calendar-gen.go 260 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395
  1. // Package calendar provides access to the Calendar API.
  2. //
  3. // See https://developers.google.com/google-apps/calendar/firstapp
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/calendar/v3"
  8. // ...
  9. // calendarService, err := calendar.New(oauthHttpClient)
  10. package calendar // import "google.golang.org/api/calendar/v3"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "calendar:v3"
  41. const apiName = "calendar"
  42. const apiVersion = "v3"
  43. const basePath = "https://www.googleapis.com/calendar/v3/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // Manage your calendars
  47. CalendarScope = "https://www.googleapis.com/auth/calendar"
  48. // View your calendars
  49. CalendarReadonlyScope = "https://www.googleapis.com/auth/calendar.readonly"
  50. )
  51. func New(client *http.Client) (*Service, error) {
  52. if client == nil {
  53. return nil, errors.New("client is nil")
  54. }
  55. s := &Service{client: client, BasePath: basePath}
  56. s.Acl = NewAclService(s)
  57. s.CalendarList = NewCalendarListService(s)
  58. s.Calendars = NewCalendarsService(s)
  59. s.Channels = NewChannelsService(s)
  60. s.Colors = NewColorsService(s)
  61. s.Events = NewEventsService(s)
  62. s.Freebusy = NewFreebusyService(s)
  63. s.Settings = NewSettingsService(s)
  64. return s, nil
  65. }
  66. type Service struct {
  67. client *http.Client
  68. BasePath string // API endpoint base URL
  69. UserAgent string // optional additional User-Agent fragment
  70. Acl *AclService
  71. CalendarList *CalendarListService
  72. Calendars *CalendarsService
  73. Channels *ChannelsService
  74. Colors *ColorsService
  75. Events *EventsService
  76. Freebusy *FreebusyService
  77. Settings *SettingsService
  78. }
  79. func (s *Service) userAgent() string {
  80. if s.UserAgent == "" {
  81. return googleapi.UserAgent
  82. }
  83. return googleapi.UserAgent + " " + s.UserAgent
  84. }
  85. func NewAclService(s *Service) *AclService {
  86. rs := &AclService{s: s}
  87. return rs
  88. }
  89. type AclService struct {
  90. s *Service
  91. }
  92. func NewCalendarListService(s *Service) *CalendarListService {
  93. rs := &CalendarListService{s: s}
  94. return rs
  95. }
  96. type CalendarListService struct {
  97. s *Service
  98. }
  99. func NewCalendarsService(s *Service) *CalendarsService {
  100. rs := &CalendarsService{s: s}
  101. return rs
  102. }
  103. type CalendarsService struct {
  104. s *Service
  105. }
  106. func NewChannelsService(s *Service) *ChannelsService {
  107. rs := &ChannelsService{s: s}
  108. return rs
  109. }
  110. type ChannelsService struct {
  111. s *Service
  112. }
  113. func NewColorsService(s *Service) *ColorsService {
  114. rs := &ColorsService{s: s}
  115. return rs
  116. }
  117. type ColorsService struct {
  118. s *Service
  119. }
  120. func NewEventsService(s *Service) *EventsService {
  121. rs := &EventsService{s: s}
  122. return rs
  123. }
  124. type EventsService struct {
  125. s *Service
  126. }
  127. func NewFreebusyService(s *Service) *FreebusyService {
  128. rs := &FreebusyService{s: s}
  129. return rs
  130. }
  131. type FreebusyService struct {
  132. s *Service
  133. }
  134. func NewSettingsService(s *Service) *SettingsService {
  135. rs := &SettingsService{s: s}
  136. return rs
  137. }
  138. type SettingsService struct {
  139. s *Service
  140. }
  141. type Acl struct {
  142. // Etag: ETag of the collection.
  143. Etag string `json:"etag,omitempty"`
  144. // Items: List of rules on the access control list.
  145. Items []*AclRule `json:"items,omitempty"`
  146. // Kind: Type of the collection ("calendar#acl").
  147. Kind string `json:"kind,omitempty"`
  148. // NextPageToken: Token used to access the next page of this result.
  149. // Omitted if no further results are available, in which case
  150. // nextSyncToken is provided.
  151. NextPageToken string `json:"nextPageToken,omitempty"`
  152. // NextSyncToken: Token used at a later point in time to retrieve only
  153. // the entries that have changed since this result was returned. Omitted
  154. // if further results are available, in which case nextPageToken is
  155. // provided.
  156. NextSyncToken string `json:"nextSyncToken,omitempty"`
  157. // ServerResponse contains the HTTP response code and headers from the
  158. // server.
  159. googleapi.ServerResponse `json:"-"`
  160. // ForceSendFields is a list of field names (e.g. "Etag") to
  161. // unconditionally include in API requests. By default, fields with
  162. // empty values are omitted from API requests. However, any non-pointer,
  163. // non-interface field appearing in ForceSendFields will be sent to the
  164. // server regardless of whether the field is empty or not. This may be
  165. // used to include empty fields in Patch requests.
  166. ForceSendFields []string `json:"-"`
  167. }
  168. func (s *Acl) MarshalJSON() ([]byte, error) {
  169. type noMethod Acl
  170. raw := noMethod(*s)
  171. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  172. }
  173. type AclRule struct {
  174. // Etag: ETag of the resource.
  175. Etag string `json:"etag,omitempty"`
  176. // Id: Identifier of the ACL rule.
  177. Id string `json:"id,omitempty"`
  178. // Kind: Type of the resource ("calendar#aclRule").
  179. Kind string `json:"kind,omitempty"`
  180. // Role: The role assigned to the scope. Possible values are:
  181. // - "none" - Provides no access.
  182. // - "freeBusyReader" - Provides read access to free/busy information.
  183. //
  184. // - "reader" - Provides read access to the calendar. Private events
  185. // will appear to users with reader access, but event details will be
  186. // hidden.
  187. // - "writer" - Provides read and write access to the calendar. Private
  188. // events will appear to users with writer access, and event details
  189. // will be visible.
  190. // - "owner" - Provides ownership of the calendar. This role has all of
  191. // the permissions of the writer role with the additional ability to see
  192. // and manipulate ACLs.
  193. Role string `json:"role,omitempty"`
  194. // Scope: The scope of the rule.
  195. Scope *AclRuleScope `json:"scope,omitempty"`
  196. // ServerResponse contains the HTTP response code and headers from the
  197. // server.
  198. googleapi.ServerResponse `json:"-"`
  199. // ForceSendFields is a list of field names (e.g. "Etag") to
  200. // unconditionally include in API requests. By default, fields with
  201. // empty values are omitted from API requests. However, any non-pointer,
  202. // non-interface field appearing in ForceSendFields will be sent to the
  203. // server regardless of whether the field is empty or not. This may be
  204. // used to include empty fields in Patch requests.
  205. ForceSendFields []string `json:"-"`
  206. }
  207. func (s *AclRule) MarshalJSON() ([]byte, error) {
  208. type noMethod AclRule
  209. raw := noMethod(*s)
  210. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  211. }
  212. // AclRuleScope: The scope of the rule.
  213. type AclRuleScope struct {
  214. // Type: The type of the scope. Possible values are:
  215. // - "default" - The public scope. This is the default value.
  216. // - "user" - Limits the scope to a single user.
  217. // - "group" - Limits the scope to a group.
  218. // - "domain" - Limits the scope to a domain. Note: The permissions
  219. // granted to the "default", or public, scope apply to any user,
  220. // authenticated or not.
  221. Type string `json:"type,omitempty"`
  222. // Value: The email address of a user or group, or the name of a domain,
  223. // depending on the scope type. Omitted for type "default".
  224. Value string `json:"value,omitempty"`
  225. // ForceSendFields is a list of field names (e.g. "Type") to
  226. // unconditionally include in API requests. By default, fields with
  227. // empty values are omitted from API requests. However, any non-pointer,
  228. // non-interface field appearing in ForceSendFields will be sent to the
  229. // server regardless of whether the field is empty or not. This may be
  230. // used to include empty fields in Patch requests.
  231. ForceSendFields []string `json:"-"`
  232. }
  233. func (s *AclRuleScope) MarshalJSON() ([]byte, error) {
  234. type noMethod AclRuleScope
  235. raw := noMethod(*s)
  236. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  237. }
  238. type Calendar struct {
  239. // Description: Description of the calendar. Optional.
  240. Description string `json:"description,omitempty"`
  241. // Etag: ETag of the resource.
  242. Etag string `json:"etag,omitempty"`
  243. // Id: Identifier of the calendar. To retrieve IDs call the
  244. // calendarList.list() method.
  245. Id string `json:"id,omitempty"`
  246. // Kind: Type of the resource ("calendar#calendar").
  247. Kind string `json:"kind,omitempty"`
  248. // Location: Geographic location of the calendar as free-form text.
  249. // Optional.
  250. Location string `json:"location,omitempty"`
  251. // Summary: Title of the calendar.
  252. Summary string `json:"summary,omitempty"`
  253. // TimeZone: The time zone of the calendar. (Formatted as an IANA Time
  254. // Zone Database name, e.g. "Europe/Zurich".) Optional.
  255. TimeZone string `json:"timeZone,omitempty"`
  256. // ServerResponse contains the HTTP response code and headers from the
  257. // server.
  258. googleapi.ServerResponse `json:"-"`
  259. // ForceSendFields is a list of field names (e.g. "Description") to
  260. // unconditionally include in API requests. By default, fields with
  261. // empty values are omitted from API requests. However, any non-pointer,
  262. // non-interface field appearing in ForceSendFields will be sent to the
  263. // server regardless of whether the field is empty or not. This may be
  264. // used to include empty fields in Patch requests.
  265. ForceSendFields []string `json:"-"`
  266. }
  267. func (s *Calendar) MarshalJSON() ([]byte, error) {
  268. type noMethod Calendar
  269. raw := noMethod(*s)
  270. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  271. }
  272. type CalendarList struct {
  273. // Etag: ETag of the collection.
  274. Etag string `json:"etag,omitempty"`
  275. // Items: Calendars that are present on the user's calendar list.
  276. Items []*CalendarListEntry `json:"items,omitempty"`
  277. // Kind: Type of the collection ("calendar#calendarList").
  278. Kind string `json:"kind,omitempty"`
  279. // NextPageToken: Token used to access the next page of this result.
  280. // Omitted if no further results are available, in which case
  281. // nextSyncToken is provided.
  282. NextPageToken string `json:"nextPageToken,omitempty"`
  283. // NextSyncToken: Token used at a later point in time to retrieve only
  284. // the entries that have changed since this result was returned. Omitted
  285. // if further results are available, in which case nextPageToken is
  286. // provided.
  287. NextSyncToken string `json:"nextSyncToken,omitempty"`
  288. // ServerResponse contains the HTTP response code and headers from the
  289. // server.
  290. googleapi.ServerResponse `json:"-"`
  291. // ForceSendFields is a list of field names (e.g. "Etag") to
  292. // unconditionally include in API requests. By default, fields with
  293. // empty values are omitted from API requests. However, any non-pointer,
  294. // non-interface field appearing in ForceSendFields will be sent to the
  295. // server regardless of whether the field is empty or not. This may be
  296. // used to include empty fields in Patch requests.
  297. ForceSendFields []string `json:"-"`
  298. }
  299. func (s *CalendarList) MarshalJSON() ([]byte, error) {
  300. type noMethod CalendarList
  301. raw := noMethod(*s)
  302. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  303. }
  304. type CalendarListEntry struct {
  305. // AccessRole: The effective access role that the authenticated user has
  306. // on the calendar. Read-only. Possible values are:
  307. // - "freeBusyReader" - Provides read access to free/busy information.
  308. //
  309. // - "reader" - Provides read access to the calendar. Private events
  310. // will appear to users with reader access, but event details will be
  311. // hidden.
  312. // - "writer" - Provides read and write access to the calendar. Private
  313. // events will appear to users with writer access, and event details
  314. // will be visible.
  315. // - "owner" - Provides ownership of the calendar. This role has all of
  316. // the permissions of the writer role with the additional ability to see
  317. // and manipulate ACLs.
  318. AccessRole string `json:"accessRole,omitempty"`
  319. // BackgroundColor: The main color of the calendar in the hexadecimal
  320. // format "#0088aa". This property supersedes the index-based colorId
  321. // property. To set or change this property, you need to specify
  322. // colorRgbFormat=true in the parameters of the insert, update and patch
  323. // methods. Optional.
  324. BackgroundColor string `json:"backgroundColor,omitempty"`
  325. // ColorId: The color of the calendar. This is an ID referring to an
  326. // entry in the calendar section of the colors definition (see the
  327. // colors endpoint). This property is superseded by the backgroundColor
  328. // and foregroundColor properties and can be ignored when using these
  329. // properties. Optional.
  330. ColorId string `json:"colorId,omitempty"`
  331. // DefaultReminders: The default reminders that the authenticated user
  332. // has for this calendar.
  333. DefaultReminders []*EventReminder `json:"defaultReminders,omitempty"`
  334. // Deleted: Whether this calendar list entry has been deleted from the
  335. // calendar list. Read-only. Optional. The default is False.
  336. Deleted bool `json:"deleted,omitempty"`
  337. // Description: Description of the calendar. Optional. Read-only.
  338. Description string `json:"description,omitempty"`
  339. // Etag: ETag of the resource.
  340. Etag string `json:"etag,omitempty"`
  341. // ForegroundColor: The foreground color of the calendar in the
  342. // hexadecimal format "#ffffff". This property supersedes the
  343. // index-based colorId property. To set or change this property, you
  344. // need to specify colorRgbFormat=true in the parameters of the insert,
  345. // update and patch methods. Optional.
  346. ForegroundColor string `json:"foregroundColor,omitempty"`
  347. // Hidden: Whether the calendar has been hidden from the list. Optional.
  348. // The default is False.
  349. Hidden bool `json:"hidden,omitempty"`
  350. // Id: Identifier of the calendar.
  351. Id string `json:"id,omitempty"`
  352. // Kind: Type of the resource ("calendar#calendarListEntry").
  353. Kind string `json:"kind,omitempty"`
  354. // Location: Geographic location of the calendar as free-form text.
  355. // Optional. Read-only.
  356. Location string `json:"location,omitempty"`
  357. // NotificationSettings: The notifications that the authenticated user
  358. // is receiving for this calendar.
  359. NotificationSettings *CalendarListEntryNotificationSettings `json:"notificationSettings,omitempty"`
  360. // Primary: Whether the calendar is the primary calendar of the
  361. // authenticated user. Read-only. Optional. The default is False.
  362. Primary bool `json:"primary,omitempty"`
  363. // Selected: Whether the calendar content shows up in the calendar UI.
  364. // Optional. The default is False.
  365. Selected bool `json:"selected,omitempty"`
  366. // Summary: Title of the calendar. Read-only.
  367. Summary string `json:"summary,omitempty"`
  368. // SummaryOverride: The summary that the authenticated user has set for
  369. // this calendar. Optional.
  370. SummaryOverride string `json:"summaryOverride,omitempty"`
  371. // TimeZone: The time zone of the calendar. Optional. Read-only.
  372. TimeZone string `json:"timeZone,omitempty"`
  373. // ServerResponse contains the HTTP response code and headers from the
  374. // server.
  375. googleapi.ServerResponse `json:"-"`
  376. // ForceSendFields is a list of field names (e.g. "AccessRole") to
  377. // unconditionally include in API requests. By default, fields with
  378. // empty values are omitted from API requests. However, any non-pointer,
  379. // non-interface field appearing in ForceSendFields will be sent to the
  380. // server regardless of whether the field is empty or not. This may be
  381. // used to include empty fields in Patch requests.
  382. ForceSendFields []string `json:"-"`
  383. }
  384. func (s *CalendarListEntry) MarshalJSON() ([]byte, error) {
  385. type noMethod CalendarListEntry
  386. raw := noMethod(*s)
  387. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  388. }
  389. // CalendarListEntryNotificationSettings: The notifications that the
  390. // authenticated user is receiving for this calendar.
  391. type CalendarListEntryNotificationSettings struct {
  392. // Notifications: The list of notifications set for this calendar.
  393. Notifications []*CalendarNotification `json:"notifications,omitempty"`
  394. // ForceSendFields is a list of field names (e.g. "Notifications") to
  395. // unconditionally include in API requests. By default, fields with
  396. // empty values are omitted from API requests. However, any non-pointer,
  397. // non-interface field appearing in ForceSendFields will be sent to the
  398. // server regardless of whether the field is empty or not. This may be
  399. // used to include empty fields in Patch requests.
  400. ForceSendFields []string `json:"-"`
  401. }
  402. func (s *CalendarListEntryNotificationSettings) MarshalJSON() ([]byte, error) {
  403. type noMethod CalendarListEntryNotificationSettings
  404. raw := noMethod(*s)
  405. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  406. }
  407. type CalendarNotification struct {
  408. // Method: The method used to deliver the notification. Possible values
  409. // are:
  410. // - "email" - Reminders are sent via email.
  411. // - "sms" - Reminders are sent via SMS. This value is read-only and is
  412. // ignored on inserts and updates. SMS reminders are only available for
  413. // Google Apps for Work, Education, and Government customers.
  414. Method string `json:"method,omitempty"`
  415. // Type: The type of notification. Possible values are:
  416. // - "eventCreation" - Notification sent when a new event is put on the
  417. // calendar.
  418. // - "eventChange" - Notification sent when an event is changed.
  419. // - "eventCancellation" - Notification sent when an event is cancelled.
  420. //
  421. // - "eventResponse" - Notification sent when an event is changed.
  422. // - "agenda" - An agenda with the events of the day (sent out in the
  423. // morning).
  424. Type string `json:"type,omitempty"`
  425. // ForceSendFields is a list of field names (e.g. "Method") to
  426. // unconditionally include in API requests. By default, fields with
  427. // empty values are omitted from API requests. However, any non-pointer,
  428. // non-interface field appearing in ForceSendFields will be sent to the
  429. // server regardless of whether the field is empty or not. This may be
  430. // used to include empty fields in Patch requests.
  431. ForceSendFields []string `json:"-"`
  432. }
  433. func (s *CalendarNotification) MarshalJSON() ([]byte, error) {
  434. type noMethod CalendarNotification
  435. raw := noMethod(*s)
  436. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  437. }
  438. type Channel struct {
  439. // Address: The address where notifications are delivered for this
  440. // channel.
  441. Address string `json:"address,omitempty"`
  442. // Expiration: Date and time of notification channel expiration,
  443. // expressed as a Unix timestamp, in milliseconds. Optional.
  444. Expiration int64 `json:"expiration,omitempty,string"`
  445. // Id: A UUID or similar unique string that identifies this channel.
  446. Id string `json:"id,omitempty"`
  447. // Kind: Identifies this as a notification channel used to watch for
  448. // changes to a resource. Value: the fixed string "api#channel".
  449. Kind string `json:"kind,omitempty"`
  450. // Params: Additional parameters controlling delivery channel behavior.
  451. // Optional.
  452. Params map[string]string `json:"params,omitempty"`
  453. // Payload: A Boolean value to indicate whether payload is wanted.
  454. // Optional.
  455. Payload bool `json:"payload,omitempty"`
  456. // ResourceId: An opaque ID that identifies the resource being watched
  457. // on this channel. Stable across different API versions.
  458. ResourceId string `json:"resourceId,omitempty"`
  459. // ResourceUri: A version-specific identifier for the watched resource.
  460. ResourceUri string `json:"resourceUri,omitempty"`
  461. // Token: An arbitrary string delivered to the target address with each
  462. // notification delivered over this channel. Optional.
  463. Token string `json:"token,omitempty"`
  464. // Type: The type of delivery mechanism used for this channel.
  465. Type string `json:"type,omitempty"`
  466. // ServerResponse contains the HTTP response code and headers from the
  467. // server.
  468. googleapi.ServerResponse `json:"-"`
  469. // ForceSendFields is a list of field names (e.g. "Address") to
  470. // unconditionally include in API requests. By default, fields with
  471. // empty values are omitted from API requests. However, any non-pointer,
  472. // non-interface field appearing in ForceSendFields will be sent to the
  473. // server regardless of whether the field is empty or not. This may be
  474. // used to include empty fields in Patch requests.
  475. ForceSendFields []string `json:"-"`
  476. }
  477. func (s *Channel) MarshalJSON() ([]byte, error) {
  478. type noMethod Channel
  479. raw := noMethod(*s)
  480. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  481. }
  482. type ColorDefinition struct {
  483. // Background: The background color associated with this color
  484. // definition.
  485. Background string `json:"background,omitempty"`
  486. // Foreground: The foreground color that can be used to write on top of
  487. // a background with 'background' color.
  488. Foreground string `json:"foreground,omitempty"`
  489. // ForceSendFields is a list of field names (e.g. "Background") to
  490. // unconditionally include in API requests. By default, fields with
  491. // empty values are omitted from API requests. However, any non-pointer,
  492. // non-interface field appearing in ForceSendFields will be sent to the
  493. // server regardless of whether the field is empty or not. This may be
  494. // used to include empty fields in Patch requests.
  495. ForceSendFields []string `json:"-"`
  496. }
  497. func (s *ColorDefinition) MarshalJSON() ([]byte, error) {
  498. type noMethod ColorDefinition
  499. raw := noMethod(*s)
  500. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  501. }
  502. type Colors struct {
  503. // Calendar: A global palette of calendar colors, mapping from the color
  504. // ID to its definition. A calendarListEntry resource refers to one of
  505. // these color IDs in its color field. Read-only.
  506. Calendar map[string]ColorDefinition `json:"calendar,omitempty"`
  507. // Event: A global palette of event colors, mapping from the color ID to
  508. // its definition. An event resource may refer to one of these color IDs
  509. // in its color field. Read-only.
  510. Event map[string]ColorDefinition `json:"event,omitempty"`
  511. // Kind: Type of the resource ("calendar#colors").
  512. Kind string `json:"kind,omitempty"`
  513. // Updated: Last modification time of the color palette (as a RFC3339
  514. // timestamp). Read-only.
  515. Updated string `json:"updated,omitempty"`
  516. // ServerResponse contains the HTTP response code and headers from the
  517. // server.
  518. googleapi.ServerResponse `json:"-"`
  519. // ForceSendFields is a list of field names (e.g. "Calendar") to
  520. // unconditionally include in API requests. By default, fields with
  521. // empty values are omitted from API requests. However, any non-pointer,
  522. // non-interface field appearing in ForceSendFields will be sent to the
  523. // server regardless of whether the field is empty or not. This may be
  524. // used to include empty fields in Patch requests.
  525. ForceSendFields []string `json:"-"`
  526. }
  527. func (s *Colors) MarshalJSON() ([]byte, error) {
  528. type noMethod Colors
  529. raw := noMethod(*s)
  530. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  531. }
  532. type Error struct {
  533. // Domain: Domain, or broad category, of the error.
  534. Domain string `json:"domain,omitempty"`
  535. // Reason: Specific reason for the error. Some of the possible values
  536. // are:
  537. // - "groupTooBig" - The group of users requested is too large for a
  538. // single query.
  539. // - "tooManyCalendarsRequested" - The number of calendars requested is
  540. // too large for a single query.
  541. // - "notFound" - The requested resource was not found.
  542. // - "internalError" - The API service has encountered an internal
  543. // error. Additional error types may be added in the future, so clients
  544. // should gracefully handle additional error statuses not included in
  545. // this list.
  546. Reason string `json:"reason,omitempty"`
  547. // ForceSendFields is a list of field names (e.g. "Domain") to
  548. // unconditionally include in API requests. By default, fields with
  549. // empty values are omitted from API requests. However, any non-pointer,
  550. // non-interface field appearing in ForceSendFields will be sent to the
  551. // server regardless of whether the field is empty or not. This may be
  552. // used to include empty fields in Patch requests.
  553. ForceSendFields []string `json:"-"`
  554. }
  555. func (s *Error) MarshalJSON() ([]byte, error) {
  556. type noMethod Error
  557. raw := noMethod(*s)
  558. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  559. }
  560. type Event struct {
  561. // AnyoneCanAddSelf: Whether anyone can invite themselves to the event
  562. // (currently works for Google+ events only). Optional. The default is
  563. // False.
  564. AnyoneCanAddSelf bool `json:"anyoneCanAddSelf,omitempty"`
  565. // Attachments: File attachments for the event. Currently only Google
  566. // Drive attachments are supported.
  567. // In order to modify attachments the supportsAttachments request
  568. // parameter should be set to true.
  569. // There can be at most 25 attachments per event,
  570. Attachments []*EventAttachment `json:"attachments,omitempty"`
  571. // Attendees: The attendees of the event. See the Events with attendees
  572. // guide for more information on scheduling events with other calendar
  573. // users.
  574. Attendees []*EventAttendee `json:"attendees,omitempty"`
  575. // AttendeesOmitted: Whether attendees may have been omitted from the
  576. // event's representation. When retrieving an event, this may be due to
  577. // a restriction specified by the maxAttendee query parameter. When
  578. // updating an event, this can be used to only update the participant's
  579. // response. Optional. The default is False.
  580. AttendeesOmitted bool `json:"attendeesOmitted,omitempty"`
  581. // ColorId: The color of the event. This is an ID referring to an entry
  582. // in the event section of the colors definition (see the colors
  583. // endpoint). Optional.
  584. ColorId string `json:"colorId,omitempty"`
  585. // Created: Creation time of the event (as a RFC3339 timestamp).
  586. // Read-only.
  587. Created string `json:"created,omitempty"`
  588. // Creator: The creator of the event. Read-only.
  589. Creator *EventCreator `json:"creator,omitempty"`
  590. // Description: Description of the event. Optional.
  591. Description string `json:"description,omitempty"`
  592. // End: The (exclusive) end time of the event. For a recurring event,
  593. // this is the end time of the first instance.
  594. End *EventDateTime `json:"end,omitempty"`
  595. // EndTimeUnspecified: Whether the end time is actually unspecified. An
  596. // end time is still provided for compatibility reasons, even if this
  597. // attribute is set to True. The default is False.
  598. EndTimeUnspecified bool `json:"endTimeUnspecified,omitempty"`
  599. // Etag: ETag of the resource.
  600. Etag string `json:"etag,omitempty"`
  601. // ExtendedProperties: Extended properties of the event.
  602. ExtendedProperties *EventExtendedProperties `json:"extendedProperties,omitempty"`
  603. // Gadget: A gadget that extends this event.
  604. Gadget *EventGadget `json:"gadget,omitempty"`
  605. // GuestsCanInviteOthers: Whether attendees other than the organizer can
  606. // invite others to the event. Optional. The default is True.
  607. //
  608. // Default: true
  609. GuestsCanInviteOthers *bool `json:"guestsCanInviteOthers,omitempty"`
  610. // GuestsCanModify: Whether attendees other than the organizer can
  611. // modify the event. Optional. The default is False.
  612. GuestsCanModify bool `json:"guestsCanModify,omitempty"`
  613. // GuestsCanSeeOtherGuests: Whether attendees other than the organizer
  614. // can see who the event's attendees are. Optional. The default is True.
  615. //
  616. // Default: true
  617. GuestsCanSeeOtherGuests *bool `json:"guestsCanSeeOtherGuests,omitempty"`
  618. // HangoutLink: An absolute link to the Google+ hangout associated with
  619. // this event. Read-only.
  620. HangoutLink string `json:"hangoutLink,omitempty"`
  621. // HtmlLink: An absolute link to this event in the Google Calendar Web
  622. // UI. Read-only.
  623. HtmlLink string `json:"htmlLink,omitempty"`
  624. // ICalUID: Event unique identifier as defined in RFC5545. It is used to
  625. // uniquely identify events accross calendaring systems and must be
  626. // supplied when importing events via the import method.
  627. // Note that the icalUID and the id are not identical and only one of
  628. // them should be supplied at event creation time. One difference in
  629. // their semantics is that in recurring events, all occurrences of one
  630. // event have different ids while they all share the same icalUIDs.
  631. ICalUID string `json:"iCalUID,omitempty"`
  632. // Id: Opaque identifier of the event. When creating new single or
  633. // recurring events, you can specify their IDs. Provided IDs must follow
  634. // these rules:
  635. // - characters allowed in the ID are those used in base32hex encoding,
  636. // i.e. lowercase letters a-v and digits 0-9, see section 3.1.2 in
  637. // RFC2938
  638. // - the length of the ID must be between 5 and 1024 characters
  639. // - the ID must be unique per calendar Due to the globally distributed
  640. // nature of the system, we cannot guarantee that ID collisions will be
  641. // detected at event creation time. To minimize the risk of collisions
  642. // we recommend using an established UUID algorithm such as one
  643. // described in RFC4122.
  644. // If you do not specify an ID, it will be automatically generated by
  645. // the server.
  646. // Note that the icalUID and the id are not identical and only one of
  647. // them should be supplied at event creation time. One difference in
  648. // their semantics is that in recurring events, all occurrences of one
  649. // event have different ids while they all share the same icalUIDs.
  650. Id string `json:"id,omitempty"`
  651. // Kind: Type of the resource ("calendar#event").
  652. Kind string `json:"kind,omitempty"`
  653. // Location: Geographic location of the event as free-form text.
  654. // Optional.
  655. Location string `json:"location,omitempty"`
  656. // Locked: Whether this is a locked event copy where no changes can be
  657. // made to the main event fields "summary", "description", "location",
  658. // "start", "end" or "recurrence". The default is False. Read-Only.
  659. Locked bool `json:"locked,omitempty"`
  660. // Organizer: The organizer of the event. If the organizer is also an
  661. // attendee, this is indicated with a separate entry in attendees with
  662. // the organizer field set to True. To change the organizer, use the
  663. // move operation. Read-only, except when importing an event.
  664. Organizer *EventOrganizer `json:"organizer,omitempty"`
  665. // OriginalStartTime: For an instance of a recurring event, this is the
  666. // time at which this event would start according to the recurrence data
  667. // in the recurring event identified by recurringEventId. Immutable.
  668. OriginalStartTime *EventDateTime `json:"originalStartTime,omitempty"`
  669. // PrivateCopy: Whether this is a private event copy where changes are
  670. // not shared with other copies on other calendars. Optional. Immutable.
  671. // The default is False.
  672. PrivateCopy bool `json:"privateCopy,omitempty"`
  673. // Recurrence: List of RRULE, EXRULE, RDATE and EXDATE lines for a
  674. // recurring event, as specified in RFC5545. Note that DTSTART and DTEND
  675. // lines are not allowed in this field; event start and end times are
  676. // specified in the start and end fields. This field is omitted for
  677. // single events or instances of recurring events.
  678. Recurrence []string `json:"recurrence,omitempty"`
  679. // RecurringEventId: For an instance of a recurring event, this is the
  680. // id of the recurring event to which this instance belongs. Immutable.
  681. RecurringEventId string `json:"recurringEventId,omitempty"`
  682. // Reminders: Information about the event's reminders for the
  683. // authenticated user.
  684. Reminders *EventReminders `json:"reminders,omitempty"`
  685. // Sequence: Sequence number as per iCalendar.
  686. Sequence int64 `json:"sequence,omitempty"`
  687. // Source: Source from which the event was created. For example, a web
  688. // page, an email message or any document identifiable by an URL with
  689. // HTTP or HTTPS scheme. Can only be seen or modified by the creator of
  690. // the event.
  691. Source *EventSource `json:"source,omitempty"`
  692. // Start: The (inclusive) start time of the event. For a recurring
  693. // event, this is the start time of the first instance.
  694. Start *EventDateTime `json:"start,omitempty"`
  695. // Status: Status of the event. Optional. Possible values are:
  696. // - "confirmed" - The event is confirmed. This is the default status.
  697. //
  698. // - "tentative" - The event is tentatively confirmed.
  699. // - "cancelled" - The event is cancelled.
  700. Status string `json:"status,omitempty"`
  701. // Summary: Title of the event.
  702. Summary string `json:"summary,omitempty"`
  703. // Transparency: Whether the event blocks time on the calendar.
  704. // Optional. Possible values are:
  705. // - "opaque" - The event blocks time on the calendar. This is the
  706. // default value.
  707. // - "transparent" - The event does not block time on the calendar.
  708. Transparency string `json:"transparency,omitempty"`
  709. // Updated: Last modification time of the event (as a RFC3339
  710. // timestamp). Read-only.
  711. Updated string `json:"updated,omitempty"`
  712. // Visibility: Visibility of the event. Optional. Possible values are:
  713. //
  714. // - "default" - Uses the default visibility for events on the calendar.
  715. // This is the default value.
  716. // - "public" - The event is public and event details are visible to all
  717. // readers of the calendar.
  718. // - "private" - The event is private and only event attendees may view
  719. // event details.
  720. // - "confidential" - The event is private. This value is provided for
  721. // compatibility reasons.
  722. Visibility string `json:"visibility,omitempty"`
  723. // ServerResponse contains the HTTP response code and headers from the
  724. // server.
  725. googleapi.ServerResponse `json:"-"`
  726. // ForceSendFields is a list of field names (e.g. "AnyoneCanAddSelf") to
  727. // unconditionally include in API requests. By default, fields with
  728. // empty values are omitted from API requests. However, any non-pointer,
  729. // non-interface field appearing in ForceSendFields will be sent to the
  730. // server regardless of whether the field is empty or not. This may be
  731. // used to include empty fields in Patch requests.
  732. ForceSendFields []string `json:"-"`
  733. }
  734. func (s *Event) MarshalJSON() ([]byte, error) {
  735. type noMethod Event
  736. raw := noMethod(*s)
  737. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  738. }
  739. // EventCreator: The creator of the event. Read-only.
  740. type EventCreator struct {
  741. // DisplayName: The creator's name, if available.
  742. DisplayName string `json:"displayName,omitempty"`
  743. // Email: The creator's email address, if available.
  744. Email string `json:"email,omitempty"`
  745. // Id: The creator's Profile ID, if available. It corresponds to theid
  746. // field in the People collection of the Google+ API
  747. Id string `json:"id,omitempty"`
  748. // Self: Whether the creator corresponds to the calendar on which this
  749. // copy of the event appears. Read-only. The default is False.
  750. Self bool `json:"self,omitempty"`
  751. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  752. // unconditionally include in API requests. By default, fields with
  753. // empty values are omitted from API requests. However, any non-pointer,
  754. // non-interface field appearing in ForceSendFields will be sent to the
  755. // server regardless of whether the field is empty or not. This may be
  756. // used to include empty fields in Patch requests.
  757. ForceSendFields []string `json:"-"`
  758. }
  759. func (s *EventCreator) MarshalJSON() ([]byte, error) {
  760. type noMethod EventCreator
  761. raw := noMethod(*s)
  762. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  763. }
  764. // EventExtendedProperties: Extended properties of the event.
  765. type EventExtendedProperties struct {
  766. // Private: Properties that are private to the copy of the event that
  767. // appears on this calendar.
  768. Private map[string]string `json:"private,omitempty"`
  769. // Shared: Properties that are shared between copies of the event on
  770. // other attendees' calendars.
  771. Shared map[string]string `json:"shared,omitempty"`
  772. // ForceSendFields is a list of field names (e.g. "Private") to
  773. // unconditionally include in API requests. By default, fields with
  774. // empty values are omitted from API requests. However, any non-pointer,
  775. // non-interface field appearing in ForceSendFields will be sent to the
  776. // server regardless of whether the field is empty or not. This may be
  777. // used to include empty fields in Patch requests.
  778. ForceSendFields []string `json:"-"`
  779. }
  780. func (s *EventExtendedProperties) MarshalJSON() ([]byte, error) {
  781. type noMethod EventExtendedProperties
  782. raw := noMethod(*s)
  783. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  784. }
  785. // EventGadget: A gadget that extends this event.
  786. type EventGadget struct {
  787. // Display: The gadget's display mode. Optional. Possible values are:
  788. //
  789. // - "icon" - The gadget displays next to the event's title in the
  790. // calendar view.
  791. // - "chip" - The gadget displays when the event is clicked.
  792. Display string `json:"display,omitempty"`
  793. // Height: The gadget's height in pixels. The height must be an integer
  794. // greater than 0. Optional.
  795. Height int64 `json:"height,omitempty"`
  796. // IconLink: The gadget's icon URL. The URL scheme must be HTTPS.
  797. IconLink string `json:"iconLink,omitempty"`
  798. // Link: The gadget's URL. The URL scheme must be HTTPS.
  799. Link string `json:"link,omitempty"`
  800. // Preferences: Preferences.
  801. Preferences map[string]string `json:"preferences,omitempty"`
  802. // Title: The gadget's title.
  803. Title string `json:"title,omitempty"`
  804. // Type: The gadget's type.
  805. Type string `json:"type,omitempty"`
  806. // Width: The gadget's width in pixels. The width must be an integer
  807. // greater than 0. Optional.
  808. Width int64 `json:"width,omitempty"`
  809. // ForceSendFields is a list of field names (e.g. "Display") to
  810. // unconditionally include in API requests. By default, fields with
  811. // empty values are omitted from API requests. However, any non-pointer,
  812. // non-interface field appearing in ForceSendFields will be sent to the
  813. // server regardless of whether the field is empty or not. This may be
  814. // used to include empty fields in Patch requests.
  815. ForceSendFields []string `json:"-"`
  816. }
  817. func (s *EventGadget) MarshalJSON() ([]byte, error) {
  818. type noMethod EventGadget
  819. raw := noMethod(*s)
  820. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  821. }
  822. // EventOrganizer: The organizer of the event. If the organizer is also
  823. // an attendee, this is indicated with a separate entry in attendees
  824. // with the organizer field set to True. To change the organizer, use
  825. // the move operation. Read-only, except when importing an event.
  826. type EventOrganizer struct {
  827. // DisplayName: The organizer's name, if available.
  828. DisplayName string `json:"displayName,omitempty"`
  829. // Email: The organizer's email address, if available. It must be a
  830. // valid email address as per RFC5322.
  831. Email string `json:"email,omitempty"`
  832. // Id: The organizer's Profile ID, if available. It corresponds to theid
  833. // field in the People collection of the Google+ API
  834. Id string `json:"id,omitempty"`
  835. // Self: Whether the organizer corresponds to the calendar on which this
  836. // copy of the event appears. Read-only. The default is False.
  837. Self bool `json:"self,omitempty"`
  838. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  839. // unconditionally include in API requests. By default, fields with
  840. // empty values are omitted from API requests. However, any non-pointer,
  841. // non-interface field appearing in ForceSendFields will be sent to the
  842. // server regardless of whether the field is empty or not. This may be
  843. // used to include empty fields in Patch requests.
  844. ForceSendFields []string `json:"-"`
  845. }
  846. func (s *EventOrganizer) MarshalJSON() ([]byte, error) {
  847. type noMethod EventOrganizer
  848. raw := noMethod(*s)
  849. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  850. }
  851. // EventReminders: Information about the event's reminders for the
  852. // authenticated user.
  853. type EventReminders struct {
  854. // Overrides: If the event doesn't use the default reminders, this lists
  855. // the reminders specific to the event, or, if not set, indicates that
  856. // no reminders are set for this event. The maximum number of override
  857. // reminders is 5.
  858. Overrides []*EventReminder `json:"overrides,omitempty"`
  859. // UseDefault: Whether the default reminders of the calendar apply to
  860. // the event.
  861. UseDefault bool `json:"useDefault,omitempty"`
  862. // ForceSendFields is a list of field names (e.g. "Overrides") to
  863. // unconditionally include in API requests. By default, fields with
  864. // empty values are omitted from API requests. However, any non-pointer,
  865. // non-interface field appearing in ForceSendFields will be sent to the
  866. // server regardless of whether the field is empty or not. This may be
  867. // used to include empty fields in Patch requests.
  868. ForceSendFields []string `json:"-"`
  869. }
  870. func (s *EventReminders) MarshalJSON() ([]byte, error) {
  871. type noMethod EventReminders
  872. raw := noMethod(*s)
  873. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  874. }
  875. // EventSource: Source from which the event was created. For example, a
  876. // web page, an email message or any document identifiable by an URL
  877. // with HTTP or HTTPS scheme. Can only be seen or modified by the
  878. // creator of the event.
  879. type EventSource struct {
  880. // Title: Title of the source; for example a title of a web page or an
  881. // email subject.
  882. Title string `json:"title,omitempty"`
  883. // Url: URL of the source pointing to a resource. The URL scheme must be
  884. // HTTP or HTTPS.
  885. Url string `json:"url,omitempty"`
  886. // ForceSendFields is a list of field names (e.g. "Title") to
  887. // unconditionally include in API requests. By default, fields with
  888. // empty values are omitted from API requests. However, any non-pointer,
  889. // non-interface field appearing in ForceSendFields will be sent to the
  890. // server regardless of whether the field is empty or not. This may be
  891. // used to include empty fields in Patch requests.
  892. ForceSendFields []string `json:"-"`
  893. }
  894. func (s *EventSource) MarshalJSON() ([]byte, error) {
  895. type noMethod EventSource
  896. raw := noMethod(*s)
  897. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  898. }
  899. type EventAttachment struct {
  900. // FileId: ID of the attached file. Read-only.
  901. // For Google Drive files, this is the ID of the corresponding Files
  902. // resource entry in the Drive API.
  903. FileId string `json:"fileId,omitempty"`
  904. // FileUrl: URL link to the attachment.
  905. // For adding Google Drive file attachments use the same format as in
  906. // alternateLink property of the Files resource in the Drive API.
  907. FileUrl string `json:"fileUrl,omitempty"`
  908. // IconLink: URL link to the attachment's icon. Read-only.
  909. IconLink string `json:"iconLink,omitempty"`
  910. // MimeType: Internet media type (MIME type) of the attachment.
  911. MimeType string `json:"mimeType,omitempty"`
  912. // Title: Attachment title.
  913. Title string `json:"title,omitempty"`
  914. // ForceSendFields is a list of field names (e.g. "FileId") to
  915. // unconditionally include in API requests. By default, fields with
  916. // empty values are omitted from API requests. However, any non-pointer,
  917. // non-interface field appearing in ForceSendFields will be sent to the
  918. // server regardless of whether the field is empty or not. This may be
  919. // used to include empty fields in Patch requests.
  920. ForceSendFields []string `json:"-"`
  921. }
  922. func (s *EventAttachment) MarshalJSON() ([]byte, error) {
  923. type noMethod EventAttachment
  924. raw := noMethod(*s)
  925. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  926. }
  927. type EventAttendee struct {
  928. // AdditionalGuests: Number of additional guests. Optional. The default
  929. // is 0.
  930. AdditionalGuests int64 `json:"additionalGuests,omitempty"`
  931. // Comment: The attendee's response comment. Optional.
  932. Comment string `json:"comment,omitempty"`
  933. // DisplayName: The attendee's name, if available. Optional.
  934. DisplayName string `json:"displayName,omitempty"`
  935. // Email: The attendee's email address, if available. This field must be
  936. // present when adding an attendee. It must be a valid email address as
  937. // per RFC5322.
  938. Email string `json:"email,omitempty"`
  939. // Id: The attendee's Profile ID, if available. It corresponds to theid
  940. // field in the People collection of the Google+ API
  941. Id string `json:"id,omitempty"`
  942. // Optional: Whether this is an optional attendee. Optional. The default
  943. // is False.
  944. Optional bool `json:"optional,omitempty"`
  945. // Organizer: Whether the attendee is the organizer of the event.
  946. // Read-only. The default is False.
  947. Organizer bool `json:"organizer,omitempty"`
  948. // Resource: Whether the attendee is a resource. Read-only. The default
  949. // is False.
  950. Resource bool `json:"resource,omitempty"`
  951. // ResponseStatus: The attendee's response status. Possible values are:
  952. //
  953. // - "needsAction" - The attendee has not responded to the invitation.
  954. //
  955. // - "declined" - The attendee has declined the invitation.
  956. // - "tentative" - The attendee has tentatively accepted the invitation.
  957. //
  958. // - "accepted" - The attendee has accepted the invitation.
  959. ResponseStatus string `json:"responseStatus,omitempty"`
  960. // Self: Whether this entry represents the calendar on which this copy
  961. // of the event appears. Read-only. The default is False.
  962. Self bool `json:"self,omitempty"`
  963. // ForceSendFields is a list of field names (e.g. "AdditionalGuests") to
  964. // unconditionally include in API requests. By default, fields with
  965. // empty values are omitted from API requests. However, any non-pointer,
  966. // non-interface field appearing in ForceSendFields will be sent to the
  967. // server regardless of whether the field is empty or not. This may be
  968. // used to include empty fields in Patch requests.
  969. ForceSendFields []string `json:"-"`
  970. }
  971. func (s *EventAttendee) MarshalJSON() ([]byte, error) {
  972. type noMethod EventAttendee
  973. raw := noMethod(*s)
  974. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  975. }
  976. type EventDateTime struct {
  977. // Date: The date, in the format "yyyy-mm-dd", if this is an all-day
  978. // event.
  979. Date string `json:"date,omitempty"`
  980. // DateTime: The time, as a combined date-time value (formatted
  981. // according to RFC3339). A time zone offset is required unless a time
  982. // zone is explicitly specified in timeZone.
  983. DateTime string `json:"dateTime,omitempty"`
  984. // TimeZone: The time zone in which the time is specified. (Formatted as
  985. // an IANA Time Zone Database name, e.g. "Europe/Zurich".) For recurring
  986. // events this field is required and specifies the time zone in which
  987. // the recurrence is expanded. For single events this field is optional
  988. // and indicates a custom time zone for the event start/end.
  989. TimeZone string `json:"timeZone,omitempty"`
  990. // ForceSendFields is a list of field names (e.g. "Date") to
  991. // unconditionally include in API requests. By default, fields with
  992. // empty values are omitted from API requests. However, any non-pointer,
  993. // non-interface field appearing in ForceSendFields will be sent to the
  994. // server regardless of whether the field is empty or not. This may be
  995. // used to include empty fields in Patch requests.
  996. ForceSendFields []string `json:"-"`
  997. }
  998. func (s *EventDateTime) MarshalJSON() ([]byte, error) {
  999. type noMethod EventDateTime
  1000. raw := noMethod(*s)
  1001. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1002. }
  1003. type EventReminder struct {
  1004. // Method: The method used by this reminder. Possible values are:
  1005. // - "email" - Reminders are sent via email.
  1006. // - "sms" - Reminders are sent via SMS. These are only available for
  1007. // Google Apps for Work, Education, and Government customers. Requests
  1008. // to set SMS reminders for other account types are ignored.
  1009. // - "popup" - Reminders are sent via a UI popup.
  1010. Method string `json:"method,omitempty"`
  1011. // Minutes: Number of minutes before the start of the event when the
  1012. // reminder should trigger. Valid values are between 0 and 40320 (4
  1013. // weeks in minutes).
  1014. Minutes int64 `json:"minutes,omitempty"`
  1015. // ForceSendFields is a list of field names (e.g. "Method") to
  1016. // unconditionally include in API requests. By default, fields with
  1017. // empty values are omitted from API requests. However, any non-pointer,
  1018. // non-interface field appearing in ForceSendFields will be sent to the
  1019. // server regardless of whether the field is empty or not. This may be
  1020. // used to include empty fields in Patch requests.
  1021. ForceSendFields []string `json:"-"`
  1022. }
  1023. func (s *EventReminder) MarshalJSON() ([]byte, error) {
  1024. type noMethod EventReminder
  1025. raw := noMethod(*s)
  1026. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1027. }
  1028. type Events struct {
  1029. // AccessRole: The user's access role for this calendar. Read-only.
  1030. // Possible values are:
  1031. // - "none" - The user has no access.
  1032. // - "freeBusyReader" - The user has read access to free/busy
  1033. // information.
  1034. // - "reader" - The user has read access to the calendar. Private events
  1035. // will appear to users with reader access, but event details will be
  1036. // hidden.
  1037. // - "writer" - The user has read and write access to the calendar.
  1038. // Private events will appear to users with writer access, and event
  1039. // details will be visible.
  1040. // - "owner" - The user has ownership of the calendar. This role has all
  1041. // of the permissions of the writer role with the additional ability to
  1042. // see and manipulate ACLs.
  1043. AccessRole string `json:"accessRole,omitempty"`
  1044. // DefaultReminders: The default reminders on the calendar for the
  1045. // authenticated user. These reminders apply to all events on this
  1046. // calendar that do not explicitly override them (i.e. do not have
  1047. // reminders.useDefault set to True).
  1048. DefaultReminders []*EventReminder `json:"defaultReminders,omitempty"`
  1049. // Description: Description of the calendar. Read-only.
  1050. Description string `json:"description,omitempty"`
  1051. // Etag: ETag of the collection.
  1052. Etag string `json:"etag,omitempty"`
  1053. // Items: List of events on the calendar.
  1054. Items []*Event `json:"items,omitempty"`
  1055. // Kind: Type of the collection ("calendar#events").
  1056. Kind string `json:"kind,omitempty"`
  1057. // NextPageToken: Token used to access the next page of this result.
  1058. // Omitted if no further results are available, in which case
  1059. // nextSyncToken is provided.
  1060. NextPageToken string `json:"nextPageToken,omitempty"`
  1061. // NextSyncToken: Token used at a later point in time to retrieve only
  1062. // the entries that have changed since this result was returned. Omitted
  1063. // if further results are available, in which case nextPageToken is
  1064. // provided.
  1065. NextSyncToken string `json:"nextSyncToken,omitempty"`
  1066. // Summary: Title of the calendar. Read-only.
  1067. Summary string `json:"summary,omitempty"`
  1068. // TimeZone: The time zone of the calendar. Read-only.
  1069. TimeZone string `json:"timeZone,omitempty"`
  1070. // Updated: Last modification time of the calendar (as a RFC3339
  1071. // timestamp). Read-only.
  1072. Updated string `json:"updated,omitempty"`
  1073. // ServerResponse contains the HTTP response code and headers from the
  1074. // server.
  1075. googleapi.ServerResponse `json:"-"`
  1076. // ForceSendFields is a list of field names (e.g. "AccessRole") to
  1077. // unconditionally include in API requests. By default, fields with
  1078. // empty values are omitted from API requests. However, any non-pointer,
  1079. // non-interface field appearing in ForceSendFields will be sent to the
  1080. // server regardless of whether the field is empty or not. This may be
  1081. // used to include empty fields in Patch requests.
  1082. ForceSendFields []string `json:"-"`
  1083. }
  1084. func (s *Events) MarshalJSON() ([]byte, error) {
  1085. type noMethod Events
  1086. raw := noMethod(*s)
  1087. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1088. }
  1089. type FreeBusyCalendar struct {
  1090. // Busy: List of time ranges during which this calendar should be
  1091. // regarded as busy.
  1092. Busy []*TimePeriod `json:"busy,omitempty"`
  1093. // Errors: Optional error(s) (if computation for the calendar failed).
  1094. Errors []*Error `json:"errors,omitempty"`
  1095. // ForceSendFields is a list of field names (e.g. "Busy") to
  1096. // unconditionally include in API requests. By default, fields with
  1097. // empty values are omitted from API requests. However, any non-pointer,
  1098. // non-interface field appearing in ForceSendFields will be sent to the
  1099. // server regardless of whether the field is empty or not. This may be
  1100. // used to include empty fields in Patch requests.
  1101. ForceSendFields []string `json:"-"`
  1102. }
  1103. func (s *FreeBusyCalendar) MarshalJSON() ([]byte, error) {
  1104. type noMethod FreeBusyCalendar
  1105. raw := noMethod(*s)
  1106. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1107. }
  1108. type FreeBusyGroup struct {
  1109. // Calendars: List of calendars' identifiers within a group.
  1110. Calendars []string `json:"calendars,omitempty"`
  1111. // Errors: Optional error(s) (if computation for the group failed).
  1112. Errors []*Error `json:"errors,omitempty"`
  1113. // ForceSendFields is a list of field names (e.g. "Calendars") to
  1114. // unconditionally include in API requests. By default, fields with
  1115. // empty values are omitted from API requests. However, any non-pointer,
  1116. // non-interface field appearing in ForceSendFields will be sent to the
  1117. // server regardless of whether the field is empty or not. This may be
  1118. // used to include empty fields in Patch requests.
  1119. ForceSendFields []string `json:"-"`
  1120. }
  1121. func (s *FreeBusyGroup) MarshalJSON() ([]byte, error) {
  1122. type noMethod FreeBusyGroup
  1123. raw := noMethod(*s)
  1124. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1125. }
  1126. type FreeBusyRequest struct {
  1127. // CalendarExpansionMax: Maximal number of calendars for which FreeBusy
  1128. // information is to be provided. Optional.
  1129. CalendarExpansionMax int64 `json:"calendarExpansionMax,omitempty"`
  1130. // GroupExpansionMax: Maximal number of calendar identifiers to be
  1131. // provided for a single group. Optional. An error will be returned for
  1132. // a group with more members than this value.
  1133. GroupExpansionMax int64 `json:"groupExpansionMax,omitempty"`
  1134. // Items: List of calendars and/or groups to query.
  1135. Items []*FreeBusyRequestItem `json:"items,omitempty"`
  1136. // TimeMax: The end of the interval for the query.
  1137. TimeMax string `json:"timeMax,omitempty"`
  1138. // TimeMin: The start of the interval for the query.
  1139. TimeMin string `json:"timeMin,omitempty"`
  1140. // TimeZone: Time zone used in the response. Optional. The default is
  1141. // UTC.
  1142. TimeZone string `json:"timeZone,omitempty"`
  1143. // ForceSendFields is a list of field names (e.g.
  1144. // "CalendarExpansionMax") to unconditionally include in API requests.
  1145. // By default, fields with empty values are omitted from API requests.
  1146. // However, any non-pointer, non-interface field appearing in
  1147. // ForceSendFields will be sent to the server regardless of whether the
  1148. // field is empty or not. This may be used to include empty fields in
  1149. // Patch requests.
  1150. ForceSendFields []string `json:"-"`
  1151. }
  1152. func (s *FreeBusyRequest) MarshalJSON() ([]byte, error) {
  1153. type noMethod FreeBusyRequest
  1154. raw := noMethod(*s)
  1155. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1156. }
  1157. type FreeBusyRequestItem struct {
  1158. // Id: The identifier of a calendar or a group.
  1159. Id string `json:"id,omitempty"`
  1160. // ForceSendFields is a list of field names (e.g. "Id") to
  1161. // unconditionally include in API requests. By default, fields with
  1162. // empty values are omitted from API requests. However, any non-pointer,
  1163. // non-interface field appearing in ForceSendFields will be sent to the
  1164. // server regardless of whether the field is empty or not. This may be
  1165. // used to include empty fields in Patch requests.
  1166. ForceSendFields []string `json:"-"`
  1167. }
  1168. func (s *FreeBusyRequestItem) MarshalJSON() ([]byte, error) {
  1169. type noMethod FreeBusyRequestItem
  1170. raw := noMethod(*s)
  1171. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1172. }
  1173. type FreeBusyResponse struct {
  1174. // Calendars: List of free/busy information for calendars.
  1175. Calendars map[string]FreeBusyCalendar `json:"calendars,omitempty"`
  1176. // Groups: Expansion of groups.
  1177. Groups map[string]FreeBusyGroup `json:"groups,omitempty"`
  1178. // Kind: Type of the resource ("calendar#freeBusy").
  1179. Kind string `json:"kind,omitempty"`
  1180. // TimeMax: The end of the interval.
  1181. TimeMax string `json:"timeMax,omitempty"`
  1182. // TimeMin: The start of the interval.
  1183. TimeMin string `json:"timeMin,omitempty"`
  1184. // ServerResponse contains the HTTP response code and headers from the
  1185. // server.
  1186. googleapi.ServerResponse `json:"-"`
  1187. // ForceSendFields is a list of field names (e.g. "Calendars") to
  1188. // unconditionally include in API requests. By default, fields with
  1189. // empty values are omitted from API requests. However, any non-pointer,
  1190. // non-interface field appearing in ForceSendFields will be sent to the
  1191. // server regardless of whether the field is empty or not. This may be
  1192. // used to include empty fields in Patch requests.
  1193. ForceSendFields []string `json:"-"`
  1194. }
  1195. func (s *FreeBusyResponse) MarshalJSON() ([]byte, error) {
  1196. type noMethod FreeBusyResponse
  1197. raw := noMethod(*s)
  1198. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1199. }
  1200. type Setting struct {
  1201. // Etag: ETag of the resource.
  1202. Etag string `json:"etag,omitempty"`
  1203. // Id: The id of the user setting.
  1204. Id string `json:"id,omitempty"`
  1205. // Kind: Type of the resource ("calendar#setting").
  1206. Kind string `json:"kind,omitempty"`
  1207. // Value: Value of the user setting. The format of the value depends on
  1208. // the ID of the setting. It must always be a UTF-8 string of length up
  1209. // to 1024 characters.
  1210. Value string `json:"value,omitempty"`
  1211. // ServerResponse contains the HTTP response code and headers from the
  1212. // server.
  1213. googleapi.ServerResponse `json:"-"`
  1214. // ForceSendFields is a list of field names (e.g. "Etag") to
  1215. // unconditionally include in API requests. By default, fields with
  1216. // empty values are omitted from API requests. However, any non-pointer,
  1217. // non-interface field appearing in ForceSendFields will be sent to the
  1218. // server regardless of whether the field is empty or not. This may be
  1219. // used to include empty fields in Patch requests.
  1220. ForceSendFields []string `json:"-"`
  1221. }
  1222. func (s *Setting) MarshalJSON() ([]byte, error) {
  1223. type noMethod Setting
  1224. raw := noMethod(*s)
  1225. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1226. }
  1227. type Settings struct {
  1228. // Etag: Etag of the collection.
  1229. Etag string `json:"etag,omitempty"`
  1230. // Items: List of user settings.
  1231. Items []*Setting `json:"items,omitempty"`
  1232. // Kind: Type of the collection ("calendar#settings").
  1233. Kind string `json:"kind,omitempty"`
  1234. // NextPageToken: Token used to access the next page of this result.
  1235. // Omitted if no further results are available, in which case
  1236. // nextSyncToken is provided.
  1237. NextPageToken string `json:"nextPageToken,omitempty"`
  1238. // NextSyncToken: Token used at a later point in time to retrieve only
  1239. // the entries that have changed since this result was returned. Omitted
  1240. // if further results are available, in which case nextPageToken is
  1241. // provided.
  1242. NextSyncToken string `json:"nextSyncToken,omitempty"`
  1243. // ServerResponse contains the HTTP response code and headers from the
  1244. // server.
  1245. googleapi.ServerResponse `json:"-"`
  1246. // ForceSendFields is a list of field names (e.g. "Etag") to
  1247. // unconditionally include in API requests. By default, fields with
  1248. // empty values are omitted from API requests. However, any non-pointer,
  1249. // non-interface field appearing in ForceSendFields will be sent to the
  1250. // server regardless of whether the field is empty or not. This may be
  1251. // used to include empty fields in Patch requests.
  1252. ForceSendFields []string `json:"-"`
  1253. }
  1254. func (s *Settings) MarshalJSON() ([]byte, error) {
  1255. type noMethod Settings
  1256. raw := noMethod(*s)
  1257. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1258. }
  1259. type TimePeriod struct {
  1260. // End: The (exclusive) end of the time period.
  1261. End string `json:"end,omitempty"`
  1262. // Start: The (inclusive) start of the time period.
  1263. Start string `json:"start,omitempty"`
  1264. // ForceSendFields is a list of field names (e.g. "End") to
  1265. // unconditionally include in API requests. By default, fields with
  1266. // empty values are omitted from API requests. However, any non-pointer,
  1267. // non-interface field appearing in ForceSendFields will be sent to the
  1268. // server regardless of whether the field is empty or not. This may be
  1269. // used to include empty fields in Patch requests.
  1270. ForceSendFields []string `json:"-"`
  1271. }
  1272. func (s *TimePeriod) MarshalJSON() ([]byte, error) {
  1273. type noMethod TimePeriod
  1274. raw := noMethod(*s)
  1275. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1276. }
  1277. // method id "calendar.acl.delete":
  1278. type AclDeleteCall struct {
  1279. s *Service
  1280. calendarId string
  1281. ruleId string
  1282. urlParams_ gensupport.URLParams
  1283. ctx_ context.Context
  1284. }
  1285. // Delete: Deletes an access control rule.
  1286. func (r *AclService) Delete(calendarId string, ruleId string) *AclDeleteCall {
  1287. c := &AclDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1288. c.calendarId = calendarId
  1289. c.ruleId = ruleId
  1290. return c
  1291. }
  1292. // Fields allows partial responses to be retrieved. See
  1293. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1294. // for more information.
  1295. func (c *AclDeleteCall) Fields(s ...googleapi.Field) *AclDeleteCall {
  1296. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1297. return c
  1298. }
  1299. // Context sets the context to be used in this call's Do method. Any
  1300. // pending HTTP request will be aborted if the provided context is
  1301. // canceled.
  1302. func (c *AclDeleteCall) Context(ctx context.Context) *AclDeleteCall {
  1303. c.ctx_ = ctx
  1304. return c
  1305. }
  1306. func (c *AclDeleteCall) doRequest(alt string) (*http.Response, error) {
  1307. var body io.Reader = nil
  1308. c.urlParams_.Set("alt", alt)
  1309. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/acl/{ruleId}")
  1310. urls += "?" + c.urlParams_.Encode()
  1311. req, _ := http.NewRequest("DELETE", urls, body)
  1312. googleapi.Expand(req.URL, map[string]string{
  1313. "calendarId": c.calendarId,
  1314. "ruleId": c.ruleId,
  1315. })
  1316. req.Header.Set("User-Agent", c.s.userAgent())
  1317. if c.ctx_ != nil {
  1318. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1319. }
  1320. return c.s.client.Do(req)
  1321. }
  1322. // Do executes the "calendar.acl.delete" call.
  1323. func (c *AclDeleteCall) Do(opts ...googleapi.CallOption) error {
  1324. gensupport.SetOptions(c.urlParams_, opts...)
  1325. res, err := c.doRequest("json")
  1326. if err != nil {
  1327. return err
  1328. }
  1329. defer googleapi.CloseBody(res)
  1330. if err := googleapi.CheckResponse(res); err != nil {
  1331. return err
  1332. }
  1333. return nil
  1334. // {
  1335. // "description": "Deletes an access control rule.",
  1336. // "httpMethod": "DELETE",
  1337. // "id": "calendar.acl.delete",
  1338. // "parameterOrder": [
  1339. // "calendarId",
  1340. // "ruleId"
  1341. // ],
  1342. // "parameters": {
  1343. // "calendarId": {
  1344. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  1345. // "location": "path",
  1346. // "required": true,
  1347. // "type": "string"
  1348. // },
  1349. // "ruleId": {
  1350. // "description": "ACL rule identifier.",
  1351. // "location": "path",
  1352. // "required": true,
  1353. // "type": "string"
  1354. // }
  1355. // },
  1356. // "path": "calendars/{calendarId}/acl/{ruleId}",
  1357. // "scopes": [
  1358. // "https://www.googleapis.com/auth/calendar"
  1359. // ]
  1360. // }
  1361. }
  1362. // method id "calendar.acl.get":
  1363. type AclGetCall struct {
  1364. s *Service
  1365. calendarId string
  1366. ruleId string
  1367. urlParams_ gensupport.URLParams
  1368. ifNoneMatch_ string
  1369. ctx_ context.Context
  1370. }
  1371. // Get: Returns an access control rule.
  1372. func (r *AclService) Get(calendarId string, ruleId string) *AclGetCall {
  1373. c := &AclGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1374. c.calendarId = calendarId
  1375. c.ruleId = ruleId
  1376. return c
  1377. }
  1378. // Fields allows partial responses to be retrieved. See
  1379. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1380. // for more information.
  1381. func (c *AclGetCall) Fields(s ...googleapi.Field) *AclGetCall {
  1382. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1383. return c
  1384. }
  1385. // IfNoneMatch sets the optional parameter which makes the operation
  1386. // fail if the object's ETag matches the given value. This is useful for
  1387. // getting updates only after the object has changed since the last
  1388. // request. Use googleapi.IsNotModified to check whether the response
  1389. // error from Do is the result of In-None-Match.
  1390. func (c *AclGetCall) IfNoneMatch(entityTag string) *AclGetCall {
  1391. c.ifNoneMatch_ = entityTag
  1392. return c
  1393. }
  1394. // Context sets the context to be used in this call's Do method. Any
  1395. // pending HTTP request will be aborted if the provided context is
  1396. // canceled.
  1397. func (c *AclGetCall) Context(ctx context.Context) *AclGetCall {
  1398. c.ctx_ = ctx
  1399. return c
  1400. }
  1401. func (c *AclGetCall) doRequest(alt string) (*http.Response, error) {
  1402. var body io.Reader = nil
  1403. c.urlParams_.Set("alt", alt)
  1404. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/acl/{ruleId}")
  1405. urls += "?" + c.urlParams_.Encode()
  1406. req, _ := http.NewRequest("GET", urls, body)
  1407. googleapi.Expand(req.URL, map[string]string{
  1408. "calendarId": c.calendarId,
  1409. "ruleId": c.ruleId,
  1410. })
  1411. req.Header.Set("User-Agent", c.s.userAgent())
  1412. if c.ifNoneMatch_ != "" {
  1413. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1414. }
  1415. if c.ctx_ != nil {
  1416. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1417. }
  1418. return c.s.client.Do(req)
  1419. }
  1420. // Do executes the "calendar.acl.get" call.
  1421. // Exactly one of *AclRule or error will be non-nil. Any non-2xx status
  1422. // code is an error. Response headers are in either
  1423. // *AclRule.ServerResponse.Header or (if a response was returned at all)
  1424. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1425. // check whether the returned error was because http.StatusNotModified
  1426. // was returned.
  1427. func (c *AclGetCall) Do(opts ...googleapi.CallOption) (*AclRule, error) {
  1428. gensupport.SetOptions(c.urlParams_, opts...)
  1429. res, err := c.doRequest("json")
  1430. if res != nil && res.StatusCode == http.StatusNotModified {
  1431. if res.Body != nil {
  1432. res.Body.Close()
  1433. }
  1434. return nil, &googleapi.Error{
  1435. Code: res.StatusCode,
  1436. Header: res.Header,
  1437. }
  1438. }
  1439. if err != nil {
  1440. return nil, err
  1441. }
  1442. defer googleapi.CloseBody(res)
  1443. if err := googleapi.CheckResponse(res); err != nil {
  1444. return nil, err
  1445. }
  1446. ret := &AclRule{
  1447. ServerResponse: googleapi.ServerResponse{
  1448. Header: res.Header,
  1449. HTTPStatusCode: res.StatusCode,
  1450. },
  1451. }
  1452. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1453. return nil, err
  1454. }
  1455. return ret, nil
  1456. // {
  1457. // "description": "Returns an access control rule.",
  1458. // "httpMethod": "GET",
  1459. // "id": "calendar.acl.get",
  1460. // "parameterOrder": [
  1461. // "calendarId",
  1462. // "ruleId"
  1463. // ],
  1464. // "parameters": {
  1465. // "calendarId": {
  1466. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  1467. // "location": "path",
  1468. // "required": true,
  1469. // "type": "string"
  1470. // },
  1471. // "ruleId": {
  1472. // "description": "ACL rule identifier.",
  1473. // "location": "path",
  1474. // "required": true,
  1475. // "type": "string"
  1476. // }
  1477. // },
  1478. // "path": "calendars/{calendarId}/acl/{ruleId}",
  1479. // "response": {
  1480. // "$ref": "AclRule"
  1481. // },
  1482. // "scopes": [
  1483. // "https://www.googleapis.com/auth/calendar",
  1484. // "https://www.googleapis.com/auth/calendar.readonly"
  1485. // ]
  1486. // }
  1487. }
  1488. // method id "calendar.acl.insert":
  1489. type AclInsertCall struct {
  1490. s *Service
  1491. calendarId string
  1492. aclrule *AclRule
  1493. urlParams_ gensupport.URLParams
  1494. ctx_ context.Context
  1495. }
  1496. // Insert: Creates an access control rule.
  1497. func (r *AclService) Insert(calendarId string, aclrule *AclRule) *AclInsertCall {
  1498. c := &AclInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1499. c.calendarId = calendarId
  1500. c.aclrule = aclrule
  1501. return c
  1502. }
  1503. // Fields allows partial responses to be retrieved. See
  1504. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1505. // for more information.
  1506. func (c *AclInsertCall) Fields(s ...googleapi.Field) *AclInsertCall {
  1507. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1508. return c
  1509. }
  1510. // Context sets the context to be used in this call's Do method. Any
  1511. // pending HTTP request will be aborted if the provided context is
  1512. // canceled.
  1513. func (c *AclInsertCall) Context(ctx context.Context) *AclInsertCall {
  1514. c.ctx_ = ctx
  1515. return c
  1516. }
  1517. func (c *AclInsertCall) doRequest(alt string) (*http.Response, error) {
  1518. var body io.Reader = nil
  1519. body, err := googleapi.WithoutDataWrapper.JSONReader(c.aclrule)
  1520. if err != nil {
  1521. return nil, err
  1522. }
  1523. ctype := "application/json"
  1524. c.urlParams_.Set("alt", alt)
  1525. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/acl")
  1526. urls += "?" + c.urlParams_.Encode()
  1527. req, _ := http.NewRequest("POST", urls, body)
  1528. googleapi.Expand(req.URL, map[string]string{
  1529. "calendarId": c.calendarId,
  1530. })
  1531. req.Header.Set("Content-Type", ctype)
  1532. req.Header.Set("User-Agent", c.s.userAgent())
  1533. if c.ctx_ != nil {
  1534. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1535. }
  1536. return c.s.client.Do(req)
  1537. }
  1538. // Do executes the "calendar.acl.insert" call.
  1539. // Exactly one of *AclRule or error will be non-nil. Any non-2xx status
  1540. // code is an error. Response headers are in either
  1541. // *AclRule.ServerResponse.Header or (if a response was returned at all)
  1542. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1543. // check whether the returned error was because http.StatusNotModified
  1544. // was returned.
  1545. func (c *AclInsertCall) Do(opts ...googleapi.CallOption) (*AclRule, error) {
  1546. gensupport.SetOptions(c.urlParams_, opts...)
  1547. res, err := c.doRequest("json")
  1548. if res != nil && res.StatusCode == http.StatusNotModified {
  1549. if res.Body != nil {
  1550. res.Body.Close()
  1551. }
  1552. return nil, &googleapi.Error{
  1553. Code: res.StatusCode,
  1554. Header: res.Header,
  1555. }
  1556. }
  1557. if err != nil {
  1558. return nil, err
  1559. }
  1560. defer googleapi.CloseBody(res)
  1561. if err := googleapi.CheckResponse(res); err != nil {
  1562. return nil, err
  1563. }
  1564. ret := &AclRule{
  1565. ServerResponse: googleapi.ServerResponse{
  1566. Header: res.Header,
  1567. HTTPStatusCode: res.StatusCode,
  1568. },
  1569. }
  1570. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1571. return nil, err
  1572. }
  1573. return ret, nil
  1574. // {
  1575. // "description": "Creates an access control rule.",
  1576. // "httpMethod": "POST",
  1577. // "id": "calendar.acl.insert",
  1578. // "parameterOrder": [
  1579. // "calendarId"
  1580. // ],
  1581. // "parameters": {
  1582. // "calendarId": {
  1583. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  1584. // "location": "path",
  1585. // "required": true,
  1586. // "type": "string"
  1587. // }
  1588. // },
  1589. // "path": "calendars/{calendarId}/acl",
  1590. // "request": {
  1591. // "$ref": "AclRule"
  1592. // },
  1593. // "response": {
  1594. // "$ref": "AclRule"
  1595. // },
  1596. // "scopes": [
  1597. // "https://www.googleapis.com/auth/calendar"
  1598. // ]
  1599. // }
  1600. }
  1601. // method id "calendar.acl.list":
  1602. type AclListCall struct {
  1603. s *Service
  1604. calendarId string
  1605. urlParams_ gensupport.URLParams
  1606. ifNoneMatch_ string
  1607. ctx_ context.Context
  1608. }
  1609. // List: Returns the rules in the access control list for the calendar.
  1610. func (r *AclService) List(calendarId string) *AclListCall {
  1611. c := &AclListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1612. c.calendarId = calendarId
  1613. return c
  1614. }
  1615. // MaxResults sets the optional parameter "maxResults": Maximum number
  1616. // of entries returned on one result page. By default the value is 100
  1617. // entries. The page size can never be larger than 250 entries.
  1618. func (c *AclListCall) MaxResults(maxResults int64) *AclListCall {
  1619. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1620. return c
  1621. }
  1622. // PageToken sets the optional parameter "pageToken": Token specifying
  1623. // which result page to return.
  1624. func (c *AclListCall) PageToken(pageToken string) *AclListCall {
  1625. c.urlParams_.Set("pageToken", pageToken)
  1626. return c
  1627. }
  1628. // ShowDeleted sets the optional parameter "showDeleted": Whether to
  1629. // include deleted ACLs in the result. Deleted ACLs are represented by
  1630. // role equal to "none". Deleted ACLs will always be included if
  1631. // syncToken is provided. The default is False.
  1632. func (c *AclListCall) ShowDeleted(showDeleted bool) *AclListCall {
  1633. c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
  1634. return c
  1635. }
  1636. // SyncToken sets the optional parameter "syncToken": Token obtained
  1637. // from the nextSyncToken field returned on the last page of results
  1638. // from the previous list request. It makes the result of this list
  1639. // request contain only entries that have changed since then. All
  1640. // entries deleted since the previous list request will always be in the
  1641. // result set and it is not allowed to set showDeleted to False.
  1642. // If the syncToken expires, the server will respond with a 410 GONE
  1643. // response code and the client should clear its storage and perform a
  1644. // full synchronization without any syncToken.
  1645. // Learn more about incremental synchronization.
  1646. // The default is to return all entries.
  1647. func (c *AclListCall) SyncToken(syncToken string) *AclListCall {
  1648. c.urlParams_.Set("syncToken", syncToken)
  1649. return c
  1650. }
  1651. // Fields allows partial responses to be retrieved. See
  1652. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1653. // for more information.
  1654. func (c *AclListCall) Fields(s ...googleapi.Field) *AclListCall {
  1655. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1656. return c
  1657. }
  1658. // IfNoneMatch sets the optional parameter which makes the operation
  1659. // fail if the object's ETag matches the given value. This is useful for
  1660. // getting updates only after the object has changed since the last
  1661. // request. Use googleapi.IsNotModified to check whether the response
  1662. // error from Do is the result of In-None-Match.
  1663. func (c *AclListCall) IfNoneMatch(entityTag string) *AclListCall {
  1664. c.ifNoneMatch_ = entityTag
  1665. return c
  1666. }
  1667. // Context sets the context to be used in this call's Do method. Any
  1668. // pending HTTP request will be aborted if the provided context is
  1669. // canceled.
  1670. func (c *AclListCall) Context(ctx context.Context) *AclListCall {
  1671. c.ctx_ = ctx
  1672. return c
  1673. }
  1674. func (c *AclListCall) doRequest(alt string) (*http.Response, error) {
  1675. var body io.Reader = nil
  1676. c.urlParams_.Set("alt", alt)
  1677. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/acl")
  1678. urls += "?" + c.urlParams_.Encode()
  1679. req, _ := http.NewRequest("GET", urls, body)
  1680. googleapi.Expand(req.URL, map[string]string{
  1681. "calendarId": c.calendarId,
  1682. })
  1683. req.Header.Set("User-Agent", c.s.userAgent())
  1684. if c.ifNoneMatch_ != "" {
  1685. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1686. }
  1687. if c.ctx_ != nil {
  1688. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1689. }
  1690. return c.s.client.Do(req)
  1691. }
  1692. // Do executes the "calendar.acl.list" call.
  1693. // Exactly one of *Acl or error will be non-nil. Any non-2xx status code
  1694. // is an error. Response headers are in either
  1695. // *Acl.ServerResponse.Header or (if a response was returned at all) in
  1696. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1697. // whether the returned error was because http.StatusNotModified was
  1698. // returned.
  1699. func (c *AclListCall) Do(opts ...googleapi.CallOption) (*Acl, error) {
  1700. gensupport.SetOptions(c.urlParams_, opts...)
  1701. res, err := c.doRequest("json")
  1702. if res != nil && res.StatusCode == http.StatusNotModified {
  1703. if res.Body != nil {
  1704. res.Body.Close()
  1705. }
  1706. return nil, &googleapi.Error{
  1707. Code: res.StatusCode,
  1708. Header: res.Header,
  1709. }
  1710. }
  1711. if err != nil {
  1712. return nil, err
  1713. }
  1714. defer googleapi.CloseBody(res)
  1715. if err := googleapi.CheckResponse(res); err != nil {
  1716. return nil, err
  1717. }
  1718. ret := &Acl{
  1719. ServerResponse: googleapi.ServerResponse{
  1720. Header: res.Header,
  1721. HTTPStatusCode: res.StatusCode,
  1722. },
  1723. }
  1724. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1725. return nil, err
  1726. }
  1727. return ret, nil
  1728. // {
  1729. // "description": "Returns the rules in the access control list for the calendar.",
  1730. // "httpMethod": "GET",
  1731. // "id": "calendar.acl.list",
  1732. // "parameterOrder": [
  1733. // "calendarId"
  1734. // ],
  1735. // "parameters": {
  1736. // "calendarId": {
  1737. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  1738. // "location": "path",
  1739. // "required": true,
  1740. // "type": "string"
  1741. // },
  1742. // "maxResults": {
  1743. // "description": "Maximum number of entries returned on one result page. By default the value is 100 entries. The page size can never be larger than 250 entries. Optional.",
  1744. // "format": "int32",
  1745. // "location": "query",
  1746. // "minimum": "1",
  1747. // "type": "integer"
  1748. // },
  1749. // "pageToken": {
  1750. // "description": "Token specifying which result page to return. Optional.",
  1751. // "location": "query",
  1752. // "type": "string"
  1753. // },
  1754. // "showDeleted": {
  1755. // "description": "Whether to include deleted ACLs in the result. Deleted ACLs are represented by role equal to \"none\". Deleted ACLs will always be included if syncToken is provided. Optional. The default is False.",
  1756. // "location": "query",
  1757. // "type": "boolean"
  1758. // },
  1759. // "syncToken": {
  1760. // "description": "Token obtained from the nextSyncToken field returned on the last page of results from the previous list request. It makes the result of this list request contain only entries that have changed since then. All entries deleted since the previous list request will always be in the result set and it is not allowed to set showDeleted to False.\nIf the syncToken expires, the server will respond with a 410 GONE response code and the client should clear its storage and perform a full synchronization without any syncToken.\nLearn more about incremental synchronization.\nOptional. The default is to return all entries.",
  1761. // "location": "query",
  1762. // "type": "string"
  1763. // }
  1764. // },
  1765. // "path": "calendars/{calendarId}/acl",
  1766. // "response": {
  1767. // "$ref": "Acl"
  1768. // },
  1769. // "scopes": [
  1770. // "https://www.googleapis.com/auth/calendar"
  1771. // ],
  1772. // "supportsSubscription": true
  1773. // }
  1774. }
  1775. // Pages invokes f for each page of results.
  1776. // A non-nil error returned from f will halt the iteration.
  1777. // The provided context supersedes any context provided to the Context method.
  1778. func (c *AclListCall) Pages(ctx context.Context, f func(*Acl) error) error {
  1779. c.ctx_ = ctx
  1780. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1781. for {
  1782. x, err := c.Do()
  1783. if err != nil {
  1784. return err
  1785. }
  1786. if err := f(x); err != nil {
  1787. return err
  1788. }
  1789. if x.NextPageToken == "" {
  1790. return nil
  1791. }
  1792. c.PageToken(x.NextPageToken)
  1793. }
  1794. }
  1795. // method id "calendar.acl.patch":
  1796. type AclPatchCall struct {
  1797. s *Service
  1798. calendarId string
  1799. ruleId string
  1800. aclrule *AclRule
  1801. urlParams_ gensupport.URLParams
  1802. ctx_ context.Context
  1803. }
  1804. // Patch: Updates an access control rule. This method supports patch
  1805. // semantics.
  1806. func (r *AclService) Patch(calendarId string, ruleId string, aclrule *AclRule) *AclPatchCall {
  1807. c := &AclPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1808. c.calendarId = calendarId
  1809. c.ruleId = ruleId
  1810. c.aclrule = aclrule
  1811. return c
  1812. }
  1813. // Fields allows partial responses to be retrieved. See
  1814. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1815. // for more information.
  1816. func (c *AclPatchCall) Fields(s ...googleapi.Field) *AclPatchCall {
  1817. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1818. return c
  1819. }
  1820. // Context sets the context to be used in this call's Do method. Any
  1821. // pending HTTP request will be aborted if the provided context is
  1822. // canceled.
  1823. func (c *AclPatchCall) Context(ctx context.Context) *AclPatchCall {
  1824. c.ctx_ = ctx
  1825. return c
  1826. }
  1827. func (c *AclPatchCall) doRequest(alt string) (*http.Response, error) {
  1828. var body io.Reader = nil
  1829. body, err := googleapi.WithoutDataWrapper.JSONReader(c.aclrule)
  1830. if err != nil {
  1831. return nil, err
  1832. }
  1833. ctype := "application/json"
  1834. c.urlParams_.Set("alt", alt)
  1835. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/acl/{ruleId}")
  1836. urls += "?" + c.urlParams_.Encode()
  1837. req, _ := http.NewRequest("PATCH", urls, body)
  1838. googleapi.Expand(req.URL, map[string]string{
  1839. "calendarId": c.calendarId,
  1840. "ruleId": c.ruleId,
  1841. })
  1842. req.Header.Set("Content-Type", ctype)
  1843. req.Header.Set("User-Agent", c.s.userAgent())
  1844. if c.ctx_ != nil {
  1845. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1846. }
  1847. return c.s.client.Do(req)
  1848. }
  1849. // Do executes the "calendar.acl.patch" call.
  1850. // Exactly one of *AclRule or error will be non-nil. Any non-2xx status
  1851. // code is an error. Response headers are in either
  1852. // *AclRule.ServerResponse.Header or (if a response was returned at all)
  1853. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1854. // check whether the returned error was because http.StatusNotModified
  1855. // was returned.
  1856. func (c *AclPatchCall) Do(opts ...googleapi.CallOption) (*AclRule, error) {
  1857. gensupport.SetOptions(c.urlParams_, opts...)
  1858. res, err := c.doRequest("json")
  1859. if res != nil && res.StatusCode == http.StatusNotModified {
  1860. if res.Body != nil {
  1861. res.Body.Close()
  1862. }
  1863. return nil, &googleapi.Error{
  1864. Code: res.StatusCode,
  1865. Header: res.Header,
  1866. }
  1867. }
  1868. if err != nil {
  1869. return nil, err
  1870. }
  1871. defer googleapi.CloseBody(res)
  1872. if err := googleapi.CheckResponse(res); err != nil {
  1873. return nil, err
  1874. }
  1875. ret := &AclRule{
  1876. ServerResponse: googleapi.ServerResponse{
  1877. Header: res.Header,
  1878. HTTPStatusCode: res.StatusCode,
  1879. },
  1880. }
  1881. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1882. return nil, err
  1883. }
  1884. return ret, nil
  1885. // {
  1886. // "description": "Updates an access control rule. This method supports patch semantics.",
  1887. // "httpMethod": "PATCH",
  1888. // "id": "calendar.acl.patch",
  1889. // "parameterOrder": [
  1890. // "calendarId",
  1891. // "ruleId"
  1892. // ],
  1893. // "parameters": {
  1894. // "calendarId": {
  1895. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  1896. // "location": "path",
  1897. // "required": true,
  1898. // "type": "string"
  1899. // },
  1900. // "ruleId": {
  1901. // "description": "ACL rule identifier.",
  1902. // "location": "path",
  1903. // "required": true,
  1904. // "type": "string"
  1905. // }
  1906. // },
  1907. // "path": "calendars/{calendarId}/acl/{ruleId}",
  1908. // "request": {
  1909. // "$ref": "AclRule"
  1910. // },
  1911. // "response": {
  1912. // "$ref": "AclRule"
  1913. // },
  1914. // "scopes": [
  1915. // "https://www.googleapis.com/auth/calendar"
  1916. // ]
  1917. // }
  1918. }
  1919. // method id "calendar.acl.update":
  1920. type AclUpdateCall struct {
  1921. s *Service
  1922. calendarId string
  1923. ruleId string
  1924. aclrule *AclRule
  1925. urlParams_ gensupport.URLParams
  1926. ctx_ context.Context
  1927. }
  1928. // Update: Updates an access control rule.
  1929. func (r *AclService) Update(calendarId string, ruleId string, aclrule *AclRule) *AclUpdateCall {
  1930. c := &AclUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1931. c.calendarId = calendarId
  1932. c.ruleId = ruleId
  1933. c.aclrule = aclrule
  1934. return c
  1935. }
  1936. // Fields allows partial responses to be retrieved. See
  1937. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1938. // for more information.
  1939. func (c *AclUpdateCall) Fields(s ...googleapi.Field) *AclUpdateCall {
  1940. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1941. return c
  1942. }
  1943. // Context sets the context to be used in this call's Do method. Any
  1944. // pending HTTP request will be aborted if the provided context is
  1945. // canceled.
  1946. func (c *AclUpdateCall) Context(ctx context.Context) *AclUpdateCall {
  1947. c.ctx_ = ctx
  1948. return c
  1949. }
  1950. func (c *AclUpdateCall) doRequest(alt string) (*http.Response, error) {
  1951. var body io.Reader = nil
  1952. body, err := googleapi.WithoutDataWrapper.JSONReader(c.aclrule)
  1953. if err != nil {
  1954. return nil, err
  1955. }
  1956. ctype := "application/json"
  1957. c.urlParams_.Set("alt", alt)
  1958. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/acl/{ruleId}")
  1959. urls += "?" + c.urlParams_.Encode()
  1960. req, _ := http.NewRequest("PUT", urls, body)
  1961. googleapi.Expand(req.URL, map[string]string{
  1962. "calendarId": c.calendarId,
  1963. "ruleId": c.ruleId,
  1964. })
  1965. req.Header.Set("Content-Type", ctype)
  1966. req.Header.Set("User-Agent", c.s.userAgent())
  1967. if c.ctx_ != nil {
  1968. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1969. }
  1970. return c.s.client.Do(req)
  1971. }
  1972. // Do executes the "calendar.acl.update" call.
  1973. // Exactly one of *AclRule or error will be non-nil. Any non-2xx status
  1974. // code is an error. Response headers are in either
  1975. // *AclRule.ServerResponse.Header or (if a response was returned at all)
  1976. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1977. // check whether the returned error was because http.StatusNotModified
  1978. // was returned.
  1979. func (c *AclUpdateCall) Do(opts ...googleapi.CallOption) (*AclRule, error) {
  1980. gensupport.SetOptions(c.urlParams_, opts...)
  1981. res, err := c.doRequest("json")
  1982. if res != nil && res.StatusCode == http.StatusNotModified {
  1983. if res.Body != nil {
  1984. res.Body.Close()
  1985. }
  1986. return nil, &googleapi.Error{
  1987. Code: res.StatusCode,
  1988. Header: res.Header,
  1989. }
  1990. }
  1991. if err != nil {
  1992. return nil, err
  1993. }
  1994. defer googleapi.CloseBody(res)
  1995. if err := googleapi.CheckResponse(res); err != nil {
  1996. return nil, err
  1997. }
  1998. ret := &AclRule{
  1999. ServerResponse: googleapi.ServerResponse{
  2000. Header: res.Header,
  2001. HTTPStatusCode: res.StatusCode,
  2002. },
  2003. }
  2004. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2005. return nil, err
  2006. }
  2007. return ret, nil
  2008. // {
  2009. // "description": "Updates an access control rule.",
  2010. // "httpMethod": "PUT",
  2011. // "id": "calendar.acl.update",
  2012. // "parameterOrder": [
  2013. // "calendarId",
  2014. // "ruleId"
  2015. // ],
  2016. // "parameters": {
  2017. // "calendarId": {
  2018. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  2019. // "location": "path",
  2020. // "required": true,
  2021. // "type": "string"
  2022. // },
  2023. // "ruleId": {
  2024. // "description": "ACL rule identifier.",
  2025. // "location": "path",
  2026. // "required": true,
  2027. // "type": "string"
  2028. // }
  2029. // },
  2030. // "path": "calendars/{calendarId}/acl/{ruleId}",
  2031. // "request": {
  2032. // "$ref": "AclRule"
  2033. // },
  2034. // "response": {
  2035. // "$ref": "AclRule"
  2036. // },
  2037. // "scopes": [
  2038. // "https://www.googleapis.com/auth/calendar"
  2039. // ]
  2040. // }
  2041. }
  2042. // method id "calendar.acl.watch":
  2043. type AclWatchCall struct {
  2044. s *Service
  2045. calendarId string
  2046. channel *Channel
  2047. urlParams_ gensupport.URLParams
  2048. ctx_ context.Context
  2049. }
  2050. // Watch: Watch for changes to ACL resources.
  2051. func (r *AclService) Watch(calendarId string, channel *Channel) *AclWatchCall {
  2052. c := &AclWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2053. c.calendarId = calendarId
  2054. c.channel = channel
  2055. return c
  2056. }
  2057. // MaxResults sets the optional parameter "maxResults": Maximum number
  2058. // of entries returned on one result page. By default the value is 100
  2059. // entries. The page size can never be larger than 250 entries.
  2060. func (c *AclWatchCall) MaxResults(maxResults int64) *AclWatchCall {
  2061. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2062. return c
  2063. }
  2064. // PageToken sets the optional parameter "pageToken": Token specifying
  2065. // which result page to return.
  2066. func (c *AclWatchCall) PageToken(pageToken string) *AclWatchCall {
  2067. c.urlParams_.Set("pageToken", pageToken)
  2068. return c
  2069. }
  2070. // ShowDeleted sets the optional parameter "showDeleted": Whether to
  2071. // include deleted ACLs in the result. Deleted ACLs are represented by
  2072. // role equal to "none". Deleted ACLs will always be included if
  2073. // syncToken is provided. The default is False.
  2074. func (c *AclWatchCall) ShowDeleted(showDeleted bool) *AclWatchCall {
  2075. c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
  2076. return c
  2077. }
  2078. // SyncToken sets the optional parameter "syncToken": Token obtained
  2079. // from the nextSyncToken field returned on the last page of results
  2080. // from the previous list request. It makes the result of this list
  2081. // request contain only entries that have changed since then. All
  2082. // entries deleted since the previous list request will always be in the
  2083. // result set and it is not allowed to set showDeleted to False.
  2084. // If the syncToken expires, the server will respond with a 410 GONE
  2085. // response code and the client should clear its storage and perform a
  2086. // full synchronization without any syncToken.
  2087. // Learn more about incremental synchronization.
  2088. // The default is to return all entries.
  2089. func (c *AclWatchCall) SyncToken(syncToken string) *AclWatchCall {
  2090. c.urlParams_.Set("syncToken", syncToken)
  2091. return c
  2092. }
  2093. // Fields allows partial responses to be retrieved. See
  2094. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2095. // for more information.
  2096. func (c *AclWatchCall) Fields(s ...googleapi.Field) *AclWatchCall {
  2097. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2098. return c
  2099. }
  2100. // Context sets the context to be used in this call's Do method. Any
  2101. // pending HTTP request will be aborted if the provided context is
  2102. // canceled.
  2103. func (c *AclWatchCall) Context(ctx context.Context) *AclWatchCall {
  2104. c.ctx_ = ctx
  2105. return c
  2106. }
  2107. func (c *AclWatchCall) doRequest(alt string) (*http.Response, error) {
  2108. var body io.Reader = nil
  2109. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  2110. if err != nil {
  2111. return nil, err
  2112. }
  2113. ctype := "application/json"
  2114. c.urlParams_.Set("alt", alt)
  2115. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/acl/watch")
  2116. urls += "?" + c.urlParams_.Encode()
  2117. req, _ := http.NewRequest("POST", urls, body)
  2118. googleapi.Expand(req.URL, map[string]string{
  2119. "calendarId": c.calendarId,
  2120. })
  2121. req.Header.Set("Content-Type", ctype)
  2122. req.Header.Set("User-Agent", c.s.userAgent())
  2123. if c.ctx_ != nil {
  2124. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2125. }
  2126. return c.s.client.Do(req)
  2127. }
  2128. // Do executes the "calendar.acl.watch" call.
  2129. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  2130. // code is an error. Response headers are in either
  2131. // *Channel.ServerResponse.Header or (if a response was returned at all)
  2132. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2133. // check whether the returned error was because http.StatusNotModified
  2134. // was returned.
  2135. func (c *AclWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  2136. gensupport.SetOptions(c.urlParams_, opts...)
  2137. res, err := c.doRequest("json")
  2138. if res != nil && res.StatusCode == http.StatusNotModified {
  2139. if res.Body != nil {
  2140. res.Body.Close()
  2141. }
  2142. return nil, &googleapi.Error{
  2143. Code: res.StatusCode,
  2144. Header: res.Header,
  2145. }
  2146. }
  2147. if err != nil {
  2148. return nil, err
  2149. }
  2150. defer googleapi.CloseBody(res)
  2151. if err := googleapi.CheckResponse(res); err != nil {
  2152. return nil, err
  2153. }
  2154. ret := &Channel{
  2155. ServerResponse: googleapi.ServerResponse{
  2156. Header: res.Header,
  2157. HTTPStatusCode: res.StatusCode,
  2158. },
  2159. }
  2160. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2161. return nil, err
  2162. }
  2163. return ret, nil
  2164. // {
  2165. // "description": "Watch for changes to ACL resources.",
  2166. // "httpMethod": "POST",
  2167. // "id": "calendar.acl.watch",
  2168. // "parameterOrder": [
  2169. // "calendarId"
  2170. // ],
  2171. // "parameters": {
  2172. // "calendarId": {
  2173. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  2174. // "location": "path",
  2175. // "required": true,
  2176. // "type": "string"
  2177. // },
  2178. // "maxResults": {
  2179. // "description": "Maximum number of entries returned on one result page. By default the value is 100 entries. The page size can never be larger than 250 entries. Optional.",
  2180. // "format": "int32",
  2181. // "location": "query",
  2182. // "minimum": "1",
  2183. // "type": "integer"
  2184. // },
  2185. // "pageToken": {
  2186. // "description": "Token specifying which result page to return. Optional.",
  2187. // "location": "query",
  2188. // "type": "string"
  2189. // },
  2190. // "showDeleted": {
  2191. // "description": "Whether to include deleted ACLs in the result. Deleted ACLs are represented by role equal to \"none\". Deleted ACLs will always be included if syncToken is provided. Optional. The default is False.",
  2192. // "location": "query",
  2193. // "type": "boolean"
  2194. // },
  2195. // "syncToken": {
  2196. // "description": "Token obtained from the nextSyncToken field returned on the last page of results from the previous list request. It makes the result of this list request contain only entries that have changed since then. All entries deleted since the previous list request will always be in the result set and it is not allowed to set showDeleted to False.\nIf the syncToken expires, the server will respond with a 410 GONE response code and the client should clear its storage and perform a full synchronization without any syncToken.\nLearn more about incremental synchronization.\nOptional. The default is to return all entries.",
  2197. // "location": "query",
  2198. // "type": "string"
  2199. // }
  2200. // },
  2201. // "path": "calendars/{calendarId}/acl/watch",
  2202. // "request": {
  2203. // "$ref": "Channel",
  2204. // "parameterName": "resource"
  2205. // },
  2206. // "response": {
  2207. // "$ref": "Channel"
  2208. // },
  2209. // "scopes": [
  2210. // "https://www.googleapis.com/auth/calendar"
  2211. // ],
  2212. // "supportsSubscription": true
  2213. // }
  2214. }
  2215. // method id "calendar.calendarList.delete":
  2216. type CalendarListDeleteCall struct {
  2217. s *Service
  2218. calendarId string
  2219. urlParams_ gensupport.URLParams
  2220. ctx_ context.Context
  2221. }
  2222. // Delete: Deletes an entry on the user's calendar list.
  2223. func (r *CalendarListService) Delete(calendarId string) *CalendarListDeleteCall {
  2224. c := &CalendarListDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2225. c.calendarId = calendarId
  2226. return c
  2227. }
  2228. // Fields allows partial responses to be retrieved. See
  2229. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2230. // for more information.
  2231. func (c *CalendarListDeleteCall) Fields(s ...googleapi.Field) *CalendarListDeleteCall {
  2232. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2233. return c
  2234. }
  2235. // Context sets the context to be used in this call's Do method. Any
  2236. // pending HTTP request will be aborted if the provided context is
  2237. // canceled.
  2238. func (c *CalendarListDeleteCall) Context(ctx context.Context) *CalendarListDeleteCall {
  2239. c.ctx_ = ctx
  2240. return c
  2241. }
  2242. func (c *CalendarListDeleteCall) doRequest(alt string) (*http.Response, error) {
  2243. var body io.Reader = nil
  2244. c.urlParams_.Set("alt", alt)
  2245. urls := googleapi.ResolveRelative(c.s.BasePath, "users/me/calendarList/{calendarId}")
  2246. urls += "?" + c.urlParams_.Encode()
  2247. req, _ := http.NewRequest("DELETE", urls, body)
  2248. googleapi.Expand(req.URL, map[string]string{
  2249. "calendarId": c.calendarId,
  2250. })
  2251. req.Header.Set("User-Agent", c.s.userAgent())
  2252. if c.ctx_ != nil {
  2253. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2254. }
  2255. return c.s.client.Do(req)
  2256. }
  2257. // Do executes the "calendar.calendarList.delete" call.
  2258. func (c *CalendarListDeleteCall) Do(opts ...googleapi.CallOption) error {
  2259. gensupport.SetOptions(c.urlParams_, opts...)
  2260. res, err := c.doRequest("json")
  2261. if err != nil {
  2262. return err
  2263. }
  2264. defer googleapi.CloseBody(res)
  2265. if err := googleapi.CheckResponse(res); err != nil {
  2266. return err
  2267. }
  2268. return nil
  2269. // {
  2270. // "description": "Deletes an entry on the user's calendar list.",
  2271. // "httpMethod": "DELETE",
  2272. // "id": "calendar.calendarList.delete",
  2273. // "parameterOrder": [
  2274. // "calendarId"
  2275. // ],
  2276. // "parameters": {
  2277. // "calendarId": {
  2278. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  2279. // "location": "path",
  2280. // "required": true,
  2281. // "type": "string"
  2282. // }
  2283. // },
  2284. // "path": "users/me/calendarList/{calendarId}",
  2285. // "scopes": [
  2286. // "https://www.googleapis.com/auth/calendar"
  2287. // ]
  2288. // }
  2289. }
  2290. // method id "calendar.calendarList.get":
  2291. type CalendarListGetCall struct {
  2292. s *Service
  2293. calendarId string
  2294. urlParams_ gensupport.URLParams
  2295. ifNoneMatch_ string
  2296. ctx_ context.Context
  2297. }
  2298. // Get: Returns an entry on the user's calendar list.
  2299. func (r *CalendarListService) Get(calendarId string) *CalendarListGetCall {
  2300. c := &CalendarListGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2301. c.calendarId = calendarId
  2302. return c
  2303. }
  2304. // Fields allows partial responses to be retrieved. See
  2305. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2306. // for more information.
  2307. func (c *CalendarListGetCall) Fields(s ...googleapi.Field) *CalendarListGetCall {
  2308. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2309. return c
  2310. }
  2311. // IfNoneMatch sets the optional parameter which makes the operation
  2312. // fail if the object's ETag matches the given value. This is useful for
  2313. // getting updates only after the object has changed since the last
  2314. // request. Use googleapi.IsNotModified to check whether the response
  2315. // error from Do is the result of In-None-Match.
  2316. func (c *CalendarListGetCall) IfNoneMatch(entityTag string) *CalendarListGetCall {
  2317. c.ifNoneMatch_ = entityTag
  2318. return c
  2319. }
  2320. // Context sets the context to be used in this call's Do method. Any
  2321. // pending HTTP request will be aborted if the provided context is
  2322. // canceled.
  2323. func (c *CalendarListGetCall) Context(ctx context.Context) *CalendarListGetCall {
  2324. c.ctx_ = ctx
  2325. return c
  2326. }
  2327. func (c *CalendarListGetCall) doRequest(alt string) (*http.Response, error) {
  2328. var body io.Reader = nil
  2329. c.urlParams_.Set("alt", alt)
  2330. urls := googleapi.ResolveRelative(c.s.BasePath, "users/me/calendarList/{calendarId}")
  2331. urls += "?" + c.urlParams_.Encode()
  2332. req, _ := http.NewRequest("GET", urls, body)
  2333. googleapi.Expand(req.URL, map[string]string{
  2334. "calendarId": c.calendarId,
  2335. })
  2336. req.Header.Set("User-Agent", c.s.userAgent())
  2337. if c.ifNoneMatch_ != "" {
  2338. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2339. }
  2340. if c.ctx_ != nil {
  2341. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2342. }
  2343. return c.s.client.Do(req)
  2344. }
  2345. // Do executes the "calendar.calendarList.get" call.
  2346. // Exactly one of *CalendarListEntry or error will be non-nil. Any
  2347. // non-2xx status code is an error. Response headers are in either
  2348. // *CalendarListEntry.ServerResponse.Header or (if a response was
  2349. // returned at all) in error.(*googleapi.Error).Header. Use
  2350. // googleapi.IsNotModified to check whether the returned error was
  2351. // because http.StatusNotModified was returned.
  2352. func (c *CalendarListGetCall) Do(opts ...googleapi.CallOption) (*CalendarListEntry, error) {
  2353. gensupport.SetOptions(c.urlParams_, opts...)
  2354. res, err := c.doRequest("json")
  2355. if res != nil && res.StatusCode == http.StatusNotModified {
  2356. if res.Body != nil {
  2357. res.Body.Close()
  2358. }
  2359. return nil, &googleapi.Error{
  2360. Code: res.StatusCode,
  2361. Header: res.Header,
  2362. }
  2363. }
  2364. if err != nil {
  2365. return nil, err
  2366. }
  2367. defer googleapi.CloseBody(res)
  2368. if err := googleapi.CheckResponse(res); err != nil {
  2369. return nil, err
  2370. }
  2371. ret := &CalendarListEntry{
  2372. ServerResponse: googleapi.ServerResponse{
  2373. Header: res.Header,
  2374. HTTPStatusCode: res.StatusCode,
  2375. },
  2376. }
  2377. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2378. return nil, err
  2379. }
  2380. return ret, nil
  2381. // {
  2382. // "description": "Returns an entry on the user's calendar list.",
  2383. // "httpMethod": "GET",
  2384. // "id": "calendar.calendarList.get",
  2385. // "parameterOrder": [
  2386. // "calendarId"
  2387. // ],
  2388. // "parameters": {
  2389. // "calendarId": {
  2390. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  2391. // "location": "path",
  2392. // "required": true,
  2393. // "type": "string"
  2394. // }
  2395. // },
  2396. // "path": "users/me/calendarList/{calendarId}",
  2397. // "response": {
  2398. // "$ref": "CalendarListEntry"
  2399. // },
  2400. // "scopes": [
  2401. // "https://www.googleapis.com/auth/calendar",
  2402. // "https://www.googleapis.com/auth/calendar.readonly"
  2403. // ]
  2404. // }
  2405. }
  2406. // method id "calendar.calendarList.insert":
  2407. type CalendarListInsertCall struct {
  2408. s *Service
  2409. calendarlistentry *CalendarListEntry
  2410. urlParams_ gensupport.URLParams
  2411. ctx_ context.Context
  2412. }
  2413. // Insert: Adds an entry to the user's calendar list.
  2414. func (r *CalendarListService) Insert(calendarlistentry *CalendarListEntry) *CalendarListInsertCall {
  2415. c := &CalendarListInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2416. c.calendarlistentry = calendarlistentry
  2417. return c
  2418. }
  2419. // ColorRgbFormat sets the optional parameter "colorRgbFormat": Whether
  2420. // to use the foregroundColor and backgroundColor fields to write the
  2421. // calendar colors (RGB). If this feature is used, the index-based
  2422. // colorId field will be set to the best matching option automatically.
  2423. // The default is False.
  2424. func (c *CalendarListInsertCall) ColorRgbFormat(colorRgbFormat bool) *CalendarListInsertCall {
  2425. c.urlParams_.Set("colorRgbFormat", fmt.Sprint(colorRgbFormat))
  2426. return c
  2427. }
  2428. // Fields allows partial responses to be retrieved. See
  2429. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2430. // for more information.
  2431. func (c *CalendarListInsertCall) Fields(s ...googleapi.Field) *CalendarListInsertCall {
  2432. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2433. return c
  2434. }
  2435. // Context sets the context to be used in this call's Do method. Any
  2436. // pending HTTP request will be aborted if the provided context is
  2437. // canceled.
  2438. func (c *CalendarListInsertCall) Context(ctx context.Context) *CalendarListInsertCall {
  2439. c.ctx_ = ctx
  2440. return c
  2441. }
  2442. func (c *CalendarListInsertCall) doRequest(alt string) (*http.Response, error) {
  2443. var body io.Reader = nil
  2444. body, err := googleapi.WithoutDataWrapper.JSONReader(c.calendarlistentry)
  2445. if err != nil {
  2446. return nil, err
  2447. }
  2448. ctype := "application/json"
  2449. c.urlParams_.Set("alt", alt)
  2450. urls := googleapi.ResolveRelative(c.s.BasePath, "users/me/calendarList")
  2451. urls += "?" + c.urlParams_.Encode()
  2452. req, _ := http.NewRequest("POST", urls, body)
  2453. googleapi.SetOpaque(req.URL)
  2454. req.Header.Set("Content-Type", ctype)
  2455. req.Header.Set("User-Agent", c.s.userAgent())
  2456. if c.ctx_ != nil {
  2457. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2458. }
  2459. return c.s.client.Do(req)
  2460. }
  2461. // Do executes the "calendar.calendarList.insert" call.
  2462. // Exactly one of *CalendarListEntry or error will be non-nil. Any
  2463. // non-2xx status code is an error. Response headers are in either
  2464. // *CalendarListEntry.ServerResponse.Header or (if a response was
  2465. // returned at all) in error.(*googleapi.Error).Header. Use
  2466. // googleapi.IsNotModified to check whether the returned error was
  2467. // because http.StatusNotModified was returned.
  2468. func (c *CalendarListInsertCall) Do(opts ...googleapi.CallOption) (*CalendarListEntry, error) {
  2469. gensupport.SetOptions(c.urlParams_, opts...)
  2470. res, err := c.doRequest("json")
  2471. if res != nil && res.StatusCode == http.StatusNotModified {
  2472. if res.Body != nil {
  2473. res.Body.Close()
  2474. }
  2475. return nil, &googleapi.Error{
  2476. Code: res.StatusCode,
  2477. Header: res.Header,
  2478. }
  2479. }
  2480. if err != nil {
  2481. return nil, err
  2482. }
  2483. defer googleapi.CloseBody(res)
  2484. if err := googleapi.CheckResponse(res); err != nil {
  2485. return nil, err
  2486. }
  2487. ret := &CalendarListEntry{
  2488. ServerResponse: googleapi.ServerResponse{
  2489. Header: res.Header,
  2490. HTTPStatusCode: res.StatusCode,
  2491. },
  2492. }
  2493. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2494. return nil, err
  2495. }
  2496. return ret, nil
  2497. // {
  2498. // "description": "Adds an entry to the user's calendar list.",
  2499. // "httpMethod": "POST",
  2500. // "id": "calendar.calendarList.insert",
  2501. // "parameters": {
  2502. // "colorRgbFormat": {
  2503. // "description": "Whether to use the foregroundColor and backgroundColor fields to write the calendar colors (RGB). If this feature is used, the index-based colorId field will be set to the best matching option automatically. Optional. The default is False.",
  2504. // "location": "query",
  2505. // "type": "boolean"
  2506. // }
  2507. // },
  2508. // "path": "users/me/calendarList",
  2509. // "request": {
  2510. // "$ref": "CalendarListEntry"
  2511. // },
  2512. // "response": {
  2513. // "$ref": "CalendarListEntry"
  2514. // },
  2515. // "scopes": [
  2516. // "https://www.googleapis.com/auth/calendar"
  2517. // ]
  2518. // }
  2519. }
  2520. // method id "calendar.calendarList.list":
  2521. type CalendarListListCall struct {
  2522. s *Service
  2523. urlParams_ gensupport.URLParams
  2524. ifNoneMatch_ string
  2525. ctx_ context.Context
  2526. }
  2527. // List: Returns entries on the user's calendar list.
  2528. func (r *CalendarListService) List() *CalendarListListCall {
  2529. c := &CalendarListListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2530. return c
  2531. }
  2532. // MaxResults sets the optional parameter "maxResults": Maximum number
  2533. // of entries returned on one result page. By default the value is 100
  2534. // entries. The page size can never be larger than 250 entries.
  2535. func (c *CalendarListListCall) MaxResults(maxResults int64) *CalendarListListCall {
  2536. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2537. return c
  2538. }
  2539. // MinAccessRole sets the optional parameter "minAccessRole": The
  2540. // minimum access role for the user in the returned entries. The
  2541. // default is no restriction.
  2542. //
  2543. // Possible values:
  2544. // "freeBusyReader" - The user can read free/busy information.
  2545. // "owner" - The user can read and modify events and access control
  2546. // lists.
  2547. // "reader" - The user can read events that are not private.
  2548. // "writer" - The user can read and modify events.
  2549. func (c *CalendarListListCall) MinAccessRole(minAccessRole string) *CalendarListListCall {
  2550. c.urlParams_.Set("minAccessRole", minAccessRole)
  2551. return c
  2552. }
  2553. // PageToken sets the optional parameter "pageToken": Token specifying
  2554. // which result page to return.
  2555. func (c *CalendarListListCall) PageToken(pageToken string) *CalendarListListCall {
  2556. c.urlParams_.Set("pageToken", pageToken)
  2557. return c
  2558. }
  2559. // ShowDeleted sets the optional parameter "showDeleted": Whether to
  2560. // include deleted calendar list entries in the result. The default is
  2561. // False.
  2562. func (c *CalendarListListCall) ShowDeleted(showDeleted bool) *CalendarListListCall {
  2563. c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
  2564. return c
  2565. }
  2566. // ShowHidden sets the optional parameter "showHidden": Whether to show
  2567. // hidden entries. The default is False.
  2568. func (c *CalendarListListCall) ShowHidden(showHidden bool) *CalendarListListCall {
  2569. c.urlParams_.Set("showHidden", fmt.Sprint(showHidden))
  2570. return c
  2571. }
  2572. // SyncToken sets the optional parameter "syncToken": Token obtained
  2573. // from the nextSyncToken field returned on the last page of results
  2574. // from the previous list request. It makes the result of this list
  2575. // request contain only entries that have changed since then. If only
  2576. // read-only fields such as calendar properties or ACLs have changed,
  2577. // the entry won't be returned. All entries deleted and hidden since the
  2578. // previous list request will always be in the result set and it is not
  2579. // allowed to set showDeleted neither showHidden to False.
  2580. // To ensure client state consistency minAccessRole query parameter
  2581. // cannot be specified together with nextSyncToken.
  2582. // If the syncToken expires, the server will respond with a 410 GONE
  2583. // response code and the client should clear its storage and perform a
  2584. // full synchronization without any syncToken.
  2585. // Learn more about incremental synchronization.
  2586. // The default is to return all entries.
  2587. func (c *CalendarListListCall) SyncToken(syncToken string) *CalendarListListCall {
  2588. c.urlParams_.Set("syncToken", syncToken)
  2589. return c
  2590. }
  2591. // Fields allows partial responses to be retrieved. See
  2592. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2593. // for more information.
  2594. func (c *CalendarListListCall) Fields(s ...googleapi.Field) *CalendarListListCall {
  2595. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2596. return c
  2597. }
  2598. // IfNoneMatch sets the optional parameter which makes the operation
  2599. // fail if the object's ETag matches the given value. This is useful for
  2600. // getting updates only after the object has changed since the last
  2601. // request. Use googleapi.IsNotModified to check whether the response
  2602. // error from Do is the result of In-None-Match.
  2603. func (c *CalendarListListCall) IfNoneMatch(entityTag string) *CalendarListListCall {
  2604. c.ifNoneMatch_ = entityTag
  2605. return c
  2606. }
  2607. // Context sets the context to be used in this call's Do method. Any
  2608. // pending HTTP request will be aborted if the provided context is
  2609. // canceled.
  2610. func (c *CalendarListListCall) Context(ctx context.Context) *CalendarListListCall {
  2611. c.ctx_ = ctx
  2612. return c
  2613. }
  2614. func (c *CalendarListListCall) doRequest(alt string) (*http.Response, error) {
  2615. var body io.Reader = nil
  2616. c.urlParams_.Set("alt", alt)
  2617. urls := googleapi.ResolveRelative(c.s.BasePath, "users/me/calendarList")
  2618. urls += "?" + c.urlParams_.Encode()
  2619. req, _ := http.NewRequest("GET", urls, body)
  2620. googleapi.SetOpaque(req.URL)
  2621. req.Header.Set("User-Agent", c.s.userAgent())
  2622. if c.ifNoneMatch_ != "" {
  2623. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2624. }
  2625. if c.ctx_ != nil {
  2626. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2627. }
  2628. return c.s.client.Do(req)
  2629. }
  2630. // Do executes the "calendar.calendarList.list" call.
  2631. // Exactly one of *CalendarList or error will be non-nil. Any non-2xx
  2632. // status code is an error. Response headers are in either
  2633. // *CalendarList.ServerResponse.Header or (if a response was returned at
  2634. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2635. // to check whether the returned error was because
  2636. // http.StatusNotModified was returned.
  2637. func (c *CalendarListListCall) Do(opts ...googleapi.CallOption) (*CalendarList, error) {
  2638. gensupport.SetOptions(c.urlParams_, opts...)
  2639. res, err := c.doRequest("json")
  2640. if res != nil && res.StatusCode == http.StatusNotModified {
  2641. if res.Body != nil {
  2642. res.Body.Close()
  2643. }
  2644. return nil, &googleapi.Error{
  2645. Code: res.StatusCode,
  2646. Header: res.Header,
  2647. }
  2648. }
  2649. if err != nil {
  2650. return nil, err
  2651. }
  2652. defer googleapi.CloseBody(res)
  2653. if err := googleapi.CheckResponse(res); err != nil {
  2654. return nil, err
  2655. }
  2656. ret := &CalendarList{
  2657. ServerResponse: googleapi.ServerResponse{
  2658. Header: res.Header,
  2659. HTTPStatusCode: res.StatusCode,
  2660. },
  2661. }
  2662. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2663. return nil, err
  2664. }
  2665. return ret, nil
  2666. // {
  2667. // "description": "Returns entries on the user's calendar list.",
  2668. // "httpMethod": "GET",
  2669. // "id": "calendar.calendarList.list",
  2670. // "parameters": {
  2671. // "maxResults": {
  2672. // "description": "Maximum number of entries returned on one result page. By default the value is 100 entries. The page size can never be larger than 250 entries. Optional.",
  2673. // "format": "int32",
  2674. // "location": "query",
  2675. // "minimum": "1",
  2676. // "type": "integer"
  2677. // },
  2678. // "minAccessRole": {
  2679. // "description": "The minimum access role for the user in the returned entries. Optional. The default is no restriction.",
  2680. // "enum": [
  2681. // "freeBusyReader",
  2682. // "owner",
  2683. // "reader",
  2684. // "writer"
  2685. // ],
  2686. // "enumDescriptions": [
  2687. // "The user can read free/busy information.",
  2688. // "The user can read and modify events and access control lists.",
  2689. // "The user can read events that are not private.",
  2690. // "The user can read and modify events."
  2691. // ],
  2692. // "location": "query",
  2693. // "type": "string"
  2694. // },
  2695. // "pageToken": {
  2696. // "description": "Token specifying which result page to return. Optional.",
  2697. // "location": "query",
  2698. // "type": "string"
  2699. // },
  2700. // "showDeleted": {
  2701. // "description": "Whether to include deleted calendar list entries in the result. Optional. The default is False.",
  2702. // "location": "query",
  2703. // "type": "boolean"
  2704. // },
  2705. // "showHidden": {
  2706. // "description": "Whether to show hidden entries. Optional. The default is False.",
  2707. // "location": "query",
  2708. // "type": "boolean"
  2709. // },
  2710. // "syncToken": {
  2711. // "description": "Token obtained from the nextSyncToken field returned on the last page of results from the previous list request. It makes the result of this list request contain only entries that have changed since then. If only read-only fields such as calendar properties or ACLs have changed, the entry won't be returned. All entries deleted and hidden since the previous list request will always be in the result set and it is not allowed to set showDeleted neither showHidden to False.\nTo ensure client state consistency minAccessRole query parameter cannot be specified together with nextSyncToken.\nIf the syncToken expires, the server will respond with a 410 GONE response code and the client should clear its storage and perform a full synchronization without any syncToken.\nLearn more about incremental synchronization.\nOptional. The default is to return all entries.",
  2712. // "location": "query",
  2713. // "type": "string"
  2714. // }
  2715. // },
  2716. // "path": "users/me/calendarList",
  2717. // "response": {
  2718. // "$ref": "CalendarList"
  2719. // },
  2720. // "scopes": [
  2721. // "https://www.googleapis.com/auth/calendar",
  2722. // "https://www.googleapis.com/auth/calendar.readonly"
  2723. // ],
  2724. // "supportsSubscription": true
  2725. // }
  2726. }
  2727. // Pages invokes f for each page of results.
  2728. // A non-nil error returned from f will halt the iteration.
  2729. // The provided context supersedes any context provided to the Context method.
  2730. func (c *CalendarListListCall) Pages(ctx context.Context, f func(*CalendarList) error) error {
  2731. c.ctx_ = ctx
  2732. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2733. for {
  2734. x, err := c.Do()
  2735. if err != nil {
  2736. return err
  2737. }
  2738. if err := f(x); err != nil {
  2739. return err
  2740. }
  2741. if x.NextPageToken == "" {
  2742. return nil
  2743. }
  2744. c.PageToken(x.NextPageToken)
  2745. }
  2746. }
  2747. // method id "calendar.calendarList.patch":
  2748. type CalendarListPatchCall struct {
  2749. s *Service
  2750. calendarId string
  2751. calendarlistentry *CalendarListEntry
  2752. urlParams_ gensupport.URLParams
  2753. ctx_ context.Context
  2754. }
  2755. // Patch: Updates an entry on the user's calendar list. This method
  2756. // supports patch semantics.
  2757. func (r *CalendarListService) Patch(calendarId string, calendarlistentry *CalendarListEntry) *CalendarListPatchCall {
  2758. c := &CalendarListPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2759. c.calendarId = calendarId
  2760. c.calendarlistentry = calendarlistentry
  2761. return c
  2762. }
  2763. // ColorRgbFormat sets the optional parameter "colorRgbFormat": Whether
  2764. // to use the foregroundColor and backgroundColor fields to write the
  2765. // calendar colors (RGB). If this feature is used, the index-based
  2766. // colorId field will be set to the best matching option automatically.
  2767. // The default is False.
  2768. func (c *CalendarListPatchCall) ColorRgbFormat(colorRgbFormat bool) *CalendarListPatchCall {
  2769. c.urlParams_.Set("colorRgbFormat", fmt.Sprint(colorRgbFormat))
  2770. return c
  2771. }
  2772. // Fields allows partial responses to be retrieved. See
  2773. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2774. // for more information.
  2775. func (c *CalendarListPatchCall) Fields(s ...googleapi.Field) *CalendarListPatchCall {
  2776. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2777. return c
  2778. }
  2779. // Context sets the context to be used in this call's Do method. Any
  2780. // pending HTTP request will be aborted if the provided context is
  2781. // canceled.
  2782. func (c *CalendarListPatchCall) Context(ctx context.Context) *CalendarListPatchCall {
  2783. c.ctx_ = ctx
  2784. return c
  2785. }
  2786. func (c *CalendarListPatchCall) doRequest(alt string) (*http.Response, error) {
  2787. var body io.Reader = nil
  2788. body, err := googleapi.WithoutDataWrapper.JSONReader(c.calendarlistentry)
  2789. if err != nil {
  2790. return nil, err
  2791. }
  2792. ctype := "application/json"
  2793. c.urlParams_.Set("alt", alt)
  2794. urls := googleapi.ResolveRelative(c.s.BasePath, "users/me/calendarList/{calendarId}")
  2795. urls += "?" + c.urlParams_.Encode()
  2796. req, _ := http.NewRequest("PATCH", urls, body)
  2797. googleapi.Expand(req.URL, map[string]string{
  2798. "calendarId": c.calendarId,
  2799. })
  2800. req.Header.Set("Content-Type", ctype)
  2801. req.Header.Set("User-Agent", c.s.userAgent())
  2802. if c.ctx_ != nil {
  2803. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2804. }
  2805. return c.s.client.Do(req)
  2806. }
  2807. // Do executes the "calendar.calendarList.patch" call.
  2808. // Exactly one of *CalendarListEntry or error will be non-nil. Any
  2809. // non-2xx status code is an error. Response headers are in either
  2810. // *CalendarListEntry.ServerResponse.Header or (if a response was
  2811. // returned at all) in error.(*googleapi.Error).Header. Use
  2812. // googleapi.IsNotModified to check whether the returned error was
  2813. // because http.StatusNotModified was returned.
  2814. func (c *CalendarListPatchCall) Do(opts ...googleapi.CallOption) (*CalendarListEntry, error) {
  2815. gensupport.SetOptions(c.urlParams_, opts...)
  2816. res, err := c.doRequest("json")
  2817. if res != nil && res.StatusCode == http.StatusNotModified {
  2818. if res.Body != nil {
  2819. res.Body.Close()
  2820. }
  2821. return nil, &googleapi.Error{
  2822. Code: res.StatusCode,
  2823. Header: res.Header,
  2824. }
  2825. }
  2826. if err != nil {
  2827. return nil, err
  2828. }
  2829. defer googleapi.CloseBody(res)
  2830. if err := googleapi.CheckResponse(res); err != nil {
  2831. return nil, err
  2832. }
  2833. ret := &CalendarListEntry{
  2834. ServerResponse: googleapi.ServerResponse{
  2835. Header: res.Header,
  2836. HTTPStatusCode: res.StatusCode,
  2837. },
  2838. }
  2839. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2840. return nil, err
  2841. }
  2842. return ret, nil
  2843. // {
  2844. // "description": "Updates an entry on the user's calendar list. This method supports patch semantics.",
  2845. // "httpMethod": "PATCH",
  2846. // "id": "calendar.calendarList.patch",
  2847. // "parameterOrder": [
  2848. // "calendarId"
  2849. // ],
  2850. // "parameters": {
  2851. // "calendarId": {
  2852. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  2853. // "location": "path",
  2854. // "required": true,
  2855. // "type": "string"
  2856. // },
  2857. // "colorRgbFormat": {
  2858. // "description": "Whether to use the foregroundColor and backgroundColor fields to write the calendar colors (RGB). If this feature is used, the index-based colorId field will be set to the best matching option automatically. Optional. The default is False.",
  2859. // "location": "query",
  2860. // "type": "boolean"
  2861. // }
  2862. // },
  2863. // "path": "users/me/calendarList/{calendarId}",
  2864. // "request": {
  2865. // "$ref": "CalendarListEntry"
  2866. // },
  2867. // "response": {
  2868. // "$ref": "CalendarListEntry"
  2869. // },
  2870. // "scopes": [
  2871. // "https://www.googleapis.com/auth/calendar"
  2872. // ]
  2873. // }
  2874. }
  2875. // method id "calendar.calendarList.update":
  2876. type CalendarListUpdateCall struct {
  2877. s *Service
  2878. calendarId string
  2879. calendarlistentry *CalendarListEntry
  2880. urlParams_ gensupport.URLParams
  2881. ctx_ context.Context
  2882. }
  2883. // Update: Updates an entry on the user's calendar list.
  2884. func (r *CalendarListService) Update(calendarId string, calendarlistentry *CalendarListEntry) *CalendarListUpdateCall {
  2885. c := &CalendarListUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2886. c.calendarId = calendarId
  2887. c.calendarlistentry = calendarlistentry
  2888. return c
  2889. }
  2890. // ColorRgbFormat sets the optional parameter "colorRgbFormat": Whether
  2891. // to use the foregroundColor and backgroundColor fields to write the
  2892. // calendar colors (RGB). If this feature is used, the index-based
  2893. // colorId field will be set to the best matching option automatically.
  2894. // The default is False.
  2895. func (c *CalendarListUpdateCall) ColorRgbFormat(colorRgbFormat bool) *CalendarListUpdateCall {
  2896. c.urlParams_.Set("colorRgbFormat", fmt.Sprint(colorRgbFormat))
  2897. return c
  2898. }
  2899. // Fields allows partial responses to be retrieved. See
  2900. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2901. // for more information.
  2902. func (c *CalendarListUpdateCall) Fields(s ...googleapi.Field) *CalendarListUpdateCall {
  2903. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2904. return c
  2905. }
  2906. // Context sets the context to be used in this call's Do method. Any
  2907. // pending HTTP request will be aborted if the provided context is
  2908. // canceled.
  2909. func (c *CalendarListUpdateCall) Context(ctx context.Context) *CalendarListUpdateCall {
  2910. c.ctx_ = ctx
  2911. return c
  2912. }
  2913. func (c *CalendarListUpdateCall) doRequest(alt string) (*http.Response, error) {
  2914. var body io.Reader = nil
  2915. body, err := googleapi.WithoutDataWrapper.JSONReader(c.calendarlistentry)
  2916. if err != nil {
  2917. return nil, err
  2918. }
  2919. ctype := "application/json"
  2920. c.urlParams_.Set("alt", alt)
  2921. urls := googleapi.ResolveRelative(c.s.BasePath, "users/me/calendarList/{calendarId}")
  2922. urls += "?" + c.urlParams_.Encode()
  2923. req, _ := http.NewRequest("PUT", urls, body)
  2924. googleapi.Expand(req.URL, map[string]string{
  2925. "calendarId": c.calendarId,
  2926. })
  2927. req.Header.Set("Content-Type", ctype)
  2928. req.Header.Set("User-Agent", c.s.userAgent())
  2929. if c.ctx_ != nil {
  2930. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2931. }
  2932. return c.s.client.Do(req)
  2933. }
  2934. // Do executes the "calendar.calendarList.update" call.
  2935. // Exactly one of *CalendarListEntry or error will be non-nil. Any
  2936. // non-2xx status code is an error. Response headers are in either
  2937. // *CalendarListEntry.ServerResponse.Header or (if a response was
  2938. // returned at all) in error.(*googleapi.Error).Header. Use
  2939. // googleapi.IsNotModified to check whether the returned error was
  2940. // because http.StatusNotModified was returned.
  2941. func (c *CalendarListUpdateCall) Do(opts ...googleapi.CallOption) (*CalendarListEntry, error) {
  2942. gensupport.SetOptions(c.urlParams_, opts...)
  2943. res, err := c.doRequest("json")
  2944. if res != nil && res.StatusCode == http.StatusNotModified {
  2945. if res.Body != nil {
  2946. res.Body.Close()
  2947. }
  2948. return nil, &googleapi.Error{
  2949. Code: res.StatusCode,
  2950. Header: res.Header,
  2951. }
  2952. }
  2953. if err != nil {
  2954. return nil, err
  2955. }
  2956. defer googleapi.CloseBody(res)
  2957. if err := googleapi.CheckResponse(res); err != nil {
  2958. return nil, err
  2959. }
  2960. ret := &CalendarListEntry{
  2961. ServerResponse: googleapi.ServerResponse{
  2962. Header: res.Header,
  2963. HTTPStatusCode: res.StatusCode,
  2964. },
  2965. }
  2966. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2967. return nil, err
  2968. }
  2969. return ret, nil
  2970. // {
  2971. // "description": "Updates an entry on the user's calendar list.",
  2972. // "httpMethod": "PUT",
  2973. // "id": "calendar.calendarList.update",
  2974. // "parameterOrder": [
  2975. // "calendarId"
  2976. // ],
  2977. // "parameters": {
  2978. // "calendarId": {
  2979. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  2980. // "location": "path",
  2981. // "required": true,
  2982. // "type": "string"
  2983. // },
  2984. // "colorRgbFormat": {
  2985. // "description": "Whether to use the foregroundColor and backgroundColor fields to write the calendar colors (RGB). If this feature is used, the index-based colorId field will be set to the best matching option automatically. Optional. The default is False.",
  2986. // "location": "query",
  2987. // "type": "boolean"
  2988. // }
  2989. // },
  2990. // "path": "users/me/calendarList/{calendarId}",
  2991. // "request": {
  2992. // "$ref": "CalendarListEntry"
  2993. // },
  2994. // "response": {
  2995. // "$ref": "CalendarListEntry"
  2996. // },
  2997. // "scopes": [
  2998. // "https://www.googleapis.com/auth/calendar"
  2999. // ]
  3000. // }
  3001. }
  3002. // method id "calendar.calendarList.watch":
  3003. type CalendarListWatchCall struct {
  3004. s *Service
  3005. channel *Channel
  3006. urlParams_ gensupport.URLParams
  3007. ctx_ context.Context
  3008. }
  3009. // Watch: Watch for changes to CalendarList resources.
  3010. func (r *CalendarListService) Watch(channel *Channel) *CalendarListWatchCall {
  3011. c := &CalendarListWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3012. c.channel = channel
  3013. return c
  3014. }
  3015. // MaxResults sets the optional parameter "maxResults": Maximum number
  3016. // of entries returned on one result page. By default the value is 100
  3017. // entries. The page size can never be larger than 250 entries.
  3018. func (c *CalendarListWatchCall) MaxResults(maxResults int64) *CalendarListWatchCall {
  3019. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3020. return c
  3021. }
  3022. // MinAccessRole sets the optional parameter "minAccessRole": The
  3023. // minimum access role for the user in the returned entries. The
  3024. // default is no restriction.
  3025. //
  3026. // Possible values:
  3027. // "freeBusyReader" - The user can read free/busy information.
  3028. // "owner" - The user can read and modify events and access control
  3029. // lists.
  3030. // "reader" - The user can read events that are not private.
  3031. // "writer" - The user can read and modify events.
  3032. func (c *CalendarListWatchCall) MinAccessRole(minAccessRole string) *CalendarListWatchCall {
  3033. c.urlParams_.Set("minAccessRole", minAccessRole)
  3034. return c
  3035. }
  3036. // PageToken sets the optional parameter "pageToken": Token specifying
  3037. // which result page to return.
  3038. func (c *CalendarListWatchCall) PageToken(pageToken string) *CalendarListWatchCall {
  3039. c.urlParams_.Set("pageToken", pageToken)
  3040. return c
  3041. }
  3042. // ShowDeleted sets the optional parameter "showDeleted": Whether to
  3043. // include deleted calendar list entries in the result. The default is
  3044. // False.
  3045. func (c *CalendarListWatchCall) ShowDeleted(showDeleted bool) *CalendarListWatchCall {
  3046. c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
  3047. return c
  3048. }
  3049. // ShowHidden sets the optional parameter "showHidden": Whether to show
  3050. // hidden entries. The default is False.
  3051. func (c *CalendarListWatchCall) ShowHidden(showHidden bool) *CalendarListWatchCall {
  3052. c.urlParams_.Set("showHidden", fmt.Sprint(showHidden))
  3053. return c
  3054. }
  3055. // SyncToken sets the optional parameter "syncToken": Token obtained
  3056. // from the nextSyncToken field returned on the last page of results
  3057. // from the previous list request. It makes the result of this list
  3058. // request contain only entries that have changed since then. If only
  3059. // read-only fields such as calendar properties or ACLs have changed,
  3060. // the entry won't be returned. All entries deleted and hidden since the
  3061. // previous list request will always be in the result set and it is not
  3062. // allowed to set showDeleted neither showHidden to False.
  3063. // To ensure client state consistency minAccessRole query parameter
  3064. // cannot be specified together with nextSyncToken.
  3065. // If the syncToken expires, the server will respond with a 410 GONE
  3066. // response code and the client should clear its storage and perform a
  3067. // full synchronization without any syncToken.
  3068. // Learn more about incremental synchronization.
  3069. // The default is to return all entries.
  3070. func (c *CalendarListWatchCall) SyncToken(syncToken string) *CalendarListWatchCall {
  3071. c.urlParams_.Set("syncToken", syncToken)
  3072. return c
  3073. }
  3074. // Fields allows partial responses to be retrieved. See
  3075. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3076. // for more information.
  3077. func (c *CalendarListWatchCall) Fields(s ...googleapi.Field) *CalendarListWatchCall {
  3078. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3079. return c
  3080. }
  3081. // Context sets the context to be used in this call's Do method. Any
  3082. // pending HTTP request will be aborted if the provided context is
  3083. // canceled.
  3084. func (c *CalendarListWatchCall) Context(ctx context.Context) *CalendarListWatchCall {
  3085. c.ctx_ = ctx
  3086. return c
  3087. }
  3088. func (c *CalendarListWatchCall) doRequest(alt string) (*http.Response, error) {
  3089. var body io.Reader = nil
  3090. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  3091. if err != nil {
  3092. return nil, err
  3093. }
  3094. ctype := "application/json"
  3095. c.urlParams_.Set("alt", alt)
  3096. urls := googleapi.ResolveRelative(c.s.BasePath, "users/me/calendarList/watch")
  3097. urls += "?" + c.urlParams_.Encode()
  3098. req, _ := http.NewRequest("POST", urls, body)
  3099. googleapi.SetOpaque(req.URL)
  3100. req.Header.Set("Content-Type", ctype)
  3101. req.Header.Set("User-Agent", c.s.userAgent())
  3102. if c.ctx_ != nil {
  3103. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3104. }
  3105. return c.s.client.Do(req)
  3106. }
  3107. // Do executes the "calendar.calendarList.watch" call.
  3108. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  3109. // code is an error. Response headers are in either
  3110. // *Channel.ServerResponse.Header or (if a response was returned at all)
  3111. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3112. // check whether the returned error was because http.StatusNotModified
  3113. // was returned.
  3114. func (c *CalendarListWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  3115. gensupport.SetOptions(c.urlParams_, opts...)
  3116. res, err := c.doRequest("json")
  3117. if res != nil && res.StatusCode == http.StatusNotModified {
  3118. if res.Body != nil {
  3119. res.Body.Close()
  3120. }
  3121. return nil, &googleapi.Error{
  3122. Code: res.StatusCode,
  3123. Header: res.Header,
  3124. }
  3125. }
  3126. if err != nil {
  3127. return nil, err
  3128. }
  3129. defer googleapi.CloseBody(res)
  3130. if err := googleapi.CheckResponse(res); err != nil {
  3131. return nil, err
  3132. }
  3133. ret := &Channel{
  3134. ServerResponse: googleapi.ServerResponse{
  3135. Header: res.Header,
  3136. HTTPStatusCode: res.StatusCode,
  3137. },
  3138. }
  3139. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3140. return nil, err
  3141. }
  3142. return ret, nil
  3143. // {
  3144. // "description": "Watch for changes to CalendarList resources.",
  3145. // "httpMethod": "POST",
  3146. // "id": "calendar.calendarList.watch",
  3147. // "parameters": {
  3148. // "maxResults": {
  3149. // "description": "Maximum number of entries returned on one result page. By default the value is 100 entries. The page size can never be larger than 250 entries. Optional.",
  3150. // "format": "int32",
  3151. // "location": "query",
  3152. // "minimum": "1",
  3153. // "type": "integer"
  3154. // },
  3155. // "minAccessRole": {
  3156. // "description": "The minimum access role for the user in the returned entries. Optional. The default is no restriction.",
  3157. // "enum": [
  3158. // "freeBusyReader",
  3159. // "owner",
  3160. // "reader",
  3161. // "writer"
  3162. // ],
  3163. // "enumDescriptions": [
  3164. // "The user can read free/busy information.",
  3165. // "The user can read and modify events and access control lists.",
  3166. // "The user can read events that are not private.",
  3167. // "The user can read and modify events."
  3168. // ],
  3169. // "location": "query",
  3170. // "type": "string"
  3171. // },
  3172. // "pageToken": {
  3173. // "description": "Token specifying which result page to return. Optional.",
  3174. // "location": "query",
  3175. // "type": "string"
  3176. // },
  3177. // "showDeleted": {
  3178. // "description": "Whether to include deleted calendar list entries in the result. Optional. The default is False.",
  3179. // "location": "query",
  3180. // "type": "boolean"
  3181. // },
  3182. // "showHidden": {
  3183. // "description": "Whether to show hidden entries. Optional. The default is False.",
  3184. // "location": "query",
  3185. // "type": "boolean"
  3186. // },
  3187. // "syncToken": {
  3188. // "description": "Token obtained from the nextSyncToken field returned on the last page of results from the previous list request. It makes the result of this list request contain only entries that have changed since then. If only read-only fields such as calendar properties or ACLs have changed, the entry won't be returned. All entries deleted and hidden since the previous list request will always be in the result set and it is not allowed to set showDeleted neither showHidden to False.\nTo ensure client state consistency minAccessRole query parameter cannot be specified together with nextSyncToken.\nIf the syncToken expires, the server will respond with a 410 GONE response code and the client should clear its storage and perform a full synchronization without any syncToken.\nLearn more about incremental synchronization.\nOptional. The default is to return all entries.",
  3189. // "location": "query",
  3190. // "type": "string"
  3191. // }
  3192. // },
  3193. // "path": "users/me/calendarList/watch",
  3194. // "request": {
  3195. // "$ref": "Channel",
  3196. // "parameterName": "resource"
  3197. // },
  3198. // "response": {
  3199. // "$ref": "Channel"
  3200. // },
  3201. // "scopes": [
  3202. // "https://www.googleapis.com/auth/calendar",
  3203. // "https://www.googleapis.com/auth/calendar.readonly"
  3204. // ],
  3205. // "supportsSubscription": true
  3206. // }
  3207. }
  3208. // method id "calendar.calendars.clear":
  3209. type CalendarsClearCall struct {
  3210. s *Service
  3211. calendarId string
  3212. urlParams_ gensupport.URLParams
  3213. ctx_ context.Context
  3214. }
  3215. // Clear: Clears a primary calendar. This operation deletes all events
  3216. // associated with the primary calendar of an account.
  3217. func (r *CalendarsService) Clear(calendarId string) *CalendarsClearCall {
  3218. c := &CalendarsClearCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3219. c.calendarId = calendarId
  3220. return c
  3221. }
  3222. // Fields allows partial responses to be retrieved. See
  3223. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3224. // for more information.
  3225. func (c *CalendarsClearCall) Fields(s ...googleapi.Field) *CalendarsClearCall {
  3226. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3227. return c
  3228. }
  3229. // Context sets the context to be used in this call's Do method. Any
  3230. // pending HTTP request will be aborted if the provided context is
  3231. // canceled.
  3232. func (c *CalendarsClearCall) Context(ctx context.Context) *CalendarsClearCall {
  3233. c.ctx_ = ctx
  3234. return c
  3235. }
  3236. func (c *CalendarsClearCall) doRequest(alt string) (*http.Response, error) {
  3237. var body io.Reader = nil
  3238. c.urlParams_.Set("alt", alt)
  3239. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/clear")
  3240. urls += "?" + c.urlParams_.Encode()
  3241. req, _ := http.NewRequest("POST", urls, body)
  3242. googleapi.Expand(req.URL, map[string]string{
  3243. "calendarId": c.calendarId,
  3244. })
  3245. req.Header.Set("User-Agent", c.s.userAgent())
  3246. if c.ctx_ != nil {
  3247. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3248. }
  3249. return c.s.client.Do(req)
  3250. }
  3251. // Do executes the "calendar.calendars.clear" call.
  3252. func (c *CalendarsClearCall) Do(opts ...googleapi.CallOption) error {
  3253. gensupport.SetOptions(c.urlParams_, opts...)
  3254. res, err := c.doRequest("json")
  3255. if err != nil {
  3256. return err
  3257. }
  3258. defer googleapi.CloseBody(res)
  3259. if err := googleapi.CheckResponse(res); err != nil {
  3260. return err
  3261. }
  3262. return nil
  3263. // {
  3264. // "description": "Clears a primary calendar. This operation deletes all events associated with the primary calendar of an account.",
  3265. // "httpMethod": "POST",
  3266. // "id": "calendar.calendars.clear",
  3267. // "parameterOrder": [
  3268. // "calendarId"
  3269. // ],
  3270. // "parameters": {
  3271. // "calendarId": {
  3272. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  3273. // "location": "path",
  3274. // "required": true,
  3275. // "type": "string"
  3276. // }
  3277. // },
  3278. // "path": "calendars/{calendarId}/clear",
  3279. // "scopes": [
  3280. // "https://www.googleapis.com/auth/calendar"
  3281. // ]
  3282. // }
  3283. }
  3284. // method id "calendar.calendars.delete":
  3285. type CalendarsDeleteCall struct {
  3286. s *Service
  3287. calendarId string
  3288. urlParams_ gensupport.URLParams
  3289. ctx_ context.Context
  3290. }
  3291. // Delete: Deletes a secondary calendar. Use calendars.clear for
  3292. // clearing all events on primary calendars.
  3293. func (r *CalendarsService) Delete(calendarId string) *CalendarsDeleteCall {
  3294. c := &CalendarsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3295. c.calendarId = calendarId
  3296. return c
  3297. }
  3298. // Fields allows partial responses to be retrieved. See
  3299. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3300. // for more information.
  3301. func (c *CalendarsDeleteCall) Fields(s ...googleapi.Field) *CalendarsDeleteCall {
  3302. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3303. return c
  3304. }
  3305. // Context sets the context to be used in this call's Do method. Any
  3306. // pending HTTP request will be aborted if the provided context is
  3307. // canceled.
  3308. func (c *CalendarsDeleteCall) Context(ctx context.Context) *CalendarsDeleteCall {
  3309. c.ctx_ = ctx
  3310. return c
  3311. }
  3312. func (c *CalendarsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3313. var body io.Reader = nil
  3314. c.urlParams_.Set("alt", alt)
  3315. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}")
  3316. urls += "?" + c.urlParams_.Encode()
  3317. req, _ := http.NewRequest("DELETE", urls, body)
  3318. googleapi.Expand(req.URL, map[string]string{
  3319. "calendarId": c.calendarId,
  3320. })
  3321. req.Header.Set("User-Agent", c.s.userAgent())
  3322. if c.ctx_ != nil {
  3323. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3324. }
  3325. return c.s.client.Do(req)
  3326. }
  3327. // Do executes the "calendar.calendars.delete" call.
  3328. func (c *CalendarsDeleteCall) Do(opts ...googleapi.CallOption) error {
  3329. gensupport.SetOptions(c.urlParams_, opts...)
  3330. res, err := c.doRequest("json")
  3331. if err != nil {
  3332. return err
  3333. }
  3334. defer googleapi.CloseBody(res)
  3335. if err := googleapi.CheckResponse(res); err != nil {
  3336. return err
  3337. }
  3338. return nil
  3339. // {
  3340. // "description": "Deletes a secondary calendar. Use calendars.clear for clearing all events on primary calendars.",
  3341. // "httpMethod": "DELETE",
  3342. // "id": "calendar.calendars.delete",
  3343. // "parameterOrder": [
  3344. // "calendarId"
  3345. // ],
  3346. // "parameters": {
  3347. // "calendarId": {
  3348. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  3349. // "location": "path",
  3350. // "required": true,
  3351. // "type": "string"
  3352. // }
  3353. // },
  3354. // "path": "calendars/{calendarId}",
  3355. // "scopes": [
  3356. // "https://www.googleapis.com/auth/calendar"
  3357. // ]
  3358. // }
  3359. }
  3360. // method id "calendar.calendars.get":
  3361. type CalendarsGetCall struct {
  3362. s *Service
  3363. calendarId string
  3364. urlParams_ gensupport.URLParams
  3365. ifNoneMatch_ string
  3366. ctx_ context.Context
  3367. }
  3368. // Get: Returns metadata for a calendar.
  3369. func (r *CalendarsService) Get(calendarId string) *CalendarsGetCall {
  3370. c := &CalendarsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3371. c.calendarId = calendarId
  3372. return c
  3373. }
  3374. // Fields allows partial responses to be retrieved. See
  3375. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3376. // for more information.
  3377. func (c *CalendarsGetCall) Fields(s ...googleapi.Field) *CalendarsGetCall {
  3378. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3379. return c
  3380. }
  3381. // IfNoneMatch sets the optional parameter which makes the operation
  3382. // fail if the object's ETag matches the given value. This is useful for
  3383. // getting updates only after the object has changed since the last
  3384. // request. Use googleapi.IsNotModified to check whether the response
  3385. // error from Do is the result of In-None-Match.
  3386. func (c *CalendarsGetCall) IfNoneMatch(entityTag string) *CalendarsGetCall {
  3387. c.ifNoneMatch_ = entityTag
  3388. return c
  3389. }
  3390. // Context sets the context to be used in this call's Do method. Any
  3391. // pending HTTP request will be aborted if the provided context is
  3392. // canceled.
  3393. func (c *CalendarsGetCall) Context(ctx context.Context) *CalendarsGetCall {
  3394. c.ctx_ = ctx
  3395. return c
  3396. }
  3397. func (c *CalendarsGetCall) doRequest(alt string) (*http.Response, error) {
  3398. var body io.Reader = nil
  3399. c.urlParams_.Set("alt", alt)
  3400. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}")
  3401. urls += "?" + c.urlParams_.Encode()
  3402. req, _ := http.NewRequest("GET", urls, body)
  3403. googleapi.Expand(req.URL, map[string]string{
  3404. "calendarId": c.calendarId,
  3405. })
  3406. req.Header.Set("User-Agent", c.s.userAgent())
  3407. if c.ifNoneMatch_ != "" {
  3408. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3409. }
  3410. if c.ctx_ != nil {
  3411. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3412. }
  3413. return c.s.client.Do(req)
  3414. }
  3415. // Do executes the "calendar.calendars.get" call.
  3416. // Exactly one of *Calendar or error will be non-nil. Any non-2xx status
  3417. // code is an error. Response headers are in either
  3418. // *Calendar.ServerResponse.Header or (if a response was returned at
  3419. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3420. // to check whether the returned error was because
  3421. // http.StatusNotModified was returned.
  3422. func (c *CalendarsGetCall) Do(opts ...googleapi.CallOption) (*Calendar, error) {
  3423. gensupport.SetOptions(c.urlParams_, opts...)
  3424. res, err := c.doRequest("json")
  3425. if res != nil && res.StatusCode == http.StatusNotModified {
  3426. if res.Body != nil {
  3427. res.Body.Close()
  3428. }
  3429. return nil, &googleapi.Error{
  3430. Code: res.StatusCode,
  3431. Header: res.Header,
  3432. }
  3433. }
  3434. if err != nil {
  3435. return nil, err
  3436. }
  3437. defer googleapi.CloseBody(res)
  3438. if err := googleapi.CheckResponse(res); err != nil {
  3439. return nil, err
  3440. }
  3441. ret := &Calendar{
  3442. ServerResponse: googleapi.ServerResponse{
  3443. Header: res.Header,
  3444. HTTPStatusCode: res.StatusCode,
  3445. },
  3446. }
  3447. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3448. return nil, err
  3449. }
  3450. return ret, nil
  3451. // {
  3452. // "description": "Returns metadata for a calendar.",
  3453. // "httpMethod": "GET",
  3454. // "id": "calendar.calendars.get",
  3455. // "parameterOrder": [
  3456. // "calendarId"
  3457. // ],
  3458. // "parameters": {
  3459. // "calendarId": {
  3460. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  3461. // "location": "path",
  3462. // "required": true,
  3463. // "type": "string"
  3464. // }
  3465. // },
  3466. // "path": "calendars/{calendarId}",
  3467. // "response": {
  3468. // "$ref": "Calendar"
  3469. // },
  3470. // "scopes": [
  3471. // "https://www.googleapis.com/auth/calendar",
  3472. // "https://www.googleapis.com/auth/calendar.readonly"
  3473. // ]
  3474. // }
  3475. }
  3476. // method id "calendar.calendars.insert":
  3477. type CalendarsInsertCall struct {
  3478. s *Service
  3479. calendar *Calendar
  3480. urlParams_ gensupport.URLParams
  3481. ctx_ context.Context
  3482. }
  3483. // Insert: Creates a secondary calendar.
  3484. func (r *CalendarsService) Insert(calendar *Calendar) *CalendarsInsertCall {
  3485. c := &CalendarsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3486. c.calendar = calendar
  3487. return c
  3488. }
  3489. // Fields allows partial responses to be retrieved. See
  3490. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3491. // for more information.
  3492. func (c *CalendarsInsertCall) Fields(s ...googleapi.Field) *CalendarsInsertCall {
  3493. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3494. return c
  3495. }
  3496. // Context sets the context to be used in this call's Do method. Any
  3497. // pending HTTP request will be aborted if the provided context is
  3498. // canceled.
  3499. func (c *CalendarsInsertCall) Context(ctx context.Context) *CalendarsInsertCall {
  3500. c.ctx_ = ctx
  3501. return c
  3502. }
  3503. func (c *CalendarsInsertCall) doRequest(alt string) (*http.Response, error) {
  3504. var body io.Reader = nil
  3505. body, err := googleapi.WithoutDataWrapper.JSONReader(c.calendar)
  3506. if err != nil {
  3507. return nil, err
  3508. }
  3509. ctype := "application/json"
  3510. c.urlParams_.Set("alt", alt)
  3511. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars")
  3512. urls += "?" + c.urlParams_.Encode()
  3513. req, _ := http.NewRequest("POST", urls, body)
  3514. googleapi.SetOpaque(req.URL)
  3515. req.Header.Set("Content-Type", ctype)
  3516. req.Header.Set("User-Agent", c.s.userAgent())
  3517. if c.ctx_ != nil {
  3518. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3519. }
  3520. return c.s.client.Do(req)
  3521. }
  3522. // Do executes the "calendar.calendars.insert" call.
  3523. // Exactly one of *Calendar or error will be non-nil. Any non-2xx status
  3524. // code is an error. Response headers are in either
  3525. // *Calendar.ServerResponse.Header or (if a response was returned at
  3526. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3527. // to check whether the returned error was because
  3528. // http.StatusNotModified was returned.
  3529. func (c *CalendarsInsertCall) Do(opts ...googleapi.CallOption) (*Calendar, error) {
  3530. gensupport.SetOptions(c.urlParams_, opts...)
  3531. res, err := c.doRequest("json")
  3532. if res != nil && res.StatusCode == http.StatusNotModified {
  3533. if res.Body != nil {
  3534. res.Body.Close()
  3535. }
  3536. return nil, &googleapi.Error{
  3537. Code: res.StatusCode,
  3538. Header: res.Header,
  3539. }
  3540. }
  3541. if err != nil {
  3542. return nil, err
  3543. }
  3544. defer googleapi.CloseBody(res)
  3545. if err := googleapi.CheckResponse(res); err != nil {
  3546. return nil, err
  3547. }
  3548. ret := &Calendar{
  3549. ServerResponse: googleapi.ServerResponse{
  3550. Header: res.Header,
  3551. HTTPStatusCode: res.StatusCode,
  3552. },
  3553. }
  3554. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3555. return nil, err
  3556. }
  3557. return ret, nil
  3558. // {
  3559. // "description": "Creates a secondary calendar.",
  3560. // "httpMethod": "POST",
  3561. // "id": "calendar.calendars.insert",
  3562. // "path": "calendars",
  3563. // "request": {
  3564. // "$ref": "Calendar"
  3565. // },
  3566. // "response": {
  3567. // "$ref": "Calendar"
  3568. // },
  3569. // "scopes": [
  3570. // "https://www.googleapis.com/auth/calendar"
  3571. // ]
  3572. // }
  3573. }
  3574. // method id "calendar.calendars.patch":
  3575. type CalendarsPatchCall struct {
  3576. s *Service
  3577. calendarId string
  3578. calendar *Calendar
  3579. urlParams_ gensupport.URLParams
  3580. ctx_ context.Context
  3581. }
  3582. // Patch: Updates metadata for a calendar. This method supports patch
  3583. // semantics.
  3584. func (r *CalendarsService) Patch(calendarId string, calendar *Calendar) *CalendarsPatchCall {
  3585. c := &CalendarsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3586. c.calendarId = calendarId
  3587. c.calendar = calendar
  3588. return c
  3589. }
  3590. // Fields allows partial responses to be retrieved. See
  3591. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3592. // for more information.
  3593. func (c *CalendarsPatchCall) Fields(s ...googleapi.Field) *CalendarsPatchCall {
  3594. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3595. return c
  3596. }
  3597. // Context sets the context to be used in this call's Do method. Any
  3598. // pending HTTP request will be aborted if the provided context is
  3599. // canceled.
  3600. func (c *CalendarsPatchCall) Context(ctx context.Context) *CalendarsPatchCall {
  3601. c.ctx_ = ctx
  3602. return c
  3603. }
  3604. func (c *CalendarsPatchCall) doRequest(alt string) (*http.Response, error) {
  3605. var body io.Reader = nil
  3606. body, err := googleapi.WithoutDataWrapper.JSONReader(c.calendar)
  3607. if err != nil {
  3608. return nil, err
  3609. }
  3610. ctype := "application/json"
  3611. c.urlParams_.Set("alt", alt)
  3612. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}")
  3613. urls += "?" + c.urlParams_.Encode()
  3614. req, _ := http.NewRequest("PATCH", urls, body)
  3615. googleapi.Expand(req.URL, map[string]string{
  3616. "calendarId": c.calendarId,
  3617. })
  3618. req.Header.Set("Content-Type", ctype)
  3619. req.Header.Set("User-Agent", c.s.userAgent())
  3620. if c.ctx_ != nil {
  3621. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3622. }
  3623. return c.s.client.Do(req)
  3624. }
  3625. // Do executes the "calendar.calendars.patch" call.
  3626. // Exactly one of *Calendar or error will be non-nil. Any non-2xx status
  3627. // code is an error. Response headers are in either
  3628. // *Calendar.ServerResponse.Header or (if a response was returned at
  3629. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3630. // to check whether the returned error was because
  3631. // http.StatusNotModified was returned.
  3632. func (c *CalendarsPatchCall) Do(opts ...googleapi.CallOption) (*Calendar, error) {
  3633. gensupport.SetOptions(c.urlParams_, opts...)
  3634. res, err := c.doRequest("json")
  3635. if res != nil && res.StatusCode == http.StatusNotModified {
  3636. if res.Body != nil {
  3637. res.Body.Close()
  3638. }
  3639. return nil, &googleapi.Error{
  3640. Code: res.StatusCode,
  3641. Header: res.Header,
  3642. }
  3643. }
  3644. if err != nil {
  3645. return nil, err
  3646. }
  3647. defer googleapi.CloseBody(res)
  3648. if err := googleapi.CheckResponse(res); err != nil {
  3649. return nil, err
  3650. }
  3651. ret := &Calendar{
  3652. ServerResponse: googleapi.ServerResponse{
  3653. Header: res.Header,
  3654. HTTPStatusCode: res.StatusCode,
  3655. },
  3656. }
  3657. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3658. return nil, err
  3659. }
  3660. return ret, nil
  3661. // {
  3662. // "description": "Updates metadata for a calendar. This method supports patch semantics.",
  3663. // "httpMethod": "PATCH",
  3664. // "id": "calendar.calendars.patch",
  3665. // "parameterOrder": [
  3666. // "calendarId"
  3667. // ],
  3668. // "parameters": {
  3669. // "calendarId": {
  3670. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  3671. // "location": "path",
  3672. // "required": true,
  3673. // "type": "string"
  3674. // }
  3675. // },
  3676. // "path": "calendars/{calendarId}",
  3677. // "request": {
  3678. // "$ref": "Calendar"
  3679. // },
  3680. // "response": {
  3681. // "$ref": "Calendar"
  3682. // },
  3683. // "scopes": [
  3684. // "https://www.googleapis.com/auth/calendar"
  3685. // ]
  3686. // }
  3687. }
  3688. // method id "calendar.calendars.update":
  3689. type CalendarsUpdateCall struct {
  3690. s *Service
  3691. calendarId string
  3692. calendar *Calendar
  3693. urlParams_ gensupport.URLParams
  3694. ctx_ context.Context
  3695. }
  3696. // Update: Updates metadata for a calendar.
  3697. func (r *CalendarsService) Update(calendarId string, calendar *Calendar) *CalendarsUpdateCall {
  3698. c := &CalendarsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3699. c.calendarId = calendarId
  3700. c.calendar = calendar
  3701. return c
  3702. }
  3703. // Fields allows partial responses to be retrieved. See
  3704. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3705. // for more information.
  3706. func (c *CalendarsUpdateCall) Fields(s ...googleapi.Field) *CalendarsUpdateCall {
  3707. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3708. return c
  3709. }
  3710. // Context sets the context to be used in this call's Do method. Any
  3711. // pending HTTP request will be aborted if the provided context is
  3712. // canceled.
  3713. func (c *CalendarsUpdateCall) Context(ctx context.Context) *CalendarsUpdateCall {
  3714. c.ctx_ = ctx
  3715. return c
  3716. }
  3717. func (c *CalendarsUpdateCall) doRequest(alt string) (*http.Response, error) {
  3718. var body io.Reader = nil
  3719. body, err := googleapi.WithoutDataWrapper.JSONReader(c.calendar)
  3720. if err != nil {
  3721. return nil, err
  3722. }
  3723. ctype := "application/json"
  3724. c.urlParams_.Set("alt", alt)
  3725. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}")
  3726. urls += "?" + c.urlParams_.Encode()
  3727. req, _ := http.NewRequest("PUT", urls, body)
  3728. googleapi.Expand(req.URL, map[string]string{
  3729. "calendarId": c.calendarId,
  3730. })
  3731. req.Header.Set("Content-Type", ctype)
  3732. req.Header.Set("User-Agent", c.s.userAgent())
  3733. if c.ctx_ != nil {
  3734. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3735. }
  3736. return c.s.client.Do(req)
  3737. }
  3738. // Do executes the "calendar.calendars.update" call.
  3739. // Exactly one of *Calendar or error will be non-nil. Any non-2xx status
  3740. // code is an error. Response headers are in either
  3741. // *Calendar.ServerResponse.Header or (if a response was returned at
  3742. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3743. // to check whether the returned error was because
  3744. // http.StatusNotModified was returned.
  3745. func (c *CalendarsUpdateCall) Do(opts ...googleapi.CallOption) (*Calendar, error) {
  3746. gensupport.SetOptions(c.urlParams_, opts...)
  3747. res, err := c.doRequest("json")
  3748. if res != nil && res.StatusCode == http.StatusNotModified {
  3749. if res.Body != nil {
  3750. res.Body.Close()
  3751. }
  3752. return nil, &googleapi.Error{
  3753. Code: res.StatusCode,
  3754. Header: res.Header,
  3755. }
  3756. }
  3757. if err != nil {
  3758. return nil, err
  3759. }
  3760. defer googleapi.CloseBody(res)
  3761. if err := googleapi.CheckResponse(res); err != nil {
  3762. return nil, err
  3763. }
  3764. ret := &Calendar{
  3765. ServerResponse: googleapi.ServerResponse{
  3766. Header: res.Header,
  3767. HTTPStatusCode: res.StatusCode,
  3768. },
  3769. }
  3770. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3771. return nil, err
  3772. }
  3773. return ret, nil
  3774. // {
  3775. // "description": "Updates metadata for a calendar.",
  3776. // "httpMethod": "PUT",
  3777. // "id": "calendar.calendars.update",
  3778. // "parameterOrder": [
  3779. // "calendarId"
  3780. // ],
  3781. // "parameters": {
  3782. // "calendarId": {
  3783. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  3784. // "location": "path",
  3785. // "required": true,
  3786. // "type": "string"
  3787. // }
  3788. // },
  3789. // "path": "calendars/{calendarId}",
  3790. // "request": {
  3791. // "$ref": "Calendar"
  3792. // },
  3793. // "response": {
  3794. // "$ref": "Calendar"
  3795. // },
  3796. // "scopes": [
  3797. // "https://www.googleapis.com/auth/calendar"
  3798. // ]
  3799. // }
  3800. }
  3801. // method id "calendar.channels.stop":
  3802. type ChannelsStopCall struct {
  3803. s *Service
  3804. channel *Channel
  3805. urlParams_ gensupport.URLParams
  3806. ctx_ context.Context
  3807. }
  3808. // Stop: Stop watching resources through this channel
  3809. func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
  3810. c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3811. c.channel = channel
  3812. return c
  3813. }
  3814. // Fields allows partial responses to be retrieved. See
  3815. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3816. // for more information.
  3817. func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
  3818. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3819. return c
  3820. }
  3821. // Context sets the context to be used in this call's Do method. Any
  3822. // pending HTTP request will be aborted if the provided context is
  3823. // canceled.
  3824. func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
  3825. c.ctx_ = ctx
  3826. return c
  3827. }
  3828. func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
  3829. var body io.Reader = nil
  3830. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  3831. if err != nil {
  3832. return nil, err
  3833. }
  3834. ctype := "application/json"
  3835. c.urlParams_.Set("alt", alt)
  3836. urls := googleapi.ResolveRelative(c.s.BasePath, "channels/stop")
  3837. urls += "?" + c.urlParams_.Encode()
  3838. req, _ := http.NewRequest("POST", urls, body)
  3839. googleapi.SetOpaque(req.URL)
  3840. req.Header.Set("Content-Type", ctype)
  3841. req.Header.Set("User-Agent", c.s.userAgent())
  3842. if c.ctx_ != nil {
  3843. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3844. }
  3845. return c.s.client.Do(req)
  3846. }
  3847. // Do executes the "calendar.channels.stop" call.
  3848. func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
  3849. gensupport.SetOptions(c.urlParams_, opts...)
  3850. res, err := c.doRequest("json")
  3851. if err != nil {
  3852. return err
  3853. }
  3854. defer googleapi.CloseBody(res)
  3855. if err := googleapi.CheckResponse(res); err != nil {
  3856. return err
  3857. }
  3858. return nil
  3859. // {
  3860. // "description": "Stop watching resources through this channel",
  3861. // "httpMethod": "POST",
  3862. // "id": "calendar.channels.stop",
  3863. // "path": "channels/stop",
  3864. // "request": {
  3865. // "$ref": "Channel",
  3866. // "parameterName": "resource"
  3867. // },
  3868. // "scopes": [
  3869. // "https://www.googleapis.com/auth/calendar",
  3870. // "https://www.googleapis.com/auth/calendar.readonly"
  3871. // ]
  3872. // }
  3873. }
  3874. // method id "calendar.colors.get":
  3875. type ColorsGetCall struct {
  3876. s *Service
  3877. urlParams_ gensupport.URLParams
  3878. ifNoneMatch_ string
  3879. ctx_ context.Context
  3880. }
  3881. // Get: Returns the color definitions for calendars and events.
  3882. func (r *ColorsService) Get() *ColorsGetCall {
  3883. c := &ColorsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3884. return c
  3885. }
  3886. // Fields allows partial responses to be retrieved. See
  3887. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3888. // for more information.
  3889. func (c *ColorsGetCall) Fields(s ...googleapi.Field) *ColorsGetCall {
  3890. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3891. return c
  3892. }
  3893. // IfNoneMatch sets the optional parameter which makes the operation
  3894. // fail if the object's ETag matches the given value. This is useful for
  3895. // getting updates only after the object has changed since the last
  3896. // request. Use googleapi.IsNotModified to check whether the response
  3897. // error from Do is the result of In-None-Match.
  3898. func (c *ColorsGetCall) IfNoneMatch(entityTag string) *ColorsGetCall {
  3899. c.ifNoneMatch_ = entityTag
  3900. return c
  3901. }
  3902. // Context sets the context to be used in this call's Do method. Any
  3903. // pending HTTP request will be aborted if the provided context is
  3904. // canceled.
  3905. func (c *ColorsGetCall) Context(ctx context.Context) *ColorsGetCall {
  3906. c.ctx_ = ctx
  3907. return c
  3908. }
  3909. func (c *ColorsGetCall) doRequest(alt string) (*http.Response, error) {
  3910. var body io.Reader = nil
  3911. c.urlParams_.Set("alt", alt)
  3912. urls := googleapi.ResolveRelative(c.s.BasePath, "colors")
  3913. urls += "?" + c.urlParams_.Encode()
  3914. req, _ := http.NewRequest("GET", urls, body)
  3915. googleapi.SetOpaque(req.URL)
  3916. req.Header.Set("User-Agent", c.s.userAgent())
  3917. if c.ifNoneMatch_ != "" {
  3918. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3919. }
  3920. if c.ctx_ != nil {
  3921. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3922. }
  3923. return c.s.client.Do(req)
  3924. }
  3925. // Do executes the "calendar.colors.get" call.
  3926. // Exactly one of *Colors or error will be non-nil. Any non-2xx status
  3927. // code is an error. Response headers are in either
  3928. // *Colors.ServerResponse.Header or (if a response was returned at all)
  3929. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3930. // check whether the returned error was because http.StatusNotModified
  3931. // was returned.
  3932. func (c *ColorsGetCall) Do(opts ...googleapi.CallOption) (*Colors, error) {
  3933. gensupport.SetOptions(c.urlParams_, opts...)
  3934. res, err := c.doRequest("json")
  3935. if res != nil && res.StatusCode == http.StatusNotModified {
  3936. if res.Body != nil {
  3937. res.Body.Close()
  3938. }
  3939. return nil, &googleapi.Error{
  3940. Code: res.StatusCode,
  3941. Header: res.Header,
  3942. }
  3943. }
  3944. if err != nil {
  3945. return nil, err
  3946. }
  3947. defer googleapi.CloseBody(res)
  3948. if err := googleapi.CheckResponse(res); err != nil {
  3949. return nil, err
  3950. }
  3951. ret := &Colors{
  3952. ServerResponse: googleapi.ServerResponse{
  3953. Header: res.Header,
  3954. HTTPStatusCode: res.StatusCode,
  3955. },
  3956. }
  3957. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3958. return nil, err
  3959. }
  3960. return ret, nil
  3961. // {
  3962. // "description": "Returns the color definitions for calendars and events.",
  3963. // "httpMethod": "GET",
  3964. // "id": "calendar.colors.get",
  3965. // "path": "colors",
  3966. // "response": {
  3967. // "$ref": "Colors"
  3968. // },
  3969. // "scopes": [
  3970. // "https://www.googleapis.com/auth/calendar",
  3971. // "https://www.googleapis.com/auth/calendar.readonly"
  3972. // ]
  3973. // }
  3974. }
  3975. // method id "calendar.events.delete":
  3976. type EventsDeleteCall struct {
  3977. s *Service
  3978. calendarId string
  3979. eventId string
  3980. urlParams_ gensupport.URLParams
  3981. ctx_ context.Context
  3982. }
  3983. // Delete: Deletes an event.
  3984. func (r *EventsService) Delete(calendarId string, eventId string) *EventsDeleteCall {
  3985. c := &EventsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3986. c.calendarId = calendarId
  3987. c.eventId = eventId
  3988. return c
  3989. }
  3990. // SendNotifications sets the optional parameter "sendNotifications":
  3991. // Whether to send notifications about the deletion of the event. The
  3992. // default is False.
  3993. func (c *EventsDeleteCall) SendNotifications(sendNotifications bool) *EventsDeleteCall {
  3994. c.urlParams_.Set("sendNotifications", fmt.Sprint(sendNotifications))
  3995. return c
  3996. }
  3997. // Fields allows partial responses to be retrieved. See
  3998. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3999. // for more information.
  4000. func (c *EventsDeleteCall) Fields(s ...googleapi.Field) *EventsDeleteCall {
  4001. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4002. return c
  4003. }
  4004. // Context sets the context to be used in this call's Do method. Any
  4005. // pending HTTP request will be aborted if the provided context is
  4006. // canceled.
  4007. func (c *EventsDeleteCall) Context(ctx context.Context) *EventsDeleteCall {
  4008. c.ctx_ = ctx
  4009. return c
  4010. }
  4011. func (c *EventsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4012. var body io.Reader = nil
  4013. c.urlParams_.Set("alt", alt)
  4014. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/events/{eventId}")
  4015. urls += "?" + c.urlParams_.Encode()
  4016. req, _ := http.NewRequest("DELETE", urls, body)
  4017. googleapi.Expand(req.URL, map[string]string{
  4018. "calendarId": c.calendarId,
  4019. "eventId": c.eventId,
  4020. })
  4021. req.Header.Set("User-Agent", c.s.userAgent())
  4022. if c.ctx_ != nil {
  4023. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4024. }
  4025. return c.s.client.Do(req)
  4026. }
  4027. // Do executes the "calendar.events.delete" call.
  4028. func (c *EventsDeleteCall) Do(opts ...googleapi.CallOption) error {
  4029. gensupport.SetOptions(c.urlParams_, opts...)
  4030. res, err := c.doRequest("json")
  4031. if err != nil {
  4032. return err
  4033. }
  4034. defer googleapi.CloseBody(res)
  4035. if err := googleapi.CheckResponse(res); err != nil {
  4036. return err
  4037. }
  4038. return nil
  4039. // {
  4040. // "description": "Deletes an event.",
  4041. // "httpMethod": "DELETE",
  4042. // "id": "calendar.events.delete",
  4043. // "parameterOrder": [
  4044. // "calendarId",
  4045. // "eventId"
  4046. // ],
  4047. // "parameters": {
  4048. // "calendarId": {
  4049. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  4050. // "location": "path",
  4051. // "required": true,
  4052. // "type": "string"
  4053. // },
  4054. // "eventId": {
  4055. // "description": "Event identifier.",
  4056. // "location": "path",
  4057. // "required": true,
  4058. // "type": "string"
  4059. // },
  4060. // "sendNotifications": {
  4061. // "description": "Whether to send notifications about the deletion of the event. Optional. The default is False.",
  4062. // "location": "query",
  4063. // "type": "boolean"
  4064. // }
  4065. // },
  4066. // "path": "calendars/{calendarId}/events/{eventId}",
  4067. // "scopes": [
  4068. // "https://www.googleapis.com/auth/calendar"
  4069. // ]
  4070. // }
  4071. }
  4072. // method id "calendar.events.get":
  4073. type EventsGetCall struct {
  4074. s *Service
  4075. calendarId string
  4076. eventId string
  4077. urlParams_ gensupport.URLParams
  4078. ifNoneMatch_ string
  4079. ctx_ context.Context
  4080. }
  4081. // Get: Returns an event.
  4082. func (r *EventsService) Get(calendarId string, eventId string) *EventsGetCall {
  4083. c := &EventsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4084. c.calendarId = calendarId
  4085. c.eventId = eventId
  4086. return c
  4087. }
  4088. // AlwaysIncludeEmail sets the optional parameter "alwaysIncludeEmail":
  4089. // Whether to always include a value in the email field for the
  4090. // organizer, creator and attendees, even if no real email is available
  4091. // (i.e. a generated, non-working value will be provided). The use of
  4092. // this option is discouraged and should only be used by clients which
  4093. // cannot handle the absence of an email address value in the mentioned
  4094. // places. The default is False.
  4095. func (c *EventsGetCall) AlwaysIncludeEmail(alwaysIncludeEmail bool) *EventsGetCall {
  4096. c.urlParams_.Set("alwaysIncludeEmail", fmt.Sprint(alwaysIncludeEmail))
  4097. return c
  4098. }
  4099. // MaxAttendees sets the optional parameter "maxAttendees": The maximum
  4100. // number of attendees to include in the response. If there are more
  4101. // than the specified number of attendees, only the participant is
  4102. // returned.
  4103. func (c *EventsGetCall) MaxAttendees(maxAttendees int64) *EventsGetCall {
  4104. c.urlParams_.Set("maxAttendees", fmt.Sprint(maxAttendees))
  4105. return c
  4106. }
  4107. // TimeZone sets the optional parameter "timeZone": Time zone used in
  4108. // the response. The default is the time zone of the calendar.
  4109. func (c *EventsGetCall) TimeZone(timeZone string) *EventsGetCall {
  4110. c.urlParams_.Set("timeZone", timeZone)
  4111. return c
  4112. }
  4113. // Fields allows partial responses to be retrieved. See
  4114. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4115. // for more information.
  4116. func (c *EventsGetCall) Fields(s ...googleapi.Field) *EventsGetCall {
  4117. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4118. return c
  4119. }
  4120. // IfNoneMatch sets the optional parameter which makes the operation
  4121. // fail if the object's ETag matches the given value. This is useful for
  4122. // getting updates only after the object has changed since the last
  4123. // request. Use googleapi.IsNotModified to check whether the response
  4124. // error from Do is the result of In-None-Match.
  4125. func (c *EventsGetCall) IfNoneMatch(entityTag string) *EventsGetCall {
  4126. c.ifNoneMatch_ = entityTag
  4127. return c
  4128. }
  4129. // Context sets the context to be used in this call's Do method. Any
  4130. // pending HTTP request will be aborted if the provided context is
  4131. // canceled.
  4132. func (c *EventsGetCall) Context(ctx context.Context) *EventsGetCall {
  4133. c.ctx_ = ctx
  4134. return c
  4135. }
  4136. func (c *EventsGetCall) doRequest(alt string) (*http.Response, error) {
  4137. var body io.Reader = nil
  4138. c.urlParams_.Set("alt", alt)
  4139. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/events/{eventId}")
  4140. urls += "?" + c.urlParams_.Encode()
  4141. req, _ := http.NewRequest("GET", urls, body)
  4142. googleapi.Expand(req.URL, map[string]string{
  4143. "calendarId": c.calendarId,
  4144. "eventId": c.eventId,
  4145. })
  4146. req.Header.Set("User-Agent", c.s.userAgent())
  4147. if c.ifNoneMatch_ != "" {
  4148. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4149. }
  4150. if c.ctx_ != nil {
  4151. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4152. }
  4153. return c.s.client.Do(req)
  4154. }
  4155. // Do executes the "calendar.events.get" call.
  4156. // Exactly one of *Event or error will be non-nil. Any non-2xx status
  4157. // code is an error. Response headers are in either
  4158. // *Event.ServerResponse.Header or (if a response was returned at all)
  4159. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4160. // check whether the returned error was because http.StatusNotModified
  4161. // was returned.
  4162. func (c *EventsGetCall) Do(opts ...googleapi.CallOption) (*Event, error) {
  4163. gensupport.SetOptions(c.urlParams_, opts...)
  4164. res, err := c.doRequest("json")
  4165. if res != nil && res.StatusCode == http.StatusNotModified {
  4166. if res.Body != nil {
  4167. res.Body.Close()
  4168. }
  4169. return nil, &googleapi.Error{
  4170. Code: res.StatusCode,
  4171. Header: res.Header,
  4172. }
  4173. }
  4174. if err != nil {
  4175. return nil, err
  4176. }
  4177. defer googleapi.CloseBody(res)
  4178. if err := googleapi.CheckResponse(res); err != nil {
  4179. return nil, err
  4180. }
  4181. ret := &Event{
  4182. ServerResponse: googleapi.ServerResponse{
  4183. Header: res.Header,
  4184. HTTPStatusCode: res.StatusCode,
  4185. },
  4186. }
  4187. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4188. return nil, err
  4189. }
  4190. return ret, nil
  4191. // {
  4192. // "description": "Returns an event.",
  4193. // "httpMethod": "GET",
  4194. // "id": "calendar.events.get",
  4195. // "parameterOrder": [
  4196. // "calendarId",
  4197. // "eventId"
  4198. // ],
  4199. // "parameters": {
  4200. // "alwaysIncludeEmail": {
  4201. // "description": "Whether to always include a value in the email field for the organizer, creator and attendees, even if no real email is available (i.e. a generated, non-working value will be provided). The use of this option is discouraged and should only be used by clients which cannot handle the absence of an email address value in the mentioned places. Optional. The default is False.",
  4202. // "location": "query",
  4203. // "type": "boolean"
  4204. // },
  4205. // "calendarId": {
  4206. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  4207. // "location": "path",
  4208. // "required": true,
  4209. // "type": "string"
  4210. // },
  4211. // "eventId": {
  4212. // "description": "Event identifier.",
  4213. // "location": "path",
  4214. // "required": true,
  4215. // "type": "string"
  4216. // },
  4217. // "maxAttendees": {
  4218. // "description": "The maximum number of attendees to include in the response. If there are more than the specified number of attendees, only the participant is returned. Optional.",
  4219. // "format": "int32",
  4220. // "location": "query",
  4221. // "minimum": "1",
  4222. // "type": "integer"
  4223. // },
  4224. // "timeZone": {
  4225. // "description": "Time zone used in the response. Optional. The default is the time zone of the calendar.",
  4226. // "location": "query",
  4227. // "type": "string"
  4228. // }
  4229. // },
  4230. // "path": "calendars/{calendarId}/events/{eventId}",
  4231. // "response": {
  4232. // "$ref": "Event"
  4233. // },
  4234. // "scopes": [
  4235. // "https://www.googleapis.com/auth/calendar",
  4236. // "https://www.googleapis.com/auth/calendar.readonly"
  4237. // ]
  4238. // }
  4239. }
  4240. // method id "calendar.events.import":
  4241. type EventsImportCall struct {
  4242. s *Service
  4243. calendarId string
  4244. event *Event
  4245. urlParams_ gensupport.URLParams
  4246. ctx_ context.Context
  4247. }
  4248. // Import: Imports an event. This operation is used to add a private
  4249. // copy of an existing event to a calendar.
  4250. func (r *EventsService) Import(calendarId string, event *Event) *EventsImportCall {
  4251. c := &EventsImportCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4252. c.calendarId = calendarId
  4253. c.event = event
  4254. return c
  4255. }
  4256. // SupportsAttachments sets the optional parameter
  4257. // "supportsAttachments": Whether API client performing operation
  4258. // supports event attachments. The default is False.
  4259. func (c *EventsImportCall) SupportsAttachments(supportsAttachments bool) *EventsImportCall {
  4260. c.urlParams_.Set("supportsAttachments", fmt.Sprint(supportsAttachments))
  4261. return c
  4262. }
  4263. // Fields allows partial responses to be retrieved. See
  4264. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4265. // for more information.
  4266. func (c *EventsImportCall) Fields(s ...googleapi.Field) *EventsImportCall {
  4267. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4268. return c
  4269. }
  4270. // Context sets the context to be used in this call's Do method. Any
  4271. // pending HTTP request will be aborted if the provided context is
  4272. // canceled.
  4273. func (c *EventsImportCall) Context(ctx context.Context) *EventsImportCall {
  4274. c.ctx_ = ctx
  4275. return c
  4276. }
  4277. func (c *EventsImportCall) doRequest(alt string) (*http.Response, error) {
  4278. var body io.Reader = nil
  4279. body, err := googleapi.WithoutDataWrapper.JSONReader(c.event)
  4280. if err != nil {
  4281. return nil, err
  4282. }
  4283. ctype := "application/json"
  4284. c.urlParams_.Set("alt", alt)
  4285. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/events/import")
  4286. urls += "?" + c.urlParams_.Encode()
  4287. req, _ := http.NewRequest("POST", urls, body)
  4288. googleapi.Expand(req.URL, map[string]string{
  4289. "calendarId": c.calendarId,
  4290. })
  4291. req.Header.Set("Content-Type", ctype)
  4292. req.Header.Set("User-Agent", c.s.userAgent())
  4293. if c.ctx_ != nil {
  4294. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4295. }
  4296. return c.s.client.Do(req)
  4297. }
  4298. // Do executes the "calendar.events.import" call.
  4299. // Exactly one of *Event or error will be non-nil. Any non-2xx status
  4300. // code is an error. Response headers are in either
  4301. // *Event.ServerResponse.Header or (if a response was returned at all)
  4302. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4303. // check whether the returned error was because http.StatusNotModified
  4304. // was returned.
  4305. func (c *EventsImportCall) Do(opts ...googleapi.CallOption) (*Event, error) {
  4306. gensupport.SetOptions(c.urlParams_, opts...)
  4307. res, err := c.doRequest("json")
  4308. if res != nil && res.StatusCode == http.StatusNotModified {
  4309. if res.Body != nil {
  4310. res.Body.Close()
  4311. }
  4312. return nil, &googleapi.Error{
  4313. Code: res.StatusCode,
  4314. Header: res.Header,
  4315. }
  4316. }
  4317. if err != nil {
  4318. return nil, err
  4319. }
  4320. defer googleapi.CloseBody(res)
  4321. if err := googleapi.CheckResponse(res); err != nil {
  4322. return nil, err
  4323. }
  4324. ret := &Event{
  4325. ServerResponse: googleapi.ServerResponse{
  4326. Header: res.Header,
  4327. HTTPStatusCode: res.StatusCode,
  4328. },
  4329. }
  4330. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4331. return nil, err
  4332. }
  4333. return ret, nil
  4334. // {
  4335. // "description": "Imports an event. This operation is used to add a private copy of an existing event to a calendar.",
  4336. // "httpMethod": "POST",
  4337. // "id": "calendar.events.import",
  4338. // "parameterOrder": [
  4339. // "calendarId"
  4340. // ],
  4341. // "parameters": {
  4342. // "calendarId": {
  4343. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  4344. // "location": "path",
  4345. // "required": true,
  4346. // "type": "string"
  4347. // },
  4348. // "supportsAttachments": {
  4349. // "description": "Whether API client performing operation supports event attachments. Optional. The default is False.",
  4350. // "location": "query",
  4351. // "type": "boolean"
  4352. // }
  4353. // },
  4354. // "path": "calendars/{calendarId}/events/import",
  4355. // "request": {
  4356. // "$ref": "Event"
  4357. // },
  4358. // "response": {
  4359. // "$ref": "Event"
  4360. // },
  4361. // "scopes": [
  4362. // "https://www.googleapis.com/auth/calendar"
  4363. // ]
  4364. // }
  4365. }
  4366. // method id "calendar.events.insert":
  4367. type EventsInsertCall struct {
  4368. s *Service
  4369. calendarId string
  4370. event *Event
  4371. urlParams_ gensupport.URLParams
  4372. ctx_ context.Context
  4373. }
  4374. // Insert: Creates an event.
  4375. func (r *EventsService) Insert(calendarId string, event *Event) *EventsInsertCall {
  4376. c := &EventsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4377. c.calendarId = calendarId
  4378. c.event = event
  4379. return c
  4380. }
  4381. // MaxAttendees sets the optional parameter "maxAttendees": The maximum
  4382. // number of attendees to include in the response. If there are more
  4383. // than the specified number of attendees, only the participant is
  4384. // returned.
  4385. func (c *EventsInsertCall) MaxAttendees(maxAttendees int64) *EventsInsertCall {
  4386. c.urlParams_.Set("maxAttendees", fmt.Sprint(maxAttendees))
  4387. return c
  4388. }
  4389. // SendNotifications sets the optional parameter "sendNotifications":
  4390. // Whether to send notifications about the creation of the new event.
  4391. // The default is False.
  4392. func (c *EventsInsertCall) SendNotifications(sendNotifications bool) *EventsInsertCall {
  4393. c.urlParams_.Set("sendNotifications", fmt.Sprint(sendNotifications))
  4394. return c
  4395. }
  4396. // SupportsAttachments sets the optional parameter
  4397. // "supportsAttachments": Whether API client performing operation
  4398. // supports event attachments. The default is False.
  4399. func (c *EventsInsertCall) SupportsAttachments(supportsAttachments bool) *EventsInsertCall {
  4400. c.urlParams_.Set("supportsAttachments", fmt.Sprint(supportsAttachments))
  4401. return c
  4402. }
  4403. // Fields allows partial responses to be retrieved. See
  4404. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4405. // for more information.
  4406. func (c *EventsInsertCall) Fields(s ...googleapi.Field) *EventsInsertCall {
  4407. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4408. return c
  4409. }
  4410. // Context sets the context to be used in this call's Do method. Any
  4411. // pending HTTP request will be aborted if the provided context is
  4412. // canceled.
  4413. func (c *EventsInsertCall) Context(ctx context.Context) *EventsInsertCall {
  4414. c.ctx_ = ctx
  4415. return c
  4416. }
  4417. func (c *EventsInsertCall) doRequest(alt string) (*http.Response, error) {
  4418. var body io.Reader = nil
  4419. body, err := googleapi.WithoutDataWrapper.JSONReader(c.event)
  4420. if err != nil {
  4421. return nil, err
  4422. }
  4423. ctype := "application/json"
  4424. c.urlParams_.Set("alt", alt)
  4425. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/events")
  4426. urls += "?" + c.urlParams_.Encode()
  4427. req, _ := http.NewRequest("POST", urls, body)
  4428. googleapi.Expand(req.URL, map[string]string{
  4429. "calendarId": c.calendarId,
  4430. })
  4431. req.Header.Set("Content-Type", ctype)
  4432. req.Header.Set("User-Agent", c.s.userAgent())
  4433. if c.ctx_ != nil {
  4434. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4435. }
  4436. return c.s.client.Do(req)
  4437. }
  4438. // Do executes the "calendar.events.insert" call.
  4439. // Exactly one of *Event or error will be non-nil. Any non-2xx status
  4440. // code is an error. Response headers are in either
  4441. // *Event.ServerResponse.Header or (if a response was returned at all)
  4442. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4443. // check whether the returned error was because http.StatusNotModified
  4444. // was returned.
  4445. func (c *EventsInsertCall) Do(opts ...googleapi.CallOption) (*Event, error) {
  4446. gensupport.SetOptions(c.urlParams_, opts...)
  4447. res, err := c.doRequest("json")
  4448. if res != nil && res.StatusCode == http.StatusNotModified {
  4449. if res.Body != nil {
  4450. res.Body.Close()
  4451. }
  4452. return nil, &googleapi.Error{
  4453. Code: res.StatusCode,
  4454. Header: res.Header,
  4455. }
  4456. }
  4457. if err != nil {
  4458. return nil, err
  4459. }
  4460. defer googleapi.CloseBody(res)
  4461. if err := googleapi.CheckResponse(res); err != nil {
  4462. return nil, err
  4463. }
  4464. ret := &Event{
  4465. ServerResponse: googleapi.ServerResponse{
  4466. Header: res.Header,
  4467. HTTPStatusCode: res.StatusCode,
  4468. },
  4469. }
  4470. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4471. return nil, err
  4472. }
  4473. return ret, nil
  4474. // {
  4475. // "description": "Creates an event.",
  4476. // "httpMethod": "POST",
  4477. // "id": "calendar.events.insert",
  4478. // "parameterOrder": [
  4479. // "calendarId"
  4480. // ],
  4481. // "parameters": {
  4482. // "calendarId": {
  4483. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  4484. // "location": "path",
  4485. // "required": true,
  4486. // "type": "string"
  4487. // },
  4488. // "maxAttendees": {
  4489. // "description": "The maximum number of attendees to include in the response. If there are more than the specified number of attendees, only the participant is returned. Optional.",
  4490. // "format": "int32",
  4491. // "location": "query",
  4492. // "minimum": "1",
  4493. // "type": "integer"
  4494. // },
  4495. // "sendNotifications": {
  4496. // "description": "Whether to send notifications about the creation of the new event. Optional. The default is False.",
  4497. // "location": "query",
  4498. // "type": "boolean"
  4499. // },
  4500. // "supportsAttachments": {
  4501. // "description": "Whether API client performing operation supports event attachments. Optional. The default is False.",
  4502. // "location": "query",
  4503. // "type": "boolean"
  4504. // }
  4505. // },
  4506. // "path": "calendars/{calendarId}/events",
  4507. // "request": {
  4508. // "$ref": "Event"
  4509. // },
  4510. // "response": {
  4511. // "$ref": "Event"
  4512. // },
  4513. // "scopes": [
  4514. // "https://www.googleapis.com/auth/calendar"
  4515. // ]
  4516. // }
  4517. }
  4518. // method id "calendar.events.instances":
  4519. type EventsInstancesCall struct {
  4520. s *Service
  4521. calendarId string
  4522. eventId string
  4523. urlParams_ gensupport.URLParams
  4524. ifNoneMatch_ string
  4525. ctx_ context.Context
  4526. }
  4527. // Instances: Returns instances of the specified recurring event.
  4528. func (r *EventsService) Instances(calendarId string, eventId string) *EventsInstancesCall {
  4529. c := &EventsInstancesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4530. c.calendarId = calendarId
  4531. c.eventId = eventId
  4532. return c
  4533. }
  4534. // AlwaysIncludeEmail sets the optional parameter "alwaysIncludeEmail":
  4535. // Whether to always include a value in the email field for the
  4536. // organizer, creator and attendees, even if no real email is available
  4537. // (i.e. a generated, non-working value will be provided). The use of
  4538. // this option is discouraged and should only be used by clients which
  4539. // cannot handle the absence of an email address value in the mentioned
  4540. // places. The default is False.
  4541. func (c *EventsInstancesCall) AlwaysIncludeEmail(alwaysIncludeEmail bool) *EventsInstancesCall {
  4542. c.urlParams_.Set("alwaysIncludeEmail", fmt.Sprint(alwaysIncludeEmail))
  4543. return c
  4544. }
  4545. // MaxAttendees sets the optional parameter "maxAttendees": The maximum
  4546. // number of attendees to include in the response. If there are more
  4547. // than the specified number of attendees, only the participant is
  4548. // returned.
  4549. func (c *EventsInstancesCall) MaxAttendees(maxAttendees int64) *EventsInstancesCall {
  4550. c.urlParams_.Set("maxAttendees", fmt.Sprint(maxAttendees))
  4551. return c
  4552. }
  4553. // MaxResults sets the optional parameter "maxResults": Maximum number
  4554. // of events returned on one result page. By default the value is 250
  4555. // events. The page size can never be larger than 2500 events.
  4556. func (c *EventsInstancesCall) MaxResults(maxResults int64) *EventsInstancesCall {
  4557. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4558. return c
  4559. }
  4560. // OriginalStart sets the optional parameter "originalStart": The
  4561. // original start time of the instance in the result.
  4562. func (c *EventsInstancesCall) OriginalStart(originalStart string) *EventsInstancesCall {
  4563. c.urlParams_.Set("originalStart", originalStart)
  4564. return c
  4565. }
  4566. // PageToken sets the optional parameter "pageToken": Token specifying
  4567. // which result page to return.
  4568. func (c *EventsInstancesCall) PageToken(pageToken string) *EventsInstancesCall {
  4569. c.urlParams_.Set("pageToken", pageToken)
  4570. return c
  4571. }
  4572. // ShowDeleted sets the optional parameter "showDeleted": Whether to
  4573. // include deleted events (with status equals "cancelled") in the
  4574. // result. Cancelled instances of recurring events will still be
  4575. // included if singleEvents is False. The default is False.
  4576. func (c *EventsInstancesCall) ShowDeleted(showDeleted bool) *EventsInstancesCall {
  4577. c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
  4578. return c
  4579. }
  4580. // TimeMax sets the optional parameter "timeMax": Upper bound
  4581. // (exclusive) for an event's start time to filter by. The default is
  4582. // not to filter by start time. Must be an RFC3339 timestamp with
  4583. // mandatory time zone offset.
  4584. func (c *EventsInstancesCall) TimeMax(timeMax string) *EventsInstancesCall {
  4585. c.urlParams_.Set("timeMax", timeMax)
  4586. return c
  4587. }
  4588. // TimeMin sets the optional parameter "timeMin": Lower bound
  4589. // (inclusive) for an event's end time to filter by. The default is not
  4590. // to filter by end time. Must be an RFC3339 timestamp with mandatory
  4591. // time zone offset.
  4592. func (c *EventsInstancesCall) TimeMin(timeMin string) *EventsInstancesCall {
  4593. c.urlParams_.Set("timeMin", timeMin)
  4594. return c
  4595. }
  4596. // TimeZone sets the optional parameter "timeZone": Time zone used in
  4597. // the response. The default is the time zone of the calendar.
  4598. func (c *EventsInstancesCall) TimeZone(timeZone string) *EventsInstancesCall {
  4599. c.urlParams_.Set("timeZone", timeZone)
  4600. return c
  4601. }
  4602. // Fields allows partial responses to be retrieved. See
  4603. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4604. // for more information.
  4605. func (c *EventsInstancesCall) Fields(s ...googleapi.Field) *EventsInstancesCall {
  4606. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4607. return c
  4608. }
  4609. // IfNoneMatch sets the optional parameter which makes the operation
  4610. // fail if the object's ETag matches the given value. This is useful for
  4611. // getting updates only after the object has changed since the last
  4612. // request. Use googleapi.IsNotModified to check whether the response
  4613. // error from Do is the result of In-None-Match.
  4614. func (c *EventsInstancesCall) IfNoneMatch(entityTag string) *EventsInstancesCall {
  4615. c.ifNoneMatch_ = entityTag
  4616. return c
  4617. }
  4618. // Context sets the context to be used in this call's Do method. Any
  4619. // pending HTTP request will be aborted if the provided context is
  4620. // canceled.
  4621. func (c *EventsInstancesCall) Context(ctx context.Context) *EventsInstancesCall {
  4622. c.ctx_ = ctx
  4623. return c
  4624. }
  4625. func (c *EventsInstancesCall) doRequest(alt string) (*http.Response, error) {
  4626. var body io.Reader = nil
  4627. c.urlParams_.Set("alt", alt)
  4628. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/events/{eventId}/instances")
  4629. urls += "?" + c.urlParams_.Encode()
  4630. req, _ := http.NewRequest("GET", urls, body)
  4631. googleapi.Expand(req.URL, map[string]string{
  4632. "calendarId": c.calendarId,
  4633. "eventId": c.eventId,
  4634. })
  4635. req.Header.Set("User-Agent", c.s.userAgent())
  4636. if c.ifNoneMatch_ != "" {
  4637. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4638. }
  4639. if c.ctx_ != nil {
  4640. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4641. }
  4642. return c.s.client.Do(req)
  4643. }
  4644. // Do executes the "calendar.events.instances" call.
  4645. // Exactly one of *Events or error will be non-nil. Any non-2xx status
  4646. // code is an error. Response headers are in either
  4647. // *Events.ServerResponse.Header or (if a response was returned at all)
  4648. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4649. // check whether the returned error was because http.StatusNotModified
  4650. // was returned.
  4651. func (c *EventsInstancesCall) Do(opts ...googleapi.CallOption) (*Events, error) {
  4652. gensupport.SetOptions(c.urlParams_, opts...)
  4653. res, err := c.doRequest("json")
  4654. if res != nil && res.StatusCode == http.StatusNotModified {
  4655. if res.Body != nil {
  4656. res.Body.Close()
  4657. }
  4658. return nil, &googleapi.Error{
  4659. Code: res.StatusCode,
  4660. Header: res.Header,
  4661. }
  4662. }
  4663. if err != nil {
  4664. return nil, err
  4665. }
  4666. defer googleapi.CloseBody(res)
  4667. if err := googleapi.CheckResponse(res); err != nil {
  4668. return nil, err
  4669. }
  4670. ret := &Events{
  4671. ServerResponse: googleapi.ServerResponse{
  4672. Header: res.Header,
  4673. HTTPStatusCode: res.StatusCode,
  4674. },
  4675. }
  4676. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4677. return nil, err
  4678. }
  4679. return ret, nil
  4680. // {
  4681. // "description": "Returns instances of the specified recurring event.",
  4682. // "httpMethod": "GET",
  4683. // "id": "calendar.events.instances",
  4684. // "parameterOrder": [
  4685. // "calendarId",
  4686. // "eventId"
  4687. // ],
  4688. // "parameters": {
  4689. // "alwaysIncludeEmail": {
  4690. // "description": "Whether to always include a value in the email field for the organizer, creator and attendees, even if no real email is available (i.e. a generated, non-working value will be provided). The use of this option is discouraged and should only be used by clients which cannot handle the absence of an email address value in the mentioned places. Optional. The default is False.",
  4691. // "location": "query",
  4692. // "type": "boolean"
  4693. // },
  4694. // "calendarId": {
  4695. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  4696. // "location": "path",
  4697. // "required": true,
  4698. // "type": "string"
  4699. // },
  4700. // "eventId": {
  4701. // "description": "Recurring event identifier.",
  4702. // "location": "path",
  4703. // "required": true,
  4704. // "type": "string"
  4705. // },
  4706. // "maxAttendees": {
  4707. // "description": "The maximum number of attendees to include in the response. If there are more than the specified number of attendees, only the participant is returned. Optional.",
  4708. // "format": "int32",
  4709. // "location": "query",
  4710. // "minimum": "1",
  4711. // "type": "integer"
  4712. // },
  4713. // "maxResults": {
  4714. // "description": "Maximum number of events returned on one result page. By default the value is 250 events. The page size can never be larger than 2500 events. Optional.",
  4715. // "format": "int32",
  4716. // "location": "query",
  4717. // "minimum": "1",
  4718. // "type": "integer"
  4719. // },
  4720. // "originalStart": {
  4721. // "description": "The original start time of the instance in the result. Optional.",
  4722. // "location": "query",
  4723. // "type": "string"
  4724. // },
  4725. // "pageToken": {
  4726. // "description": "Token specifying which result page to return. Optional.",
  4727. // "location": "query",
  4728. // "type": "string"
  4729. // },
  4730. // "showDeleted": {
  4731. // "description": "Whether to include deleted events (with status equals \"cancelled\") in the result. Cancelled instances of recurring events will still be included if singleEvents is False. Optional. The default is False.",
  4732. // "location": "query",
  4733. // "type": "boolean"
  4734. // },
  4735. // "timeMax": {
  4736. // "description": "Upper bound (exclusive) for an event's start time to filter by. Optional. The default is not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset.",
  4737. // "format": "date-time",
  4738. // "location": "query",
  4739. // "type": "string"
  4740. // },
  4741. // "timeMin": {
  4742. // "description": "Lower bound (inclusive) for an event's end time to filter by. Optional. The default is not to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset.",
  4743. // "format": "date-time",
  4744. // "location": "query",
  4745. // "type": "string"
  4746. // },
  4747. // "timeZone": {
  4748. // "description": "Time zone used in the response. Optional. The default is the time zone of the calendar.",
  4749. // "location": "query",
  4750. // "type": "string"
  4751. // }
  4752. // },
  4753. // "path": "calendars/{calendarId}/events/{eventId}/instances",
  4754. // "response": {
  4755. // "$ref": "Events"
  4756. // },
  4757. // "scopes": [
  4758. // "https://www.googleapis.com/auth/calendar",
  4759. // "https://www.googleapis.com/auth/calendar.readonly"
  4760. // ],
  4761. // "supportsSubscription": true
  4762. // }
  4763. }
  4764. // Pages invokes f for each page of results.
  4765. // A non-nil error returned from f will halt the iteration.
  4766. // The provided context supersedes any context provided to the Context method.
  4767. func (c *EventsInstancesCall) Pages(ctx context.Context, f func(*Events) error) error {
  4768. c.ctx_ = ctx
  4769. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4770. for {
  4771. x, err := c.Do()
  4772. if err != nil {
  4773. return err
  4774. }
  4775. if err := f(x); err != nil {
  4776. return err
  4777. }
  4778. if x.NextPageToken == "" {
  4779. return nil
  4780. }
  4781. c.PageToken(x.NextPageToken)
  4782. }
  4783. }
  4784. // method id "calendar.events.list":
  4785. type EventsListCall struct {
  4786. s *Service
  4787. calendarId string
  4788. urlParams_ gensupport.URLParams
  4789. ifNoneMatch_ string
  4790. ctx_ context.Context
  4791. }
  4792. // List: Returns events on the specified calendar.
  4793. func (r *EventsService) List(calendarId string) *EventsListCall {
  4794. c := &EventsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4795. c.calendarId = calendarId
  4796. return c
  4797. }
  4798. // AlwaysIncludeEmail sets the optional parameter "alwaysIncludeEmail":
  4799. // Whether to always include a value in the email field for the
  4800. // organizer, creator and attendees, even if no real email is available
  4801. // (i.e. a generated, non-working value will be provided). The use of
  4802. // this option is discouraged and should only be used by clients which
  4803. // cannot handle the absence of an email address value in the mentioned
  4804. // places. The default is False.
  4805. func (c *EventsListCall) AlwaysIncludeEmail(alwaysIncludeEmail bool) *EventsListCall {
  4806. c.urlParams_.Set("alwaysIncludeEmail", fmt.Sprint(alwaysIncludeEmail))
  4807. return c
  4808. }
  4809. // ICalUID sets the optional parameter "iCalUID": Specifies event ID in
  4810. // the iCalendar format to be included in the response.
  4811. func (c *EventsListCall) ICalUID(iCalUID string) *EventsListCall {
  4812. c.urlParams_.Set("iCalUID", iCalUID)
  4813. return c
  4814. }
  4815. // MaxAttendees sets the optional parameter "maxAttendees": The maximum
  4816. // number of attendees to include in the response. If there are more
  4817. // than the specified number of attendees, only the participant is
  4818. // returned.
  4819. func (c *EventsListCall) MaxAttendees(maxAttendees int64) *EventsListCall {
  4820. c.urlParams_.Set("maxAttendees", fmt.Sprint(maxAttendees))
  4821. return c
  4822. }
  4823. // MaxResults sets the optional parameter "maxResults": Maximum number
  4824. // of events returned on one result page. By default the value is 250
  4825. // events. The page size can never be larger than 2500 events.
  4826. func (c *EventsListCall) MaxResults(maxResults int64) *EventsListCall {
  4827. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4828. return c
  4829. }
  4830. // OrderBy sets the optional parameter "orderBy": The order of the
  4831. // events returned in the result. The default is an unspecified, stable
  4832. // order.
  4833. //
  4834. // Possible values:
  4835. // "startTime" - Order by the start date/time (ascending). This is
  4836. // only available when querying single events (i.e. the parameter
  4837. // singleEvents is True)
  4838. // "updated" - Order by last modification time (ascending).
  4839. func (c *EventsListCall) OrderBy(orderBy string) *EventsListCall {
  4840. c.urlParams_.Set("orderBy", orderBy)
  4841. return c
  4842. }
  4843. // PageToken sets the optional parameter "pageToken": Token specifying
  4844. // which result page to return.
  4845. func (c *EventsListCall) PageToken(pageToken string) *EventsListCall {
  4846. c.urlParams_.Set("pageToken", pageToken)
  4847. return c
  4848. }
  4849. // PrivateExtendedProperty sets the optional parameter
  4850. // "privateExtendedProperty": Extended properties constraint specified
  4851. // as propertyName=value. Matches only private properties. This
  4852. // parameter might be repeated multiple times to return events that
  4853. // match all given constraints.
  4854. func (c *EventsListCall) PrivateExtendedProperty(privateExtendedProperty ...string) *EventsListCall {
  4855. c.urlParams_.SetMulti("privateExtendedProperty", append([]string{}, privateExtendedProperty...))
  4856. return c
  4857. }
  4858. // Q sets the optional parameter "q": Free text search terms to find
  4859. // events that match these terms in any field, except for extended
  4860. // properties.
  4861. func (c *EventsListCall) Q(q string) *EventsListCall {
  4862. c.urlParams_.Set("q", q)
  4863. return c
  4864. }
  4865. // SharedExtendedProperty sets the optional parameter
  4866. // "sharedExtendedProperty": Extended properties constraint specified as
  4867. // propertyName=value. Matches only shared properties. This parameter
  4868. // might be repeated multiple times to return events that match all
  4869. // given constraints.
  4870. func (c *EventsListCall) SharedExtendedProperty(sharedExtendedProperty ...string) *EventsListCall {
  4871. c.urlParams_.SetMulti("sharedExtendedProperty", append([]string{}, sharedExtendedProperty...))
  4872. return c
  4873. }
  4874. // ShowDeleted sets the optional parameter "showDeleted": Whether to
  4875. // include deleted events (with status equals "cancelled") in the
  4876. // result. Cancelled instances of recurring events (but not the
  4877. // underlying recurring event) will still be included if showDeleted and
  4878. // singleEvents are both False. If showDeleted and singleEvents are both
  4879. // True, only single instances of deleted events (but not the underlying
  4880. // recurring events) are returned. The default is False.
  4881. func (c *EventsListCall) ShowDeleted(showDeleted bool) *EventsListCall {
  4882. c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
  4883. return c
  4884. }
  4885. // ShowHiddenInvitations sets the optional parameter
  4886. // "showHiddenInvitations": Whether to include hidden invitations in the
  4887. // result. The default is False.
  4888. func (c *EventsListCall) ShowHiddenInvitations(showHiddenInvitations bool) *EventsListCall {
  4889. c.urlParams_.Set("showHiddenInvitations", fmt.Sprint(showHiddenInvitations))
  4890. return c
  4891. }
  4892. // SingleEvents sets the optional parameter "singleEvents": Whether to
  4893. // expand recurring events into instances and only return single one-off
  4894. // events and instances of recurring events, but not the underlying
  4895. // recurring events themselves. The default is False.
  4896. func (c *EventsListCall) SingleEvents(singleEvents bool) *EventsListCall {
  4897. c.urlParams_.Set("singleEvents", fmt.Sprint(singleEvents))
  4898. return c
  4899. }
  4900. // SyncToken sets the optional parameter "syncToken": Token obtained
  4901. // from the nextSyncToken field returned on the last page of results
  4902. // from the previous list request. It makes the result of this list
  4903. // request contain only entries that have changed since then. All events
  4904. // deleted since the previous list request will always be in the result
  4905. // set and it is not allowed to set showDeleted to False.
  4906. // There are several query parameters that cannot be specified together
  4907. // with nextSyncToken to ensure consistency of the client state.
  4908. //
  4909. // These are:
  4910. // - iCalUID
  4911. // - orderBy
  4912. // - privateExtendedProperty
  4913. // - q
  4914. // - sharedExtendedProperty
  4915. // - timeMin
  4916. // - timeMax
  4917. // - updatedMin If the syncToken expires, the server will respond with a
  4918. // 410 GONE response code and the client should clear its storage and
  4919. // perform a full synchronization without any syncToken.
  4920. // Learn more about incremental synchronization.
  4921. // The default is to return all entries.
  4922. func (c *EventsListCall) SyncToken(syncToken string) *EventsListCall {
  4923. c.urlParams_.Set("syncToken", syncToken)
  4924. return c
  4925. }
  4926. // TimeMax sets the optional parameter "timeMax": Upper bound
  4927. // (exclusive) for an event's start time to filter by. The default is
  4928. // not to filter by start time. Must be an RFC3339 timestamp with
  4929. // mandatory time zone offset, e.g., 2011-06-03T10:00:00-07:00,
  4930. // 2011-06-03T10:00:00Z. Milliseconds may be provided but will be
  4931. // ignored.
  4932. func (c *EventsListCall) TimeMax(timeMax string) *EventsListCall {
  4933. c.urlParams_.Set("timeMax", timeMax)
  4934. return c
  4935. }
  4936. // TimeMin sets the optional parameter "timeMin": Lower bound
  4937. // (inclusive) for an event's end time to filter by. The default is not
  4938. // to filter by end time. Must be an RFC3339 timestamp with mandatory
  4939. // time zone offset, e.g., 2011-06-03T10:00:00-07:00,
  4940. // 2011-06-03T10:00:00Z. Milliseconds may be provided but will be
  4941. // ignored.
  4942. func (c *EventsListCall) TimeMin(timeMin string) *EventsListCall {
  4943. c.urlParams_.Set("timeMin", timeMin)
  4944. return c
  4945. }
  4946. // TimeZone sets the optional parameter "timeZone": Time zone used in
  4947. // the response. The default is the time zone of the calendar.
  4948. func (c *EventsListCall) TimeZone(timeZone string) *EventsListCall {
  4949. c.urlParams_.Set("timeZone", timeZone)
  4950. return c
  4951. }
  4952. // UpdatedMin sets the optional parameter "updatedMin": Lower bound for
  4953. // an event's last modification time (as a RFC3339 timestamp) to filter
  4954. // by. When specified, entries deleted since this time will always be
  4955. // included regardless of showDeleted. The default is not to filter by
  4956. // last modification time.
  4957. func (c *EventsListCall) UpdatedMin(updatedMin string) *EventsListCall {
  4958. c.urlParams_.Set("updatedMin", updatedMin)
  4959. return c
  4960. }
  4961. // Fields allows partial responses to be retrieved. See
  4962. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4963. // for more information.
  4964. func (c *EventsListCall) Fields(s ...googleapi.Field) *EventsListCall {
  4965. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4966. return c
  4967. }
  4968. // IfNoneMatch sets the optional parameter which makes the operation
  4969. // fail if the object's ETag matches the given value. This is useful for
  4970. // getting updates only after the object has changed since the last
  4971. // request. Use googleapi.IsNotModified to check whether the response
  4972. // error from Do is the result of In-None-Match.
  4973. func (c *EventsListCall) IfNoneMatch(entityTag string) *EventsListCall {
  4974. c.ifNoneMatch_ = entityTag
  4975. return c
  4976. }
  4977. // Context sets the context to be used in this call's Do method. Any
  4978. // pending HTTP request will be aborted if the provided context is
  4979. // canceled.
  4980. func (c *EventsListCall) Context(ctx context.Context) *EventsListCall {
  4981. c.ctx_ = ctx
  4982. return c
  4983. }
  4984. func (c *EventsListCall) doRequest(alt string) (*http.Response, error) {
  4985. var body io.Reader = nil
  4986. c.urlParams_.Set("alt", alt)
  4987. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/events")
  4988. urls += "?" + c.urlParams_.Encode()
  4989. req, _ := http.NewRequest("GET", urls, body)
  4990. googleapi.Expand(req.URL, map[string]string{
  4991. "calendarId": c.calendarId,
  4992. })
  4993. req.Header.Set("User-Agent", c.s.userAgent())
  4994. if c.ifNoneMatch_ != "" {
  4995. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4996. }
  4997. if c.ctx_ != nil {
  4998. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4999. }
  5000. return c.s.client.Do(req)
  5001. }
  5002. // Do executes the "calendar.events.list" call.
  5003. // Exactly one of *Events or error will be non-nil. Any non-2xx status
  5004. // code is an error. Response headers are in either
  5005. // *Events.ServerResponse.Header or (if a response was returned at all)
  5006. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5007. // check whether the returned error was because http.StatusNotModified
  5008. // was returned.
  5009. func (c *EventsListCall) Do(opts ...googleapi.CallOption) (*Events, error) {
  5010. gensupport.SetOptions(c.urlParams_, opts...)
  5011. res, err := c.doRequest("json")
  5012. if res != nil && res.StatusCode == http.StatusNotModified {
  5013. if res.Body != nil {
  5014. res.Body.Close()
  5015. }
  5016. return nil, &googleapi.Error{
  5017. Code: res.StatusCode,
  5018. Header: res.Header,
  5019. }
  5020. }
  5021. if err != nil {
  5022. return nil, err
  5023. }
  5024. defer googleapi.CloseBody(res)
  5025. if err := googleapi.CheckResponse(res); err != nil {
  5026. return nil, err
  5027. }
  5028. ret := &Events{
  5029. ServerResponse: googleapi.ServerResponse{
  5030. Header: res.Header,
  5031. HTTPStatusCode: res.StatusCode,
  5032. },
  5033. }
  5034. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5035. return nil, err
  5036. }
  5037. return ret, nil
  5038. // {
  5039. // "description": "Returns events on the specified calendar.",
  5040. // "httpMethod": "GET",
  5041. // "id": "calendar.events.list",
  5042. // "parameterOrder": [
  5043. // "calendarId"
  5044. // ],
  5045. // "parameters": {
  5046. // "alwaysIncludeEmail": {
  5047. // "description": "Whether to always include a value in the email field for the organizer, creator and attendees, even if no real email is available (i.e. a generated, non-working value will be provided). The use of this option is discouraged and should only be used by clients which cannot handle the absence of an email address value in the mentioned places. Optional. The default is False.",
  5048. // "location": "query",
  5049. // "type": "boolean"
  5050. // },
  5051. // "calendarId": {
  5052. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  5053. // "location": "path",
  5054. // "required": true,
  5055. // "type": "string"
  5056. // },
  5057. // "iCalUID": {
  5058. // "description": "Specifies event ID in the iCalendar format to be included in the response. Optional.",
  5059. // "location": "query",
  5060. // "type": "string"
  5061. // },
  5062. // "maxAttendees": {
  5063. // "description": "The maximum number of attendees to include in the response. If there are more than the specified number of attendees, only the participant is returned. Optional.",
  5064. // "format": "int32",
  5065. // "location": "query",
  5066. // "minimum": "1",
  5067. // "type": "integer"
  5068. // },
  5069. // "maxResults": {
  5070. // "description": "Maximum number of events returned on one result page. By default the value is 250 events. The page size can never be larger than 2500 events. Optional.",
  5071. // "format": "int32",
  5072. // "location": "query",
  5073. // "minimum": "1",
  5074. // "type": "integer"
  5075. // },
  5076. // "orderBy": {
  5077. // "description": "The order of the events returned in the result. Optional. The default is an unspecified, stable order.",
  5078. // "enum": [
  5079. // "startTime",
  5080. // "updated"
  5081. // ],
  5082. // "enumDescriptions": [
  5083. // "Order by the start date/time (ascending). This is only available when querying single events (i.e. the parameter singleEvents is True)",
  5084. // "Order by last modification time (ascending)."
  5085. // ],
  5086. // "location": "query",
  5087. // "type": "string"
  5088. // },
  5089. // "pageToken": {
  5090. // "description": "Token specifying which result page to return. Optional.",
  5091. // "location": "query",
  5092. // "type": "string"
  5093. // },
  5094. // "privateExtendedProperty": {
  5095. // "description": "Extended properties constraint specified as propertyName=value. Matches only private properties. This parameter might be repeated multiple times to return events that match all given constraints.",
  5096. // "location": "query",
  5097. // "repeated": true,
  5098. // "type": "string"
  5099. // },
  5100. // "q": {
  5101. // "description": "Free text search terms to find events that match these terms in any field, except for extended properties. Optional.",
  5102. // "location": "query",
  5103. // "type": "string"
  5104. // },
  5105. // "sharedExtendedProperty": {
  5106. // "description": "Extended properties constraint specified as propertyName=value. Matches only shared properties. This parameter might be repeated multiple times to return events that match all given constraints.",
  5107. // "location": "query",
  5108. // "repeated": true,
  5109. // "type": "string"
  5110. // },
  5111. // "showDeleted": {
  5112. // "description": "Whether to include deleted events (with status equals \"cancelled\") in the result. Cancelled instances of recurring events (but not the underlying recurring event) will still be included if showDeleted and singleEvents are both False. If showDeleted and singleEvents are both True, only single instances of deleted events (but not the underlying recurring events) are returned. Optional. The default is False.",
  5113. // "location": "query",
  5114. // "type": "boolean"
  5115. // },
  5116. // "showHiddenInvitations": {
  5117. // "description": "Whether to include hidden invitations in the result. Optional. The default is False.",
  5118. // "location": "query",
  5119. // "type": "boolean"
  5120. // },
  5121. // "singleEvents": {
  5122. // "description": "Whether to expand recurring events into instances and only return single one-off events and instances of recurring events, but not the underlying recurring events themselves. Optional. The default is False.",
  5123. // "location": "query",
  5124. // "type": "boolean"
  5125. // },
  5126. // "syncToken": {
  5127. // "description": "Token obtained from the nextSyncToken field returned on the last page of results from the previous list request. It makes the result of this list request contain only entries that have changed since then. All events deleted since the previous list request will always be in the result set and it is not allowed to set showDeleted to False.\nThere are several query parameters that cannot be specified together with nextSyncToken to ensure consistency of the client state.\n\nThese are: \n- iCalUID \n- orderBy \n- privateExtendedProperty \n- q \n- sharedExtendedProperty \n- timeMin \n- timeMax \n- updatedMin If the syncToken expires, the server will respond with a 410 GONE response code and the client should clear its storage and perform a full synchronization without any syncToken.\nLearn more about incremental synchronization.\nOptional. The default is to return all entries.",
  5128. // "location": "query",
  5129. // "type": "string"
  5130. // },
  5131. // "timeMax": {
  5132. // "description": "Upper bound (exclusive) for an event's start time to filter by. Optional. The default is not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset, e.g., 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but will be ignored.",
  5133. // "format": "date-time",
  5134. // "location": "query",
  5135. // "type": "string"
  5136. // },
  5137. // "timeMin": {
  5138. // "description": "Lower bound (inclusive) for an event's end time to filter by. Optional. The default is not to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, e.g., 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but will be ignored.",
  5139. // "format": "date-time",
  5140. // "location": "query",
  5141. // "type": "string"
  5142. // },
  5143. // "timeZone": {
  5144. // "description": "Time zone used in the response. Optional. The default is the time zone of the calendar.",
  5145. // "location": "query",
  5146. // "type": "string"
  5147. // },
  5148. // "updatedMin": {
  5149. // "description": "Lower bound for an event's last modification time (as a RFC3339 timestamp) to filter by. When specified, entries deleted since this time will always be included regardless of showDeleted. Optional. The default is not to filter by last modification time.",
  5150. // "format": "date-time",
  5151. // "location": "query",
  5152. // "type": "string"
  5153. // }
  5154. // },
  5155. // "path": "calendars/{calendarId}/events",
  5156. // "response": {
  5157. // "$ref": "Events"
  5158. // },
  5159. // "scopes": [
  5160. // "https://www.googleapis.com/auth/calendar",
  5161. // "https://www.googleapis.com/auth/calendar.readonly"
  5162. // ],
  5163. // "supportsSubscription": true
  5164. // }
  5165. }
  5166. // Pages invokes f for each page of results.
  5167. // A non-nil error returned from f will halt the iteration.
  5168. // The provided context supersedes any context provided to the Context method.
  5169. func (c *EventsListCall) Pages(ctx context.Context, f func(*Events) error) error {
  5170. c.ctx_ = ctx
  5171. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5172. for {
  5173. x, err := c.Do()
  5174. if err != nil {
  5175. return err
  5176. }
  5177. if err := f(x); err != nil {
  5178. return err
  5179. }
  5180. if x.NextPageToken == "" {
  5181. return nil
  5182. }
  5183. c.PageToken(x.NextPageToken)
  5184. }
  5185. }
  5186. // method id "calendar.events.move":
  5187. type EventsMoveCall struct {
  5188. s *Service
  5189. calendarId string
  5190. eventId string
  5191. urlParams_ gensupport.URLParams
  5192. ctx_ context.Context
  5193. }
  5194. // Move: Moves an event to another calendar, i.e. changes an event's
  5195. // organizer.
  5196. func (r *EventsService) Move(calendarId string, eventId string, destinationid string) *EventsMoveCall {
  5197. c := &EventsMoveCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5198. c.calendarId = calendarId
  5199. c.eventId = eventId
  5200. c.urlParams_.Set("destination", destinationid)
  5201. return c
  5202. }
  5203. // SendNotifications sets the optional parameter "sendNotifications":
  5204. // Whether to send notifications about the change of the event's
  5205. // organizer. The default is False.
  5206. func (c *EventsMoveCall) SendNotifications(sendNotifications bool) *EventsMoveCall {
  5207. c.urlParams_.Set("sendNotifications", fmt.Sprint(sendNotifications))
  5208. return c
  5209. }
  5210. // Fields allows partial responses to be retrieved. See
  5211. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5212. // for more information.
  5213. func (c *EventsMoveCall) Fields(s ...googleapi.Field) *EventsMoveCall {
  5214. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5215. return c
  5216. }
  5217. // Context sets the context to be used in this call's Do method. Any
  5218. // pending HTTP request will be aborted if the provided context is
  5219. // canceled.
  5220. func (c *EventsMoveCall) Context(ctx context.Context) *EventsMoveCall {
  5221. c.ctx_ = ctx
  5222. return c
  5223. }
  5224. func (c *EventsMoveCall) doRequest(alt string) (*http.Response, error) {
  5225. var body io.Reader = nil
  5226. c.urlParams_.Set("alt", alt)
  5227. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/events/{eventId}/move")
  5228. urls += "?" + c.urlParams_.Encode()
  5229. req, _ := http.NewRequest("POST", urls, body)
  5230. googleapi.Expand(req.URL, map[string]string{
  5231. "calendarId": c.calendarId,
  5232. "eventId": c.eventId,
  5233. })
  5234. req.Header.Set("User-Agent", c.s.userAgent())
  5235. if c.ctx_ != nil {
  5236. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5237. }
  5238. return c.s.client.Do(req)
  5239. }
  5240. // Do executes the "calendar.events.move" call.
  5241. // Exactly one of *Event or error will be non-nil. Any non-2xx status
  5242. // code is an error. Response headers are in either
  5243. // *Event.ServerResponse.Header or (if a response was returned at all)
  5244. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5245. // check whether the returned error was because http.StatusNotModified
  5246. // was returned.
  5247. func (c *EventsMoveCall) Do(opts ...googleapi.CallOption) (*Event, error) {
  5248. gensupport.SetOptions(c.urlParams_, opts...)
  5249. res, err := c.doRequest("json")
  5250. if res != nil && res.StatusCode == http.StatusNotModified {
  5251. if res.Body != nil {
  5252. res.Body.Close()
  5253. }
  5254. return nil, &googleapi.Error{
  5255. Code: res.StatusCode,
  5256. Header: res.Header,
  5257. }
  5258. }
  5259. if err != nil {
  5260. return nil, err
  5261. }
  5262. defer googleapi.CloseBody(res)
  5263. if err := googleapi.CheckResponse(res); err != nil {
  5264. return nil, err
  5265. }
  5266. ret := &Event{
  5267. ServerResponse: googleapi.ServerResponse{
  5268. Header: res.Header,
  5269. HTTPStatusCode: res.StatusCode,
  5270. },
  5271. }
  5272. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5273. return nil, err
  5274. }
  5275. return ret, nil
  5276. // {
  5277. // "description": "Moves an event to another calendar, i.e. changes an event's organizer.",
  5278. // "httpMethod": "POST",
  5279. // "id": "calendar.events.move",
  5280. // "parameterOrder": [
  5281. // "calendarId",
  5282. // "eventId",
  5283. // "destination"
  5284. // ],
  5285. // "parameters": {
  5286. // "calendarId": {
  5287. // "description": "Calendar identifier of the source calendar where the event currently is on.",
  5288. // "location": "path",
  5289. // "required": true,
  5290. // "type": "string"
  5291. // },
  5292. // "destination": {
  5293. // "description": "Calendar identifier of the target calendar where the event is to be moved to.",
  5294. // "location": "query",
  5295. // "required": true,
  5296. // "type": "string"
  5297. // },
  5298. // "eventId": {
  5299. // "description": "Event identifier.",
  5300. // "location": "path",
  5301. // "required": true,
  5302. // "type": "string"
  5303. // },
  5304. // "sendNotifications": {
  5305. // "description": "Whether to send notifications about the change of the event's organizer. Optional. The default is False.",
  5306. // "location": "query",
  5307. // "type": "boolean"
  5308. // }
  5309. // },
  5310. // "path": "calendars/{calendarId}/events/{eventId}/move",
  5311. // "response": {
  5312. // "$ref": "Event"
  5313. // },
  5314. // "scopes": [
  5315. // "https://www.googleapis.com/auth/calendar"
  5316. // ]
  5317. // }
  5318. }
  5319. // method id "calendar.events.patch":
  5320. type EventsPatchCall struct {
  5321. s *Service
  5322. calendarId string
  5323. eventId string
  5324. event *Event
  5325. urlParams_ gensupport.URLParams
  5326. ctx_ context.Context
  5327. }
  5328. // Patch: Updates an event. This method supports patch semantics.
  5329. func (r *EventsService) Patch(calendarId string, eventId string, event *Event) *EventsPatchCall {
  5330. c := &EventsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5331. c.calendarId = calendarId
  5332. c.eventId = eventId
  5333. c.event = event
  5334. return c
  5335. }
  5336. // AlwaysIncludeEmail sets the optional parameter "alwaysIncludeEmail":
  5337. // Whether to always include a value in the email field for the
  5338. // organizer, creator and attendees, even if no real email is available
  5339. // (i.e. a generated, non-working value will be provided). The use of
  5340. // this option is discouraged and should only be used by clients which
  5341. // cannot handle the absence of an email address value in the mentioned
  5342. // places. The default is False.
  5343. func (c *EventsPatchCall) AlwaysIncludeEmail(alwaysIncludeEmail bool) *EventsPatchCall {
  5344. c.urlParams_.Set("alwaysIncludeEmail", fmt.Sprint(alwaysIncludeEmail))
  5345. return c
  5346. }
  5347. // MaxAttendees sets the optional parameter "maxAttendees": The maximum
  5348. // number of attendees to include in the response. If there are more
  5349. // than the specified number of attendees, only the participant is
  5350. // returned.
  5351. func (c *EventsPatchCall) MaxAttendees(maxAttendees int64) *EventsPatchCall {
  5352. c.urlParams_.Set("maxAttendees", fmt.Sprint(maxAttendees))
  5353. return c
  5354. }
  5355. // SendNotifications sets the optional parameter "sendNotifications":
  5356. // Whether to send notifications about the event update (e.g. attendee's
  5357. // responses, title changes, etc.). The default is False.
  5358. func (c *EventsPatchCall) SendNotifications(sendNotifications bool) *EventsPatchCall {
  5359. c.urlParams_.Set("sendNotifications", fmt.Sprint(sendNotifications))
  5360. return c
  5361. }
  5362. // SupportsAttachments sets the optional parameter
  5363. // "supportsAttachments": Whether API client performing operation
  5364. // supports event attachments. The default is False.
  5365. func (c *EventsPatchCall) SupportsAttachments(supportsAttachments bool) *EventsPatchCall {
  5366. c.urlParams_.Set("supportsAttachments", fmt.Sprint(supportsAttachments))
  5367. return c
  5368. }
  5369. // Fields allows partial responses to be retrieved. See
  5370. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5371. // for more information.
  5372. func (c *EventsPatchCall) Fields(s ...googleapi.Field) *EventsPatchCall {
  5373. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5374. return c
  5375. }
  5376. // Context sets the context to be used in this call's Do method. Any
  5377. // pending HTTP request will be aborted if the provided context is
  5378. // canceled.
  5379. func (c *EventsPatchCall) Context(ctx context.Context) *EventsPatchCall {
  5380. c.ctx_ = ctx
  5381. return c
  5382. }
  5383. func (c *EventsPatchCall) doRequest(alt string) (*http.Response, error) {
  5384. var body io.Reader = nil
  5385. body, err := googleapi.WithoutDataWrapper.JSONReader(c.event)
  5386. if err != nil {
  5387. return nil, err
  5388. }
  5389. ctype := "application/json"
  5390. c.urlParams_.Set("alt", alt)
  5391. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/events/{eventId}")
  5392. urls += "?" + c.urlParams_.Encode()
  5393. req, _ := http.NewRequest("PATCH", urls, body)
  5394. googleapi.Expand(req.URL, map[string]string{
  5395. "calendarId": c.calendarId,
  5396. "eventId": c.eventId,
  5397. })
  5398. req.Header.Set("Content-Type", ctype)
  5399. req.Header.Set("User-Agent", c.s.userAgent())
  5400. if c.ctx_ != nil {
  5401. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5402. }
  5403. return c.s.client.Do(req)
  5404. }
  5405. // Do executes the "calendar.events.patch" call.
  5406. // Exactly one of *Event or error will be non-nil. Any non-2xx status
  5407. // code is an error. Response headers are in either
  5408. // *Event.ServerResponse.Header or (if a response was returned at all)
  5409. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5410. // check whether the returned error was because http.StatusNotModified
  5411. // was returned.
  5412. func (c *EventsPatchCall) Do(opts ...googleapi.CallOption) (*Event, error) {
  5413. gensupport.SetOptions(c.urlParams_, opts...)
  5414. res, err := c.doRequest("json")
  5415. if res != nil && res.StatusCode == http.StatusNotModified {
  5416. if res.Body != nil {
  5417. res.Body.Close()
  5418. }
  5419. return nil, &googleapi.Error{
  5420. Code: res.StatusCode,
  5421. Header: res.Header,
  5422. }
  5423. }
  5424. if err != nil {
  5425. return nil, err
  5426. }
  5427. defer googleapi.CloseBody(res)
  5428. if err := googleapi.CheckResponse(res); err != nil {
  5429. return nil, err
  5430. }
  5431. ret := &Event{
  5432. ServerResponse: googleapi.ServerResponse{
  5433. Header: res.Header,
  5434. HTTPStatusCode: res.StatusCode,
  5435. },
  5436. }
  5437. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5438. return nil, err
  5439. }
  5440. return ret, nil
  5441. // {
  5442. // "description": "Updates an event. This method supports patch semantics.",
  5443. // "httpMethod": "PATCH",
  5444. // "id": "calendar.events.patch",
  5445. // "parameterOrder": [
  5446. // "calendarId",
  5447. // "eventId"
  5448. // ],
  5449. // "parameters": {
  5450. // "alwaysIncludeEmail": {
  5451. // "description": "Whether to always include a value in the email field for the organizer, creator and attendees, even if no real email is available (i.e. a generated, non-working value will be provided). The use of this option is discouraged and should only be used by clients which cannot handle the absence of an email address value in the mentioned places. Optional. The default is False.",
  5452. // "location": "query",
  5453. // "type": "boolean"
  5454. // },
  5455. // "calendarId": {
  5456. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  5457. // "location": "path",
  5458. // "required": true,
  5459. // "type": "string"
  5460. // },
  5461. // "eventId": {
  5462. // "description": "Event identifier.",
  5463. // "location": "path",
  5464. // "required": true,
  5465. // "type": "string"
  5466. // },
  5467. // "maxAttendees": {
  5468. // "description": "The maximum number of attendees to include in the response. If there are more than the specified number of attendees, only the participant is returned. Optional.",
  5469. // "format": "int32",
  5470. // "location": "query",
  5471. // "minimum": "1",
  5472. // "type": "integer"
  5473. // },
  5474. // "sendNotifications": {
  5475. // "description": "Whether to send notifications about the event update (e.g. attendee's responses, title changes, etc.). Optional. The default is False.",
  5476. // "location": "query",
  5477. // "type": "boolean"
  5478. // },
  5479. // "supportsAttachments": {
  5480. // "description": "Whether API client performing operation supports event attachments. Optional. The default is False.",
  5481. // "location": "query",
  5482. // "type": "boolean"
  5483. // }
  5484. // },
  5485. // "path": "calendars/{calendarId}/events/{eventId}",
  5486. // "request": {
  5487. // "$ref": "Event"
  5488. // },
  5489. // "response": {
  5490. // "$ref": "Event"
  5491. // },
  5492. // "scopes": [
  5493. // "https://www.googleapis.com/auth/calendar"
  5494. // ]
  5495. // }
  5496. }
  5497. // method id "calendar.events.quickAdd":
  5498. type EventsQuickAddCall struct {
  5499. s *Service
  5500. calendarId string
  5501. urlParams_ gensupport.URLParams
  5502. ctx_ context.Context
  5503. }
  5504. // QuickAdd: Creates an event based on a simple text string.
  5505. func (r *EventsService) QuickAdd(calendarId string, text string) *EventsQuickAddCall {
  5506. c := &EventsQuickAddCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5507. c.calendarId = calendarId
  5508. c.urlParams_.Set("text", text)
  5509. return c
  5510. }
  5511. // SendNotifications sets the optional parameter "sendNotifications":
  5512. // Whether to send notifications about the creation of the event. The
  5513. // default is False.
  5514. func (c *EventsQuickAddCall) SendNotifications(sendNotifications bool) *EventsQuickAddCall {
  5515. c.urlParams_.Set("sendNotifications", fmt.Sprint(sendNotifications))
  5516. return c
  5517. }
  5518. // Fields allows partial responses to be retrieved. See
  5519. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5520. // for more information.
  5521. func (c *EventsQuickAddCall) Fields(s ...googleapi.Field) *EventsQuickAddCall {
  5522. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5523. return c
  5524. }
  5525. // Context sets the context to be used in this call's Do method. Any
  5526. // pending HTTP request will be aborted if the provided context is
  5527. // canceled.
  5528. func (c *EventsQuickAddCall) Context(ctx context.Context) *EventsQuickAddCall {
  5529. c.ctx_ = ctx
  5530. return c
  5531. }
  5532. func (c *EventsQuickAddCall) doRequest(alt string) (*http.Response, error) {
  5533. var body io.Reader = nil
  5534. c.urlParams_.Set("alt", alt)
  5535. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/events/quickAdd")
  5536. urls += "?" + c.urlParams_.Encode()
  5537. req, _ := http.NewRequest("POST", urls, body)
  5538. googleapi.Expand(req.URL, map[string]string{
  5539. "calendarId": c.calendarId,
  5540. })
  5541. req.Header.Set("User-Agent", c.s.userAgent())
  5542. if c.ctx_ != nil {
  5543. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5544. }
  5545. return c.s.client.Do(req)
  5546. }
  5547. // Do executes the "calendar.events.quickAdd" call.
  5548. // Exactly one of *Event or error will be non-nil. Any non-2xx status
  5549. // code is an error. Response headers are in either
  5550. // *Event.ServerResponse.Header or (if a response was returned at all)
  5551. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5552. // check whether the returned error was because http.StatusNotModified
  5553. // was returned.
  5554. func (c *EventsQuickAddCall) Do(opts ...googleapi.CallOption) (*Event, error) {
  5555. gensupport.SetOptions(c.urlParams_, opts...)
  5556. res, err := c.doRequest("json")
  5557. if res != nil && res.StatusCode == http.StatusNotModified {
  5558. if res.Body != nil {
  5559. res.Body.Close()
  5560. }
  5561. return nil, &googleapi.Error{
  5562. Code: res.StatusCode,
  5563. Header: res.Header,
  5564. }
  5565. }
  5566. if err != nil {
  5567. return nil, err
  5568. }
  5569. defer googleapi.CloseBody(res)
  5570. if err := googleapi.CheckResponse(res); err != nil {
  5571. return nil, err
  5572. }
  5573. ret := &Event{
  5574. ServerResponse: googleapi.ServerResponse{
  5575. Header: res.Header,
  5576. HTTPStatusCode: res.StatusCode,
  5577. },
  5578. }
  5579. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5580. return nil, err
  5581. }
  5582. return ret, nil
  5583. // {
  5584. // "description": "Creates an event based on a simple text string.",
  5585. // "httpMethod": "POST",
  5586. // "id": "calendar.events.quickAdd",
  5587. // "parameterOrder": [
  5588. // "calendarId",
  5589. // "text"
  5590. // ],
  5591. // "parameters": {
  5592. // "calendarId": {
  5593. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  5594. // "location": "path",
  5595. // "required": true,
  5596. // "type": "string"
  5597. // },
  5598. // "sendNotifications": {
  5599. // "description": "Whether to send notifications about the creation of the event. Optional. The default is False.",
  5600. // "location": "query",
  5601. // "type": "boolean"
  5602. // },
  5603. // "text": {
  5604. // "description": "The text describing the event to be created.",
  5605. // "location": "query",
  5606. // "required": true,
  5607. // "type": "string"
  5608. // }
  5609. // },
  5610. // "path": "calendars/{calendarId}/events/quickAdd",
  5611. // "response": {
  5612. // "$ref": "Event"
  5613. // },
  5614. // "scopes": [
  5615. // "https://www.googleapis.com/auth/calendar"
  5616. // ]
  5617. // }
  5618. }
  5619. // method id "calendar.events.update":
  5620. type EventsUpdateCall struct {
  5621. s *Service
  5622. calendarId string
  5623. eventId string
  5624. event *Event
  5625. urlParams_ gensupport.URLParams
  5626. ctx_ context.Context
  5627. }
  5628. // Update: Updates an event.
  5629. func (r *EventsService) Update(calendarId string, eventId string, event *Event) *EventsUpdateCall {
  5630. c := &EventsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5631. c.calendarId = calendarId
  5632. c.eventId = eventId
  5633. c.event = event
  5634. return c
  5635. }
  5636. // AlwaysIncludeEmail sets the optional parameter "alwaysIncludeEmail":
  5637. // Whether to always include a value in the email field for the
  5638. // organizer, creator and attendees, even if no real email is available
  5639. // (i.e. a generated, non-working value will be provided). The use of
  5640. // this option is discouraged and should only be used by clients which
  5641. // cannot handle the absence of an email address value in the mentioned
  5642. // places. The default is False.
  5643. func (c *EventsUpdateCall) AlwaysIncludeEmail(alwaysIncludeEmail bool) *EventsUpdateCall {
  5644. c.urlParams_.Set("alwaysIncludeEmail", fmt.Sprint(alwaysIncludeEmail))
  5645. return c
  5646. }
  5647. // MaxAttendees sets the optional parameter "maxAttendees": The maximum
  5648. // number of attendees to include in the response. If there are more
  5649. // than the specified number of attendees, only the participant is
  5650. // returned.
  5651. func (c *EventsUpdateCall) MaxAttendees(maxAttendees int64) *EventsUpdateCall {
  5652. c.urlParams_.Set("maxAttendees", fmt.Sprint(maxAttendees))
  5653. return c
  5654. }
  5655. // SendNotifications sets the optional parameter "sendNotifications":
  5656. // Whether to send notifications about the event update (e.g. attendee's
  5657. // responses, title changes, etc.). The default is False.
  5658. func (c *EventsUpdateCall) SendNotifications(sendNotifications bool) *EventsUpdateCall {
  5659. c.urlParams_.Set("sendNotifications", fmt.Sprint(sendNotifications))
  5660. return c
  5661. }
  5662. // SupportsAttachments sets the optional parameter
  5663. // "supportsAttachments": Whether API client performing operation
  5664. // supports event attachments. The default is False.
  5665. func (c *EventsUpdateCall) SupportsAttachments(supportsAttachments bool) *EventsUpdateCall {
  5666. c.urlParams_.Set("supportsAttachments", fmt.Sprint(supportsAttachments))
  5667. return c
  5668. }
  5669. // Fields allows partial responses to be retrieved. See
  5670. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5671. // for more information.
  5672. func (c *EventsUpdateCall) Fields(s ...googleapi.Field) *EventsUpdateCall {
  5673. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5674. return c
  5675. }
  5676. // Context sets the context to be used in this call's Do method. Any
  5677. // pending HTTP request will be aborted if the provided context is
  5678. // canceled.
  5679. func (c *EventsUpdateCall) Context(ctx context.Context) *EventsUpdateCall {
  5680. c.ctx_ = ctx
  5681. return c
  5682. }
  5683. func (c *EventsUpdateCall) doRequest(alt string) (*http.Response, error) {
  5684. var body io.Reader = nil
  5685. body, err := googleapi.WithoutDataWrapper.JSONReader(c.event)
  5686. if err != nil {
  5687. return nil, err
  5688. }
  5689. ctype := "application/json"
  5690. c.urlParams_.Set("alt", alt)
  5691. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/events/{eventId}")
  5692. urls += "?" + c.urlParams_.Encode()
  5693. req, _ := http.NewRequest("PUT", urls, body)
  5694. googleapi.Expand(req.URL, map[string]string{
  5695. "calendarId": c.calendarId,
  5696. "eventId": c.eventId,
  5697. })
  5698. req.Header.Set("Content-Type", ctype)
  5699. req.Header.Set("User-Agent", c.s.userAgent())
  5700. if c.ctx_ != nil {
  5701. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5702. }
  5703. return c.s.client.Do(req)
  5704. }
  5705. // Do executes the "calendar.events.update" call.
  5706. // Exactly one of *Event or error will be non-nil. Any non-2xx status
  5707. // code is an error. Response headers are in either
  5708. // *Event.ServerResponse.Header or (if a response was returned at all)
  5709. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5710. // check whether the returned error was because http.StatusNotModified
  5711. // was returned.
  5712. func (c *EventsUpdateCall) Do(opts ...googleapi.CallOption) (*Event, error) {
  5713. gensupport.SetOptions(c.urlParams_, opts...)
  5714. res, err := c.doRequest("json")
  5715. if res != nil && res.StatusCode == http.StatusNotModified {
  5716. if res.Body != nil {
  5717. res.Body.Close()
  5718. }
  5719. return nil, &googleapi.Error{
  5720. Code: res.StatusCode,
  5721. Header: res.Header,
  5722. }
  5723. }
  5724. if err != nil {
  5725. return nil, err
  5726. }
  5727. defer googleapi.CloseBody(res)
  5728. if err := googleapi.CheckResponse(res); err != nil {
  5729. return nil, err
  5730. }
  5731. ret := &Event{
  5732. ServerResponse: googleapi.ServerResponse{
  5733. Header: res.Header,
  5734. HTTPStatusCode: res.StatusCode,
  5735. },
  5736. }
  5737. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5738. return nil, err
  5739. }
  5740. return ret, nil
  5741. // {
  5742. // "description": "Updates an event.",
  5743. // "httpMethod": "PUT",
  5744. // "id": "calendar.events.update",
  5745. // "parameterOrder": [
  5746. // "calendarId",
  5747. // "eventId"
  5748. // ],
  5749. // "parameters": {
  5750. // "alwaysIncludeEmail": {
  5751. // "description": "Whether to always include a value in the email field for the organizer, creator and attendees, even if no real email is available (i.e. a generated, non-working value will be provided). The use of this option is discouraged and should only be used by clients which cannot handle the absence of an email address value in the mentioned places. Optional. The default is False.",
  5752. // "location": "query",
  5753. // "type": "boolean"
  5754. // },
  5755. // "calendarId": {
  5756. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  5757. // "location": "path",
  5758. // "required": true,
  5759. // "type": "string"
  5760. // },
  5761. // "eventId": {
  5762. // "description": "Event identifier.",
  5763. // "location": "path",
  5764. // "required": true,
  5765. // "type": "string"
  5766. // },
  5767. // "maxAttendees": {
  5768. // "description": "The maximum number of attendees to include in the response. If there are more than the specified number of attendees, only the participant is returned. Optional.",
  5769. // "format": "int32",
  5770. // "location": "query",
  5771. // "minimum": "1",
  5772. // "type": "integer"
  5773. // },
  5774. // "sendNotifications": {
  5775. // "description": "Whether to send notifications about the event update (e.g. attendee's responses, title changes, etc.). Optional. The default is False.",
  5776. // "location": "query",
  5777. // "type": "boolean"
  5778. // },
  5779. // "supportsAttachments": {
  5780. // "description": "Whether API client performing operation supports event attachments. Optional. The default is False.",
  5781. // "location": "query",
  5782. // "type": "boolean"
  5783. // }
  5784. // },
  5785. // "path": "calendars/{calendarId}/events/{eventId}",
  5786. // "request": {
  5787. // "$ref": "Event"
  5788. // },
  5789. // "response": {
  5790. // "$ref": "Event"
  5791. // },
  5792. // "scopes": [
  5793. // "https://www.googleapis.com/auth/calendar"
  5794. // ]
  5795. // }
  5796. }
  5797. // method id "calendar.events.watch":
  5798. type EventsWatchCall struct {
  5799. s *Service
  5800. calendarId string
  5801. channel *Channel
  5802. urlParams_ gensupport.URLParams
  5803. ctx_ context.Context
  5804. }
  5805. // Watch: Watch for changes to Events resources.
  5806. func (r *EventsService) Watch(calendarId string, channel *Channel) *EventsWatchCall {
  5807. c := &EventsWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5808. c.calendarId = calendarId
  5809. c.channel = channel
  5810. return c
  5811. }
  5812. // AlwaysIncludeEmail sets the optional parameter "alwaysIncludeEmail":
  5813. // Whether to always include a value in the email field for the
  5814. // organizer, creator and attendees, even if no real email is available
  5815. // (i.e. a generated, non-working value will be provided). The use of
  5816. // this option is discouraged and should only be used by clients which
  5817. // cannot handle the absence of an email address value in the mentioned
  5818. // places. The default is False.
  5819. func (c *EventsWatchCall) AlwaysIncludeEmail(alwaysIncludeEmail bool) *EventsWatchCall {
  5820. c.urlParams_.Set("alwaysIncludeEmail", fmt.Sprint(alwaysIncludeEmail))
  5821. return c
  5822. }
  5823. // ICalUID sets the optional parameter "iCalUID": Specifies event ID in
  5824. // the iCalendar format to be included in the response.
  5825. func (c *EventsWatchCall) ICalUID(iCalUID string) *EventsWatchCall {
  5826. c.urlParams_.Set("iCalUID", iCalUID)
  5827. return c
  5828. }
  5829. // MaxAttendees sets the optional parameter "maxAttendees": The maximum
  5830. // number of attendees to include in the response. If there are more
  5831. // than the specified number of attendees, only the participant is
  5832. // returned.
  5833. func (c *EventsWatchCall) MaxAttendees(maxAttendees int64) *EventsWatchCall {
  5834. c.urlParams_.Set("maxAttendees", fmt.Sprint(maxAttendees))
  5835. return c
  5836. }
  5837. // MaxResults sets the optional parameter "maxResults": Maximum number
  5838. // of events returned on one result page. By default the value is 250
  5839. // events. The page size can never be larger than 2500 events.
  5840. func (c *EventsWatchCall) MaxResults(maxResults int64) *EventsWatchCall {
  5841. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5842. return c
  5843. }
  5844. // OrderBy sets the optional parameter "orderBy": The order of the
  5845. // events returned in the result. The default is an unspecified, stable
  5846. // order.
  5847. //
  5848. // Possible values:
  5849. // "startTime" - Order by the start date/time (ascending). This is
  5850. // only available when querying single events (i.e. the parameter
  5851. // singleEvents is True)
  5852. // "updated" - Order by last modification time (ascending).
  5853. func (c *EventsWatchCall) OrderBy(orderBy string) *EventsWatchCall {
  5854. c.urlParams_.Set("orderBy", orderBy)
  5855. return c
  5856. }
  5857. // PageToken sets the optional parameter "pageToken": Token specifying
  5858. // which result page to return.
  5859. func (c *EventsWatchCall) PageToken(pageToken string) *EventsWatchCall {
  5860. c.urlParams_.Set("pageToken", pageToken)
  5861. return c
  5862. }
  5863. // PrivateExtendedProperty sets the optional parameter
  5864. // "privateExtendedProperty": Extended properties constraint specified
  5865. // as propertyName=value. Matches only private properties. This
  5866. // parameter might be repeated multiple times to return events that
  5867. // match all given constraints.
  5868. func (c *EventsWatchCall) PrivateExtendedProperty(privateExtendedProperty ...string) *EventsWatchCall {
  5869. c.urlParams_.SetMulti("privateExtendedProperty", append([]string{}, privateExtendedProperty...))
  5870. return c
  5871. }
  5872. // Q sets the optional parameter "q": Free text search terms to find
  5873. // events that match these terms in any field, except for extended
  5874. // properties.
  5875. func (c *EventsWatchCall) Q(q string) *EventsWatchCall {
  5876. c.urlParams_.Set("q", q)
  5877. return c
  5878. }
  5879. // SharedExtendedProperty sets the optional parameter
  5880. // "sharedExtendedProperty": Extended properties constraint specified as
  5881. // propertyName=value. Matches only shared properties. This parameter
  5882. // might be repeated multiple times to return events that match all
  5883. // given constraints.
  5884. func (c *EventsWatchCall) SharedExtendedProperty(sharedExtendedProperty ...string) *EventsWatchCall {
  5885. c.urlParams_.SetMulti("sharedExtendedProperty", append([]string{}, sharedExtendedProperty...))
  5886. return c
  5887. }
  5888. // ShowDeleted sets the optional parameter "showDeleted": Whether to
  5889. // include deleted events (with status equals "cancelled") in the
  5890. // result. Cancelled instances of recurring events (but not the
  5891. // underlying recurring event) will still be included if showDeleted and
  5892. // singleEvents are both False. If showDeleted and singleEvents are both
  5893. // True, only single instances of deleted events (but not the underlying
  5894. // recurring events) are returned. The default is False.
  5895. func (c *EventsWatchCall) ShowDeleted(showDeleted bool) *EventsWatchCall {
  5896. c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
  5897. return c
  5898. }
  5899. // ShowHiddenInvitations sets the optional parameter
  5900. // "showHiddenInvitations": Whether to include hidden invitations in the
  5901. // result. The default is False.
  5902. func (c *EventsWatchCall) ShowHiddenInvitations(showHiddenInvitations bool) *EventsWatchCall {
  5903. c.urlParams_.Set("showHiddenInvitations", fmt.Sprint(showHiddenInvitations))
  5904. return c
  5905. }
  5906. // SingleEvents sets the optional parameter "singleEvents": Whether to
  5907. // expand recurring events into instances and only return single one-off
  5908. // events and instances of recurring events, but not the underlying
  5909. // recurring events themselves. The default is False.
  5910. func (c *EventsWatchCall) SingleEvents(singleEvents bool) *EventsWatchCall {
  5911. c.urlParams_.Set("singleEvents", fmt.Sprint(singleEvents))
  5912. return c
  5913. }
  5914. // SyncToken sets the optional parameter "syncToken": Token obtained
  5915. // from the nextSyncToken field returned on the last page of results
  5916. // from the previous list request. It makes the result of this list
  5917. // request contain only entries that have changed since then. All events
  5918. // deleted since the previous list request will always be in the result
  5919. // set and it is not allowed to set showDeleted to False.
  5920. // There are several query parameters that cannot be specified together
  5921. // with nextSyncToken to ensure consistency of the client state.
  5922. //
  5923. // These are:
  5924. // - iCalUID
  5925. // - orderBy
  5926. // - privateExtendedProperty
  5927. // - q
  5928. // - sharedExtendedProperty
  5929. // - timeMin
  5930. // - timeMax
  5931. // - updatedMin If the syncToken expires, the server will respond with a
  5932. // 410 GONE response code and the client should clear its storage and
  5933. // perform a full synchronization without any syncToken.
  5934. // Learn more about incremental synchronization.
  5935. // The default is to return all entries.
  5936. func (c *EventsWatchCall) SyncToken(syncToken string) *EventsWatchCall {
  5937. c.urlParams_.Set("syncToken", syncToken)
  5938. return c
  5939. }
  5940. // TimeMax sets the optional parameter "timeMax": Upper bound
  5941. // (exclusive) for an event's start time to filter by. The default is
  5942. // not to filter by start time. Must be an RFC3339 timestamp with
  5943. // mandatory time zone offset, e.g., 2011-06-03T10:00:00-07:00,
  5944. // 2011-06-03T10:00:00Z. Milliseconds may be provided but will be
  5945. // ignored.
  5946. func (c *EventsWatchCall) TimeMax(timeMax string) *EventsWatchCall {
  5947. c.urlParams_.Set("timeMax", timeMax)
  5948. return c
  5949. }
  5950. // TimeMin sets the optional parameter "timeMin": Lower bound
  5951. // (inclusive) for an event's end time to filter by. The default is not
  5952. // to filter by end time. Must be an RFC3339 timestamp with mandatory
  5953. // time zone offset, e.g., 2011-06-03T10:00:00-07:00,
  5954. // 2011-06-03T10:00:00Z. Milliseconds may be provided but will be
  5955. // ignored.
  5956. func (c *EventsWatchCall) TimeMin(timeMin string) *EventsWatchCall {
  5957. c.urlParams_.Set("timeMin", timeMin)
  5958. return c
  5959. }
  5960. // TimeZone sets the optional parameter "timeZone": Time zone used in
  5961. // the response. The default is the time zone of the calendar.
  5962. func (c *EventsWatchCall) TimeZone(timeZone string) *EventsWatchCall {
  5963. c.urlParams_.Set("timeZone", timeZone)
  5964. return c
  5965. }
  5966. // UpdatedMin sets the optional parameter "updatedMin": Lower bound for
  5967. // an event's last modification time (as a RFC3339 timestamp) to filter
  5968. // by. When specified, entries deleted since this time will always be
  5969. // included regardless of showDeleted. The default is not to filter by
  5970. // last modification time.
  5971. func (c *EventsWatchCall) UpdatedMin(updatedMin string) *EventsWatchCall {
  5972. c.urlParams_.Set("updatedMin", updatedMin)
  5973. return c
  5974. }
  5975. // Fields allows partial responses to be retrieved. See
  5976. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5977. // for more information.
  5978. func (c *EventsWatchCall) Fields(s ...googleapi.Field) *EventsWatchCall {
  5979. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5980. return c
  5981. }
  5982. // Context sets the context to be used in this call's Do method. Any
  5983. // pending HTTP request will be aborted if the provided context is
  5984. // canceled.
  5985. func (c *EventsWatchCall) Context(ctx context.Context) *EventsWatchCall {
  5986. c.ctx_ = ctx
  5987. return c
  5988. }
  5989. func (c *EventsWatchCall) doRequest(alt string) (*http.Response, error) {
  5990. var body io.Reader = nil
  5991. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  5992. if err != nil {
  5993. return nil, err
  5994. }
  5995. ctype := "application/json"
  5996. c.urlParams_.Set("alt", alt)
  5997. urls := googleapi.ResolveRelative(c.s.BasePath, "calendars/{calendarId}/events/watch")
  5998. urls += "?" + c.urlParams_.Encode()
  5999. req, _ := http.NewRequest("POST", urls, body)
  6000. googleapi.Expand(req.URL, map[string]string{
  6001. "calendarId": c.calendarId,
  6002. })
  6003. req.Header.Set("Content-Type", ctype)
  6004. req.Header.Set("User-Agent", c.s.userAgent())
  6005. if c.ctx_ != nil {
  6006. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6007. }
  6008. return c.s.client.Do(req)
  6009. }
  6010. // Do executes the "calendar.events.watch" call.
  6011. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  6012. // code is an error. Response headers are in either
  6013. // *Channel.ServerResponse.Header or (if a response was returned at all)
  6014. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6015. // check whether the returned error was because http.StatusNotModified
  6016. // was returned.
  6017. func (c *EventsWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  6018. gensupport.SetOptions(c.urlParams_, opts...)
  6019. res, err := c.doRequest("json")
  6020. if res != nil && res.StatusCode == http.StatusNotModified {
  6021. if res.Body != nil {
  6022. res.Body.Close()
  6023. }
  6024. return nil, &googleapi.Error{
  6025. Code: res.StatusCode,
  6026. Header: res.Header,
  6027. }
  6028. }
  6029. if err != nil {
  6030. return nil, err
  6031. }
  6032. defer googleapi.CloseBody(res)
  6033. if err := googleapi.CheckResponse(res); err != nil {
  6034. return nil, err
  6035. }
  6036. ret := &Channel{
  6037. ServerResponse: googleapi.ServerResponse{
  6038. Header: res.Header,
  6039. HTTPStatusCode: res.StatusCode,
  6040. },
  6041. }
  6042. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6043. return nil, err
  6044. }
  6045. return ret, nil
  6046. // {
  6047. // "description": "Watch for changes to Events resources.",
  6048. // "httpMethod": "POST",
  6049. // "id": "calendar.events.watch",
  6050. // "parameterOrder": [
  6051. // "calendarId"
  6052. // ],
  6053. // "parameters": {
  6054. // "alwaysIncludeEmail": {
  6055. // "description": "Whether to always include a value in the email field for the organizer, creator and attendees, even if no real email is available (i.e. a generated, non-working value will be provided). The use of this option is discouraged and should only be used by clients which cannot handle the absence of an email address value in the mentioned places. Optional. The default is False.",
  6056. // "location": "query",
  6057. // "type": "boolean"
  6058. // },
  6059. // "calendarId": {
  6060. // "description": "Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the \"primary\" keyword.",
  6061. // "location": "path",
  6062. // "required": true,
  6063. // "type": "string"
  6064. // },
  6065. // "iCalUID": {
  6066. // "description": "Specifies event ID in the iCalendar format to be included in the response. Optional.",
  6067. // "location": "query",
  6068. // "type": "string"
  6069. // },
  6070. // "maxAttendees": {
  6071. // "description": "The maximum number of attendees to include in the response. If there are more than the specified number of attendees, only the participant is returned. Optional.",
  6072. // "format": "int32",
  6073. // "location": "query",
  6074. // "minimum": "1",
  6075. // "type": "integer"
  6076. // },
  6077. // "maxResults": {
  6078. // "description": "Maximum number of events returned on one result page. By default the value is 250 events. The page size can never be larger than 2500 events. Optional.",
  6079. // "format": "int32",
  6080. // "location": "query",
  6081. // "minimum": "1",
  6082. // "type": "integer"
  6083. // },
  6084. // "orderBy": {
  6085. // "description": "The order of the events returned in the result. Optional. The default is an unspecified, stable order.",
  6086. // "enum": [
  6087. // "startTime",
  6088. // "updated"
  6089. // ],
  6090. // "enumDescriptions": [
  6091. // "Order by the start date/time (ascending). This is only available when querying single events (i.e. the parameter singleEvents is True)",
  6092. // "Order by last modification time (ascending)."
  6093. // ],
  6094. // "location": "query",
  6095. // "type": "string"
  6096. // },
  6097. // "pageToken": {
  6098. // "description": "Token specifying which result page to return. Optional.",
  6099. // "location": "query",
  6100. // "type": "string"
  6101. // },
  6102. // "privateExtendedProperty": {
  6103. // "description": "Extended properties constraint specified as propertyName=value. Matches only private properties. This parameter might be repeated multiple times to return events that match all given constraints.",
  6104. // "location": "query",
  6105. // "repeated": true,
  6106. // "type": "string"
  6107. // },
  6108. // "q": {
  6109. // "description": "Free text search terms to find events that match these terms in any field, except for extended properties. Optional.",
  6110. // "location": "query",
  6111. // "type": "string"
  6112. // },
  6113. // "sharedExtendedProperty": {
  6114. // "description": "Extended properties constraint specified as propertyName=value. Matches only shared properties. This parameter might be repeated multiple times to return events that match all given constraints.",
  6115. // "location": "query",
  6116. // "repeated": true,
  6117. // "type": "string"
  6118. // },
  6119. // "showDeleted": {
  6120. // "description": "Whether to include deleted events (with status equals \"cancelled\") in the result. Cancelled instances of recurring events (but not the underlying recurring event) will still be included if showDeleted and singleEvents are both False. If showDeleted and singleEvents are both True, only single instances of deleted events (but not the underlying recurring events) are returned. Optional. The default is False.",
  6121. // "location": "query",
  6122. // "type": "boolean"
  6123. // },
  6124. // "showHiddenInvitations": {
  6125. // "description": "Whether to include hidden invitations in the result. Optional. The default is False.",
  6126. // "location": "query",
  6127. // "type": "boolean"
  6128. // },
  6129. // "singleEvents": {
  6130. // "description": "Whether to expand recurring events into instances and only return single one-off events and instances of recurring events, but not the underlying recurring events themselves. Optional. The default is False.",
  6131. // "location": "query",
  6132. // "type": "boolean"
  6133. // },
  6134. // "syncToken": {
  6135. // "description": "Token obtained from the nextSyncToken field returned on the last page of results from the previous list request. It makes the result of this list request contain only entries that have changed since then. All events deleted since the previous list request will always be in the result set and it is not allowed to set showDeleted to False.\nThere are several query parameters that cannot be specified together with nextSyncToken to ensure consistency of the client state.\n\nThese are: \n- iCalUID \n- orderBy \n- privateExtendedProperty \n- q \n- sharedExtendedProperty \n- timeMin \n- timeMax \n- updatedMin If the syncToken expires, the server will respond with a 410 GONE response code and the client should clear its storage and perform a full synchronization without any syncToken.\nLearn more about incremental synchronization.\nOptional. The default is to return all entries.",
  6136. // "location": "query",
  6137. // "type": "string"
  6138. // },
  6139. // "timeMax": {
  6140. // "description": "Upper bound (exclusive) for an event's start time to filter by. Optional. The default is not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset, e.g., 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but will be ignored.",
  6141. // "format": "date-time",
  6142. // "location": "query",
  6143. // "type": "string"
  6144. // },
  6145. // "timeMin": {
  6146. // "description": "Lower bound (inclusive) for an event's end time to filter by. Optional. The default is not to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, e.g., 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but will be ignored.",
  6147. // "format": "date-time",
  6148. // "location": "query",
  6149. // "type": "string"
  6150. // },
  6151. // "timeZone": {
  6152. // "description": "Time zone used in the response. Optional. The default is the time zone of the calendar.",
  6153. // "location": "query",
  6154. // "type": "string"
  6155. // },
  6156. // "updatedMin": {
  6157. // "description": "Lower bound for an event's last modification time (as a RFC3339 timestamp) to filter by. When specified, entries deleted since this time will always be included regardless of showDeleted. Optional. The default is not to filter by last modification time.",
  6158. // "format": "date-time",
  6159. // "location": "query",
  6160. // "type": "string"
  6161. // }
  6162. // },
  6163. // "path": "calendars/{calendarId}/events/watch",
  6164. // "request": {
  6165. // "$ref": "Channel",
  6166. // "parameterName": "resource"
  6167. // },
  6168. // "response": {
  6169. // "$ref": "Channel"
  6170. // },
  6171. // "scopes": [
  6172. // "https://www.googleapis.com/auth/calendar",
  6173. // "https://www.googleapis.com/auth/calendar.readonly"
  6174. // ],
  6175. // "supportsSubscription": true
  6176. // }
  6177. }
  6178. // method id "calendar.freebusy.query":
  6179. type FreebusyQueryCall struct {
  6180. s *Service
  6181. freebusyrequest *FreeBusyRequest
  6182. urlParams_ gensupport.URLParams
  6183. ctx_ context.Context
  6184. }
  6185. // Query: Returns free/busy information for a set of calendars.
  6186. func (r *FreebusyService) Query(freebusyrequest *FreeBusyRequest) *FreebusyQueryCall {
  6187. c := &FreebusyQueryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6188. c.freebusyrequest = freebusyrequest
  6189. return c
  6190. }
  6191. // Fields allows partial responses to be retrieved. See
  6192. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6193. // for more information.
  6194. func (c *FreebusyQueryCall) Fields(s ...googleapi.Field) *FreebusyQueryCall {
  6195. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6196. return c
  6197. }
  6198. // Context sets the context to be used in this call's Do method. Any
  6199. // pending HTTP request will be aborted if the provided context is
  6200. // canceled.
  6201. func (c *FreebusyQueryCall) Context(ctx context.Context) *FreebusyQueryCall {
  6202. c.ctx_ = ctx
  6203. return c
  6204. }
  6205. func (c *FreebusyQueryCall) doRequest(alt string) (*http.Response, error) {
  6206. var body io.Reader = nil
  6207. body, err := googleapi.WithoutDataWrapper.JSONReader(c.freebusyrequest)
  6208. if err != nil {
  6209. return nil, err
  6210. }
  6211. ctype := "application/json"
  6212. c.urlParams_.Set("alt", alt)
  6213. urls := googleapi.ResolveRelative(c.s.BasePath, "freeBusy")
  6214. urls += "?" + c.urlParams_.Encode()
  6215. req, _ := http.NewRequest("POST", urls, body)
  6216. googleapi.SetOpaque(req.URL)
  6217. req.Header.Set("Content-Type", ctype)
  6218. req.Header.Set("User-Agent", c.s.userAgent())
  6219. if c.ctx_ != nil {
  6220. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6221. }
  6222. return c.s.client.Do(req)
  6223. }
  6224. // Do executes the "calendar.freebusy.query" call.
  6225. // Exactly one of *FreeBusyResponse or error will be non-nil. Any
  6226. // non-2xx status code is an error. Response headers are in either
  6227. // *FreeBusyResponse.ServerResponse.Header or (if a response was
  6228. // returned at all) in error.(*googleapi.Error).Header. Use
  6229. // googleapi.IsNotModified to check whether the returned error was
  6230. // because http.StatusNotModified was returned.
  6231. func (c *FreebusyQueryCall) Do(opts ...googleapi.CallOption) (*FreeBusyResponse, error) {
  6232. gensupport.SetOptions(c.urlParams_, opts...)
  6233. res, err := c.doRequest("json")
  6234. if res != nil && res.StatusCode == http.StatusNotModified {
  6235. if res.Body != nil {
  6236. res.Body.Close()
  6237. }
  6238. return nil, &googleapi.Error{
  6239. Code: res.StatusCode,
  6240. Header: res.Header,
  6241. }
  6242. }
  6243. if err != nil {
  6244. return nil, err
  6245. }
  6246. defer googleapi.CloseBody(res)
  6247. if err := googleapi.CheckResponse(res); err != nil {
  6248. return nil, err
  6249. }
  6250. ret := &FreeBusyResponse{
  6251. ServerResponse: googleapi.ServerResponse{
  6252. Header: res.Header,
  6253. HTTPStatusCode: res.StatusCode,
  6254. },
  6255. }
  6256. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6257. return nil, err
  6258. }
  6259. return ret, nil
  6260. // {
  6261. // "description": "Returns free/busy information for a set of calendars.",
  6262. // "httpMethod": "POST",
  6263. // "id": "calendar.freebusy.query",
  6264. // "path": "freeBusy",
  6265. // "request": {
  6266. // "$ref": "FreeBusyRequest"
  6267. // },
  6268. // "response": {
  6269. // "$ref": "FreeBusyResponse"
  6270. // },
  6271. // "scopes": [
  6272. // "https://www.googleapis.com/auth/calendar",
  6273. // "https://www.googleapis.com/auth/calendar.readonly"
  6274. // ]
  6275. // }
  6276. }
  6277. // method id "calendar.settings.get":
  6278. type SettingsGetCall struct {
  6279. s *Service
  6280. setting string
  6281. urlParams_ gensupport.URLParams
  6282. ifNoneMatch_ string
  6283. ctx_ context.Context
  6284. }
  6285. // Get: Returns a single user setting.
  6286. func (r *SettingsService) Get(setting string) *SettingsGetCall {
  6287. c := &SettingsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6288. c.setting = setting
  6289. return c
  6290. }
  6291. // Fields allows partial responses to be retrieved. See
  6292. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6293. // for more information.
  6294. func (c *SettingsGetCall) Fields(s ...googleapi.Field) *SettingsGetCall {
  6295. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6296. return c
  6297. }
  6298. // IfNoneMatch sets the optional parameter which makes the operation
  6299. // fail if the object's ETag matches the given value. This is useful for
  6300. // getting updates only after the object has changed since the last
  6301. // request. Use googleapi.IsNotModified to check whether the response
  6302. // error from Do is the result of In-None-Match.
  6303. func (c *SettingsGetCall) IfNoneMatch(entityTag string) *SettingsGetCall {
  6304. c.ifNoneMatch_ = entityTag
  6305. return c
  6306. }
  6307. // Context sets the context to be used in this call's Do method. Any
  6308. // pending HTTP request will be aborted if the provided context is
  6309. // canceled.
  6310. func (c *SettingsGetCall) Context(ctx context.Context) *SettingsGetCall {
  6311. c.ctx_ = ctx
  6312. return c
  6313. }
  6314. func (c *SettingsGetCall) doRequest(alt string) (*http.Response, error) {
  6315. var body io.Reader = nil
  6316. c.urlParams_.Set("alt", alt)
  6317. urls := googleapi.ResolveRelative(c.s.BasePath, "users/me/settings/{setting}")
  6318. urls += "?" + c.urlParams_.Encode()
  6319. req, _ := http.NewRequest("GET", urls, body)
  6320. googleapi.Expand(req.URL, map[string]string{
  6321. "setting": c.setting,
  6322. })
  6323. req.Header.Set("User-Agent", c.s.userAgent())
  6324. if c.ifNoneMatch_ != "" {
  6325. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  6326. }
  6327. if c.ctx_ != nil {
  6328. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6329. }
  6330. return c.s.client.Do(req)
  6331. }
  6332. // Do executes the "calendar.settings.get" call.
  6333. // Exactly one of *Setting or error will be non-nil. Any non-2xx status
  6334. // code is an error. Response headers are in either
  6335. // *Setting.ServerResponse.Header or (if a response was returned at all)
  6336. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6337. // check whether the returned error was because http.StatusNotModified
  6338. // was returned.
  6339. func (c *SettingsGetCall) Do(opts ...googleapi.CallOption) (*Setting, error) {
  6340. gensupport.SetOptions(c.urlParams_, opts...)
  6341. res, err := c.doRequest("json")
  6342. if res != nil && res.StatusCode == http.StatusNotModified {
  6343. if res.Body != nil {
  6344. res.Body.Close()
  6345. }
  6346. return nil, &googleapi.Error{
  6347. Code: res.StatusCode,
  6348. Header: res.Header,
  6349. }
  6350. }
  6351. if err != nil {
  6352. return nil, err
  6353. }
  6354. defer googleapi.CloseBody(res)
  6355. if err := googleapi.CheckResponse(res); err != nil {
  6356. return nil, err
  6357. }
  6358. ret := &Setting{
  6359. ServerResponse: googleapi.ServerResponse{
  6360. Header: res.Header,
  6361. HTTPStatusCode: res.StatusCode,
  6362. },
  6363. }
  6364. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6365. return nil, err
  6366. }
  6367. return ret, nil
  6368. // {
  6369. // "description": "Returns a single user setting.",
  6370. // "httpMethod": "GET",
  6371. // "id": "calendar.settings.get",
  6372. // "parameterOrder": [
  6373. // "setting"
  6374. // ],
  6375. // "parameters": {
  6376. // "setting": {
  6377. // "description": "The id of the user setting.",
  6378. // "location": "path",
  6379. // "required": true,
  6380. // "type": "string"
  6381. // }
  6382. // },
  6383. // "path": "users/me/settings/{setting}",
  6384. // "response": {
  6385. // "$ref": "Setting"
  6386. // },
  6387. // "scopes": [
  6388. // "https://www.googleapis.com/auth/calendar",
  6389. // "https://www.googleapis.com/auth/calendar.readonly"
  6390. // ]
  6391. // }
  6392. }
  6393. // method id "calendar.settings.list":
  6394. type SettingsListCall struct {
  6395. s *Service
  6396. urlParams_ gensupport.URLParams
  6397. ifNoneMatch_ string
  6398. ctx_ context.Context
  6399. }
  6400. // List: Returns all user settings for the authenticated user.
  6401. func (r *SettingsService) List() *SettingsListCall {
  6402. c := &SettingsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6403. return c
  6404. }
  6405. // MaxResults sets the optional parameter "maxResults": Maximum number
  6406. // of entries returned on one result page. By default the value is 100
  6407. // entries. The page size can never be larger than 250 entries.
  6408. func (c *SettingsListCall) MaxResults(maxResults int64) *SettingsListCall {
  6409. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  6410. return c
  6411. }
  6412. // PageToken sets the optional parameter "pageToken": Token specifying
  6413. // which result page to return.
  6414. func (c *SettingsListCall) PageToken(pageToken string) *SettingsListCall {
  6415. c.urlParams_.Set("pageToken", pageToken)
  6416. return c
  6417. }
  6418. // SyncToken sets the optional parameter "syncToken": Token obtained
  6419. // from the nextSyncToken field returned on the last page of results
  6420. // from the previous list request. It makes the result of this list
  6421. // request contain only entries that have changed since then.
  6422. // If the syncToken expires, the server will respond with a 410 GONE
  6423. // response code and the client should clear its storage and perform a
  6424. // full synchronization without any syncToken.
  6425. // Learn more about incremental synchronization.
  6426. // The default is to return all entries.
  6427. func (c *SettingsListCall) SyncToken(syncToken string) *SettingsListCall {
  6428. c.urlParams_.Set("syncToken", syncToken)
  6429. return c
  6430. }
  6431. // Fields allows partial responses to be retrieved. See
  6432. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6433. // for more information.
  6434. func (c *SettingsListCall) Fields(s ...googleapi.Field) *SettingsListCall {
  6435. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6436. return c
  6437. }
  6438. // IfNoneMatch sets the optional parameter which makes the operation
  6439. // fail if the object's ETag matches the given value. This is useful for
  6440. // getting updates only after the object has changed since the last
  6441. // request. Use googleapi.IsNotModified to check whether the response
  6442. // error from Do is the result of In-None-Match.
  6443. func (c *SettingsListCall) IfNoneMatch(entityTag string) *SettingsListCall {
  6444. c.ifNoneMatch_ = entityTag
  6445. return c
  6446. }
  6447. // Context sets the context to be used in this call's Do method. Any
  6448. // pending HTTP request will be aborted if the provided context is
  6449. // canceled.
  6450. func (c *SettingsListCall) Context(ctx context.Context) *SettingsListCall {
  6451. c.ctx_ = ctx
  6452. return c
  6453. }
  6454. func (c *SettingsListCall) doRequest(alt string) (*http.Response, error) {
  6455. var body io.Reader = nil
  6456. c.urlParams_.Set("alt", alt)
  6457. urls := googleapi.ResolveRelative(c.s.BasePath, "users/me/settings")
  6458. urls += "?" + c.urlParams_.Encode()
  6459. req, _ := http.NewRequest("GET", urls, body)
  6460. googleapi.SetOpaque(req.URL)
  6461. req.Header.Set("User-Agent", c.s.userAgent())
  6462. if c.ifNoneMatch_ != "" {
  6463. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  6464. }
  6465. if c.ctx_ != nil {
  6466. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6467. }
  6468. return c.s.client.Do(req)
  6469. }
  6470. // Do executes the "calendar.settings.list" call.
  6471. // Exactly one of *Settings or error will be non-nil. Any non-2xx status
  6472. // code is an error. Response headers are in either
  6473. // *Settings.ServerResponse.Header or (if a response was returned at
  6474. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6475. // to check whether the returned error was because
  6476. // http.StatusNotModified was returned.
  6477. func (c *SettingsListCall) Do(opts ...googleapi.CallOption) (*Settings, error) {
  6478. gensupport.SetOptions(c.urlParams_, opts...)
  6479. res, err := c.doRequest("json")
  6480. if res != nil && res.StatusCode == http.StatusNotModified {
  6481. if res.Body != nil {
  6482. res.Body.Close()
  6483. }
  6484. return nil, &googleapi.Error{
  6485. Code: res.StatusCode,
  6486. Header: res.Header,
  6487. }
  6488. }
  6489. if err != nil {
  6490. return nil, err
  6491. }
  6492. defer googleapi.CloseBody(res)
  6493. if err := googleapi.CheckResponse(res); err != nil {
  6494. return nil, err
  6495. }
  6496. ret := &Settings{
  6497. ServerResponse: googleapi.ServerResponse{
  6498. Header: res.Header,
  6499. HTTPStatusCode: res.StatusCode,
  6500. },
  6501. }
  6502. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6503. return nil, err
  6504. }
  6505. return ret, nil
  6506. // {
  6507. // "description": "Returns all user settings for the authenticated user.",
  6508. // "httpMethod": "GET",
  6509. // "id": "calendar.settings.list",
  6510. // "parameters": {
  6511. // "maxResults": {
  6512. // "description": "Maximum number of entries returned on one result page. By default the value is 100 entries. The page size can never be larger than 250 entries. Optional.",
  6513. // "format": "int32",
  6514. // "location": "query",
  6515. // "minimum": "1",
  6516. // "type": "integer"
  6517. // },
  6518. // "pageToken": {
  6519. // "description": "Token specifying which result page to return. Optional.",
  6520. // "location": "query",
  6521. // "type": "string"
  6522. // },
  6523. // "syncToken": {
  6524. // "description": "Token obtained from the nextSyncToken field returned on the last page of results from the previous list request. It makes the result of this list request contain only entries that have changed since then.\nIf the syncToken expires, the server will respond with a 410 GONE response code and the client should clear its storage and perform a full synchronization without any syncToken.\nLearn more about incremental synchronization.\nOptional. The default is to return all entries.",
  6525. // "location": "query",
  6526. // "type": "string"
  6527. // }
  6528. // },
  6529. // "path": "users/me/settings",
  6530. // "response": {
  6531. // "$ref": "Settings"
  6532. // },
  6533. // "scopes": [
  6534. // "https://www.googleapis.com/auth/calendar",
  6535. // "https://www.googleapis.com/auth/calendar.readonly"
  6536. // ],
  6537. // "supportsSubscription": true
  6538. // }
  6539. }
  6540. // Pages invokes f for each page of results.
  6541. // A non-nil error returned from f will halt the iteration.
  6542. // The provided context supersedes any context provided to the Context method.
  6543. func (c *SettingsListCall) Pages(ctx context.Context, f func(*Settings) error) error {
  6544. c.ctx_ = ctx
  6545. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6546. for {
  6547. x, err := c.Do()
  6548. if err != nil {
  6549. return err
  6550. }
  6551. if err := f(x); err != nil {
  6552. return err
  6553. }
  6554. if x.NextPageToken == "" {
  6555. return nil
  6556. }
  6557. c.PageToken(x.NextPageToken)
  6558. }
  6559. }
  6560. // method id "calendar.settings.watch":
  6561. type SettingsWatchCall struct {
  6562. s *Service
  6563. channel *Channel
  6564. urlParams_ gensupport.URLParams
  6565. ctx_ context.Context
  6566. }
  6567. // Watch: Watch for changes to Settings resources.
  6568. func (r *SettingsService) Watch(channel *Channel) *SettingsWatchCall {
  6569. c := &SettingsWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6570. c.channel = channel
  6571. return c
  6572. }
  6573. // MaxResults sets the optional parameter "maxResults": Maximum number
  6574. // of entries returned on one result page. By default the value is 100
  6575. // entries. The page size can never be larger than 250 entries.
  6576. func (c *SettingsWatchCall) MaxResults(maxResults int64) *SettingsWatchCall {
  6577. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  6578. return c
  6579. }
  6580. // PageToken sets the optional parameter "pageToken": Token specifying
  6581. // which result page to return.
  6582. func (c *SettingsWatchCall) PageToken(pageToken string) *SettingsWatchCall {
  6583. c.urlParams_.Set("pageToken", pageToken)
  6584. return c
  6585. }
  6586. // SyncToken sets the optional parameter "syncToken": Token obtained
  6587. // from the nextSyncToken field returned on the last page of results
  6588. // from the previous list request. It makes the result of this list
  6589. // request contain only entries that have changed since then.
  6590. // If the syncToken expires, the server will respond with a 410 GONE
  6591. // response code and the client should clear its storage and perform a
  6592. // full synchronization without any syncToken.
  6593. // Learn more about incremental synchronization.
  6594. // The default is to return all entries.
  6595. func (c *SettingsWatchCall) SyncToken(syncToken string) *SettingsWatchCall {
  6596. c.urlParams_.Set("syncToken", syncToken)
  6597. return c
  6598. }
  6599. // Fields allows partial responses to be retrieved. See
  6600. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6601. // for more information.
  6602. func (c *SettingsWatchCall) Fields(s ...googleapi.Field) *SettingsWatchCall {
  6603. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6604. return c
  6605. }
  6606. // Context sets the context to be used in this call's Do method. Any
  6607. // pending HTTP request will be aborted if the provided context is
  6608. // canceled.
  6609. func (c *SettingsWatchCall) Context(ctx context.Context) *SettingsWatchCall {
  6610. c.ctx_ = ctx
  6611. return c
  6612. }
  6613. func (c *SettingsWatchCall) doRequest(alt string) (*http.Response, error) {
  6614. var body io.Reader = nil
  6615. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  6616. if err != nil {
  6617. return nil, err
  6618. }
  6619. ctype := "application/json"
  6620. c.urlParams_.Set("alt", alt)
  6621. urls := googleapi.ResolveRelative(c.s.BasePath, "users/me/settings/watch")
  6622. urls += "?" + c.urlParams_.Encode()
  6623. req, _ := http.NewRequest("POST", urls, body)
  6624. googleapi.SetOpaque(req.URL)
  6625. req.Header.Set("Content-Type", ctype)
  6626. req.Header.Set("User-Agent", c.s.userAgent())
  6627. if c.ctx_ != nil {
  6628. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6629. }
  6630. return c.s.client.Do(req)
  6631. }
  6632. // Do executes the "calendar.settings.watch" call.
  6633. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  6634. // code is an error. Response headers are in either
  6635. // *Channel.ServerResponse.Header or (if a response was returned at all)
  6636. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6637. // check whether the returned error was because http.StatusNotModified
  6638. // was returned.
  6639. func (c *SettingsWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  6640. gensupport.SetOptions(c.urlParams_, opts...)
  6641. res, err := c.doRequest("json")
  6642. if res != nil && res.StatusCode == http.StatusNotModified {
  6643. if res.Body != nil {
  6644. res.Body.Close()
  6645. }
  6646. return nil, &googleapi.Error{
  6647. Code: res.StatusCode,
  6648. Header: res.Header,
  6649. }
  6650. }
  6651. if err != nil {
  6652. return nil, err
  6653. }
  6654. defer googleapi.CloseBody(res)
  6655. if err := googleapi.CheckResponse(res); err != nil {
  6656. return nil, err
  6657. }
  6658. ret := &Channel{
  6659. ServerResponse: googleapi.ServerResponse{
  6660. Header: res.Header,
  6661. HTTPStatusCode: res.StatusCode,
  6662. },
  6663. }
  6664. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6665. return nil, err
  6666. }
  6667. return ret, nil
  6668. // {
  6669. // "description": "Watch for changes to Settings resources.",
  6670. // "httpMethod": "POST",
  6671. // "id": "calendar.settings.watch",
  6672. // "parameters": {
  6673. // "maxResults": {
  6674. // "description": "Maximum number of entries returned on one result page. By default the value is 100 entries. The page size can never be larger than 250 entries. Optional.",
  6675. // "format": "int32",
  6676. // "location": "query",
  6677. // "minimum": "1",
  6678. // "type": "integer"
  6679. // },
  6680. // "pageToken": {
  6681. // "description": "Token specifying which result page to return. Optional.",
  6682. // "location": "query",
  6683. // "type": "string"
  6684. // },
  6685. // "syncToken": {
  6686. // "description": "Token obtained from the nextSyncToken field returned on the last page of results from the previous list request. It makes the result of this list request contain only entries that have changed since then.\nIf the syncToken expires, the server will respond with a 410 GONE response code and the client should clear its storage and perform a full synchronization without any syncToken.\nLearn more about incremental synchronization.\nOptional. The default is to return all entries.",
  6687. // "location": "query",
  6688. // "type": "string"
  6689. // }
  6690. // },
  6691. // "path": "users/me/settings/watch",
  6692. // "request": {
  6693. // "$ref": "Channel",
  6694. // "parameterName": "resource"
  6695. // },
  6696. // "response": {
  6697. // "$ref": "Channel"
  6698. // },
  6699. // "scopes": [
  6700. // "https://www.googleapis.com/auth/calendar",
  6701. // "https://www.googleapis.com/auth/calendar.readonly"
  6702. // ],
  6703. // "supportsSubscription": true
  6704. // }
  6705. }