drive-gen.go 206 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423
  1. // Package drive provides access to the Drive API.
  2. //
  3. // See https://developers.google.com/drive/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/drive/v3"
  8. // ...
  9. // driveService, err := drive.New(oauthHttpClient)
  10. package drive // import "google.golang.org/api/drive/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 = "drive:v3"
  41. const apiName = "drive"
  42. const apiVersion = "v3"
  43. const basePath = "https://www.googleapis.com/drive/v3/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage the files in your Google Drive
  47. DriveScope = "https://www.googleapis.com/auth/drive"
  48. // View and manage its own configuration data in your Google Drive
  49. DriveAppdataScope = "https://www.googleapis.com/auth/drive.appdata"
  50. // View and manage Google Drive files and folders that you have opened
  51. // or created with this app
  52. DriveFileScope = "https://www.googleapis.com/auth/drive.file"
  53. // View and manage metadata of files in your Google Drive
  54. DriveMetadataScope = "https://www.googleapis.com/auth/drive.metadata"
  55. // View metadata for files in your Google Drive
  56. DriveMetadataReadonlyScope = "https://www.googleapis.com/auth/drive.metadata.readonly"
  57. // View the photos, videos and albums in your Google Photos
  58. DrivePhotosReadonlyScope = "https://www.googleapis.com/auth/drive.photos.readonly"
  59. // View the files in your Google Drive
  60. DriveReadonlyScope = "https://www.googleapis.com/auth/drive.readonly"
  61. // Modify your Google Apps Script scripts' behavior
  62. DriveScriptsScope = "https://www.googleapis.com/auth/drive.scripts"
  63. )
  64. func New(client *http.Client) (*Service, error) {
  65. if client == nil {
  66. return nil, errors.New("client is nil")
  67. }
  68. s := &Service{client: client, BasePath: basePath}
  69. s.About = NewAboutService(s)
  70. s.Changes = NewChangesService(s)
  71. s.Channels = NewChannelsService(s)
  72. s.Comments = NewCommentsService(s)
  73. s.Files = NewFilesService(s)
  74. s.Permissions = NewPermissionsService(s)
  75. s.Replies = NewRepliesService(s)
  76. s.Revisions = NewRevisionsService(s)
  77. return s, nil
  78. }
  79. type Service struct {
  80. client *http.Client
  81. BasePath string // API endpoint base URL
  82. UserAgent string // optional additional User-Agent fragment
  83. About *AboutService
  84. Changes *ChangesService
  85. Channels *ChannelsService
  86. Comments *CommentsService
  87. Files *FilesService
  88. Permissions *PermissionsService
  89. Replies *RepliesService
  90. Revisions *RevisionsService
  91. }
  92. func (s *Service) userAgent() string {
  93. if s.UserAgent == "" {
  94. return googleapi.UserAgent
  95. }
  96. return googleapi.UserAgent + " " + s.UserAgent
  97. }
  98. func NewAboutService(s *Service) *AboutService {
  99. rs := &AboutService{s: s}
  100. return rs
  101. }
  102. type AboutService struct {
  103. s *Service
  104. }
  105. func NewChangesService(s *Service) *ChangesService {
  106. rs := &ChangesService{s: s}
  107. return rs
  108. }
  109. type ChangesService struct {
  110. s *Service
  111. }
  112. func NewChannelsService(s *Service) *ChannelsService {
  113. rs := &ChannelsService{s: s}
  114. return rs
  115. }
  116. type ChannelsService struct {
  117. s *Service
  118. }
  119. func NewCommentsService(s *Service) *CommentsService {
  120. rs := &CommentsService{s: s}
  121. return rs
  122. }
  123. type CommentsService struct {
  124. s *Service
  125. }
  126. func NewFilesService(s *Service) *FilesService {
  127. rs := &FilesService{s: s}
  128. return rs
  129. }
  130. type FilesService struct {
  131. s *Service
  132. }
  133. func NewPermissionsService(s *Service) *PermissionsService {
  134. rs := &PermissionsService{s: s}
  135. return rs
  136. }
  137. type PermissionsService struct {
  138. s *Service
  139. }
  140. func NewRepliesService(s *Service) *RepliesService {
  141. rs := &RepliesService{s: s}
  142. return rs
  143. }
  144. type RepliesService struct {
  145. s *Service
  146. }
  147. func NewRevisionsService(s *Service) *RevisionsService {
  148. rs := &RevisionsService{s: s}
  149. return rs
  150. }
  151. type RevisionsService struct {
  152. s *Service
  153. }
  154. // About: Information about the user, the user's Drive, and system
  155. // capabilities.
  156. type About struct {
  157. // AppInstalled: Whether the user has installed the requesting app.
  158. AppInstalled bool `json:"appInstalled,omitempty"`
  159. // ExportFormats: A map of source MIME type to possible targets for all
  160. // supported exports.
  161. ExportFormats map[string][]string `json:"exportFormats,omitempty"`
  162. // FolderColorPalette: The currently supported folder colors as RGB hex
  163. // strings.
  164. FolderColorPalette []string `json:"folderColorPalette,omitempty"`
  165. // ImportFormats: A map of source MIME type to possible targets for all
  166. // supported imports.
  167. ImportFormats map[string][]string `json:"importFormats,omitempty"`
  168. // Kind: This is always drive#about.
  169. Kind string `json:"kind,omitempty"`
  170. // MaxImportSizes: A map of maximum import sizes by MIME type, in bytes.
  171. MaxImportSizes map[string]string `json:"maxImportSizes,omitempty"`
  172. // MaxUploadSize: The maximum upload size in bytes.
  173. MaxUploadSize int64 `json:"maxUploadSize,omitempty,string"`
  174. // StorageQuota: The user's storage quota limits and usage. All fields
  175. // are measured in bytes.
  176. StorageQuota *AboutStorageQuota `json:"storageQuota,omitempty"`
  177. // User: The authenticated user.
  178. User *User `json:"user,omitempty"`
  179. // ServerResponse contains the HTTP response code and headers from the
  180. // server.
  181. googleapi.ServerResponse `json:"-"`
  182. // ForceSendFields is a list of field names (e.g. "AppInstalled") to
  183. // unconditionally include in API requests. By default, fields with
  184. // empty values are omitted from API requests. However, any non-pointer,
  185. // non-interface field appearing in ForceSendFields will be sent to the
  186. // server regardless of whether the field is empty or not. This may be
  187. // used to include empty fields in Patch requests.
  188. ForceSendFields []string `json:"-"`
  189. }
  190. func (s *About) MarshalJSON() ([]byte, error) {
  191. type noMethod About
  192. raw := noMethod(*s)
  193. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  194. }
  195. // AboutStorageQuota: The user's storage quota limits and usage. All
  196. // fields are measured in bytes.
  197. type AboutStorageQuota struct {
  198. // Limit: The usage limit, if applicable. This will not be present if
  199. // the user has unlimited storage.
  200. Limit int64 `json:"limit,omitempty,string"`
  201. // Usage: The total usage across all services.
  202. Usage int64 `json:"usage,omitempty,string"`
  203. // UsageInDrive: The usage by all files in Google Drive.
  204. UsageInDrive int64 `json:"usageInDrive,omitempty,string"`
  205. // UsageInDriveTrash: The usage by trashed files in Google Drive.
  206. UsageInDriveTrash int64 `json:"usageInDriveTrash,omitempty,string"`
  207. // ForceSendFields is a list of field names (e.g. "Limit") to
  208. // unconditionally include in API requests. By default, fields with
  209. // empty values are omitted from API requests. However, any non-pointer,
  210. // non-interface field appearing in ForceSendFields will be sent to the
  211. // server regardless of whether the field is empty or not. This may be
  212. // used to include empty fields in Patch requests.
  213. ForceSendFields []string `json:"-"`
  214. }
  215. func (s *AboutStorageQuota) MarshalJSON() ([]byte, error) {
  216. type noMethod AboutStorageQuota
  217. raw := noMethod(*s)
  218. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  219. }
  220. // Change: A change to a file.
  221. type Change struct {
  222. // File: The updated state of the file. Present if the file has not been
  223. // removed.
  224. File *File `json:"file,omitempty"`
  225. // FileId: The ID of the file which has changed.
  226. FileId string `json:"fileId,omitempty"`
  227. // Kind: This is always drive#change.
  228. Kind string `json:"kind,omitempty"`
  229. // Removed: Whether the file has been removed from the view of the
  230. // changes list, for example by deletion or lost access.
  231. Removed bool `json:"removed,omitempty"`
  232. // Time: The time of this change (RFC 3339 date-time).
  233. Time string `json:"time,omitempty"`
  234. // ForceSendFields is a list of field names (e.g. "File") to
  235. // unconditionally include in API requests. By default, fields with
  236. // empty values are omitted from API requests. However, any non-pointer,
  237. // non-interface field appearing in ForceSendFields will be sent to the
  238. // server regardless of whether the field is empty or not. This may be
  239. // used to include empty fields in Patch requests.
  240. ForceSendFields []string `json:"-"`
  241. }
  242. func (s *Change) MarshalJSON() ([]byte, error) {
  243. type noMethod Change
  244. raw := noMethod(*s)
  245. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  246. }
  247. // ChangeList: A list of changes for a user.
  248. type ChangeList struct {
  249. // Changes: The page of changes.
  250. Changes []*Change `json:"changes,omitempty"`
  251. // Kind: This is always drive#changeList.
  252. Kind string `json:"kind,omitempty"`
  253. // NewStartPageToken: The starting page token for future changes. This
  254. // will be present only if the end of the current changes list has been
  255. // reached.
  256. NewStartPageToken string `json:"newStartPageToken,omitempty"`
  257. // NextPageToken: The page token for the next page of changes. This will
  258. // be absent if the end of the current changes list has been reached.
  259. NextPageToken string `json:"nextPageToken,omitempty"`
  260. // ServerResponse contains the HTTP response code and headers from the
  261. // server.
  262. googleapi.ServerResponse `json:"-"`
  263. // ForceSendFields is a list of field names (e.g. "Changes") to
  264. // unconditionally include in API requests. By default, fields with
  265. // empty values are omitted from API requests. However, any non-pointer,
  266. // non-interface field appearing in ForceSendFields will be sent to the
  267. // server regardless of whether the field is empty or not. This may be
  268. // used to include empty fields in Patch requests.
  269. ForceSendFields []string `json:"-"`
  270. }
  271. func (s *ChangeList) MarshalJSON() ([]byte, error) {
  272. type noMethod ChangeList
  273. raw := noMethod(*s)
  274. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  275. }
  276. // Channel: An notification channel used to watch for resource changes.
  277. type Channel struct {
  278. // Address: The address where notifications are delivered for this
  279. // channel.
  280. Address string `json:"address,omitempty"`
  281. // Expiration: Date and time of notification channel expiration,
  282. // expressed as a Unix timestamp, in milliseconds. Optional.
  283. Expiration int64 `json:"expiration,omitempty,string"`
  284. // Id: A UUID or similar unique string that identifies this channel.
  285. Id string `json:"id,omitempty"`
  286. // Kind: Identifies this as a notification channel used to watch for
  287. // changes to a resource. Value: the fixed string "api#channel".
  288. Kind string `json:"kind,omitempty"`
  289. // Params: Additional parameters controlling delivery channel behavior.
  290. // Optional.
  291. Params map[string]string `json:"params,omitempty"`
  292. // Payload: A Boolean value to indicate whether payload is wanted.
  293. // Optional.
  294. Payload bool `json:"payload,omitempty"`
  295. // ResourceId: An opaque ID that identifies the resource being watched
  296. // on this channel. Stable across different API versions.
  297. ResourceId string `json:"resourceId,omitempty"`
  298. // ResourceUri: A version-specific identifier for the watched resource.
  299. ResourceUri string `json:"resourceUri,omitempty"`
  300. // Token: An arbitrary string delivered to the target address with each
  301. // notification delivered over this channel. Optional.
  302. Token string `json:"token,omitempty"`
  303. // Type: The type of delivery mechanism used for this channel.
  304. Type string `json:"type,omitempty"`
  305. // ServerResponse contains the HTTP response code and headers from the
  306. // server.
  307. googleapi.ServerResponse `json:"-"`
  308. // ForceSendFields is a list of field names (e.g. "Address") to
  309. // unconditionally include in API requests. By default, fields with
  310. // empty values are omitted from API requests. However, any non-pointer,
  311. // non-interface field appearing in ForceSendFields will be sent to the
  312. // server regardless of whether the field is empty or not. This may be
  313. // used to include empty fields in Patch requests.
  314. ForceSendFields []string `json:"-"`
  315. }
  316. func (s *Channel) MarshalJSON() ([]byte, error) {
  317. type noMethod Channel
  318. raw := noMethod(*s)
  319. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  320. }
  321. // Comment: A comment on a file.
  322. type Comment struct {
  323. // Anchor: A region of the document represented as a JSON string. See
  324. // anchor documentation for details on how to define and interpret
  325. // anchor properties.
  326. Anchor string `json:"anchor,omitempty"`
  327. // Author: The user who created the comment.
  328. Author *User `json:"author,omitempty"`
  329. // Content: The plain text content of the comment. This field is used
  330. // for setting the content, while htmlContent should be displayed.
  331. Content string `json:"content,omitempty"`
  332. // CreatedTime: The time at which the comment was created (RFC 3339
  333. // date-time).
  334. CreatedTime string `json:"createdTime,omitempty"`
  335. // Deleted: Whether the comment has been deleted. A deleted comment has
  336. // no content.
  337. Deleted bool `json:"deleted,omitempty"`
  338. // HtmlContent: The content of the comment with HTML formatting.
  339. HtmlContent string `json:"htmlContent,omitempty"`
  340. // Id: The ID of the comment.
  341. Id string `json:"id,omitempty"`
  342. // Kind: This is always drive#comment.
  343. Kind string `json:"kind,omitempty"`
  344. // ModifiedTime: The last time the comment or any of its replies was
  345. // modified (RFC 3339 date-time).
  346. ModifiedTime string `json:"modifiedTime,omitempty"`
  347. // QuotedFileContent: The file content to which the comment refers,
  348. // typically within the anchor region. For a text file, for example,
  349. // this would be the text at the location of the comment.
  350. QuotedFileContent *CommentQuotedFileContent `json:"quotedFileContent,omitempty"`
  351. // Replies: The full list of replies to the comment in chronological
  352. // order.
  353. Replies []*Reply `json:"replies,omitempty"`
  354. // Resolved: Whether the comment has been resolved by one of its
  355. // replies.
  356. Resolved bool `json:"resolved,omitempty"`
  357. // ServerResponse contains the HTTP response code and headers from the
  358. // server.
  359. googleapi.ServerResponse `json:"-"`
  360. // ForceSendFields is a list of field names (e.g. "Anchor") to
  361. // unconditionally include in API requests. By default, fields with
  362. // empty values are omitted from API requests. However, any non-pointer,
  363. // non-interface field appearing in ForceSendFields will be sent to the
  364. // server regardless of whether the field is empty or not. This may be
  365. // used to include empty fields in Patch requests.
  366. ForceSendFields []string `json:"-"`
  367. }
  368. func (s *Comment) MarshalJSON() ([]byte, error) {
  369. type noMethod Comment
  370. raw := noMethod(*s)
  371. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  372. }
  373. // CommentQuotedFileContent: The file content to which the comment
  374. // refers, typically within the anchor region. For a text file, for
  375. // example, this would be the text at the location of the comment.
  376. type CommentQuotedFileContent struct {
  377. // MimeType: The MIME type of the quoted content.
  378. MimeType string `json:"mimeType,omitempty"`
  379. // Value: The quoted content itself. This is interpreted as plain text
  380. // if set through the API.
  381. Value string `json:"value,omitempty"`
  382. // ForceSendFields is a list of field names (e.g. "MimeType") to
  383. // unconditionally include in API requests. By default, fields with
  384. // empty values are omitted from API requests. However, any non-pointer,
  385. // non-interface field appearing in ForceSendFields will be sent to the
  386. // server regardless of whether the field is empty or not. This may be
  387. // used to include empty fields in Patch requests.
  388. ForceSendFields []string `json:"-"`
  389. }
  390. func (s *CommentQuotedFileContent) MarshalJSON() ([]byte, error) {
  391. type noMethod CommentQuotedFileContent
  392. raw := noMethod(*s)
  393. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  394. }
  395. // CommentList: A list of comments on a file.
  396. type CommentList struct {
  397. // Comments: The page of comments.
  398. Comments []*Comment `json:"comments,omitempty"`
  399. // Kind: This is always drive#commentList.
  400. Kind string `json:"kind,omitempty"`
  401. // NextPageToken: The page token for the next page of comments. This
  402. // will be absent if the end of the comments list has been reached.
  403. NextPageToken string `json:"nextPageToken,omitempty"`
  404. // ServerResponse contains the HTTP response code and headers from the
  405. // server.
  406. googleapi.ServerResponse `json:"-"`
  407. // ForceSendFields is a list of field names (e.g. "Comments") to
  408. // unconditionally include in API requests. By default, fields with
  409. // empty values are omitted from API requests. However, any non-pointer,
  410. // non-interface field appearing in ForceSendFields will be sent to the
  411. // server regardless of whether the field is empty or not. This may be
  412. // used to include empty fields in Patch requests.
  413. ForceSendFields []string `json:"-"`
  414. }
  415. func (s *CommentList) MarshalJSON() ([]byte, error) {
  416. type noMethod CommentList
  417. raw := noMethod(*s)
  418. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  419. }
  420. // File: The metadata for a file.
  421. type File struct {
  422. // AppProperties: A collection of arbitrary key-value pairs which are
  423. // private to the requesting app.
  424. // Entries with null values are cleared in update and copy requests.
  425. AppProperties map[string]string `json:"appProperties,omitempty"`
  426. // Capabilities: Capabilities the current user has on the file.
  427. Capabilities *FileCapabilities `json:"capabilities,omitempty"`
  428. // ContentHints: Additional information about the content of the file.
  429. // These fields are never populated in responses.
  430. ContentHints *FileContentHints `json:"contentHints,omitempty"`
  431. // CreatedTime: The time at which the file was created (RFC 3339
  432. // date-time).
  433. CreatedTime string `json:"createdTime,omitempty"`
  434. // Description: A short description of the file.
  435. Description string `json:"description,omitempty"`
  436. // ExplicitlyTrashed: Whether the file has been explicitly trashed, as
  437. // opposed to recursively trashed from a parent folder.
  438. ExplicitlyTrashed bool `json:"explicitlyTrashed,omitempty"`
  439. // FileExtension: The final component of fullFileExtension. This is only
  440. // available for files with binary content in Drive.
  441. FileExtension string `json:"fileExtension,omitempty"`
  442. // FolderColorRgb: The color for a folder as an RGB hex string. The
  443. // supported colors are published in the folderColorPalette field of the
  444. // About resource.
  445. // If an unsupported color is specified, the closest color in the
  446. // palette will be used instead.
  447. FolderColorRgb string `json:"folderColorRgb,omitempty"`
  448. // FullFileExtension: The full file extension extracted from the name
  449. // field. May contain multiple concatenated extensions, such as
  450. // "tar.gz". This is only available for files with binary content in
  451. // Drive.
  452. // This is automatically updated when the name field changes, however it
  453. // is not cleared if the new name does not contain a valid extension.
  454. FullFileExtension string `json:"fullFileExtension,omitempty"`
  455. // HeadRevisionId: The ID of the file's head revision. This is currently
  456. // only available for files with binary content in Drive.
  457. HeadRevisionId string `json:"headRevisionId,omitempty"`
  458. // IconLink: A static, unauthenticated link to the file's icon.
  459. IconLink string `json:"iconLink,omitempty"`
  460. // Id: The ID of the file.
  461. Id string `json:"id,omitempty"`
  462. // ImageMediaMetadata: Additional metadata about image media, if
  463. // available.
  464. ImageMediaMetadata *FileImageMediaMetadata `json:"imageMediaMetadata,omitempty"`
  465. // Kind: This is always drive#file.
  466. Kind string `json:"kind,omitempty"`
  467. // LastModifyingUser: The last user to modify the file.
  468. LastModifyingUser *User `json:"lastModifyingUser,omitempty"`
  469. // Md5Checksum: The MD5 checksum for the content of the file. This is
  470. // only applicable to files with binary content in Drive.
  471. Md5Checksum string `json:"md5Checksum,omitempty"`
  472. // MimeType: The MIME type of the file.
  473. // Drive will attempt to automatically detect an appropriate value from
  474. // uploaded content if no value is provided. The value cannot be changed
  475. // unless a new revision is uploaded.
  476. // If a file is created with a Google Doc MIME type, the uploaded
  477. // content will be imported if possible. The supported import formats
  478. // are published in the About resource.
  479. MimeType string `json:"mimeType,omitempty"`
  480. // ModifiedByMeTime: The last time the file was modified by the user
  481. // (RFC 3339 date-time).
  482. ModifiedByMeTime string `json:"modifiedByMeTime,omitempty"`
  483. // ModifiedTime: The last time the file was modified by anyone (RFC 3339
  484. // date-time).
  485. // Note that setting modifiedTime will also update modifiedByMeTime for
  486. // the user.
  487. ModifiedTime string `json:"modifiedTime,omitempty"`
  488. // Name: The name of the file. This is not necessarily unique within a
  489. // folder.
  490. Name string `json:"name,omitempty"`
  491. // OriginalFilename: The original filename of the uploaded content if
  492. // available, or else the original value of the name field. This is only
  493. // available for files with binary content in Drive.
  494. OriginalFilename string `json:"originalFilename,omitempty"`
  495. // OwnedByMe: Whether the user owns the file.
  496. OwnedByMe bool `json:"ownedByMe,omitempty"`
  497. // Owners: The owners of the file. Currently, only certain legacy files
  498. // may have more than one owner.
  499. Owners []*User `json:"owners,omitempty"`
  500. // Parents: The IDs of the parent folders which contain the file.
  501. // If not specified as part of a create request, the file will be placed
  502. // directly in the My Drive folder. Update requests must use the
  503. // addParents and removeParents parameters to modify the values.
  504. Parents []string `json:"parents,omitempty"`
  505. // Permissions: The full list of permissions for the file. This is only
  506. // available if the requesting user can share the file.
  507. Permissions []*Permission `json:"permissions,omitempty"`
  508. // Properties: A collection of arbitrary key-value pairs which are
  509. // visible to all apps.
  510. // Entries with null values are cleared in update and copy requests.
  511. Properties map[string]string `json:"properties,omitempty"`
  512. // QuotaBytesUsed: The number of storage quota bytes used by the file.
  513. // This includes the head revision as well as previous revisions with
  514. // keepForever enabled.
  515. QuotaBytesUsed int64 `json:"quotaBytesUsed,omitempty,string"`
  516. // Shared: Whether the file has been shared.
  517. Shared bool `json:"shared,omitempty"`
  518. // SharedWithMeTime: The time at which the file was shared with the
  519. // user, if applicable (RFC 3339 date-time).
  520. SharedWithMeTime string `json:"sharedWithMeTime,omitempty"`
  521. // SharingUser: The user who shared the file with the requesting user,
  522. // if applicable.
  523. SharingUser *User `json:"sharingUser,omitempty"`
  524. // Size: The size of the file's content in bytes. This is only
  525. // applicable to files with binary content in Drive.
  526. Size int64 `json:"size,omitempty,string"`
  527. // Spaces: The list of spaces which contain the file. The currently
  528. // supported values are 'drive', 'appDataFolder' and 'photos'.
  529. Spaces []string `json:"spaces,omitempty"`
  530. // Starred: Whether the user has starred the file.
  531. Starred bool `json:"starred,omitempty"`
  532. // ThumbnailLink: A short-lived link to the file's thumbnail, if
  533. // available. Typically lasts on the order of hours.
  534. ThumbnailLink string `json:"thumbnailLink,omitempty"`
  535. // Trashed: Whether the file has been trashed, either explicitly or from
  536. // a trashed parent folder. Only the owner may trash a file, and other
  537. // users cannot see files in the owner's trash.
  538. Trashed bool `json:"trashed,omitempty"`
  539. // Version: A monotonically increasing version number for the file. This
  540. // reflects every change made to the file on the server, even those not
  541. // visible to the user.
  542. Version int64 `json:"version,omitempty,string"`
  543. // VideoMediaMetadata: Additional metadata about video media. This may
  544. // not be available immediately upon upload.
  545. VideoMediaMetadata *FileVideoMediaMetadata `json:"videoMediaMetadata,omitempty"`
  546. // ViewedByMe: Whether the file has been viewed by this user.
  547. ViewedByMe bool `json:"viewedByMe,omitempty"`
  548. // ViewedByMeTime: The last time the file was viewed by the user (RFC
  549. // 3339 date-time).
  550. ViewedByMeTime string `json:"viewedByMeTime,omitempty"`
  551. // ViewersCanCopyContent: Whether users with only reader or commenter
  552. // permission can copy the file's content. This affects copy, download,
  553. // and print operations.
  554. ViewersCanCopyContent bool `json:"viewersCanCopyContent,omitempty"`
  555. // WebContentLink: A link for downloading the content of the file in a
  556. // browser. This is only available for files with binary content in
  557. // Drive.
  558. WebContentLink string `json:"webContentLink,omitempty"`
  559. // WebViewLink: A link for opening the file in a relevant Google editor
  560. // or viewer in a browser.
  561. WebViewLink string `json:"webViewLink,omitempty"`
  562. // WritersCanShare: Whether users with only writer permission can modify
  563. // the file's permissions.
  564. WritersCanShare bool `json:"writersCanShare,omitempty"`
  565. // ServerResponse contains the HTTP response code and headers from the
  566. // server.
  567. googleapi.ServerResponse `json:"-"`
  568. // ForceSendFields is a list of field names (e.g. "AppProperties") to
  569. // unconditionally include in API requests. By default, fields with
  570. // empty values are omitted from API requests. However, any non-pointer,
  571. // non-interface field appearing in ForceSendFields will be sent to the
  572. // server regardless of whether the field is empty or not. This may be
  573. // used to include empty fields in Patch requests.
  574. ForceSendFields []string `json:"-"`
  575. }
  576. func (s *File) MarshalJSON() ([]byte, error) {
  577. type noMethod File
  578. raw := noMethod(*s)
  579. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  580. }
  581. // FileCapabilities: Capabilities the current user has on the file.
  582. type FileCapabilities struct {
  583. // CanComment: Whether the user can comment on the file.
  584. CanComment bool `json:"canComment,omitempty"`
  585. // CanCopy: Whether the user can copy the file.
  586. CanCopy bool `json:"canCopy,omitempty"`
  587. // CanEdit: Whether the user can edit the file's content.
  588. CanEdit bool `json:"canEdit,omitempty"`
  589. // CanShare: Whether the user can modify the file's permissions and
  590. // sharing settings.
  591. CanShare bool `json:"canShare,omitempty"`
  592. // ForceSendFields is a list of field names (e.g. "CanComment") to
  593. // unconditionally include in API requests. By default, fields with
  594. // empty values are omitted from API requests. However, any non-pointer,
  595. // non-interface field appearing in ForceSendFields will be sent to the
  596. // server regardless of whether the field is empty or not. This may be
  597. // used to include empty fields in Patch requests.
  598. ForceSendFields []string `json:"-"`
  599. }
  600. func (s *FileCapabilities) MarshalJSON() ([]byte, error) {
  601. type noMethod FileCapabilities
  602. raw := noMethod(*s)
  603. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  604. }
  605. // FileContentHints: Additional information about the content of the
  606. // file. These fields are never populated in responses.
  607. type FileContentHints struct {
  608. // IndexableText: Text to be indexed for the file to improve fullText
  609. // queries. This is limited to 128KB in length and may contain HTML
  610. // elements.
  611. IndexableText string `json:"indexableText,omitempty"`
  612. // Thumbnail: A thumbnail for the file. This will only be used if Drive
  613. // cannot generate a standard thumbnail.
  614. Thumbnail *FileContentHintsThumbnail `json:"thumbnail,omitempty"`
  615. // ForceSendFields is a list of field names (e.g. "IndexableText") to
  616. // unconditionally include in API requests. By default, fields with
  617. // empty values are omitted from API requests. However, any non-pointer,
  618. // non-interface field appearing in ForceSendFields will be sent to the
  619. // server regardless of whether the field is empty or not. This may be
  620. // used to include empty fields in Patch requests.
  621. ForceSendFields []string `json:"-"`
  622. }
  623. func (s *FileContentHints) MarshalJSON() ([]byte, error) {
  624. type noMethod FileContentHints
  625. raw := noMethod(*s)
  626. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  627. }
  628. // FileContentHintsThumbnail: A thumbnail for the file. This will only
  629. // be used if Drive cannot generate a standard thumbnail.
  630. type FileContentHintsThumbnail struct {
  631. // Image: The thumbnail data encoded with URL-safe Base64 (RFC 4648
  632. // section 5).
  633. Image string `json:"image,omitempty"`
  634. // MimeType: The MIME type of the thumbnail.
  635. MimeType string `json:"mimeType,omitempty"`
  636. // ForceSendFields is a list of field names (e.g. "Image") to
  637. // unconditionally include in API requests. By default, fields with
  638. // empty values are omitted from API requests. However, any non-pointer,
  639. // non-interface field appearing in ForceSendFields will be sent to the
  640. // server regardless of whether the field is empty or not. This may be
  641. // used to include empty fields in Patch requests.
  642. ForceSendFields []string `json:"-"`
  643. }
  644. func (s *FileContentHintsThumbnail) MarshalJSON() ([]byte, error) {
  645. type noMethod FileContentHintsThumbnail
  646. raw := noMethod(*s)
  647. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  648. }
  649. // FileImageMediaMetadata: Additional metadata about image media, if
  650. // available.
  651. type FileImageMediaMetadata struct {
  652. // Aperture: The aperture used to create the photo (f-number).
  653. Aperture float64 `json:"aperture,omitempty"`
  654. // CameraMake: The make of the camera used to create the photo.
  655. CameraMake string `json:"cameraMake,omitempty"`
  656. // CameraModel: The model of the camera used to create the photo.
  657. CameraModel string `json:"cameraModel,omitempty"`
  658. // ColorSpace: The color space of the photo.
  659. ColorSpace string `json:"colorSpace,omitempty"`
  660. // ExposureBias: The exposure bias of the photo (APEX value).
  661. ExposureBias float64 `json:"exposureBias,omitempty"`
  662. // ExposureMode: The exposure mode used to create the photo.
  663. ExposureMode string `json:"exposureMode,omitempty"`
  664. // ExposureTime: The length of the exposure, in seconds.
  665. ExposureTime float64 `json:"exposureTime,omitempty"`
  666. // FlashUsed: Whether a flash was used to create the photo.
  667. FlashUsed bool `json:"flashUsed,omitempty"`
  668. // FocalLength: The focal length used to create the photo, in
  669. // millimeters.
  670. FocalLength float64 `json:"focalLength,omitempty"`
  671. // Height: The height of the image in pixels.
  672. Height int64 `json:"height,omitempty"`
  673. // IsoSpeed: The ISO speed used to create the photo.
  674. IsoSpeed int64 `json:"isoSpeed,omitempty"`
  675. // Lens: The lens used to create the photo.
  676. Lens string `json:"lens,omitempty"`
  677. // Location: Geographic location information stored in the image.
  678. Location *FileImageMediaMetadataLocation `json:"location,omitempty"`
  679. // MaxApertureValue: The smallest f-number of the lens at the focal
  680. // length used to create the photo (APEX value).
  681. MaxApertureValue float64 `json:"maxApertureValue,omitempty"`
  682. // MeteringMode: The metering mode used to create the photo.
  683. MeteringMode string `json:"meteringMode,omitempty"`
  684. // Rotation: The rotation in clockwise degrees from the image's original
  685. // orientation.
  686. Rotation int64 `json:"rotation,omitempty"`
  687. // Sensor: The type of sensor used to create the photo.
  688. Sensor string `json:"sensor,omitempty"`
  689. // SubjectDistance: The distance to the subject of the photo, in meters.
  690. SubjectDistance int64 `json:"subjectDistance,omitempty"`
  691. // Time: The date and time the photo was taken (EXIF DateTime).
  692. Time string `json:"time,omitempty"`
  693. // WhiteBalance: The white balance mode used to create the photo.
  694. WhiteBalance string `json:"whiteBalance,omitempty"`
  695. // Width: The width of the image in pixels.
  696. Width int64 `json:"width,omitempty"`
  697. // ForceSendFields is a list of field names (e.g. "Aperture") to
  698. // unconditionally include in API requests. By default, fields with
  699. // empty values are omitted from API requests. However, any non-pointer,
  700. // non-interface field appearing in ForceSendFields will be sent to the
  701. // server regardless of whether the field is empty or not. This may be
  702. // used to include empty fields in Patch requests.
  703. ForceSendFields []string `json:"-"`
  704. }
  705. func (s *FileImageMediaMetadata) MarshalJSON() ([]byte, error) {
  706. type noMethod FileImageMediaMetadata
  707. raw := noMethod(*s)
  708. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  709. }
  710. // FileImageMediaMetadataLocation: Geographic location information
  711. // stored in the image.
  712. type FileImageMediaMetadataLocation struct {
  713. // Altitude: The altitude stored in the image.
  714. Altitude float64 `json:"altitude,omitempty"`
  715. // Latitude: The latitude stored in the image.
  716. Latitude float64 `json:"latitude,omitempty"`
  717. // Longitude: The longitude stored in the image.
  718. Longitude float64 `json:"longitude,omitempty"`
  719. // ForceSendFields is a list of field names (e.g. "Altitude") to
  720. // unconditionally include in API requests. By default, fields with
  721. // empty values are omitted from API requests. However, any non-pointer,
  722. // non-interface field appearing in ForceSendFields will be sent to the
  723. // server regardless of whether the field is empty or not. This may be
  724. // used to include empty fields in Patch requests.
  725. ForceSendFields []string `json:"-"`
  726. }
  727. func (s *FileImageMediaMetadataLocation) MarshalJSON() ([]byte, error) {
  728. type noMethod FileImageMediaMetadataLocation
  729. raw := noMethod(*s)
  730. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  731. }
  732. // FileVideoMediaMetadata: Additional metadata about video media. This
  733. // may not be available immediately upon upload.
  734. type FileVideoMediaMetadata struct {
  735. // DurationMillis: The duration of the video in milliseconds.
  736. DurationMillis int64 `json:"durationMillis,omitempty,string"`
  737. // Height: The height of the video in pixels.
  738. Height int64 `json:"height,omitempty"`
  739. // Width: The width of the video in pixels.
  740. Width int64 `json:"width,omitempty"`
  741. // ForceSendFields is a list of field names (e.g. "DurationMillis") to
  742. // unconditionally include in API requests. By default, fields with
  743. // empty values are omitted from API requests. However, any non-pointer,
  744. // non-interface field appearing in ForceSendFields will be sent to the
  745. // server regardless of whether the field is empty or not. This may be
  746. // used to include empty fields in Patch requests.
  747. ForceSendFields []string `json:"-"`
  748. }
  749. func (s *FileVideoMediaMetadata) MarshalJSON() ([]byte, error) {
  750. type noMethod FileVideoMediaMetadata
  751. raw := noMethod(*s)
  752. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  753. }
  754. // FileList: A list of files.
  755. type FileList struct {
  756. // Files: The page of files.
  757. Files []*File `json:"files,omitempty"`
  758. // Kind: This is always drive#fileList.
  759. Kind string `json:"kind,omitempty"`
  760. // NextPageToken: The page token for the next page of files. This will
  761. // be absent if the end of the files list has been reached.
  762. NextPageToken string `json:"nextPageToken,omitempty"`
  763. // ServerResponse contains the HTTP response code and headers from the
  764. // server.
  765. googleapi.ServerResponse `json:"-"`
  766. // ForceSendFields is a list of field names (e.g. "Files") to
  767. // unconditionally include in API requests. By default, fields with
  768. // empty values are omitted from API requests. However, any non-pointer,
  769. // non-interface field appearing in ForceSendFields will be sent to the
  770. // server regardless of whether the field is empty or not. This may be
  771. // used to include empty fields in Patch requests.
  772. ForceSendFields []string `json:"-"`
  773. }
  774. func (s *FileList) MarshalJSON() ([]byte, error) {
  775. type noMethod FileList
  776. raw := noMethod(*s)
  777. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  778. }
  779. // GeneratedIds: A list of generated file IDs which can be provided in
  780. // create requests.
  781. type GeneratedIds struct {
  782. // Ids: The IDs generated for the requesting user in the specified
  783. // space.
  784. Ids []string `json:"ids,omitempty"`
  785. // Kind: This is always drive#generatedIds
  786. Kind string `json:"kind,omitempty"`
  787. // Space: The type of file that can be created with these IDs.
  788. Space string `json:"space,omitempty"`
  789. // ServerResponse contains the HTTP response code and headers from the
  790. // server.
  791. googleapi.ServerResponse `json:"-"`
  792. // ForceSendFields is a list of field names (e.g. "Ids") to
  793. // unconditionally include in API requests. By default, fields with
  794. // empty values are omitted from API requests. However, any non-pointer,
  795. // non-interface field appearing in ForceSendFields will be sent to the
  796. // server regardless of whether the field is empty or not. This may be
  797. // used to include empty fields in Patch requests.
  798. ForceSendFields []string `json:"-"`
  799. }
  800. func (s *GeneratedIds) MarshalJSON() ([]byte, error) {
  801. type noMethod GeneratedIds
  802. raw := noMethod(*s)
  803. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  804. }
  805. // Permission: A permission for a file. A permission grants a user,
  806. // group, domain or the world access to a file or a folder hierarchy.
  807. type Permission struct {
  808. // AllowFileDiscovery: Whether the permission allows the file to be
  809. // discovered through search. This is only applicable for permissions of
  810. // type domain or anyone.
  811. AllowFileDiscovery bool `json:"allowFileDiscovery,omitempty"`
  812. // DisplayName: A displayable name for users, groups or domains.
  813. DisplayName string `json:"displayName,omitempty"`
  814. // Domain: The domain to which this permission refers.
  815. Domain string `json:"domain,omitempty"`
  816. // EmailAddress: The email address of the user or group to which this
  817. // permission refers.
  818. EmailAddress string `json:"emailAddress,omitempty"`
  819. // Id: The ID of this permission. This is a unique identifier for the
  820. // grantee, and is published in User resources as permissionId.
  821. Id string `json:"id,omitempty"`
  822. // Kind: This is always drive#permission.
  823. Kind string `json:"kind,omitempty"`
  824. // PhotoLink: A link to the user's profile photo, if available.
  825. PhotoLink string `json:"photoLink,omitempty"`
  826. // Role: The role granted by this permission. Valid values are:
  827. // - owner
  828. // - writer
  829. // - commenter
  830. // - reader
  831. Role string `json:"role,omitempty"`
  832. // Type: The type of the grantee. Valid values are:
  833. // - user
  834. // - group
  835. // - domain
  836. // - anyone
  837. Type string `json:"type,omitempty"`
  838. // ServerResponse contains the HTTP response code and headers from the
  839. // server.
  840. googleapi.ServerResponse `json:"-"`
  841. // ForceSendFields is a list of field names (e.g. "AllowFileDiscovery")
  842. // to unconditionally include in API requests. By default, fields with
  843. // empty values are omitted from API requests. However, any non-pointer,
  844. // non-interface field appearing in ForceSendFields will be sent to the
  845. // server regardless of whether the field is empty or not. This may be
  846. // used to include empty fields in Patch requests.
  847. ForceSendFields []string `json:"-"`
  848. }
  849. func (s *Permission) MarshalJSON() ([]byte, error) {
  850. type noMethod Permission
  851. raw := noMethod(*s)
  852. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  853. }
  854. // PermissionList: A list of permissions for a file.
  855. type PermissionList struct {
  856. // Kind: This is always drive#permissionList.
  857. Kind string `json:"kind,omitempty"`
  858. // Permissions: The full list of permissions.
  859. Permissions []*Permission `json:"permissions,omitempty"`
  860. // ServerResponse contains the HTTP response code and headers from the
  861. // server.
  862. googleapi.ServerResponse `json:"-"`
  863. // ForceSendFields is a list of field names (e.g. "Kind") to
  864. // unconditionally include in API requests. By default, fields with
  865. // empty values are omitted from API requests. However, any non-pointer,
  866. // non-interface field appearing in ForceSendFields will be sent to the
  867. // server regardless of whether the field is empty or not. This may be
  868. // used to include empty fields in Patch requests.
  869. ForceSendFields []string `json:"-"`
  870. }
  871. func (s *PermissionList) MarshalJSON() ([]byte, error) {
  872. type noMethod PermissionList
  873. raw := noMethod(*s)
  874. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  875. }
  876. // Reply: A reply to a comment on a file.
  877. type Reply struct {
  878. // Action: The action the reply performed to the parent comment. Valid
  879. // values are:
  880. // - resolve
  881. // - reopen
  882. Action string `json:"action,omitempty"`
  883. // Author: The user who created the reply.
  884. Author *User `json:"author,omitempty"`
  885. // Content: The plain text content of the reply. This field is used for
  886. // setting the content, while htmlContent should be displayed. This is
  887. // required on creates if no action is specified.
  888. Content string `json:"content,omitempty"`
  889. // CreatedTime: The time at which the reply was created (RFC 3339
  890. // date-time).
  891. CreatedTime string `json:"createdTime,omitempty"`
  892. // Deleted: Whether the reply has been deleted. A deleted reply has no
  893. // content.
  894. Deleted bool `json:"deleted,omitempty"`
  895. // HtmlContent: The content of the reply with HTML formatting.
  896. HtmlContent string `json:"htmlContent,omitempty"`
  897. // Id: The ID of the reply.
  898. Id string `json:"id,omitempty"`
  899. // Kind: This is always drive#reply.
  900. Kind string `json:"kind,omitempty"`
  901. // ModifiedTime: The last time the reply was modified (RFC 3339
  902. // date-time).
  903. ModifiedTime string `json:"modifiedTime,omitempty"`
  904. // ServerResponse contains the HTTP response code and headers from the
  905. // server.
  906. googleapi.ServerResponse `json:"-"`
  907. // ForceSendFields is a list of field names (e.g. "Action") to
  908. // unconditionally include in API requests. By default, fields with
  909. // empty values are omitted from API requests. However, any non-pointer,
  910. // non-interface field appearing in ForceSendFields will be sent to the
  911. // server regardless of whether the field is empty or not. This may be
  912. // used to include empty fields in Patch requests.
  913. ForceSendFields []string `json:"-"`
  914. }
  915. func (s *Reply) MarshalJSON() ([]byte, error) {
  916. type noMethod Reply
  917. raw := noMethod(*s)
  918. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  919. }
  920. // ReplyList: A list of replies to a comment on a file.
  921. type ReplyList struct {
  922. // Kind: This is always drive#replyList.
  923. Kind string `json:"kind,omitempty"`
  924. // NextPageToken: The page token for the next page of replies. This will
  925. // be absent if the end of the replies list has been reached.
  926. NextPageToken string `json:"nextPageToken,omitempty"`
  927. // Replies: The page of replies.
  928. Replies []*Reply `json:"replies,omitempty"`
  929. // ServerResponse contains the HTTP response code and headers from the
  930. // server.
  931. googleapi.ServerResponse `json:"-"`
  932. // ForceSendFields is a list of field names (e.g. "Kind") to
  933. // unconditionally include in API requests. By default, fields with
  934. // empty values are omitted from API requests. However, any non-pointer,
  935. // non-interface field appearing in ForceSendFields will be sent to the
  936. // server regardless of whether the field is empty or not. This may be
  937. // used to include empty fields in Patch requests.
  938. ForceSendFields []string `json:"-"`
  939. }
  940. func (s *ReplyList) MarshalJSON() ([]byte, error) {
  941. type noMethod ReplyList
  942. raw := noMethod(*s)
  943. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  944. }
  945. // Revision: The metadata for a revision to a file.
  946. type Revision struct {
  947. // Id: The ID of the revision.
  948. Id string `json:"id,omitempty"`
  949. // KeepForever: Whether to keep this revision forever, even if it is no
  950. // longer the head revision. If not set, the revision will be
  951. // automatically purged 30 days after newer content is uploaded. This
  952. // can be set on a maximum of 200 revisions for a file.
  953. // This field is only applicable to files with binary content in Drive.
  954. KeepForever bool `json:"keepForever,omitempty"`
  955. // Kind: This is always drive#revision.
  956. Kind string `json:"kind,omitempty"`
  957. // LastModifyingUser: The last user to modify this revision.
  958. LastModifyingUser *User `json:"lastModifyingUser,omitempty"`
  959. // Md5Checksum: The MD5 checksum of the revision's content. This is only
  960. // applicable to files with binary content in Drive.
  961. Md5Checksum string `json:"md5Checksum,omitempty"`
  962. // MimeType: The MIME type of the revision.
  963. MimeType string `json:"mimeType,omitempty"`
  964. // ModifiedTime: The last time the revision was modified (RFC 3339
  965. // date-time).
  966. ModifiedTime string `json:"modifiedTime,omitempty"`
  967. // OriginalFilename: The original filename used to create this revision.
  968. // This is only applicable to files with binary content in Drive.
  969. OriginalFilename string `json:"originalFilename,omitempty"`
  970. // PublishAuto: Whether subsequent revisions will be automatically
  971. // republished. This is only applicable to Google Docs.
  972. PublishAuto bool `json:"publishAuto,omitempty"`
  973. // Published: Whether this revision is published. This is only
  974. // applicable to Google Docs.
  975. Published bool `json:"published,omitempty"`
  976. // PublishedOutsideDomain: Whether this revision is published outside
  977. // the domain. This is only applicable to Google Docs.
  978. PublishedOutsideDomain bool `json:"publishedOutsideDomain,omitempty"`
  979. // Size: The size of the revision's content in bytes. This is only
  980. // applicable to files with binary content in Drive.
  981. Size int64 `json:"size,omitempty,string"`
  982. // ServerResponse contains the HTTP response code and headers from the
  983. // server.
  984. googleapi.ServerResponse `json:"-"`
  985. // ForceSendFields is a list of field names (e.g. "Id") to
  986. // unconditionally include in API requests. By default, fields with
  987. // empty values are omitted from API requests. However, any non-pointer,
  988. // non-interface field appearing in ForceSendFields will be sent to the
  989. // server regardless of whether the field is empty or not. This may be
  990. // used to include empty fields in Patch requests.
  991. ForceSendFields []string `json:"-"`
  992. }
  993. func (s *Revision) MarshalJSON() ([]byte, error) {
  994. type noMethod Revision
  995. raw := noMethod(*s)
  996. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  997. }
  998. // RevisionList: A list of revisions of a file.
  999. type RevisionList struct {
  1000. // Kind: This is always drive#revisionList.
  1001. Kind string `json:"kind,omitempty"`
  1002. // Revisions: The full list of revisions.
  1003. Revisions []*Revision `json:"revisions,omitempty"`
  1004. // ServerResponse contains the HTTP response code and headers from the
  1005. // server.
  1006. googleapi.ServerResponse `json:"-"`
  1007. // ForceSendFields is a list of field names (e.g. "Kind") to
  1008. // unconditionally include in API requests. By default, fields with
  1009. // empty values are omitted from API requests. However, any non-pointer,
  1010. // non-interface field appearing in ForceSendFields will be sent to the
  1011. // server regardless of whether the field is empty or not. This may be
  1012. // used to include empty fields in Patch requests.
  1013. ForceSendFields []string `json:"-"`
  1014. }
  1015. func (s *RevisionList) MarshalJSON() ([]byte, error) {
  1016. type noMethod RevisionList
  1017. raw := noMethod(*s)
  1018. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1019. }
  1020. type StartPageToken struct {
  1021. // Kind: This is always drive#startPageToken.
  1022. Kind string `json:"kind,omitempty"`
  1023. // StartPageToken: The starting page token for listing changes.
  1024. StartPageToken string `json:"startPageToken,omitempty"`
  1025. // ServerResponse contains the HTTP response code and headers from the
  1026. // server.
  1027. googleapi.ServerResponse `json:"-"`
  1028. // ForceSendFields is a list of field names (e.g. "Kind") to
  1029. // unconditionally include in API requests. By default, fields with
  1030. // empty values are omitted from API requests. However, any non-pointer,
  1031. // non-interface field appearing in ForceSendFields will be sent to the
  1032. // server regardless of whether the field is empty or not. This may be
  1033. // used to include empty fields in Patch requests.
  1034. ForceSendFields []string `json:"-"`
  1035. }
  1036. func (s *StartPageToken) MarshalJSON() ([]byte, error) {
  1037. type noMethod StartPageToken
  1038. raw := noMethod(*s)
  1039. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1040. }
  1041. // User: Information about a Drive user.
  1042. type User struct {
  1043. // DisplayName: A plain text displayable name for this user.
  1044. DisplayName string `json:"displayName,omitempty"`
  1045. // EmailAddress: The email address of the user. This may not be present
  1046. // in certain contexts if the user has not made their email address
  1047. // visible to the requester.
  1048. EmailAddress string `json:"emailAddress,omitempty"`
  1049. // Kind: This is always drive#user.
  1050. Kind string `json:"kind,omitempty"`
  1051. // Me: Whether this user is the requesting user.
  1052. Me bool `json:"me,omitempty"`
  1053. // PermissionId: The user's ID as visible in Permission resources.
  1054. PermissionId string `json:"permissionId,omitempty"`
  1055. // PhotoLink: A link to the user's profile photo, if available.
  1056. PhotoLink string `json:"photoLink,omitempty"`
  1057. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  1058. // unconditionally include in API requests. By default, fields with
  1059. // empty values are omitted from API requests. However, any non-pointer,
  1060. // non-interface field appearing in ForceSendFields will be sent to the
  1061. // server regardless of whether the field is empty or not. This may be
  1062. // used to include empty fields in Patch requests.
  1063. ForceSendFields []string `json:"-"`
  1064. }
  1065. func (s *User) MarshalJSON() ([]byte, error) {
  1066. type noMethod User
  1067. raw := noMethod(*s)
  1068. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1069. }
  1070. // method id "drive.about.get":
  1071. type AboutGetCall struct {
  1072. s *Service
  1073. urlParams_ gensupport.URLParams
  1074. ifNoneMatch_ string
  1075. ctx_ context.Context
  1076. }
  1077. // Get: Gets information about the user, the user's Drive, and system
  1078. // capabilities.
  1079. func (r *AboutService) Get() *AboutGetCall {
  1080. c := &AboutGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1081. return c
  1082. }
  1083. // Fields allows partial responses to be retrieved. See
  1084. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1085. // for more information.
  1086. func (c *AboutGetCall) Fields(s ...googleapi.Field) *AboutGetCall {
  1087. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1088. return c
  1089. }
  1090. // IfNoneMatch sets the optional parameter which makes the operation
  1091. // fail if the object's ETag matches the given value. This is useful for
  1092. // getting updates only after the object has changed since the last
  1093. // request. Use googleapi.IsNotModified to check whether the response
  1094. // error from Do is the result of In-None-Match.
  1095. func (c *AboutGetCall) IfNoneMatch(entityTag string) *AboutGetCall {
  1096. c.ifNoneMatch_ = entityTag
  1097. return c
  1098. }
  1099. // Context sets the context to be used in this call's Do method. Any
  1100. // pending HTTP request will be aborted if the provided context is
  1101. // canceled.
  1102. func (c *AboutGetCall) Context(ctx context.Context) *AboutGetCall {
  1103. c.ctx_ = ctx
  1104. return c
  1105. }
  1106. func (c *AboutGetCall) doRequest(alt string) (*http.Response, error) {
  1107. var body io.Reader = nil
  1108. c.urlParams_.Set("alt", alt)
  1109. urls := googleapi.ResolveRelative(c.s.BasePath, "about")
  1110. urls += "?" + c.urlParams_.Encode()
  1111. req, _ := http.NewRequest("GET", urls, body)
  1112. googleapi.SetOpaque(req.URL)
  1113. req.Header.Set("User-Agent", c.s.userAgent())
  1114. if c.ifNoneMatch_ != "" {
  1115. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1116. }
  1117. if c.ctx_ != nil {
  1118. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1119. }
  1120. return c.s.client.Do(req)
  1121. }
  1122. // Do executes the "drive.about.get" call.
  1123. // Exactly one of *About or error will be non-nil. Any non-2xx status
  1124. // code is an error. Response headers are in either
  1125. // *About.ServerResponse.Header or (if a response was returned at all)
  1126. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1127. // check whether the returned error was because http.StatusNotModified
  1128. // was returned.
  1129. func (c *AboutGetCall) Do(opts ...googleapi.CallOption) (*About, error) {
  1130. gensupport.SetOptions(c.urlParams_, opts...)
  1131. res, err := c.doRequest("json")
  1132. if res != nil && res.StatusCode == http.StatusNotModified {
  1133. if res.Body != nil {
  1134. res.Body.Close()
  1135. }
  1136. return nil, &googleapi.Error{
  1137. Code: res.StatusCode,
  1138. Header: res.Header,
  1139. }
  1140. }
  1141. if err != nil {
  1142. return nil, err
  1143. }
  1144. defer googleapi.CloseBody(res)
  1145. if err := googleapi.CheckResponse(res); err != nil {
  1146. return nil, err
  1147. }
  1148. ret := &About{
  1149. ServerResponse: googleapi.ServerResponse{
  1150. Header: res.Header,
  1151. HTTPStatusCode: res.StatusCode,
  1152. },
  1153. }
  1154. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1155. return nil, err
  1156. }
  1157. return ret, nil
  1158. // {
  1159. // "description": "Gets information about the user, the user's Drive, and system capabilities.",
  1160. // "httpMethod": "GET",
  1161. // "id": "drive.about.get",
  1162. // "path": "about",
  1163. // "response": {
  1164. // "$ref": "About"
  1165. // },
  1166. // "scopes": [
  1167. // "https://www.googleapis.com/auth/drive",
  1168. // "https://www.googleapis.com/auth/drive.appdata",
  1169. // "https://www.googleapis.com/auth/drive.file",
  1170. // "https://www.googleapis.com/auth/drive.metadata",
  1171. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  1172. // "https://www.googleapis.com/auth/drive.photos.readonly",
  1173. // "https://www.googleapis.com/auth/drive.readonly"
  1174. // ]
  1175. // }
  1176. }
  1177. // method id "drive.changes.getStartPageToken":
  1178. type ChangesGetStartPageTokenCall struct {
  1179. s *Service
  1180. urlParams_ gensupport.URLParams
  1181. ifNoneMatch_ string
  1182. ctx_ context.Context
  1183. }
  1184. // GetStartPageToken: Gets the starting pageToken for listing future
  1185. // changes.
  1186. func (r *ChangesService) GetStartPageToken() *ChangesGetStartPageTokenCall {
  1187. c := &ChangesGetStartPageTokenCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1188. return c
  1189. }
  1190. // Fields allows partial responses to be retrieved. See
  1191. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1192. // for more information.
  1193. func (c *ChangesGetStartPageTokenCall) Fields(s ...googleapi.Field) *ChangesGetStartPageTokenCall {
  1194. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1195. return c
  1196. }
  1197. // IfNoneMatch sets the optional parameter which makes the operation
  1198. // fail if the object's ETag matches the given value. This is useful for
  1199. // getting updates only after the object has changed since the last
  1200. // request. Use googleapi.IsNotModified to check whether the response
  1201. // error from Do is the result of In-None-Match.
  1202. func (c *ChangesGetStartPageTokenCall) IfNoneMatch(entityTag string) *ChangesGetStartPageTokenCall {
  1203. c.ifNoneMatch_ = entityTag
  1204. return c
  1205. }
  1206. // Context sets the context to be used in this call's Do method. Any
  1207. // pending HTTP request will be aborted if the provided context is
  1208. // canceled.
  1209. func (c *ChangesGetStartPageTokenCall) Context(ctx context.Context) *ChangesGetStartPageTokenCall {
  1210. c.ctx_ = ctx
  1211. return c
  1212. }
  1213. func (c *ChangesGetStartPageTokenCall) doRequest(alt string) (*http.Response, error) {
  1214. var body io.Reader = nil
  1215. c.urlParams_.Set("alt", alt)
  1216. urls := googleapi.ResolveRelative(c.s.BasePath, "changes/startPageToken")
  1217. urls += "?" + c.urlParams_.Encode()
  1218. req, _ := http.NewRequest("GET", urls, body)
  1219. googleapi.SetOpaque(req.URL)
  1220. req.Header.Set("User-Agent", c.s.userAgent())
  1221. if c.ifNoneMatch_ != "" {
  1222. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1223. }
  1224. if c.ctx_ != nil {
  1225. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1226. }
  1227. return c.s.client.Do(req)
  1228. }
  1229. // Do executes the "drive.changes.getStartPageToken" call.
  1230. // Exactly one of *StartPageToken or error will be non-nil. Any non-2xx
  1231. // status code is an error. Response headers are in either
  1232. // *StartPageToken.ServerResponse.Header or (if a response was returned
  1233. // at all) in error.(*googleapi.Error).Header. Use
  1234. // googleapi.IsNotModified to check whether the returned error was
  1235. // because http.StatusNotModified was returned.
  1236. func (c *ChangesGetStartPageTokenCall) Do(opts ...googleapi.CallOption) (*StartPageToken, error) {
  1237. gensupport.SetOptions(c.urlParams_, opts...)
  1238. res, err := c.doRequest("json")
  1239. if res != nil && res.StatusCode == http.StatusNotModified {
  1240. if res.Body != nil {
  1241. res.Body.Close()
  1242. }
  1243. return nil, &googleapi.Error{
  1244. Code: res.StatusCode,
  1245. Header: res.Header,
  1246. }
  1247. }
  1248. if err != nil {
  1249. return nil, err
  1250. }
  1251. defer googleapi.CloseBody(res)
  1252. if err := googleapi.CheckResponse(res); err != nil {
  1253. return nil, err
  1254. }
  1255. ret := &StartPageToken{
  1256. ServerResponse: googleapi.ServerResponse{
  1257. Header: res.Header,
  1258. HTTPStatusCode: res.StatusCode,
  1259. },
  1260. }
  1261. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1262. return nil, err
  1263. }
  1264. return ret, nil
  1265. // {
  1266. // "description": "Gets the starting pageToken for listing future changes.",
  1267. // "httpMethod": "GET",
  1268. // "id": "drive.changes.getStartPageToken",
  1269. // "path": "changes/startPageToken",
  1270. // "response": {
  1271. // "$ref": "StartPageToken"
  1272. // },
  1273. // "scopes": [
  1274. // "https://www.googleapis.com/auth/drive",
  1275. // "https://www.googleapis.com/auth/drive.appdata",
  1276. // "https://www.googleapis.com/auth/drive.file",
  1277. // "https://www.googleapis.com/auth/drive.metadata",
  1278. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  1279. // "https://www.googleapis.com/auth/drive.photos.readonly",
  1280. // "https://www.googleapis.com/auth/drive.readonly"
  1281. // ]
  1282. // }
  1283. }
  1284. // method id "drive.changes.list":
  1285. type ChangesListCall struct {
  1286. s *Service
  1287. urlParams_ gensupport.URLParams
  1288. ifNoneMatch_ string
  1289. ctx_ context.Context
  1290. }
  1291. // List: Lists changes for a user.
  1292. func (r *ChangesService) List(pageToken string) *ChangesListCall {
  1293. c := &ChangesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1294. c.urlParams_.Set("pageToken", pageToken)
  1295. return c
  1296. }
  1297. // IncludeRemoved sets the optional parameter "includeRemoved": Whether
  1298. // to include changes indicating that items have left the view of the
  1299. // changes list, for example by deletion or lost access.
  1300. func (c *ChangesListCall) IncludeRemoved(includeRemoved bool) *ChangesListCall {
  1301. c.urlParams_.Set("includeRemoved", fmt.Sprint(includeRemoved))
  1302. return c
  1303. }
  1304. // PageSize sets the optional parameter "pageSize": The maximum number
  1305. // of changes to return per page.
  1306. func (c *ChangesListCall) PageSize(pageSize int64) *ChangesListCall {
  1307. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1308. return c
  1309. }
  1310. // RestrictToMyDrive sets the optional parameter "restrictToMyDrive":
  1311. // Whether to restrict the results to changes inside the My Drive
  1312. // hierarchy. This omits changes to files such as those in the
  1313. // Application Data folder or shared files which have not been added to
  1314. // My Drive.
  1315. func (c *ChangesListCall) RestrictToMyDrive(restrictToMyDrive bool) *ChangesListCall {
  1316. c.urlParams_.Set("restrictToMyDrive", fmt.Sprint(restrictToMyDrive))
  1317. return c
  1318. }
  1319. // Spaces sets the optional parameter "spaces": A comma-separated list
  1320. // of spaces to query within the user corpus. Supported values are
  1321. // 'drive', 'appDataFolder' and 'photos'.
  1322. func (c *ChangesListCall) Spaces(spaces string) *ChangesListCall {
  1323. c.urlParams_.Set("spaces", spaces)
  1324. return c
  1325. }
  1326. // Fields allows partial responses to be retrieved. See
  1327. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1328. // for more information.
  1329. func (c *ChangesListCall) Fields(s ...googleapi.Field) *ChangesListCall {
  1330. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1331. return c
  1332. }
  1333. // IfNoneMatch sets the optional parameter which makes the operation
  1334. // fail if the object's ETag matches the given value. This is useful for
  1335. // getting updates only after the object has changed since the last
  1336. // request. Use googleapi.IsNotModified to check whether the response
  1337. // error from Do is the result of In-None-Match.
  1338. func (c *ChangesListCall) IfNoneMatch(entityTag string) *ChangesListCall {
  1339. c.ifNoneMatch_ = entityTag
  1340. return c
  1341. }
  1342. // Context sets the context to be used in this call's Do method. Any
  1343. // pending HTTP request will be aborted if the provided context is
  1344. // canceled.
  1345. func (c *ChangesListCall) Context(ctx context.Context) *ChangesListCall {
  1346. c.ctx_ = ctx
  1347. return c
  1348. }
  1349. func (c *ChangesListCall) doRequest(alt string) (*http.Response, error) {
  1350. var body io.Reader = nil
  1351. c.urlParams_.Set("alt", alt)
  1352. urls := googleapi.ResolveRelative(c.s.BasePath, "changes")
  1353. urls += "?" + c.urlParams_.Encode()
  1354. req, _ := http.NewRequest("GET", urls, body)
  1355. googleapi.SetOpaque(req.URL)
  1356. req.Header.Set("User-Agent", c.s.userAgent())
  1357. if c.ifNoneMatch_ != "" {
  1358. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1359. }
  1360. if c.ctx_ != nil {
  1361. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1362. }
  1363. return c.s.client.Do(req)
  1364. }
  1365. // Do executes the "drive.changes.list" call.
  1366. // Exactly one of *ChangeList or error will be non-nil. Any non-2xx
  1367. // status code is an error. Response headers are in either
  1368. // *ChangeList.ServerResponse.Header or (if a response was returned at
  1369. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1370. // to check whether the returned error was because
  1371. // http.StatusNotModified was returned.
  1372. func (c *ChangesListCall) Do(opts ...googleapi.CallOption) (*ChangeList, error) {
  1373. gensupport.SetOptions(c.urlParams_, opts...)
  1374. res, err := c.doRequest("json")
  1375. if res != nil && res.StatusCode == http.StatusNotModified {
  1376. if res.Body != nil {
  1377. res.Body.Close()
  1378. }
  1379. return nil, &googleapi.Error{
  1380. Code: res.StatusCode,
  1381. Header: res.Header,
  1382. }
  1383. }
  1384. if err != nil {
  1385. return nil, err
  1386. }
  1387. defer googleapi.CloseBody(res)
  1388. if err := googleapi.CheckResponse(res); err != nil {
  1389. return nil, err
  1390. }
  1391. ret := &ChangeList{
  1392. ServerResponse: googleapi.ServerResponse{
  1393. Header: res.Header,
  1394. HTTPStatusCode: res.StatusCode,
  1395. },
  1396. }
  1397. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1398. return nil, err
  1399. }
  1400. return ret, nil
  1401. // {
  1402. // "description": "Lists changes for a user.",
  1403. // "httpMethod": "GET",
  1404. // "id": "drive.changes.list",
  1405. // "parameterOrder": [
  1406. // "pageToken"
  1407. // ],
  1408. // "parameters": {
  1409. // "includeRemoved": {
  1410. // "default": "true",
  1411. // "description": "Whether to include changes indicating that items have left the view of the changes list, for example by deletion or lost access.",
  1412. // "location": "query",
  1413. // "type": "boolean"
  1414. // },
  1415. // "pageSize": {
  1416. // "default": "100",
  1417. // "description": "The maximum number of changes to return per page.",
  1418. // "format": "int32",
  1419. // "location": "query",
  1420. // "maximum": "1000",
  1421. // "minimum": "1",
  1422. // "type": "integer"
  1423. // },
  1424. // "pageToken": {
  1425. // "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response or to the response from the getStartPageToken method.",
  1426. // "location": "query",
  1427. // "required": true,
  1428. // "type": "string"
  1429. // },
  1430. // "restrictToMyDrive": {
  1431. // "default": "false",
  1432. // "description": "Whether to restrict the results to changes inside the My Drive hierarchy. This omits changes to files such as those in the Application Data folder or shared files which have not been added to My Drive.",
  1433. // "location": "query",
  1434. // "type": "boolean"
  1435. // },
  1436. // "spaces": {
  1437. // "default": "drive",
  1438. // "description": "A comma-separated list of spaces to query within the user corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.",
  1439. // "location": "query",
  1440. // "type": "string"
  1441. // }
  1442. // },
  1443. // "path": "changes",
  1444. // "response": {
  1445. // "$ref": "ChangeList"
  1446. // },
  1447. // "scopes": [
  1448. // "https://www.googleapis.com/auth/drive",
  1449. // "https://www.googleapis.com/auth/drive.appdata",
  1450. // "https://www.googleapis.com/auth/drive.file",
  1451. // "https://www.googleapis.com/auth/drive.metadata",
  1452. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  1453. // "https://www.googleapis.com/auth/drive.photos.readonly",
  1454. // "https://www.googleapis.com/auth/drive.readonly"
  1455. // ],
  1456. // "supportsSubscription": true
  1457. // }
  1458. }
  1459. // method id "drive.changes.watch":
  1460. type ChangesWatchCall struct {
  1461. s *Service
  1462. channel *Channel
  1463. urlParams_ gensupport.URLParams
  1464. ctx_ context.Context
  1465. }
  1466. // Watch: Subscribes to changes for a user.
  1467. func (r *ChangesService) Watch(pageToken string, channel *Channel) *ChangesWatchCall {
  1468. c := &ChangesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1469. c.urlParams_.Set("pageToken", pageToken)
  1470. c.channel = channel
  1471. return c
  1472. }
  1473. // IncludeRemoved sets the optional parameter "includeRemoved": Whether
  1474. // to include changes indicating that items have left the view of the
  1475. // changes list, for example by deletion or lost access.
  1476. func (c *ChangesWatchCall) IncludeRemoved(includeRemoved bool) *ChangesWatchCall {
  1477. c.urlParams_.Set("includeRemoved", fmt.Sprint(includeRemoved))
  1478. return c
  1479. }
  1480. // PageSize sets the optional parameter "pageSize": The maximum number
  1481. // of changes to return per page.
  1482. func (c *ChangesWatchCall) PageSize(pageSize int64) *ChangesWatchCall {
  1483. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1484. return c
  1485. }
  1486. // RestrictToMyDrive sets the optional parameter "restrictToMyDrive":
  1487. // Whether to restrict the results to changes inside the My Drive
  1488. // hierarchy. This omits changes to files such as those in the
  1489. // Application Data folder or shared files which have not been added to
  1490. // My Drive.
  1491. func (c *ChangesWatchCall) RestrictToMyDrive(restrictToMyDrive bool) *ChangesWatchCall {
  1492. c.urlParams_.Set("restrictToMyDrive", fmt.Sprint(restrictToMyDrive))
  1493. return c
  1494. }
  1495. // Spaces sets the optional parameter "spaces": A comma-separated list
  1496. // of spaces to query within the user corpus. Supported values are
  1497. // 'drive', 'appDataFolder' and 'photos'.
  1498. func (c *ChangesWatchCall) Spaces(spaces string) *ChangesWatchCall {
  1499. c.urlParams_.Set("spaces", spaces)
  1500. return c
  1501. }
  1502. // Fields allows partial responses to be retrieved. See
  1503. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1504. // for more information.
  1505. func (c *ChangesWatchCall) Fields(s ...googleapi.Field) *ChangesWatchCall {
  1506. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1507. return c
  1508. }
  1509. // Context sets the context to be used in this call's Do method. Any
  1510. // pending HTTP request will be aborted if the provided context is
  1511. // canceled.
  1512. func (c *ChangesWatchCall) Context(ctx context.Context) *ChangesWatchCall {
  1513. c.ctx_ = ctx
  1514. return c
  1515. }
  1516. func (c *ChangesWatchCall) doRequest(alt string) (*http.Response, error) {
  1517. var body io.Reader = nil
  1518. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  1519. if err != nil {
  1520. return nil, err
  1521. }
  1522. ctype := "application/json"
  1523. c.urlParams_.Set("alt", alt)
  1524. urls := googleapi.ResolveRelative(c.s.BasePath, "changes/watch")
  1525. urls += "?" + c.urlParams_.Encode()
  1526. req, _ := http.NewRequest("POST", urls, body)
  1527. googleapi.SetOpaque(req.URL)
  1528. req.Header.Set("Content-Type", ctype)
  1529. req.Header.Set("User-Agent", c.s.userAgent())
  1530. if c.ctx_ != nil {
  1531. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1532. }
  1533. return c.s.client.Do(req)
  1534. }
  1535. // Do executes the "drive.changes.watch" call.
  1536. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  1537. // code is an error. Response headers are in either
  1538. // *Channel.ServerResponse.Header or (if a response was returned at all)
  1539. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1540. // check whether the returned error was because http.StatusNotModified
  1541. // was returned.
  1542. func (c *ChangesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  1543. gensupport.SetOptions(c.urlParams_, opts...)
  1544. res, err := c.doRequest("json")
  1545. if res != nil && res.StatusCode == http.StatusNotModified {
  1546. if res.Body != nil {
  1547. res.Body.Close()
  1548. }
  1549. return nil, &googleapi.Error{
  1550. Code: res.StatusCode,
  1551. Header: res.Header,
  1552. }
  1553. }
  1554. if err != nil {
  1555. return nil, err
  1556. }
  1557. defer googleapi.CloseBody(res)
  1558. if err := googleapi.CheckResponse(res); err != nil {
  1559. return nil, err
  1560. }
  1561. ret := &Channel{
  1562. ServerResponse: googleapi.ServerResponse{
  1563. Header: res.Header,
  1564. HTTPStatusCode: res.StatusCode,
  1565. },
  1566. }
  1567. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1568. return nil, err
  1569. }
  1570. return ret, nil
  1571. // {
  1572. // "description": "Subscribes to changes for a user.",
  1573. // "httpMethod": "POST",
  1574. // "id": "drive.changes.watch",
  1575. // "parameterOrder": [
  1576. // "pageToken"
  1577. // ],
  1578. // "parameters": {
  1579. // "includeRemoved": {
  1580. // "default": "true",
  1581. // "description": "Whether to include changes indicating that items have left the view of the changes list, for example by deletion or lost access.",
  1582. // "location": "query",
  1583. // "type": "boolean"
  1584. // },
  1585. // "pageSize": {
  1586. // "default": "100",
  1587. // "description": "The maximum number of changes to return per page.",
  1588. // "format": "int32",
  1589. // "location": "query",
  1590. // "maximum": "1000",
  1591. // "minimum": "1",
  1592. // "type": "integer"
  1593. // },
  1594. // "pageToken": {
  1595. // "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response or to the response from the getStartPageToken method.",
  1596. // "location": "query",
  1597. // "required": true,
  1598. // "type": "string"
  1599. // },
  1600. // "restrictToMyDrive": {
  1601. // "default": "false",
  1602. // "description": "Whether to restrict the results to changes inside the My Drive hierarchy. This omits changes to files such as those in the Application Data folder or shared files which have not been added to My Drive.",
  1603. // "location": "query",
  1604. // "type": "boolean"
  1605. // },
  1606. // "spaces": {
  1607. // "default": "drive",
  1608. // "description": "A comma-separated list of spaces to query within the user corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.",
  1609. // "location": "query",
  1610. // "type": "string"
  1611. // }
  1612. // },
  1613. // "path": "changes/watch",
  1614. // "request": {
  1615. // "$ref": "Channel",
  1616. // "parameterName": "resource"
  1617. // },
  1618. // "response": {
  1619. // "$ref": "Channel"
  1620. // },
  1621. // "scopes": [
  1622. // "https://www.googleapis.com/auth/drive",
  1623. // "https://www.googleapis.com/auth/drive.appdata",
  1624. // "https://www.googleapis.com/auth/drive.file",
  1625. // "https://www.googleapis.com/auth/drive.metadata",
  1626. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  1627. // "https://www.googleapis.com/auth/drive.photos.readonly",
  1628. // "https://www.googleapis.com/auth/drive.readonly"
  1629. // ],
  1630. // "supportsSubscription": true
  1631. // }
  1632. }
  1633. // method id "drive.channels.stop":
  1634. type ChannelsStopCall struct {
  1635. s *Service
  1636. channel *Channel
  1637. urlParams_ gensupport.URLParams
  1638. ctx_ context.Context
  1639. }
  1640. // Stop: Stop watching resources through this channel
  1641. func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
  1642. c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1643. c.channel = channel
  1644. return c
  1645. }
  1646. // Fields allows partial responses to be retrieved. See
  1647. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1648. // for more information.
  1649. func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
  1650. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1651. return c
  1652. }
  1653. // Context sets the context to be used in this call's Do method. Any
  1654. // pending HTTP request will be aborted if the provided context is
  1655. // canceled.
  1656. func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
  1657. c.ctx_ = ctx
  1658. return c
  1659. }
  1660. func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
  1661. var body io.Reader = nil
  1662. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  1663. if err != nil {
  1664. return nil, err
  1665. }
  1666. ctype := "application/json"
  1667. c.urlParams_.Set("alt", alt)
  1668. urls := googleapi.ResolveRelative(c.s.BasePath, "channels/stop")
  1669. urls += "?" + c.urlParams_.Encode()
  1670. req, _ := http.NewRequest("POST", urls, body)
  1671. googleapi.SetOpaque(req.URL)
  1672. req.Header.Set("Content-Type", ctype)
  1673. req.Header.Set("User-Agent", c.s.userAgent())
  1674. if c.ctx_ != nil {
  1675. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1676. }
  1677. return c.s.client.Do(req)
  1678. }
  1679. // Do executes the "drive.channels.stop" call.
  1680. func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
  1681. gensupport.SetOptions(c.urlParams_, opts...)
  1682. res, err := c.doRequest("json")
  1683. if err != nil {
  1684. return err
  1685. }
  1686. defer googleapi.CloseBody(res)
  1687. if err := googleapi.CheckResponse(res); err != nil {
  1688. return err
  1689. }
  1690. return nil
  1691. // {
  1692. // "description": "Stop watching resources through this channel",
  1693. // "httpMethod": "POST",
  1694. // "id": "drive.channels.stop",
  1695. // "path": "channels/stop",
  1696. // "request": {
  1697. // "$ref": "Channel",
  1698. // "parameterName": "resource"
  1699. // },
  1700. // "scopes": [
  1701. // "https://www.googleapis.com/auth/drive",
  1702. // "https://www.googleapis.com/auth/drive.appdata",
  1703. // "https://www.googleapis.com/auth/drive.file",
  1704. // "https://www.googleapis.com/auth/drive.metadata",
  1705. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  1706. // "https://www.googleapis.com/auth/drive.photos.readonly",
  1707. // "https://www.googleapis.com/auth/drive.readonly"
  1708. // ]
  1709. // }
  1710. }
  1711. // method id "drive.comments.create":
  1712. type CommentsCreateCall struct {
  1713. s *Service
  1714. fileId string
  1715. comment *Comment
  1716. urlParams_ gensupport.URLParams
  1717. ctx_ context.Context
  1718. }
  1719. // Create: Creates a new comment on a file.
  1720. func (r *CommentsService) Create(fileId string, comment *Comment) *CommentsCreateCall {
  1721. c := &CommentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1722. c.fileId = fileId
  1723. c.comment = comment
  1724. return c
  1725. }
  1726. // Fields allows partial responses to be retrieved. See
  1727. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1728. // for more information.
  1729. func (c *CommentsCreateCall) Fields(s ...googleapi.Field) *CommentsCreateCall {
  1730. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1731. return c
  1732. }
  1733. // Context sets the context to be used in this call's Do method. Any
  1734. // pending HTTP request will be aborted if the provided context is
  1735. // canceled.
  1736. func (c *CommentsCreateCall) Context(ctx context.Context) *CommentsCreateCall {
  1737. c.ctx_ = ctx
  1738. return c
  1739. }
  1740. func (c *CommentsCreateCall) doRequest(alt string) (*http.Response, error) {
  1741. var body io.Reader = nil
  1742. body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment)
  1743. if err != nil {
  1744. return nil, err
  1745. }
  1746. ctype := "application/json"
  1747. c.urlParams_.Set("alt", alt)
  1748. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments")
  1749. urls += "?" + c.urlParams_.Encode()
  1750. req, _ := http.NewRequest("POST", urls, body)
  1751. googleapi.Expand(req.URL, map[string]string{
  1752. "fileId": c.fileId,
  1753. })
  1754. req.Header.Set("Content-Type", ctype)
  1755. req.Header.Set("User-Agent", c.s.userAgent())
  1756. if c.ctx_ != nil {
  1757. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1758. }
  1759. return c.s.client.Do(req)
  1760. }
  1761. // Do executes the "drive.comments.create" call.
  1762. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  1763. // code is an error. Response headers are in either
  1764. // *Comment.ServerResponse.Header or (if a response was returned at all)
  1765. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1766. // check whether the returned error was because http.StatusNotModified
  1767. // was returned.
  1768. func (c *CommentsCreateCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  1769. gensupport.SetOptions(c.urlParams_, opts...)
  1770. res, err := c.doRequest("json")
  1771. if res != nil && res.StatusCode == http.StatusNotModified {
  1772. if res.Body != nil {
  1773. res.Body.Close()
  1774. }
  1775. return nil, &googleapi.Error{
  1776. Code: res.StatusCode,
  1777. Header: res.Header,
  1778. }
  1779. }
  1780. if err != nil {
  1781. return nil, err
  1782. }
  1783. defer googleapi.CloseBody(res)
  1784. if err := googleapi.CheckResponse(res); err != nil {
  1785. return nil, err
  1786. }
  1787. ret := &Comment{
  1788. ServerResponse: googleapi.ServerResponse{
  1789. Header: res.Header,
  1790. HTTPStatusCode: res.StatusCode,
  1791. },
  1792. }
  1793. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1794. return nil, err
  1795. }
  1796. return ret, nil
  1797. // {
  1798. // "description": "Creates a new comment on a file.",
  1799. // "httpMethod": "POST",
  1800. // "id": "drive.comments.create",
  1801. // "parameterOrder": [
  1802. // "fileId"
  1803. // ],
  1804. // "parameters": {
  1805. // "fileId": {
  1806. // "description": "The ID of the file.",
  1807. // "location": "path",
  1808. // "required": true,
  1809. // "type": "string"
  1810. // }
  1811. // },
  1812. // "path": "files/{fileId}/comments",
  1813. // "request": {
  1814. // "$ref": "Comment"
  1815. // },
  1816. // "response": {
  1817. // "$ref": "Comment"
  1818. // },
  1819. // "scopes": [
  1820. // "https://www.googleapis.com/auth/drive",
  1821. // "https://www.googleapis.com/auth/drive.file"
  1822. // ]
  1823. // }
  1824. }
  1825. // method id "drive.comments.delete":
  1826. type CommentsDeleteCall struct {
  1827. s *Service
  1828. fileId string
  1829. commentId string
  1830. urlParams_ gensupport.URLParams
  1831. ctx_ context.Context
  1832. }
  1833. // Delete: Deletes a comment.
  1834. func (r *CommentsService) Delete(fileId string, commentId string) *CommentsDeleteCall {
  1835. c := &CommentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1836. c.fileId = fileId
  1837. c.commentId = commentId
  1838. return c
  1839. }
  1840. // Fields allows partial responses to be retrieved. See
  1841. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1842. // for more information.
  1843. func (c *CommentsDeleteCall) Fields(s ...googleapi.Field) *CommentsDeleteCall {
  1844. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1845. return c
  1846. }
  1847. // Context sets the context to be used in this call's Do method. Any
  1848. // pending HTTP request will be aborted if the provided context is
  1849. // canceled.
  1850. func (c *CommentsDeleteCall) Context(ctx context.Context) *CommentsDeleteCall {
  1851. c.ctx_ = ctx
  1852. return c
  1853. }
  1854. func (c *CommentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1855. var body io.Reader = nil
  1856. c.urlParams_.Set("alt", alt)
  1857. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  1858. urls += "?" + c.urlParams_.Encode()
  1859. req, _ := http.NewRequest("DELETE", urls, body)
  1860. googleapi.Expand(req.URL, map[string]string{
  1861. "fileId": c.fileId,
  1862. "commentId": c.commentId,
  1863. })
  1864. req.Header.Set("User-Agent", c.s.userAgent())
  1865. if c.ctx_ != nil {
  1866. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1867. }
  1868. return c.s.client.Do(req)
  1869. }
  1870. // Do executes the "drive.comments.delete" call.
  1871. func (c *CommentsDeleteCall) Do(opts ...googleapi.CallOption) error {
  1872. gensupport.SetOptions(c.urlParams_, opts...)
  1873. res, err := c.doRequest("json")
  1874. if err != nil {
  1875. return err
  1876. }
  1877. defer googleapi.CloseBody(res)
  1878. if err := googleapi.CheckResponse(res); err != nil {
  1879. return err
  1880. }
  1881. return nil
  1882. // {
  1883. // "description": "Deletes a comment.",
  1884. // "httpMethod": "DELETE",
  1885. // "id": "drive.comments.delete",
  1886. // "parameterOrder": [
  1887. // "fileId",
  1888. // "commentId"
  1889. // ],
  1890. // "parameters": {
  1891. // "commentId": {
  1892. // "description": "The ID of the comment.",
  1893. // "location": "path",
  1894. // "required": true,
  1895. // "type": "string"
  1896. // },
  1897. // "fileId": {
  1898. // "description": "The ID of the file.",
  1899. // "location": "path",
  1900. // "required": true,
  1901. // "type": "string"
  1902. // }
  1903. // },
  1904. // "path": "files/{fileId}/comments/{commentId}",
  1905. // "scopes": [
  1906. // "https://www.googleapis.com/auth/drive",
  1907. // "https://www.googleapis.com/auth/drive.file"
  1908. // ]
  1909. // }
  1910. }
  1911. // method id "drive.comments.get":
  1912. type CommentsGetCall struct {
  1913. s *Service
  1914. fileId string
  1915. commentId string
  1916. urlParams_ gensupport.URLParams
  1917. ifNoneMatch_ string
  1918. ctx_ context.Context
  1919. }
  1920. // Get: Gets a comment by ID.
  1921. func (r *CommentsService) Get(fileId string, commentId string) *CommentsGetCall {
  1922. c := &CommentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1923. c.fileId = fileId
  1924. c.commentId = commentId
  1925. return c
  1926. }
  1927. // IncludeDeleted sets the optional parameter "includeDeleted": Whether
  1928. // to return deleted comments. Deleted comments will not include their
  1929. // original content.
  1930. func (c *CommentsGetCall) IncludeDeleted(includeDeleted bool) *CommentsGetCall {
  1931. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  1932. return c
  1933. }
  1934. // Fields allows partial responses to be retrieved. See
  1935. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1936. // for more information.
  1937. func (c *CommentsGetCall) Fields(s ...googleapi.Field) *CommentsGetCall {
  1938. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1939. return c
  1940. }
  1941. // IfNoneMatch sets the optional parameter which makes the operation
  1942. // fail if the object's ETag matches the given value. This is useful for
  1943. // getting updates only after the object has changed since the last
  1944. // request. Use googleapi.IsNotModified to check whether the response
  1945. // error from Do is the result of In-None-Match.
  1946. func (c *CommentsGetCall) IfNoneMatch(entityTag string) *CommentsGetCall {
  1947. c.ifNoneMatch_ = entityTag
  1948. return c
  1949. }
  1950. // Context sets the context to be used in this call's Do method. Any
  1951. // pending HTTP request will be aborted if the provided context is
  1952. // canceled.
  1953. func (c *CommentsGetCall) Context(ctx context.Context) *CommentsGetCall {
  1954. c.ctx_ = ctx
  1955. return c
  1956. }
  1957. func (c *CommentsGetCall) doRequest(alt string) (*http.Response, error) {
  1958. var body io.Reader = nil
  1959. c.urlParams_.Set("alt", alt)
  1960. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  1961. urls += "?" + c.urlParams_.Encode()
  1962. req, _ := http.NewRequest("GET", urls, body)
  1963. googleapi.Expand(req.URL, map[string]string{
  1964. "fileId": c.fileId,
  1965. "commentId": c.commentId,
  1966. })
  1967. req.Header.Set("User-Agent", c.s.userAgent())
  1968. if c.ifNoneMatch_ != "" {
  1969. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1970. }
  1971. if c.ctx_ != nil {
  1972. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1973. }
  1974. return c.s.client.Do(req)
  1975. }
  1976. // Do executes the "drive.comments.get" call.
  1977. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  1978. // code is an error. Response headers are in either
  1979. // *Comment.ServerResponse.Header or (if a response was returned at all)
  1980. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1981. // check whether the returned error was because http.StatusNotModified
  1982. // was returned.
  1983. func (c *CommentsGetCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  1984. gensupport.SetOptions(c.urlParams_, opts...)
  1985. res, err := c.doRequest("json")
  1986. if res != nil && res.StatusCode == http.StatusNotModified {
  1987. if res.Body != nil {
  1988. res.Body.Close()
  1989. }
  1990. return nil, &googleapi.Error{
  1991. Code: res.StatusCode,
  1992. Header: res.Header,
  1993. }
  1994. }
  1995. if err != nil {
  1996. return nil, err
  1997. }
  1998. defer googleapi.CloseBody(res)
  1999. if err := googleapi.CheckResponse(res); err != nil {
  2000. return nil, err
  2001. }
  2002. ret := &Comment{
  2003. ServerResponse: googleapi.ServerResponse{
  2004. Header: res.Header,
  2005. HTTPStatusCode: res.StatusCode,
  2006. },
  2007. }
  2008. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2009. return nil, err
  2010. }
  2011. return ret, nil
  2012. // {
  2013. // "description": "Gets a comment by ID.",
  2014. // "httpMethod": "GET",
  2015. // "id": "drive.comments.get",
  2016. // "parameterOrder": [
  2017. // "fileId",
  2018. // "commentId"
  2019. // ],
  2020. // "parameters": {
  2021. // "commentId": {
  2022. // "description": "The ID of the comment.",
  2023. // "location": "path",
  2024. // "required": true,
  2025. // "type": "string"
  2026. // },
  2027. // "fileId": {
  2028. // "description": "The ID of the file.",
  2029. // "location": "path",
  2030. // "required": true,
  2031. // "type": "string"
  2032. // },
  2033. // "includeDeleted": {
  2034. // "default": "false",
  2035. // "description": "Whether to return deleted comments. Deleted comments will not include their original content.",
  2036. // "location": "query",
  2037. // "type": "boolean"
  2038. // }
  2039. // },
  2040. // "path": "files/{fileId}/comments/{commentId}",
  2041. // "response": {
  2042. // "$ref": "Comment"
  2043. // },
  2044. // "scopes": [
  2045. // "https://www.googleapis.com/auth/drive",
  2046. // "https://www.googleapis.com/auth/drive.file",
  2047. // "https://www.googleapis.com/auth/drive.readonly"
  2048. // ]
  2049. // }
  2050. }
  2051. // method id "drive.comments.list":
  2052. type CommentsListCall struct {
  2053. s *Service
  2054. fileId string
  2055. urlParams_ gensupport.URLParams
  2056. ifNoneMatch_ string
  2057. ctx_ context.Context
  2058. }
  2059. // List: Lists a file's comments.
  2060. func (r *CommentsService) List(fileId string) *CommentsListCall {
  2061. c := &CommentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2062. c.fileId = fileId
  2063. return c
  2064. }
  2065. // IncludeDeleted sets the optional parameter "includeDeleted": Whether
  2066. // to include deleted comments. Deleted comments will not include their
  2067. // original content.
  2068. func (c *CommentsListCall) IncludeDeleted(includeDeleted bool) *CommentsListCall {
  2069. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  2070. return c
  2071. }
  2072. // PageSize sets the optional parameter "pageSize": The maximum number
  2073. // of comments to return per page.
  2074. func (c *CommentsListCall) PageSize(pageSize int64) *CommentsListCall {
  2075. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2076. return c
  2077. }
  2078. // PageToken sets the optional parameter "pageToken": The token for
  2079. // continuing a previous list request on the next page. This should be
  2080. // set to the value of 'nextPageToken' from the previous response.
  2081. func (c *CommentsListCall) PageToken(pageToken string) *CommentsListCall {
  2082. c.urlParams_.Set("pageToken", pageToken)
  2083. return c
  2084. }
  2085. // StartModifiedTime sets the optional parameter "startModifiedTime":
  2086. // The minimum value of 'modifiedTime' for the result comments (RFC 3339
  2087. // date-time).
  2088. func (c *CommentsListCall) StartModifiedTime(startModifiedTime string) *CommentsListCall {
  2089. c.urlParams_.Set("startModifiedTime", startModifiedTime)
  2090. return c
  2091. }
  2092. // Fields allows partial responses to be retrieved. See
  2093. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2094. // for more information.
  2095. func (c *CommentsListCall) Fields(s ...googleapi.Field) *CommentsListCall {
  2096. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2097. return c
  2098. }
  2099. // IfNoneMatch sets the optional parameter which makes the operation
  2100. // fail if the object's ETag matches the given value. This is useful for
  2101. // getting updates only after the object has changed since the last
  2102. // request. Use googleapi.IsNotModified to check whether the response
  2103. // error from Do is the result of In-None-Match.
  2104. func (c *CommentsListCall) IfNoneMatch(entityTag string) *CommentsListCall {
  2105. c.ifNoneMatch_ = entityTag
  2106. return c
  2107. }
  2108. // Context sets the context to be used in this call's Do method. Any
  2109. // pending HTTP request will be aborted if the provided context is
  2110. // canceled.
  2111. func (c *CommentsListCall) Context(ctx context.Context) *CommentsListCall {
  2112. c.ctx_ = ctx
  2113. return c
  2114. }
  2115. func (c *CommentsListCall) doRequest(alt string) (*http.Response, error) {
  2116. var body io.Reader = nil
  2117. c.urlParams_.Set("alt", alt)
  2118. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments")
  2119. urls += "?" + c.urlParams_.Encode()
  2120. req, _ := http.NewRequest("GET", urls, body)
  2121. googleapi.Expand(req.URL, map[string]string{
  2122. "fileId": c.fileId,
  2123. })
  2124. req.Header.Set("User-Agent", c.s.userAgent())
  2125. if c.ifNoneMatch_ != "" {
  2126. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2127. }
  2128. if c.ctx_ != nil {
  2129. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2130. }
  2131. return c.s.client.Do(req)
  2132. }
  2133. // Do executes the "drive.comments.list" call.
  2134. // Exactly one of *CommentList or error will be non-nil. Any non-2xx
  2135. // status code is an error. Response headers are in either
  2136. // *CommentList.ServerResponse.Header or (if a response was returned at
  2137. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2138. // to check whether the returned error was because
  2139. // http.StatusNotModified was returned.
  2140. func (c *CommentsListCall) Do(opts ...googleapi.CallOption) (*CommentList, error) {
  2141. gensupport.SetOptions(c.urlParams_, opts...)
  2142. res, err := c.doRequest("json")
  2143. if res != nil && res.StatusCode == http.StatusNotModified {
  2144. if res.Body != nil {
  2145. res.Body.Close()
  2146. }
  2147. return nil, &googleapi.Error{
  2148. Code: res.StatusCode,
  2149. Header: res.Header,
  2150. }
  2151. }
  2152. if err != nil {
  2153. return nil, err
  2154. }
  2155. defer googleapi.CloseBody(res)
  2156. if err := googleapi.CheckResponse(res); err != nil {
  2157. return nil, err
  2158. }
  2159. ret := &CommentList{
  2160. ServerResponse: googleapi.ServerResponse{
  2161. Header: res.Header,
  2162. HTTPStatusCode: res.StatusCode,
  2163. },
  2164. }
  2165. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2166. return nil, err
  2167. }
  2168. return ret, nil
  2169. // {
  2170. // "description": "Lists a file's comments.",
  2171. // "httpMethod": "GET",
  2172. // "id": "drive.comments.list",
  2173. // "parameterOrder": [
  2174. // "fileId"
  2175. // ],
  2176. // "parameters": {
  2177. // "fileId": {
  2178. // "description": "The ID of the file.",
  2179. // "location": "path",
  2180. // "required": true,
  2181. // "type": "string"
  2182. // },
  2183. // "includeDeleted": {
  2184. // "default": "false",
  2185. // "description": "Whether to include deleted comments. Deleted comments will not include their original content.",
  2186. // "location": "query",
  2187. // "type": "boolean"
  2188. // },
  2189. // "pageSize": {
  2190. // "default": "20",
  2191. // "description": "The maximum number of comments to return per page.",
  2192. // "format": "int32",
  2193. // "location": "query",
  2194. // "maximum": "100",
  2195. // "minimum": "1",
  2196. // "type": "integer"
  2197. // },
  2198. // "pageToken": {
  2199. // "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.",
  2200. // "location": "query",
  2201. // "type": "string"
  2202. // },
  2203. // "startModifiedTime": {
  2204. // "description": "The minimum value of 'modifiedTime' for the result comments (RFC 3339 date-time).",
  2205. // "location": "query",
  2206. // "type": "string"
  2207. // }
  2208. // },
  2209. // "path": "files/{fileId}/comments",
  2210. // "response": {
  2211. // "$ref": "CommentList"
  2212. // },
  2213. // "scopes": [
  2214. // "https://www.googleapis.com/auth/drive",
  2215. // "https://www.googleapis.com/auth/drive.file",
  2216. // "https://www.googleapis.com/auth/drive.readonly"
  2217. // ]
  2218. // }
  2219. }
  2220. // Pages invokes f for each page of results.
  2221. // A non-nil error returned from f will halt the iteration.
  2222. // The provided context supersedes any context provided to the Context method.
  2223. func (c *CommentsListCall) Pages(ctx context.Context, f func(*CommentList) error) error {
  2224. c.ctx_ = ctx
  2225. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2226. for {
  2227. x, err := c.Do()
  2228. if err != nil {
  2229. return err
  2230. }
  2231. if err := f(x); err != nil {
  2232. return err
  2233. }
  2234. if x.NextPageToken == "" {
  2235. return nil
  2236. }
  2237. c.PageToken(x.NextPageToken)
  2238. }
  2239. }
  2240. // method id "drive.comments.update":
  2241. type CommentsUpdateCall struct {
  2242. s *Service
  2243. fileId string
  2244. commentId string
  2245. comment *Comment
  2246. urlParams_ gensupport.URLParams
  2247. ctx_ context.Context
  2248. }
  2249. // Update: Updates a comment with patch semantics.
  2250. func (r *CommentsService) Update(fileId string, commentId string, comment *Comment) *CommentsUpdateCall {
  2251. c := &CommentsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2252. c.fileId = fileId
  2253. c.commentId = commentId
  2254. c.comment = comment
  2255. return c
  2256. }
  2257. // Fields allows partial responses to be retrieved. See
  2258. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2259. // for more information.
  2260. func (c *CommentsUpdateCall) Fields(s ...googleapi.Field) *CommentsUpdateCall {
  2261. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2262. return c
  2263. }
  2264. // Context sets the context to be used in this call's Do method. Any
  2265. // pending HTTP request will be aborted if the provided context is
  2266. // canceled.
  2267. func (c *CommentsUpdateCall) Context(ctx context.Context) *CommentsUpdateCall {
  2268. c.ctx_ = ctx
  2269. return c
  2270. }
  2271. func (c *CommentsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2272. var body io.Reader = nil
  2273. body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment)
  2274. if err != nil {
  2275. return nil, err
  2276. }
  2277. ctype := "application/json"
  2278. c.urlParams_.Set("alt", alt)
  2279. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  2280. urls += "?" + c.urlParams_.Encode()
  2281. req, _ := http.NewRequest("PATCH", urls, body)
  2282. googleapi.Expand(req.URL, map[string]string{
  2283. "fileId": c.fileId,
  2284. "commentId": c.commentId,
  2285. })
  2286. req.Header.Set("Content-Type", ctype)
  2287. req.Header.Set("User-Agent", c.s.userAgent())
  2288. if c.ctx_ != nil {
  2289. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2290. }
  2291. return c.s.client.Do(req)
  2292. }
  2293. // Do executes the "drive.comments.update" call.
  2294. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  2295. // code is an error. Response headers are in either
  2296. // *Comment.ServerResponse.Header or (if a response was returned at all)
  2297. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2298. // check whether the returned error was because http.StatusNotModified
  2299. // was returned.
  2300. func (c *CommentsUpdateCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  2301. gensupport.SetOptions(c.urlParams_, opts...)
  2302. res, err := c.doRequest("json")
  2303. if res != nil && res.StatusCode == http.StatusNotModified {
  2304. if res.Body != nil {
  2305. res.Body.Close()
  2306. }
  2307. return nil, &googleapi.Error{
  2308. Code: res.StatusCode,
  2309. Header: res.Header,
  2310. }
  2311. }
  2312. if err != nil {
  2313. return nil, err
  2314. }
  2315. defer googleapi.CloseBody(res)
  2316. if err := googleapi.CheckResponse(res); err != nil {
  2317. return nil, err
  2318. }
  2319. ret := &Comment{
  2320. ServerResponse: googleapi.ServerResponse{
  2321. Header: res.Header,
  2322. HTTPStatusCode: res.StatusCode,
  2323. },
  2324. }
  2325. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2326. return nil, err
  2327. }
  2328. return ret, nil
  2329. // {
  2330. // "description": "Updates a comment with patch semantics.",
  2331. // "httpMethod": "PATCH",
  2332. // "id": "drive.comments.update",
  2333. // "parameterOrder": [
  2334. // "fileId",
  2335. // "commentId"
  2336. // ],
  2337. // "parameters": {
  2338. // "commentId": {
  2339. // "description": "The ID of the comment.",
  2340. // "location": "path",
  2341. // "required": true,
  2342. // "type": "string"
  2343. // },
  2344. // "fileId": {
  2345. // "description": "The ID of the file.",
  2346. // "location": "path",
  2347. // "required": true,
  2348. // "type": "string"
  2349. // }
  2350. // },
  2351. // "path": "files/{fileId}/comments/{commentId}",
  2352. // "request": {
  2353. // "$ref": "Comment"
  2354. // },
  2355. // "response": {
  2356. // "$ref": "Comment"
  2357. // },
  2358. // "scopes": [
  2359. // "https://www.googleapis.com/auth/drive",
  2360. // "https://www.googleapis.com/auth/drive.file"
  2361. // ]
  2362. // }
  2363. }
  2364. // method id "drive.files.copy":
  2365. type FilesCopyCall struct {
  2366. s *Service
  2367. fileId string
  2368. file *File
  2369. urlParams_ gensupport.URLParams
  2370. ctx_ context.Context
  2371. }
  2372. // Copy: Creates a copy of a file and applies any requested updates with
  2373. // patch semantics.
  2374. func (r *FilesService) Copy(fileId string, file *File) *FilesCopyCall {
  2375. c := &FilesCopyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2376. c.fileId = fileId
  2377. c.file = file
  2378. return c
  2379. }
  2380. // IgnoreDefaultVisibility sets the optional parameter
  2381. // "ignoreDefaultVisibility": Whether to ignore the domain's default
  2382. // visibility settings for the created file. Domain administrators can
  2383. // choose to make all uploaded files visible to the domain by default;
  2384. // this parameter bypasses that behavior for the request. Permissions
  2385. // are still inherited from parent folders.
  2386. func (c *FilesCopyCall) IgnoreDefaultVisibility(ignoreDefaultVisibility bool) *FilesCopyCall {
  2387. c.urlParams_.Set("ignoreDefaultVisibility", fmt.Sprint(ignoreDefaultVisibility))
  2388. return c
  2389. }
  2390. // KeepRevisionForever sets the optional parameter
  2391. // "keepRevisionForever": Whether to set the 'keepForever' field in the
  2392. // new head revision. This is only applicable to files with binary
  2393. // content in Drive.
  2394. func (c *FilesCopyCall) KeepRevisionForever(keepRevisionForever bool) *FilesCopyCall {
  2395. c.urlParams_.Set("keepRevisionForever", fmt.Sprint(keepRevisionForever))
  2396. return c
  2397. }
  2398. // OcrLanguage sets the optional parameter "ocrLanguage": A language
  2399. // hint for OCR processing during image import (ISO 639-1 code).
  2400. func (c *FilesCopyCall) OcrLanguage(ocrLanguage string) *FilesCopyCall {
  2401. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  2402. return c
  2403. }
  2404. // Fields allows partial responses to be retrieved. See
  2405. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2406. // for more information.
  2407. func (c *FilesCopyCall) Fields(s ...googleapi.Field) *FilesCopyCall {
  2408. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2409. return c
  2410. }
  2411. // Context sets the context to be used in this call's Do method. Any
  2412. // pending HTTP request will be aborted if the provided context is
  2413. // canceled.
  2414. func (c *FilesCopyCall) Context(ctx context.Context) *FilesCopyCall {
  2415. c.ctx_ = ctx
  2416. return c
  2417. }
  2418. func (c *FilesCopyCall) doRequest(alt string) (*http.Response, error) {
  2419. var body io.Reader = nil
  2420. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  2421. if err != nil {
  2422. return nil, err
  2423. }
  2424. ctype := "application/json"
  2425. c.urlParams_.Set("alt", alt)
  2426. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/copy")
  2427. urls += "?" + c.urlParams_.Encode()
  2428. req, _ := http.NewRequest("POST", urls, body)
  2429. googleapi.Expand(req.URL, map[string]string{
  2430. "fileId": c.fileId,
  2431. })
  2432. req.Header.Set("Content-Type", ctype)
  2433. req.Header.Set("User-Agent", c.s.userAgent())
  2434. if c.ctx_ != nil {
  2435. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2436. }
  2437. return c.s.client.Do(req)
  2438. }
  2439. // Do executes the "drive.files.copy" call.
  2440. // Exactly one of *File or error will be non-nil. Any non-2xx status
  2441. // code is an error. Response headers are in either
  2442. // *File.ServerResponse.Header or (if a response was returned at all) in
  2443. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2444. // whether the returned error was because http.StatusNotModified was
  2445. // returned.
  2446. func (c *FilesCopyCall) Do(opts ...googleapi.CallOption) (*File, error) {
  2447. gensupport.SetOptions(c.urlParams_, opts...)
  2448. res, err := c.doRequest("json")
  2449. if res != nil && res.StatusCode == http.StatusNotModified {
  2450. if res.Body != nil {
  2451. res.Body.Close()
  2452. }
  2453. return nil, &googleapi.Error{
  2454. Code: res.StatusCode,
  2455. Header: res.Header,
  2456. }
  2457. }
  2458. if err != nil {
  2459. return nil, err
  2460. }
  2461. defer googleapi.CloseBody(res)
  2462. if err := googleapi.CheckResponse(res); err != nil {
  2463. return nil, err
  2464. }
  2465. ret := &File{
  2466. ServerResponse: googleapi.ServerResponse{
  2467. Header: res.Header,
  2468. HTTPStatusCode: res.StatusCode,
  2469. },
  2470. }
  2471. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2472. return nil, err
  2473. }
  2474. return ret, nil
  2475. // {
  2476. // "description": "Creates a copy of a file and applies any requested updates with patch semantics.",
  2477. // "httpMethod": "POST",
  2478. // "id": "drive.files.copy",
  2479. // "parameterOrder": [
  2480. // "fileId"
  2481. // ],
  2482. // "parameters": {
  2483. // "fileId": {
  2484. // "description": "The ID of the file.",
  2485. // "location": "path",
  2486. // "required": true,
  2487. // "type": "string"
  2488. // },
  2489. // "ignoreDefaultVisibility": {
  2490. // "default": "false",
  2491. // "description": "Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders.",
  2492. // "location": "query",
  2493. // "type": "boolean"
  2494. // },
  2495. // "keepRevisionForever": {
  2496. // "default": "false",
  2497. // "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive.",
  2498. // "location": "query",
  2499. // "type": "boolean"
  2500. // },
  2501. // "ocrLanguage": {
  2502. // "description": "A language hint for OCR processing during image import (ISO 639-1 code).",
  2503. // "location": "query",
  2504. // "type": "string"
  2505. // }
  2506. // },
  2507. // "path": "files/{fileId}/copy",
  2508. // "request": {
  2509. // "$ref": "File"
  2510. // },
  2511. // "response": {
  2512. // "$ref": "File"
  2513. // },
  2514. // "scopes": [
  2515. // "https://www.googleapis.com/auth/drive",
  2516. // "https://www.googleapis.com/auth/drive.appdata",
  2517. // "https://www.googleapis.com/auth/drive.file",
  2518. // "https://www.googleapis.com/auth/drive.photos.readonly"
  2519. // ]
  2520. // }
  2521. }
  2522. // method id "drive.files.create":
  2523. type FilesCreateCall struct {
  2524. s *Service
  2525. file *File
  2526. urlParams_ gensupport.URLParams
  2527. media_ io.Reader
  2528. resumableBuffer_ *gensupport.ResumableBuffer
  2529. mediaType_ string
  2530. mediaSize_ int64 // mediaSize, if known. Used only for calls to progressUpdater_.
  2531. progressUpdater_ googleapi.ProgressUpdater
  2532. ctx_ context.Context
  2533. }
  2534. // Create: Creates a new file.
  2535. func (r *FilesService) Create(file *File) *FilesCreateCall {
  2536. c := &FilesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2537. c.file = file
  2538. return c
  2539. }
  2540. // IgnoreDefaultVisibility sets the optional parameter
  2541. // "ignoreDefaultVisibility": Whether to ignore the domain's default
  2542. // visibility settings for the created file. Domain administrators can
  2543. // choose to make all uploaded files visible to the domain by default;
  2544. // this parameter bypasses that behavior for the request. Permissions
  2545. // are still inherited from parent folders.
  2546. func (c *FilesCreateCall) IgnoreDefaultVisibility(ignoreDefaultVisibility bool) *FilesCreateCall {
  2547. c.urlParams_.Set("ignoreDefaultVisibility", fmt.Sprint(ignoreDefaultVisibility))
  2548. return c
  2549. }
  2550. // KeepRevisionForever sets the optional parameter
  2551. // "keepRevisionForever": Whether to set the 'keepForever' field in the
  2552. // new head revision. This is only applicable to files with binary
  2553. // content in Drive.
  2554. func (c *FilesCreateCall) KeepRevisionForever(keepRevisionForever bool) *FilesCreateCall {
  2555. c.urlParams_.Set("keepRevisionForever", fmt.Sprint(keepRevisionForever))
  2556. return c
  2557. }
  2558. // OcrLanguage sets the optional parameter "ocrLanguage": A language
  2559. // hint for OCR processing during image import (ISO 639-1 code).
  2560. func (c *FilesCreateCall) OcrLanguage(ocrLanguage string) *FilesCreateCall {
  2561. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  2562. return c
  2563. }
  2564. // UseContentAsIndexableText sets the optional parameter
  2565. // "useContentAsIndexableText": Whether to use the uploaded content as
  2566. // indexable text.
  2567. func (c *FilesCreateCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesCreateCall {
  2568. c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText))
  2569. return c
  2570. }
  2571. // Media specifies the media to upload in one or more chunks. The chunk
  2572. // size may be controlled by supplying a MediaOption generated by
  2573. // googleapi.ChunkSize. The chunk size defaults to
  2574. // googleapi.DefaultUploadChunkSize.
  2575. // At most one of Media and ResumableMedia may be set.
  2576. func (c *FilesCreateCall) Media(r io.Reader, options ...googleapi.MediaOption) *FilesCreateCall {
  2577. opts := googleapi.ProcessMediaOptions(options)
  2578. chunkSize := opts.ChunkSize
  2579. r, c.mediaType_ = gensupport.DetermineContentType(r, opts.ContentType)
  2580. c.media_, c.resumableBuffer_ = gensupport.PrepareUpload(r, chunkSize)
  2581. return c
  2582. }
  2583. // ResumableMedia specifies the media to upload in chunks and can be
  2584. // canceled with ctx.
  2585. //
  2586. // Deprecated: use Media instead.
  2587. //
  2588. // At most one of Media and ResumableMedia may be set. mediaType
  2589. // identifies the MIME media type of the upload, such as "image/png". If
  2590. // mediaType is "", it will be auto-detected. The provided ctx will
  2591. // supersede any context previously provided to the Context method.
  2592. func (c *FilesCreateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesCreateCall {
  2593. c.ctx_ = ctx
  2594. rdr := gensupport.ReaderAtToReader(r, size)
  2595. rdr, c.mediaType_ = gensupport.DetermineContentType(rdr, mediaType)
  2596. c.resumableBuffer_ = gensupport.NewResumableBuffer(rdr, googleapi.DefaultUploadChunkSize)
  2597. c.media_ = nil
  2598. c.mediaSize_ = size
  2599. return c
  2600. }
  2601. // ProgressUpdater provides a callback function that will be called
  2602. // after every chunk. It should be a low-latency function in order to
  2603. // not slow down the upload operation. This should only be called when
  2604. // using ResumableMedia (as opposed to Media).
  2605. func (c *FilesCreateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesCreateCall {
  2606. c.progressUpdater_ = pu
  2607. return c
  2608. }
  2609. // Fields allows partial responses to be retrieved. See
  2610. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2611. // for more information.
  2612. func (c *FilesCreateCall) Fields(s ...googleapi.Field) *FilesCreateCall {
  2613. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2614. return c
  2615. }
  2616. // Context sets the context to be used in this call's Do method. Any
  2617. // pending HTTP request will be aborted if the provided context is
  2618. // canceled.
  2619. // This context will supersede any context previously provided to the
  2620. // ResumableMedia method.
  2621. func (c *FilesCreateCall) Context(ctx context.Context) *FilesCreateCall {
  2622. c.ctx_ = ctx
  2623. return c
  2624. }
  2625. func (c *FilesCreateCall) doRequest(alt string) (*http.Response, error) {
  2626. var body io.Reader = nil
  2627. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  2628. if err != nil {
  2629. return nil, err
  2630. }
  2631. ctype := "application/json"
  2632. c.urlParams_.Set("alt", alt)
  2633. urls := googleapi.ResolveRelative(c.s.BasePath, "files")
  2634. if c.media_ != nil || c.resumableBuffer_ != nil {
  2635. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  2636. protocol := "multipart"
  2637. if c.resumableBuffer_ != nil {
  2638. protocol = "resumable"
  2639. }
  2640. c.urlParams_.Set("uploadType", protocol)
  2641. }
  2642. urls += "?" + c.urlParams_.Encode()
  2643. if c.media_ != nil {
  2644. var combined io.ReadCloser
  2645. combined, ctype = gensupport.CombineBodyMedia(body, ctype, c.media_, c.mediaType_)
  2646. defer combined.Close()
  2647. body = combined
  2648. }
  2649. req, _ := http.NewRequest("POST", urls, body)
  2650. googleapi.SetOpaque(req.URL)
  2651. if c.resumableBuffer_ != nil {
  2652. req.Header.Set("X-Upload-Content-Type", c.mediaType_)
  2653. }
  2654. req.Header.Set("Content-Type", ctype)
  2655. req.Header.Set("User-Agent", c.s.userAgent())
  2656. if c.ctx_ != nil {
  2657. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2658. }
  2659. return c.s.client.Do(req)
  2660. }
  2661. // Do executes the "drive.files.create" call.
  2662. // Exactly one of *File or error will be non-nil. Any non-2xx status
  2663. // code is an error. Response headers are in either
  2664. // *File.ServerResponse.Header or (if a response was returned at all) in
  2665. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2666. // whether the returned error was because http.StatusNotModified was
  2667. // returned.
  2668. func (c *FilesCreateCall) Do(opts ...googleapi.CallOption) (*File, error) {
  2669. gensupport.SetOptions(c.urlParams_, opts...)
  2670. res, err := gensupport.Retry(c.ctx_, func() (*http.Response, error) {
  2671. return c.doRequest("json")
  2672. }, gensupport.DefaultBackoffStrategy())
  2673. if res != nil && res.StatusCode == http.StatusNotModified {
  2674. if res.Body != nil {
  2675. res.Body.Close()
  2676. }
  2677. return nil, &googleapi.Error{
  2678. Code: res.StatusCode,
  2679. Header: res.Header,
  2680. }
  2681. }
  2682. if err != nil {
  2683. return nil, err
  2684. }
  2685. defer googleapi.CloseBody(res)
  2686. if err := googleapi.CheckResponse(res); err != nil {
  2687. return nil, err
  2688. }
  2689. if c.resumableBuffer_ != nil {
  2690. loc := res.Header.Get("Location")
  2691. rx := &gensupport.ResumableUpload{
  2692. Client: c.s.client,
  2693. UserAgent: c.s.userAgent(),
  2694. URI: loc,
  2695. Media: c.resumableBuffer_,
  2696. MediaType: c.mediaType_,
  2697. Callback: func(curr int64) {
  2698. if c.progressUpdater_ != nil {
  2699. c.progressUpdater_(curr, c.mediaSize_)
  2700. }
  2701. },
  2702. }
  2703. ctx := c.ctx_
  2704. if ctx == nil {
  2705. ctx = context.TODO()
  2706. }
  2707. res, err = rx.Upload(ctx)
  2708. if err != nil {
  2709. return nil, err
  2710. }
  2711. defer res.Body.Close()
  2712. if err := googleapi.CheckResponse(res); err != nil {
  2713. return nil, err
  2714. }
  2715. }
  2716. ret := &File{
  2717. ServerResponse: googleapi.ServerResponse{
  2718. Header: res.Header,
  2719. HTTPStatusCode: res.StatusCode,
  2720. },
  2721. }
  2722. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2723. return nil, err
  2724. }
  2725. return ret, nil
  2726. // {
  2727. // "description": "Creates a new file.",
  2728. // "httpMethod": "POST",
  2729. // "id": "drive.files.create",
  2730. // "mediaUpload": {
  2731. // "accept": [
  2732. // "*/*"
  2733. // ],
  2734. // "maxSize": "5120GB",
  2735. // "protocols": {
  2736. // "resumable": {
  2737. // "multipart": true,
  2738. // "path": "/resumable/upload/drive/v3/files"
  2739. // },
  2740. // "simple": {
  2741. // "multipart": true,
  2742. // "path": "/upload/drive/v3/files"
  2743. // }
  2744. // }
  2745. // },
  2746. // "parameters": {
  2747. // "ignoreDefaultVisibility": {
  2748. // "default": "false",
  2749. // "description": "Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders.",
  2750. // "location": "query",
  2751. // "type": "boolean"
  2752. // },
  2753. // "keepRevisionForever": {
  2754. // "default": "false",
  2755. // "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive.",
  2756. // "location": "query",
  2757. // "type": "boolean"
  2758. // },
  2759. // "ocrLanguage": {
  2760. // "description": "A language hint for OCR processing during image import (ISO 639-1 code).",
  2761. // "location": "query",
  2762. // "type": "string"
  2763. // },
  2764. // "useContentAsIndexableText": {
  2765. // "default": "false",
  2766. // "description": "Whether to use the uploaded content as indexable text.",
  2767. // "location": "query",
  2768. // "type": "boolean"
  2769. // }
  2770. // },
  2771. // "path": "files",
  2772. // "request": {
  2773. // "$ref": "File"
  2774. // },
  2775. // "response": {
  2776. // "$ref": "File"
  2777. // },
  2778. // "scopes": [
  2779. // "https://www.googleapis.com/auth/drive",
  2780. // "https://www.googleapis.com/auth/drive.appdata",
  2781. // "https://www.googleapis.com/auth/drive.file"
  2782. // ],
  2783. // "supportsMediaUpload": true,
  2784. // "supportsSubscription": true
  2785. // }
  2786. }
  2787. // method id "drive.files.delete":
  2788. type FilesDeleteCall struct {
  2789. s *Service
  2790. fileId string
  2791. urlParams_ gensupport.URLParams
  2792. ctx_ context.Context
  2793. }
  2794. // Delete: Permanently deletes a file owned by the user without moving
  2795. // it to the trash. If the target is a folder, all descendants owned by
  2796. // the user are also deleted.
  2797. func (r *FilesService) Delete(fileId string) *FilesDeleteCall {
  2798. c := &FilesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2799. c.fileId = fileId
  2800. return c
  2801. }
  2802. // Fields allows partial responses to be retrieved. See
  2803. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2804. // for more information.
  2805. func (c *FilesDeleteCall) Fields(s ...googleapi.Field) *FilesDeleteCall {
  2806. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2807. return c
  2808. }
  2809. // Context sets the context to be used in this call's Do method. Any
  2810. // pending HTTP request will be aborted if the provided context is
  2811. // canceled.
  2812. func (c *FilesDeleteCall) Context(ctx context.Context) *FilesDeleteCall {
  2813. c.ctx_ = ctx
  2814. return c
  2815. }
  2816. func (c *FilesDeleteCall) doRequest(alt string) (*http.Response, error) {
  2817. var body io.Reader = nil
  2818. c.urlParams_.Set("alt", alt)
  2819. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  2820. urls += "?" + c.urlParams_.Encode()
  2821. req, _ := http.NewRequest("DELETE", urls, body)
  2822. googleapi.Expand(req.URL, map[string]string{
  2823. "fileId": c.fileId,
  2824. })
  2825. req.Header.Set("User-Agent", c.s.userAgent())
  2826. if c.ctx_ != nil {
  2827. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2828. }
  2829. return c.s.client.Do(req)
  2830. }
  2831. // Do executes the "drive.files.delete" call.
  2832. func (c *FilesDeleteCall) Do(opts ...googleapi.CallOption) error {
  2833. gensupport.SetOptions(c.urlParams_, opts...)
  2834. res, err := c.doRequest("json")
  2835. if err != nil {
  2836. return err
  2837. }
  2838. defer googleapi.CloseBody(res)
  2839. if err := googleapi.CheckResponse(res); err != nil {
  2840. return err
  2841. }
  2842. return nil
  2843. // {
  2844. // "description": "Permanently deletes a file owned by the user without moving it to the trash. If the target is a folder, all descendants owned by the user are also deleted.",
  2845. // "httpMethod": "DELETE",
  2846. // "id": "drive.files.delete",
  2847. // "parameterOrder": [
  2848. // "fileId"
  2849. // ],
  2850. // "parameters": {
  2851. // "fileId": {
  2852. // "description": "The ID of the file.",
  2853. // "location": "path",
  2854. // "required": true,
  2855. // "type": "string"
  2856. // }
  2857. // },
  2858. // "path": "files/{fileId}",
  2859. // "scopes": [
  2860. // "https://www.googleapis.com/auth/drive",
  2861. // "https://www.googleapis.com/auth/drive.appdata",
  2862. // "https://www.googleapis.com/auth/drive.file"
  2863. // ]
  2864. // }
  2865. }
  2866. // method id "drive.files.emptyTrash":
  2867. type FilesEmptyTrashCall struct {
  2868. s *Service
  2869. urlParams_ gensupport.URLParams
  2870. ctx_ context.Context
  2871. }
  2872. // EmptyTrash: Permanently deletes all of the user's trashed files.
  2873. func (r *FilesService) EmptyTrash() *FilesEmptyTrashCall {
  2874. c := &FilesEmptyTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2875. return c
  2876. }
  2877. // Fields allows partial responses to be retrieved. See
  2878. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2879. // for more information.
  2880. func (c *FilesEmptyTrashCall) Fields(s ...googleapi.Field) *FilesEmptyTrashCall {
  2881. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2882. return c
  2883. }
  2884. // Context sets the context to be used in this call's Do method. Any
  2885. // pending HTTP request will be aborted if the provided context is
  2886. // canceled.
  2887. func (c *FilesEmptyTrashCall) Context(ctx context.Context) *FilesEmptyTrashCall {
  2888. c.ctx_ = ctx
  2889. return c
  2890. }
  2891. func (c *FilesEmptyTrashCall) doRequest(alt string) (*http.Response, error) {
  2892. var body io.Reader = nil
  2893. c.urlParams_.Set("alt", alt)
  2894. urls := googleapi.ResolveRelative(c.s.BasePath, "files/trash")
  2895. urls += "?" + c.urlParams_.Encode()
  2896. req, _ := http.NewRequest("DELETE", urls, body)
  2897. googleapi.SetOpaque(req.URL)
  2898. req.Header.Set("User-Agent", c.s.userAgent())
  2899. if c.ctx_ != nil {
  2900. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2901. }
  2902. return c.s.client.Do(req)
  2903. }
  2904. // Do executes the "drive.files.emptyTrash" call.
  2905. func (c *FilesEmptyTrashCall) Do(opts ...googleapi.CallOption) error {
  2906. gensupport.SetOptions(c.urlParams_, opts...)
  2907. res, err := c.doRequest("json")
  2908. if err != nil {
  2909. return err
  2910. }
  2911. defer googleapi.CloseBody(res)
  2912. if err := googleapi.CheckResponse(res); err != nil {
  2913. return err
  2914. }
  2915. return nil
  2916. // {
  2917. // "description": "Permanently deletes all of the user's trashed files.",
  2918. // "httpMethod": "DELETE",
  2919. // "id": "drive.files.emptyTrash",
  2920. // "path": "files/trash",
  2921. // "scopes": [
  2922. // "https://www.googleapis.com/auth/drive"
  2923. // ]
  2924. // }
  2925. }
  2926. // method id "drive.files.export":
  2927. type FilesExportCall struct {
  2928. s *Service
  2929. fileId string
  2930. urlParams_ gensupport.URLParams
  2931. ifNoneMatch_ string
  2932. ctx_ context.Context
  2933. }
  2934. // Export: Exports a Google Doc to the requested MIME type.
  2935. func (r *FilesService) Export(fileId string, mimeType string) *FilesExportCall {
  2936. c := &FilesExportCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2937. c.fileId = fileId
  2938. c.urlParams_.Set("mimeType", mimeType)
  2939. return c
  2940. }
  2941. // Fields allows partial responses to be retrieved. See
  2942. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2943. // for more information.
  2944. func (c *FilesExportCall) Fields(s ...googleapi.Field) *FilesExportCall {
  2945. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2946. return c
  2947. }
  2948. // IfNoneMatch sets the optional parameter which makes the operation
  2949. // fail if the object's ETag matches the given value. This is useful for
  2950. // getting updates only after the object has changed since the last
  2951. // request. Use googleapi.IsNotModified to check whether the response
  2952. // error from Do is the result of In-None-Match.
  2953. func (c *FilesExportCall) IfNoneMatch(entityTag string) *FilesExportCall {
  2954. c.ifNoneMatch_ = entityTag
  2955. return c
  2956. }
  2957. // Context sets the context to be used in this call's Do and Download
  2958. // methods. Any pending HTTP request will be aborted if the provided
  2959. // context is canceled.
  2960. func (c *FilesExportCall) Context(ctx context.Context) *FilesExportCall {
  2961. c.ctx_ = ctx
  2962. return c
  2963. }
  2964. func (c *FilesExportCall) doRequest(alt string) (*http.Response, error) {
  2965. var body io.Reader = nil
  2966. c.urlParams_.Set("alt", alt)
  2967. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/export")
  2968. urls += "?" + c.urlParams_.Encode()
  2969. req, _ := http.NewRequest("GET", urls, body)
  2970. googleapi.Expand(req.URL, map[string]string{
  2971. "fileId": c.fileId,
  2972. })
  2973. req.Header.Set("User-Agent", c.s.userAgent())
  2974. if c.ifNoneMatch_ != "" {
  2975. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2976. }
  2977. if c.ctx_ != nil {
  2978. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2979. }
  2980. return c.s.client.Do(req)
  2981. }
  2982. // Download fetches the API endpoint's "media" value, instead of the normal
  2983. // API response value. If the returned error is nil, the Response is guaranteed to
  2984. // have a 2xx status code. Callers must close the Response.Body as usual.
  2985. func (c *FilesExportCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  2986. gensupport.SetOptions(c.urlParams_, opts...)
  2987. res, err := c.doRequest("media")
  2988. if err != nil {
  2989. return nil, err
  2990. }
  2991. if err := googleapi.CheckMediaResponse(res); err != nil {
  2992. res.Body.Close()
  2993. return nil, err
  2994. }
  2995. return res, nil
  2996. }
  2997. // Do executes the "drive.files.export" call.
  2998. func (c *FilesExportCall) Do(opts ...googleapi.CallOption) error {
  2999. gensupport.SetOptions(c.urlParams_, opts...)
  3000. res, err := c.doRequest("json")
  3001. if err != nil {
  3002. return err
  3003. }
  3004. defer googleapi.CloseBody(res)
  3005. if err := googleapi.CheckResponse(res); err != nil {
  3006. return err
  3007. }
  3008. return nil
  3009. // {
  3010. // "description": "Exports a Google Doc to the requested MIME type.",
  3011. // "httpMethod": "GET",
  3012. // "id": "drive.files.export",
  3013. // "parameterOrder": [
  3014. // "fileId",
  3015. // "mimeType"
  3016. // ],
  3017. // "parameters": {
  3018. // "fileId": {
  3019. // "description": "The ID of the file.",
  3020. // "location": "path",
  3021. // "required": true,
  3022. // "type": "string"
  3023. // },
  3024. // "mimeType": {
  3025. // "description": "The MIME type of the format requested for this export.",
  3026. // "location": "query",
  3027. // "required": true,
  3028. // "type": "string"
  3029. // }
  3030. // },
  3031. // "path": "files/{fileId}/export",
  3032. // "scopes": [
  3033. // "https://www.googleapis.com/auth/drive",
  3034. // "https://www.googleapis.com/auth/drive.file",
  3035. // "https://www.googleapis.com/auth/drive.readonly"
  3036. // ],
  3037. // "supportsMediaDownload": true
  3038. // }
  3039. }
  3040. // method id "drive.files.generateIds":
  3041. type FilesGenerateIdsCall struct {
  3042. s *Service
  3043. urlParams_ gensupport.URLParams
  3044. ifNoneMatch_ string
  3045. ctx_ context.Context
  3046. }
  3047. // GenerateIds: Generates a set of file IDs which can be provided in
  3048. // create requests.
  3049. func (r *FilesService) GenerateIds() *FilesGenerateIdsCall {
  3050. c := &FilesGenerateIdsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3051. return c
  3052. }
  3053. // Count sets the optional parameter "count": The number of IDs to
  3054. // return.
  3055. func (c *FilesGenerateIdsCall) Count(count int64) *FilesGenerateIdsCall {
  3056. c.urlParams_.Set("count", fmt.Sprint(count))
  3057. return c
  3058. }
  3059. // Space sets the optional parameter "space": The space in which the IDs
  3060. // can be used to create new files. Supported values are 'drive' and
  3061. // 'appDataFolder'.
  3062. func (c *FilesGenerateIdsCall) Space(space string) *FilesGenerateIdsCall {
  3063. c.urlParams_.Set("space", space)
  3064. return c
  3065. }
  3066. // Fields allows partial responses to be retrieved. See
  3067. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3068. // for more information.
  3069. func (c *FilesGenerateIdsCall) Fields(s ...googleapi.Field) *FilesGenerateIdsCall {
  3070. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3071. return c
  3072. }
  3073. // IfNoneMatch sets the optional parameter which makes the operation
  3074. // fail if the object's ETag matches the given value. This is useful for
  3075. // getting updates only after the object has changed since the last
  3076. // request. Use googleapi.IsNotModified to check whether the response
  3077. // error from Do is the result of In-None-Match.
  3078. func (c *FilesGenerateIdsCall) IfNoneMatch(entityTag string) *FilesGenerateIdsCall {
  3079. c.ifNoneMatch_ = entityTag
  3080. return c
  3081. }
  3082. // Context sets the context to be used in this call's Do method. Any
  3083. // pending HTTP request will be aborted if the provided context is
  3084. // canceled.
  3085. func (c *FilesGenerateIdsCall) Context(ctx context.Context) *FilesGenerateIdsCall {
  3086. c.ctx_ = ctx
  3087. return c
  3088. }
  3089. func (c *FilesGenerateIdsCall) doRequest(alt string) (*http.Response, error) {
  3090. var body io.Reader = nil
  3091. c.urlParams_.Set("alt", alt)
  3092. urls := googleapi.ResolveRelative(c.s.BasePath, "files/generateIds")
  3093. urls += "?" + c.urlParams_.Encode()
  3094. req, _ := http.NewRequest("GET", urls, body)
  3095. googleapi.SetOpaque(req.URL)
  3096. req.Header.Set("User-Agent", c.s.userAgent())
  3097. if c.ifNoneMatch_ != "" {
  3098. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3099. }
  3100. if c.ctx_ != nil {
  3101. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3102. }
  3103. return c.s.client.Do(req)
  3104. }
  3105. // Do executes the "drive.files.generateIds" call.
  3106. // Exactly one of *GeneratedIds or error will be non-nil. Any non-2xx
  3107. // status code is an error. Response headers are in either
  3108. // *GeneratedIds.ServerResponse.Header or (if a response was returned at
  3109. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3110. // to check whether the returned error was because
  3111. // http.StatusNotModified was returned.
  3112. func (c *FilesGenerateIdsCall) Do(opts ...googleapi.CallOption) (*GeneratedIds, error) {
  3113. gensupport.SetOptions(c.urlParams_, opts...)
  3114. res, err := c.doRequest("json")
  3115. if res != nil && res.StatusCode == http.StatusNotModified {
  3116. if res.Body != nil {
  3117. res.Body.Close()
  3118. }
  3119. return nil, &googleapi.Error{
  3120. Code: res.StatusCode,
  3121. Header: res.Header,
  3122. }
  3123. }
  3124. if err != nil {
  3125. return nil, err
  3126. }
  3127. defer googleapi.CloseBody(res)
  3128. if err := googleapi.CheckResponse(res); err != nil {
  3129. return nil, err
  3130. }
  3131. ret := &GeneratedIds{
  3132. ServerResponse: googleapi.ServerResponse{
  3133. Header: res.Header,
  3134. HTTPStatusCode: res.StatusCode,
  3135. },
  3136. }
  3137. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3138. return nil, err
  3139. }
  3140. return ret, nil
  3141. // {
  3142. // "description": "Generates a set of file IDs which can be provided in create requests.",
  3143. // "httpMethod": "GET",
  3144. // "id": "drive.files.generateIds",
  3145. // "parameters": {
  3146. // "count": {
  3147. // "default": "10",
  3148. // "description": "The number of IDs to return.",
  3149. // "format": "int32",
  3150. // "location": "query",
  3151. // "maximum": "1000",
  3152. // "minimum": "1",
  3153. // "type": "integer"
  3154. // },
  3155. // "space": {
  3156. // "default": "drive",
  3157. // "description": "The space in which the IDs can be used to create new files. Supported values are 'drive' and 'appDataFolder'.",
  3158. // "location": "query",
  3159. // "type": "string"
  3160. // }
  3161. // },
  3162. // "path": "files/generateIds",
  3163. // "response": {
  3164. // "$ref": "GeneratedIds"
  3165. // },
  3166. // "scopes": [
  3167. // "https://www.googleapis.com/auth/drive",
  3168. // "https://www.googleapis.com/auth/drive.appdata",
  3169. // "https://www.googleapis.com/auth/drive.file"
  3170. // ]
  3171. // }
  3172. }
  3173. // method id "drive.files.get":
  3174. type FilesGetCall struct {
  3175. s *Service
  3176. fileId string
  3177. urlParams_ gensupport.URLParams
  3178. ifNoneMatch_ string
  3179. ctx_ context.Context
  3180. }
  3181. // Get: Gets a file's metadata or content by ID.
  3182. func (r *FilesService) Get(fileId string) *FilesGetCall {
  3183. c := &FilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3184. c.fileId = fileId
  3185. return c
  3186. }
  3187. // AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse":
  3188. // Whether the user is acknowledging the risk of downloading known
  3189. // malware or other abusive files. This is only applicable when
  3190. // alt=media.
  3191. func (c *FilesGetCall) AcknowledgeAbuse(acknowledgeAbuse bool) *FilesGetCall {
  3192. c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse))
  3193. return c
  3194. }
  3195. // Fields allows partial responses to be retrieved. See
  3196. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3197. // for more information.
  3198. func (c *FilesGetCall) Fields(s ...googleapi.Field) *FilesGetCall {
  3199. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3200. return c
  3201. }
  3202. // IfNoneMatch sets the optional parameter which makes the operation
  3203. // fail if the object's ETag matches the given value. This is useful for
  3204. // getting updates only after the object has changed since the last
  3205. // request. Use googleapi.IsNotModified to check whether the response
  3206. // error from Do is the result of In-None-Match.
  3207. func (c *FilesGetCall) IfNoneMatch(entityTag string) *FilesGetCall {
  3208. c.ifNoneMatch_ = entityTag
  3209. return c
  3210. }
  3211. // Context sets the context to be used in this call's Do and Download
  3212. // methods. Any pending HTTP request will be aborted if the provided
  3213. // context is canceled.
  3214. func (c *FilesGetCall) Context(ctx context.Context) *FilesGetCall {
  3215. c.ctx_ = ctx
  3216. return c
  3217. }
  3218. func (c *FilesGetCall) doRequest(alt string) (*http.Response, error) {
  3219. var body io.Reader = nil
  3220. c.urlParams_.Set("alt", alt)
  3221. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  3222. urls += "?" + c.urlParams_.Encode()
  3223. req, _ := http.NewRequest("GET", urls, body)
  3224. googleapi.Expand(req.URL, map[string]string{
  3225. "fileId": c.fileId,
  3226. })
  3227. req.Header.Set("User-Agent", c.s.userAgent())
  3228. if c.ifNoneMatch_ != "" {
  3229. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3230. }
  3231. if c.ctx_ != nil {
  3232. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3233. }
  3234. return c.s.client.Do(req)
  3235. }
  3236. // Download fetches the API endpoint's "media" value, instead of the normal
  3237. // API response value. If the returned error is nil, the Response is guaranteed to
  3238. // have a 2xx status code. Callers must close the Response.Body as usual.
  3239. func (c *FilesGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  3240. gensupport.SetOptions(c.urlParams_, opts...)
  3241. res, err := c.doRequest("media")
  3242. if err != nil {
  3243. return nil, err
  3244. }
  3245. if err := googleapi.CheckMediaResponse(res); err != nil {
  3246. res.Body.Close()
  3247. return nil, err
  3248. }
  3249. return res, nil
  3250. }
  3251. // Do executes the "drive.files.get" call.
  3252. // Exactly one of *File or error will be non-nil. Any non-2xx status
  3253. // code is an error. Response headers are in either
  3254. // *File.ServerResponse.Header or (if a response was returned at all) in
  3255. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3256. // whether the returned error was because http.StatusNotModified was
  3257. // returned.
  3258. func (c *FilesGetCall) Do(opts ...googleapi.CallOption) (*File, error) {
  3259. gensupport.SetOptions(c.urlParams_, opts...)
  3260. res, err := c.doRequest("json")
  3261. if res != nil && res.StatusCode == http.StatusNotModified {
  3262. if res.Body != nil {
  3263. res.Body.Close()
  3264. }
  3265. return nil, &googleapi.Error{
  3266. Code: res.StatusCode,
  3267. Header: res.Header,
  3268. }
  3269. }
  3270. if err != nil {
  3271. return nil, err
  3272. }
  3273. defer googleapi.CloseBody(res)
  3274. if err := googleapi.CheckResponse(res); err != nil {
  3275. return nil, err
  3276. }
  3277. ret := &File{
  3278. ServerResponse: googleapi.ServerResponse{
  3279. Header: res.Header,
  3280. HTTPStatusCode: res.StatusCode,
  3281. },
  3282. }
  3283. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3284. return nil, err
  3285. }
  3286. return ret, nil
  3287. // {
  3288. // "description": "Gets a file's metadata or content by ID.",
  3289. // "httpMethod": "GET",
  3290. // "id": "drive.files.get",
  3291. // "parameterOrder": [
  3292. // "fileId"
  3293. // ],
  3294. // "parameters": {
  3295. // "acknowledgeAbuse": {
  3296. // "default": "false",
  3297. // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.",
  3298. // "location": "query",
  3299. // "type": "boolean"
  3300. // },
  3301. // "fileId": {
  3302. // "description": "The ID of the file.",
  3303. // "location": "path",
  3304. // "required": true,
  3305. // "type": "string"
  3306. // }
  3307. // },
  3308. // "path": "files/{fileId}",
  3309. // "response": {
  3310. // "$ref": "File"
  3311. // },
  3312. // "scopes": [
  3313. // "https://www.googleapis.com/auth/drive",
  3314. // "https://www.googleapis.com/auth/drive.appdata",
  3315. // "https://www.googleapis.com/auth/drive.file",
  3316. // "https://www.googleapis.com/auth/drive.metadata",
  3317. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  3318. // "https://www.googleapis.com/auth/drive.photos.readonly",
  3319. // "https://www.googleapis.com/auth/drive.readonly"
  3320. // ],
  3321. // "supportsMediaDownload": true,
  3322. // "supportsSubscription": true,
  3323. // "useMediaDownloadService": true
  3324. // }
  3325. }
  3326. // method id "drive.files.list":
  3327. type FilesListCall struct {
  3328. s *Service
  3329. urlParams_ gensupport.URLParams
  3330. ifNoneMatch_ string
  3331. ctx_ context.Context
  3332. }
  3333. // List: Lists or searches files.
  3334. func (r *FilesService) List() *FilesListCall {
  3335. c := &FilesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3336. return c
  3337. }
  3338. // Corpus sets the optional parameter "corpus": The source of files to
  3339. // list.
  3340. //
  3341. // Possible values:
  3342. // "domain" - Files shared to the user's domain.
  3343. // "user" (default) - Files owned by or shared to the user.
  3344. func (c *FilesListCall) Corpus(corpus string) *FilesListCall {
  3345. c.urlParams_.Set("corpus", corpus)
  3346. return c
  3347. }
  3348. // OrderBy sets the optional parameter "orderBy": A comma-separated list
  3349. // of sort keys. Valid keys are 'createdTime', 'folder',
  3350. // 'modifiedByMeTime', 'modifiedTime', 'name', 'quotaBytesUsed',
  3351. // 'recency', 'sharedWithMeTime', 'starred', and 'viewedByMeTime'. Each
  3352. // key sorts ascending by default, but may be reversed with the 'desc'
  3353. // modifier. Example usage: ?orderBy=folder,modifiedTime desc,name.
  3354. // Please note that there is a current limitation for users with
  3355. // approximately one million files in which the requested sort order is
  3356. // ignored.
  3357. func (c *FilesListCall) OrderBy(orderBy string) *FilesListCall {
  3358. c.urlParams_.Set("orderBy", orderBy)
  3359. return c
  3360. }
  3361. // PageSize sets the optional parameter "pageSize": The maximum number
  3362. // of files to return per page.
  3363. func (c *FilesListCall) PageSize(pageSize int64) *FilesListCall {
  3364. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3365. return c
  3366. }
  3367. // PageToken sets the optional parameter "pageToken": The token for
  3368. // continuing a previous list request on the next page. This should be
  3369. // set to the value of 'nextPageToken' from the previous response.
  3370. func (c *FilesListCall) PageToken(pageToken string) *FilesListCall {
  3371. c.urlParams_.Set("pageToken", pageToken)
  3372. return c
  3373. }
  3374. // Q sets the optional parameter "q": A query for filtering the file
  3375. // results. See the "Search for Files" guide for supported syntax.
  3376. func (c *FilesListCall) Q(q string) *FilesListCall {
  3377. c.urlParams_.Set("q", q)
  3378. return c
  3379. }
  3380. // Spaces sets the optional parameter "spaces": A comma-separated list
  3381. // of spaces to query within the corpus. Supported values are 'drive',
  3382. // 'appDataFolder' and 'photos'.
  3383. func (c *FilesListCall) Spaces(spaces string) *FilesListCall {
  3384. c.urlParams_.Set("spaces", spaces)
  3385. return c
  3386. }
  3387. // Fields allows partial responses to be retrieved. See
  3388. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3389. // for more information.
  3390. func (c *FilesListCall) Fields(s ...googleapi.Field) *FilesListCall {
  3391. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3392. return c
  3393. }
  3394. // IfNoneMatch sets the optional parameter which makes the operation
  3395. // fail if the object's ETag matches the given value. This is useful for
  3396. // getting updates only after the object has changed since the last
  3397. // request. Use googleapi.IsNotModified to check whether the response
  3398. // error from Do is the result of In-None-Match.
  3399. func (c *FilesListCall) IfNoneMatch(entityTag string) *FilesListCall {
  3400. c.ifNoneMatch_ = entityTag
  3401. return c
  3402. }
  3403. // Context sets the context to be used in this call's Do method. Any
  3404. // pending HTTP request will be aborted if the provided context is
  3405. // canceled.
  3406. func (c *FilesListCall) Context(ctx context.Context) *FilesListCall {
  3407. c.ctx_ = ctx
  3408. return c
  3409. }
  3410. func (c *FilesListCall) doRequest(alt string) (*http.Response, error) {
  3411. var body io.Reader = nil
  3412. c.urlParams_.Set("alt", alt)
  3413. urls := googleapi.ResolveRelative(c.s.BasePath, "files")
  3414. urls += "?" + c.urlParams_.Encode()
  3415. req, _ := http.NewRequest("GET", urls, body)
  3416. googleapi.SetOpaque(req.URL)
  3417. req.Header.Set("User-Agent", c.s.userAgent())
  3418. if c.ifNoneMatch_ != "" {
  3419. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3420. }
  3421. if c.ctx_ != nil {
  3422. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3423. }
  3424. return c.s.client.Do(req)
  3425. }
  3426. // Do executes the "drive.files.list" call.
  3427. // Exactly one of *FileList or error will be non-nil. Any non-2xx status
  3428. // code is an error. Response headers are in either
  3429. // *FileList.ServerResponse.Header or (if a response was returned at
  3430. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3431. // to check whether the returned error was because
  3432. // http.StatusNotModified was returned.
  3433. func (c *FilesListCall) Do(opts ...googleapi.CallOption) (*FileList, error) {
  3434. gensupport.SetOptions(c.urlParams_, opts...)
  3435. res, err := c.doRequest("json")
  3436. if res != nil && res.StatusCode == http.StatusNotModified {
  3437. if res.Body != nil {
  3438. res.Body.Close()
  3439. }
  3440. return nil, &googleapi.Error{
  3441. Code: res.StatusCode,
  3442. Header: res.Header,
  3443. }
  3444. }
  3445. if err != nil {
  3446. return nil, err
  3447. }
  3448. defer googleapi.CloseBody(res)
  3449. if err := googleapi.CheckResponse(res); err != nil {
  3450. return nil, err
  3451. }
  3452. ret := &FileList{
  3453. ServerResponse: googleapi.ServerResponse{
  3454. Header: res.Header,
  3455. HTTPStatusCode: res.StatusCode,
  3456. },
  3457. }
  3458. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3459. return nil, err
  3460. }
  3461. return ret, nil
  3462. // {
  3463. // "description": "Lists or searches files.",
  3464. // "httpMethod": "GET",
  3465. // "id": "drive.files.list",
  3466. // "parameters": {
  3467. // "corpus": {
  3468. // "default": "user",
  3469. // "description": "The source of files to list.",
  3470. // "enum": [
  3471. // "domain",
  3472. // "user"
  3473. // ],
  3474. // "enumDescriptions": [
  3475. // "Files shared to the user's domain.",
  3476. // "Files owned by or shared to the user."
  3477. // ],
  3478. // "location": "query",
  3479. // "type": "string"
  3480. // },
  3481. // "orderBy": {
  3482. // "description": "A comma-separated list of sort keys. Valid keys are 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime', 'name', 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and 'viewedByMeTime'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedTime desc,name. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.",
  3483. // "location": "query",
  3484. // "type": "string"
  3485. // },
  3486. // "pageSize": {
  3487. // "default": "100",
  3488. // "description": "The maximum number of files to return per page.",
  3489. // "format": "int32",
  3490. // "location": "query",
  3491. // "maximum": "1000",
  3492. // "minimum": "1",
  3493. // "type": "integer"
  3494. // },
  3495. // "pageToken": {
  3496. // "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.",
  3497. // "location": "query",
  3498. // "type": "string"
  3499. // },
  3500. // "q": {
  3501. // "description": "A query for filtering the file results. See the \"Search for Files\" guide for supported syntax.",
  3502. // "location": "query",
  3503. // "type": "string"
  3504. // },
  3505. // "spaces": {
  3506. // "default": "drive",
  3507. // "description": "A comma-separated list of spaces to query within the corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.",
  3508. // "location": "query",
  3509. // "type": "string"
  3510. // }
  3511. // },
  3512. // "path": "files",
  3513. // "response": {
  3514. // "$ref": "FileList"
  3515. // },
  3516. // "scopes": [
  3517. // "https://www.googleapis.com/auth/drive",
  3518. // "https://www.googleapis.com/auth/drive.appdata",
  3519. // "https://www.googleapis.com/auth/drive.file",
  3520. // "https://www.googleapis.com/auth/drive.metadata",
  3521. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  3522. // "https://www.googleapis.com/auth/drive.photos.readonly",
  3523. // "https://www.googleapis.com/auth/drive.readonly"
  3524. // ]
  3525. // }
  3526. }
  3527. // Pages invokes f for each page of results.
  3528. // A non-nil error returned from f will halt the iteration.
  3529. // The provided context supersedes any context provided to the Context method.
  3530. func (c *FilesListCall) Pages(ctx context.Context, f func(*FileList) error) error {
  3531. c.ctx_ = ctx
  3532. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3533. for {
  3534. x, err := c.Do()
  3535. if err != nil {
  3536. return err
  3537. }
  3538. if err := f(x); err != nil {
  3539. return err
  3540. }
  3541. if x.NextPageToken == "" {
  3542. return nil
  3543. }
  3544. c.PageToken(x.NextPageToken)
  3545. }
  3546. }
  3547. // method id "drive.files.update":
  3548. type FilesUpdateCall struct {
  3549. s *Service
  3550. fileId string
  3551. file *File
  3552. urlParams_ gensupport.URLParams
  3553. media_ io.Reader
  3554. resumableBuffer_ *gensupport.ResumableBuffer
  3555. mediaType_ string
  3556. mediaSize_ int64 // mediaSize, if known. Used only for calls to progressUpdater_.
  3557. progressUpdater_ googleapi.ProgressUpdater
  3558. ctx_ context.Context
  3559. }
  3560. // Update: Updates a file's metadata and/or content with patch
  3561. // semantics.
  3562. func (r *FilesService) Update(fileId string, file *File) *FilesUpdateCall {
  3563. c := &FilesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3564. c.fileId = fileId
  3565. c.file = file
  3566. return c
  3567. }
  3568. // AddParents sets the optional parameter "addParents": A
  3569. // comma-separated list of parent IDs to add.
  3570. func (c *FilesUpdateCall) AddParents(addParents string) *FilesUpdateCall {
  3571. c.urlParams_.Set("addParents", addParents)
  3572. return c
  3573. }
  3574. // KeepRevisionForever sets the optional parameter
  3575. // "keepRevisionForever": Whether to set the 'keepForever' field in the
  3576. // new head revision. This is only applicable to files with binary
  3577. // content in Drive.
  3578. func (c *FilesUpdateCall) KeepRevisionForever(keepRevisionForever bool) *FilesUpdateCall {
  3579. c.urlParams_.Set("keepRevisionForever", fmt.Sprint(keepRevisionForever))
  3580. return c
  3581. }
  3582. // OcrLanguage sets the optional parameter "ocrLanguage": A language
  3583. // hint for OCR processing during image import (ISO 639-1 code).
  3584. func (c *FilesUpdateCall) OcrLanguage(ocrLanguage string) *FilesUpdateCall {
  3585. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  3586. return c
  3587. }
  3588. // RemoveParents sets the optional parameter "removeParents": A
  3589. // comma-separated list of parent IDs to remove.
  3590. func (c *FilesUpdateCall) RemoveParents(removeParents string) *FilesUpdateCall {
  3591. c.urlParams_.Set("removeParents", removeParents)
  3592. return c
  3593. }
  3594. // UseContentAsIndexableText sets the optional parameter
  3595. // "useContentAsIndexableText": Whether to use the uploaded content as
  3596. // indexable text.
  3597. func (c *FilesUpdateCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesUpdateCall {
  3598. c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText))
  3599. return c
  3600. }
  3601. // Media specifies the media to upload in one or more chunks. The chunk
  3602. // size may be controlled by supplying a MediaOption generated by
  3603. // googleapi.ChunkSize. The chunk size defaults to
  3604. // googleapi.DefaultUploadChunkSize.
  3605. // At most one of Media and ResumableMedia may be set.
  3606. func (c *FilesUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *FilesUpdateCall {
  3607. opts := googleapi.ProcessMediaOptions(options)
  3608. chunkSize := opts.ChunkSize
  3609. r, c.mediaType_ = gensupport.DetermineContentType(r, opts.ContentType)
  3610. c.media_, c.resumableBuffer_ = gensupport.PrepareUpload(r, chunkSize)
  3611. return c
  3612. }
  3613. // ResumableMedia specifies the media to upload in chunks and can be
  3614. // canceled with ctx.
  3615. //
  3616. // Deprecated: use Media instead.
  3617. //
  3618. // At most one of Media and ResumableMedia may be set. mediaType
  3619. // identifies the MIME media type of the upload, such as "image/png". If
  3620. // mediaType is "", it will be auto-detected. The provided ctx will
  3621. // supersede any context previously provided to the Context method.
  3622. func (c *FilesUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesUpdateCall {
  3623. c.ctx_ = ctx
  3624. rdr := gensupport.ReaderAtToReader(r, size)
  3625. rdr, c.mediaType_ = gensupport.DetermineContentType(rdr, mediaType)
  3626. c.resumableBuffer_ = gensupport.NewResumableBuffer(rdr, googleapi.DefaultUploadChunkSize)
  3627. c.media_ = nil
  3628. c.mediaSize_ = size
  3629. return c
  3630. }
  3631. // ProgressUpdater provides a callback function that will be called
  3632. // after every chunk. It should be a low-latency function in order to
  3633. // not slow down the upload operation. This should only be called when
  3634. // using ResumableMedia (as opposed to Media).
  3635. func (c *FilesUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesUpdateCall {
  3636. c.progressUpdater_ = pu
  3637. return c
  3638. }
  3639. // Fields allows partial responses to be retrieved. See
  3640. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3641. // for more information.
  3642. func (c *FilesUpdateCall) Fields(s ...googleapi.Field) *FilesUpdateCall {
  3643. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3644. return c
  3645. }
  3646. // Context sets the context to be used in this call's Do method. Any
  3647. // pending HTTP request will be aborted if the provided context is
  3648. // canceled.
  3649. // This context will supersede any context previously provided to the
  3650. // ResumableMedia method.
  3651. func (c *FilesUpdateCall) Context(ctx context.Context) *FilesUpdateCall {
  3652. c.ctx_ = ctx
  3653. return c
  3654. }
  3655. func (c *FilesUpdateCall) doRequest(alt string) (*http.Response, error) {
  3656. var body io.Reader = nil
  3657. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  3658. if err != nil {
  3659. return nil, err
  3660. }
  3661. ctype := "application/json"
  3662. c.urlParams_.Set("alt", alt)
  3663. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  3664. if c.media_ != nil || c.resumableBuffer_ != nil {
  3665. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  3666. protocol := "multipart"
  3667. if c.resumableBuffer_ != nil {
  3668. protocol = "resumable"
  3669. }
  3670. c.urlParams_.Set("uploadType", protocol)
  3671. }
  3672. urls += "?" + c.urlParams_.Encode()
  3673. if c.media_ != nil {
  3674. var combined io.ReadCloser
  3675. combined, ctype = gensupport.CombineBodyMedia(body, ctype, c.media_, c.mediaType_)
  3676. defer combined.Close()
  3677. body = combined
  3678. }
  3679. req, _ := http.NewRequest("PATCH", urls, body)
  3680. googleapi.Expand(req.URL, map[string]string{
  3681. "fileId": c.fileId,
  3682. })
  3683. if c.resumableBuffer_ != nil {
  3684. req.Header.Set("X-Upload-Content-Type", c.mediaType_)
  3685. }
  3686. req.Header.Set("Content-Type", ctype)
  3687. req.Header.Set("User-Agent", c.s.userAgent())
  3688. if c.ctx_ != nil {
  3689. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3690. }
  3691. return c.s.client.Do(req)
  3692. }
  3693. // Do executes the "drive.files.update" call.
  3694. // Exactly one of *File or error will be non-nil. Any non-2xx status
  3695. // code is an error. Response headers are in either
  3696. // *File.ServerResponse.Header or (if a response was returned at all) in
  3697. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3698. // whether the returned error was because http.StatusNotModified was
  3699. // returned.
  3700. func (c *FilesUpdateCall) Do(opts ...googleapi.CallOption) (*File, error) {
  3701. gensupport.SetOptions(c.urlParams_, opts...)
  3702. res, err := gensupport.Retry(c.ctx_, func() (*http.Response, error) {
  3703. return c.doRequest("json")
  3704. }, gensupport.DefaultBackoffStrategy())
  3705. if res != nil && res.StatusCode == http.StatusNotModified {
  3706. if res.Body != nil {
  3707. res.Body.Close()
  3708. }
  3709. return nil, &googleapi.Error{
  3710. Code: res.StatusCode,
  3711. Header: res.Header,
  3712. }
  3713. }
  3714. if err != nil {
  3715. return nil, err
  3716. }
  3717. defer googleapi.CloseBody(res)
  3718. if err := googleapi.CheckResponse(res); err != nil {
  3719. return nil, err
  3720. }
  3721. if c.resumableBuffer_ != nil {
  3722. loc := res.Header.Get("Location")
  3723. rx := &gensupport.ResumableUpload{
  3724. Client: c.s.client,
  3725. UserAgent: c.s.userAgent(),
  3726. URI: loc,
  3727. Media: c.resumableBuffer_,
  3728. MediaType: c.mediaType_,
  3729. Callback: func(curr int64) {
  3730. if c.progressUpdater_ != nil {
  3731. c.progressUpdater_(curr, c.mediaSize_)
  3732. }
  3733. },
  3734. }
  3735. ctx := c.ctx_
  3736. if ctx == nil {
  3737. ctx = context.TODO()
  3738. }
  3739. res, err = rx.Upload(ctx)
  3740. if err != nil {
  3741. return nil, err
  3742. }
  3743. defer res.Body.Close()
  3744. if err := googleapi.CheckResponse(res); err != nil {
  3745. return nil, err
  3746. }
  3747. }
  3748. ret := &File{
  3749. ServerResponse: googleapi.ServerResponse{
  3750. Header: res.Header,
  3751. HTTPStatusCode: res.StatusCode,
  3752. },
  3753. }
  3754. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3755. return nil, err
  3756. }
  3757. return ret, nil
  3758. // {
  3759. // "description": "Updates a file's metadata and/or content with patch semantics.",
  3760. // "httpMethod": "PATCH",
  3761. // "id": "drive.files.update",
  3762. // "mediaUpload": {
  3763. // "accept": [
  3764. // "*/*"
  3765. // ],
  3766. // "maxSize": "5120GB",
  3767. // "protocols": {
  3768. // "resumable": {
  3769. // "multipart": true,
  3770. // "path": "/resumable/upload/drive/v3/files/{fileId}"
  3771. // },
  3772. // "simple": {
  3773. // "multipart": true,
  3774. // "path": "/upload/drive/v3/files/{fileId}"
  3775. // }
  3776. // }
  3777. // },
  3778. // "parameterOrder": [
  3779. // "fileId"
  3780. // ],
  3781. // "parameters": {
  3782. // "addParents": {
  3783. // "description": "A comma-separated list of parent IDs to add.",
  3784. // "location": "query",
  3785. // "type": "string"
  3786. // },
  3787. // "fileId": {
  3788. // "description": "The ID of the file.",
  3789. // "location": "path",
  3790. // "required": true,
  3791. // "type": "string"
  3792. // },
  3793. // "keepRevisionForever": {
  3794. // "default": "false",
  3795. // "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive.",
  3796. // "location": "query",
  3797. // "type": "boolean"
  3798. // },
  3799. // "ocrLanguage": {
  3800. // "description": "A language hint for OCR processing during image import (ISO 639-1 code).",
  3801. // "location": "query",
  3802. // "type": "string"
  3803. // },
  3804. // "removeParents": {
  3805. // "description": "A comma-separated list of parent IDs to remove.",
  3806. // "location": "query",
  3807. // "type": "string"
  3808. // },
  3809. // "useContentAsIndexableText": {
  3810. // "default": "false",
  3811. // "description": "Whether to use the uploaded content as indexable text.",
  3812. // "location": "query",
  3813. // "type": "boolean"
  3814. // }
  3815. // },
  3816. // "path": "files/{fileId}",
  3817. // "request": {
  3818. // "$ref": "File"
  3819. // },
  3820. // "response": {
  3821. // "$ref": "File"
  3822. // },
  3823. // "scopes": [
  3824. // "https://www.googleapis.com/auth/drive",
  3825. // "https://www.googleapis.com/auth/drive.appdata",
  3826. // "https://www.googleapis.com/auth/drive.file",
  3827. // "https://www.googleapis.com/auth/drive.metadata",
  3828. // "https://www.googleapis.com/auth/drive.scripts"
  3829. // ],
  3830. // "supportsMediaUpload": true
  3831. // }
  3832. }
  3833. // method id "drive.files.watch":
  3834. type FilesWatchCall struct {
  3835. s *Service
  3836. fileId string
  3837. channel *Channel
  3838. urlParams_ gensupport.URLParams
  3839. ctx_ context.Context
  3840. }
  3841. // Watch: Subscribes to changes to a file
  3842. func (r *FilesService) Watch(fileId string, channel *Channel) *FilesWatchCall {
  3843. c := &FilesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3844. c.fileId = fileId
  3845. c.channel = channel
  3846. return c
  3847. }
  3848. // AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse":
  3849. // Whether the user is acknowledging the risk of downloading known
  3850. // malware or other abusive files. This is only applicable when
  3851. // alt=media.
  3852. func (c *FilesWatchCall) AcknowledgeAbuse(acknowledgeAbuse bool) *FilesWatchCall {
  3853. c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse))
  3854. return c
  3855. }
  3856. // Fields allows partial responses to be retrieved. See
  3857. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3858. // for more information.
  3859. func (c *FilesWatchCall) Fields(s ...googleapi.Field) *FilesWatchCall {
  3860. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3861. return c
  3862. }
  3863. // Context sets the context to be used in this call's Do and Download
  3864. // methods. Any pending HTTP request will be aborted if the provided
  3865. // context is canceled.
  3866. func (c *FilesWatchCall) Context(ctx context.Context) *FilesWatchCall {
  3867. c.ctx_ = ctx
  3868. return c
  3869. }
  3870. func (c *FilesWatchCall) doRequest(alt string) (*http.Response, error) {
  3871. var body io.Reader = nil
  3872. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  3873. if err != nil {
  3874. return nil, err
  3875. }
  3876. ctype := "application/json"
  3877. c.urlParams_.Set("alt", alt)
  3878. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/watch")
  3879. urls += "?" + c.urlParams_.Encode()
  3880. req, _ := http.NewRequest("POST", urls, body)
  3881. googleapi.Expand(req.URL, map[string]string{
  3882. "fileId": c.fileId,
  3883. })
  3884. req.Header.Set("Content-Type", ctype)
  3885. req.Header.Set("User-Agent", c.s.userAgent())
  3886. if c.ctx_ != nil {
  3887. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3888. }
  3889. return c.s.client.Do(req)
  3890. }
  3891. // Download fetches the API endpoint's "media" value, instead of the normal
  3892. // API response value. If the returned error is nil, the Response is guaranteed to
  3893. // have a 2xx status code. Callers must close the Response.Body as usual.
  3894. func (c *FilesWatchCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  3895. gensupport.SetOptions(c.urlParams_, opts...)
  3896. res, err := c.doRequest("media")
  3897. if err != nil {
  3898. return nil, err
  3899. }
  3900. if err := googleapi.CheckMediaResponse(res); err != nil {
  3901. res.Body.Close()
  3902. return nil, err
  3903. }
  3904. return res, nil
  3905. }
  3906. // Do executes the "drive.files.watch" call.
  3907. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  3908. // code is an error. Response headers are in either
  3909. // *Channel.ServerResponse.Header or (if a response was returned at all)
  3910. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3911. // check whether the returned error was because http.StatusNotModified
  3912. // was returned.
  3913. func (c *FilesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  3914. gensupport.SetOptions(c.urlParams_, opts...)
  3915. res, err := c.doRequest("json")
  3916. if res != nil && res.StatusCode == http.StatusNotModified {
  3917. if res.Body != nil {
  3918. res.Body.Close()
  3919. }
  3920. return nil, &googleapi.Error{
  3921. Code: res.StatusCode,
  3922. Header: res.Header,
  3923. }
  3924. }
  3925. if err != nil {
  3926. return nil, err
  3927. }
  3928. defer googleapi.CloseBody(res)
  3929. if err := googleapi.CheckResponse(res); err != nil {
  3930. return nil, err
  3931. }
  3932. ret := &Channel{
  3933. ServerResponse: googleapi.ServerResponse{
  3934. Header: res.Header,
  3935. HTTPStatusCode: res.StatusCode,
  3936. },
  3937. }
  3938. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3939. return nil, err
  3940. }
  3941. return ret, nil
  3942. // {
  3943. // "description": "Subscribes to changes to a file",
  3944. // "httpMethod": "POST",
  3945. // "id": "drive.files.watch",
  3946. // "parameterOrder": [
  3947. // "fileId"
  3948. // ],
  3949. // "parameters": {
  3950. // "acknowledgeAbuse": {
  3951. // "default": "false",
  3952. // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.",
  3953. // "location": "query",
  3954. // "type": "boolean"
  3955. // },
  3956. // "fileId": {
  3957. // "description": "The ID of the file.",
  3958. // "location": "path",
  3959. // "required": true,
  3960. // "type": "string"
  3961. // }
  3962. // },
  3963. // "path": "files/{fileId}/watch",
  3964. // "request": {
  3965. // "$ref": "Channel",
  3966. // "parameterName": "resource"
  3967. // },
  3968. // "response": {
  3969. // "$ref": "Channel"
  3970. // },
  3971. // "scopes": [
  3972. // "https://www.googleapis.com/auth/drive",
  3973. // "https://www.googleapis.com/auth/drive.appdata",
  3974. // "https://www.googleapis.com/auth/drive.file",
  3975. // "https://www.googleapis.com/auth/drive.metadata",
  3976. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  3977. // "https://www.googleapis.com/auth/drive.photos.readonly",
  3978. // "https://www.googleapis.com/auth/drive.readonly"
  3979. // ],
  3980. // "supportsMediaDownload": true,
  3981. // "supportsSubscription": true,
  3982. // "useMediaDownloadService": true
  3983. // }
  3984. }
  3985. // method id "drive.permissions.create":
  3986. type PermissionsCreateCall struct {
  3987. s *Service
  3988. fileId string
  3989. permission *Permission
  3990. urlParams_ gensupport.URLParams
  3991. ctx_ context.Context
  3992. }
  3993. // Create: Creates a permission for a file.
  3994. func (r *PermissionsService) Create(fileId string, permission *Permission) *PermissionsCreateCall {
  3995. c := &PermissionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3996. c.fileId = fileId
  3997. c.permission = permission
  3998. return c
  3999. }
  4000. // EmailMessage sets the optional parameter "emailMessage": A custom
  4001. // message to include in the notification email.
  4002. func (c *PermissionsCreateCall) EmailMessage(emailMessage string) *PermissionsCreateCall {
  4003. c.urlParams_.Set("emailMessage", emailMessage)
  4004. return c
  4005. }
  4006. // SendNotificationEmail sets the optional parameter
  4007. // "sendNotificationEmail": Whether to send a notification email when
  4008. // sharing to users or groups. This defaults to true for users and
  4009. // groups, and is not allowed for other requests. It must not be
  4010. // disabled for ownership transfers.
  4011. func (c *PermissionsCreateCall) SendNotificationEmail(sendNotificationEmail bool) *PermissionsCreateCall {
  4012. c.urlParams_.Set("sendNotificationEmail", fmt.Sprint(sendNotificationEmail))
  4013. return c
  4014. }
  4015. // TransferOwnership sets the optional parameter "transferOwnership":
  4016. // Whether to transfer ownership to the specified user and downgrade the
  4017. // current owner to a writer. This parameter is required as an
  4018. // acknowledgement of the side effect.
  4019. func (c *PermissionsCreateCall) TransferOwnership(transferOwnership bool) *PermissionsCreateCall {
  4020. c.urlParams_.Set("transferOwnership", fmt.Sprint(transferOwnership))
  4021. return c
  4022. }
  4023. // Fields allows partial responses to be retrieved. See
  4024. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4025. // for more information.
  4026. func (c *PermissionsCreateCall) Fields(s ...googleapi.Field) *PermissionsCreateCall {
  4027. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4028. return c
  4029. }
  4030. // Context sets the context to be used in this call's Do method. Any
  4031. // pending HTTP request will be aborted if the provided context is
  4032. // canceled.
  4033. func (c *PermissionsCreateCall) Context(ctx context.Context) *PermissionsCreateCall {
  4034. c.ctx_ = ctx
  4035. return c
  4036. }
  4037. func (c *PermissionsCreateCall) doRequest(alt string) (*http.Response, error) {
  4038. var body io.Reader = nil
  4039. body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission)
  4040. if err != nil {
  4041. return nil, err
  4042. }
  4043. ctype := "application/json"
  4044. c.urlParams_.Set("alt", alt)
  4045. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions")
  4046. urls += "?" + c.urlParams_.Encode()
  4047. req, _ := http.NewRequest("POST", urls, body)
  4048. googleapi.Expand(req.URL, map[string]string{
  4049. "fileId": c.fileId,
  4050. })
  4051. req.Header.Set("Content-Type", ctype)
  4052. req.Header.Set("User-Agent", c.s.userAgent())
  4053. if c.ctx_ != nil {
  4054. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4055. }
  4056. return c.s.client.Do(req)
  4057. }
  4058. // Do executes the "drive.permissions.create" call.
  4059. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  4060. // status code is an error. Response headers are in either
  4061. // *Permission.ServerResponse.Header or (if a response was returned at
  4062. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4063. // to check whether the returned error was because
  4064. // http.StatusNotModified was returned.
  4065. func (c *PermissionsCreateCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  4066. gensupport.SetOptions(c.urlParams_, opts...)
  4067. res, err := c.doRequest("json")
  4068. if res != nil && res.StatusCode == http.StatusNotModified {
  4069. if res.Body != nil {
  4070. res.Body.Close()
  4071. }
  4072. return nil, &googleapi.Error{
  4073. Code: res.StatusCode,
  4074. Header: res.Header,
  4075. }
  4076. }
  4077. if err != nil {
  4078. return nil, err
  4079. }
  4080. defer googleapi.CloseBody(res)
  4081. if err := googleapi.CheckResponse(res); err != nil {
  4082. return nil, err
  4083. }
  4084. ret := &Permission{
  4085. ServerResponse: googleapi.ServerResponse{
  4086. Header: res.Header,
  4087. HTTPStatusCode: res.StatusCode,
  4088. },
  4089. }
  4090. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4091. return nil, err
  4092. }
  4093. return ret, nil
  4094. // {
  4095. // "description": "Creates a permission for a file.",
  4096. // "httpMethod": "POST",
  4097. // "id": "drive.permissions.create",
  4098. // "parameterOrder": [
  4099. // "fileId"
  4100. // ],
  4101. // "parameters": {
  4102. // "emailMessage": {
  4103. // "description": "A custom message to include in the notification email.",
  4104. // "location": "query",
  4105. // "type": "string"
  4106. // },
  4107. // "fileId": {
  4108. // "description": "The ID of the file.",
  4109. // "location": "path",
  4110. // "required": true,
  4111. // "type": "string"
  4112. // },
  4113. // "sendNotificationEmail": {
  4114. // "description": "Whether to send a notification email when sharing to users or groups. This defaults to true for users and groups, and is not allowed for other requests. It must not be disabled for ownership transfers.",
  4115. // "location": "query",
  4116. // "type": "boolean"
  4117. // },
  4118. // "transferOwnership": {
  4119. // "default": "false",
  4120. // "description": "Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect.",
  4121. // "location": "query",
  4122. // "type": "boolean"
  4123. // }
  4124. // },
  4125. // "path": "files/{fileId}/permissions",
  4126. // "request": {
  4127. // "$ref": "Permission"
  4128. // },
  4129. // "response": {
  4130. // "$ref": "Permission"
  4131. // },
  4132. // "scopes": [
  4133. // "https://www.googleapis.com/auth/drive",
  4134. // "https://www.googleapis.com/auth/drive.file"
  4135. // ]
  4136. // }
  4137. }
  4138. // method id "drive.permissions.delete":
  4139. type PermissionsDeleteCall struct {
  4140. s *Service
  4141. fileId string
  4142. permissionId string
  4143. urlParams_ gensupport.URLParams
  4144. ctx_ context.Context
  4145. }
  4146. // Delete: Deletes a permission.
  4147. func (r *PermissionsService) Delete(fileId string, permissionId string) *PermissionsDeleteCall {
  4148. c := &PermissionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4149. c.fileId = fileId
  4150. c.permissionId = permissionId
  4151. return c
  4152. }
  4153. // Fields allows partial responses to be retrieved. See
  4154. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4155. // for more information.
  4156. func (c *PermissionsDeleteCall) Fields(s ...googleapi.Field) *PermissionsDeleteCall {
  4157. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4158. return c
  4159. }
  4160. // Context sets the context to be used in this call's Do method. Any
  4161. // pending HTTP request will be aborted if the provided context is
  4162. // canceled.
  4163. func (c *PermissionsDeleteCall) Context(ctx context.Context) *PermissionsDeleteCall {
  4164. c.ctx_ = ctx
  4165. return c
  4166. }
  4167. func (c *PermissionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4168. var body io.Reader = nil
  4169. c.urlParams_.Set("alt", alt)
  4170. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  4171. urls += "?" + c.urlParams_.Encode()
  4172. req, _ := http.NewRequest("DELETE", urls, body)
  4173. googleapi.Expand(req.URL, map[string]string{
  4174. "fileId": c.fileId,
  4175. "permissionId": c.permissionId,
  4176. })
  4177. req.Header.Set("User-Agent", c.s.userAgent())
  4178. if c.ctx_ != nil {
  4179. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4180. }
  4181. return c.s.client.Do(req)
  4182. }
  4183. // Do executes the "drive.permissions.delete" call.
  4184. func (c *PermissionsDeleteCall) Do(opts ...googleapi.CallOption) error {
  4185. gensupport.SetOptions(c.urlParams_, opts...)
  4186. res, err := c.doRequest("json")
  4187. if err != nil {
  4188. return err
  4189. }
  4190. defer googleapi.CloseBody(res)
  4191. if err := googleapi.CheckResponse(res); err != nil {
  4192. return err
  4193. }
  4194. return nil
  4195. // {
  4196. // "description": "Deletes a permission.",
  4197. // "httpMethod": "DELETE",
  4198. // "id": "drive.permissions.delete",
  4199. // "parameterOrder": [
  4200. // "fileId",
  4201. // "permissionId"
  4202. // ],
  4203. // "parameters": {
  4204. // "fileId": {
  4205. // "description": "The ID of the file.",
  4206. // "location": "path",
  4207. // "required": true,
  4208. // "type": "string"
  4209. // },
  4210. // "permissionId": {
  4211. // "description": "The ID of the permission.",
  4212. // "location": "path",
  4213. // "required": true,
  4214. // "type": "string"
  4215. // }
  4216. // },
  4217. // "path": "files/{fileId}/permissions/{permissionId}",
  4218. // "scopes": [
  4219. // "https://www.googleapis.com/auth/drive",
  4220. // "https://www.googleapis.com/auth/drive.file"
  4221. // ]
  4222. // }
  4223. }
  4224. // method id "drive.permissions.get":
  4225. type PermissionsGetCall struct {
  4226. s *Service
  4227. fileId string
  4228. permissionId string
  4229. urlParams_ gensupport.URLParams
  4230. ifNoneMatch_ string
  4231. ctx_ context.Context
  4232. }
  4233. // Get: Gets a permission by ID.
  4234. func (r *PermissionsService) Get(fileId string, permissionId string) *PermissionsGetCall {
  4235. c := &PermissionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4236. c.fileId = fileId
  4237. c.permissionId = permissionId
  4238. return c
  4239. }
  4240. // Fields allows partial responses to be retrieved. See
  4241. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4242. // for more information.
  4243. func (c *PermissionsGetCall) Fields(s ...googleapi.Field) *PermissionsGetCall {
  4244. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4245. return c
  4246. }
  4247. // IfNoneMatch sets the optional parameter which makes the operation
  4248. // fail if the object's ETag matches the given value. This is useful for
  4249. // getting updates only after the object has changed since the last
  4250. // request. Use googleapi.IsNotModified to check whether the response
  4251. // error from Do is the result of In-None-Match.
  4252. func (c *PermissionsGetCall) IfNoneMatch(entityTag string) *PermissionsGetCall {
  4253. c.ifNoneMatch_ = entityTag
  4254. return c
  4255. }
  4256. // Context sets the context to be used in this call's Do method. Any
  4257. // pending HTTP request will be aborted if the provided context is
  4258. // canceled.
  4259. func (c *PermissionsGetCall) Context(ctx context.Context) *PermissionsGetCall {
  4260. c.ctx_ = ctx
  4261. return c
  4262. }
  4263. func (c *PermissionsGetCall) doRequest(alt string) (*http.Response, error) {
  4264. var body io.Reader = nil
  4265. c.urlParams_.Set("alt", alt)
  4266. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  4267. urls += "?" + c.urlParams_.Encode()
  4268. req, _ := http.NewRequest("GET", urls, body)
  4269. googleapi.Expand(req.URL, map[string]string{
  4270. "fileId": c.fileId,
  4271. "permissionId": c.permissionId,
  4272. })
  4273. req.Header.Set("User-Agent", c.s.userAgent())
  4274. if c.ifNoneMatch_ != "" {
  4275. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4276. }
  4277. if c.ctx_ != nil {
  4278. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4279. }
  4280. return c.s.client.Do(req)
  4281. }
  4282. // Do executes the "drive.permissions.get" call.
  4283. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  4284. // status code is an error. Response headers are in either
  4285. // *Permission.ServerResponse.Header or (if a response was returned at
  4286. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4287. // to check whether the returned error was because
  4288. // http.StatusNotModified was returned.
  4289. func (c *PermissionsGetCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  4290. gensupport.SetOptions(c.urlParams_, opts...)
  4291. res, err := c.doRequest("json")
  4292. if res != nil && res.StatusCode == http.StatusNotModified {
  4293. if res.Body != nil {
  4294. res.Body.Close()
  4295. }
  4296. return nil, &googleapi.Error{
  4297. Code: res.StatusCode,
  4298. Header: res.Header,
  4299. }
  4300. }
  4301. if err != nil {
  4302. return nil, err
  4303. }
  4304. defer googleapi.CloseBody(res)
  4305. if err := googleapi.CheckResponse(res); err != nil {
  4306. return nil, err
  4307. }
  4308. ret := &Permission{
  4309. ServerResponse: googleapi.ServerResponse{
  4310. Header: res.Header,
  4311. HTTPStatusCode: res.StatusCode,
  4312. },
  4313. }
  4314. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4315. return nil, err
  4316. }
  4317. return ret, nil
  4318. // {
  4319. // "description": "Gets a permission by ID.",
  4320. // "httpMethod": "GET",
  4321. // "id": "drive.permissions.get",
  4322. // "parameterOrder": [
  4323. // "fileId",
  4324. // "permissionId"
  4325. // ],
  4326. // "parameters": {
  4327. // "fileId": {
  4328. // "description": "The ID of the file.",
  4329. // "location": "path",
  4330. // "required": true,
  4331. // "type": "string"
  4332. // },
  4333. // "permissionId": {
  4334. // "description": "The ID of the permission.",
  4335. // "location": "path",
  4336. // "required": true,
  4337. // "type": "string"
  4338. // }
  4339. // },
  4340. // "path": "files/{fileId}/permissions/{permissionId}",
  4341. // "response": {
  4342. // "$ref": "Permission"
  4343. // },
  4344. // "scopes": [
  4345. // "https://www.googleapis.com/auth/drive",
  4346. // "https://www.googleapis.com/auth/drive.file",
  4347. // "https://www.googleapis.com/auth/drive.metadata",
  4348. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  4349. // "https://www.googleapis.com/auth/drive.photos.readonly",
  4350. // "https://www.googleapis.com/auth/drive.readonly"
  4351. // ]
  4352. // }
  4353. }
  4354. // method id "drive.permissions.list":
  4355. type PermissionsListCall struct {
  4356. s *Service
  4357. fileId string
  4358. urlParams_ gensupport.URLParams
  4359. ifNoneMatch_ string
  4360. ctx_ context.Context
  4361. }
  4362. // List: Lists a file's permissions.
  4363. func (r *PermissionsService) List(fileId string) *PermissionsListCall {
  4364. c := &PermissionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4365. c.fileId = fileId
  4366. return c
  4367. }
  4368. // Fields allows partial responses to be retrieved. See
  4369. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4370. // for more information.
  4371. func (c *PermissionsListCall) Fields(s ...googleapi.Field) *PermissionsListCall {
  4372. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4373. return c
  4374. }
  4375. // IfNoneMatch sets the optional parameter which makes the operation
  4376. // fail if the object's ETag matches the given value. This is useful for
  4377. // getting updates only after the object has changed since the last
  4378. // request. Use googleapi.IsNotModified to check whether the response
  4379. // error from Do is the result of In-None-Match.
  4380. func (c *PermissionsListCall) IfNoneMatch(entityTag string) *PermissionsListCall {
  4381. c.ifNoneMatch_ = entityTag
  4382. return c
  4383. }
  4384. // Context sets the context to be used in this call's Do method. Any
  4385. // pending HTTP request will be aborted if the provided context is
  4386. // canceled.
  4387. func (c *PermissionsListCall) Context(ctx context.Context) *PermissionsListCall {
  4388. c.ctx_ = ctx
  4389. return c
  4390. }
  4391. func (c *PermissionsListCall) doRequest(alt string) (*http.Response, error) {
  4392. var body io.Reader = nil
  4393. c.urlParams_.Set("alt", alt)
  4394. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions")
  4395. urls += "?" + c.urlParams_.Encode()
  4396. req, _ := http.NewRequest("GET", urls, body)
  4397. googleapi.Expand(req.URL, map[string]string{
  4398. "fileId": c.fileId,
  4399. })
  4400. req.Header.Set("User-Agent", c.s.userAgent())
  4401. if c.ifNoneMatch_ != "" {
  4402. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4403. }
  4404. if c.ctx_ != nil {
  4405. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4406. }
  4407. return c.s.client.Do(req)
  4408. }
  4409. // Do executes the "drive.permissions.list" call.
  4410. // Exactly one of *PermissionList or error will be non-nil. Any non-2xx
  4411. // status code is an error. Response headers are in either
  4412. // *PermissionList.ServerResponse.Header or (if a response was returned
  4413. // at all) in error.(*googleapi.Error).Header. Use
  4414. // googleapi.IsNotModified to check whether the returned error was
  4415. // because http.StatusNotModified was returned.
  4416. func (c *PermissionsListCall) Do(opts ...googleapi.CallOption) (*PermissionList, error) {
  4417. gensupport.SetOptions(c.urlParams_, opts...)
  4418. res, err := c.doRequest("json")
  4419. if res != nil && res.StatusCode == http.StatusNotModified {
  4420. if res.Body != nil {
  4421. res.Body.Close()
  4422. }
  4423. return nil, &googleapi.Error{
  4424. Code: res.StatusCode,
  4425. Header: res.Header,
  4426. }
  4427. }
  4428. if err != nil {
  4429. return nil, err
  4430. }
  4431. defer googleapi.CloseBody(res)
  4432. if err := googleapi.CheckResponse(res); err != nil {
  4433. return nil, err
  4434. }
  4435. ret := &PermissionList{
  4436. ServerResponse: googleapi.ServerResponse{
  4437. Header: res.Header,
  4438. HTTPStatusCode: res.StatusCode,
  4439. },
  4440. }
  4441. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4442. return nil, err
  4443. }
  4444. return ret, nil
  4445. // {
  4446. // "description": "Lists a file's permissions.",
  4447. // "httpMethod": "GET",
  4448. // "id": "drive.permissions.list",
  4449. // "parameterOrder": [
  4450. // "fileId"
  4451. // ],
  4452. // "parameters": {
  4453. // "fileId": {
  4454. // "description": "The ID of the file.",
  4455. // "location": "path",
  4456. // "required": true,
  4457. // "type": "string"
  4458. // }
  4459. // },
  4460. // "path": "files/{fileId}/permissions",
  4461. // "response": {
  4462. // "$ref": "PermissionList"
  4463. // },
  4464. // "scopes": [
  4465. // "https://www.googleapis.com/auth/drive",
  4466. // "https://www.googleapis.com/auth/drive.file",
  4467. // "https://www.googleapis.com/auth/drive.metadata",
  4468. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  4469. // "https://www.googleapis.com/auth/drive.photos.readonly",
  4470. // "https://www.googleapis.com/auth/drive.readonly"
  4471. // ]
  4472. // }
  4473. }
  4474. // method id "drive.permissions.update":
  4475. type PermissionsUpdateCall struct {
  4476. s *Service
  4477. fileId string
  4478. permissionId string
  4479. permission *Permission
  4480. urlParams_ gensupport.URLParams
  4481. ctx_ context.Context
  4482. }
  4483. // Update: Updates a permission with patch semantics.
  4484. func (r *PermissionsService) Update(fileId string, permissionId string, permission *Permission) *PermissionsUpdateCall {
  4485. c := &PermissionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4486. c.fileId = fileId
  4487. c.permissionId = permissionId
  4488. c.permission = permission
  4489. return c
  4490. }
  4491. // TransferOwnership sets the optional parameter "transferOwnership":
  4492. // Whether to transfer ownership to the specified user and downgrade the
  4493. // current owner to a writer. This parameter is required as an
  4494. // acknowledgement of the side effect.
  4495. func (c *PermissionsUpdateCall) TransferOwnership(transferOwnership bool) *PermissionsUpdateCall {
  4496. c.urlParams_.Set("transferOwnership", fmt.Sprint(transferOwnership))
  4497. return c
  4498. }
  4499. // Fields allows partial responses to be retrieved. See
  4500. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4501. // for more information.
  4502. func (c *PermissionsUpdateCall) Fields(s ...googleapi.Field) *PermissionsUpdateCall {
  4503. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4504. return c
  4505. }
  4506. // Context sets the context to be used in this call's Do method. Any
  4507. // pending HTTP request will be aborted if the provided context is
  4508. // canceled.
  4509. func (c *PermissionsUpdateCall) Context(ctx context.Context) *PermissionsUpdateCall {
  4510. c.ctx_ = ctx
  4511. return c
  4512. }
  4513. func (c *PermissionsUpdateCall) doRequest(alt string) (*http.Response, error) {
  4514. var body io.Reader = nil
  4515. body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission)
  4516. if err != nil {
  4517. return nil, err
  4518. }
  4519. ctype := "application/json"
  4520. c.urlParams_.Set("alt", alt)
  4521. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  4522. urls += "?" + c.urlParams_.Encode()
  4523. req, _ := http.NewRequest("PATCH", urls, body)
  4524. googleapi.Expand(req.URL, map[string]string{
  4525. "fileId": c.fileId,
  4526. "permissionId": c.permissionId,
  4527. })
  4528. req.Header.Set("Content-Type", ctype)
  4529. req.Header.Set("User-Agent", c.s.userAgent())
  4530. if c.ctx_ != nil {
  4531. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4532. }
  4533. return c.s.client.Do(req)
  4534. }
  4535. // Do executes the "drive.permissions.update" call.
  4536. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  4537. // status code is an error. Response headers are in either
  4538. // *Permission.ServerResponse.Header or (if a response was returned at
  4539. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4540. // to check whether the returned error was because
  4541. // http.StatusNotModified was returned.
  4542. func (c *PermissionsUpdateCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  4543. gensupport.SetOptions(c.urlParams_, opts...)
  4544. res, err := c.doRequest("json")
  4545. if res != nil && res.StatusCode == http.StatusNotModified {
  4546. if res.Body != nil {
  4547. res.Body.Close()
  4548. }
  4549. return nil, &googleapi.Error{
  4550. Code: res.StatusCode,
  4551. Header: res.Header,
  4552. }
  4553. }
  4554. if err != nil {
  4555. return nil, err
  4556. }
  4557. defer googleapi.CloseBody(res)
  4558. if err := googleapi.CheckResponse(res); err != nil {
  4559. return nil, err
  4560. }
  4561. ret := &Permission{
  4562. ServerResponse: googleapi.ServerResponse{
  4563. Header: res.Header,
  4564. HTTPStatusCode: res.StatusCode,
  4565. },
  4566. }
  4567. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4568. return nil, err
  4569. }
  4570. return ret, nil
  4571. // {
  4572. // "description": "Updates a permission with patch semantics.",
  4573. // "httpMethod": "PATCH",
  4574. // "id": "drive.permissions.update",
  4575. // "parameterOrder": [
  4576. // "fileId",
  4577. // "permissionId"
  4578. // ],
  4579. // "parameters": {
  4580. // "fileId": {
  4581. // "description": "The ID of the file.",
  4582. // "location": "path",
  4583. // "required": true,
  4584. // "type": "string"
  4585. // },
  4586. // "permissionId": {
  4587. // "description": "The ID of the permission.",
  4588. // "location": "path",
  4589. // "required": true,
  4590. // "type": "string"
  4591. // },
  4592. // "transferOwnership": {
  4593. // "default": "false",
  4594. // "description": "Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect.",
  4595. // "location": "query",
  4596. // "type": "boolean"
  4597. // }
  4598. // },
  4599. // "path": "files/{fileId}/permissions/{permissionId}",
  4600. // "request": {
  4601. // "$ref": "Permission"
  4602. // },
  4603. // "response": {
  4604. // "$ref": "Permission"
  4605. // },
  4606. // "scopes": [
  4607. // "https://www.googleapis.com/auth/drive",
  4608. // "https://www.googleapis.com/auth/drive.file"
  4609. // ]
  4610. // }
  4611. }
  4612. // method id "drive.replies.create":
  4613. type RepliesCreateCall struct {
  4614. s *Service
  4615. fileId string
  4616. commentId string
  4617. reply *Reply
  4618. urlParams_ gensupport.URLParams
  4619. ctx_ context.Context
  4620. }
  4621. // Create: Creates a new reply to a comment.
  4622. func (r *RepliesService) Create(fileId string, commentId string, reply *Reply) *RepliesCreateCall {
  4623. c := &RepliesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4624. c.fileId = fileId
  4625. c.commentId = commentId
  4626. c.reply = reply
  4627. return c
  4628. }
  4629. // Fields allows partial responses to be retrieved. See
  4630. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4631. // for more information.
  4632. func (c *RepliesCreateCall) Fields(s ...googleapi.Field) *RepliesCreateCall {
  4633. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4634. return c
  4635. }
  4636. // Context sets the context to be used in this call's Do method. Any
  4637. // pending HTTP request will be aborted if the provided context is
  4638. // canceled.
  4639. func (c *RepliesCreateCall) Context(ctx context.Context) *RepliesCreateCall {
  4640. c.ctx_ = ctx
  4641. return c
  4642. }
  4643. func (c *RepliesCreateCall) doRequest(alt string) (*http.Response, error) {
  4644. var body io.Reader = nil
  4645. body, err := googleapi.WithoutDataWrapper.JSONReader(c.reply)
  4646. if err != nil {
  4647. return nil, err
  4648. }
  4649. ctype := "application/json"
  4650. c.urlParams_.Set("alt", alt)
  4651. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies")
  4652. urls += "?" + c.urlParams_.Encode()
  4653. req, _ := http.NewRequest("POST", urls, body)
  4654. googleapi.Expand(req.URL, map[string]string{
  4655. "fileId": c.fileId,
  4656. "commentId": c.commentId,
  4657. })
  4658. req.Header.Set("Content-Type", ctype)
  4659. req.Header.Set("User-Agent", c.s.userAgent())
  4660. if c.ctx_ != nil {
  4661. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4662. }
  4663. return c.s.client.Do(req)
  4664. }
  4665. // Do executes the "drive.replies.create" call.
  4666. // Exactly one of *Reply or error will be non-nil. Any non-2xx status
  4667. // code is an error. Response headers are in either
  4668. // *Reply.ServerResponse.Header or (if a response was returned at all)
  4669. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4670. // check whether the returned error was because http.StatusNotModified
  4671. // was returned.
  4672. func (c *RepliesCreateCall) Do(opts ...googleapi.CallOption) (*Reply, error) {
  4673. gensupport.SetOptions(c.urlParams_, opts...)
  4674. res, err := c.doRequest("json")
  4675. if res != nil && res.StatusCode == http.StatusNotModified {
  4676. if res.Body != nil {
  4677. res.Body.Close()
  4678. }
  4679. return nil, &googleapi.Error{
  4680. Code: res.StatusCode,
  4681. Header: res.Header,
  4682. }
  4683. }
  4684. if err != nil {
  4685. return nil, err
  4686. }
  4687. defer googleapi.CloseBody(res)
  4688. if err := googleapi.CheckResponse(res); err != nil {
  4689. return nil, err
  4690. }
  4691. ret := &Reply{
  4692. ServerResponse: googleapi.ServerResponse{
  4693. Header: res.Header,
  4694. HTTPStatusCode: res.StatusCode,
  4695. },
  4696. }
  4697. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4698. return nil, err
  4699. }
  4700. return ret, nil
  4701. // {
  4702. // "description": "Creates a new reply to a comment.",
  4703. // "httpMethod": "POST",
  4704. // "id": "drive.replies.create",
  4705. // "parameterOrder": [
  4706. // "fileId",
  4707. // "commentId"
  4708. // ],
  4709. // "parameters": {
  4710. // "commentId": {
  4711. // "description": "The ID of the comment.",
  4712. // "location": "path",
  4713. // "required": true,
  4714. // "type": "string"
  4715. // },
  4716. // "fileId": {
  4717. // "description": "The ID of the file.",
  4718. // "location": "path",
  4719. // "required": true,
  4720. // "type": "string"
  4721. // }
  4722. // },
  4723. // "path": "files/{fileId}/comments/{commentId}/replies",
  4724. // "request": {
  4725. // "$ref": "Reply"
  4726. // },
  4727. // "response": {
  4728. // "$ref": "Reply"
  4729. // },
  4730. // "scopes": [
  4731. // "https://www.googleapis.com/auth/drive",
  4732. // "https://www.googleapis.com/auth/drive.file"
  4733. // ]
  4734. // }
  4735. }
  4736. // method id "drive.replies.delete":
  4737. type RepliesDeleteCall struct {
  4738. s *Service
  4739. fileId string
  4740. commentId string
  4741. replyId string
  4742. urlParams_ gensupport.URLParams
  4743. ctx_ context.Context
  4744. }
  4745. // Delete: Deletes a reply.
  4746. func (r *RepliesService) Delete(fileId string, commentId string, replyId string) *RepliesDeleteCall {
  4747. c := &RepliesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4748. c.fileId = fileId
  4749. c.commentId = commentId
  4750. c.replyId = replyId
  4751. return c
  4752. }
  4753. // Fields allows partial responses to be retrieved. See
  4754. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4755. // for more information.
  4756. func (c *RepliesDeleteCall) Fields(s ...googleapi.Field) *RepliesDeleteCall {
  4757. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4758. return c
  4759. }
  4760. // Context sets the context to be used in this call's Do method. Any
  4761. // pending HTTP request will be aborted if the provided context is
  4762. // canceled.
  4763. func (c *RepliesDeleteCall) Context(ctx context.Context) *RepliesDeleteCall {
  4764. c.ctx_ = ctx
  4765. return c
  4766. }
  4767. func (c *RepliesDeleteCall) doRequest(alt string) (*http.Response, error) {
  4768. var body io.Reader = nil
  4769. c.urlParams_.Set("alt", alt)
  4770. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  4771. urls += "?" + c.urlParams_.Encode()
  4772. req, _ := http.NewRequest("DELETE", urls, body)
  4773. googleapi.Expand(req.URL, map[string]string{
  4774. "fileId": c.fileId,
  4775. "commentId": c.commentId,
  4776. "replyId": c.replyId,
  4777. })
  4778. req.Header.Set("User-Agent", c.s.userAgent())
  4779. if c.ctx_ != nil {
  4780. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4781. }
  4782. return c.s.client.Do(req)
  4783. }
  4784. // Do executes the "drive.replies.delete" call.
  4785. func (c *RepliesDeleteCall) Do(opts ...googleapi.CallOption) error {
  4786. gensupport.SetOptions(c.urlParams_, opts...)
  4787. res, err := c.doRequest("json")
  4788. if err != nil {
  4789. return err
  4790. }
  4791. defer googleapi.CloseBody(res)
  4792. if err := googleapi.CheckResponse(res); err != nil {
  4793. return err
  4794. }
  4795. return nil
  4796. // {
  4797. // "description": "Deletes a reply.",
  4798. // "httpMethod": "DELETE",
  4799. // "id": "drive.replies.delete",
  4800. // "parameterOrder": [
  4801. // "fileId",
  4802. // "commentId",
  4803. // "replyId"
  4804. // ],
  4805. // "parameters": {
  4806. // "commentId": {
  4807. // "description": "The ID of the comment.",
  4808. // "location": "path",
  4809. // "required": true,
  4810. // "type": "string"
  4811. // },
  4812. // "fileId": {
  4813. // "description": "The ID of the file.",
  4814. // "location": "path",
  4815. // "required": true,
  4816. // "type": "string"
  4817. // },
  4818. // "replyId": {
  4819. // "description": "The ID of the reply.",
  4820. // "location": "path",
  4821. // "required": true,
  4822. // "type": "string"
  4823. // }
  4824. // },
  4825. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  4826. // "scopes": [
  4827. // "https://www.googleapis.com/auth/drive",
  4828. // "https://www.googleapis.com/auth/drive.file"
  4829. // ]
  4830. // }
  4831. }
  4832. // method id "drive.replies.get":
  4833. type RepliesGetCall struct {
  4834. s *Service
  4835. fileId string
  4836. commentId string
  4837. replyId string
  4838. urlParams_ gensupport.URLParams
  4839. ifNoneMatch_ string
  4840. ctx_ context.Context
  4841. }
  4842. // Get: Gets a reply by ID.
  4843. func (r *RepliesService) Get(fileId string, commentId string, replyId string) *RepliesGetCall {
  4844. c := &RepliesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4845. c.fileId = fileId
  4846. c.commentId = commentId
  4847. c.replyId = replyId
  4848. return c
  4849. }
  4850. // IncludeDeleted sets the optional parameter "includeDeleted": Whether
  4851. // to return deleted replies. Deleted replies will not include their
  4852. // original content.
  4853. func (c *RepliesGetCall) IncludeDeleted(includeDeleted bool) *RepliesGetCall {
  4854. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  4855. return c
  4856. }
  4857. // Fields allows partial responses to be retrieved. See
  4858. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4859. // for more information.
  4860. func (c *RepliesGetCall) Fields(s ...googleapi.Field) *RepliesGetCall {
  4861. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4862. return c
  4863. }
  4864. // IfNoneMatch sets the optional parameter which makes the operation
  4865. // fail if the object's ETag matches the given value. This is useful for
  4866. // getting updates only after the object has changed since the last
  4867. // request. Use googleapi.IsNotModified to check whether the response
  4868. // error from Do is the result of In-None-Match.
  4869. func (c *RepliesGetCall) IfNoneMatch(entityTag string) *RepliesGetCall {
  4870. c.ifNoneMatch_ = entityTag
  4871. return c
  4872. }
  4873. // Context sets the context to be used in this call's Do method. Any
  4874. // pending HTTP request will be aborted if the provided context is
  4875. // canceled.
  4876. func (c *RepliesGetCall) Context(ctx context.Context) *RepliesGetCall {
  4877. c.ctx_ = ctx
  4878. return c
  4879. }
  4880. func (c *RepliesGetCall) doRequest(alt string) (*http.Response, error) {
  4881. var body io.Reader = nil
  4882. c.urlParams_.Set("alt", alt)
  4883. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  4884. urls += "?" + c.urlParams_.Encode()
  4885. req, _ := http.NewRequest("GET", urls, body)
  4886. googleapi.Expand(req.URL, map[string]string{
  4887. "fileId": c.fileId,
  4888. "commentId": c.commentId,
  4889. "replyId": c.replyId,
  4890. })
  4891. req.Header.Set("User-Agent", c.s.userAgent())
  4892. if c.ifNoneMatch_ != "" {
  4893. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4894. }
  4895. if c.ctx_ != nil {
  4896. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4897. }
  4898. return c.s.client.Do(req)
  4899. }
  4900. // Do executes the "drive.replies.get" call.
  4901. // Exactly one of *Reply or error will be non-nil. Any non-2xx status
  4902. // code is an error. Response headers are in either
  4903. // *Reply.ServerResponse.Header or (if a response was returned at all)
  4904. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4905. // check whether the returned error was because http.StatusNotModified
  4906. // was returned.
  4907. func (c *RepliesGetCall) Do(opts ...googleapi.CallOption) (*Reply, error) {
  4908. gensupport.SetOptions(c.urlParams_, opts...)
  4909. res, err := c.doRequest("json")
  4910. if res != nil && res.StatusCode == http.StatusNotModified {
  4911. if res.Body != nil {
  4912. res.Body.Close()
  4913. }
  4914. return nil, &googleapi.Error{
  4915. Code: res.StatusCode,
  4916. Header: res.Header,
  4917. }
  4918. }
  4919. if err != nil {
  4920. return nil, err
  4921. }
  4922. defer googleapi.CloseBody(res)
  4923. if err := googleapi.CheckResponse(res); err != nil {
  4924. return nil, err
  4925. }
  4926. ret := &Reply{
  4927. ServerResponse: googleapi.ServerResponse{
  4928. Header: res.Header,
  4929. HTTPStatusCode: res.StatusCode,
  4930. },
  4931. }
  4932. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4933. return nil, err
  4934. }
  4935. return ret, nil
  4936. // {
  4937. // "description": "Gets a reply by ID.",
  4938. // "httpMethod": "GET",
  4939. // "id": "drive.replies.get",
  4940. // "parameterOrder": [
  4941. // "fileId",
  4942. // "commentId",
  4943. // "replyId"
  4944. // ],
  4945. // "parameters": {
  4946. // "commentId": {
  4947. // "description": "The ID of the comment.",
  4948. // "location": "path",
  4949. // "required": true,
  4950. // "type": "string"
  4951. // },
  4952. // "fileId": {
  4953. // "description": "The ID of the file.",
  4954. // "location": "path",
  4955. // "required": true,
  4956. // "type": "string"
  4957. // },
  4958. // "includeDeleted": {
  4959. // "default": "false",
  4960. // "description": "Whether to return deleted replies. Deleted replies will not include their original content.",
  4961. // "location": "query",
  4962. // "type": "boolean"
  4963. // },
  4964. // "replyId": {
  4965. // "description": "The ID of the reply.",
  4966. // "location": "path",
  4967. // "required": true,
  4968. // "type": "string"
  4969. // }
  4970. // },
  4971. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  4972. // "response": {
  4973. // "$ref": "Reply"
  4974. // },
  4975. // "scopes": [
  4976. // "https://www.googleapis.com/auth/drive",
  4977. // "https://www.googleapis.com/auth/drive.file",
  4978. // "https://www.googleapis.com/auth/drive.readonly"
  4979. // ]
  4980. // }
  4981. }
  4982. // method id "drive.replies.list":
  4983. type RepliesListCall struct {
  4984. s *Service
  4985. fileId string
  4986. commentId string
  4987. urlParams_ gensupport.URLParams
  4988. ifNoneMatch_ string
  4989. ctx_ context.Context
  4990. }
  4991. // List: Lists a comment's replies.
  4992. func (r *RepliesService) List(fileId string, commentId string) *RepliesListCall {
  4993. c := &RepliesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4994. c.fileId = fileId
  4995. c.commentId = commentId
  4996. return c
  4997. }
  4998. // IncludeDeleted sets the optional parameter "includeDeleted": Whether
  4999. // to include deleted replies. Deleted replies will not include their
  5000. // original content.
  5001. func (c *RepliesListCall) IncludeDeleted(includeDeleted bool) *RepliesListCall {
  5002. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  5003. return c
  5004. }
  5005. // PageSize sets the optional parameter "pageSize": The maximum number
  5006. // of replies to return per page.
  5007. func (c *RepliesListCall) PageSize(pageSize int64) *RepliesListCall {
  5008. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5009. return c
  5010. }
  5011. // PageToken sets the optional parameter "pageToken": The token for
  5012. // continuing a previous list request on the next page. This should be
  5013. // set to the value of 'nextPageToken' from the previous response.
  5014. func (c *RepliesListCall) PageToken(pageToken string) *RepliesListCall {
  5015. c.urlParams_.Set("pageToken", pageToken)
  5016. return c
  5017. }
  5018. // Fields allows partial responses to be retrieved. See
  5019. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5020. // for more information.
  5021. func (c *RepliesListCall) Fields(s ...googleapi.Field) *RepliesListCall {
  5022. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5023. return c
  5024. }
  5025. // IfNoneMatch sets the optional parameter which makes the operation
  5026. // fail if the object's ETag matches the given value. This is useful for
  5027. // getting updates only after the object has changed since the last
  5028. // request. Use googleapi.IsNotModified to check whether the response
  5029. // error from Do is the result of In-None-Match.
  5030. func (c *RepliesListCall) IfNoneMatch(entityTag string) *RepliesListCall {
  5031. c.ifNoneMatch_ = entityTag
  5032. return c
  5033. }
  5034. // Context sets the context to be used in this call's Do method. Any
  5035. // pending HTTP request will be aborted if the provided context is
  5036. // canceled.
  5037. func (c *RepliesListCall) Context(ctx context.Context) *RepliesListCall {
  5038. c.ctx_ = ctx
  5039. return c
  5040. }
  5041. func (c *RepliesListCall) doRequest(alt string) (*http.Response, error) {
  5042. var body io.Reader = nil
  5043. c.urlParams_.Set("alt", alt)
  5044. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies")
  5045. urls += "?" + c.urlParams_.Encode()
  5046. req, _ := http.NewRequest("GET", urls, body)
  5047. googleapi.Expand(req.URL, map[string]string{
  5048. "fileId": c.fileId,
  5049. "commentId": c.commentId,
  5050. })
  5051. req.Header.Set("User-Agent", c.s.userAgent())
  5052. if c.ifNoneMatch_ != "" {
  5053. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  5054. }
  5055. if c.ctx_ != nil {
  5056. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5057. }
  5058. return c.s.client.Do(req)
  5059. }
  5060. // Do executes the "drive.replies.list" call.
  5061. // Exactly one of *ReplyList or error will be non-nil. Any non-2xx
  5062. // status code is an error. Response headers are in either
  5063. // *ReplyList.ServerResponse.Header or (if a response was returned at
  5064. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5065. // to check whether the returned error was because
  5066. // http.StatusNotModified was returned.
  5067. func (c *RepliesListCall) Do(opts ...googleapi.CallOption) (*ReplyList, error) {
  5068. gensupport.SetOptions(c.urlParams_, opts...)
  5069. res, err := c.doRequest("json")
  5070. if res != nil && res.StatusCode == http.StatusNotModified {
  5071. if res.Body != nil {
  5072. res.Body.Close()
  5073. }
  5074. return nil, &googleapi.Error{
  5075. Code: res.StatusCode,
  5076. Header: res.Header,
  5077. }
  5078. }
  5079. if err != nil {
  5080. return nil, err
  5081. }
  5082. defer googleapi.CloseBody(res)
  5083. if err := googleapi.CheckResponse(res); err != nil {
  5084. return nil, err
  5085. }
  5086. ret := &ReplyList{
  5087. ServerResponse: googleapi.ServerResponse{
  5088. Header: res.Header,
  5089. HTTPStatusCode: res.StatusCode,
  5090. },
  5091. }
  5092. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5093. return nil, err
  5094. }
  5095. return ret, nil
  5096. // {
  5097. // "description": "Lists a comment's replies.",
  5098. // "httpMethod": "GET",
  5099. // "id": "drive.replies.list",
  5100. // "parameterOrder": [
  5101. // "fileId",
  5102. // "commentId"
  5103. // ],
  5104. // "parameters": {
  5105. // "commentId": {
  5106. // "description": "The ID of the comment.",
  5107. // "location": "path",
  5108. // "required": true,
  5109. // "type": "string"
  5110. // },
  5111. // "fileId": {
  5112. // "description": "The ID of the file.",
  5113. // "location": "path",
  5114. // "required": true,
  5115. // "type": "string"
  5116. // },
  5117. // "includeDeleted": {
  5118. // "default": "false",
  5119. // "description": "Whether to include deleted replies. Deleted replies will not include their original content.",
  5120. // "location": "query",
  5121. // "type": "boolean"
  5122. // },
  5123. // "pageSize": {
  5124. // "default": "20",
  5125. // "description": "The maximum number of replies to return per page.",
  5126. // "format": "int32",
  5127. // "location": "query",
  5128. // "maximum": "100",
  5129. // "minimum": "1",
  5130. // "type": "integer"
  5131. // },
  5132. // "pageToken": {
  5133. // "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.",
  5134. // "location": "query",
  5135. // "type": "string"
  5136. // }
  5137. // },
  5138. // "path": "files/{fileId}/comments/{commentId}/replies",
  5139. // "response": {
  5140. // "$ref": "ReplyList"
  5141. // },
  5142. // "scopes": [
  5143. // "https://www.googleapis.com/auth/drive",
  5144. // "https://www.googleapis.com/auth/drive.file",
  5145. // "https://www.googleapis.com/auth/drive.readonly"
  5146. // ]
  5147. // }
  5148. }
  5149. // Pages invokes f for each page of results.
  5150. // A non-nil error returned from f will halt the iteration.
  5151. // The provided context supersedes any context provided to the Context method.
  5152. func (c *RepliesListCall) Pages(ctx context.Context, f func(*ReplyList) error) error {
  5153. c.ctx_ = ctx
  5154. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5155. for {
  5156. x, err := c.Do()
  5157. if err != nil {
  5158. return err
  5159. }
  5160. if err := f(x); err != nil {
  5161. return err
  5162. }
  5163. if x.NextPageToken == "" {
  5164. return nil
  5165. }
  5166. c.PageToken(x.NextPageToken)
  5167. }
  5168. }
  5169. // method id "drive.replies.update":
  5170. type RepliesUpdateCall struct {
  5171. s *Service
  5172. fileId string
  5173. commentId string
  5174. replyId string
  5175. reply *Reply
  5176. urlParams_ gensupport.URLParams
  5177. ctx_ context.Context
  5178. }
  5179. // Update: Updates a reply with patch semantics.
  5180. func (r *RepliesService) Update(fileId string, commentId string, replyId string, reply *Reply) *RepliesUpdateCall {
  5181. c := &RepliesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5182. c.fileId = fileId
  5183. c.commentId = commentId
  5184. c.replyId = replyId
  5185. c.reply = reply
  5186. return c
  5187. }
  5188. // Fields allows partial responses to be retrieved. See
  5189. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5190. // for more information.
  5191. func (c *RepliesUpdateCall) Fields(s ...googleapi.Field) *RepliesUpdateCall {
  5192. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5193. return c
  5194. }
  5195. // Context sets the context to be used in this call's Do method. Any
  5196. // pending HTTP request will be aborted if the provided context is
  5197. // canceled.
  5198. func (c *RepliesUpdateCall) Context(ctx context.Context) *RepliesUpdateCall {
  5199. c.ctx_ = ctx
  5200. return c
  5201. }
  5202. func (c *RepliesUpdateCall) doRequest(alt string) (*http.Response, error) {
  5203. var body io.Reader = nil
  5204. body, err := googleapi.WithoutDataWrapper.JSONReader(c.reply)
  5205. if err != nil {
  5206. return nil, err
  5207. }
  5208. ctype := "application/json"
  5209. c.urlParams_.Set("alt", alt)
  5210. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  5211. urls += "?" + c.urlParams_.Encode()
  5212. req, _ := http.NewRequest("PATCH", urls, body)
  5213. googleapi.Expand(req.URL, map[string]string{
  5214. "fileId": c.fileId,
  5215. "commentId": c.commentId,
  5216. "replyId": c.replyId,
  5217. })
  5218. req.Header.Set("Content-Type", ctype)
  5219. req.Header.Set("User-Agent", c.s.userAgent())
  5220. if c.ctx_ != nil {
  5221. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5222. }
  5223. return c.s.client.Do(req)
  5224. }
  5225. // Do executes the "drive.replies.update" call.
  5226. // Exactly one of *Reply or error will be non-nil. Any non-2xx status
  5227. // code is an error. Response headers are in either
  5228. // *Reply.ServerResponse.Header or (if a response was returned at all)
  5229. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5230. // check whether the returned error was because http.StatusNotModified
  5231. // was returned.
  5232. func (c *RepliesUpdateCall) Do(opts ...googleapi.CallOption) (*Reply, error) {
  5233. gensupport.SetOptions(c.urlParams_, opts...)
  5234. res, err := c.doRequest("json")
  5235. if res != nil && res.StatusCode == http.StatusNotModified {
  5236. if res.Body != nil {
  5237. res.Body.Close()
  5238. }
  5239. return nil, &googleapi.Error{
  5240. Code: res.StatusCode,
  5241. Header: res.Header,
  5242. }
  5243. }
  5244. if err != nil {
  5245. return nil, err
  5246. }
  5247. defer googleapi.CloseBody(res)
  5248. if err := googleapi.CheckResponse(res); err != nil {
  5249. return nil, err
  5250. }
  5251. ret := &Reply{
  5252. ServerResponse: googleapi.ServerResponse{
  5253. Header: res.Header,
  5254. HTTPStatusCode: res.StatusCode,
  5255. },
  5256. }
  5257. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5258. return nil, err
  5259. }
  5260. return ret, nil
  5261. // {
  5262. // "description": "Updates a reply with patch semantics.",
  5263. // "httpMethod": "PATCH",
  5264. // "id": "drive.replies.update",
  5265. // "parameterOrder": [
  5266. // "fileId",
  5267. // "commentId",
  5268. // "replyId"
  5269. // ],
  5270. // "parameters": {
  5271. // "commentId": {
  5272. // "description": "The ID of the comment.",
  5273. // "location": "path",
  5274. // "required": true,
  5275. // "type": "string"
  5276. // },
  5277. // "fileId": {
  5278. // "description": "The ID of the file.",
  5279. // "location": "path",
  5280. // "required": true,
  5281. // "type": "string"
  5282. // },
  5283. // "replyId": {
  5284. // "description": "The ID of the reply.",
  5285. // "location": "path",
  5286. // "required": true,
  5287. // "type": "string"
  5288. // }
  5289. // },
  5290. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  5291. // "request": {
  5292. // "$ref": "Reply"
  5293. // },
  5294. // "response": {
  5295. // "$ref": "Reply"
  5296. // },
  5297. // "scopes": [
  5298. // "https://www.googleapis.com/auth/drive",
  5299. // "https://www.googleapis.com/auth/drive.file"
  5300. // ]
  5301. // }
  5302. }
  5303. // method id "drive.revisions.delete":
  5304. type RevisionsDeleteCall struct {
  5305. s *Service
  5306. fileId string
  5307. revisionId string
  5308. urlParams_ gensupport.URLParams
  5309. ctx_ context.Context
  5310. }
  5311. // Delete: Permanently deletes a revision. This method is only
  5312. // applicable to files with binary content in Drive.
  5313. func (r *RevisionsService) Delete(fileId string, revisionId string) *RevisionsDeleteCall {
  5314. c := &RevisionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5315. c.fileId = fileId
  5316. c.revisionId = revisionId
  5317. return c
  5318. }
  5319. // Fields allows partial responses to be retrieved. See
  5320. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5321. // for more information.
  5322. func (c *RevisionsDeleteCall) Fields(s ...googleapi.Field) *RevisionsDeleteCall {
  5323. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5324. return c
  5325. }
  5326. // Context sets the context to be used in this call's Do method. Any
  5327. // pending HTTP request will be aborted if the provided context is
  5328. // canceled.
  5329. func (c *RevisionsDeleteCall) Context(ctx context.Context) *RevisionsDeleteCall {
  5330. c.ctx_ = ctx
  5331. return c
  5332. }
  5333. func (c *RevisionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5334. var body io.Reader = nil
  5335. c.urlParams_.Set("alt", alt)
  5336. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  5337. urls += "?" + c.urlParams_.Encode()
  5338. req, _ := http.NewRequest("DELETE", urls, body)
  5339. googleapi.Expand(req.URL, map[string]string{
  5340. "fileId": c.fileId,
  5341. "revisionId": c.revisionId,
  5342. })
  5343. req.Header.Set("User-Agent", c.s.userAgent())
  5344. if c.ctx_ != nil {
  5345. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5346. }
  5347. return c.s.client.Do(req)
  5348. }
  5349. // Do executes the "drive.revisions.delete" call.
  5350. func (c *RevisionsDeleteCall) Do(opts ...googleapi.CallOption) error {
  5351. gensupport.SetOptions(c.urlParams_, opts...)
  5352. res, err := c.doRequest("json")
  5353. if err != nil {
  5354. return err
  5355. }
  5356. defer googleapi.CloseBody(res)
  5357. if err := googleapi.CheckResponse(res); err != nil {
  5358. return err
  5359. }
  5360. return nil
  5361. // {
  5362. // "description": "Permanently deletes a revision. This method is only applicable to files with binary content in Drive.",
  5363. // "httpMethod": "DELETE",
  5364. // "id": "drive.revisions.delete",
  5365. // "parameterOrder": [
  5366. // "fileId",
  5367. // "revisionId"
  5368. // ],
  5369. // "parameters": {
  5370. // "fileId": {
  5371. // "description": "The ID of the file.",
  5372. // "location": "path",
  5373. // "required": true,
  5374. // "type": "string"
  5375. // },
  5376. // "revisionId": {
  5377. // "description": "The ID of the revision.",
  5378. // "location": "path",
  5379. // "required": true,
  5380. // "type": "string"
  5381. // }
  5382. // },
  5383. // "path": "files/{fileId}/revisions/{revisionId}",
  5384. // "scopes": [
  5385. // "https://www.googleapis.com/auth/drive",
  5386. // "https://www.googleapis.com/auth/drive.appdata",
  5387. // "https://www.googleapis.com/auth/drive.file"
  5388. // ]
  5389. // }
  5390. }
  5391. // method id "drive.revisions.get":
  5392. type RevisionsGetCall struct {
  5393. s *Service
  5394. fileId string
  5395. revisionId string
  5396. urlParams_ gensupport.URLParams
  5397. ifNoneMatch_ string
  5398. ctx_ context.Context
  5399. }
  5400. // Get: Gets a revision's metadata or content by ID.
  5401. func (r *RevisionsService) Get(fileId string, revisionId string) *RevisionsGetCall {
  5402. c := &RevisionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5403. c.fileId = fileId
  5404. c.revisionId = revisionId
  5405. return c
  5406. }
  5407. // AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse":
  5408. // Whether the user is acknowledging the risk of downloading known
  5409. // malware or other abusive files. This is only applicable when
  5410. // alt=media.
  5411. func (c *RevisionsGetCall) AcknowledgeAbuse(acknowledgeAbuse bool) *RevisionsGetCall {
  5412. c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse))
  5413. return c
  5414. }
  5415. // Fields allows partial responses to be retrieved. See
  5416. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5417. // for more information.
  5418. func (c *RevisionsGetCall) Fields(s ...googleapi.Field) *RevisionsGetCall {
  5419. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5420. return c
  5421. }
  5422. // IfNoneMatch sets the optional parameter which makes the operation
  5423. // fail if the object's ETag matches the given value. This is useful for
  5424. // getting updates only after the object has changed since the last
  5425. // request. Use googleapi.IsNotModified to check whether the response
  5426. // error from Do is the result of In-None-Match.
  5427. func (c *RevisionsGetCall) IfNoneMatch(entityTag string) *RevisionsGetCall {
  5428. c.ifNoneMatch_ = entityTag
  5429. return c
  5430. }
  5431. // Context sets the context to be used in this call's Do and Download
  5432. // methods. Any pending HTTP request will be aborted if the provided
  5433. // context is canceled.
  5434. func (c *RevisionsGetCall) Context(ctx context.Context) *RevisionsGetCall {
  5435. c.ctx_ = ctx
  5436. return c
  5437. }
  5438. func (c *RevisionsGetCall) doRequest(alt string) (*http.Response, error) {
  5439. var body io.Reader = nil
  5440. c.urlParams_.Set("alt", alt)
  5441. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  5442. urls += "?" + c.urlParams_.Encode()
  5443. req, _ := http.NewRequest("GET", urls, body)
  5444. googleapi.Expand(req.URL, map[string]string{
  5445. "fileId": c.fileId,
  5446. "revisionId": c.revisionId,
  5447. })
  5448. req.Header.Set("User-Agent", c.s.userAgent())
  5449. if c.ifNoneMatch_ != "" {
  5450. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  5451. }
  5452. if c.ctx_ != nil {
  5453. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5454. }
  5455. return c.s.client.Do(req)
  5456. }
  5457. // Download fetches the API endpoint's "media" value, instead of the normal
  5458. // API response value. If the returned error is nil, the Response is guaranteed to
  5459. // have a 2xx status code. Callers must close the Response.Body as usual.
  5460. func (c *RevisionsGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  5461. gensupport.SetOptions(c.urlParams_, opts...)
  5462. res, err := c.doRequest("media")
  5463. if err != nil {
  5464. return nil, err
  5465. }
  5466. if err := googleapi.CheckMediaResponse(res); err != nil {
  5467. res.Body.Close()
  5468. return nil, err
  5469. }
  5470. return res, nil
  5471. }
  5472. // Do executes the "drive.revisions.get" call.
  5473. // Exactly one of *Revision or error will be non-nil. Any non-2xx status
  5474. // code is an error. Response headers are in either
  5475. // *Revision.ServerResponse.Header or (if a response was returned at
  5476. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5477. // to check whether the returned error was because
  5478. // http.StatusNotModified was returned.
  5479. func (c *RevisionsGetCall) Do(opts ...googleapi.CallOption) (*Revision, error) {
  5480. gensupport.SetOptions(c.urlParams_, opts...)
  5481. res, err := c.doRequest("json")
  5482. if res != nil && res.StatusCode == http.StatusNotModified {
  5483. if res.Body != nil {
  5484. res.Body.Close()
  5485. }
  5486. return nil, &googleapi.Error{
  5487. Code: res.StatusCode,
  5488. Header: res.Header,
  5489. }
  5490. }
  5491. if err != nil {
  5492. return nil, err
  5493. }
  5494. defer googleapi.CloseBody(res)
  5495. if err := googleapi.CheckResponse(res); err != nil {
  5496. return nil, err
  5497. }
  5498. ret := &Revision{
  5499. ServerResponse: googleapi.ServerResponse{
  5500. Header: res.Header,
  5501. HTTPStatusCode: res.StatusCode,
  5502. },
  5503. }
  5504. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5505. return nil, err
  5506. }
  5507. return ret, nil
  5508. // {
  5509. // "description": "Gets a revision's metadata or content by ID.",
  5510. // "httpMethod": "GET",
  5511. // "id": "drive.revisions.get",
  5512. // "parameterOrder": [
  5513. // "fileId",
  5514. // "revisionId"
  5515. // ],
  5516. // "parameters": {
  5517. // "acknowledgeAbuse": {
  5518. // "default": "false",
  5519. // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.",
  5520. // "location": "query",
  5521. // "type": "boolean"
  5522. // },
  5523. // "fileId": {
  5524. // "description": "The ID of the file.",
  5525. // "location": "path",
  5526. // "required": true,
  5527. // "type": "string"
  5528. // },
  5529. // "revisionId": {
  5530. // "description": "The ID of the revision.",
  5531. // "location": "path",
  5532. // "required": true,
  5533. // "type": "string"
  5534. // }
  5535. // },
  5536. // "path": "files/{fileId}/revisions/{revisionId}",
  5537. // "response": {
  5538. // "$ref": "Revision"
  5539. // },
  5540. // "scopes": [
  5541. // "https://www.googleapis.com/auth/drive",
  5542. // "https://www.googleapis.com/auth/drive.appdata",
  5543. // "https://www.googleapis.com/auth/drive.file",
  5544. // "https://www.googleapis.com/auth/drive.metadata",
  5545. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  5546. // "https://www.googleapis.com/auth/drive.photos.readonly",
  5547. // "https://www.googleapis.com/auth/drive.readonly"
  5548. // ],
  5549. // "supportsMediaDownload": true,
  5550. // "useMediaDownloadService": true
  5551. // }
  5552. }
  5553. // method id "drive.revisions.list":
  5554. type RevisionsListCall struct {
  5555. s *Service
  5556. fileId string
  5557. urlParams_ gensupport.URLParams
  5558. ifNoneMatch_ string
  5559. ctx_ context.Context
  5560. }
  5561. // List: Lists a file's revisions.
  5562. func (r *RevisionsService) List(fileId string) *RevisionsListCall {
  5563. c := &RevisionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5564. c.fileId = fileId
  5565. return c
  5566. }
  5567. // Fields allows partial responses to be retrieved. See
  5568. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5569. // for more information.
  5570. func (c *RevisionsListCall) Fields(s ...googleapi.Field) *RevisionsListCall {
  5571. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5572. return c
  5573. }
  5574. // IfNoneMatch sets the optional parameter which makes the operation
  5575. // fail if the object's ETag matches the given value. This is useful for
  5576. // getting updates only after the object has changed since the last
  5577. // request. Use googleapi.IsNotModified to check whether the response
  5578. // error from Do is the result of In-None-Match.
  5579. func (c *RevisionsListCall) IfNoneMatch(entityTag string) *RevisionsListCall {
  5580. c.ifNoneMatch_ = entityTag
  5581. return c
  5582. }
  5583. // Context sets the context to be used in this call's Do method. Any
  5584. // pending HTTP request will be aborted if the provided context is
  5585. // canceled.
  5586. func (c *RevisionsListCall) Context(ctx context.Context) *RevisionsListCall {
  5587. c.ctx_ = ctx
  5588. return c
  5589. }
  5590. func (c *RevisionsListCall) doRequest(alt string) (*http.Response, error) {
  5591. var body io.Reader = nil
  5592. c.urlParams_.Set("alt", alt)
  5593. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions")
  5594. urls += "?" + c.urlParams_.Encode()
  5595. req, _ := http.NewRequest("GET", urls, body)
  5596. googleapi.Expand(req.URL, map[string]string{
  5597. "fileId": c.fileId,
  5598. })
  5599. req.Header.Set("User-Agent", c.s.userAgent())
  5600. if c.ifNoneMatch_ != "" {
  5601. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  5602. }
  5603. if c.ctx_ != nil {
  5604. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5605. }
  5606. return c.s.client.Do(req)
  5607. }
  5608. // Do executes the "drive.revisions.list" call.
  5609. // Exactly one of *RevisionList or error will be non-nil. Any non-2xx
  5610. // status code is an error. Response headers are in either
  5611. // *RevisionList.ServerResponse.Header or (if a response was returned at
  5612. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5613. // to check whether the returned error was because
  5614. // http.StatusNotModified was returned.
  5615. func (c *RevisionsListCall) Do(opts ...googleapi.CallOption) (*RevisionList, error) {
  5616. gensupport.SetOptions(c.urlParams_, opts...)
  5617. res, err := c.doRequest("json")
  5618. if res != nil && res.StatusCode == http.StatusNotModified {
  5619. if res.Body != nil {
  5620. res.Body.Close()
  5621. }
  5622. return nil, &googleapi.Error{
  5623. Code: res.StatusCode,
  5624. Header: res.Header,
  5625. }
  5626. }
  5627. if err != nil {
  5628. return nil, err
  5629. }
  5630. defer googleapi.CloseBody(res)
  5631. if err := googleapi.CheckResponse(res); err != nil {
  5632. return nil, err
  5633. }
  5634. ret := &RevisionList{
  5635. ServerResponse: googleapi.ServerResponse{
  5636. Header: res.Header,
  5637. HTTPStatusCode: res.StatusCode,
  5638. },
  5639. }
  5640. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5641. return nil, err
  5642. }
  5643. return ret, nil
  5644. // {
  5645. // "description": "Lists a file's revisions.",
  5646. // "httpMethod": "GET",
  5647. // "id": "drive.revisions.list",
  5648. // "parameterOrder": [
  5649. // "fileId"
  5650. // ],
  5651. // "parameters": {
  5652. // "fileId": {
  5653. // "description": "The ID of the file.",
  5654. // "location": "path",
  5655. // "required": true,
  5656. // "type": "string"
  5657. // }
  5658. // },
  5659. // "path": "files/{fileId}/revisions",
  5660. // "response": {
  5661. // "$ref": "RevisionList"
  5662. // },
  5663. // "scopes": [
  5664. // "https://www.googleapis.com/auth/drive",
  5665. // "https://www.googleapis.com/auth/drive.appdata",
  5666. // "https://www.googleapis.com/auth/drive.file",
  5667. // "https://www.googleapis.com/auth/drive.metadata",
  5668. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  5669. // "https://www.googleapis.com/auth/drive.photos.readonly",
  5670. // "https://www.googleapis.com/auth/drive.readonly"
  5671. // ]
  5672. // }
  5673. }
  5674. // method id "drive.revisions.update":
  5675. type RevisionsUpdateCall struct {
  5676. s *Service
  5677. fileId string
  5678. revisionId string
  5679. revision *Revision
  5680. urlParams_ gensupport.URLParams
  5681. ctx_ context.Context
  5682. }
  5683. // Update: Updates a revision with patch semantics.
  5684. func (r *RevisionsService) Update(fileId string, revisionId string, revision *Revision) *RevisionsUpdateCall {
  5685. c := &RevisionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5686. c.fileId = fileId
  5687. c.revisionId = revisionId
  5688. c.revision = revision
  5689. return c
  5690. }
  5691. // Fields allows partial responses to be retrieved. See
  5692. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5693. // for more information.
  5694. func (c *RevisionsUpdateCall) Fields(s ...googleapi.Field) *RevisionsUpdateCall {
  5695. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5696. return c
  5697. }
  5698. // Context sets the context to be used in this call's Do method. Any
  5699. // pending HTTP request will be aborted if the provided context is
  5700. // canceled.
  5701. func (c *RevisionsUpdateCall) Context(ctx context.Context) *RevisionsUpdateCall {
  5702. c.ctx_ = ctx
  5703. return c
  5704. }
  5705. func (c *RevisionsUpdateCall) doRequest(alt string) (*http.Response, error) {
  5706. var body io.Reader = nil
  5707. body, err := googleapi.WithoutDataWrapper.JSONReader(c.revision)
  5708. if err != nil {
  5709. return nil, err
  5710. }
  5711. ctype := "application/json"
  5712. c.urlParams_.Set("alt", alt)
  5713. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  5714. urls += "?" + c.urlParams_.Encode()
  5715. req, _ := http.NewRequest("PATCH", urls, body)
  5716. googleapi.Expand(req.URL, map[string]string{
  5717. "fileId": c.fileId,
  5718. "revisionId": c.revisionId,
  5719. })
  5720. req.Header.Set("Content-Type", ctype)
  5721. req.Header.Set("User-Agent", c.s.userAgent())
  5722. if c.ctx_ != nil {
  5723. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5724. }
  5725. return c.s.client.Do(req)
  5726. }
  5727. // Do executes the "drive.revisions.update" call.
  5728. // Exactly one of *Revision or error will be non-nil. Any non-2xx status
  5729. // code is an error. Response headers are in either
  5730. // *Revision.ServerResponse.Header or (if a response was returned at
  5731. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5732. // to check whether the returned error was because
  5733. // http.StatusNotModified was returned.
  5734. func (c *RevisionsUpdateCall) Do(opts ...googleapi.CallOption) (*Revision, error) {
  5735. gensupport.SetOptions(c.urlParams_, opts...)
  5736. res, err := c.doRequest("json")
  5737. if res != nil && res.StatusCode == http.StatusNotModified {
  5738. if res.Body != nil {
  5739. res.Body.Close()
  5740. }
  5741. return nil, &googleapi.Error{
  5742. Code: res.StatusCode,
  5743. Header: res.Header,
  5744. }
  5745. }
  5746. if err != nil {
  5747. return nil, err
  5748. }
  5749. defer googleapi.CloseBody(res)
  5750. if err := googleapi.CheckResponse(res); err != nil {
  5751. return nil, err
  5752. }
  5753. ret := &Revision{
  5754. ServerResponse: googleapi.ServerResponse{
  5755. Header: res.Header,
  5756. HTTPStatusCode: res.StatusCode,
  5757. },
  5758. }
  5759. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5760. return nil, err
  5761. }
  5762. return ret, nil
  5763. // {
  5764. // "description": "Updates a revision with patch semantics.",
  5765. // "httpMethod": "PATCH",
  5766. // "id": "drive.revisions.update",
  5767. // "parameterOrder": [
  5768. // "fileId",
  5769. // "revisionId"
  5770. // ],
  5771. // "parameters": {
  5772. // "fileId": {
  5773. // "description": "The ID of the file.",
  5774. // "location": "path",
  5775. // "required": true,
  5776. // "type": "string"
  5777. // },
  5778. // "revisionId": {
  5779. // "description": "The ID of the revision.",
  5780. // "location": "path",
  5781. // "required": true,
  5782. // "type": "string"
  5783. // }
  5784. // },
  5785. // "path": "files/{fileId}/revisions/{revisionId}",
  5786. // "request": {
  5787. // "$ref": "Revision"
  5788. // },
  5789. // "response": {
  5790. // "$ref": "Revision"
  5791. // },
  5792. // "scopes": [
  5793. // "https://www.googleapis.com/auth/drive",
  5794. // "https://www.googleapis.com/auth/drive.appdata",
  5795. // "https://www.googleapis.com/auth/drive.file"
  5796. // ]
  5797. // }
  5798. }