drive-gen.go 363 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382
  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/v2"
  8. // ...
  9. // driveService, err := drive.New(oauthHttpClient)
  10. package drive // import "google.golang.org/api/drive/v2"
  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:v2"
  41. const apiName = "drive"
  42. const apiVersion = "v2"
  43. const basePath = "https://www.googleapis.com/drive/v2/"
  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 your Google Drive apps
  51. DriveAppsReadonlyScope = "https://www.googleapis.com/auth/drive.apps.readonly"
  52. // View and manage Google Drive files and folders that you have opened
  53. // or created with this app
  54. DriveFileScope = "https://www.googleapis.com/auth/drive.file"
  55. // View and manage metadata of files in your Google Drive
  56. DriveMetadataScope = "https://www.googleapis.com/auth/drive.metadata"
  57. // View metadata for files in your Google Drive
  58. DriveMetadataReadonlyScope = "https://www.googleapis.com/auth/drive.metadata.readonly"
  59. // View the photos, videos and albums in your Google Photos
  60. DrivePhotosReadonlyScope = "https://www.googleapis.com/auth/drive.photos.readonly"
  61. // View the files in your Google Drive
  62. DriveReadonlyScope = "https://www.googleapis.com/auth/drive.readonly"
  63. // Modify your Google Apps Script scripts' behavior
  64. DriveScriptsScope = "https://www.googleapis.com/auth/drive.scripts"
  65. )
  66. func New(client *http.Client) (*Service, error) {
  67. if client == nil {
  68. return nil, errors.New("client is nil")
  69. }
  70. s := &Service{client: client, BasePath: basePath}
  71. s.About = NewAboutService(s)
  72. s.Apps = NewAppsService(s)
  73. s.Changes = NewChangesService(s)
  74. s.Channels = NewChannelsService(s)
  75. s.Children = NewChildrenService(s)
  76. s.Comments = NewCommentsService(s)
  77. s.Files = NewFilesService(s)
  78. s.Parents = NewParentsService(s)
  79. s.Permissions = NewPermissionsService(s)
  80. s.Properties = NewPropertiesService(s)
  81. s.Realtime = NewRealtimeService(s)
  82. s.Replies = NewRepliesService(s)
  83. s.Revisions = NewRevisionsService(s)
  84. return s, nil
  85. }
  86. type Service struct {
  87. client *http.Client
  88. BasePath string // API endpoint base URL
  89. UserAgent string // optional additional User-Agent fragment
  90. About *AboutService
  91. Apps *AppsService
  92. Changes *ChangesService
  93. Channels *ChannelsService
  94. Children *ChildrenService
  95. Comments *CommentsService
  96. Files *FilesService
  97. Parents *ParentsService
  98. Permissions *PermissionsService
  99. Properties *PropertiesService
  100. Realtime *RealtimeService
  101. Replies *RepliesService
  102. Revisions *RevisionsService
  103. }
  104. func (s *Service) userAgent() string {
  105. if s.UserAgent == "" {
  106. return googleapi.UserAgent
  107. }
  108. return googleapi.UserAgent + " " + s.UserAgent
  109. }
  110. func NewAboutService(s *Service) *AboutService {
  111. rs := &AboutService{s: s}
  112. return rs
  113. }
  114. type AboutService struct {
  115. s *Service
  116. }
  117. func NewAppsService(s *Service) *AppsService {
  118. rs := &AppsService{s: s}
  119. return rs
  120. }
  121. type AppsService struct {
  122. s *Service
  123. }
  124. func NewChangesService(s *Service) *ChangesService {
  125. rs := &ChangesService{s: s}
  126. return rs
  127. }
  128. type ChangesService struct {
  129. s *Service
  130. }
  131. func NewChannelsService(s *Service) *ChannelsService {
  132. rs := &ChannelsService{s: s}
  133. return rs
  134. }
  135. type ChannelsService struct {
  136. s *Service
  137. }
  138. func NewChildrenService(s *Service) *ChildrenService {
  139. rs := &ChildrenService{s: s}
  140. return rs
  141. }
  142. type ChildrenService struct {
  143. s *Service
  144. }
  145. func NewCommentsService(s *Service) *CommentsService {
  146. rs := &CommentsService{s: s}
  147. return rs
  148. }
  149. type CommentsService struct {
  150. s *Service
  151. }
  152. func NewFilesService(s *Service) *FilesService {
  153. rs := &FilesService{s: s}
  154. return rs
  155. }
  156. type FilesService struct {
  157. s *Service
  158. }
  159. func NewParentsService(s *Service) *ParentsService {
  160. rs := &ParentsService{s: s}
  161. return rs
  162. }
  163. type ParentsService struct {
  164. s *Service
  165. }
  166. func NewPermissionsService(s *Service) *PermissionsService {
  167. rs := &PermissionsService{s: s}
  168. return rs
  169. }
  170. type PermissionsService struct {
  171. s *Service
  172. }
  173. func NewPropertiesService(s *Service) *PropertiesService {
  174. rs := &PropertiesService{s: s}
  175. return rs
  176. }
  177. type PropertiesService struct {
  178. s *Service
  179. }
  180. func NewRealtimeService(s *Service) *RealtimeService {
  181. rs := &RealtimeService{s: s}
  182. return rs
  183. }
  184. type RealtimeService struct {
  185. s *Service
  186. }
  187. func NewRepliesService(s *Service) *RepliesService {
  188. rs := &RepliesService{s: s}
  189. return rs
  190. }
  191. type RepliesService struct {
  192. s *Service
  193. }
  194. func NewRevisionsService(s *Service) *RevisionsService {
  195. rs := &RevisionsService{s: s}
  196. return rs
  197. }
  198. type RevisionsService struct {
  199. s *Service
  200. }
  201. // About: An item with user information and settings.
  202. type About struct {
  203. // AdditionalRoleInfo: Information about supported additional roles per
  204. // file type. The most specific type takes precedence.
  205. AdditionalRoleInfo []*AboutAdditionalRoleInfo `json:"additionalRoleInfo,omitempty"`
  206. // DomainSharingPolicy: The domain sharing policy for the current user.
  207. // Possible values are:
  208. // - allowed
  209. // - allowedWithWarning
  210. // - incomingOnly
  211. // - disallowed
  212. DomainSharingPolicy string `json:"domainSharingPolicy,omitempty"`
  213. // Etag: The ETag of the item.
  214. Etag string `json:"etag,omitempty"`
  215. // ExportFormats: The allowable export formats.
  216. ExportFormats []*AboutExportFormats `json:"exportFormats,omitempty"`
  217. // Features: List of additional features enabled on this account.
  218. Features []*AboutFeatures `json:"features,omitempty"`
  219. // FolderColorPalette: The palette of allowable folder colors as RGB hex
  220. // strings.
  221. FolderColorPalette []string `json:"folderColorPalette,omitempty"`
  222. // ImportFormats: The allowable import formats.
  223. ImportFormats []*AboutImportFormats `json:"importFormats,omitempty"`
  224. // IsCurrentAppInstalled: A boolean indicating whether the authenticated
  225. // app is installed by the authenticated user.
  226. IsCurrentAppInstalled bool `json:"isCurrentAppInstalled,omitempty"`
  227. // Kind: This is always drive#about.
  228. Kind string `json:"kind,omitempty"`
  229. // LanguageCode: The user's language or locale code, as defined by BCP
  230. // 47, with some extensions from Unicode's LDML format
  231. // (http://www.unicode.org/reports/tr35/).
  232. LanguageCode string `json:"languageCode,omitempty"`
  233. // LargestChangeId: The largest change id.
  234. LargestChangeId int64 `json:"largestChangeId,omitempty,string"`
  235. // MaxUploadSizes: List of max upload sizes for each file type. The most
  236. // specific type takes precedence.
  237. MaxUploadSizes []*AboutMaxUploadSizes `json:"maxUploadSizes,omitempty"`
  238. // Name: The name of the current user.
  239. Name string `json:"name,omitempty"`
  240. // PermissionId: The current user's ID as visible in the permissions
  241. // collection.
  242. PermissionId string `json:"permissionId,omitempty"`
  243. // QuotaBytesByService: The amount of storage quota used by different
  244. // Google services.
  245. QuotaBytesByService []*AboutQuotaBytesByService `json:"quotaBytesByService,omitempty"`
  246. // QuotaBytesTotal: The total number of quota bytes.
  247. QuotaBytesTotal int64 `json:"quotaBytesTotal,omitempty,string"`
  248. // QuotaBytesUsed: The number of quota bytes used by Google Drive.
  249. QuotaBytesUsed int64 `json:"quotaBytesUsed,omitempty,string"`
  250. // QuotaBytesUsedAggregate: The number of quota bytes used by all Google
  251. // apps (Drive, Picasa, etc.).
  252. QuotaBytesUsedAggregate int64 `json:"quotaBytesUsedAggregate,omitempty,string"`
  253. // QuotaBytesUsedInTrash: The number of quota bytes used by trashed
  254. // items.
  255. QuotaBytesUsedInTrash int64 `json:"quotaBytesUsedInTrash,omitempty,string"`
  256. // QuotaType: The type of the user's storage quota. Possible values are:
  257. //
  258. // - LIMITED
  259. // - UNLIMITED
  260. QuotaType string `json:"quotaType,omitempty"`
  261. // RemainingChangeIds: The number of remaining change ids.
  262. RemainingChangeIds int64 `json:"remainingChangeIds,omitempty,string"`
  263. // RootFolderId: The id of the root folder.
  264. RootFolderId string `json:"rootFolderId,omitempty"`
  265. // SelfLink: A link back to this item.
  266. SelfLink string `json:"selfLink,omitempty"`
  267. // User: The authenticated user.
  268. User *User `json:"user,omitempty"`
  269. // ServerResponse contains the HTTP response code and headers from the
  270. // server.
  271. googleapi.ServerResponse `json:"-"`
  272. // ForceSendFields is a list of field names (e.g. "AdditionalRoleInfo")
  273. // to unconditionally include in API requests. By default, fields with
  274. // empty values are omitted from API requests. However, any non-pointer,
  275. // non-interface field appearing in ForceSendFields will be sent to the
  276. // server regardless of whether the field is empty or not. This may be
  277. // used to include empty fields in Patch requests.
  278. ForceSendFields []string `json:"-"`
  279. }
  280. func (s *About) MarshalJSON() ([]byte, error) {
  281. type noMethod About
  282. raw := noMethod(*s)
  283. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  284. }
  285. type AboutAdditionalRoleInfo struct {
  286. // RoleSets: The supported additional roles per primary role.
  287. RoleSets []*AboutAdditionalRoleInfoRoleSets `json:"roleSets,omitempty"`
  288. // Type: The content type that this additional role info applies to.
  289. Type string `json:"type,omitempty"`
  290. // ForceSendFields is a list of field names (e.g. "RoleSets") to
  291. // unconditionally include in API requests. By default, fields with
  292. // empty values are omitted from API requests. However, any non-pointer,
  293. // non-interface field appearing in ForceSendFields will be sent to the
  294. // server regardless of whether the field is empty or not. This may be
  295. // used to include empty fields in Patch requests.
  296. ForceSendFields []string `json:"-"`
  297. }
  298. func (s *AboutAdditionalRoleInfo) MarshalJSON() ([]byte, error) {
  299. type noMethod AboutAdditionalRoleInfo
  300. raw := noMethod(*s)
  301. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  302. }
  303. type AboutAdditionalRoleInfoRoleSets struct {
  304. // AdditionalRoles: The supported additional roles with the primary
  305. // role.
  306. AdditionalRoles []string `json:"additionalRoles,omitempty"`
  307. // PrimaryRole: A primary permission role.
  308. PrimaryRole string `json:"primaryRole,omitempty"`
  309. // ForceSendFields is a list of field names (e.g. "AdditionalRoles") to
  310. // unconditionally include in API requests. By default, fields with
  311. // empty values are omitted from API requests. However, any non-pointer,
  312. // non-interface field appearing in ForceSendFields will be sent to the
  313. // server regardless of whether the field is empty or not. This may be
  314. // used to include empty fields in Patch requests.
  315. ForceSendFields []string `json:"-"`
  316. }
  317. func (s *AboutAdditionalRoleInfoRoleSets) MarshalJSON() ([]byte, error) {
  318. type noMethod AboutAdditionalRoleInfoRoleSets
  319. raw := noMethod(*s)
  320. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  321. }
  322. type AboutExportFormats struct {
  323. // Source: The content type to convert from.
  324. Source string `json:"source,omitempty"`
  325. // Targets: The possible content types to convert to.
  326. Targets []string `json:"targets,omitempty"`
  327. // ForceSendFields is a list of field names (e.g. "Source") to
  328. // unconditionally include in API requests. By default, fields with
  329. // empty values are omitted from API requests. However, any non-pointer,
  330. // non-interface field appearing in ForceSendFields will be sent to the
  331. // server regardless of whether the field is empty or not. This may be
  332. // used to include empty fields in Patch requests.
  333. ForceSendFields []string `json:"-"`
  334. }
  335. func (s *AboutExportFormats) MarshalJSON() ([]byte, error) {
  336. type noMethod AboutExportFormats
  337. raw := noMethod(*s)
  338. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  339. }
  340. type AboutFeatures struct {
  341. // FeatureName: The name of the feature.
  342. FeatureName string `json:"featureName,omitempty"`
  343. // FeatureRate: The request limit rate for this feature, in queries per
  344. // second.
  345. FeatureRate float64 `json:"featureRate,omitempty"`
  346. // ForceSendFields is a list of field names (e.g. "FeatureName") to
  347. // unconditionally include in API requests. By default, fields with
  348. // empty values are omitted from API requests. However, any non-pointer,
  349. // non-interface field appearing in ForceSendFields will be sent to the
  350. // server regardless of whether the field is empty or not. This may be
  351. // used to include empty fields in Patch requests.
  352. ForceSendFields []string `json:"-"`
  353. }
  354. func (s *AboutFeatures) MarshalJSON() ([]byte, error) {
  355. type noMethod AboutFeatures
  356. raw := noMethod(*s)
  357. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  358. }
  359. type AboutImportFormats struct {
  360. // Source: The imported file's content type to convert from.
  361. Source string `json:"source,omitempty"`
  362. // Targets: The possible content types to convert to.
  363. Targets []string `json:"targets,omitempty"`
  364. // ForceSendFields is a list of field names (e.g. "Source") to
  365. // unconditionally include in API requests. By default, fields with
  366. // empty values are omitted from API requests. However, any non-pointer,
  367. // non-interface field appearing in ForceSendFields will be sent to the
  368. // server regardless of whether the field is empty or not. This may be
  369. // used to include empty fields in Patch requests.
  370. ForceSendFields []string `json:"-"`
  371. }
  372. func (s *AboutImportFormats) MarshalJSON() ([]byte, error) {
  373. type noMethod AboutImportFormats
  374. raw := noMethod(*s)
  375. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  376. }
  377. type AboutMaxUploadSizes struct {
  378. // Size: The max upload size for this type.
  379. Size int64 `json:"size,omitempty,string"`
  380. // Type: The file type.
  381. Type string `json:"type,omitempty"`
  382. // ForceSendFields is a list of field names (e.g. "Size") 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 *AboutMaxUploadSizes) MarshalJSON() ([]byte, error) {
  391. type noMethod AboutMaxUploadSizes
  392. raw := noMethod(*s)
  393. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  394. }
  395. type AboutQuotaBytesByService struct {
  396. // BytesUsed: The storage quota bytes used by the service.
  397. BytesUsed int64 `json:"bytesUsed,omitempty,string"`
  398. // ServiceName: The service's name, e.g. DRIVE, GMAIL, or PHOTOS.
  399. ServiceName string `json:"serviceName,omitempty"`
  400. // ForceSendFields is a list of field names (e.g. "BytesUsed") to
  401. // unconditionally include in API requests. By default, fields with
  402. // empty values are omitted from API requests. However, any non-pointer,
  403. // non-interface field appearing in ForceSendFields will be sent to the
  404. // server regardless of whether the field is empty or not. This may be
  405. // used to include empty fields in Patch requests.
  406. ForceSendFields []string `json:"-"`
  407. }
  408. func (s *AboutQuotaBytesByService) MarshalJSON() ([]byte, error) {
  409. type noMethod AboutQuotaBytesByService
  410. raw := noMethod(*s)
  411. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  412. }
  413. // App: The apps resource provides a list of the apps that a user has
  414. // installed, with information about each app's supported MIME types,
  415. // file extensions, and other details.
  416. type App struct {
  417. // Authorized: Whether the app is authorized to access data on the
  418. // user's Drive.
  419. Authorized bool `json:"authorized,omitempty"`
  420. // CreateInFolderTemplate: The template url to create a new file with
  421. // this app in a given folder. The template will contain {folderId} to
  422. // be replaced by the folder to create the new file in.
  423. CreateInFolderTemplate string `json:"createInFolderTemplate,omitempty"`
  424. // CreateUrl: The url to create a new file with this app.
  425. CreateUrl string `json:"createUrl,omitempty"`
  426. // HasDriveWideScope: Whether the app has drive-wide scope. An app with
  427. // drive-wide scope can access all files in the user's drive.
  428. HasDriveWideScope bool `json:"hasDriveWideScope,omitempty"`
  429. // Icons: The various icons for the app.
  430. Icons []*AppIcons `json:"icons,omitempty"`
  431. // Id: The ID of the app.
  432. Id string `json:"id,omitempty"`
  433. // Installed: Whether the app is installed.
  434. Installed bool `json:"installed,omitempty"`
  435. // Kind: This is always drive#app.
  436. Kind string `json:"kind,omitempty"`
  437. // LongDescription: A long description of the app.
  438. LongDescription string `json:"longDescription,omitempty"`
  439. // Name: The name of the app.
  440. Name string `json:"name,omitempty"`
  441. // ObjectType: The type of object this app creates (e.g. Chart). If
  442. // empty, the app name should be used instead.
  443. ObjectType string `json:"objectType,omitempty"`
  444. // OpenUrlTemplate: The template url for opening files with this app.
  445. // The template will contain {ids} and/or {exportIds} to be replaced by
  446. // the actual file ids. See Open Files for the full documentation.
  447. OpenUrlTemplate string `json:"openUrlTemplate,omitempty"`
  448. // PrimaryFileExtensions: The list of primary file extensions.
  449. PrimaryFileExtensions []string `json:"primaryFileExtensions,omitempty"`
  450. // PrimaryMimeTypes: The list of primary mime types.
  451. PrimaryMimeTypes []string `json:"primaryMimeTypes,omitempty"`
  452. // ProductId: The ID of the product listing for this app.
  453. ProductId string `json:"productId,omitempty"`
  454. // ProductUrl: A link to the product listing for this app.
  455. ProductUrl string `json:"productUrl,omitempty"`
  456. // SecondaryFileExtensions: The list of secondary file extensions.
  457. SecondaryFileExtensions []string `json:"secondaryFileExtensions,omitempty"`
  458. // SecondaryMimeTypes: The list of secondary mime types.
  459. SecondaryMimeTypes []string `json:"secondaryMimeTypes,omitempty"`
  460. // ShortDescription: A short description of the app.
  461. ShortDescription string `json:"shortDescription,omitempty"`
  462. // SupportsCreate: Whether this app supports creating new objects.
  463. SupportsCreate bool `json:"supportsCreate,omitempty"`
  464. // SupportsImport: Whether this app supports importing Google Docs.
  465. SupportsImport bool `json:"supportsImport,omitempty"`
  466. // SupportsMultiOpen: Whether this app supports opening more than one
  467. // file.
  468. SupportsMultiOpen bool `json:"supportsMultiOpen,omitempty"`
  469. // SupportsOfflineCreate: Whether this app supports creating new files
  470. // when offline.
  471. SupportsOfflineCreate bool `json:"supportsOfflineCreate,omitempty"`
  472. // UseByDefault: Whether the app is selected as the default handler for
  473. // the types it supports.
  474. UseByDefault bool `json:"useByDefault,omitempty"`
  475. // ServerResponse contains the HTTP response code and headers from the
  476. // server.
  477. googleapi.ServerResponse `json:"-"`
  478. // ForceSendFields is a list of field names (e.g. "Authorized") to
  479. // unconditionally include in API requests. By default, fields with
  480. // empty values are omitted from API requests. However, any non-pointer,
  481. // non-interface field appearing in ForceSendFields will be sent to the
  482. // server regardless of whether the field is empty or not. This may be
  483. // used to include empty fields in Patch requests.
  484. ForceSendFields []string `json:"-"`
  485. }
  486. func (s *App) MarshalJSON() ([]byte, error) {
  487. type noMethod App
  488. raw := noMethod(*s)
  489. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  490. }
  491. type AppIcons struct {
  492. // Category: Category of the icon. Allowed values are:
  493. // - application - icon for the application
  494. // - document - icon for a file associated with the app
  495. // - documentShared - icon for a shared file associated with the app
  496. Category string `json:"category,omitempty"`
  497. // IconUrl: URL for the icon.
  498. IconUrl string `json:"iconUrl,omitempty"`
  499. // Size: Size of the icon. Represented as the maximum of the width and
  500. // height.
  501. Size int64 `json:"size,omitempty"`
  502. // ForceSendFields is a list of field names (e.g. "Category") to
  503. // unconditionally include in API requests. By default, fields with
  504. // empty values are omitted from API requests. However, any non-pointer,
  505. // non-interface field appearing in ForceSendFields will be sent to the
  506. // server regardless of whether the field is empty or not. This may be
  507. // used to include empty fields in Patch requests.
  508. ForceSendFields []string `json:"-"`
  509. }
  510. func (s *AppIcons) MarshalJSON() ([]byte, error) {
  511. type noMethod AppIcons
  512. raw := noMethod(*s)
  513. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  514. }
  515. // AppList: A list of third-party applications which the user has
  516. // installed or given access to Google Drive.
  517. type AppList struct {
  518. // DefaultAppIds: List of app IDs that the user has specified to use by
  519. // default. The list is in reverse-priority order (lowest to highest).
  520. DefaultAppIds []string `json:"defaultAppIds,omitempty"`
  521. // Etag: The ETag of the list.
  522. Etag string `json:"etag,omitempty"`
  523. // Items: The actual list of apps.
  524. Items []*App `json:"items,omitempty"`
  525. // Kind: This is always drive#appList.
  526. Kind string `json:"kind,omitempty"`
  527. // SelfLink: A link back to this list.
  528. SelfLink string `json:"selfLink,omitempty"`
  529. // ServerResponse contains the HTTP response code and headers from the
  530. // server.
  531. googleapi.ServerResponse `json:"-"`
  532. // ForceSendFields is a list of field names (e.g. "DefaultAppIds") to
  533. // unconditionally include in API requests. By default, fields with
  534. // empty values are omitted from API requests. However, any non-pointer,
  535. // non-interface field appearing in ForceSendFields will be sent to the
  536. // server regardless of whether the field is empty or not. This may be
  537. // used to include empty fields in Patch requests.
  538. ForceSendFields []string `json:"-"`
  539. }
  540. func (s *AppList) MarshalJSON() ([]byte, error) {
  541. type noMethod AppList
  542. raw := noMethod(*s)
  543. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  544. }
  545. // Change: Representation of a change to a file.
  546. type Change struct {
  547. // Deleted: Whether the file has been deleted.
  548. Deleted bool `json:"deleted,omitempty"`
  549. // File: The updated state of the file. Present if the file has not been
  550. // deleted.
  551. File *File `json:"file,omitempty"`
  552. // FileId: The ID of the file associated with this change.
  553. FileId string `json:"fileId,omitempty"`
  554. // Id: The ID of the change.
  555. Id int64 `json:"id,omitempty,string"`
  556. // Kind: This is always drive#change.
  557. Kind string `json:"kind,omitempty"`
  558. // ModificationDate: The time of this modification.
  559. ModificationDate string `json:"modificationDate,omitempty"`
  560. // SelfLink: A link back to this change.
  561. SelfLink string `json:"selfLink,omitempty"`
  562. // ServerResponse contains the HTTP response code and headers from the
  563. // server.
  564. googleapi.ServerResponse `json:"-"`
  565. // ForceSendFields is a list of field names (e.g. "Deleted") to
  566. // unconditionally include in API requests. By default, fields with
  567. // empty values are omitted from API requests. However, any non-pointer,
  568. // non-interface field appearing in ForceSendFields will be sent to the
  569. // server regardless of whether the field is empty or not. This may be
  570. // used to include empty fields in Patch requests.
  571. ForceSendFields []string `json:"-"`
  572. }
  573. func (s *Change) MarshalJSON() ([]byte, error) {
  574. type noMethod Change
  575. raw := noMethod(*s)
  576. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  577. }
  578. // ChangeList: A list of changes for a user.
  579. type ChangeList struct {
  580. // Etag: The ETag of the list.
  581. Etag string `json:"etag,omitempty"`
  582. // Items: The actual list of changes.
  583. Items []*Change `json:"items,omitempty"`
  584. // Kind: This is always drive#changeList.
  585. Kind string `json:"kind,omitempty"`
  586. // LargestChangeId: The current largest change ID.
  587. LargestChangeId int64 `json:"largestChangeId,omitempty,string"`
  588. // NextLink: A link to the next page of changes.
  589. NextLink string `json:"nextLink,omitempty"`
  590. // NextPageToken: The page token for the next page of changes.
  591. NextPageToken string `json:"nextPageToken,omitempty"`
  592. // SelfLink: A link back to this list.
  593. SelfLink string `json:"selfLink,omitempty"`
  594. // ServerResponse contains the HTTP response code and headers from the
  595. // server.
  596. googleapi.ServerResponse `json:"-"`
  597. // ForceSendFields is a list of field names (e.g. "Etag") to
  598. // unconditionally include in API requests. By default, fields with
  599. // empty values are omitted from API requests. However, any non-pointer,
  600. // non-interface field appearing in ForceSendFields will be sent to the
  601. // server regardless of whether the field is empty or not. This may be
  602. // used to include empty fields in Patch requests.
  603. ForceSendFields []string `json:"-"`
  604. }
  605. func (s *ChangeList) MarshalJSON() ([]byte, error) {
  606. type noMethod ChangeList
  607. raw := noMethod(*s)
  608. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  609. }
  610. // Channel: An notification channel used to watch for resource changes.
  611. type Channel struct {
  612. // Address: The address where notifications are delivered for this
  613. // channel.
  614. Address string `json:"address,omitempty"`
  615. // Expiration: Date and time of notification channel expiration,
  616. // expressed as a Unix timestamp, in milliseconds. Optional.
  617. Expiration int64 `json:"expiration,omitempty,string"`
  618. // Id: A UUID or similar unique string that identifies this channel.
  619. Id string `json:"id,omitempty"`
  620. // Kind: Identifies this as a notification channel used to watch for
  621. // changes to a resource. Value: the fixed string "api#channel".
  622. Kind string `json:"kind,omitempty"`
  623. // Params: Additional parameters controlling delivery channel behavior.
  624. // Optional.
  625. Params map[string]string `json:"params,omitempty"`
  626. // Payload: A Boolean value to indicate whether payload is wanted.
  627. // Optional.
  628. Payload bool `json:"payload,omitempty"`
  629. // ResourceId: An opaque ID that identifies the resource being watched
  630. // on this channel. Stable across different API versions.
  631. ResourceId string `json:"resourceId,omitempty"`
  632. // ResourceUri: A version-specific identifier for the watched resource.
  633. ResourceUri string `json:"resourceUri,omitempty"`
  634. // Token: An arbitrary string delivered to the target address with each
  635. // notification delivered over this channel. Optional.
  636. Token string `json:"token,omitempty"`
  637. // Type: The type of delivery mechanism used for this channel.
  638. Type string `json:"type,omitempty"`
  639. // ServerResponse contains the HTTP response code and headers from the
  640. // server.
  641. googleapi.ServerResponse `json:"-"`
  642. // ForceSendFields is a list of field names (e.g. "Address") to
  643. // unconditionally include in API requests. By default, fields with
  644. // empty values are omitted from API requests. However, any non-pointer,
  645. // non-interface field appearing in ForceSendFields will be sent to the
  646. // server regardless of whether the field is empty or not. This may be
  647. // used to include empty fields in Patch requests.
  648. ForceSendFields []string `json:"-"`
  649. }
  650. func (s *Channel) MarshalJSON() ([]byte, error) {
  651. type noMethod Channel
  652. raw := noMethod(*s)
  653. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  654. }
  655. // ChildList: A list of children of a file.
  656. type ChildList struct {
  657. // Etag: The ETag of the list.
  658. Etag string `json:"etag,omitempty"`
  659. // Items: The actual list of children.
  660. Items []*ChildReference `json:"items,omitempty"`
  661. // Kind: This is always drive#childList.
  662. Kind string `json:"kind,omitempty"`
  663. // NextLink: A link to the next page of children.
  664. NextLink string `json:"nextLink,omitempty"`
  665. // NextPageToken: The page token for the next page of children.
  666. NextPageToken string `json:"nextPageToken,omitempty"`
  667. // SelfLink: A link back to this list.
  668. SelfLink string `json:"selfLink,omitempty"`
  669. // ServerResponse contains the HTTP response code and headers from the
  670. // server.
  671. googleapi.ServerResponse `json:"-"`
  672. // ForceSendFields is a list of field names (e.g. "Etag") to
  673. // unconditionally include in API requests. By default, fields with
  674. // empty values are omitted from API requests. However, any non-pointer,
  675. // non-interface field appearing in ForceSendFields will be sent to the
  676. // server regardless of whether the field is empty or not. This may be
  677. // used to include empty fields in Patch requests.
  678. ForceSendFields []string `json:"-"`
  679. }
  680. func (s *ChildList) MarshalJSON() ([]byte, error) {
  681. type noMethod ChildList
  682. raw := noMethod(*s)
  683. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  684. }
  685. // ChildReference: A reference to a folder's child.
  686. type ChildReference struct {
  687. // ChildLink: A link to the child.
  688. ChildLink string `json:"childLink,omitempty"`
  689. // Id: The ID of the child.
  690. Id string `json:"id,omitempty"`
  691. // Kind: This is always drive#childReference.
  692. Kind string `json:"kind,omitempty"`
  693. // SelfLink: A link back to this reference.
  694. SelfLink string `json:"selfLink,omitempty"`
  695. // ServerResponse contains the HTTP response code and headers from the
  696. // server.
  697. googleapi.ServerResponse `json:"-"`
  698. // ForceSendFields is a list of field names (e.g. "ChildLink") to
  699. // unconditionally include in API requests. By default, fields with
  700. // empty values are omitted from API requests. However, any non-pointer,
  701. // non-interface field appearing in ForceSendFields will be sent to the
  702. // server regardless of whether the field is empty or not. This may be
  703. // used to include empty fields in Patch requests.
  704. ForceSendFields []string `json:"-"`
  705. }
  706. func (s *ChildReference) MarshalJSON() ([]byte, error) {
  707. type noMethod ChildReference
  708. raw := noMethod(*s)
  709. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  710. }
  711. // Comment: A comment on a file in Google Drive.
  712. type Comment struct {
  713. // Anchor: A region of the document represented as a JSON string. See
  714. // anchor documentation for details on how to define and interpret
  715. // anchor properties.
  716. Anchor string `json:"anchor,omitempty"`
  717. // Author: The user who wrote this comment.
  718. Author *User `json:"author,omitempty"`
  719. // CommentId: The ID of the comment.
  720. CommentId string `json:"commentId,omitempty"`
  721. // Content: The plain text content used to create this comment. This is
  722. // not HTML safe and should only be used as a starting point to make
  723. // edits to a comment's content.
  724. Content string `json:"content,omitempty"`
  725. // Context: The context of the file which is being commented on.
  726. Context *CommentContext `json:"context,omitempty"`
  727. // CreatedDate: The date when this comment was first created.
  728. CreatedDate string `json:"createdDate,omitempty"`
  729. // Deleted: Whether this comment has been deleted. If a comment has been
  730. // deleted the content will be cleared and this will only represent a
  731. // comment that once existed.
  732. Deleted bool `json:"deleted,omitempty"`
  733. // FileId: The file which this comment is addressing.
  734. FileId string `json:"fileId,omitempty"`
  735. // FileTitle: The title of the file which this comment is addressing.
  736. FileTitle string `json:"fileTitle,omitempty"`
  737. // HtmlContent: HTML formatted content for this comment.
  738. HtmlContent string `json:"htmlContent,omitempty"`
  739. // Kind: This is always drive#comment.
  740. Kind string `json:"kind,omitempty"`
  741. // ModifiedDate: The date when this comment or any of its replies were
  742. // last modified.
  743. ModifiedDate string `json:"modifiedDate,omitempty"`
  744. // Replies: Replies to this post.
  745. Replies []*CommentReply `json:"replies,omitempty"`
  746. // SelfLink: A link back to this comment.
  747. SelfLink string `json:"selfLink,omitempty"`
  748. // Status: The status of this comment. Status can be changed by posting
  749. // a reply to a comment with the desired status.
  750. // - "open" - The comment is still open.
  751. // - "resolved" - The comment has been resolved by one of its replies.
  752. Status string `json:"status,omitempty"`
  753. // ServerResponse contains the HTTP response code and headers from the
  754. // server.
  755. googleapi.ServerResponse `json:"-"`
  756. // ForceSendFields is a list of field names (e.g. "Anchor") to
  757. // unconditionally include in API requests. By default, fields with
  758. // empty values are omitted from API requests. However, any non-pointer,
  759. // non-interface field appearing in ForceSendFields will be sent to the
  760. // server regardless of whether the field is empty or not. This may be
  761. // used to include empty fields in Patch requests.
  762. ForceSendFields []string `json:"-"`
  763. }
  764. func (s *Comment) MarshalJSON() ([]byte, error) {
  765. type noMethod Comment
  766. raw := noMethod(*s)
  767. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  768. }
  769. // CommentContext: The context of the file which is being commented on.
  770. type CommentContext struct {
  771. // Type: The MIME type of the context snippet.
  772. Type string `json:"type,omitempty"`
  773. // Value: Data representation of the segment of the file being commented
  774. // on. In the case of a text file for example, this would be the actual
  775. // text that the comment is about.
  776. Value string `json:"value,omitempty"`
  777. // ForceSendFields is a list of field names (e.g. "Type") to
  778. // unconditionally include in API requests. By default, fields with
  779. // empty values are omitted from API requests. However, any non-pointer,
  780. // non-interface field appearing in ForceSendFields will be sent to the
  781. // server regardless of whether the field is empty or not. This may be
  782. // used to include empty fields in Patch requests.
  783. ForceSendFields []string `json:"-"`
  784. }
  785. func (s *CommentContext) MarshalJSON() ([]byte, error) {
  786. type noMethod CommentContext
  787. raw := noMethod(*s)
  788. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  789. }
  790. // CommentList: A list of comments on a file in Google Drive.
  791. type CommentList struct {
  792. // Items: List of comments.
  793. Items []*Comment `json:"items,omitempty"`
  794. // Kind: This is always drive#commentList.
  795. Kind string `json:"kind,omitempty"`
  796. // NextLink: A link to the next page of comments.
  797. NextLink string `json:"nextLink,omitempty"`
  798. // NextPageToken: The token to use to request the next page of results.
  799. NextPageToken string `json:"nextPageToken,omitempty"`
  800. // SelfLink: A link back to this list.
  801. SelfLink string `json:"selfLink,omitempty"`
  802. // ServerResponse contains the HTTP response code and headers from the
  803. // server.
  804. googleapi.ServerResponse `json:"-"`
  805. // ForceSendFields is a list of field names (e.g. "Items") to
  806. // unconditionally include in API requests. By default, fields with
  807. // empty values are omitted from API requests. However, any non-pointer,
  808. // non-interface field appearing in ForceSendFields will be sent to the
  809. // server regardless of whether the field is empty or not. This may be
  810. // used to include empty fields in Patch requests.
  811. ForceSendFields []string `json:"-"`
  812. }
  813. func (s *CommentList) MarshalJSON() ([]byte, error) {
  814. type noMethod CommentList
  815. raw := noMethod(*s)
  816. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  817. }
  818. // CommentReply: A comment on a file in Google Drive.
  819. type CommentReply struct {
  820. // Author: The user who wrote this reply.
  821. Author *User `json:"author,omitempty"`
  822. // Content: The plain text content used to create this reply. This is
  823. // not HTML safe and should only be used as a starting point to make
  824. // edits to a reply's content. This field is required on inserts if no
  825. // verb is specified (resolve/reopen).
  826. Content string `json:"content,omitempty"`
  827. // CreatedDate: The date when this reply was first created.
  828. CreatedDate string `json:"createdDate,omitempty"`
  829. // Deleted: Whether this reply has been deleted. If a reply has been
  830. // deleted the content will be cleared and this will only represent a
  831. // reply that once existed.
  832. Deleted bool `json:"deleted,omitempty"`
  833. // HtmlContent: HTML formatted content for this reply.
  834. HtmlContent string `json:"htmlContent,omitempty"`
  835. // Kind: This is always drive#commentReply.
  836. Kind string `json:"kind,omitempty"`
  837. // ModifiedDate: The date when this reply was last modified.
  838. ModifiedDate string `json:"modifiedDate,omitempty"`
  839. // ReplyId: The ID of the reply.
  840. ReplyId string `json:"replyId,omitempty"`
  841. // Verb: The action this reply performed to the parent comment. When
  842. // creating a new reply this is the action to be perform to the parent
  843. // comment. Possible values are:
  844. // - "resolve" - To resolve a comment.
  845. // - "reopen" - To reopen (un-resolve) a comment.
  846. Verb string `json:"verb,omitempty"`
  847. // ServerResponse contains the HTTP response code and headers from the
  848. // server.
  849. googleapi.ServerResponse `json:"-"`
  850. // ForceSendFields is a list of field names (e.g. "Author") to
  851. // unconditionally include in API requests. By default, fields with
  852. // empty values are omitted from API requests. However, any non-pointer,
  853. // non-interface field appearing in ForceSendFields will be sent to the
  854. // server regardless of whether the field is empty or not. This may be
  855. // used to include empty fields in Patch requests.
  856. ForceSendFields []string `json:"-"`
  857. }
  858. func (s *CommentReply) MarshalJSON() ([]byte, error) {
  859. type noMethod CommentReply
  860. raw := noMethod(*s)
  861. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  862. }
  863. // CommentReplyList: A list of replies to a comment on a file in Google
  864. // Drive.
  865. type CommentReplyList struct {
  866. // Items: List of reply.
  867. Items []*CommentReply `json:"items,omitempty"`
  868. // Kind: This is always drive#commentReplyList.
  869. Kind string `json:"kind,omitempty"`
  870. // NextLink: A link to the next page of replies.
  871. NextLink string `json:"nextLink,omitempty"`
  872. // NextPageToken: The token to use to request the next page of results.
  873. NextPageToken string `json:"nextPageToken,omitempty"`
  874. // SelfLink: A link back to this list.
  875. SelfLink string `json:"selfLink,omitempty"`
  876. // ServerResponse contains the HTTP response code and headers from the
  877. // server.
  878. googleapi.ServerResponse `json:"-"`
  879. // ForceSendFields is a list of field names (e.g. "Items") to
  880. // unconditionally include in API requests. By default, fields with
  881. // empty values are omitted from API requests. However, any non-pointer,
  882. // non-interface field appearing in ForceSendFields will be sent to the
  883. // server regardless of whether the field is empty or not. This may be
  884. // used to include empty fields in Patch requests.
  885. ForceSendFields []string `json:"-"`
  886. }
  887. func (s *CommentReplyList) MarshalJSON() ([]byte, error) {
  888. type noMethod CommentReplyList
  889. raw := noMethod(*s)
  890. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  891. }
  892. // File: The metadata for a file.
  893. type File struct {
  894. // AlternateLink: A link for opening the file in a relevant Google
  895. // editor or viewer.
  896. AlternateLink string `json:"alternateLink,omitempty"`
  897. // AppDataContents: Whether this file is in the Application Data folder.
  898. AppDataContents bool `json:"appDataContents,omitempty"`
  899. // CanComment: Whether the current user can comment on the file.
  900. CanComment bool `json:"canComment,omitempty"`
  901. // Copyable: Whether the file can be copied by the current user.
  902. Copyable bool `json:"copyable,omitempty"`
  903. // CreatedDate: Create time for this file (formatted RFC 3339
  904. // timestamp).
  905. CreatedDate string `json:"createdDate,omitempty"`
  906. // DefaultOpenWithLink: A link to open this file with the user's default
  907. // app for this file. Only populated when the drive.apps.readonly scope
  908. // is used.
  909. DefaultOpenWithLink string `json:"defaultOpenWithLink,omitempty"`
  910. // Description: A short description of the file.
  911. Description string `json:"description,omitempty"`
  912. DownloadUrl string `json:"downloadUrl,omitempty"`
  913. // Editable: Whether the file can be edited by the current user.
  914. Editable bool `json:"editable,omitempty"`
  915. // EmbedLink: A link for embedding the file.
  916. EmbedLink string `json:"embedLink,omitempty"`
  917. // Etag: ETag of the file.
  918. Etag string `json:"etag,omitempty"`
  919. // ExplicitlyTrashed: Whether this file has been explicitly trashed, as
  920. // opposed to recursively trashed.
  921. ExplicitlyTrashed bool `json:"explicitlyTrashed,omitempty"`
  922. // ExportLinks: Links for exporting Google Docs to specific formats.
  923. ExportLinks map[string]string `json:"exportLinks,omitempty"`
  924. // FileExtension: The final component of fullFileExtension with trailing
  925. // text that does not appear to be part of the extension removed. This
  926. // field is only populated for files with content stored in Drive; it is
  927. // not populated for Google Docs or shortcut files.
  928. FileExtension string `json:"fileExtension,omitempty"`
  929. // FileSize: The size of the file in bytes. This field is only populated
  930. // for files with content stored in Drive; it is not populated for
  931. // Google Docs or shortcut files.
  932. FileSize int64 `json:"fileSize,omitempty,string"`
  933. // FolderColorRgb: Folder color as an RGB hex string if the file is a
  934. // folder. The list of supported colors is available in the
  935. // folderColorPalette field of the About resource. If an unsupported
  936. // color is specified, it will be changed to the closest color in the
  937. // palette.
  938. FolderColorRgb string `json:"folderColorRgb,omitempty"`
  939. // FullFileExtension: The full file extension; extracted from the title.
  940. // May contain multiple concatenated extensions, such as "tar.gz".
  941. // Removing an extension from the title does not clear this field;
  942. // however, changing the extension on the title does update this field.
  943. // This field is only populated for files with content stored in Drive;
  944. // it is not populated for Google Docs or shortcut files.
  945. FullFileExtension string `json:"fullFileExtension,omitempty"`
  946. // HeadRevisionId: The ID of the file's head revision. This field is
  947. // only populated for files with content stored in Drive; it is not
  948. // populated for Google Docs or shortcut files.
  949. HeadRevisionId string `json:"headRevisionId,omitempty"`
  950. // IconLink: A link to the file's icon.
  951. IconLink string `json:"iconLink,omitempty"`
  952. // Id: The ID of the file.
  953. Id string `json:"id,omitempty"`
  954. // ImageMediaMetadata: Metadata about image media. This will only be
  955. // present for image types, and its contents will depend on what can be
  956. // parsed from the image content.
  957. ImageMediaMetadata *FileImageMediaMetadata `json:"imageMediaMetadata,omitempty"`
  958. // IndexableText: Indexable text attributes for the file (can only be
  959. // written)
  960. IndexableText *FileIndexableText `json:"indexableText,omitempty"`
  961. // Kind: The type of file. This is always drive#file.
  962. Kind string `json:"kind,omitempty"`
  963. // Labels: A group of labels for the file.
  964. Labels *FileLabels `json:"labels,omitempty"`
  965. // LastModifyingUser: The last user to modify this file.
  966. LastModifyingUser *User `json:"lastModifyingUser,omitempty"`
  967. // LastModifyingUserName: Name of the last user to modify this file.
  968. LastModifyingUserName string `json:"lastModifyingUserName,omitempty"`
  969. // LastViewedByMeDate: Last time this file was viewed by the user
  970. // (formatted RFC 3339 timestamp).
  971. LastViewedByMeDate string `json:"lastViewedByMeDate,omitempty"`
  972. // MarkedViewedByMeDate: Deprecated.
  973. MarkedViewedByMeDate string `json:"markedViewedByMeDate,omitempty"`
  974. // Md5Checksum: An MD5 checksum for the content of this file. This field
  975. // is only populated for files with content stored in Drive; it is not
  976. // populated for Google Docs or shortcut files.
  977. Md5Checksum string `json:"md5Checksum,omitempty"`
  978. // MimeType: The MIME type of the file. This is only mutable on update
  979. // when uploading new content. This field can be left blank, and the
  980. // mimetype will be determined from the uploaded content's MIME type.
  981. MimeType string `json:"mimeType,omitempty"`
  982. // ModifiedByMeDate: Last time this file was modified by the user
  983. // (formatted RFC 3339 timestamp). Note that setting modifiedDate will
  984. // also update the modifiedByMe date for the user which set the date.
  985. ModifiedByMeDate string `json:"modifiedByMeDate,omitempty"`
  986. // ModifiedDate: Last time this file was modified by anyone (formatted
  987. // RFC 3339 timestamp). This is only mutable on update when the
  988. // setModifiedDate parameter is set.
  989. ModifiedDate string `json:"modifiedDate,omitempty"`
  990. // OpenWithLinks: A map of the id of each of the user's apps to a link
  991. // to open this file with that app. Only populated when the
  992. // drive.apps.readonly scope is used.
  993. OpenWithLinks map[string]string `json:"openWithLinks,omitempty"`
  994. // OriginalFilename: The original filename if the file was uploaded
  995. // manually, or the original title if the file was inserted through the
  996. // API. Note that renames of the title will not change the original
  997. // filename. This field is only populated for files with content stored
  998. // in Drive; it is not populated for Google Docs or shortcut files.
  999. OriginalFilename string `json:"originalFilename,omitempty"`
  1000. // OwnedByMe: Whether the file is owned by the current user.
  1001. OwnedByMe bool `json:"ownedByMe,omitempty"`
  1002. // OwnerNames: Name(s) of the owner(s) of this file.
  1003. OwnerNames []string `json:"ownerNames,omitempty"`
  1004. // Owners: The owner(s) of this file.
  1005. Owners []*User `json:"owners,omitempty"`
  1006. // Parents: Collection of parent folders which contain this
  1007. // file.
  1008. // Setting this field will put the file in all of the provided folders.
  1009. // On insert, if no folders are provided, the file will be placed in the
  1010. // default root folder.
  1011. Parents []*ParentReference `json:"parents,omitempty"`
  1012. // Permissions: The list of permissions for users with access to this
  1013. // file.
  1014. Permissions []*Permission `json:"permissions,omitempty"`
  1015. // Properties: The list of properties.
  1016. Properties []*Property `json:"properties,omitempty"`
  1017. // QuotaBytesUsed: The number of quota bytes used by this file.
  1018. QuotaBytesUsed int64 `json:"quotaBytesUsed,omitempty,string"`
  1019. // SelfLink: A link back to this file.
  1020. SelfLink string `json:"selfLink,omitempty"`
  1021. // Shareable: Whether the file's sharing settings can be modified by the
  1022. // current user.
  1023. Shareable bool `json:"shareable,omitempty"`
  1024. // Shared: Whether the file has been shared.
  1025. Shared bool `json:"shared,omitempty"`
  1026. // SharedWithMeDate: Time at which this file was shared with the user
  1027. // (formatted RFC 3339 timestamp).
  1028. SharedWithMeDate string `json:"sharedWithMeDate,omitempty"`
  1029. // SharingUser: User that shared the item with the current user, if
  1030. // available.
  1031. SharingUser *User `json:"sharingUser,omitempty"`
  1032. // Spaces: The list of spaces which contain the file. Supported values
  1033. // are 'drive', 'appDataFolder' and 'photos'.
  1034. Spaces []string `json:"spaces,omitempty"`
  1035. // Thumbnail: Thumbnail for the file. Only accepted on upload and for
  1036. // files that are not already thumbnailed by Google.
  1037. Thumbnail *FileThumbnail `json:"thumbnail,omitempty"`
  1038. // ThumbnailLink: A short-lived link to the file's thumbnail. Typically
  1039. // lasts on the order of hours.
  1040. ThumbnailLink string `json:"thumbnailLink,omitempty"`
  1041. // Title: The title of this file.
  1042. Title string `json:"title,omitempty"`
  1043. // UserPermission: The permissions for the authenticated user on this
  1044. // file.
  1045. UserPermission *Permission `json:"userPermission,omitempty"`
  1046. // Version: A monotonically increasing version number for the file. This
  1047. // reflects every change made to the file on the server, even those not
  1048. // visible to the requesting user.
  1049. Version int64 `json:"version,omitempty,string"`
  1050. // VideoMediaMetadata: Metadata about video media. This will only be
  1051. // present for video types.
  1052. VideoMediaMetadata *FileVideoMediaMetadata `json:"videoMediaMetadata,omitempty"`
  1053. // WebContentLink: A link for downloading the content of the file in a
  1054. // browser using cookie based authentication. In cases where the content
  1055. // is shared publicly, the content can be downloaded without any
  1056. // credentials.
  1057. WebContentLink string `json:"webContentLink,omitempty"`
  1058. // WebViewLink: A link only available on public folders for viewing
  1059. // their static web assets (HTML, CSS, JS, etc) via Google Drive's
  1060. // Website Hosting.
  1061. WebViewLink string `json:"webViewLink,omitempty"`
  1062. // WritersCanShare: Whether writers can share the document with other
  1063. // users.
  1064. WritersCanShare bool `json:"writersCanShare,omitempty"`
  1065. // ServerResponse contains the HTTP response code and headers from the
  1066. // server.
  1067. googleapi.ServerResponse `json:"-"`
  1068. // ForceSendFields is a list of field names (e.g. "AlternateLink") to
  1069. // unconditionally include in API requests. By default, fields with
  1070. // empty values are omitted from API requests. However, any non-pointer,
  1071. // non-interface field appearing in ForceSendFields will be sent to the
  1072. // server regardless of whether the field is empty or not. This may be
  1073. // used to include empty fields in Patch requests.
  1074. ForceSendFields []string `json:"-"`
  1075. }
  1076. func (s *File) MarshalJSON() ([]byte, error) {
  1077. type noMethod File
  1078. raw := noMethod(*s)
  1079. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1080. }
  1081. // FileImageMediaMetadata: Metadata about image media. This will only be
  1082. // present for image types, and its contents will depend on what can be
  1083. // parsed from the image content.
  1084. type FileImageMediaMetadata struct {
  1085. // Aperture: The aperture used to create the photo (f-number).
  1086. Aperture float64 `json:"aperture,omitempty"`
  1087. // CameraMake: The make of the camera used to create the photo.
  1088. CameraMake string `json:"cameraMake,omitempty"`
  1089. // CameraModel: The model of the camera used to create the photo.
  1090. CameraModel string `json:"cameraModel,omitempty"`
  1091. // ColorSpace: The color space of the photo.
  1092. ColorSpace string `json:"colorSpace,omitempty"`
  1093. // Date: The date and time the photo was taken (EXIF format timestamp).
  1094. Date string `json:"date,omitempty"`
  1095. // ExposureBias: The exposure bias of the photo (APEX value).
  1096. ExposureBias float64 `json:"exposureBias,omitempty"`
  1097. // ExposureMode: The exposure mode used to create the photo.
  1098. ExposureMode string `json:"exposureMode,omitempty"`
  1099. // ExposureTime: The length of the exposure, in seconds.
  1100. ExposureTime float64 `json:"exposureTime,omitempty"`
  1101. // FlashUsed: Whether a flash was used to create the photo.
  1102. FlashUsed bool `json:"flashUsed,omitempty"`
  1103. // FocalLength: The focal length used to create the photo, in
  1104. // millimeters.
  1105. FocalLength float64 `json:"focalLength,omitempty"`
  1106. // Height: The height of the image in pixels.
  1107. Height int64 `json:"height,omitempty"`
  1108. // IsoSpeed: The ISO speed used to create the photo.
  1109. IsoSpeed int64 `json:"isoSpeed,omitempty"`
  1110. // Lens: The lens used to create the photo.
  1111. Lens string `json:"lens,omitempty"`
  1112. // Location: Geographic location information stored in the image.
  1113. Location *FileImageMediaMetadataLocation `json:"location,omitempty"`
  1114. // MaxApertureValue: The smallest f-number of the lens at the focal
  1115. // length used to create the photo (APEX value).
  1116. MaxApertureValue float64 `json:"maxApertureValue,omitempty"`
  1117. // MeteringMode: The metering mode used to create the photo.
  1118. MeteringMode string `json:"meteringMode,omitempty"`
  1119. // Rotation: The rotation in clockwise degrees from the image's original
  1120. // orientation.
  1121. Rotation int64 `json:"rotation,omitempty"`
  1122. // Sensor: The type of sensor used to create the photo.
  1123. Sensor string `json:"sensor,omitempty"`
  1124. // SubjectDistance: The distance to the subject of the photo, in meters.
  1125. SubjectDistance int64 `json:"subjectDistance,omitempty"`
  1126. // WhiteBalance: The white balance mode used to create the photo.
  1127. WhiteBalance string `json:"whiteBalance,omitempty"`
  1128. // Width: The width of the image in pixels.
  1129. Width int64 `json:"width,omitempty"`
  1130. // ForceSendFields is a list of field names (e.g. "Aperture") to
  1131. // unconditionally include in API requests. By default, fields with
  1132. // empty values are omitted from API requests. However, any non-pointer,
  1133. // non-interface field appearing in ForceSendFields will be sent to the
  1134. // server regardless of whether the field is empty or not. This may be
  1135. // used to include empty fields in Patch requests.
  1136. ForceSendFields []string `json:"-"`
  1137. }
  1138. func (s *FileImageMediaMetadata) MarshalJSON() ([]byte, error) {
  1139. type noMethod FileImageMediaMetadata
  1140. raw := noMethod(*s)
  1141. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1142. }
  1143. // FileImageMediaMetadataLocation: Geographic location information
  1144. // stored in the image.
  1145. type FileImageMediaMetadataLocation struct {
  1146. // Altitude: The altitude stored in the image.
  1147. Altitude float64 `json:"altitude,omitempty"`
  1148. // Latitude: The latitude stored in the image.
  1149. Latitude float64 `json:"latitude,omitempty"`
  1150. // Longitude: The longitude stored in the image.
  1151. Longitude float64 `json:"longitude,omitempty"`
  1152. // ForceSendFields is a list of field names (e.g. "Altitude") to
  1153. // unconditionally include in API requests. By default, fields with
  1154. // empty values are omitted from API requests. However, any non-pointer,
  1155. // non-interface field appearing in ForceSendFields will be sent to the
  1156. // server regardless of whether the field is empty or not. This may be
  1157. // used to include empty fields in Patch requests.
  1158. ForceSendFields []string `json:"-"`
  1159. }
  1160. func (s *FileImageMediaMetadataLocation) MarshalJSON() ([]byte, error) {
  1161. type noMethod FileImageMediaMetadataLocation
  1162. raw := noMethod(*s)
  1163. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1164. }
  1165. // FileIndexableText: Indexable text attributes for the file (can only
  1166. // be written)
  1167. type FileIndexableText struct {
  1168. // Text: The text to be indexed for this file.
  1169. Text string `json:"text,omitempty"`
  1170. // ForceSendFields is a list of field names (e.g. "Text") to
  1171. // unconditionally include in API requests. By default, fields with
  1172. // empty values are omitted from API requests. However, any non-pointer,
  1173. // non-interface field appearing in ForceSendFields will be sent to the
  1174. // server regardless of whether the field is empty or not. This may be
  1175. // used to include empty fields in Patch requests.
  1176. ForceSendFields []string `json:"-"`
  1177. }
  1178. func (s *FileIndexableText) MarshalJSON() ([]byte, error) {
  1179. type noMethod FileIndexableText
  1180. raw := noMethod(*s)
  1181. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1182. }
  1183. // FileLabels: A group of labels for the file.
  1184. type FileLabels struct {
  1185. // Hidden: Deprecated.
  1186. Hidden bool `json:"hidden,omitempty"`
  1187. // Restricted: Whether viewers and commenters are prevented from
  1188. // downloading, printing, and copying this file.
  1189. Restricted bool `json:"restricted,omitempty"`
  1190. // Starred: Whether this file is starred by the user.
  1191. Starred bool `json:"starred,omitempty"`
  1192. // Trashed: Whether this file has been trashed. This label applies to
  1193. // all users accessing the file; however, only owners are allowed to see
  1194. // and untrash files.
  1195. Trashed bool `json:"trashed,omitempty"`
  1196. // Viewed: Whether this file has been viewed by this user.
  1197. Viewed bool `json:"viewed,omitempty"`
  1198. // ForceSendFields is a list of field names (e.g. "Hidden") to
  1199. // unconditionally include in API requests. By default, fields with
  1200. // empty values are omitted from API requests. However, any non-pointer,
  1201. // non-interface field appearing in ForceSendFields will be sent to the
  1202. // server regardless of whether the field is empty or not. This may be
  1203. // used to include empty fields in Patch requests.
  1204. ForceSendFields []string `json:"-"`
  1205. }
  1206. func (s *FileLabels) MarshalJSON() ([]byte, error) {
  1207. type noMethod FileLabels
  1208. raw := noMethod(*s)
  1209. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1210. }
  1211. // FileThumbnail: Thumbnail for the file. Only accepted on upload and
  1212. // for files that are not already thumbnailed by Google.
  1213. type FileThumbnail struct {
  1214. // Image: The URL-safe Base64 encoded bytes of the thumbnail image. It
  1215. // should conform to RFC 4648 section 5.
  1216. Image string `json:"image,omitempty"`
  1217. // MimeType: The MIME type of the thumbnail.
  1218. MimeType string `json:"mimeType,omitempty"`
  1219. // ForceSendFields is a list of field names (e.g. "Image") to
  1220. // unconditionally include in API requests. By default, fields with
  1221. // empty values are omitted from API requests. However, any non-pointer,
  1222. // non-interface field appearing in ForceSendFields will be sent to the
  1223. // server regardless of whether the field is empty or not. This may be
  1224. // used to include empty fields in Patch requests.
  1225. ForceSendFields []string `json:"-"`
  1226. }
  1227. func (s *FileThumbnail) MarshalJSON() ([]byte, error) {
  1228. type noMethod FileThumbnail
  1229. raw := noMethod(*s)
  1230. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1231. }
  1232. // FileVideoMediaMetadata: Metadata about video media. This will only be
  1233. // present for video types.
  1234. type FileVideoMediaMetadata struct {
  1235. // DurationMillis: The duration of the video in milliseconds.
  1236. DurationMillis int64 `json:"durationMillis,omitempty,string"`
  1237. // Height: The height of the video in pixels.
  1238. Height int64 `json:"height,omitempty"`
  1239. // Width: The width of the video in pixels.
  1240. Width int64 `json:"width,omitempty"`
  1241. // ForceSendFields is a list of field names (e.g. "DurationMillis") to
  1242. // unconditionally include in API requests. By default, fields with
  1243. // empty values are omitted from API requests. However, any non-pointer,
  1244. // non-interface field appearing in ForceSendFields will be sent to the
  1245. // server regardless of whether the field is empty or not. This may be
  1246. // used to include empty fields in Patch requests.
  1247. ForceSendFields []string `json:"-"`
  1248. }
  1249. func (s *FileVideoMediaMetadata) MarshalJSON() ([]byte, error) {
  1250. type noMethod FileVideoMediaMetadata
  1251. raw := noMethod(*s)
  1252. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1253. }
  1254. // FileList: A list of files.
  1255. type FileList struct {
  1256. // Etag: The ETag of the list.
  1257. Etag string `json:"etag,omitempty"`
  1258. // Items: The actual list of files.
  1259. Items []*File `json:"items,omitempty"`
  1260. // Kind: This is always drive#fileList.
  1261. Kind string `json:"kind,omitempty"`
  1262. // NextLink: A link to the next page of files.
  1263. NextLink string `json:"nextLink,omitempty"`
  1264. // NextPageToken: The page token for the next page of files.
  1265. NextPageToken string `json:"nextPageToken,omitempty"`
  1266. // SelfLink: A link back to this list.
  1267. SelfLink string `json:"selfLink,omitempty"`
  1268. // ServerResponse contains the HTTP response code and headers from the
  1269. // server.
  1270. googleapi.ServerResponse `json:"-"`
  1271. // ForceSendFields is a list of field names (e.g. "Etag") to
  1272. // unconditionally include in API requests. By default, fields with
  1273. // empty values are omitted from API requests. However, any non-pointer,
  1274. // non-interface field appearing in ForceSendFields will be sent to the
  1275. // server regardless of whether the field is empty or not. This may be
  1276. // used to include empty fields in Patch requests.
  1277. ForceSendFields []string `json:"-"`
  1278. }
  1279. func (s *FileList) MarshalJSON() ([]byte, error) {
  1280. type noMethod FileList
  1281. raw := noMethod(*s)
  1282. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1283. }
  1284. // GeneratedIds: A list of generated IDs which can be provided in insert
  1285. // requests
  1286. type GeneratedIds struct {
  1287. // Ids: The IDs generated for the requesting user in the specified
  1288. // space.
  1289. Ids []string `json:"ids,omitempty"`
  1290. // Kind: This is always drive#generatedIds
  1291. Kind string `json:"kind,omitempty"`
  1292. // Space: The type of file that can be created with these IDs.
  1293. Space string `json:"space,omitempty"`
  1294. // ServerResponse contains the HTTP response code and headers from the
  1295. // server.
  1296. googleapi.ServerResponse `json:"-"`
  1297. // ForceSendFields is a list of field names (e.g. "Ids") to
  1298. // unconditionally include in API requests. By default, fields with
  1299. // empty values are omitted from API requests. However, any non-pointer,
  1300. // non-interface field appearing in ForceSendFields will be sent to the
  1301. // server regardless of whether the field is empty or not. This may be
  1302. // used to include empty fields in Patch requests.
  1303. ForceSendFields []string `json:"-"`
  1304. }
  1305. func (s *GeneratedIds) MarshalJSON() ([]byte, error) {
  1306. type noMethod GeneratedIds
  1307. raw := noMethod(*s)
  1308. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1309. }
  1310. // ParentList: A list of a file's parents.
  1311. type ParentList struct {
  1312. // Etag: The ETag of the list.
  1313. Etag string `json:"etag,omitempty"`
  1314. // Items: The actual list of parents.
  1315. Items []*ParentReference `json:"items,omitempty"`
  1316. // Kind: This is always drive#parentList.
  1317. Kind string `json:"kind,omitempty"`
  1318. // SelfLink: A link back to this list.
  1319. SelfLink string `json:"selfLink,omitempty"`
  1320. // ServerResponse contains the HTTP response code and headers from the
  1321. // server.
  1322. googleapi.ServerResponse `json:"-"`
  1323. // ForceSendFields is a list of field names (e.g. "Etag") to
  1324. // unconditionally include in API requests. By default, fields with
  1325. // empty values are omitted from API requests. However, any non-pointer,
  1326. // non-interface field appearing in ForceSendFields will be sent to the
  1327. // server regardless of whether the field is empty or not. This may be
  1328. // used to include empty fields in Patch requests.
  1329. ForceSendFields []string `json:"-"`
  1330. }
  1331. func (s *ParentList) MarshalJSON() ([]byte, error) {
  1332. type noMethod ParentList
  1333. raw := noMethod(*s)
  1334. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1335. }
  1336. // ParentReference: A reference to a file's parent.
  1337. type ParentReference struct {
  1338. // Id: The ID of the parent.
  1339. Id string `json:"id,omitempty"`
  1340. // IsRoot: Whether or not the parent is the root folder.
  1341. IsRoot bool `json:"isRoot,omitempty"`
  1342. // Kind: This is always drive#parentReference.
  1343. Kind string `json:"kind,omitempty"`
  1344. // ParentLink: A link to the parent.
  1345. ParentLink string `json:"parentLink,omitempty"`
  1346. // SelfLink: A link back to this reference.
  1347. SelfLink string `json:"selfLink,omitempty"`
  1348. // ServerResponse contains the HTTP response code and headers from the
  1349. // server.
  1350. googleapi.ServerResponse `json:"-"`
  1351. // ForceSendFields is a list of field names (e.g. "Id") to
  1352. // unconditionally include in API requests. By default, fields with
  1353. // empty values are omitted from API requests. However, any non-pointer,
  1354. // non-interface field appearing in ForceSendFields will be sent to the
  1355. // server regardless of whether the field is empty or not. This may be
  1356. // used to include empty fields in Patch requests.
  1357. ForceSendFields []string `json:"-"`
  1358. }
  1359. func (s *ParentReference) MarshalJSON() ([]byte, error) {
  1360. type noMethod ParentReference
  1361. raw := noMethod(*s)
  1362. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1363. }
  1364. // Permission: A permission for a file.
  1365. type Permission struct {
  1366. // AdditionalRoles: Additional roles for this user. Only commenter is
  1367. // currently allowed.
  1368. AdditionalRoles []string `json:"additionalRoles,omitempty"`
  1369. // AuthKey: The authkey parameter required for this permission.
  1370. AuthKey string `json:"authKey,omitempty"`
  1371. // Domain: The domain name of the entity this permission refers to. This
  1372. // is an output-only field which is present when the permission type is
  1373. // user, group or domain.
  1374. Domain string `json:"domain,omitempty"`
  1375. // EmailAddress: The email address of the user or group this permission
  1376. // refers to. This is an output-only field which is present when the
  1377. // permission type is user or group.
  1378. EmailAddress string `json:"emailAddress,omitempty"`
  1379. // Etag: The ETag of the permission.
  1380. Etag string `json:"etag,omitempty"`
  1381. // Id: The ID of the user this permission refers to, and identical to
  1382. // the permissionId in the About and Files resources. When making a
  1383. // drive.permissions.insert request, exactly one of the id or value
  1384. // fields must be specified.
  1385. Id string `json:"id,omitempty"`
  1386. // Kind: This is always drive#permission.
  1387. Kind string `json:"kind,omitempty"`
  1388. // Name: The name for this permission.
  1389. Name string `json:"name,omitempty"`
  1390. // PhotoLink: A link to the profile photo, if available.
  1391. PhotoLink string `json:"photoLink,omitempty"`
  1392. // Role: The primary role for this user. Allowed values are:
  1393. // - owner
  1394. // - reader
  1395. // - writer
  1396. Role string `json:"role,omitempty"`
  1397. // SelfLink: A link back to this permission.
  1398. SelfLink string `json:"selfLink,omitempty"`
  1399. // Type: The account type. Allowed values are:
  1400. // - user
  1401. // - group
  1402. // - domain
  1403. // - anyone
  1404. Type string `json:"type,omitempty"`
  1405. // Value: The email address or domain name for the entity. This is used
  1406. // during inserts and is not populated in responses. When making a
  1407. // drive.permissions.insert request, exactly one of the id or value
  1408. // fields must be specified.
  1409. Value string `json:"value,omitempty"`
  1410. // WithLink: Whether the link is required for this permission.
  1411. WithLink bool `json:"withLink,omitempty"`
  1412. // ServerResponse contains the HTTP response code and headers from the
  1413. // server.
  1414. googleapi.ServerResponse `json:"-"`
  1415. // ForceSendFields is a list of field names (e.g. "AdditionalRoles") to
  1416. // unconditionally include in API requests. By default, fields with
  1417. // empty values are omitted from API requests. However, any non-pointer,
  1418. // non-interface field appearing in ForceSendFields will be sent to the
  1419. // server regardless of whether the field is empty or not. This may be
  1420. // used to include empty fields in Patch requests.
  1421. ForceSendFields []string `json:"-"`
  1422. }
  1423. func (s *Permission) MarshalJSON() ([]byte, error) {
  1424. type noMethod Permission
  1425. raw := noMethod(*s)
  1426. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1427. }
  1428. // PermissionId: An ID for a user or group as seen in Permission items.
  1429. type PermissionId struct {
  1430. // Id: The permission ID.
  1431. Id string `json:"id,omitempty"`
  1432. // Kind: This is always drive#permissionId.
  1433. Kind string `json:"kind,omitempty"`
  1434. // ServerResponse contains the HTTP response code and headers from the
  1435. // server.
  1436. googleapi.ServerResponse `json:"-"`
  1437. // ForceSendFields is a list of field names (e.g. "Id") to
  1438. // unconditionally include in API requests. By default, fields with
  1439. // empty values are omitted from API requests. However, any non-pointer,
  1440. // non-interface field appearing in ForceSendFields will be sent to the
  1441. // server regardless of whether the field is empty or not. This may be
  1442. // used to include empty fields in Patch requests.
  1443. ForceSendFields []string `json:"-"`
  1444. }
  1445. func (s *PermissionId) MarshalJSON() ([]byte, error) {
  1446. type noMethod PermissionId
  1447. raw := noMethod(*s)
  1448. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1449. }
  1450. // PermissionList: A list of permissions associated with a file.
  1451. type PermissionList struct {
  1452. // Etag: The ETag of the list.
  1453. Etag string `json:"etag,omitempty"`
  1454. // Items: The actual list of permissions.
  1455. Items []*Permission `json:"items,omitempty"`
  1456. // Kind: This is always drive#permissionList.
  1457. Kind string `json:"kind,omitempty"`
  1458. // SelfLink: A link back to this list.
  1459. SelfLink string `json:"selfLink,omitempty"`
  1460. // ServerResponse contains the HTTP response code and headers from the
  1461. // server.
  1462. googleapi.ServerResponse `json:"-"`
  1463. // ForceSendFields is a list of field names (e.g. "Etag") to
  1464. // unconditionally include in API requests. By default, fields with
  1465. // empty values are omitted from API requests. However, any non-pointer,
  1466. // non-interface field appearing in ForceSendFields will be sent to the
  1467. // server regardless of whether the field is empty or not. This may be
  1468. // used to include empty fields in Patch requests.
  1469. ForceSendFields []string `json:"-"`
  1470. }
  1471. func (s *PermissionList) MarshalJSON() ([]byte, error) {
  1472. type noMethod PermissionList
  1473. raw := noMethod(*s)
  1474. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1475. }
  1476. // Property: A key-value pair attached to a file that is either public
  1477. // or private to an application.
  1478. // The following limits apply to file properties:
  1479. // - Maximum of 100 properties total per file
  1480. // - Maximum of 30 private properties per app
  1481. // - Maximum of 30 public properties
  1482. // - Maximum of 124 bytes size limit on (key + value) string in UTF-8
  1483. // encoding for a single property.
  1484. type Property struct {
  1485. // Etag: ETag of the property.
  1486. Etag string `json:"etag,omitempty"`
  1487. // Key: The key of this property.
  1488. Key string `json:"key,omitempty"`
  1489. // Kind: This is always drive#property.
  1490. Kind string `json:"kind,omitempty"`
  1491. // SelfLink: The link back to this property.
  1492. SelfLink string `json:"selfLink,omitempty"`
  1493. // Value: The value of this property.
  1494. Value string `json:"value,omitempty"`
  1495. // Visibility: The visibility of this property.
  1496. Visibility string `json:"visibility,omitempty"`
  1497. // ServerResponse contains the HTTP response code and headers from the
  1498. // server.
  1499. googleapi.ServerResponse `json:"-"`
  1500. // ForceSendFields is a list of field names (e.g. "Etag") to
  1501. // unconditionally include in API requests. By default, fields with
  1502. // empty values are omitted from API requests. However, any non-pointer,
  1503. // non-interface field appearing in ForceSendFields will be sent to the
  1504. // server regardless of whether the field is empty or not. This may be
  1505. // used to include empty fields in Patch requests.
  1506. ForceSendFields []string `json:"-"`
  1507. }
  1508. func (s *Property) MarshalJSON() ([]byte, error) {
  1509. type noMethod Property
  1510. raw := noMethod(*s)
  1511. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1512. }
  1513. // PropertyList: A collection of properties, key-value pairs that are
  1514. // either public or private to an application.
  1515. type PropertyList struct {
  1516. // Etag: The ETag of the list.
  1517. Etag string `json:"etag,omitempty"`
  1518. // Items: The list of properties.
  1519. Items []*Property `json:"items,omitempty"`
  1520. // Kind: This is always drive#propertyList.
  1521. Kind string `json:"kind,omitempty"`
  1522. // SelfLink: The link back to this list.
  1523. SelfLink string `json:"selfLink,omitempty"`
  1524. // ServerResponse contains the HTTP response code and headers from the
  1525. // server.
  1526. googleapi.ServerResponse `json:"-"`
  1527. // ForceSendFields is a list of field names (e.g. "Etag") to
  1528. // unconditionally include in API requests. By default, fields with
  1529. // empty values are omitted from API requests. However, any non-pointer,
  1530. // non-interface field appearing in ForceSendFields will be sent to the
  1531. // server regardless of whether the field is empty or not. This may be
  1532. // used to include empty fields in Patch requests.
  1533. ForceSendFields []string `json:"-"`
  1534. }
  1535. func (s *PropertyList) MarshalJSON() ([]byte, error) {
  1536. type noMethod PropertyList
  1537. raw := noMethod(*s)
  1538. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1539. }
  1540. // Revision: A revision of a file.
  1541. type Revision struct {
  1542. // DownloadUrl: Short term download URL for the file. This will only be
  1543. // populated on files with content stored in Drive.
  1544. DownloadUrl string `json:"downloadUrl,omitempty"`
  1545. // Etag: The ETag of the revision.
  1546. Etag string `json:"etag,omitempty"`
  1547. // ExportLinks: Links for exporting Google Docs to specific formats.
  1548. ExportLinks map[string]string `json:"exportLinks,omitempty"`
  1549. // FileSize: The size of the revision in bytes. This will only be
  1550. // populated on files with content stored in Drive.
  1551. FileSize int64 `json:"fileSize,omitempty,string"`
  1552. // Id: The ID of the revision.
  1553. Id string `json:"id,omitempty"`
  1554. // Kind: This is always drive#revision.
  1555. Kind string `json:"kind,omitempty"`
  1556. // LastModifyingUser: The last user to modify this revision.
  1557. LastModifyingUser *User `json:"lastModifyingUser,omitempty"`
  1558. // LastModifyingUserName: Name of the last user to modify this revision.
  1559. LastModifyingUserName string `json:"lastModifyingUserName,omitempty"`
  1560. // Md5Checksum: An MD5 checksum for the content of this revision. This
  1561. // will only be populated on files with content stored in Drive.
  1562. Md5Checksum string `json:"md5Checksum,omitempty"`
  1563. // MimeType: The MIME type of the revision.
  1564. MimeType string `json:"mimeType,omitempty"`
  1565. // ModifiedDate: Last time this revision was modified (formatted RFC
  1566. // 3339 timestamp).
  1567. ModifiedDate string `json:"modifiedDate,omitempty"`
  1568. // OriginalFilename: The original filename when this revision was
  1569. // created. This will only be populated on files with content stored in
  1570. // Drive.
  1571. OriginalFilename string `json:"originalFilename,omitempty"`
  1572. // Pinned: Whether this revision is pinned to prevent automatic purging.
  1573. // This will only be populated and can only be modified on files with
  1574. // content stored in Drive which are not Google Docs. Revisions can also
  1575. // be pinned when they are created through the
  1576. // drive.files.insert/update/copy by using the pinned query parameter.
  1577. Pinned bool `json:"pinned,omitempty"`
  1578. // PublishAuto: Whether subsequent revisions will be automatically
  1579. // republished. This is only populated and can only be modified for
  1580. // Google Docs.
  1581. PublishAuto bool `json:"publishAuto,omitempty"`
  1582. // Published: Whether this revision is published. This is only populated
  1583. // and can only be modified for Google Docs.
  1584. Published bool `json:"published,omitempty"`
  1585. // PublishedLink: A link to the published revision.
  1586. PublishedLink string `json:"publishedLink,omitempty"`
  1587. // PublishedOutsideDomain: Whether this revision is published outside
  1588. // the domain. This is only populated and can only be modified for
  1589. // Google Docs.
  1590. PublishedOutsideDomain bool `json:"publishedOutsideDomain,omitempty"`
  1591. // SelfLink: A link back to this revision.
  1592. SelfLink string `json:"selfLink,omitempty"`
  1593. // ServerResponse contains the HTTP response code and headers from the
  1594. // server.
  1595. googleapi.ServerResponse `json:"-"`
  1596. // ForceSendFields is a list of field names (e.g. "DownloadUrl") to
  1597. // unconditionally include in API requests. By default, fields with
  1598. // empty values are omitted from API requests. However, any non-pointer,
  1599. // non-interface field appearing in ForceSendFields will be sent to the
  1600. // server regardless of whether the field is empty or not. This may be
  1601. // used to include empty fields in Patch requests.
  1602. ForceSendFields []string `json:"-"`
  1603. }
  1604. func (s *Revision) MarshalJSON() ([]byte, error) {
  1605. type noMethod Revision
  1606. raw := noMethod(*s)
  1607. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1608. }
  1609. // RevisionList: A list of revisions of a file.
  1610. type RevisionList struct {
  1611. // Etag: The ETag of the list.
  1612. Etag string `json:"etag,omitempty"`
  1613. // Items: The actual list of revisions.
  1614. Items []*Revision `json:"items,omitempty"`
  1615. // Kind: This is always drive#revisionList.
  1616. Kind string `json:"kind,omitempty"`
  1617. // SelfLink: A link back to this list.
  1618. SelfLink string `json:"selfLink,omitempty"`
  1619. // ServerResponse contains the HTTP response code and headers from the
  1620. // server.
  1621. googleapi.ServerResponse `json:"-"`
  1622. // ForceSendFields is a list of field names (e.g. "Etag") to
  1623. // unconditionally include in API requests. By default, fields with
  1624. // empty values are omitted from API requests. However, any non-pointer,
  1625. // non-interface field appearing in ForceSendFields will be sent to the
  1626. // server regardless of whether the field is empty or not. This may be
  1627. // used to include empty fields in Patch requests.
  1628. ForceSendFields []string `json:"-"`
  1629. }
  1630. func (s *RevisionList) MarshalJSON() ([]byte, error) {
  1631. type noMethod RevisionList
  1632. raw := noMethod(*s)
  1633. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1634. }
  1635. // User: Information about a Drive user.
  1636. type User struct {
  1637. // DisplayName: A plain text displayable name for this user.
  1638. DisplayName string `json:"displayName,omitempty"`
  1639. // EmailAddress: The email address of the user.
  1640. EmailAddress string `json:"emailAddress,omitempty"`
  1641. // IsAuthenticatedUser: Whether this user is the same as the
  1642. // authenticated user for whom the request was made.
  1643. IsAuthenticatedUser bool `json:"isAuthenticatedUser,omitempty"`
  1644. // Kind: This is always drive#user.
  1645. Kind string `json:"kind,omitempty"`
  1646. // PermissionId: The user's ID as visible in the permissions collection.
  1647. PermissionId string `json:"permissionId,omitempty"`
  1648. // Picture: The user's profile picture.
  1649. Picture *UserPicture `json:"picture,omitempty"`
  1650. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  1651. // unconditionally include in API requests. By default, fields with
  1652. // empty values are omitted from API requests. However, any non-pointer,
  1653. // non-interface field appearing in ForceSendFields will be sent to the
  1654. // server regardless of whether the field is empty or not. This may be
  1655. // used to include empty fields in Patch requests.
  1656. ForceSendFields []string `json:"-"`
  1657. }
  1658. func (s *User) MarshalJSON() ([]byte, error) {
  1659. type noMethod User
  1660. raw := noMethod(*s)
  1661. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1662. }
  1663. // UserPicture: The user's profile picture.
  1664. type UserPicture struct {
  1665. // Url: A URL that points to a profile picture of this user.
  1666. Url string `json:"url,omitempty"`
  1667. // ForceSendFields is a list of field names (e.g. "Url") to
  1668. // unconditionally include in API requests. By default, fields with
  1669. // empty values are omitted from API requests. However, any non-pointer,
  1670. // non-interface field appearing in ForceSendFields will be sent to the
  1671. // server regardless of whether the field is empty or not. This may be
  1672. // used to include empty fields in Patch requests.
  1673. ForceSendFields []string `json:"-"`
  1674. }
  1675. func (s *UserPicture) MarshalJSON() ([]byte, error) {
  1676. type noMethod UserPicture
  1677. raw := noMethod(*s)
  1678. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1679. }
  1680. // method id "drive.about.get":
  1681. type AboutGetCall struct {
  1682. s *Service
  1683. urlParams_ gensupport.URLParams
  1684. ifNoneMatch_ string
  1685. ctx_ context.Context
  1686. }
  1687. // Get: Gets the information about the current user along with Drive API
  1688. // settings
  1689. func (r *AboutService) Get() *AboutGetCall {
  1690. c := &AboutGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1691. return c
  1692. }
  1693. // IncludeSubscribed sets the optional parameter "includeSubscribed":
  1694. // When calculating the number of remaining change IDs, whether to
  1695. // include public files the user has opened and shared files. When set
  1696. // to false, this counts only change IDs for owned files and any shared
  1697. // or public files that the user has explicitly added to a folder they
  1698. // own.
  1699. func (c *AboutGetCall) IncludeSubscribed(includeSubscribed bool) *AboutGetCall {
  1700. c.urlParams_.Set("includeSubscribed", fmt.Sprint(includeSubscribed))
  1701. return c
  1702. }
  1703. // MaxChangeIdCount sets the optional parameter "maxChangeIdCount":
  1704. // Maximum number of remaining change IDs to count
  1705. func (c *AboutGetCall) MaxChangeIdCount(maxChangeIdCount int64) *AboutGetCall {
  1706. c.urlParams_.Set("maxChangeIdCount", fmt.Sprint(maxChangeIdCount))
  1707. return c
  1708. }
  1709. // StartChangeId sets the optional parameter "startChangeId": Change ID
  1710. // to start counting from when calculating number of remaining change
  1711. // IDs
  1712. func (c *AboutGetCall) StartChangeId(startChangeId int64) *AboutGetCall {
  1713. c.urlParams_.Set("startChangeId", fmt.Sprint(startChangeId))
  1714. return c
  1715. }
  1716. // Fields allows partial responses to be retrieved. See
  1717. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1718. // for more information.
  1719. func (c *AboutGetCall) Fields(s ...googleapi.Field) *AboutGetCall {
  1720. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1721. return c
  1722. }
  1723. // IfNoneMatch sets the optional parameter which makes the operation
  1724. // fail if the object's ETag matches the given value. This is useful for
  1725. // getting updates only after the object has changed since the last
  1726. // request. Use googleapi.IsNotModified to check whether the response
  1727. // error from Do is the result of In-None-Match.
  1728. func (c *AboutGetCall) IfNoneMatch(entityTag string) *AboutGetCall {
  1729. c.ifNoneMatch_ = entityTag
  1730. return c
  1731. }
  1732. // Context sets the context to be used in this call's Do method. Any
  1733. // pending HTTP request will be aborted if the provided context is
  1734. // canceled.
  1735. func (c *AboutGetCall) Context(ctx context.Context) *AboutGetCall {
  1736. c.ctx_ = ctx
  1737. return c
  1738. }
  1739. func (c *AboutGetCall) doRequest(alt string) (*http.Response, error) {
  1740. var body io.Reader = nil
  1741. c.urlParams_.Set("alt", alt)
  1742. urls := googleapi.ResolveRelative(c.s.BasePath, "about")
  1743. urls += "?" + c.urlParams_.Encode()
  1744. req, _ := http.NewRequest("GET", urls, body)
  1745. googleapi.SetOpaque(req.URL)
  1746. req.Header.Set("User-Agent", c.s.userAgent())
  1747. if c.ifNoneMatch_ != "" {
  1748. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1749. }
  1750. if c.ctx_ != nil {
  1751. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1752. }
  1753. return c.s.client.Do(req)
  1754. }
  1755. // Do executes the "drive.about.get" call.
  1756. // Exactly one of *About or error will be non-nil. Any non-2xx status
  1757. // code is an error. Response headers are in either
  1758. // *About.ServerResponse.Header or (if a response was returned at all)
  1759. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1760. // check whether the returned error was because http.StatusNotModified
  1761. // was returned.
  1762. func (c *AboutGetCall) Do(opts ...googleapi.CallOption) (*About, error) {
  1763. gensupport.SetOptions(c.urlParams_, opts...)
  1764. res, err := c.doRequest("json")
  1765. if res != nil && res.StatusCode == http.StatusNotModified {
  1766. if res.Body != nil {
  1767. res.Body.Close()
  1768. }
  1769. return nil, &googleapi.Error{
  1770. Code: res.StatusCode,
  1771. Header: res.Header,
  1772. }
  1773. }
  1774. if err != nil {
  1775. return nil, err
  1776. }
  1777. defer googleapi.CloseBody(res)
  1778. if err := googleapi.CheckResponse(res); err != nil {
  1779. return nil, err
  1780. }
  1781. ret := &About{
  1782. ServerResponse: googleapi.ServerResponse{
  1783. Header: res.Header,
  1784. HTTPStatusCode: res.StatusCode,
  1785. },
  1786. }
  1787. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1788. return nil, err
  1789. }
  1790. return ret, nil
  1791. // {
  1792. // "description": "Gets the information about the current user along with Drive API settings",
  1793. // "httpMethod": "GET",
  1794. // "id": "drive.about.get",
  1795. // "parameters": {
  1796. // "includeSubscribed": {
  1797. // "default": "true",
  1798. // "description": "When calculating the number of remaining change IDs, whether to include public files the user has opened and shared files. When set to false, this counts only change IDs for owned files and any shared or public files that the user has explicitly added to a folder they own.",
  1799. // "location": "query",
  1800. // "type": "boolean"
  1801. // },
  1802. // "maxChangeIdCount": {
  1803. // "default": "1",
  1804. // "description": "Maximum number of remaining change IDs to count",
  1805. // "format": "int64",
  1806. // "location": "query",
  1807. // "type": "string"
  1808. // },
  1809. // "startChangeId": {
  1810. // "description": "Change ID to start counting from when calculating number of remaining change IDs",
  1811. // "format": "int64",
  1812. // "location": "query",
  1813. // "type": "string"
  1814. // }
  1815. // },
  1816. // "path": "about",
  1817. // "response": {
  1818. // "$ref": "About"
  1819. // },
  1820. // "scopes": [
  1821. // "https://www.googleapis.com/auth/drive",
  1822. // "https://www.googleapis.com/auth/drive.appdata",
  1823. // "https://www.googleapis.com/auth/drive.file",
  1824. // "https://www.googleapis.com/auth/drive.metadata",
  1825. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  1826. // "https://www.googleapis.com/auth/drive.photos.readonly",
  1827. // "https://www.googleapis.com/auth/drive.readonly"
  1828. // ]
  1829. // }
  1830. }
  1831. // method id "drive.apps.get":
  1832. type AppsGetCall struct {
  1833. s *Service
  1834. appId string
  1835. urlParams_ gensupport.URLParams
  1836. ifNoneMatch_ string
  1837. ctx_ context.Context
  1838. }
  1839. // Get: Gets a specific app.
  1840. func (r *AppsService) Get(appId string) *AppsGetCall {
  1841. c := &AppsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1842. c.appId = appId
  1843. return c
  1844. }
  1845. // Fields allows partial responses to be retrieved. See
  1846. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1847. // for more information.
  1848. func (c *AppsGetCall) Fields(s ...googleapi.Field) *AppsGetCall {
  1849. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1850. return c
  1851. }
  1852. // IfNoneMatch sets the optional parameter which makes the operation
  1853. // fail if the object's ETag matches the given value. This is useful for
  1854. // getting updates only after the object has changed since the last
  1855. // request. Use googleapi.IsNotModified to check whether the response
  1856. // error from Do is the result of In-None-Match.
  1857. func (c *AppsGetCall) IfNoneMatch(entityTag string) *AppsGetCall {
  1858. c.ifNoneMatch_ = entityTag
  1859. return c
  1860. }
  1861. // Context sets the context to be used in this call's Do method. Any
  1862. // pending HTTP request will be aborted if the provided context is
  1863. // canceled.
  1864. func (c *AppsGetCall) Context(ctx context.Context) *AppsGetCall {
  1865. c.ctx_ = ctx
  1866. return c
  1867. }
  1868. func (c *AppsGetCall) doRequest(alt string) (*http.Response, error) {
  1869. var body io.Reader = nil
  1870. c.urlParams_.Set("alt", alt)
  1871. urls := googleapi.ResolveRelative(c.s.BasePath, "apps/{appId}")
  1872. urls += "?" + c.urlParams_.Encode()
  1873. req, _ := http.NewRequest("GET", urls, body)
  1874. googleapi.Expand(req.URL, map[string]string{
  1875. "appId": c.appId,
  1876. })
  1877. req.Header.Set("User-Agent", c.s.userAgent())
  1878. if c.ifNoneMatch_ != "" {
  1879. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1880. }
  1881. if c.ctx_ != nil {
  1882. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1883. }
  1884. return c.s.client.Do(req)
  1885. }
  1886. // Do executes the "drive.apps.get" call.
  1887. // Exactly one of *App or error will be non-nil. Any non-2xx status code
  1888. // is an error. Response headers are in either
  1889. // *App.ServerResponse.Header or (if a response was returned at all) in
  1890. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1891. // whether the returned error was because http.StatusNotModified was
  1892. // returned.
  1893. func (c *AppsGetCall) Do(opts ...googleapi.CallOption) (*App, error) {
  1894. gensupport.SetOptions(c.urlParams_, opts...)
  1895. res, err := c.doRequest("json")
  1896. if res != nil && res.StatusCode == http.StatusNotModified {
  1897. if res.Body != nil {
  1898. res.Body.Close()
  1899. }
  1900. return nil, &googleapi.Error{
  1901. Code: res.StatusCode,
  1902. Header: res.Header,
  1903. }
  1904. }
  1905. if err != nil {
  1906. return nil, err
  1907. }
  1908. defer googleapi.CloseBody(res)
  1909. if err := googleapi.CheckResponse(res); err != nil {
  1910. return nil, err
  1911. }
  1912. ret := &App{
  1913. ServerResponse: googleapi.ServerResponse{
  1914. Header: res.Header,
  1915. HTTPStatusCode: res.StatusCode,
  1916. },
  1917. }
  1918. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1919. return nil, err
  1920. }
  1921. return ret, nil
  1922. // {
  1923. // "description": "Gets a specific app.",
  1924. // "httpMethod": "GET",
  1925. // "id": "drive.apps.get",
  1926. // "parameterOrder": [
  1927. // "appId"
  1928. // ],
  1929. // "parameters": {
  1930. // "appId": {
  1931. // "description": "The ID of the app.",
  1932. // "location": "path",
  1933. // "required": true,
  1934. // "type": "string"
  1935. // }
  1936. // },
  1937. // "path": "apps/{appId}",
  1938. // "response": {
  1939. // "$ref": "App"
  1940. // },
  1941. // "scopes": [
  1942. // "https://www.googleapis.com/auth/drive",
  1943. // "https://www.googleapis.com/auth/drive.appdata",
  1944. // "https://www.googleapis.com/auth/drive.apps.readonly",
  1945. // "https://www.googleapis.com/auth/drive.file",
  1946. // "https://www.googleapis.com/auth/drive.metadata",
  1947. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  1948. // "https://www.googleapis.com/auth/drive.readonly"
  1949. // ]
  1950. // }
  1951. }
  1952. // method id "drive.apps.list":
  1953. type AppsListCall struct {
  1954. s *Service
  1955. urlParams_ gensupport.URLParams
  1956. ifNoneMatch_ string
  1957. ctx_ context.Context
  1958. }
  1959. // List: Lists a user's installed apps.
  1960. func (r *AppsService) List() *AppsListCall {
  1961. c := &AppsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1962. return c
  1963. }
  1964. // AppFilterExtensions sets the optional parameter
  1965. // "appFilterExtensions": A comma-separated list of file extensions for
  1966. // open with filtering. All apps within the given app query scope which
  1967. // can open any of the given file extensions will be included in the
  1968. // response. If appFilterMimeTypes are provided as well, the result is a
  1969. // union of the two resulting app lists.
  1970. func (c *AppsListCall) AppFilterExtensions(appFilterExtensions string) *AppsListCall {
  1971. c.urlParams_.Set("appFilterExtensions", appFilterExtensions)
  1972. return c
  1973. }
  1974. // AppFilterMimeTypes sets the optional parameter "appFilterMimeTypes":
  1975. // A comma-separated list of MIME types for open with filtering. All
  1976. // apps within the given app query scope which can open any of the given
  1977. // MIME types will be included in the response. If appFilterExtensions
  1978. // are provided as well, the result is a union of the two resulting app
  1979. // lists.
  1980. func (c *AppsListCall) AppFilterMimeTypes(appFilterMimeTypes string) *AppsListCall {
  1981. c.urlParams_.Set("appFilterMimeTypes", appFilterMimeTypes)
  1982. return c
  1983. }
  1984. // LanguageCode sets the optional parameter "languageCode": A language
  1985. // or locale code, as defined by BCP 47, with some extensions from
  1986. // Unicode's LDML format (http://www.unicode.org/reports/tr35/).
  1987. func (c *AppsListCall) LanguageCode(languageCode string) *AppsListCall {
  1988. c.urlParams_.Set("languageCode", languageCode)
  1989. return c
  1990. }
  1991. // Fields allows partial responses to be retrieved. See
  1992. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1993. // for more information.
  1994. func (c *AppsListCall) Fields(s ...googleapi.Field) *AppsListCall {
  1995. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1996. return c
  1997. }
  1998. // IfNoneMatch sets the optional parameter which makes the operation
  1999. // fail if the object's ETag matches the given value. This is useful for
  2000. // getting updates only after the object has changed since the last
  2001. // request. Use googleapi.IsNotModified to check whether the response
  2002. // error from Do is the result of In-None-Match.
  2003. func (c *AppsListCall) IfNoneMatch(entityTag string) *AppsListCall {
  2004. c.ifNoneMatch_ = entityTag
  2005. return c
  2006. }
  2007. // Context sets the context to be used in this call's Do method. Any
  2008. // pending HTTP request will be aborted if the provided context is
  2009. // canceled.
  2010. func (c *AppsListCall) Context(ctx context.Context) *AppsListCall {
  2011. c.ctx_ = ctx
  2012. return c
  2013. }
  2014. func (c *AppsListCall) doRequest(alt string) (*http.Response, error) {
  2015. var body io.Reader = nil
  2016. c.urlParams_.Set("alt", alt)
  2017. urls := googleapi.ResolveRelative(c.s.BasePath, "apps")
  2018. urls += "?" + c.urlParams_.Encode()
  2019. req, _ := http.NewRequest("GET", urls, body)
  2020. googleapi.SetOpaque(req.URL)
  2021. req.Header.Set("User-Agent", c.s.userAgent())
  2022. if c.ifNoneMatch_ != "" {
  2023. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2024. }
  2025. if c.ctx_ != nil {
  2026. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2027. }
  2028. return c.s.client.Do(req)
  2029. }
  2030. // Do executes the "drive.apps.list" call.
  2031. // Exactly one of *AppList or error will be non-nil. Any non-2xx status
  2032. // code is an error. Response headers are in either
  2033. // *AppList.ServerResponse.Header or (if a response was returned at all)
  2034. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2035. // check whether the returned error was because http.StatusNotModified
  2036. // was returned.
  2037. func (c *AppsListCall) Do(opts ...googleapi.CallOption) (*AppList, error) {
  2038. gensupport.SetOptions(c.urlParams_, opts...)
  2039. res, err := c.doRequest("json")
  2040. if res != nil && res.StatusCode == http.StatusNotModified {
  2041. if res.Body != nil {
  2042. res.Body.Close()
  2043. }
  2044. return nil, &googleapi.Error{
  2045. Code: res.StatusCode,
  2046. Header: res.Header,
  2047. }
  2048. }
  2049. if err != nil {
  2050. return nil, err
  2051. }
  2052. defer googleapi.CloseBody(res)
  2053. if err := googleapi.CheckResponse(res); err != nil {
  2054. return nil, err
  2055. }
  2056. ret := &AppList{
  2057. ServerResponse: googleapi.ServerResponse{
  2058. Header: res.Header,
  2059. HTTPStatusCode: res.StatusCode,
  2060. },
  2061. }
  2062. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2063. return nil, err
  2064. }
  2065. return ret, nil
  2066. // {
  2067. // "description": "Lists a user's installed apps.",
  2068. // "httpMethod": "GET",
  2069. // "id": "drive.apps.list",
  2070. // "parameters": {
  2071. // "appFilterExtensions": {
  2072. // "default": "",
  2073. // "description": "A comma-separated list of file extensions for open with filtering. All apps within the given app query scope which can open any of the given file extensions will be included in the response. If appFilterMimeTypes are provided as well, the result is a union of the two resulting app lists.",
  2074. // "location": "query",
  2075. // "type": "string"
  2076. // },
  2077. // "appFilterMimeTypes": {
  2078. // "default": "",
  2079. // "description": "A comma-separated list of MIME types for open with filtering. All apps within the given app query scope which can open any of the given MIME types will be included in the response. If appFilterExtensions are provided as well, the result is a union of the two resulting app lists.",
  2080. // "location": "query",
  2081. // "type": "string"
  2082. // },
  2083. // "languageCode": {
  2084. // "description": "A language or locale code, as defined by BCP 47, with some extensions from Unicode's LDML format (http://www.unicode.org/reports/tr35/).",
  2085. // "location": "query",
  2086. // "type": "string"
  2087. // }
  2088. // },
  2089. // "path": "apps",
  2090. // "response": {
  2091. // "$ref": "AppList"
  2092. // },
  2093. // "scopes": [
  2094. // "https://www.googleapis.com/auth/drive.apps.readonly"
  2095. // ]
  2096. // }
  2097. }
  2098. // method id "drive.changes.get":
  2099. type ChangesGetCall struct {
  2100. s *Service
  2101. changeId string
  2102. urlParams_ gensupport.URLParams
  2103. ifNoneMatch_ string
  2104. ctx_ context.Context
  2105. }
  2106. // Get: Gets a specific change.
  2107. func (r *ChangesService) Get(changeId string) *ChangesGetCall {
  2108. c := &ChangesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2109. c.changeId = changeId
  2110. return c
  2111. }
  2112. // Fields allows partial responses to be retrieved. See
  2113. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2114. // for more information.
  2115. func (c *ChangesGetCall) Fields(s ...googleapi.Field) *ChangesGetCall {
  2116. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2117. return c
  2118. }
  2119. // IfNoneMatch sets the optional parameter which makes the operation
  2120. // fail if the object's ETag matches the given value. This is useful for
  2121. // getting updates only after the object has changed since the last
  2122. // request. Use googleapi.IsNotModified to check whether the response
  2123. // error from Do is the result of In-None-Match.
  2124. func (c *ChangesGetCall) IfNoneMatch(entityTag string) *ChangesGetCall {
  2125. c.ifNoneMatch_ = entityTag
  2126. return c
  2127. }
  2128. // Context sets the context to be used in this call's Do method. Any
  2129. // pending HTTP request will be aborted if the provided context is
  2130. // canceled.
  2131. func (c *ChangesGetCall) Context(ctx context.Context) *ChangesGetCall {
  2132. c.ctx_ = ctx
  2133. return c
  2134. }
  2135. func (c *ChangesGetCall) doRequest(alt string) (*http.Response, error) {
  2136. var body io.Reader = nil
  2137. c.urlParams_.Set("alt", alt)
  2138. urls := googleapi.ResolveRelative(c.s.BasePath, "changes/{changeId}")
  2139. urls += "?" + c.urlParams_.Encode()
  2140. req, _ := http.NewRequest("GET", urls, body)
  2141. googleapi.Expand(req.URL, map[string]string{
  2142. "changeId": c.changeId,
  2143. })
  2144. req.Header.Set("User-Agent", c.s.userAgent())
  2145. if c.ifNoneMatch_ != "" {
  2146. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2147. }
  2148. if c.ctx_ != nil {
  2149. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2150. }
  2151. return c.s.client.Do(req)
  2152. }
  2153. // Do executes the "drive.changes.get" call.
  2154. // Exactly one of *Change or error will be non-nil. Any non-2xx status
  2155. // code is an error. Response headers are in either
  2156. // *Change.ServerResponse.Header or (if a response was returned at all)
  2157. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2158. // check whether the returned error was because http.StatusNotModified
  2159. // was returned.
  2160. func (c *ChangesGetCall) Do(opts ...googleapi.CallOption) (*Change, error) {
  2161. gensupport.SetOptions(c.urlParams_, opts...)
  2162. res, err := c.doRequest("json")
  2163. if res != nil && res.StatusCode == http.StatusNotModified {
  2164. if res.Body != nil {
  2165. res.Body.Close()
  2166. }
  2167. return nil, &googleapi.Error{
  2168. Code: res.StatusCode,
  2169. Header: res.Header,
  2170. }
  2171. }
  2172. if err != nil {
  2173. return nil, err
  2174. }
  2175. defer googleapi.CloseBody(res)
  2176. if err := googleapi.CheckResponse(res); err != nil {
  2177. return nil, err
  2178. }
  2179. ret := &Change{
  2180. ServerResponse: googleapi.ServerResponse{
  2181. Header: res.Header,
  2182. HTTPStatusCode: res.StatusCode,
  2183. },
  2184. }
  2185. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2186. return nil, err
  2187. }
  2188. return ret, nil
  2189. // {
  2190. // "description": "Gets a specific change.",
  2191. // "httpMethod": "GET",
  2192. // "id": "drive.changes.get",
  2193. // "parameterOrder": [
  2194. // "changeId"
  2195. // ],
  2196. // "parameters": {
  2197. // "changeId": {
  2198. // "description": "The ID of the change.",
  2199. // "location": "path",
  2200. // "required": true,
  2201. // "type": "string"
  2202. // }
  2203. // },
  2204. // "path": "changes/{changeId}",
  2205. // "response": {
  2206. // "$ref": "Change"
  2207. // },
  2208. // "scopes": [
  2209. // "https://www.googleapis.com/auth/drive",
  2210. // "https://www.googleapis.com/auth/drive.appdata",
  2211. // "https://www.googleapis.com/auth/drive.apps.readonly",
  2212. // "https://www.googleapis.com/auth/drive.file",
  2213. // "https://www.googleapis.com/auth/drive.metadata",
  2214. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  2215. // "https://www.googleapis.com/auth/drive.photos.readonly",
  2216. // "https://www.googleapis.com/auth/drive.readonly"
  2217. // ]
  2218. // }
  2219. }
  2220. // method id "drive.changes.list":
  2221. type ChangesListCall struct {
  2222. s *Service
  2223. urlParams_ gensupport.URLParams
  2224. ifNoneMatch_ string
  2225. ctx_ context.Context
  2226. }
  2227. // List: Lists the changes for a user.
  2228. func (r *ChangesService) List() *ChangesListCall {
  2229. c := &ChangesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2230. return c
  2231. }
  2232. // IncludeDeleted sets the optional parameter "includeDeleted": Whether
  2233. // to include deleted items.
  2234. func (c *ChangesListCall) IncludeDeleted(includeDeleted bool) *ChangesListCall {
  2235. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  2236. return c
  2237. }
  2238. // IncludeSubscribed sets the optional parameter "includeSubscribed":
  2239. // Whether to include public files the user has opened and shared files.
  2240. // When set to false, the list only includes owned files plus any shared
  2241. // or public files the user has explicitly added to a folder they own.
  2242. func (c *ChangesListCall) IncludeSubscribed(includeSubscribed bool) *ChangesListCall {
  2243. c.urlParams_.Set("includeSubscribed", fmt.Sprint(includeSubscribed))
  2244. return c
  2245. }
  2246. // MaxResults sets the optional parameter "maxResults": Maximum number
  2247. // of changes to return.
  2248. func (c *ChangesListCall) MaxResults(maxResults int64) *ChangesListCall {
  2249. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2250. return c
  2251. }
  2252. // PageToken sets the optional parameter "pageToken": Page token for
  2253. // changes.
  2254. func (c *ChangesListCall) PageToken(pageToken string) *ChangesListCall {
  2255. c.urlParams_.Set("pageToken", pageToken)
  2256. return c
  2257. }
  2258. // Spaces sets the optional parameter "spaces": A comma-separated list
  2259. // of spaces to query. Supported values are 'drive', 'appDataFolder' and
  2260. // 'photos'.
  2261. func (c *ChangesListCall) Spaces(spaces string) *ChangesListCall {
  2262. c.urlParams_.Set("spaces", spaces)
  2263. return c
  2264. }
  2265. // StartChangeId sets the optional parameter "startChangeId": Change ID
  2266. // to start listing changes from.
  2267. func (c *ChangesListCall) StartChangeId(startChangeId int64) *ChangesListCall {
  2268. c.urlParams_.Set("startChangeId", fmt.Sprint(startChangeId))
  2269. return c
  2270. }
  2271. // Fields allows partial responses to be retrieved. See
  2272. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2273. // for more information.
  2274. func (c *ChangesListCall) Fields(s ...googleapi.Field) *ChangesListCall {
  2275. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2276. return c
  2277. }
  2278. // IfNoneMatch sets the optional parameter which makes the operation
  2279. // fail if the object's ETag matches the given value. This is useful for
  2280. // getting updates only after the object has changed since the last
  2281. // request. Use googleapi.IsNotModified to check whether the response
  2282. // error from Do is the result of In-None-Match.
  2283. func (c *ChangesListCall) IfNoneMatch(entityTag string) *ChangesListCall {
  2284. c.ifNoneMatch_ = entityTag
  2285. return c
  2286. }
  2287. // Context sets the context to be used in this call's Do method. Any
  2288. // pending HTTP request will be aborted if the provided context is
  2289. // canceled.
  2290. func (c *ChangesListCall) Context(ctx context.Context) *ChangesListCall {
  2291. c.ctx_ = ctx
  2292. return c
  2293. }
  2294. func (c *ChangesListCall) doRequest(alt string) (*http.Response, error) {
  2295. var body io.Reader = nil
  2296. c.urlParams_.Set("alt", alt)
  2297. urls := googleapi.ResolveRelative(c.s.BasePath, "changes")
  2298. urls += "?" + c.urlParams_.Encode()
  2299. req, _ := http.NewRequest("GET", urls, body)
  2300. googleapi.SetOpaque(req.URL)
  2301. req.Header.Set("User-Agent", c.s.userAgent())
  2302. if c.ifNoneMatch_ != "" {
  2303. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2304. }
  2305. if c.ctx_ != nil {
  2306. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2307. }
  2308. return c.s.client.Do(req)
  2309. }
  2310. // Do executes the "drive.changes.list" call.
  2311. // Exactly one of *ChangeList or error will be non-nil. Any non-2xx
  2312. // status code is an error. Response headers are in either
  2313. // *ChangeList.ServerResponse.Header or (if a response was returned at
  2314. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2315. // to check whether the returned error was because
  2316. // http.StatusNotModified was returned.
  2317. func (c *ChangesListCall) Do(opts ...googleapi.CallOption) (*ChangeList, error) {
  2318. gensupport.SetOptions(c.urlParams_, opts...)
  2319. res, err := c.doRequest("json")
  2320. if res != nil && res.StatusCode == http.StatusNotModified {
  2321. if res.Body != nil {
  2322. res.Body.Close()
  2323. }
  2324. return nil, &googleapi.Error{
  2325. Code: res.StatusCode,
  2326. Header: res.Header,
  2327. }
  2328. }
  2329. if err != nil {
  2330. return nil, err
  2331. }
  2332. defer googleapi.CloseBody(res)
  2333. if err := googleapi.CheckResponse(res); err != nil {
  2334. return nil, err
  2335. }
  2336. ret := &ChangeList{
  2337. ServerResponse: googleapi.ServerResponse{
  2338. Header: res.Header,
  2339. HTTPStatusCode: res.StatusCode,
  2340. },
  2341. }
  2342. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2343. return nil, err
  2344. }
  2345. return ret, nil
  2346. // {
  2347. // "description": "Lists the changes for a user.",
  2348. // "httpMethod": "GET",
  2349. // "id": "drive.changes.list",
  2350. // "parameters": {
  2351. // "includeDeleted": {
  2352. // "default": "true",
  2353. // "description": "Whether to include deleted items.",
  2354. // "location": "query",
  2355. // "type": "boolean"
  2356. // },
  2357. // "includeSubscribed": {
  2358. // "default": "true",
  2359. // "description": "Whether to include public files the user has opened and shared files. When set to false, the list only includes owned files plus any shared or public files the user has explicitly added to a folder they own.",
  2360. // "location": "query",
  2361. // "type": "boolean"
  2362. // },
  2363. // "maxResults": {
  2364. // "default": "100",
  2365. // "description": "Maximum number of changes to return.",
  2366. // "format": "int32",
  2367. // "location": "query",
  2368. // "minimum": "1",
  2369. // "type": "integer"
  2370. // },
  2371. // "pageToken": {
  2372. // "description": "Page token for changes.",
  2373. // "location": "query",
  2374. // "type": "string"
  2375. // },
  2376. // "spaces": {
  2377. // "description": "A comma-separated list of spaces to query. Supported values are 'drive', 'appDataFolder' and 'photos'.",
  2378. // "location": "query",
  2379. // "type": "string"
  2380. // },
  2381. // "startChangeId": {
  2382. // "description": "Change ID to start listing changes from.",
  2383. // "format": "int64",
  2384. // "location": "query",
  2385. // "type": "string"
  2386. // }
  2387. // },
  2388. // "path": "changes",
  2389. // "response": {
  2390. // "$ref": "ChangeList"
  2391. // },
  2392. // "scopes": [
  2393. // "https://www.googleapis.com/auth/drive",
  2394. // "https://www.googleapis.com/auth/drive.appdata",
  2395. // "https://www.googleapis.com/auth/drive.apps.readonly",
  2396. // "https://www.googleapis.com/auth/drive.file",
  2397. // "https://www.googleapis.com/auth/drive.metadata",
  2398. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  2399. // "https://www.googleapis.com/auth/drive.photos.readonly",
  2400. // "https://www.googleapis.com/auth/drive.readonly"
  2401. // ],
  2402. // "supportsSubscription": true
  2403. // }
  2404. }
  2405. // Pages invokes f for each page of results.
  2406. // A non-nil error returned from f will halt the iteration.
  2407. // The provided context supersedes any context provided to the Context method.
  2408. func (c *ChangesListCall) Pages(ctx context.Context, f func(*ChangeList) error) error {
  2409. c.ctx_ = ctx
  2410. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2411. for {
  2412. x, err := c.Do()
  2413. if err != nil {
  2414. return err
  2415. }
  2416. if err := f(x); err != nil {
  2417. return err
  2418. }
  2419. if x.NextPageToken == "" {
  2420. return nil
  2421. }
  2422. c.PageToken(x.NextPageToken)
  2423. }
  2424. }
  2425. // method id "drive.changes.watch":
  2426. type ChangesWatchCall struct {
  2427. s *Service
  2428. channel *Channel
  2429. urlParams_ gensupport.URLParams
  2430. ctx_ context.Context
  2431. }
  2432. // Watch: Subscribe to changes for a user.
  2433. func (r *ChangesService) Watch(channel *Channel) *ChangesWatchCall {
  2434. c := &ChangesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2435. c.channel = channel
  2436. return c
  2437. }
  2438. // IncludeDeleted sets the optional parameter "includeDeleted": Whether
  2439. // to include deleted items.
  2440. func (c *ChangesWatchCall) IncludeDeleted(includeDeleted bool) *ChangesWatchCall {
  2441. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  2442. return c
  2443. }
  2444. // IncludeSubscribed sets the optional parameter "includeSubscribed":
  2445. // Whether to include public files the user has opened and shared files.
  2446. // When set to false, the list only includes owned files plus any shared
  2447. // or public files the user has explicitly added to a folder they own.
  2448. func (c *ChangesWatchCall) IncludeSubscribed(includeSubscribed bool) *ChangesWatchCall {
  2449. c.urlParams_.Set("includeSubscribed", fmt.Sprint(includeSubscribed))
  2450. return c
  2451. }
  2452. // MaxResults sets the optional parameter "maxResults": Maximum number
  2453. // of changes to return.
  2454. func (c *ChangesWatchCall) MaxResults(maxResults int64) *ChangesWatchCall {
  2455. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2456. return c
  2457. }
  2458. // PageToken sets the optional parameter "pageToken": Page token for
  2459. // changes.
  2460. func (c *ChangesWatchCall) PageToken(pageToken string) *ChangesWatchCall {
  2461. c.urlParams_.Set("pageToken", pageToken)
  2462. return c
  2463. }
  2464. // Spaces sets the optional parameter "spaces": A comma-separated list
  2465. // of spaces to query. Supported values are 'drive', 'appDataFolder' and
  2466. // 'photos'.
  2467. func (c *ChangesWatchCall) Spaces(spaces string) *ChangesWatchCall {
  2468. c.urlParams_.Set("spaces", spaces)
  2469. return c
  2470. }
  2471. // StartChangeId sets the optional parameter "startChangeId": Change ID
  2472. // to start listing changes from.
  2473. func (c *ChangesWatchCall) StartChangeId(startChangeId int64) *ChangesWatchCall {
  2474. c.urlParams_.Set("startChangeId", fmt.Sprint(startChangeId))
  2475. return c
  2476. }
  2477. // Fields allows partial responses to be retrieved. See
  2478. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2479. // for more information.
  2480. func (c *ChangesWatchCall) Fields(s ...googleapi.Field) *ChangesWatchCall {
  2481. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2482. return c
  2483. }
  2484. // Context sets the context to be used in this call's Do method. Any
  2485. // pending HTTP request will be aborted if the provided context is
  2486. // canceled.
  2487. func (c *ChangesWatchCall) Context(ctx context.Context) *ChangesWatchCall {
  2488. c.ctx_ = ctx
  2489. return c
  2490. }
  2491. func (c *ChangesWatchCall) doRequest(alt string) (*http.Response, error) {
  2492. var body io.Reader = nil
  2493. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  2494. if err != nil {
  2495. return nil, err
  2496. }
  2497. ctype := "application/json"
  2498. c.urlParams_.Set("alt", alt)
  2499. urls := googleapi.ResolveRelative(c.s.BasePath, "changes/watch")
  2500. urls += "?" + c.urlParams_.Encode()
  2501. req, _ := http.NewRequest("POST", urls, body)
  2502. googleapi.SetOpaque(req.URL)
  2503. req.Header.Set("Content-Type", ctype)
  2504. req.Header.Set("User-Agent", c.s.userAgent())
  2505. if c.ctx_ != nil {
  2506. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2507. }
  2508. return c.s.client.Do(req)
  2509. }
  2510. // Do executes the "drive.changes.watch" call.
  2511. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  2512. // code is an error. Response headers are in either
  2513. // *Channel.ServerResponse.Header or (if a response was returned at all)
  2514. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2515. // check whether the returned error was because http.StatusNotModified
  2516. // was returned.
  2517. func (c *ChangesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  2518. gensupport.SetOptions(c.urlParams_, opts...)
  2519. res, err := c.doRequest("json")
  2520. if res != nil && res.StatusCode == http.StatusNotModified {
  2521. if res.Body != nil {
  2522. res.Body.Close()
  2523. }
  2524. return nil, &googleapi.Error{
  2525. Code: res.StatusCode,
  2526. Header: res.Header,
  2527. }
  2528. }
  2529. if err != nil {
  2530. return nil, err
  2531. }
  2532. defer googleapi.CloseBody(res)
  2533. if err := googleapi.CheckResponse(res); err != nil {
  2534. return nil, err
  2535. }
  2536. ret := &Channel{
  2537. ServerResponse: googleapi.ServerResponse{
  2538. Header: res.Header,
  2539. HTTPStatusCode: res.StatusCode,
  2540. },
  2541. }
  2542. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2543. return nil, err
  2544. }
  2545. return ret, nil
  2546. // {
  2547. // "description": "Subscribe to changes for a user.",
  2548. // "httpMethod": "POST",
  2549. // "id": "drive.changes.watch",
  2550. // "parameters": {
  2551. // "includeDeleted": {
  2552. // "default": "true",
  2553. // "description": "Whether to include deleted items.",
  2554. // "location": "query",
  2555. // "type": "boolean"
  2556. // },
  2557. // "includeSubscribed": {
  2558. // "default": "true",
  2559. // "description": "Whether to include public files the user has opened and shared files. When set to false, the list only includes owned files plus any shared or public files the user has explicitly added to a folder they own.",
  2560. // "location": "query",
  2561. // "type": "boolean"
  2562. // },
  2563. // "maxResults": {
  2564. // "default": "100",
  2565. // "description": "Maximum number of changes to return.",
  2566. // "format": "int32",
  2567. // "location": "query",
  2568. // "minimum": "1",
  2569. // "type": "integer"
  2570. // },
  2571. // "pageToken": {
  2572. // "description": "Page token for changes.",
  2573. // "location": "query",
  2574. // "type": "string"
  2575. // },
  2576. // "spaces": {
  2577. // "description": "A comma-separated list of spaces to query. Supported values are 'drive', 'appDataFolder' and 'photos'.",
  2578. // "location": "query",
  2579. // "type": "string"
  2580. // },
  2581. // "startChangeId": {
  2582. // "description": "Change ID to start listing changes from.",
  2583. // "format": "int64",
  2584. // "location": "query",
  2585. // "type": "string"
  2586. // }
  2587. // },
  2588. // "path": "changes/watch",
  2589. // "request": {
  2590. // "$ref": "Channel",
  2591. // "parameterName": "resource"
  2592. // },
  2593. // "response": {
  2594. // "$ref": "Channel"
  2595. // },
  2596. // "scopes": [
  2597. // "https://www.googleapis.com/auth/drive",
  2598. // "https://www.googleapis.com/auth/drive.appdata",
  2599. // "https://www.googleapis.com/auth/drive.apps.readonly",
  2600. // "https://www.googleapis.com/auth/drive.file",
  2601. // "https://www.googleapis.com/auth/drive.metadata",
  2602. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  2603. // "https://www.googleapis.com/auth/drive.photos.readonly",
  2604. // "https://www.googleapis.com/auth/drive.readonly"
  2605. // ],
  2606. // "supportsSubscription": true
  2607. // }
  2608. }
  2609. // method id "drive.channels.stop":
  2610. type ChannelsStopCall struct {
  2611. s *Service
  2612. channel *Channel
  2613. urlParams_ gensupport.URLParams
  2614. ctx_ context.Context
  2615. }
  2616. // Stop: Stop watching resources through this channel
  2617. func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
  2618. c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2619. c.channel = channel
  2620. return c
  2621. }
  2622. // Fields allows partial responses to be retrieved. See
  2623. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2624. // for more information.
  2625. func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
  2626. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2627. return c
  2628. }
  2629. // Context sets the context to be used in this call's Do method. Any
  2630. // pending HTTP request will be aborted if the provided context is
  2631. // canceled.
  2632. func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
  2633. c.ctx_ = ctx
  2634. return c
  2635. }
  2636. func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
  2637. var body io.Reader = nil
  2638. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  2639. if err != nil {
  2640. return nil, err
  2641. }
  2642. ctype := "application/json"
  2643. c.urlParams_.Set("alt", alt)
  2644. urls := googleapi.ResolveRelative(c.s.BasePath, "channels/stop")
  2645. urls += "?" + c.urlParams_.Encode()
  2646. req, _ := http.NewRequest("POST", urls, body)
  2647. googleapi.SetOpaque(req.URL)
  2648. req.Header.Set("Content-Type", ctype)
  2649. req.Header.Set("User-Agent", c.s.userAgent())
  2650. if c.ctx_ != nil {
  2651. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2652. }
  2653. return c.s.client.Do(req)
  2654. }
  2655. // Do executes the "drive.channels.stop" call.
  2656. func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
  2657. gensupport.SetOptions(c.urlParams_, opts...)
  2658. res, err := c.doRequest("json")
  2659. if err != nil {
  2660. return err
  2661. }
  2662. defer googleapi.CloseBody(res)
  2663. if err := googleapi.CheckResponse(res); err != nil {
  2664. return err
  2665. }
  2666. return nil
  2667. // {
  2668. // "description": "Stop watching resources through this channel",
  2669. // "httpMethod": "POST",
  2670. // "id": "drive.channels.stop",
  2671. // "path": "channels/stop",
  2672. // "request": {
  2673. // "$ref": "Channel",
  2674. // "parameterName": "resource"
  2675. // },
  2676. // "scopes": [
  2677. // "https://www.googleapis.com/auth/drive",
  2678. // "https://www.googleapis.com/auth/drive.appdata",
  2679. // "https://www.googleapis.com/auth/drive.apps.readonly",
  2680. // "https://www.googleapis.com/auth/drive.file",
  2681. // "https://www.googleapis.com/auth/drive.metadata",
  2682. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  2683. // "https://www.googleapis.com/auth/drive.photos.readonly",
  2684. // "https://www.googleapis.com/auth/drive.readonly"
  2685. // ]
  2686. // }
  2687. }
  2688. // method id "drive.children.delete":
  2689. type ChildrenDeleteCall struct {
  2690. s *Service
  2691. folderId string
  2692. childId string
  2693. urlParams_ gensupport.URLParams
  2694. ctx_ context.Context
  2695. }
  2696. // Delete: Removes a child from a folder.
  2697. func (r *ChildrenService) Delete(folderId string, childId string) *ChildrenDeleteCall {
  2698. c := &ChildrenDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2699. c.folderId = folderId
  2700. c.childId = childId
  2701. return c
  2702. }
  2703. // Fields allows partial responses to be retrieved. See
  2704. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2705. // for more information.
  2706. func (c *ChildrenDeleteCall) Fields(s ...googleapi.Field) *ChildrenDeleteCall {
  2707. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2708. return c
  2709. }
  2710. // Context sets the context to be used in this call's Do method. Any
  2711. // pending HTTP request will be aborted if the provided context is
  2712. // canceled.
  2713. func (c *ChildrenDeleteCall) Context(ctx context.Context) *ChildrenDeleteCall {
  2714. c.ctx_ = ctx
  2715. return c
  2716. }
  2717. func (c *ChildrenDeleteCall) doRequest(alt string) (*http.Response, error) {
  2718. var body io.Reader = nil
  2719. c.urlParams_.Set("alt", alt)
  2720. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{folderId}/children/{childId}")
  2721. urls += "?" + c.urlParams_.Encode()
  2722. req, _ := http.NewRequest("DELETE", urls, body)
  2723. googleapi.Expand(req.URL, map[string]string{
  2724. "folderId": c.folderId,
  2725. "childId": c.childId,
  2726. })
  2727. req.Header.Set("User-Agent", c.s.userAgent())
  2728. if c.ctx_ != nil {
  2729. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2730. }
  2731. return c.s.client.Do(req)
  2732. }
  2733. // Do executes the "drive.children.delete" call.
  2734. func (c *ChildrenDeleteCall) Do(opts ...googleapi.CallOption) error {
  2735. gensupport.SetOptions(c.urlParams_, opts...)
  2736. res, err := c.doRequest("json")
  2737. if err != nil {
  2738. return err
  2739. }
  2740. defer googleapi.CloseBody(res)
  2741. if err := googleapi.CheckResponse(res); err != nil {
  2742. return err
  2743. }
  2744. return nil
  2745. // {
  2746. // "description": "Removes a child from a folder.",
  2747. // "httpMethod": "DELETE",
  2748. // "id": "drive.children.delete",
  2749. // "parameterOrder": [
  2750. // "folderId",
  2751. // "childId"
  2752. // ],
  2753. // "parameters": {
  2754. // "childId": {
  2755. // "description": "The ID of the child.",
  2756. // "location": "path",
  2757. // "required": true,
  2758. // "type": "string"
  2759. // },
  2760. // "folderId": {
  2761. // "description": "The ID of the folder.",
  2762. // "location": "path",
  2763. // "required": true,
  2764. // "type": "string"
  2765. // }
  2766. // },
  2767. // "path": "files/{folderId}/children/{childId}",
  2768. // "scopes": [
  2769. // "https://www.googleapis.com/auth/drive",
  2770. // "https://www.googleapis.com/auth/drive.file"
  2771. // ]
  2772. // }
  2773. }
  2774. // method id "drive.children.get":
  2775. type ChildrenGetCall struct {
  2776. s *Service
  2777. folderId string
  2778. childId string
  2779. urlParams_ gensupport.URLParams
  2780. ifNoneMatch_ string
  2781. ctx_ context.Context
  2782. }
  2783. // Get: Gets a specific child reference.
  2784. func (r *ChildrenService) Get(folderId string, childId string) *ChildrenGetCall {
  2785. c := &ChildrenGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2786. c.folderId = folderId
  2787. c.childId = childId
  2788. return c
  2789. }
  2790. // Fields allows partial responses to be retrieved. See
  2791. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2792. // for more information.
  2793. func (c *ChildrenGetCall) Fields(s ...googleapi.Field) *ChildrenGetCall {
  2794. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2795. return c
  2796. }
  2797. // IfNoneMatch sets the optional parameter which makes the operation
  2798. // fail if the object's ETag matches the given value. This is useful for
  2799. // getting updates only after the object has changed since the last
  2800. // request. Use googleapi.IsNotModified to check whether the response
  2801. // error from Do is the result of In-None-Match.
  2802. func (c *ChildrenGetCall) IfNoneMatch(entityTag string) *ChildrenGetCall {
  2803. c.ifNoneMatch_ = entityTag
  2804. return c
  2805. }
  2806. // Context sets the context to be used in this call's Do method. Any
  2807. // pending HTTP request will be aborted if the provided context is
  2808. // canceled.
  2809. func (c *ChildrenGetCall) Context(ctx context.Context) *ChildrenGetCall {
  2810. c.ctx_ = ctx
  2811. return c
  2812. }
  2813. func (c *ChildrenGetCall) doRequest(alt string) (*http.Response, error) {
  2814. var body io.Reader = nil
  2815. c.urlParams_.Set("alt", alt)
  2816. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{folderId}/children/{childId}")
  2817. urls += "?" + c.urlParams_.Encode()
  2818. req, _ := http.NewRequest("GET", urls, body)
  2819. googleapi.Expand(req.URL, map[string]string{
  2820. "folderId": c.folderId,
  2821. "childId": c.childId,
  2822. })
  2823. req.Header.Set("User-Agent", c.s.userAgent())
  2824. if c.ifNoneMatch_ != "" {
  2825. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2826. }
  2827. if c.ctx_ != nil {
  2828. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2829. }
  2830. return c.s.client.Do(req)
  2831. }
  2832. // Do executes the "drive.children.get" call.
  2833. // Exactly one of *ChildReference or error will be non-nil. Any non-2xx
  2834. // status code is an error. Response headers are in either
  2835. // *ChildReference.ServerResponse.Header or (if a response was returned
  2836. // at all) in error.(*googleapi.Error).Header. Use
  2837. // googleapi.IsNotModified to check whether the returned error was
  2838. // because http.StatusNotModified was returned.
  2839. func (c *ChildrenGetCall) Do(opts ...googleapi.CallOption) (*ChildReference, error) {
  2840. gensupport.SetOptions(c.urlParams_, opts...)
  2841. res, err := c.doRequest("json")
  2842. if res != nil && res.StatusCode == http.StatusNotModified {
  2843. if res.Body != nil {
  2844. res.Body.Close()
  2845. }
  2846. return nil, &googleapi.Error{
  2847. Code: res.StatusCode,
  2848. Header: res.Header,
  2849. }
  2850. }
  2851. if err != nil {
  2852. return nil, err
  2853. }
  2854. defer googleapi.CloseBody(res)
  2855. if err := googleapi.CheckResponse(res); err != nil {
  2856. return nil, err
  2857. }
  2858. ret := &ChildReference{
  2859. ServerResponse: googleapi.ServerResponse{
  2860. Header: res.Header,
  2861. HTTPStatusCode: res.StatusCode,
  2862. },
  2863. }
  2864. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2865. return nil, err
  2866. }
  2867. return ret, nil
  2868. // {
  2869. // "description": "Gets a specific child reference.",
  2870. // "httpMethod": "GET",
  2871. // "id": "drive.children.get",
  2872. // "parameterOrder": [
  2873. // "folderId",
  2874. // "childId"
  2875. // ],
  2876. // "parameters": {
  2877. // "childId": {
  2878. // "description": "The ID of the child.",
  2879. // "location": "path",
  2880. // "required": true,
  2881. // "type": "string"
  2882. // },
  2883. // "folderId": {
  2884. // "description": "The ID of the folder.",
  2885. // "location": "path",
  2886. // "required": true,
  2887. // "type": "string"
  2888. // }
  2889. // },
  2890. // "path": "files/{folderId}/children/{childId}",
  2891. // "response": {
  2892. // "$ref": "ChildReference"
  2893. // },
  2894. // "scopes": [
  2895. // "https://www.googleapis.com/auth/drive",
  2896. // "https://www.googleapis.com/auth/drive.appdata",
  2897. // "https://www.googleapis.com/auth/drive.file",
  2898. // "https://www.googleapis.com/auth/drive.metadata",
  2899. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  2900. // "https://www.googleapis.com/auth/drive.photos.readonly",
  2901. // "https://www.googleapis.com/auth/drive.readonly"
  2902. // ]
  2903. // }
  2904. }
  2905. // method id "drive.children.insert":
  2906. type ChildrenInsertCall struct {
  2907. s *Service
  2908. folderId string
  2909. childreference *ChildReference
  2910. urlParams_ gensupport.URLParams
  2911. ctx_ context.Context
  2912. }
  2913. // Insert: Inserts a file into a folder.
  2914. func (r *ChildrenService) Insert(folderId string, childreference *ChildReference) *ChildrenInsertCall {
  2915. c := &ChildrenInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2916. c.folderId = folderId
  2917. c.childreference = childreference
  2918. return c
  2919. }
  2920. // Fields allows partial responses to be retrieved. See
  2921. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2922. // for more information.
  2923. func (c *ChildrenInsertCall) Fields(s ...googleapi.Field) *ChildrenInsertCall {
  2924. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2925. return c
  2926. }
  2927. // Context sets the context to be used in this call's Do method. Any
  2928. // pending HTTP request will be aborted if the provided context is
  2929. // canceled.
  2930. func (c *ChildrenInsertCall) Context(ctx context.Context) *ChildrenInsertCall {
  2931. c.ctx_ = ctx
  2932. return c
  2933. }
  2934. func (c *ChildrenInsertCall) doRequest(alt string) (*http.Response, error) {
  2935. var body io.Reader = nil
  2936. body, err := googleapi.WithoutDataWrapper.JSONReader(c.childreference)
  2937. if err != nil {
  2938. return nil, err
  2939. }
  2940. ctype := "application/json"
  2941. c.urlParams_.Set("alt", alt)
  2942. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{folderId}/children")
  2943. urls += "?" + c.urlParams_.Encode()
  2944. req, _ := http.NewRequest("POST", urls, body)
  2945. googleapi.Expand(req.URL, map[string]string{
  2946. "folderId": c.folderId,
  2947. })
  2948. req.Header.Set("Content-Type", ctype)
  2949. req.Header.Set("User-Agent", c.s.userAgent())
  2950. if c.ctx_ != nil {
  2951. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2952. }
  2953. return c.s.client.Do(req)
  2954. }
  2955. // Do executes the "drive.children.insert" call.
  2956. // Exactly one of *ChildReference or error will be non-nil. Any non-2xx
  2957. // status code is an error. Response headers are in either
  2958. // *ChildReference.ServerResponse.Header or (if a response was returned
  2959. // at all) in error.(*googleapi.Error).Header. Use
  2960. // googleapi.IsNotModified to check whether the returned error was
  2961. // because http.StatusNotModified was returned.
  2962. func (c *ChildrenInsertCall) Do(opts ...googleapi.CallOption) (*ChildReference, error) {
  2963. gensupport.SetOptions(c.urlParams_, opts...)
  2964. res, err := c.doRequest("json")
  2965. if res != nil && res.StatusCode == http.StatusNotModified {
  2966. if res.Body != nil {
  2967. res.Body.Close()
  2968. }
  2969. return nil, &googleapi.Error{
  2970. Code: res.StatusCode,
  2971. Header: res.Header,
  2972. }
  2973. }
  2974. if err != nil {
  2975. return nil, err
  2976. }
  2977. defer googleapi.CloseBody(res)
  2978. if err := googleapi.CheckResponse(res); err != nil {
  2979. return nil, err
  2980. }
  2981. ret := &ChildReference{
  2982. ServerResponse: googleapi.ServerResponse{
  2983. Header: res.Header,
  2984. HTTPStatusCode: res.StatusCode,
  2985. },
  2986. }
  2987. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2988. return nil, err
  2989. }
  2990. return ret, nil
  2991. // {
  2992. // "description": "Inserts a file into a folder.",
  2993. // "httpMethod": "POST",
  2994. // "id": "drive.children.insert",
  2995. // "parameterOrder": [
  2996. // "folderId"
  2997. // ],
  2998. // "parameters": {
  2999. // "folderId": {
  3000. // "description": "The ID of the folder.",
  3001. // "location": "path",
  3002. // "required": true,
  3003. // "type": "string"
  3004. // }
  3005. // },
  3006. // "path": "files/{folderId}/children",
  3007. // "request": {
  3008. // "$ref": "ChildReference"
  3009. // },
  3010. // "response": {
  3011. // "$ref": "ChildReference"
  3012. // },
  3013. // "scopes": [
  3014. // "https://www.googleapis.com/auth/drive",
  3015. // "https://www.googleapis.com/auth/drive.appdata",
  3016. // "https://www.googleapis.com/auth/drive.file"
  3017. // ]
  3018. // }
  3019. }
  3020. // method id "drive.children.list":
  3021. type ChildrenListCall struct {
  3022. s *Service
  3023. folderId string
  3024. urlParams_ gensupport.URLParams
  3025. ifNoneMatch_ string
  3026. ctx_ context.Context
  3027. }
  3028. // List: Lists a folder's children.
  3029. func (r *ChildrenService) List(folderId string) *ChildrenListCall {
  3030. c := &ChildrenListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3031. c.folderId = folderId
  3032. return c
  3033. }
  3034. // MaxResults sets the optional parameter "maxResults": Maximum number
  3035. // of children to return.
  3036. func (c *ChildrenListCall) MaxResults(maxResults int64) *ChildrenListCall {
  3037. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3038. return c
  3039. }
  3040. // OrderBy sets the optional parameter "orderBy": A comma-separated list
  3041. // of sort keys. Valid keys are 'createdDate', 'folder',
  3042. // 'lastViewedByMeDate', 'modifiedByMeDate', 'modifiedDate',
  3043. // 'quotaBytesUsed', 'recency', 'sharedWithMeDate', 'starred', and
  3044. // 'title'. Each key sorts ascending by default, but may be reversed
  3045. // with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedDate
  3046. // desc,title. Please note that there is a current limitation for users
  3047. // with approximately one million files in which the requested sort
  3048. // order is ignored.
  3049. func (c *ChildrenListCall) OrderBy(orderBy string) *ChildrenListCall {
  3050. c.urlParams_.Set("orderBy", orderBy)
  3051. return c
  3052. }
  3053. // PageToken sets the optional parameter "pageToken": Page token for
  3054. // children.
  3055. func (c *ChildrenListCall) PageToken(pageToken string) *ChildrenListCall {
  3056. c.urlParams_.Set("pageToken", pageToken)
  3057. return c
  3058. }
  3059. // Q sets the optional parameter "q": Query string for searching
  3060. // children.
  3061. func (c *ChildrenListCall) Q(q string) *ChildrenListCall {
  3062. c.urlParams_.Set("q", q)
  3063. return c
  3064. }
  3065. // Fields allows partial responses to be retrieved. See
  3066. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3067. // for more information.
  3068. func (c *ChildrenListCall) Fields(s ...googleapi.Field) *ChildrenListCall {
  3069. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3070. return c
  3071. }
  3072. // IfNoneMatch sets the optional parameter which makes the operation
  3073. // fail if the object's ETag matches the given value. This is useful for
  3074. // getting updates only after the object has changed since the last
  3075. // request. Use googleapi.IsNotModified to check whether the response
  3076. // error from Do is the result of In-None-Match.
  3077. func (c *ChildrenListCall) IfNoneMatch(entityTag string) *ChildrenListCall {
  3078. c.ifNoneMatch_ = entityTag
  3079. return c
  3080. }
  3081. // Context sets the context to be used in this call's Do method. Any
  3082. // pending HTTP request will be aborted if the provided context is
  3083. // canceled.
  3084. func (c *ChildrenListCall) Context(ctx context.Context) *ChildrenListCall {
  3085. c.ctx_ = ctx
  3086. return c
  3087. }
  3088. func (c *ChildrenListCall) doRequest(alt string) (*http.Response, error) {
  3089. var body io.Reader = nil
  3090. c.urlParams_.Set("alt", alt)
  3091. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{folderId}/children")
  3092. urls += "?" + c.urlParams_.Encode()
  3093. req, _ := http.NewRequest("GET", urls, body)
  3094. googleapi.Expand(req.URL, map[string]string{
  3095. "folderId": c.folderId,
  3096. })
  3097. req.Header.Set("User-Agent", c.s.userAgent())
  3098. if c.ifNoneMatch_ != "" {
  3099. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3100. }
  3101. if c.ctx_ != nil {
  3102. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3103. }
  3104. return c.s.client.Do(req)
  3105. }
  3106. // Do executes the "drive.children.list" call.
  3107. // Exactly one of *ChildList or error will be non-nil. Any non-2xx
  3108. // status code is an error. Response headers are in either
  3109. // *ChildList.ServerResponse.Header or (if a response was returned at
  3110. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3111. // to check whether the returned error was because
  3112. // http.StatusNotModified was returned.
  3113. func (c *ChildrenListCall) Do(opts ...googleapi.CallOption) (*ChildList, error) {
  3114. gensupport.SetOptions(c.urlParams_, opts...)
  3115. res, err := c.doRequest("json")
  3116. if res != nil && res.StatusCode == http.StatusNotModified {
  3117. if res.Body != nil {
  3118. res.Body.Close()
  3119. }
  3120. return nil, &googleapi.Error{
  3121. Code: res.StatusCode,
  3122. Header: res.Header,
  3123. }
  3124. }
  3125. if err != nil {
  3126. return nil, err
  3127. }
  3128. defer googleapi.CloseBody(res)
  3129. if err := googleapi.CheckResponse(res); err != nil {
  3130. return nil, err
  3131. }
  3132. ret := &ChildList{
  3133. ServerResponse: googleapi.ServerResponse{
  3134. Header: res.Header,
  3135. HTTPStatusCode: res.StatusCode,
  3136. },
  3137. }
  3138. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3139. return nil, err
  3140. }
  3141. return ret, nil
  3142. // {
  3143. // "description": "Lists a folder's children.",
  3144. // "httpMethod": "GET",
  3145. // "id": "drive.children.list",
  3146. // "parameterOrder": [
  3147. // "folderId"
  3148. // ],
  3149. // "parameters": {
  3150. // "folderId": {
  3151. // "description": "The ID of the folder.",
  3152. // "location": "path",
  3153. // "required": true,
  3154. // "type": "string"
  3155. // },
  3156. // "maxResults": {
  3157. // "default": "100",
  3158. // "description": "Maximum number of children to return.",
  3159. // "format": "int32",
  3160. // "location": "query",
  3161. // "minimum": "0",
  3162. // "type": "integer"
  3163. // },
  3164. // "orderBy": {
  3165. // "description": "A comma-separated list of sort keys. Valid keys are 'createdDate', 'folder', 'lastViewedByMeDate', 'modifiedByMeDate', 'modifiedDate', 'quotaBytesUsed', 'recency', 'sharedWithMeDate', 'starred', and 'title'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedDate desc,title. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.",
  3166. // "location": "query",
  3167. // "type": "string"
  3168. // },
  3169. // "pageToken": {
  3170. // "description": "Page token for children.",
  3171. // "location": "query",
  3172. // "type": "string"
  3173. // },
  3174. // "q": {
  3175. // "description": "Query string for searching children.",
  3176. // "location": "query",
  3177. // "type": "string"
  3178. // }
  3179. // },
  3180. // "path": "files/{folderId}/children",
  3181. // "response": {
  3182. // "$ref": "ChildList"
  3183. // },
  3184. // "scopes": [
  3185. // "https://www.googleapis.com/auth/drive",
  3186. // "https://www.googleapis.com/auth/drive.appdata",
  3187. // "https://www.googleapis.com/auth/drive.file",
  3188. // "https://www.googleapis.com/auth/drive.metadata",
  3189. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  3190. // "https://www.googleapis.com/auth/drive.photos.readonly",
  3191. // "https://www.googleapis.com/auth/drive.readonly"
  3192. // ]
  3193. // }
  3194. }
  3195. // Pages invokes f for each page of results.
  3196. // A non-nil error returned from f will halt the iteration.
  3197. // The provided context supersedes any context provided to the Context method.
  3198. func (c *ChildrenListCall) Pages(ctx context.Context, f func(*ChildList) error) error {
  3199. c.ctx_ = ctx
  3200. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3201. for {
  3202. x, err := c.Do()
  3203. if err != nil {
  3204. return err
  3205. }
  3206. if err := f(x); err != nil {
  3207. return err
  3208. }
  3209. if x.NextPageToken == "" {
  3210. return nil
  3211. }
  3212. c.PageToken(x.NextPageToken)
  3213. }
  3214. }
  3215. // method id "drive.comments.delete":
  3216. type CommentsDeleteCall struct {
  3217. s *Service
  3218. fileId string
  3219. commentId string
  3220. urlParams_ gensupport.URLParams
  3221. ctx_ context.Context
  3222. }
  3223. // Delete: Deletes a comment.
  3224. func (r *CommentsService) Delete(fileId string, commentId string) *CommentsDeleteCall {
  3225. c := &CommentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3226. c.fileId = fileId
  3227. c.commentId = commentId
  3228. return c
  3229. }
  3230. // Fields allows partial responses to be retrieved. See
  3231. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3232. // for more information.
  3233. func (c *CommentsDeleteCall) Fields(s ...googleapi.Field) *CommentsDeleteCall {
  3234. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3235. return c
  3236. }
  3237. // Context sets the context to be used in this call's Do method. Any
  3238. // pending HTTP request will be aborted if the provided context is
  3239. // canceled.
  3240. func (c *CommentsDeleteCall) Context(ctx context.Context) *CommentsDeleteCall {
  3241. c.ctx_ = ctx
  3242. return c
  3243. }
  3244. func (c *CommentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3245. var body io.Reader = nil
  3246. c.urlParams_.Set("alt", alt)
  3247. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  3248. urls += "?" + c.urlParams_.Encode()
  3249. req, _ := http.NewRequest("DELETE", urls, body)
  3250. googleapi.Expand(req.URL, map[string]string{
  3251. "fileId": c.fileId,
  3252. "commentId": c.commentId,
  3253. })
  3254. req.Header.Set("User-Agent", c.s.userAgent())
  3255. if c.ctx_ != nil {
  3256. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3257. }
  3258. return c.s.client.Do(req)
  3259. }
  3260. // Do executes the "drive.comments.delete" call.
  3261. func (c *CommentsDeleteCall) Do(opts ...googleapi.CallOption) error {
  3262. gensupport.SetOptions(c.urlParams_, opts...)
  3263. res, err := c.doRequest("json")
  3264. if err != nil {
  3265. return err
  3266. }
  3267. defer googleapi.CloseBody(res)
  3268. if err := googleapi.CheckResponse(res); err != nil {
  3269. return err
  3270. }
  3271. return nil
  3272. // {
  3273. // "description": "Deletes a comment.",
  3274. // "httpMethod": "DELETE",
  3275. // "id": "drive.comments.delete",
  3276. // "parameterOrder": [
  3277. // "fileId",
  3278. // "commentId"
  3279. // ],
  3280. // "parameters": {
  3281. // "commentId": {
  3282. // "description": "The ID of the comment.",
  3283. // "location": "path",
  3284. // "required": true,
  3285. // "type": "string"
  3286. // },
  3287. // "fileId": {
  3288. // "description": "The ID of the file.",
  3289. // "location": "path",
  3290. // "required": true,
  3291. // "type": "string"
  3292. // }
  3293. // },
  3294. // "path": "files/{fileId}/comments/{commentId}",
  3295. // "scopes": [
  3296. // "https://www.googleapis.com/auth/drive",
  3297. // "https://www.googleapis.com/auth/drive.file"
  3298. // ]
  3299. // }
  3300. }
  3301. // method id "drive.comments.get":
  3302. type CommentsGetCall struct {
  3303. s *Service
  3304. fileId string
  3305. commentId string
  3306. urlParams_ gensupport.URLParams
  3307. ifNoneMatch_ string
  3308. ctx_ context.Context
  3309. }
  3310. // Get: Gets a comment by ID.
  3311. func (r *CommentsService) Get(fileId string, commentId string) *CommentsGetCall {
  3312. c := &CommentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3313. c.fileId = fileId
  3314. c.commentId = commentId
  3315. return c
  3316. }
  3317. // IncludeDeleted sets the optional parameter "includeDeleted": If set,
  3318. // this will succeed when retrieving a deleted comment, and will include
  3319. // any deleted replies.
  3320. func (c *CommentsGetCall) IncludeDeleted(includeDeleted bool) *CommentsGetCall {
  3321. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  3322. return c
  3323. }
  3324. // Fields allows partial responses to be retrieved. See
  3325. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3326. // for more information.
  3327. func (c *CommentsGetCall) Fields(s ...googleapi.Field) *CommentsGetCall {
  3328. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3329. return c
  3330. }
  3331. // IfNoneMatch sets the optional parameter which makes the operation
  3332. // fail if the object's ETag matches the given value. This is useful for
  3333. // getting updates only after the object has changed since the last
  3334. // request. Use googleapi.IsNotModified to check whether the response
  3335. // error from Do is the result of In-None-Match.
  3336. func (c *CommentsGetCall) IfNoneMatch(entityTag string) *CommentsGetCall {
  3337. c.ifNoneMatch_ = entityTag
  3338. return c
  3339. }
  3340. // Context sets the context to be used in this call's Do method. Any
  3341. // pending HTTP request will be aborted if the provided context is
  3342. // canceled.
  3343. func (c *CommentsGetCall) Context(ctx context.Context) *CommentsGetCall {
  3344. c.ctx_ = ctx
  3345. return c
  3346. }
  3347. func (c *CommentsGetCall) doRequest(alt string) (*http.Response, error) {
  3348. var body io.Reader = nil
  3349. c.urlParams_.Set("alt", alt)
  3350. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  3351. urls += "?" + c.urlParams_.Encode()
  3352. req, _ := http.NewRequest("GET", urls, body)
  3353. googleapi.Expand(req.URL, map[string]string{
  3354. "fileId": c.fileId,
  3355. "commentId": c.commentId,
  3356. })
  3357. req.Header.Set("User-Agent", c.s.userAgent())
  3358. if c.ifNoneMatch_ != "" {
  3359. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3360. }
  3361. if c.ctx_ != nil {
  3362. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3363. }
  3364. return c.s.client.Do(req)
  3365. }
  3366. // Do executes the "drive.comments.get" call.
  3367. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  3368. // code is an error. Response headers are in either
  3369. // *Comment.ServerResponse.Header or (if a response was returned at all)
  3370. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3371. // check whether the returned error was because http.StatusNotModified
  3372. // was returned.
  3373. func (c *CommentsGetCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  3374. gensupport.SetOptions(c.urlParams_, opts...)
  3375. res, err := c.doRequest("json")
  3376. if res != nil && res.StatusCode == http.StatusNotModified {
  3377. if res.Body != nil {
  3378. res.Body.Close()
  3379. }
  3380. return nil, &googleapi.Error{
  3381. Code: res.StatusCode,
  3382. Header: res.Header,
  3383. }
  3384. }
  3385. if err != nil {
  3386. return nil, err
  3387. }
  3388. defer googleapi.CloseBody(res)
  3389. if err := googleapi.CheckResponse(res); err != nil {
  3390. return nil, err
  3391. }
  3392. ret := &Comment{
  3393. ServerResponse: googleapi.ServerResponse{
  3394. Header: res.Header,
  3395. HTTPStatusCode: res.StatusCode,
  3396. },
  3397. }
  3398. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3399. return nil, err
  3400. }
  3401. return ret, nil
  3402. // {
  3403. // "description": "Gets a comment by ID.",
  3404. // "httpMethod": "GET",
  3405. // "id": "drive.comments.get",
  3406. // "parameterOrder": [
  3407. // "fileId",
  3408. // "commentId"
  3409. // ],
  3410. // "parameters": {
  3411. // "commentId": {
  3412. // "description": "The ID of the comment.",
  3413. // "location": "path",
  3414. // "required": true,
  3415. // "type": "string"
  3416. // },
  3417. // "fileId": {
  3418. // "description": "The ID of the file.",
  3419. // "location": "path",
  3420. // "required": true,
  3421. // "type": "string"
  3422. // },
  3423. // "includeDeleted": {
  3424. // "default": "false",
  3425. // "description": "If set, this will succeed when retrieving a deleted comment, and will include any deleted replies.",
  3426. // "location": "query",
  3427. // "type": "boolean"
  3428. // }
  3429. // },
  3430. // "path": "files/{fileId}/comments/{commentId}",
  3431. // "response": {
  3432. // "$ref": "Comment"
  3433. // },
  3434. // "scopes": [
  3435. // "https://www.googleapis.com/auth/drive",
  3436. // "https://www.googleapis.com/auth/drive.file",
  3437. // "https://www.googleapis.com/auth/drive.readonly"
  3438. // ]
  3439. // }
  3440. }
  3441. // method id "drive.comments.insert":
  3442. type CommentsInsertCall struct {
  3443. s *Service
  3444. fileId string
  3445. comment *Comment
  3446. urlParams_ gensupport.URLParams
  3447. ctx_ context.Context
  3448. }
  3449. // Insert: Creates a new comment on the given file.
  3450. func (r *CommentsService) Insert(fileId string, comment *Comment) *CommentsInsertCall {
  3451. c := &CommentsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3452. c.fileId = fileId
  3453. c.comment = comment
  3454. return c
  3455. }
  3456. // Fields allows partial responses to be retrieved. See
  3457. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3458. // for more information.
  3459. func (c *CommentsInsertCall) Fields(s ...googleapi.Field) *CommentsInsertCall {
  3460. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3461. return c
  3462. }
  3463. // Context sets the context to be used in this call's Do method. Any
  3464. // pending HTTP request will be aborted if the provided context is
  3465. // canceled.
  3466. func (c *CommentsInsertCall) Context(ctx context.Context) *CommentsInsertCall {
  3467. c.ctx_ = ctx
  3468. return c
  3469. }
  3470. func (c *CommentsInsertCall) doRequest(alt string) (*http.Response, error) {
  3471. var body io.Reader = nil
  3472. body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment)
  3473. if err != nil {
  3474. return nil, err
  3475. }
  3476. ctype := "application/json"
  3477. c.urlParams_.Set("alt", alt)
  3478. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments")
  3479. urls += "?" + c.urlParams_.Encode()
  3480. req, _ := http.NewRequest("POST", urls, body)
  3481. googleapi.Expand(req.URL, map[string]string{
  3482. "fileId": c.fileId,
  3483. })
  3484. req.Header.Set("Content-Type", ctype)
  3485. req.Header.Set("User-Agent", c.s.userAgent())
  3486. if c.ctx_ != nil {
  3487. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3488. }
  3489. return c.s.client.Do(req)
  3490. }
  3491. // Do executes the "drive.comments.insert" call.
  3492. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  3493. // code is an error. Response headers are in either
  3494. // *Comment.ServerResponse.Header or (if a response was returned at all)
  3495. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3496. // check whether the returned error was because http.StatusNotModified
  3497. // was returned.
  3498. func (c *CommentsInsertCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  3499. gensupport.SetOptions(c.urlParams_, opts...)
  3500. res, err := c.doRequest("json")
  3501. if res != nil && res.StatusCode == http.StatusNotModified {
  3502. if res.Body != nil {
  3503. res.Body.Close()
  3504. }
  3505. return nil, &googleapi.Error{
  3506. Code: res.StatusCode,
  3507. Header: res.Header,
  3508. }
  3509. }
  3510. if err != nil {
  3511. return nil, err
  3512. }
  3513. defer googleapi.CloseBody(res)
  3514. if err := googleapi.CheckResponse(res); err != nil {
  3515. return nil, err
  3516. }
  3517. ret := &Comment{
  3518. ServerResponse: googleapi.ServerResponse{
  3519. Header: res.Header,
  3520. HTTPStatusCode: res.StatusCode,
  3521. },
  3522. }
  3523. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3524. return nil, err
  3525. }
  3526. return ret, nil
  3527. // {
  3528. // "description": "Creates a new comment on the given file.",
  3529. // "httpMethod": "POST",
  3530. // "id": "drive.comments.insert",
  3531. // "parameterOrder": [
  3532. // "fileId"
  3533. // ],
  3534. // "parameters": {
  3535. // "fileId": {
  3536. // "description": "The ID of the file.",
  3537. // "location": "path",
  3538. // "required": true,
  3539. // "type": "string"
  3540. // }
  3541. // },
  3542. // "path": "files/{fileId}/comments",
  3543. // "request": {
  3544. // "$ref": "Comment"
  3545. // },
  3546. // "response": {
  3547. // "$ref": "Comment"
  3548. // },
  3549. // "scopes": [
  3550. // "https://www.googleapis.com/auth/drive",
  3551. // "https://www.googleapis.com/auth/drive.file"
  3552. // ]
  3553. // }
  3554. }
  3555. // method id "drive.comments.list":
  3556. type CommentsListCall struct {
  3557. s *Service
  3558. fileId string
  3559. urlParams_ gensupport.URLParams
  3560. ifNoneMatch_ string
  3561. ctx_ context.Context
  3562. }
  3563. // List: Lists a file's comments.
  3564. func (r *CommentsService) List(fileId string) *CommentsListCall {
  3565. c := &CommentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3566. c.fileId = fileId
  3567. return c
  3568. }
  3569. // IncludeDeleted sets the optional parameter "includeDeleted": If set,
  3570. // all comments and replies, including deleted comments and replies
  3571. // (with content stripped) will be returned.
  3572. func (c *CommentsListCall) IncludeDeleted(includeDeleted bool) *CommentsListCall {
  3573. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  3574. return c
  3575. }
  3576. // MaxResults sets the optional parameter "maxResults": The maximum
  3577. // number of discussions to include in the response, used for paging.
  3578. func (c *CommentsListCall) MaxResults(maxResults int64) *CommentsListCall {
  3579. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3580. return c
  3581. }
  3582. // PageToken sets the optional parameter "pageToken": The continuation
  3583. // token, used to page through large result sets. To get the next page
  3584. // of results, set this parameter to the value of "nextPageToken" from
  3585. // the previous response.
  3586. func (c *CommentsListCall) PageToken(pageToken string) *CommentsListCall {
  3587. c.urlParams_.Set("pageToken", pageToken)
  3588. return c
  3589. }
  3590. // UpdatedMin sets the optional parameter "updatedMin": Only discussions
  3591. // that were updated after this timestamp will be returned. Formatted as
  3592. // an RFC 3339 timestamp.
  3593. func (c *CommentsListCall) UpdatedMin(updatedMin string) *CommentsListCall {
  3594. c.urlParams_.Set("updatedMin", updatedMin)
  3595. return c
  3596. }
  3597. // Fields allows partial responses to be retrieved. See
  3598. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3599. // for more information.
  3600. func (c *CommentsListCall) Fields(s ...googleapi.Field) *CommentsListCall {
  3601. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3602. return c
  3603. }
  3604. // IfNoneMatch sets the optional parameter which makes the operation
  3605. // fail if the object's ETag matches the given value. This is useful for
  3606. // getting updates only after the object has changed since the last
  3607. // request. Use googleapi.IsNotModified to check whether the response
  3608. // error from Do is the result of In-None-Match.
  3609. func (c *CommentsListCall) IfNoneMatch(entityTag string) *CommentsListCall {
  3610. c.ifNoneMatch_ = entityTag
  3611. return c
  3612. }
  3613. // Context sets the context to be used in this call's Do method. Any
  3614. // pending HTTP request will be aborted if the provided context is
  3615. // canceled.
  3616. func (c *CommentsListCall) Context(ctx context.Context) *CommentsListCall {
  3617. c.ctx_ = ctx
  3618. return c
  3619. }
  3620. func (c *CommentsListCall) doRequest(alt string) (*http.Response, error) {
  3621. var body io.Reader = nil
  3622. c.urlParams_.Set("alt", alt)
  3623. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments")
  3624. urls += "?" + c.urlParams_.Encode()
  3625. req, _ := http.NewRequest("GET", urls, body)
  3626. googleapi.Expand(req.URL, map[string]string{
  3627. "fileId": c.fileId,
  3628. })
  3629. req.Header.Set("User-Agent", c.s.userAgent())
  3630. if c.ifNoneMatch_ != "" {
  3631. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3632. }
  3633. if c.ctx_ != nil {
  3634. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3635. }
  3636. return c.s.client.Do(req)
  3637. }
  3638. // Do executes the "drive.comments.list" call.
  3639. // Exactly one of *CommentList or error will be non-nil. Any non-2xx
  3640. // status code is an error. Response headers are in either
  3641. // *CommentList.ServerResponse.Header or (if a response was returned at
  3642. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3643. // to check whether the returned error was because
  3644. // http.StatusNotModified was returned.
  3645. func (c *CommentsListCall) Do(opts ...googleapi.CallOption) (*CommentList, error) {
  3646. gensupport.SetOptions(c.urlParams_, opts...)
  3647. res, err := c.doRequest("json")
  3648. if res != nil && res.StatusCode == http.StatusNotModified {
  3649. if res.Body != nil {
  3650. res.Body.Close()
  3651. }
  3652. return nil, &googleapi.Error{
  3653. Code: res.StatusCode,
  3654. Header: res.Header,
  3655. }
  3656. }
  3657. if err != nil {
  3658. return nil, err
  3659. }
  3660. defer googleapi.CloseBody(res)
  3661. if err := googleapi.CheckResponse(res); err != nil {
  3662. return nil, err
  3663. }
  3664. ret := &CommentList{
  3665. ServerResponse: googleapi.ServerResponse{
  3666. Header: res.Header,
  3667. HTTPStatusCode: res.StatusCode,
  3668. },
  3669. }
  3670. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3671. return nil, err
  3672. }
  3673. return ret, nil
  3674. // {
  3675. // "description": "Lists a file's comments.",
  3676. // "httpMethod": "GET",
  3677. // "id": "drive.comments.list",
  3678. // "parameterOrder": [
  3679. // "fileId"
  3680. // ],
  3681. // "parameters": {
  3682. // "fileId": {
  3683. // "description": "The ID of the file.",
  3684. // "location": "path",
  3685. // "required": true,
  3686. // "type": "string"
  3687. // },
  3688. // "includeDeleted": {
  3689. // "default": "false",
  3690. // "description": "If set, all comments and replies, including deleted comments and replies (with content stripped) will be returned.",
  3691. // "location": "query",
  3692. // "type": "boolean"
  3693. // },
  3694. // "maxResults": {
  3695. // "default": "20",
  3696. // "description": "The maximum number of discussions to include in the response, used for paging.",
  3697. // "format": "int32",
  3698. // "location": "query",
  3699. // "maximum": "100",
  3700. // "minimum": "0",
  3701. // "type": "integer"
  3702. // },
  3703. // "pageToken": {
  3704. // "description": "The continuation token, used to page through large result sets. To get the next page of results, set this parameter to the value of \"nextPageToken\" from the previous response.",
  3705. // "location": "query",
  3706. // "type": "string"
  3707. // },
  3708. // "updatedMin": {
  3709. // "description": "Only discussions that were updated after this timestamp will be returned. Formatted as an RFC 3339 timestamp.",
  3710. // "location": "query",
  3711. // "type": "string"
  3712. // }
  3713. // },
  3714. // "path": "files/{fileId}/comments",
  3715. // "response": {
  3716. // "$ref": "CommentList"
  3717. // },
  3718. // "scopes": [
  3719. // "https://www.googleapis.com/auth/drive",
  3720. // "https://www.googleapis.com/auth/drive.file",
  3721. // "https://www.googleapis.com/auth/drive.readonly"
  3722. // ]
  3723. // }
  3724. }
  3725. // Pages invokes f for each page of results.
  3726. // A non-nil error returned from f will halt the iteration.
  3727. // The provided context supersedes any context provided to the Context method.
  3728. func (c *CommentsListCall) Pages(ctx context.Context, f func(*CommentList) error) error {
  3729. c.ctx_ = ctx
  3730. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3731. for {
  3732. x, err := c.Do()
  3733. if err != nil {
  3734. return err
  3735. }
  3736. if err := f(x); err != nil {
  3737. return err
  3738. }
  3739. if x.NextPageToken == "" {
  3740. return nil
  3741. }
  3742. c.PageToken(x.NextPageToken)
  3743. }
  3744. }
  3745. // method id "drive.comments.patch":
  3746. type CommentsPatchCall struct {
  3747. s *Service
  3748. fileId string
  3749. commentId string
  3750. comment *Comment
  3751. urlParams_ gensupport.URLParams
  3752. ctx_ context.Context
  3753. }
  3754. // Patch: Updates an existing comment. This method supports patch
  3755. // semantics.
  3756. func (r *CommentsService) Patch(fileId string, commentId string, comment *Comment) *CommentsPatchCall {
  3757. c := &CommentsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3758. c.fileId = fileId
  3759. c.commentId = commentId
  3760. c.comment = comment
  3761. return c
  3762. }
  3763. // Fields allows partial responses to be retrieved. See
  3764. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3765. // for more information.
  3766. func (c *CommentsPatchCall) Fields(s ...googleapi.Field) *CommentsPatchCall {
  3767. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3768. return c
  3769. }
  3770. // Context sets the context to be used in this call's Do method. Any
  3771. // pending HTTP request will be aborted if the provided context is
  3772. // canceled.
  3773. func (c *CommentsPatchCall) Context(ctx context.Context) *CommentsPatchCall {
  3774. c.ctx_ = ctx
  3775. return c
  3776. }
  3777. func (c *CommentsPatchCall) doRequest(alt string) (*http.Response, error) {
  3778. var body io.Reader = nil
  3779. body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment)
  3780. if err != nil {
  3781. return nil, err
  3782. }
  3783. ctype := "application/json"
  3784. c.urlParams_.Set("alt", alt)
  3785. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  3786. urls += "?" + c.urlParams_.Encode()
  3787. req, _ := http.NewRequest("PATCH", urls, body)
  3788. googleapi.Expand(req.URL, map[string]string{
  3789. "fileId": c.fileId,
  3790. "commentId": c.commentId,
  3791. })
  3792. req.Header.Set("Content-Type", ctype)
  3793. req.Header.Set("User-Agent", c.s.userAgent())
  3794. if c.ctx_ != nil {
  3795. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3796. }
  3797. return c.s.client.Do(req)
  3798. }
  3799. // Do executes the "drive.comments.patch" call.
  3800. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  3801. // code is an error. Response headers are in either
  3802. // *Comment.ServerResponse.Header or (if a response was returned at all)
  3803. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3804. // check whether the returned error was because http.StatusNotModified
  3805. // was returned.
  3806. func (c *CommentsPatchCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  3807. gensupport.SetOptions(c.urlParams_, opts...)
  3808. res, err := c.doRequest("json")
  3809. if res != nil && res.StatusCode == http.StatusNotModified {
  3810. if res.Body != nil {
  3811. res.Body.Close()
  3812. }
  3813. return nil, &googleapi.Error{
  3814. Code: res.StatusCode,
  3815. Header: res.Header,
  3816. }
  3817. }
  3818. if err != nil {
  3819. return nil, err
  3820. }
  3821. defer googleapi.CloseBody(res)
  3822. if err := googleapi.CheckResponse(res); err != nil {
  3823. return nil, err
  3824. }
  3825. ret := &Comment{
  3826. ServerResponse: googleapi.ServerResponse{
  3827. Header: res.Header,
  3828. HTTPStatusCode: res.StatusCode,
  3829. },
  3830. }
  3831. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3832. return nil, err
  3833. }
  3834. return ret, nil
  3835. // {
  3836. // "description": "Updates an existing comment. This method supports patch semantics.",
  3837. // "httpMethod": "PATCH",
  3838. // "id": "drive.comments.patch",
  3839. // "parameterOrder": [
  3840. // "fileId",
  3841. // "commentId"
  3842. // ],
  3843. // "parameters": {
  3844. // "commentId": {
  3845. // "description": "The ID of the comment.",
  3846. // "location": "path",
  3847. // "required": true,
  3848. // "type": "string"
  3849. // },
  3850. // "fileId": {
  3851. // "description": "The ID of the file.",
  3852. // "location": "path",
  3853. // "required": true,
  3854. // "type": "string"
  3855. // }
  3856. // },
  3857. // "path": "files/{fileId}/comments/{commentId}",
  3858. // "request": {
  3859. // "$ref": "Comment"
  3860. // },
  3861. // "response": {
  3862. // "$ref": "Comment"
  3863. // },
  3864. // "scopes": [
  3865. // "https://www.googleapis.com/auth/drive",
  3866. // "https://www.googleapis.com/auth/drive.file"
  3867. // ]
  3868. // }
  3869. }
  3870. // method id "drive.comments.update":
  3871. type CommentsUpdateCall struct {
  3872. s *Service
  3873. fileId string
  3874. commentId string
  3875. comment *Comment
  3876. urlParams_ gensupport.URLParams
  3877. ctx_ context.Context
  3878. }
  3879. // Update: Updates an existing comment.
  3880. func (r *CommentsService) Update(fileId string, commentId string, comment *Comment) *CommentsUpdateCall {
  3881. c := &CommentsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3882. c.fileId = fileId
  3883. c.commentId = commentId
  3884. c.comment = comment
  3885. return c
  3886. }
  3887. // Fields allows partial responses to be retrieved. See
  3888. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3889. // for more information.
  3890. func (c *CommentsUpdateCall) Fields(s ...googleapi.Field) *CommentsUpdateCall {
  3891. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3892. return c
  3893. }
  3894. // Context sets the context to be used in this call's Do method. Any
  3895. // pending HTTP request will be aborted if the provided context is
  3896. // canceled.
  3897. func (c *CommentsUpdateCall) Context(ctx context.Context) *CommentsUpdateCall {
  3898. c.ctx_ = ctx
  3899. return c
  3900. }
  3901. func (c *CommentsUpdateCall) doRequest(alt string) (*http.Response, error) {
  3902. var body io.Reader = nil
  3903. body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment)
  3904. if err != nil {
  3905. return nil, err
  3906. }
  3907. ctype := "application/json"
  3908. c.urlParams_.Set("alt", alt)
  3909. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  3910. urls += "?" + c.urlParams_.Encode()
  3911. req, _ := http.NewRequest("PUT", urls, body)
  3912. googleapi.Expand(req.URL, map[string]string{
  3913. "fileId": c.fileId,
  3914. "commentId": c.commentId,
  3915. })
  3916. req.Header.Set("Content-Type", ctype)
  3917. req.Header.Set("User-Agent", c.s.userAgent())
  3918. if c.ctx_ != nil {
  3919. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3920. }
  3921. return c.s.client.Do(req)
  3922. }
  3923. // Do executes the "drive.comments.update" call.
  3924. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  3925. // code is an error. Response headers are in either
  3926. // *Comment.ServerResponse.Header or (if a response was returned at all)
  3927. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3928. // check whether the returned error was because http.StatusNotModified
  3929. // was returned.
  3930. func (c *CommentsUpdateCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  3931. gensupport.SetOptions(c.urlParams_, opts...)
  3932. res, err := c.doRequest("json")
  3933. if res != nil && res.StatusCode == http.StatusNotModified {
  3934. if res.Body != nil {
  3935. res.Body.Close()
  3936. }
  3937. return nil, &googleapi.Error{
  3938. Code: res.StatusCode,
  3939. Header: res.Header,
  3940. }
  3941. }
  3942. if err != nil {
  3943. return nil, err
  3944. }
  3945. defer googleapi.CloseBody(res)
  3946. if err := googleapi.CheckResponse(res); err != nil {
  3947. return nil, err
  3948. }
  3949. ret := &Comment{
  3950. ServerResponse: googleapi.ServerResponse{
  3951. Header: res.Header,
  3952. HTTPStatusCode: res.StatusCode,
  3953. },
  3954. }
  3955. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3956. return nil, err
  3957. }
  3958. return ret, nil
  3959. // {
  3960. // "description": "Updates an existing comment.",
  3961. // "httpMethod": "PUT",
  3962. // "id": "drive.comments.update",
  3963. // "parameterOrder": [
  3964. // "fileId",
  3965. // "commentId"
  3966. // ],
  3967. // "parameters": {
  3968. // "commentId": {
  3969. // "description": "The ID of the comment.",
  3970. // "location": "path",
  3971. // "required": true,
  3972. // "type": "string"
  3973. // },
  3974. // "fileId": {
  3975. // "description": "The ID of the file.",
  3976. // "location": "path",
  3977. // "required": true,
  3978. // "type": "string"
  3979. // }
  3980. // },
  3981. // "path": "files/{fileId}/comments/{commentId}",
  3982. // "request": {
  3983. // "$ref": "Comment"
  3984. // },
  3985. // "response": {
  3986. // "$ref": "Comment"
  3987. // },
  3988. // "scopes": [
  3989. // "https://www.googleapis.com/auth/drive",
  3990. // "https://www.googleapis.com/auth/drive.file"
  3991. // ]
  3992. // }
  3993. }
  3994. // method id "drive.files.copy":
  3995. type FilesCopyCall struct {
  3996. s *Service
  3997. fileId string
  3998. file *File
  3999. urlParams_ gensupport.URLParams
  4000. ctx_ context.Context
  4001. }
  4002. // Copy: Creates a copy of the specified file.
  4003. func (r *FilesService) Copy(fileId string, file *File) *FilesCopyCall {
  4004. c := &FilesCopyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4005. c.fileId = fileId
  4006. c.file = file
  4007. return c
  4008. }
  4009. // Convert sets the optional parameter "convert": Whether to convert
  4010. // this file to the corresponding Google Docs format.
  4011. func (c *FilesCopyCall) Convert(convert bool) *FilesCopyCall {
  4012. c.urlParams_.Set("convert", fmt.Sprint(convert))
  4013. return c
  4014. }
  4015. // Ocr sets the optional parameter "ocr": Whether to attempt OCR on
  4016. // .jpg, .png, .gif, or .pdf uploads.
  4017. func (c *FilesCopyCall) Ocr(ocr bool) *FilesCopyCall {
  4018. c.urlParams_.Set("ocr", fmt.Sprint(ocr))
  4019. return c
  4020. }
  4021. // OcrLanguage sets the optional parameter "ocrLanguage": If ocr is
  4022. // true, hints at the language to use. Valid values are BCP 47 codes.
  4023. func (c *FilesCopyCall) OcrLanguage(ocrLanguage string) *FilesCopyCall {
  4024. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  4025. return c
  4026. }
  4027. // Pinned sets the optional parameter "pinned": Whether to pin the head
  4028. // revision of the new copy. A file can have a maximum of 200 pinned
  4029. // revisions.
  4030. func (c *FilesCopyCall) Pinned(pinned bool) *FilesCopyCall {
  4031. c.urlParams_.Set("pinned", fmt.Sprint(pinned))
  4032. return c
  4033. }
  4034. // TimedTextLanguage sets the optional parameter "timedTextLanguage":
  4035. // The language of the timed text.
  4036. func (c *FilesCopyCall) TimedTextLanguage(timedTextLanguage string) *FilesCopyCall {
  4037. c.urlParams_.Set("timedTextLanguage", timedTextLanguage)
  4038. return c
  4039. }
  4040. // TimedTextTrackName sets the optional parameter "timedTextTrackName":
  4041. // The timed text track name.
  4042. func (c *FilesCopyCall) TimedTextTrackName(timedTextTrackName string) *FilesCopyCall {
  4043. c.urlParams_.Set("timedTextTrackName", timedTextTrackName)
  4044. return c
  4045. }
  4046. // Visibility sets the optional parameter "visibility": The visibility
  4047. // of the new file. This parameter is only relevant when the source is
  4048. // not a native Google Doc and convert=false.
  4049. //
  4050. // Possible values:
  4051. // "DEFAULT" (default) - The visibility of the new file is determined
  4052. // by the user's default visibility/sharing policies.
  4053. // "PRIVATE" - The new file will be visible to only the owner.
  4054. func (c *FilesCopyCall) Visibility(visibility string) *FilesCopyCall {
  4055. c.urlParams_.Set("visibility", visibility)
  4056. return c
  4057. }
  4058. // Fields allows partial responses to be retrieved. See
  4059. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4060. // for more information.
  4061. func (c *FilesCopyCall) Fields(s ...googleapi.Field) *FilesCopyCall {
  4062. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4063. return c
  4064. }
  4065. // Context sets the context to be used in this call's Do method. Any
  4066. // pending HTTP request will be aborted if the provided context is
  4067. // canceled.
  4068. func (c *FilesCopyCall) Context(ctx context.Context) *FilesCopyCall {
  4069. c.ctx_ = ctx
  4070. return c
  4071. }
  4072. func (c *FilesCopyCall) doRequest(alt string) (*http.Response, error) {
  4073. var body io.Reader = nil
  4074. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  4075. if err != nil {
  4076. return nil, err
  4077. }
  4078. ctype := "application/json"
  4079. c.urlParams_.Set("alt", alt)
  4080. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/copy")
  4081. urls += "?" + c.urlParams_.Encode()
  4082. req, _ := http.NewRequest("POST", urls, body)
  4083. googleapi.Expand(req.URL, map[string]string{
  4084. "fileId": c.fileId,
  4085. })
  4086. req.Header.Set("Content-Type", ctype)
  4087. req.Header.Set("User-Agent", c.s.userAgent())
  4088. if c.ctx_ != nil {
  4089. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4090. }
  4091. return c.s.client.Do(req)
  4092. }
  4093. // Do executes the "drive.files.copy" call.
  4094. // Exactly one of *File or error will be non-nil. Any non-2xx status
  4095. // code is an error. Response headers are in either
  4096. // *File.ServerResponse.Header or (if a response was returned at all) in
  4097. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4098. // whether the returned error was because http.StatusNotModified was
  4099. // returned.
  4100. func (c *FilesCopyCall) Do(opts ...googleapi.CallOption) (*File, error) {
  4101. gensupport.SetOptions(c.urlParams_, opts...)
  4102. res, err := c.doRequest("json")
  4103. if res != nil && res.StatusCode == http.StatusNotModified {
  4104. if res.Body != nil {
  4105. res.Body.Close()
  4106. }
  4107. return nil, &googleapi.Error{
  4108. Code: res.StatusCode,
  4109. Header: res.Header,
  4110. }
  4111. }
  4112. if err != nil {
  4113. return nil, err
  4114. }
  4115. defer googleapi.CloseBody(res)
  4116. if err := googleapi.CheckResponse(res); err != nil {
  4117. return nil, err
  4118. }
  4119. ret := &File{
  4120. ServerResponse: googleapi.ServerResponse{
  4121. Header: res.Header,
  4122. HTTPStatusCode: res.StatusCode,
  4123. },
  4124. }
  4125. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4126. return nil, err
  4127. }
  4128. return ret, nil
  4129. // {
  4130. // "description": "Creates a copy of the specified file.",
  4131. // "httpMethod": "POST",
  4132. // "id": "drive.files.copy",
  4133. // "parameterOrder": [
  4134. // "fileId"
  4135. // ],
  4136. // "parameters": {
  4137. // "convert": {
  4138. // "default": "false",
  4139. // "description": "Whether to convert this file to the corresponding Google Docs format.",
  4140. // "location": "query",
  4141. // "type": "boolean"
  4142. // },
  4143. // "fileId": {
  4144. // "description": "The ID of the file to copy.",
  4145. // "location": "path",
  4146. // "required": true,
  4147. // "type": "string"
  4148. // },
  4149. // "ocr": {
  4150. // "default": "false",
  4151. // "description": "Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.",
  4152. // "location": "query",
  4153. // "type": "boolean"
  4154. // },
  4155. // "ocrLanguage": {
  4156. // "description": "If ocr is true, hints at the language to use. Valid values are BCP 47 codes.",
  4157. // "location": "query",
  4158. // "type": "string"
  4159. // },
  4160. // "pinned": {
  4161. // "default": "false",
  4162. // "description": "Whether to pin the head revision of the new copy. A file can have a maximum of 200 pinned revisions.",
  4163. // "location": "query",
  4164. // "type": "boolean"
  4165. // },
  4166. // "timedTextLanguage": {
  4167. // "description": "The language of the timed text.",
  4168. // "location": "query",
  4169. // "type": "string"
  4170. // },
  4171. // "timedTextTrackName": {
  4172. // "description": "The timed text track name.",
  4173. // "location": "query",
  4174. // "type": "string"
  4175. // },
  4176. // "visibility": {
  4177. // "default": "DEFAULT",
  4178. // "description": "The visibility of the new file. This parameter is only relevant when the source is not a native Google Doc and convert=false.",
  4179. // "enum": [
  4180. // "DEFAULT",
  4181. // "PRIVATE"
  4182. // ],
  4183. // "enumDescriptions": [
  4184. // "The visibility of the new file is determined by the user's default visibility/sharing policies.",
  4185. // "The new file will be visible to only the owner."
  4186. // ],
  4187. // "location": "query",
  4188. // "type": "string"
  4189. // }
  4190. // },
  4191. // "path": "files/{fileId}/copy",
  4192. // "request": {
  4193. // "$ref": "File"
  4194. // },
  4195. // "response": {
  4196. // "$ref": "File"
  4197. // },
  4198. // "scopes": [
  4199. // "https://www.googleapis.com/auth/drive",
  4200. // "https://www.googleapis.com/auth/drive.appdata",
  4201. // "https://www.googleapis.com/auth/drive.apps.readonly",
  4202. // "https://www.googleapis.com/auth/drive.file",
  4203. // "https://www.googleapis.com/auth/drive.photos.readonly"
  4204. // ]
  4205. // }
  4206. }
  4207. // method id "drive.files.delete":
  4208. type FilesDeleteCall struct {
  4209. s *Service
  4210. fileId string
  4211. urlParams_ gensupport.URLParams
  4212. ctx_ context.Context
  4213. }
  4214. // Delete: Permanently deletes a file by ID. Skips the trash. The
  4215. // currently authenticated user must own the file.
  4216. func (r *FilesService) Delete(fileId string) *FilesDeleteCall {
  4217. c := &FilesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4218. c.fileId = fileId
  4219. return c
  4220. }
  4221. // Fields allows partial responses to be retrieved. See
  4222. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4223. // for more information.
  4224. func (c *FilesDeleteCall) Fields(s ...googleapi.Field) *FilesDeleteCall {
  4225. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4226. return c
  4227. }
  4228. // Context sets the context to be used in this call's Do method. Any
  4229. // pending HTTP request will be aborted if the provided context is
  4230. // canceled.
  4231. func (c *FilesDeleteCall) Context(ctx context.Context) *FilesDeleteCall {
  4232. c.ctx_ = ctx
  4233. return c
  4234. }
  4235. func (c *FilesDeleteCall) doRequest(alt string) (*http.Response, error) {
  4236. var body io.Reader = nil
  4237. c.urlParams_.Set("alt", alt)
  4238. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  4239. urls += "?" + c.urlParams_.Encode()
  4240. req, _ := http.NewRequest("DELETE", urls, body)
  4241. googleapi.Expand(req.URL, map[string]string{
  4242. "fileId": c.fileId,
  4243. })
  4244. req.Header.Set("User-Agent", c.s.userAgent())
  4245. if c.ctx_ != nil {
  4246. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4247. }
  4248. return c.s.client.Do(req)
  4249. }
  4250. // Do executes the "drive.files.delete" call.
  4251. func (c *FilesDeleteCall) Do(opts ...googleapi.CallOption) error {
  4252. gensupport.SetOptions(c.urlParams_, opts...)
  4253. res, err := c.doRequest("json")
  4254. if err != nil {
  4255. return err
  4256. }
  4257. defer googleapi.CloseBody(res)
  4258. if err := googleapi.CheckResponse(res); err != nil {
  4259. return err
  4260. }
  4261. return nil
  4262. // {
  4263. // "description": "Permanently deletes a file by ID. Skips the trash. The currently authenticated user must own the file.",
  4264. // "httpMethod": "DELETE",
  4265. // "id": "drive.files.delete",
  4266. // "parameterOrder": [
  4267. // "fileId"
  4268. // ],
  4269. // "parameters": {
  4270. // "fileId": {
  4271. // "description": "The ID of the file to delete.",
  4272. // "location": "path",
  4273. // "required": true,
  4274. // "type": "string"
  4275. // }
  4276. // },
  4277. // "path": "files/{fileId}",
  4278. // "scopes": [
  4279. // "https://www.googleapis.com/auth/drive",
  4280. // "https://www.googleapis.com/auth/drive.appdata",
  4281. // "https://www.googleapis.com/auth/drive.file"
  4282. // ]
  4283. // }
  4284. }
  4285. // method id "drive.files.emptyTrash":
  4286. type FilesEmptyTrashCall struct {
  4287. s *Service
  4288. urlParams_ gensupport.URLParams
  4289. ctx_ context.Context
  4290. }
  4291. // EmptyTrash: Permanently deletes all of the user's trashed files.
  4292. func (r *FilesService) EmptyTrash() *FilesEmptyTrashCall {
  4293. c := &FilesEmptyTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4294. return c
  4295. }
  4296. // Fields allows partial responses to be retrieved. See
  4297. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4298. // for more information.
  4299. func (c *FilesEmptyTrashCall) Fields(s ...googleapi.Field) *FilesEmptyTrashCall {
  4300. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4301. return c
  4302. }
  4303. // Context sets the context to be used in this call's Do method. Any
  4304. // pending HTTP request will be aborted if the provided context is
  4305. // canceled.
  4306. func (c *FilesEmptyTrashCall) Context(ctx context.Context) *FilesEmptyTrashCall {
  4307. c.ctx_ = ctx
  4308. return c
  4309. }
  4310. func (c *FilesEmptyTrashCall) doRequest(alt string) (*http.Response, error) {
  4311. var body io.Reader = nil
  4312. c.urlParams_.Set("alt", alt)
  4313. urls := googleapi.ResolveRelative(c.s.BasePath, "files/trash")
  4314. urls += "?" + c.urlParams_.Encode()
  4315. req, _ := http.NewRequest("DELETE", urls, body)
  4316. googleapi.SetOpaque(req.URL)
  4317. req.Header.Set("User-Agent", c.s.userAgent())
  4318. if c.ctx_ != nil {
  4319. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4320. }
  4321. return c.s.client.Do(req)
  4322. }
  4323. // Do executes the "drive.files.emptyTrash" call.
  4324. func (c *FilesEmptyTrashCall) Do(opts ...googleapi.CallOption) error {
  4325. gensupport.SetOptions(c.urlParams_, opts...)
  4326. res, err := c.doRequest("json")
  4327. if err != nil {
  4328. return err
  4329. }
  4330. defer googleapi.CloseBody(res)
  4331. if err := googleapi.CheckResponse(res); err != nil {
  4332. return err
  4333. }
  4334. return nil
  4335. // {
  4336. // "description": "Permanently deletes all of the user's trashed files.",
  4337. // "httpMethod": "DELETE",
  4338. // "id": "drive.files.emptyTrash",
  4339. // "path": "files/trash",
  4340. // "scopes": [
  4341. // "https://www.googleapis.com/auth/drive"
  4342. // ]
  4343. // }
  4344. }
  4345. // method id "drive.files.generateIds":
  4346. type FilesGenerateIdsCall struct {
  4347. s *Service
  4348. urlParams_ gensupport.URLParams
  4349. ifNoneMatch_ string
  4350. ctx_ context.Context
  4351. }
  4352. // GenerateIds: Generates a set of file IDs which can be provided in
  4353. // insert requests.
  4354. func (r *FilesService) GenerateIds() *FilesGenerateIdsCall {
  4355. c := &FilesGenerateIdsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4356. return c
  4357. }
  4358. // MaxResults sets the optional parameter "maxResults": Maximum number
  4359. // of IDs to return.
  4360. func (c *FilesGenerateIdsCall) MaxResults(maxResults int64) *FilesGenerateIdsCall {
  4361. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4362. return c
  4363. }
  4364. // Space sets the optional parameter "space": The space in which the IDs
  4365. // can be used to create new files. Supported values are 'drive' and
  4366. // 'appDataFolder'.
  4367. func (c *FilesGenerateIdsCall) Space(space string) *FilesGenerateIdsCall {
  4368. c.urlParams_.Set("space", space)
  4369. return c
  4370. }
  4371. // Fields allows partial responses to be retrieved. See
  4372. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4373. // for more information.
  4374. func (c *FilesGenerateIdsCall) Fields(s ...googleapi.Field) *FilesGenerateIdsCall {
  4375. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4376. return c
  4377. }
  4378. // IfNoneMatch sets the optional parameter which makes the operation
  4379. // fail if the object's ETag matches the given value. This is useful for
  4380. // getting updates only after the object has changed since the last
  4381. // request. Use googleapi.IsNotModified to check whether the response
  4382. // error from Do is the result of In-None-Match.
  4383. func (c *FilesGenerateIdsCall) IfNoneMatch(entityTag string) *FilesGenerateIdsCall {
  4384. c.ifNoneMatch_ = entityTag
  4385. return c
  4386. }
  4387. // Context sets the context to be used in this call's Do method. Any
  4388. // pending HTTP request will be aborted if the provided context is
  4389. // canceled.
  4390. func (c *FilesGenerateIdsCall) Context(ctx context.Context) *FilesGenerateIdsCall {
  4391. c.ctx_ = ctx
  4392. return c
  4393. }
  4394. func (c *FilesGenerateIdsCall) doRequest(alt string) (*http.Response, error) {
  4395. var body io.Reader = nil
  4396. c.urlParams_.Set("alt", alt)
  4397. urls := googleapi.ResolveRelative(c.s.BasePath, "files/generateIds")
  4398. urls += "?" + c.urlParams_.Encode()
  4399. req, _ := http.NewRequest("GET", urls, body)
  4400. googleapi.SetOpaque(req.URL)
  4401. req.Header.Set("User-Agent", c.s.userAgent())
  4402. if c.ifNoneMatch_ != "" {
  4403. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4404. }
  4405. if c.ctx_ != nil {
  4406. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4407. }
  4408. return c.s.client.Do(req)
  4409. }
  4410. // Do executes the "drive.files.generateIds" call.
  4411. // Exactly one of *GeneratedIds or error will be non-nil. Any non-2xx
  4412. // status code is an error. Response headers are in either
  4413. // *GeneratedIds.ServerResponse.Header or (if a response was returned at
  4414. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4415. // to check whether the returned error was because
  4416. // http.StatusNotModified was returned.
  4417. func (c *FilesGenerateIdsCall) Do(opts ...googleapi.CallOption) (*GeneratedIds, error) {
  4418. gensupport.SetOptions(c.urlParams_, opts...)
  4419. res, err := c.doRequest("json")
  4420. if res != nil && res.StatusCode == http.StatusNotModified {
  4421. if res.Body != nil {
  4422. res.Body.Close()
  4423. }
  4424. return nil, &googleapi.Error{
  4425. Code: res.StatusCode,
  4426. Header: res.Header,
  4427. }
  4428. }
  4429. if err != nil {
  4430. return nil, err
  4431. }
  4432. defer googleapi.CloseBody(res)
  4433. if err := googleapi.CheckResponse(res); err != nil {
  4434. return nil, err
  4435. }
  4436. ret := &GeneratedIds{
  4437. ServerResponse: googleapi.ServerResponse{
  4438. Header: res.Header,
  4439. HTTPStatusCode: res.StatusCode,
  4440. },
  4441. }
  4442. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4443. return nil, err
  4444. }
  4445. return ret, nil
  4446. // {
  4447. // "description": "Generates a set of file IDs which can be provided in insert requests.",
  4448. // "httpMethod": "GET",
  4449. // "id": "drive.files.generateIds",
  4450. // "parameters": {
  4451. // "maxResults": {
  4452. // "default": "10",
  4453. // "description": "Maximum number of IDs to return.",
  4454. // "format": "int32",
  4455. // "location": "query",
  4456. // "maximum": "1000",
  4457. // "minimum": "1",
  4458. // "type": "integer"
  4459. // },
  4460. // "space": {
  4461. // "default": "drive",
  4462. // "description": "The space in which the IDs can be used to create new files. Supported values are 'drive' and 'appDataFolder'.",
  4463. // "location": "query",
  4464. // "type": "string"
  4465. // }
  4466. // },
  4467. // "path": "files/generateIds",
  4468. // "response": {
  4469. // "$ref": "GeneratedIds"
  4470. // },
  4471. // "scopes": [
  4472. // "https://www.googleapis.com/auth/drive",
  4473. // "https://www.googleapis.com/auth/drive.appdata",
  4474. // "https://www.googleapis.com/auth/drive.file"
  4475. // ]
  4476. // }
  4477. }
  4478. // method id "drive.files.get":
  4479. type FilesGetCall struct {
  4480. s *Service
  4481. fileId string
  4482. urlParams_ gensupport.URLParams
  4483. ifNoneMatch_ string
  4484. ctx_ context.Context
  4485. }
  4486. // Get: Gets a file's metadata by ID.
  4487. func (r *FilesService) Get(fileId string) *FilesGetCall {
  4488. c := &FilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4489. c.fileId = fileId
  4490. return c
  4491. }
  4492. // AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse":
  4493. // Whether the user is acknowledging the risk of downloading known
  4494. // malware or other abusive files.
  4495. func (c *FilesGetCall) AcknowledgeAbuse(acknowledgeAbuse bool) *FilesGetCall {
  4496. c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse))
  4497. return c
  4498. }
  4499. // Projection sets the optional parameter "projection": This parameter
  4500. // is deprecated and has no function.
  4501. //
  4502. // Possible values:
  4503. // "BASIC" - Deprecated
  4504. // "FULL" - Deprecated
  4505. func (c *FilesGetCall) Projection(projection string) *FilesGetCall {
  4506. c.urlParams_.Set("projection", projection)
  4507. return c
  4508. }
  4509. // RevisionId sets the optional parameter "revisionId": Specifies the
  4510. // Revision ID that should be downloaded. Ignored unless alt=media is
  4511. // specified.
  4512. func (c *FilesGetCall) RevisionId(revisionId string) *FilesGetCall {
  4513. c.urlParams_.Set("revisionId", revisionId)
  4514. return c
  4515. }
  4516. // UpdateViewedDate sets the optional parameter "updateViewedDate":
  4517. // Deprecated: Use files.update with modifiedDateBehavior=noChange,
  4518. // updateViewedDate=true and an empty request body.
  4519. func (c *FilesGetCall) UpdateViewedDate(updateViewedDate bool) *FilesGetCall {
  4520. c.urlParams_.Set("updateViewedDate", fmt.Sprint(updateViewedDate))
  4521. return c
  4522. }
  4523. // Fields allows partial responses to be retrieved. See
  4524. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4525. // for more information.
  4526. func (c *FilesGetCall) Fields(s ...googleapi.Field) *FilesGetCall {
  4527. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4528. return c
  4529. }
  4530. // IfNoneMatch sets the optional parameter which makes the operation
  4531. // fail if the object's ETag matches the given value. This is useful for
  4532. // getting updates only after the object has changed since the last
  4533. // request. Use googleapi.IsNotModified to check whether the response
  4534. // error from Do is the result of In-None-Match.
  4535. func (c *FilesGetCall) IfNoneMatch(entityTag string) *FilesGetCall {
  4536. c.ifNoneMatch_ = entityTag
  4537. return c
  4538. }
  4539. // Context sets the context to be used in this call's Do and Download
  4540. // methods. Any pending HTTP request will be aborted if the provided
  4541. // context is canceled.
  4542. func (c *FilesGetCall) Context(ctx context.Context) *FilesGetCall {
  4543. c.ctx_ = ctx
  4544. return c
  4545. }
  4546. func (c *FilesGetCall) doRequest(alt string) (*http.Response, error) {
  4547. var body io.Reader = nil
  4548. c.urlParams_.Set("alt", alt)
  4549. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  4550. urls += "?" + c.urlParams_.Encode()
  4551. req, _ := http.NewRequest("GET", urls, body)
  4552. googleapi.Expand(req.URL, map[string]string{
  4553. "fileId": c.fileId,
  4554. })
  4555. req.Header.Set("User-Agent", c.s.userAgent())
  4556. if c.ifNoneMatch_ != "" {
  4557. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4558. }
  4559. if c.ctx_ != nil {
  4560. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4561. }
  4562. return c.s.client.Do(req)
  4563. }
  4564. // Download fetches the API endpoint's "media" value, instead of the normal
  4565. // API response value. If the returned error is nil, the Response is guaranteed to
  4566. // have a 2xx status code. Callers must close the Response.Body as usual.
  4567. func (c *FilesGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  4568. gensupport.SetOptions(c.urlParams_, opts...)
  4569. res, err := c.doRequest("media")
  4570. if err != nil {
  4571. return nil, err
  4572. }
  4573. if err := googleapi.CheckMediaResponse(res); err != nil {
  4574. res.Body.Close()
  4575. return nil, err
  4576. }
  4577. return res, nil
  4578. }
  4579. // Do executes the "drive.files.get" call.
  4580. // Exactly one of *File or error will be non-nil. Any non-2xx status
  4581. // code is an error. Response headers are in either
  4582. // *File.ServerResponse.Header or (if a response was returned at all) in
  4583. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4584. // whether the returned error was because http.StatusNotModified was
  4585. // returned.
  4586. func (c *FilesGetCall) Do(opts ...googleapi.CallOption) (*File, error) {
  4587. gensupport.SetOptions(c.urlParams_, opts...)
  4588. res, err := c.doRequest("json")
  4589. if res != nil && res.StatusCode == http.StatusNotModified {
  4590. if res.Body != nil {
  4591. res.Body.Close()
  4592. }
  4593. return nil, &googleapi.Error{
  4594. Code: res.StatusCode,
  4595. Header: res.Header,
  4596. }
  4597. }
  4598. if err != nil {
  4599. return nil, err
  4600. }
  4601. defer googleapi.CloseBody(res)
  4602. if err := googleapi.CheckResponse(res); err != nil {
  4603. return nil, err
  4604. }
  4605. ret := &File{
  4606. ServerResponse: googleapi.ServerResponse{
  4607. Header: res.Header,
  4608. HTTPStatusCode: res.StatusCode,
  4609. },
  4610. }
  4611. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4612. return nil, err
  4613. }
  4614. return ret, nil
  4615. // {
  4616. // "description": "Gets a file's metadata by ID.",
  4617. // "httpMethod": "GET",
  4618. // "id": "drive.files.get",
  4619. // "parameterOrder": [
  4620. // "fileId"
  4621. // ],
  4622. // "parameters": {
  4623. // "acknowledgeAbuse": {
  4624. // "default": "false",
  4625. // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files.",
  4626. // "location": "query",
  4627. // "type": "boolean"
  4628. // },
  4629. // "fileId": {
  4630. // "description": "The ID for the file in question.",
  4631. // "location": "path",
  4632. // "required": true,
  4633. // "type": "string"
  4634. // },
  4635. // "projection": {
  4636. // "description": "This parameter is deprecated and has no function.",
  4637. // "enum": [
  4638. // "BASIC",
  4639. // "FULL"
  4640. // ],
  4641. // "enumDescriptions": [
  4642. // "Deprecated",
  4643. // "Deprecated"
  4644. // ],
  4645. // "location": "query",
  4646. // "type": "string"
  4647. // },
  4648. // "revisionId": {
  4649. // "description": "Specifies the Revision ID that should be downloaded. Ignored unless alt=media is specified.",
  4650. // "location": "query",
  4651. // "type": "string"
  4652. // },
  4653. // "updateViewedDate": {
  4654. // "default": "false",
  4655. // "description": "Deprecated: Use files.update with modifiedDateBehavior=noChange, updateViewedDate=true and an empty request body.",
  4656. // "location": "query",
  4657. // "type": "boolean"
  4658. // }
  4659. // },
  4660. // "path": "files/{fileId}",
  4661. // "response": {
  4662. // "$ref": "File"
  4663. // },
  4664. // "scopes": [
  4665. // "https://www.googleapis.com/auth/drive",
  4666. // "https://www.googleapis.com/auth/drive.appdata",
  4667. // "https://www.googleapis.com/auth/drive.apps.readonly",
  4668. // "https://www.googleapis.com/auth/drive.file",
  4669. // "https://www.googleapis.com/auth/drive.metadata",
  4670. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  4671. // "https://www.googleapis.com/auth/drive.photos.readonly",
  4672. // "https://www.googleapis.com/auth/drive.readonly"
  4673. // ],
  4674. // "supportsMediaDownload": true,
  4675. // "supportsSubscription": true,
  4676. // "useMediaDownloadService": true
  4677. // }
  4678. }
  4679. // method id "drive.files.insert":
  4680. type FilesInsertCall struct {
  4681. s *Service
  4682. file *File
  4683. urlParams_ gensupport.URLParams
  4684. media_ io.Reader
  4685. resumableBuffer_ *gensupport.ResumableBuffer
  4686. mediaType_ string
  4687. mediaSize_ int64 // mediaSize, if known. Used only for calls to progressUpdater_.
  4688. progressUpdater_ googleapi.ProgressUpdater
  4689. ctx_ context.Context
  4690. }
  4691. // Insert: Insert a new file.
  4692. func (r *FilesService) Insert(file *File) *FilesInsertCall {
  4693. c := &FilesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4694. c.file = file
  4695. return c
  4696. }
  4697. // Convert sets the optional parameter "convert": Whether to convert
  4698. // this file to the corresponding Google Docs format.
  4699. func (c *FilesInsertCall) Convert(convert bool) *FilesInsertCall {
  4700. c.urlParams_.Set("convert", fmt.Sprint(convert))
  4701. return c
  4702. }
  4703. // Ocr sets the optional parameter "ocr": Whether to attempt OCR on
  4704. // .jpg, .png, .gif, or .pdf uploads.
  4705. func (c *FilesInsertCall) Ocr(ocr bool) *FilesInsertCall {
  4706. c.urlParams_.Set("ocr", fmt.Sprint(ocr))
  4707. return c
  4708. }
  4709. // OcrLanguage sets the optional parameter "ocrLanguage": If ocr is
  4710. // true, hints at the language to use. Valid values are BCP 47 codes.
  4711. func (c *FilesInsertCall) OcrLanguage(ocrLanguage string) *FilesInsertCall {
  4712. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  4713. return c
  4714. }
  4715. // Pinned sets the optional parameter "pinned": Whether to pin the head
  4716. // revision of the uploaded file. A file can have a maximum of 200
  4717. // pinned revisions.
  4718. func (c *FilesInsertCall) Pinned(pinned bool) *FilesInsertCall {
  4719. c.urlParams_.Set("pinned", fmt.Sprint(pinned))
  4720. return c
  4721. }
  4722. // TimedTextLanguage sets the optional parameter "timedTextLanguage":
  4723. // The language of the timed text.
  4724. func (c *FilesInsertCall) TimedTextLanguage(timedTextLanguage string) *FilesInsertCall {
  4725. c.urlParams_.Set("timedTextLanguage", timedTextLanguage)
  4726. return c
  4727. }
  4728. // TimedTextTrackName sets the optional parameter "timedTextTrackName":
  4729. // The timed text track name.
  4730. func (c *FilesInsertCall) TimedTextTrackName(timedTextTrackName string) *FilesInsertCall {
  4731. c.urlParams_.Set("timedTextTrackName", timedTextTrackName)
  4732. return c
  4733. }
  4734. // UseContentAsIndexableText sets the optional parameter
  4735. // "useContentAsIndexableText": Whether to use the content as indexable
  4736. // text.
  4737. func (c *FilesInsertCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesInsertCall {
  4738. c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText))
  4739. return c
  4740. }
  4741. // Visibility sets the optional parameter "visibility": The visibility
  4742. // of the new file. This parameter is only relevant when convert=false.
  4743. //
  4744. // Possible values:
  4745. // "DEFAULT" (default) - The visibility of the new file is determined
  4746. // by the user's default visibility/sharing policies.
  4747. // "PRIVATE" - The new file will be visible to only the owner.
  4748. func (c *FilesInsertCall) Visibility(visibility string) *FilesInsertCall {
  4749. c.urlParams_.Set("visibility", visibility)
  4750. return c
  4751. }
  4752. // Media specifies the media to upload in one or more chunks. The chunk
  4753. // size may be controlled by supplying a MediaOption generated by
  4754. // googleapi.ChunkSize. The chunk size defaults to
  4755. // googleapi.DefaultUploadChunkSize.
  4756. // At most one of Media and ResumableMedia may be set.
  4757. func (c *FilesInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *FilesInsertCall {
  4758. opts := googleapi.ProcessMediaOptions(options)
  4759. chunkSize := opts.ChunkSize
  4760. r, c.mediaType_ = gensupport.DetermineContentType(r, opts.ContentType)
  4761. c.media_, c.resumableBuffer_ = gensupport.PrepareUpload(r, chunkSize)
  4762. return c
  4763. }
  4764. // ResumableMedia specifies the media to upload in chunks and can be
  4765. // canceled with ctx.
  4766. //
  4767. // Deprecated: use Media instead.
  4768. //
  4769. // At most one of Media and ResumableMedia may be set. mediaType
  4770. // identifies the MIME media type of the upload, such as "image/png". If
  4771. // mediaType is "", it will be auto-detected. The provided ctx will
  4772. // supersede any context previously provided to the Context method.
  4773. func (c *FilesInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesInsertCall {
  4774. c.ctx_ = ctx
  4775. rdr := gensupport.ReaderAtToReader(r, size)
  4776. rdr, c.mediaType_ = gensupport.DetermineContentType(rdr, mediaType)
  4777. c.resumableBuffer_ = gensupport.NewResumableBuffer(rdr, googleapi.DefaultUploadChunkSize)
  4778. c.media_ = nil
  4779. c.mediaSize_ = size
  4780. return c
  4781. }
  4782. // ProgressUpdater provides a callback function that will be called
  4783. // after every chunk. It should be a low-latency function in order to
  4784. // not slow down the upload operation. This should only be called when
  4785. // using ResumableMedia (as opposed to Media).
  4786. func (c *FilesInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesInsertCall {
  4787. c.progressUpdater_ = pu
  4788. return c
  4789. }
  4790. // Fields allows partial responses to be retrieved. See
  4791. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4792. // for more information.
  4793. func (c *FilesInsertCall) Fields(s ...googleapi.Field) *FilesInsertCall {
  4794. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4795. return c
  4796. }
  4797. // Context sets the context to be used in this call's Do method. Any
  4798. // pending HTTP request will be aborted if the provided context is
  4799. // canceled.
  4800. // This context will supersede any context previously provided to the
  4801. // ResumableMedia method.
  4802. func (c *FilesInsertCall) Context(ctx context.Context) *FilesInsertCall {
  4803. c.ctx_ = ctx
  4804. return c
  4805. }
  4806. func (c *FilesInsertCall) doRequest(alt string) (*http.Response, error) {
  4807. var body io.Reader = nil
  4808. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  4809. if err != nil {
  4810. return nil, err
  4811. }
  4812. ctype := "application/json"
  4813. c.urlParams_.Set("alt", alt)
  4814. urls := googleapi.ResolveRelative(c.s.BasePath, "files")
  4815. if c.media_ != nil || c.resumableBuffer_ != nil {
  4816. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  4817. protocol := "multipart"
  4818. if c.resumableBuffer_ != nil {
  4819. protocol = "resumable"
  4820. }
  4821. c.urlParams_.Set("uploadType", protocol)
  4822. }
  4823. urls += "?" + c.urlParams_.Encode()
  4824. if c.media_ != nil {
  4825. var combined io.ReadCloser
  4826. combined, ctype = gensupport.CombineBodyMedia(body, ctype, c.media_, c.mediaType_)
  4827. defer combined.Close()
  4828. body = combined
  4829. }
  4830. req, _ := http.NewRequest("POST", urls, body)
  4831. googleapi.SetOpaque(req.URL)
  4832. if c.resumableBuffer_ != nil {
  4833. req.Header.Set("X-Upload-Content-Type", c.mediaType_)
  4834. }
  4835. req.Header.Set("Content-Type", ctype)
  4836. req.Header.Set("User-Agent", c.s.userAgent())
  4837. if c.ctx_ != nil {
  4838. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4839. }
  4840. return c.s.client.Do(req)
  4841. }
  4842. // Do executes the "drive.files.insert" call.
  4843. // Exactly one of *File or error will be non-nil. Any non-2xx status
  4844. // code is an error. Response headers are in either
  4845. // *File.ServerResponse.Header or (if a response was returned at all) in
  4846. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4847. // whether the returned error was because http.StatusNotModified was
  4848. // returned.
  4849. func (c *FilesInsertCall) Do(opts ...googleapi.CallOption) (*File, error) {
  4850. gensupport.SetOptions(c.urlParams_, opts...)
  4851. res, err := gensupport.Retry(c.ctx_, func() (*http.Response, error) {
  4852. return c.doRequest("json")
  4853. }, gensupport.DefaultBackoffStrategy())
  4854. if res != nil && res.StatusCode == http.StatusNotModified {
  4855. if res.Body != nil {
  4856. res.Body.Close()
  4857. }
  4858. return nil, &googleapi.Error{
  4859. Code: res.StatusCode,
  4860. Header: res.Header,
  4861. }
  4862. }
  4863. if err != nil {
  4864. return nil, err
  4865. }
  4866. defer googleapi.CloseBody(res)
  4867. if err := googleapi.CheckResponse(res); err != nil {
  4868. return nil, err
  4869. }
  4870. if c.resumableBuffer_ != nil {
  4871. loc := res.Header.Get("Location")
  4872. rx := &gensupport.ResumableUpload{
  4873. Client: c.s.client,
  4874. UserAgent: c.s.userAgent(),
  4875. URI: loc,
  4876. Media: c.resumableBuffer_,
  4877. MediaType: c.mediaType_,
  4878. Callback: func(curr int64) {
  4879. if c.progressUpdater_ != nil {
  4880. c.progressUpdater_(curr, c.mediaSize_)
  4881. }
  4882. },
  4883. }
  4884. ctx := c.ctx_
  4885. if ctx == nil {
  4886. ctx = context.TODO()
  4887. }
  4888. res, err = rx.Upload(ctx)
  4889. if err != nil {
  4890. return nil, err
  4891. }
  4892. defer res.Body.Close()
  4893. if err := googleapi.CheckResponse(res); err != nil {
  4894. return nil, err
  4895. }
  4896. }
  4897. ret := &File{
  4898. ServerResponse: googleapi.ServerResponse{
  4899. Header: res.Header,
  4900. HTTPStatusCode: res.StatusCode,
  4901. },
  4902. }
  4903. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4904. return nil, err
  4905. }
  4906. return ret, nil
  4907. // {
  4908. // "description": "Insert a new file.",
  4909. // "httpMethod": "POST",
  4910. // "id": "drive.files.insert",
  4911. // "mediaUpload": {
  4912. // "accept": [
  4913. // "*/*"
  4914. // ],
  4915. // "maxSize": "5120GB",
  4916. // "protocols": {
  4917. // "resumable": {
  4918. // "multipart": true,
  4919. // "path": "/resumable/upload/drive/v2/files"
  4920. // },
  4921. // "simple": {
  4922. // "multipart": true,
  4923. // "path": "/upload/drive/v2/files"
  4924. // }
  4925. // }
  4926. // },
  4927. // "parameters": {
  4928. // "convert": {
  4929. // "default": "false",
  4930. // "description": "Whether to convert this file to the corresponding Google Docs format.",
  4931. // "location": "query",
  4932. // "type": "boolean"
  4933. // },
  4934. // "ocr": {
  4935. // "default": "false",
  4936. // "description": "Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.",
  4937. // "location": "query",
  4938. // "type": "boolean"
  4939. // },
  4940. // "ocrLanguage": {
  4941. // "description": "If ocr is true, hints at the language to use. Valid values are BCP 47 codes.",
  4942. // "location": "query",
  4943. // "type": "string"
  4944. // },
  4945. // "pinned": {
  4946. // "default": "false",
  4947. // "description": "Whether to pin the head revision of the uploaded file. A file can have a maximum of 200 pinned revisions.",
  4948. // "location": "query",
  4949. // "type": "boolean"
  4950. // },
  4951. // "timedTextLanguage": {
  4952. // "description": "The language of the timed text.",
  4953. // "location": "query",
  4954. // "type": "string"
  4955. // },
  4956. // "timedTextTrackName": {
  4957. // "description": "The timed text track name.",
  4958. // "location": "query",
  4959. // "type": "string"
  4960. // },
  4961. // "useContentAsIndexableText": {
  4962. // "default": "false",
  4963. // "description": "Whether to use the content as indexable text.",
  4964. // "location": "query",
  4965. // "type": "boolean"
  4966. // },
  4967. // "visibility": {
  4968. // "default": "DEFAULT",
  4969. // "description": "The visibility of the new file. This parameter is only relevant when convert=false.",
  4970. // "enum": [
  4971. // "DEFAULT",
  4972. // "PRIVATE"
  4973. // ],
  4974. // "enumDescriptions": [
  4975. // "The visibility of the new file is determined by the user's default visibility/sharing policies.",
  4976. // "The new file will be visible to only the owner."
  4977. // ],
  4978. // "location": "query",
  4979. // "type": "string"
  4980. // }
  4981. // },
  4982. // "path": "files",
  4983. // "request": {
  4984. // "$ref": "File"
  4985. // },
  4986. // "response": {
  4987. // "$ref": "File"
  4988. // },
  4989. // "scopes": [
  4990. // "https://www.googleapis.com/auth/drive",
  4991. // "https://www.googleapis.com/auth/drive.appdata",
  4992. // "https://www.googleapis.com/auth/drive.apps.readonly",
  4993. // "https://www.googleapis.com/auth/drive.file"
  4994. // ],
  4995. // "supportsMediaUpload": true,
  4996. // "supportsSubscription": true
  4997. // }
  4998. }
  4999. // method id "drive.files.list":
  5000. type FilesListCall struct {
  5001. s *Service
  5002. urlParams_ gensupport.URLParams
  5003. ifNoneMatch_ string
  5004. ctx_ context.Context
  5005. }
  5006. // List: Lists the user's files.
  5007. func (r *FilesService) List() *FilesListCall {
  5008. c := &FilesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5009. return c
  5010. }
  5011. // Corpus sets the optional parameter "corpus": The body of items
  5012. // (files/documents) to which the query applies.
  5013. //
  5014. // Possible values:
  5015. // "DEFAULT" - The items that the user has accessed.
  5016. // "DOMAIN" - Items shared to the user's domain.
  5017. func (c *FilesListCall) Corpus(corpus string) *FilesListCall {
  5018. c.urlParams_.Set("corpus", corpus)
  5019. return c
  5020. }
  5021. // MaxResults sets the optional parameter "maxResults": Maximum number
  5022. // of files to return.
  5023. func (c *FilesListCall) MaxResults(maxResults int64) *FilesListCall {
  5024. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5025. return c
  5026. }
  5027. // OrderBy sets the optional parameter "orderBy": A comma-separated list
  5028. // of sort keys. Valid keys are 'createdDate', 'folder',
  5029. // 'lastViewedByMeDate', 'modifiedByMeDate', 'modifiedDate',
  5030. // 'quotaBytesUsed', 'recency', 'sharedWithMeDate', 'starred', and
  5031. // 'title'. Each key sorts ascending by default, but may be reversed
  5032. // with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedDate
  5033. // desc,title. Please note that there is a current limitation for users
  5034. // with approximately one million files in which the requested sort
  5035. // order is ignored.
  5036. func (c *FilesListCall) OrderBy(orderBy string) *FilesListCall {
  5037. c.urlParams_.Set("orderBy", orderBy)
  5038. return c
  5039. }
  5040. // PageToken sets the optional parameter "pageToken": Page token for
  5041. // files.
  5042. func (c *FilesListCall) PageToken(pageToken string) *FilesListCall {
  5043. c.urlParams_.Set("pageToken", pageToken)
  5044. return c
  5045. }
  5046. // Projection sets the optional parameter "projection": This parameter
  5047. // is deprecated and has no function.
  5048. //
  5049. // Possible values:
  5050. // "BASIC" - Deprecated
  5051. // "FULL" - Deprecated
  5052. func (c *FilesListCall) Projection(projection string) *FilesListCall {
  5053. c.urlParams_.Set("projection", projection)
  5054. return c
  5055. }
  5056. // Q sets the optional parameter "q": Query string for searching files.
  5057. func (c *FilesListCall) Q(q string) *FilesListCall {
  5058. c.urlParams_.Set("q", q)
  5059. return c
  5060. }
  5061. // Spaces sets the optional parameter "spaces": A comma-separated list
  5062. // of spaces to query. Supported values are 'drive', 'appDataFolder' and
  5063. // 'photos'.
  5064. func (c *FilesListCall) Spaces(spaces string) *FilesListCall {
  5065. c.urlParams_.Set("spaces", spaces)
  5066. return c
  5067. }
  5068. // Fields allows partial responses to be retrieved. See
  5069. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5070. // for more information.
  5071. func (c *FilesListCall) Fields(s ...googleapi.Field) *FilesListCall {
  5072. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5073. return c
  5074. }
  5075. // IfNoneMatch sets the optional parameter which makes the operation
  5076. // fail if the object's ETag matches the given value. This is useful for
  5077. // getting updates only after the object has changed since the last
  5078. // request. Use googleapi.IsNotModified to check whether the response
  5079. // error from Do is the result of In-None-Match.
  5080. func (c *FilesListCall) IfNoneMatch(entityTag string) *FilesListCall {
  5081. c.ifNoneMatch_ = entityTag
  5082. return c
  5083. }
  5084. // Context sets the context to be used in this call's Do method. Any
  5085. // pending HTTP request will be aborted if the provided context is
  5086. // canceled.
  5087. func (c *FilesListCall) Context(ctx context.Context) *FilesListCall {
  5088. c.ctx_ = ctx
  5089. return c
  5090. }
  5091. func (c *FilesListCall) doRequest(alt string) (*http.Response, error) {
  5092. var body io.Reader = nil
  5093. c.urlParams_.Set("alt", alt)
  5094. urls := googleapi.ResolveRelative(c.s.BasePath, "files")
  5095. urls += "?" + c.urlParams_.Encode()
  5096. req, _ := http.NewRequest("GET", urls, body)
  5097. googleapi.SetOpaque(req.URL)
  5098. req.Header.Set("User-Agent", c.s.userAgent())
  5099. if c.ifNoneMatch_ != "" {
  5100. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  5101. }
  5102. if c.ctx_ != nil {
  5103. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5104. }
  5105. return c.s.client.Do(req)
  5106. }
  5107. // Do executes the "drive.files.list" call.
  5108. // Exactly one of *FileList or error will be non-nil. Any non-2xx status
  5109. // code is an error. Response headers are in either
  5110. // *FileList.ServerResponse.Header or (if a response was returned at
  5111. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5112. // to check whether the returned error was because
  5113. // http.StatusNotModified was returned.
  5114. func (c *FilesListCall) Do(opts ...googleapi.CallOption) (*FileList, error) {
  5115. gensupport.SetOptions(c.urlParams_, opts...)
  5116. res, err := c.doRequest("json")
  5117. if res != nil && res.StatusCode == http.StatusNotModified {
  5118. if res.Body != nil {
  5119. res.Body.Close()
  5120. }
  5121. return nil, &googleapi.Error{
  5122. Code: res.StatusCode,
  5123. Header: res.Header,
  5124. }
  5125. }
  5126. if err != nil {
  5127. return nil, err
  5128. }
  5129. defer googleapi.CloseBody(res)
  5130. if err := googleapi.CheckResponse(res); err != nil {
  5131. return nil, err
  5132. }
  5133. ret := &FileList{
  5134. ServerResponse: googleapi.ServerResponse{
  5135. Header: res.Header,
  5136. HTTPStatusCode: res.StatusCode,
  5137. },
  5138. }
  5139. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5140. return nil, err
  5141. }
  5142. return ret, nil
  5143. // {
  5144. // "description": "Lists the user's files.",
  5145. // "httpMethod": "GET",
  5146. // "id": "drive.files.list",
  5147. // "parameters": {
  5148. // "corpus": {
  5149. // "description": "The body of items (files/documents) to which the query applies.",
  5150. // "enum": [
  5151. // "DEFAULT",
  5152. // "DOMAIN"
  5153. // ],
  5154. // "enumDescriptions": [
  5155. // "The items that the user has accessed.",
  5156. // "Items shared to the user's domain."
  5157. // ],
  5158. // "location": "query",
  5159. // "type": "string"
  5160. // },
  5161. // "maxResults": {
  5162. // "default": "100",
  5163. // "description": "Maximum number of files to return.",
  5164. // "format": "int32",
  5165. // "location": "query",
  5166. // "minimum": "0",
  5167. // "type": "integer"
  5168. // },
  5169. // "orderBy": {
  5170. // "description": "A comma-separated list of sort keys. Valid keys are 'createdDate', 'folder', 'lastViewedByMeDate', 'modifiedByMeDate', 'modifiedDate', 'quotaBytesUsed', 'recency', 'sharedWithMeDate', 'starred', and 'title'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedDate desc,title. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.",
  5171. // "location": "query",
  5172. // "type": "string"
  5173. // },
  5174. // "pageToken": {
  5175. // "description": "Page token for files.",
  5176. // "location": "query",
  5177. // "type": "string"
  5178. // },
  5179. // "projection": {
  5180. // "description": "This parameter is deprecated and has no function.",
  5181. // "enum": [
  5182. // "BASIC",
  5183. // "FULL"
  5184. // ],
  5185. // "enumDescriptions": [
  5186. // "Deprecated",
  5187. // "Deprecated"
  5188. // ],
  5189. // "location": "query",
  5190. // "type": "string"
  5191. // },
  5192. // "q": {
  5193. // "description": "Query string for searching files.",
  5194. // "location": "query",
  5195. // "type": "string"
  5196. // },
  5197. // "spaces": {
  5198. // "description": "A comma-separated list of spaces to query. Supported values are 'drive', 'appDataFolder' and 'photos'.",
  5199. // "location": "query",
  5200. // "type": "string"
  5201. // }
  5202. // },
  5203. // "path": "files",
  5204. // "response": {
  5205. // "$ref": "FileList"
  5206. // },
  5207. // "scopes": [
  5208. // "https://www.googleapis.com/auth/drive",
  5209. // "https://www.googleapis.com/auth/drive.appdata",
  5210. // "https://www.googleapis.com/auth/drive.apps.readonly",
  5211. // "https://www.googleapis.com/auth/drive.file",
  5212. // "https://www.googleapis.com/auth/drive.metadata",
  5213. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  5214. // "https://www.googleapis.com/auth/drive.photos.readonly",
  5215. // "https://www.googleapis.com/auth/drive.readonly"
  5216. // ]
  5217. // }
  5218. }
  5219. // Pages invokes f for each page of results.
  5220. // A non-nil error returned from f will halt the iteration.
  5221. // The provided context supersedes any context provided to the Context method.
  5222. func (c *FilesListCall) Pages(ctx context.Context, f func(*FileList) error) error {
  5223. c.ctx_ = ctx
  5224. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5225. for {
  5226. x, err := c.Do()
  5227. if err != nil {
  5228. return err
  5229. }
  5230. if err := f(x); err != nil {
  5231. return err
  5232. }
  5233. if x.NextPageToken == "" {
  5234. return nil
  5235. }
  5236. c.PageToken(x.NextPageToken)
  5237. }
  5238. }
  5239. // method id "drive.files.patch":
  5240. type FilesPatchCall struct {
  5241. s *Service
  5242. fileId string
  5243. file *File
  5244. urlParams_ gensupport.URLParams
  5245. ctx_ context.Context
  5246. }
  5247. // Patch: Updates file metadata and/or content. This method supports
  5248. // patch semantics.
  5249. func (r *FilesService) Patch(fileId string, file *File) *FilesPatchCall {
  5250. c := &FilesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5251. c.fileId = fileId
  5252. c.file = file
  5253. return c
  5254. }
  5255. // AddParents sets the optional parameter "addParents": Comma-separated
  5256. // list of parent IDs to add.
  5257. func (c *FilesPatchCall) AddParents(addParents string) *FilesPatchCall {
  5258. c.urlParams_.Set("addParents", addParents)
  5259. return c
  5260. }
  5261. // Convert sets the optional parameter "convert": This parameter is
  5262. // deprecated and has no function.
  5263. func (c *FilesPatchCall) Convert(convert bool) *FilesPatchCall {
  5264. c.urlParams_.Set("convert", fmt.Sprint(convert))
  5265. return c
  5266. }
  5267. // ModifiedDateBehavior sets the optional parameter
  5268. // "modifiedDateBehavior": Determines the behavior in which modifiedDate
  5269. // is updated. This overrides setModifiedDate.
  5270. //
  5271. // Possible values:
  5272. // "fromBody" - Set modifiedDate to the value provided in the body of
  5273. // the request. No change if no value was provided.
  5274. // "fromBodyIfNeeded" - Set modifiedDate to the value provided in the
  5275. // body of the request depending on other contents of the update.
  5276. // "fromBodyOrNow" - Set modifiedDate to the value provided in the
  5277. // body of the request, or to the current time if no value was provided.
  5278. // "noChange" - Maintain the previous value of modifiedDate.
  5279. // "now" - Set modifiedDate to the current time.
  5280. // "nowIfNeeded" - Set modifiedDate to the current time depending on
  5281. // contents of the update.
  5282. func (c *FilesPatchCall) ModifiedDateBehavior(modifiedDateBehavior string) *FilesPatchCall {
  5283. c.urlParams_.Set("modifiedDateBehavior", modifiedDateBehavior)
  5284. return c
  5285. }
  5286. // NewRevision sets the optional parameter "newRevision": Whether a blob
  5287. // upload should create a new revision. If false, the blob data in the
  5288. // current head revision is replaced. If true or not set, a new blob is
  5289. // created as head revision, and previous unpinned revisions are
  5290. // preserved for a short period of time. Pinned revisions are stored
  5291. // indefinitely, using additional storage quota, up to a maximum of 200
  5292. // revisions. For details on how revisions are retained, see the Drive
  5293. // Help Center.
  5294. func (c *FilesPatchCall) NewRevision(newRevision bool) *FilesPatchCall {
  5295. c.urlParams_.Set("newRevision", fmt.Sprint(newRevision))
  5296. return c
  5297. }
  5298. // Ocr sets the optional parameter "ocr": Whether to attempt OCR on
  5299. // .jpg, .png, .gif, or .pdf uploads.
  5300. func (c *FilesPatchCall) Ocr(ocr bool) *FilesPatchCall {
  5301. c.urlParams_.Set("ocr", fmt.Sprint(ocr))
  5302. return c
  5303. }
  5304. // OcrLanguage sets the optional parameter "ocrLanguage": If ocr is
  5305. // true, hints at the language to use. Valid values are BCP 47 codes.
  5306. func (c *FilesPatchCall) OcrLanguage(ocrLanguage string) *FilesPatchCall {
  5307. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  5308. return c
  5309. }
  5310. // Pinned sets the optional parameter "pinned": Whether to pin the new
  5311. // revision. A file can have a maximum of 200 pinned revisions.
  5312. func (c *FilesPatchCall) Pinned(pinned bool) *FilesPatchCall {
  5313. c.urlParams_.Set("pinned", fmt.Sprint(pinned))
  5314. return c
  5315. }
  5316. // RemoveParents sets the optional parameter "removeParents":
  5317. // Comma-separated list of parent IDs to remove.
  5318. func (c *FilesPatchCall) RemoveParents(removeParents string) *FilesPatchCall {
  5319. c.urlParams_.Set("removeParents", removeParents)
  5320. return c
  5321. }
  5322. // SetModifiedDate sets the optional parameter "setModifiedDate":
  5323. // Whether to set the modified date with the supplied modified date.
  5324. func (c *FilesPatchCall) SetModifiedDate(setModifiedDate bool) *FilesPatchCall {
  5325. c.urlParams_.Set("setModifiedDate", fmt.Sprint(setModifiedDate))
  5326. return c
  5327. }
  5328. // TimedTextLanguage sets the optional parameter "timedTextLanguage":
  5329. // The language of the timed text.
  5330. func (c *FilesPatchCall) TimedTextLanguage(timedTextLanguage string) *FilesPatchCall {
  5331. c.urlParams_.Set("timedTextLanguage", timedTextLanguage)
  5332. return c
  5333. }
  5334. // TimedTextTrackName sets the optional parameter "timedTextTrackName":
  5335. // The timed text track name.
  5336. func (c *FilesPatchCall) TimedTextTrackName(timedTextTrackName string) *FilesPatchCall {
  5337. c.urlParams_.Set("timedTextTrackName", timedTextTrackName)
  5338. return c
  5339. }
  5340. // UpdateViewedDate sets the optional parameter "updateViewedDate":
  5341. // Whether to update the view date after successfully updating the file.
  5342. func (c *FilesPatchCall) UpdateViewedDate(updateViewedDate bool) *FilesPatchCall {
  5343. c.urlParams_.Set("updateViewedDate", fmt.Sprint(updateViewedDate))
  5344. return c
  5345. }
  5346. // UseContentAsIndexableText sets the optional parameter
  5347. // "useContentAsIndexableText": Whether to use the content as indexable
  5348. // text.
  5349. func (c *FilesPatchCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesPatchCall {
  5350. c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText))
  5351. return c
  5352. }
  5353. // Fields allows partial responses to be retrieved. See
  5354. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5355. // for more information.
  5356. func (c *FilesPatchCall) Fields(s ...googleapi.Field) *FilesPatchCall {
  5357. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5358. return c
  5359. }
  5360. // Context sets the context to be used in this call's Do method. Any
  5361. // pending HTTP request will be aborted if the provided context is
  5362. // canceled.
  5363. func (c *FilesPatchCall) Context(ctx context.Context) *FilesPatchCall {
  5364. c.ctx_ = ctx
  5365. return c
  5366. }
  5367. func (c *FilesPatchCall) doRequest(alt string) (*http.Response, error) {
  5368. var body io.Reader = nil
  5369. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  5370. if err != nil {
  5371. return nil, err
  5372. }
  5373. ctype := "application/json"
  5374. c.urlParams_.Set("alt", alt)
  5375. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  5376. urls += "?" + c.urlParams_.Encode()
  5377. req, _ := http.NewRequest("PATCH", urls, body)
  5378. googleapi.Expand(req.URL, map[string]string{
  5379. "fileId": c.fileId,
  5380. })
  5381. req.Header.Set("Content-Type", ctype)
  5382. req.Header.Set("User-Agent", c.s.userAgent())
  5383. if c.ctx_ != nil {
  5384. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5385. }
  5386. return c.s.client.Do(req)
  5387. }
  5388. // Do executes the "drive.files.patch" call.
  5389. // Exactly one of *File or error will be non-nil. Any non-2xx status
  5390. // code is an error. Response headers are in either
  5391. // *File.ServerResponse.Header or (if a response was returned at all) in
  5392. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5393. // whether the returned error was because http.StatusNotModified was
  5394. // returned.
  5395. func (c *FilesPatchCall) Do(opts ...googleapi.CallOption) (*File, error) {
  5396. gensupport.SetOptions(c.urlParams_, opts...)
  5397. res, err := c.doRequest("json")
  5398. if res != nil && res.StatusCode == http.StatusNotModified {
  5399. if res.Body != nil {
  5400. res.Body.Close()
  5401. }
  5402. return nil, &googleapi.Error{
  5403. Code: res.StatusCode,
  5404. Header: res.Header,
  5405. }
  5406. }
  5407. if err != nil {
  5408. return nil, err
  5409. }
  5410. defer googleapi.CloseBody(res)
  5411. if err := googleapi.CheckResponse(res); err != nil {
  5412. return nil, err
  5413. }
  5414. ret := &File{
  5415. ServerResponse: googleapi.ServerResponse{
  5416. Header: res.Header,
  5417. HTTPStatusCode: res.StatusCode,
  5418. },
  5419. }
  5420. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5421. return nil, err
  5422. }
  5423. return ret, nil
  5424. // {
  5425. // "description": "Updates file metadata and/or content. This method supports patch semantics.",
  5426. // "httpMethod": "PATCH",
  5427. // "id": "drive.files.patch",
  5428. // "parameterOrder": [
  5429. // "fileId"
  5430. // ],
  5431. // "parameters": {
  5432. // "addParents": {
  5433. // "description": "Comma-separated list of parent IDs to add.",
  5434. // "location": "query",
  5435. // "type": "string"
  5436. // },
  5437. // "convert": {
  5438. // "default": "false",
  5439. // "description": "This parameter is deprecated and has no function.",
  5440. // "location": "query",
  5441. // "type": "boolean"
  5442. // },
  5443. // "fileId": {
  5444. // "description": "The ID of the file to update.",
  5445. // "location": "path",
  5446. // "required": true,
  5447. // "type": "string"
  5448. // },
  5449. // "modifiedDateBehavior": {
  5450. // "description": "Determines the behavior in which modifiedDate is updated. This overrides setModifiedDate.",
  5451. // "enum": [
  5452. // "fromBody",
  5453. // "fromBodyIfNeeded",
  5454. // "fromBodyOrNow",
  5455. // "noChange",
  5456. // "now",
  5457. // "nowIfNeeded"
  5458. // ],
  5459. // "enumDescriptions": [
  5460. // "Set modifiedDate to the value provided in the body of the request. No change if no value was provided.",
  5461. // "Set modifiedDate to the value provided in the body of the request depending on other contents of the update.",
  5462. // "Set modifiedDate to the value provided in the body of the request, or to the current time if no value was provided.",
  5463. // "Maintain the previous value of modifiedDate.",
  5464. // "Set modifiedDate to the current time.",
  5465. // "Set modifiedDate to the current time depending on contents of the update."
  5466. // ],
  5467. // "location": "query",
  5468. // "type": "string"
  5469. // },
  5470. // "newRevision": {
  5471. // "default": "true",
  5472. // "description": "Whether a blob upload should create a new revision. If false, the blob data in the current head revision is replaced. If true or not set, a new blob is created as head revision, and previous unpinned revisions are preserved for a short period of time. Pinned revisions are stored indefinitely, using additional storage quota, up to a maximum of 200 revisions. For details on how revisions are retained, see the Drive Help Center.",
  5473. // "location": "query",
  5474. // "type": "boolean"
  5475. // },
  5476. // "ocr": {
  5477. // "default": "false",
  5478. // "description": "Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.",
  5479. // "location": "query",
  5480. // "type": "boolean"
  5481. // },
  5482. // "ocrLanguage": {
  5483. // "description": "If ocr is true, hints at the language to use. Valid values are BCP 47 codes.",
  5484. // "location": "query",
  5485. // "type": "string"
  5486. // },
  5487. // "pinned": {
  5488. // "default": "false",
  5489. // "description": "Whether to pin the new revision. A file can have a maximum of 200 pinned revisions.",
  5490. // "location": "query",
  5491. // "type": "boolean"
  5492. // },
  5493. // "removeParents": {
  5494. // "description": "Comma-separated list of parent IDs to remove.",
  5495. // "location": "query",
  5496. // "type": "string"
  5497. // },
  5498. // "setModifiedDate": {
  5499. // "default": "false",
  5500. // "description": "Whether to set the modified date with the supplied modified date.",
  5501. // "location": "query",
  5502. // "type": "boolean"
  5503. // },
  5504. // "timedTextLanguage": {
  5505. // "description": "The language of the timed text.",
  5506. // "location": "query",
  5507. // "type": "string"
  5508. // },
  5509. // "timedTextTrackName": {
  5510. // "description": "The timed text track name.",
  5511. // "location": "query",
  5512. // "type": "string"
  5513. // },
  5514. // "updateViewedDate": {
  5515. // "default": "true",
  5516. // "description": "Whether to update the view date after successfully updating the file.",
  5517. // "location": "query",
  5518. // "type": "boolean"
  5519. // },
  5520. // "useContentAsIndexableText": {
  5521. // "default": "false",
  5522. // "description": "Whether to use the content as indexable text.",
  5523. // "location": "query",
  5524. // "type": "boolean"
  5525. // }
  5526. // },
  5527. // "path": "files/{fileId}",
  5528. // "request": {
  5529. // "$ref": "File"
  5530. // },
  5531. // "response": {
  5532. // "$ref": "File"
  5533. // },
  5534. // "scopes": [
  5535. // "https://www.googleapis.com/auth/drive",
  5536. // "https://www.googleapis.com/auth/drive.appdata",
  5537. // "https://www.googleapis.com/auth/drive.apps.readonly",
  5538. // "https://www.googleapis.com/auth/drive.file",
  5539. // "https://www.googleapis.com/auth/drive.metadata",
  5540. // "https://www.googleapis.com/auth/drive.scripts"
  5541. // ]
  5542. // }
  5543. }
  5544. // method id "drive.files.touch":
  5545. type FilesTouchCall struct {
  5546. s *Service
  5547. fileId string
  5548. urlParams_ gensupport.URLParams
  5549. ctx_ context.Context
  5550. }
  5551. // Touch: Set the file's updated time to the current server time.
  5552. func (r *FilesService) Touch(fileId string) *FilesTouchCall {
  5553. c := &FilesTouchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5554. c.fileId = fileId
  5555. return c
  5556. }
  5557. // Fields allows partial responses to be retrieved. See
  5558. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5559. // for more information.
  5560. func (c *FilesTouchCall) Fields(s ...googleapi.Field) *FilesTouchCall {
  5561. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5562. return c
  5563. }
  5564. // Context sets the context to be used in this call's Do method. Any
  5565. // pending HTTP request will be aborted if the provided context is
  5566. // canceled.
  5567. func (c *FilesTouchCall) Context(ctx context.Context) *FilesTouchCall {
  5568. c.ctx_ = ctx
  5569. return c
  5570. }
  5571. func (c *FilesTouchCall) doRequest(alt string) (*http.Response, error) {
  5572. var body io.Reader = nil
  5573. c.urlParams_.Set("alt", alt)
  5574. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/touch")
  5575. urls += "?" + c.urlParams_.Encode()
  5576. req, _ := http.NewRequest("POST", urls, body)
  5577. googleapi.Expand(req.URL, map[string]string{
  5578. "fileId": c.fileId,
  5579. })
  5580. req.Header.Set("User-Agent", c.s.userAgent())
  5581. if c.ctx_ != nil {
  5582. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5583. }
  5584. return c.s.client.Do(req)
  5585. }
  5586. // Do executes the "drive.files.touch" call.
  5587. // Exactly one of *File or error will be non-nil. Any non-2xx status
  5588. // code is an error. Response headers are in either
  5589. // *File.ServerResponse.Header or (if a response was returned at all) in
  5590. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5591. // whether the returned error was because http.StatusNotModified was
  5592. // returned.
  5593. func (c *FilesTouchCall) Do(opts ...googleapi.CallOption) (*File, error) {
  5594. gensupport.SetOptions(c.urlParams_, opts...)
  5595. res, err := c.doRequest("json")
  5596. if res != nil && res.StatusCode == http.StatusNotModified {
  5597. if res.Body != nil {
  5598. res.Body.Close()
  5599. }
  5600. return nil, &googleapi.Error{
  5601. Code: res.StatusCode,
  5602. Header: res.Header,
  5603. }
  5604. }
  5605. if err != nil {
  5606. return nil, err
  5607. }
  5608. defer googleapi.CloseBody(res)
  5609. if err := googleapi.CheckResponse(res); err != nil {
  5610. return nil, err
  5611. }
  5612. ret := &File{
  5613. ServerResponse: googleapi.ServerResponse{
  5614. Header: res.Header,
  5615. HTTPStatusCode: res.StatusCode,
  5616. },
  5617. }
  5618. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5619. return nil, err
  5620. }
  5621. return ret, nil
  5622. // {
  5623. // "description": "Set the file's updated time to the current server time.",
  5624. // "httpMethod": "POST",
  5625. // "id": "drive.files.touch",
  5626. // "parameterOrder": [
  5627. // "fileId"
  5628. // ],
  5629. // "parameters": {
  5630. // "fileId": {
  5631. // "description": "The ID of the file to update.",
  5632. // "location": "path",
  5633. // "required": true,
  5634. // "type": "string"
  5635. // }
  5636. // },
  5637. // "path": "files/{fileId}/touch",
  5638. // "response": {
  5639. // "$ref": "File"
  5640. // },
  5641. // "scopes": [
  5642. // "https://www.googleapis.com/auth/drive",
  5643. // "https://www.googleapis.com/auth/drive.appdata",
  5644. // "https://www.googleapis.com/auth/drive.apps.readonly",
  5645. // "https://www.googleapis.com/auth/drive.file",
  5646. // "https://www.googleapis.com/auth/drive.metadata"
  5647. // ]
  5648. // }
  5649. }
  5650. // method id "drive.files.trash":
  5651. type FilesTrashCall struct {
  5652. s *Service
  5653. fileId string
  5654. urlParams_ gensupport.URLParams
  5655. ctx_ context.Context
  5656. }
  5657. // Trash: Moves a file to the trash. The currently authenticated user
  5658. // must own the file.
  5659. func (r *FilesService) Trash(fileId string) *FilesTrashCall {
  5660. c := &FilesTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5661. c.fileId = fileId
  5662. return c
  5663. }
  5664. // Fields allows partial responses to be retrieved. See
  5665. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5666. // for more information.
  5667. func (c *FilesTrashCall) Fields(s ...googleapi.Field) *FilesTrashCall {
  5668. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5669. return c
  5670. }
  5671. // Context sets the context to be used in this call's Do method. Any
  5672. // pending HTTP request will be aborted if the provided context is
  5673. // canceled.
  5674. func (c *FilesTrashCall) Context(ctx context.Context) *FilesTrashCall {
  5675. c.ctx_ = ctx
  5676. return c
  5677. }
  5678. func (c *FilesTrashCall) doRequest(alt string) (*http.Response, error) {
  5679. var body io.Reader = nil
  5680. c.urlParams_.Set("alt", alt)
  5681. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/trash")
  5682. urls += "?" + c.urlParams_.Encode()
  5683. req, _ := http.NewRequest("POST", urls, body)
  5684. googleapi.Expand(req.URL, map[string]string{
  5685. "fileId": c.fileId,
  5686. })
  5687. req.Header.Set("User-Agent", c.s.userAgent())
  5688. if c.ctx_ != nil {
  5689. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5690. }
  5691. return c.s.client.Do(req)
  5692. }
  5693. // Do executes the "drive.files.trash" call.
  5694. // Exactly one of *File or error will be non-nil. Any non-2xx status
  5695. // code is an error. Response headers are in either
  5696. // *File.ServerResponse.Header or (if a response was returned at all) in
  5697. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5698. // whether the returned error was because http.StatusNotModified was
  5699. // returned.
  5700. func (c *FilesTrashCall) Do(opts ...googleapi.CallOption) (*File, error) {
  5701. gensupport.SetOptions(c.urlParams_, opts...)
  5702. res, err := c.doRequest("json")
  5703. if res != nil && res.StatusCode == http.StatusNotModified {
  5704. if res.Body != nil {
  5705. res.Body.Close()
  5706. }
  5707. return nil, &googleapi.Error{
  5708. Code: res.StatusCode,
  5709. Header: res.Header,
  5710. }
  5711. }
  5712. if err != nil {
  5713. return nil, err
  5714. }
  5715. defer googleapi.CloseBody(res)
  5716. if err := googleapi.CheckResponse(res); err != nil {
  5717. return nil, err
  5718. }
  5719. ret := &File{
  5720. ServerResponse: googleapi.ServerResponse{
  5721. Header: res.Header,
  5722. HTTPStatusCode: res.StatusCode,
  5723. },
  5724. }
  5725. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5726. return nil, err
  5727. }
  5728. return ret, nil
  5729. // {
  5730. // "description": "Moves a file to the trash. The currently authenticated user must own the file.",
  5731. // "httpMethod": "POST",
  5732. // "id": "drive.files.trash",
  5733. // "parameterOrder": [
  5734. // "fileId"
  5735. // ],
  5736. // "parameters": {
  5737. // "fileId": {
  5738. // "description": "The ID of the file to trash.",
  5739. // "location": "path",
  5740. // "required": true,
  5741. // "type": "string"
  5742. // }
  5743. // },
  5744. // "path": "files/{fileId}/trash",
  5745. // "response": {
  5746. // "$ref": "File"
  5747. // },
  5748. // "scopes": [
  5749. // "https://www.googleapis.com/auth/drive",
  5750. // "https://www.googleapis.com/auth/drive.appdata",
  5751. // "https://www.googleapis.com/auth/drive.apps.readonly",
  5752. // "https://www.googleapis.com/auth/drive.file"
  5753. // ]
  5754. // }
  5755. }
  5756. // method id "drive.files.untrash":
  5757. type FilesUntrashCall struct {
  5758. s *Service
  5759. fileId string
  5760. urlParams_ gensupport.URLParams
  5761. ctx_ context.Context
  5762. }
  5763. // Untrash: Restores a file from the trash.
  5764. func (r *FilesService) Untrash(fileId string) *FilesUntrashCall {
  5765. c := &FilesUntrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5766. c.fileId = fileId
  5767. return c
  5768. }
  5769. // Fields allows partial responses to be retrieved. See
  5770. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5771. // for more information.
  5772. func (c *FilesUntrashCall) Fields(s ...googleapi.Field) *FilesUntrashCall {
  5773. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5774. return c
  5775. }
  5776. // Context sets the context to be used in this call's Do method. Any
  5777. // pending HTTP request will be aborted if the provided context is
  5778. // canceled.
  5779. func (c *FilesUntrashCall) Context(ctx context.Context) *FilesUntrashCall {
  5780. c.ctx_ = ctx
  5781. return c
  5782. }
  5783. func (c *FilesUntrashCall) doRequest(alt string) (*http.Response, error) {
  5784. var body io.Reader = nil
  5785. c.urlParams_.Set("alt", alt)
  5786. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/untrash")
  5787. urls += "?" + c.urlParams_.Encode()
  5788. req, _ := http.NewRequest("POST", urls, body)
  5789. googleapi.Expand(req.URL, map[string]string{
  5790. "fileId": c.fileId,
  5791. })
  5792. req.Header.Set("User-Agent", c.s.userAgent())
  5793. if c.ctx_ != nil {
  5794. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5795. }
  5796. return c.s.client.Do(req)
  5797. }
  5798. // Do executes the "drive.files.untrash" call.
  5799. // Exactly one of *File or error will be non-nil. Any non-2xx status
  5800. // code is an error. Response headers are in either
  5801. // *File.ServerResponse.Header or (if a response was returned at all) in
  5802. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5803. // whether the returned error was because http.StatusNotModified was
  5804. // returned.
  5805. func (c *FilesUntrashCall) Do(opts ...googleapi.CallOption) (*File, error) {
  5806. gensupport.SetOptions(c.urlParams_, opts...)
  5807. res, err := c.doRequest("json")
  5808. if res != nil && res.StatusCode == http.StatusNotModified {
  5809. if res.Body != nil {
  5810. res.Body.Close()
  5811. }
  5812. return nil, &googleapi.Error{
  5813. Code: res.StatusCode,
  5814. Header: res.Header,
  5815. }
  5816. }
  5817. if err != nil {
  5818. return nil, err
  5819. }
  5820. defer googleapi.CloseBody(res)
  5821. if err := googleapi.CheckResponse(res); err != nil {
  5822. return nil, err
  5823. }
  5824. ret := &File{
  5825. ServerResponse: googleapi.ServerResponse{
  5826. Header: res.Header,
  5827. HTTPStatusCode: res.StatusCode,
  5828. },
  5829. }
  5830. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5831. return nil, err
  5832. }
  5833. return ret, nil
  5834. // {
  5835. // "description": "Restores a file from the trash.",
  5836. // "httpMethod": "POST",
  5837. // "id": "drive.files.untrash",
  5838. // "parameterOrder": [
  5839. // "fileId"
  5840. // ],
  5841. // "parameters": {
  5842. // "fileId": {
  5843. // "description": "The ID of the file to untrash.",
  5844. // "location": "path",
  5845. // "required": true,
  5846. // "type": "string"
  5847. // }
  5848. // },
  5849. // "path": "files/{fileId}/untrash",
  5850. // "response": {
  5851. // "$ref": "File"
  5852. // },
  5853. // "scopes": [
  5854. // "https://www.googleapis.com/auth/drive",
  5855. // "https://www.googleapis.com/auth/drive.appdata",
  5856. // "https://www.googleapis.com/auth/drive.apps.readonly",
  5857. // "https://www.googleapis.com/auth/drive.file"
  5858. // ]
  5859. // }
  5860. }
  5861. // method id "drive.files.update":
  5862. type FilesUpdateCall struct {
  5863. s *Service
  5864. fileId string
  5865. file *File
  5866. urlParams_ gensupport.URLParams
  5867. media_ io.Reader
  5868. resumableBuffer_ *gensupport.ResumableBuffer
  5869. mediaType_ string
  5870. mediaSize_ int64 // mediaSize, if known. Used only for calls to progressUpdater_.
  5871. progressUpdater_ googleapi.ProgressUpdater
  5872. ctx_ context.Context
  5873. }
  5874. // Update: Updates file metadata and/or content.
  5875. func (r *FilesService) Update(fileId string, file *File) *FilesUpdateCall {
  5876. c := &FilesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5877. c.fileId = fileId
  5878. c.file = file
  5879. return c
  5880. }
  5881. // AddParents sets the optional parameter "addParents": Comma-separated
  5882. // list of parent IDs to add.
  5883. func (c *FilesUpdateCall) AddParents(addParents string) *FilesUpdateCall {
  5884. c.urlParams_.Set("addParents", addParents)
  5885. return c
  5886. }
  5887. // Convert sets the optional parameter "convert": This parameter is
  5888. // deprecated and has no function.
  5889. func (c *FilesUpdateCall) Convert(convert bool) *FilesUpdateCall {
  5890. c.urlParams_.Set("convert", fmt.Sprint(convert))
  5891. return c
  5892. }
  5893. // ModifiedDateBehavior sets the optional parameter
  5894. // "modifiedDateBehavior": Determines the behavior in which modifiedDate
  5895. // is updated. This overrides setModifiedDate.
  5896. //
  5897. // Possible values:
  5898. // "fromBody" - Set modifiedDate to the value provided in the body of
  5899. // the request. No change if no value was provided.
  5900. // "fromBodyIfNeeded" - Set modifiedDate to the value provided in the
  5901. // body of the request depending on other contents of the update.
  5902. // "fromBodyOrNow" - Set modifiedDate to the value provided in the
  5903. // body of the request, or to the current time if no value was provided.
  5904. // "noChange" - Maintain the previous value of modifiedDate.
  5905. // "now" - Set modifiedDate to the current time.
  5906. // "nowIfNeeded" - Set modifiedDate to the current time depending on
  5907. // contents of the update.
  5908. func (c *FilesUpdateCall) ModifiedDateBehavior(modifiedDateBehavior string) *FilesUpdateCall {
  5909. c.urlParams_.Set("modifiedDateBehavior", modifiedDateBehavior)
  5910. return c
  5911. }
  5912. // NewRevision sets the optional parameter "newRevision": Whether a blob
  5913. // upload should create a new revision. If false, the blob data in the
  5914. // current head revision is replaced. If true or not set, a new blob is
  5915. // created as head revision, and previous unpinned revisions are
  5916. // preserved for a short period of time. Pinned revisions are stored
  5917. // indefinitely, using additional storage quota, up to a maximum of 200
  5918. // revisions. For details on how revisions are retained, see the Drive
  5919. // Help Center.
  5920. func (c *FilesUpdateCall) NewRevision(newRevision bool) *FilesUpdateCall {
  5921. c.urlParams_.Set("newRevision", fmt.Sprint(newRevision))
  5922. return c
  5923. }
  5924. // Ocr sets the optional parameter "ocr": Whether to attempt OCR on
  5925. // .jpg, .png, .gif, or .pdf uploads.
  5926. func (c *FilesUpdateCall) Ocr(ocr bool) *FilesUpdateCall {
  5927. c.urlParams_.Set("ocr", fmt.Sprint(ocr))
  5928. return c
  5929. }
  5930. // OcrLanguage sets the optional parameter "ocrLanguage": If ocr is
  5931. // true, hints at the language to use. Valid values are BCP 47 codes.
  5932. func (c *FilesUpdateCall) OcrLanguage(ocrLanguage string) *FilesUpdateCall {
  5933. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  5934. return c
  5935. }
  5936. // Pinned sets the optional parameter "pinned": Whether to pin the new
  5937. // revision. A file can have a maximum of 200 pinned revisions.
  5938. func (c *FilesUpdateCall) Pinned(pinned bool) *FilesUpdateCall {
  5939. c.urlParams_.Set("pinned", fmt.Sprint(pinned))
  5940. return c
  5941. }
  5942. // RemoveParents sets the optional parameter "removeParents":
  5943. // Comma-separated list of parent IDs to remove.
  5944. func (c *FilesUpdateCall) RemoveParents(removeParents string) *FilesUpdateCall {
  5945. c.urlParams_.Set("removeParents", removeParents)
  5946. return c
  5947. }
  5948. // SetModifiedDate sets the optional parameter "setModifiedDate":
  5949. // Whether to set the modified date with the supplied modified date.
  5950. func (c *FilesUpdateCall) SetModifiedDate(setModifiedDate bool) *FilesUpdateCall {
  5951. c.urlParams_.Set("setModifiedDate", fmt.Sprint(setModifiedDate))
  5952. return c
  5953. }
  5954. // TimedTextLanguage sets the optional parameter "timedTextLanguage":
  5955. // The language of the timed text.
  5956. func (c *FilesUpdateCall) TimedTextLanguage(timedTextLanguage string) *FilesUpdateCall {
  5957. c.urlParams_.Set("timedTextLanguage", timedTextLanguage)
  5958. return c
  5959. }
  5960. // TimedTextTrackName sets the optional parameter "timedTextTrackName":
  5961. // The timed text track name.
  5962. func (c *FilesUpdateCall) TimedTextTrackName(timedTextTrackName string) *FilesUpdateCall {
  5963. c.urlParams_.Set("timedTextTrackName", timedTextTrackName)
  5964. return c
  5965. }
  5966. // UpdateViewedDate sets the optional parameter "updateViewedDate":
  5967. // Whether to update the view date after successfully updating the file.
  5968. func (c *FilesUpdateCall) UpdateViewedDate(updateViewedDate bool) *FilesUpdateCall {
  5969. c.urlParams_.Set("updateViewedDate", fmt.Sprint(updateViewedDate))
  5970. return c
  5971. }
  5972. // UseContentAsIndexableText sets the optional parameter
  5973. // "useContentAsIndexableText": Whether to use the content as indexable
  5974. // text.
  5975. func (c *FilesUpdateCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesUpdateCall {
  5976. c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText))
  5977. return c
  5978. }
  5979. // Media specifies the media to upload in one or more chunks. The chunk
  5980. // size may be controlled by supplying a MediaOption generated by
  5981. // googleapi.ChunkSize. The chunk size defaults to
  5982. // googleapi.DefaultUploadChunkSize.
  5983. // At most one of Media and ResumableMedia may be set.
  5984. func (c *FilesUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *FilesUpdateCall {
  5985. opts := googleapi.ProcessMediaOptions(options)
  5986. chunkSize := opts.ChunkSize
  5987. r, c.mediaType_ = gensupport.DetermineContentType(r, opts.ContentType)
  5988. c.media_, c.resumableBuffer_ = gensupport.PrepareUpload(r, chunkSize)
  5989. return c
  5990. }
  5991. // ResumableMedia specifies the media to upload in chunks and can be
  5992. // canceled with ctx.
  5993. //
  5994. // Deprecated: use Media instead.
  5995. //
  5996. // At most one of Media and ResumableMedia may be set. mediaType
  5997. // identifies the MIME media type of the upload, such as "image/png". If
  5998. // mediaType is "", it will be auto-detected. The provided ctx will
  5999. // supersede any context previously provided to the Context method.
  6000. func (c *FilesUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesUpdateCall {
  6001. c.ctx_ = ctx
  6002. rdr := gensupport.ReaderAtToReader(r, size)
  6003. rdr, c.mediaType_ = gensupport.DetermineContentType(rdr, mediaType)
  6004. c.resumableBuffer_ = gensupport.NewResumableBuffer(rdr, googleapi.DefaultUploadChunkSize)
  6005. c.media_ = nil
  6006. c.mediaSize_ = size
  6007. return c
  6008. }
  6009. // ProgressUpdater provides a callback function that will be called
  6010. // after every chunk. It should be a low-latency function in order to
  6011. // not slow down the upload operation. This should only be called when
  6012. // using ResumableMedia (as opposed to Media).
  6013. func (c *FilesUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesUpdateCall {
  6014. c.progressUpdater_ = pu
  6015. return c
  6016. }
  6017. // Fields allows partial responses to be retrieved. See
  6018. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6019. // for more information.
  6020. func (c *FilesUpdateCall) Fields(s ...googleapi.Field) *FilesUpdateCall {
  6021. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6022. return c
  6023. }
  6024. // Context sets the context to be used in this call's Do method. Any
  6025. // pending HTTP request will be aborted if the provided context is
  6026. // canceled.
  6027. // This context will supersede any context previously provided to the
  6028. // ResumableMedia method.
  6029. func (c *FilesUpdateCall) Context(ctx context.Context) *FilesUpdateCall {
  6030. c.ctx_ = ctx
  6031. return c
  6032. }
  6033. func (c *FilesUpdateCall) doRequest(alt string) (*http.Response, error) {
  6034. var body io.Reader = nil
  6035. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  6036. if err != nil {
  6037. return nil, err
  6038. }
  6039. ctype := "application/json"
  6040. c.urlParams_.Set("alt", alt)
  6041. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  6042. if c.media_ != nil || c.resumableBuffer_ != nil {
  6043. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  6044. protocol := "multipart"
  6045. if c.resumableBuffer_ != nil {
  6046. protocol = "resumable"
  6047. }
  6048. c.urlParams_.Set("uploadType", protocol)
  6049. }
  6050. urls += "?" + c.urlParams_.Encode()
  6051. if c.media_ != nil {
  6052. var combined io.ReadCloser
  6053. combined, ctype = gensupport.CombineBodyMedia(body, ctype, c.media_, c.mediaType_)
  6054. defer combined.Close()
  6055. body = combined
  6056. }
  6057. req, _ := http.NewRequest("PUT", urls, body)
  6058. googleapi.Expand(req.URL, map[string]string{
  6059. "fileId": c.fileId,
  6060. })
  6061. if c.resumableBuffer_ != nil {
  6062. req.Header.Set("X-Upload-Content-Type", c.mediaType_)
  6063. }
  6064. req.Header.Set("Content-Type", ctype)
  6065. req.Header.Set("User-Agent", c.s.userAgent())
  6066. if c.ctx_ != nil {
  6067. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6068. }
  6069. return c.s.client.Do(req)
  6070. }
  6071. // Do executes the "drive.files.update" call.
  6072. // Exactly one of *File or error will be non-nil. Any non-2xx status
  6073. // code is an error. Response headers are in either
  6074. // *File.ServerResponse.Header or (if a response was returned at all) in
  6075. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6076. // whether the returned error was because http.StatusNotModified was
  6077. // returned.
  6078. func (c *FilesUpdateCall) Do(opts ...googleapi.CallOption) (*File, error) {
  6079. gensupport.SetOptions(c.urlParams_, opts...)
  6080. res, err := gensupport.Retry(c.ctx_, func() (*http.Response, error) {
  6081. return c.doRequest("json")
  6082. }, gensupport.DefaultBackoffStrategy())
  6083. if res != nil && res.StatusCode == http.StatusNotModified {
  6084. if res.Body != nil {
  6085. res.Body.Close()
  6086. }
  6087. return nil, &googleapi.Error{
  6088. Code: res.StatusCode,
  6089. Header: res.Header,
  6090. }
  6091. }
  6092. if err != nil {
  6093. return nil, err
  6094. }
  6095. defer googleapi.CloseBody(res)
  6096. if err := googleapi.CheckResponse(res); err != nil {
  6097. return nil, err
  6098. }
  6099. if c.resumableBuffer_ != nil {
  6100. loc := res.Header.Get("Location")
  6101. rx := &gensupport.ResumableUpload{
  6102. Client: c.s.client,
  6103. UserAgent: c.s.userAgent(),
  6104. URI: loc,
  6105. Media: c.resumableBuffer_,
  6106. MediaType: c.mediaType_,
  6107. Callback: func(curr int64) {
  6108. if c.progressUpdater_ != nil {
  6109. c.progressUpdater_(curr, c.mediaSize_)
  6110. }
  6111. },
  6112. }
  6113. ctx := c.ctx_
  6114. if ctx == nil {
  6115. ctx = context.TODO()
  6116. }
  6117. res, err = rx.Upload(ctx)
  6118. if err != nil {
  6119. return nil, err
  6120. }
  6121. defer res.Body.Close()
  6122. if err := googleapi.CheckResponse(res); err != nil {
  6123. return nil, err
  6124. }
  6125. }
  6126. ret := &File{
  6127. ServerResponse: googleapi.ServerResponse{
  6128. Header: res.Header,
  6129. HTTPStatusCode: res.StatusCode,
  6130. },
  6131. }
  6132. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6133. return nil, err
  6134. }
  6135. return ret, nil
  6136. // {
  6137. // "description": "Updates file metadata and/or content.",
  6138. // "httpMethod": "PUT",
  6139. // "id": "drive.files.update",
  6140. // "mediaUpload": {
  6141. // "accept": [
  6142. // "*/*"
  6143. // ],
  6144. // "maxSize": "5120GB",
  6145. // "protocols": {
  6146. // "resumable": {
  6147. // "multipart": true,
  6148. // "path": "/resumable/upload/drive/v2/files/{fileId}"
  6149. // },
  6150. // "simple": {
  6151. // "multipart": true,
  6152. // "path": "/upload/drive/v2/files/{fileId}"
  6153. // }
  6154. // }
  6155. // },
  6156. // "parameterOrder": [
  6157. // "fileId"
  6158. // ],
  6159. // "parameters": {
  6160. // "addParents": {
  6161. // "description": "Comma-separated list of parent IDs to add.",
  6162. // "location": "query",
  6163. // "type": "string"
  6164. // },
  6165. // "convert": {
  6166. // "default": "false",
  6167. // "description": "This parameter is deprecated and has no function.",
  6168. // "location": "query",
  6169. // "type": "boolean"
  6170. // },
  6171. // "fileId": {
  6172. // "description": "The ID of the file to update.",
  6173. // "location": "path",
  6174. // "required": true,
  6175. // "type": "string"
  6176. // },
  6177. // "modifiedDateBehavior": {
  6178. // "description": "Determines the behavior in which modifiedDate is updated. This overrides setModifiedDate.",
  6179. // "enum": [
  6180. // "fromBody",
  6181. // "fromBodyIfNeeded",
  6182. // "fromBodyOrNow",
  6183. // "noChange",
  6184. // "now",
  6185. // "nowIfNeeded"
  6186. // ],
  6187. // "enumDescriptions": [
  6188. // "Set modifiedDate to the value provided in the body of the request. No change if no value was provided.",
  6189. // "Set modifiedDate to the value provided in the body of the request depending on other contents of the update.",
  6190. // "Set modifiedDate to the value provided in the body of the request, or to the current time if no value was provided.",
  6191. // "Maintain the previous value of modifiedDate.",
  6192. // "Set modifiedDate to the current time.",
  6193. // "Set modifiedDate to the current time depending on contents of the update."
  6194. // ],
  6195. // "location": "query",
  6196. // "type": "string"
  6197. // },
  6198. // "newRevision": {
  6199. // "default": "true",
  6200. // "description": "Whether a blob upload should create a new revision. If false, the blob data in the current head revision is replaced. If true or not set, a new blob is created as head revision, and previous unpinned revisions are preserved for a short period of time. Pinned revisions are stored indefinitely, using additional storage quota, up to a maximum of 200 revisions. For details on how revisions are retained, see the Drive Help Center.",
  6201. // "location": "query",
  6202. // "type": "boolean"
  6203. // },
  6204. // "ocr": {
  6205. // "default": "false",
  6206. // "description": "Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.",
  6207. // "location": "query",
  6208. // "type": "boolean"
  6209. // },
  6210. // "ocrLanguage": {
  6211. // "description": "If ocr is true, hints at the language to use. Valid values are BCP 47 codes.",
  6212. // "location": "query",
  6213. // "type": "string"
  6214. // },
  6215. // "pinned": {
  6216. // "default": "false",
  6217. // "description": "Whether to pin the new revision. A file can have a maximum of 200 pinned revisions.",
  6218. // "location": "query",
  6219. // "type": "boolean"
  6220. // },
  6221. // "removeParents": {
  6222. // "description": "Comma-separated list of parent IDs to remove.",
  6223. // "location": "query",
  6224. // "type": "string"
  6225. // },
  6226. // "setModifiedDate": {
  6227. // "default": "false",
  6228. // "description": "Whether to set the modified date with the supplied modified date.",
  6229. // "location": "query",
  6230. // "type": "boolean"
  6231. // },
  6232. // "timedTextLanguage": {
  6233. // "description": "The language of the timed text.",
  6234. // "location": "query",
  6235. // "type": "string"
  6236. // },
  6237. // "timedTextTrackName": {
  6238. // "description": "The timed text track name.",
  6239. // "location": "query",
  6240. // "type": "string"
  6241. // },
  6242. // "updateViewedDate": {
  6243. // "default": "true",
  6244. // "description": "Whether to update the view date after successfully updating the file.",
  6245. // "location": "query",
  6246. // "type": "boolean"
  6247. // },
  6248. // "useContentAsIndexableText": {
  6249. // "default": "false",
  6250. // "description": "Whether to use the content as indexable text.",
  6251. // "location": "query",
  6252. // "type": "boolean"
  6253. // }
  6254. // },
  6255. // "path": "files/{fileId}",
  6256. // "request": {
  6257. // "$ref": "File"
  6258. // },
  6259. // "response": {
  6260. // "$ref": "File"
  6261. // },
  6262. // "scopes": [
  6263. // "https://www.googleapis.com/auth/drive",
  6264. // "https://www.googleapis.com/auth/drive.appdata",
  6265. // "https://www.googleapis.com/auth/drive.apps.readonly",
  6266. // "https://www.googleapis.com/auth/drive.file",
  6267. // "https://www.googleapis.com/auth/drive.metadata",
  6268. // "https://www.googleapis.com/auth/drive.scripts"
  6269. // ],
  6270. // "supportsMediaUpload": true
  6271. // }
  6272. }
  6273. // method id "drive.files.watch":
  6274. type FilesWatchCall struct {
  6275. s *Service
  6276. fileId string
  6277. channel *Channel
  6278. urlParams_ gensupport.URLParams
  6279. ctx_ context.Context
  6280. }
  6281. // Watch: Subscribe to changes on a file
  6282. func (r *FilesService) Watch(fileId string, channel *Channel) *FilesWatchCall {
  6283. c := &FilesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6284. c.fileId = fileId
  6285. c.channel = channel
  6286. return c
  6287. }
  6288. // AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse":
  6289. // Whether the user is acknowledging the risk of downloading known
  6290. // malware or other abusive files.
  6291. func (c *FilesWatchCall) AcknowledgeAbuse(acknowledgeAbuse bool) *FilesWatchCall {
  6292. c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse))
  6293. return c
  6294. }
  6295. // Projection sets the optional parameter "projection": This parameter
  6296. // is deprecated and has no function.
  6297. //
  6298. // Possible values:
  6299. // "BASIC" - Deprecated
  6300. // "FULL" - Deprecated
  6301. func (c *FilesWatchCall) Projection(projection string) *FilesWatchCall {
  6302. c.urlParams_.Set("projection", projection)
  6303. return c
  6304. }
  6305. // RevisionId sets the optional parameter "revisionId": Specifies the
  6306. // Revision ID that should be downloaded. Ignored unless alt=media is
  6307. // specified.
  6308. func (c *FilesWatchCall) RevisionId(revisionId string) *FilesWatchCall {
  6309. c.urlParams_.Set("revisionId", revisionId)
  6310. return c
  6311. }
  6312. // UpdateViewedDate sets the optional parameter "updateViewedDate":
  6313. // Deprecated: Use files.update with modifiedDateBehavior=noChange,
  6314. // updateViewedDate=true and an empty request body.
  6315. func (c *FilesWatchCall) UpdateViewedDate(updateViewedDate bool) *FilesWatchCall {
  6316. c.urlParams_.Set("updateViewedDate", fmt.Sprint(updateViewedDate))
  6317. return c
  6318. }
  6319. // Fields allows partial responses to be retrieved. See
  6320. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6321. // for more information.
  6322. func (c *FilesWatchCall) Fields(s ...googleapi.Field) *FilesWatchCall {
  6323. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6324. return c
  6325. }
  6326. // Context sets the context to be used in this call's Do and Download
  6327. // methods. Any pending HTTP request will be aborted if the provided
  6328. // context is canceled.
  6329. func (c *FilesWatchCall) Context(ctx context.Context) *FilesWatchCall {
  6330. c.ctx_ = ctx
  6331. return c
  6332. }
  6333. func (c *FilesWatchCall) doRequest(alt string) (*http.Response, error) {
  6334. var body io.Reader = nil
  6335. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  6336. if err != nil {
  6337. return nil, err
  6338. }
  6339. ctype := "application/json"
  6340. c.urlParams_.Set("alt", alt)
  6341. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/watch")
  6342. urls += "?" + c.urlParams_.Encode()
  6343. req, _ := http.NewRequest("POST", urls, body)
  6344. googleapi.Expand(req.URL, map[string]string{
  6345. "fileId": c.fileId,
  6346. })
  6347. req.Header.Set("Content-Type", ctype)
  6348. req.Header.Set("User-Agent", c.s.userAgent())
  6349. if c.ctx_ != nil {
  6350. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6351. }
  6352. return c.s.client.Do(req)
  6353. }
  6354. // Download fetches the API endpoint's "media" value, instead of the normal
  6355. // API response value. If the returned error is nil, the Response is guaranteed to
  6356. // have a 2xx status code. Callers must close the Response.Body as usual.
  6357. func (c *FilesWatchCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  6358. gensupport.SetOptions(c.urlParams_, opts...)
  6359. res, err := c.doRequest("media")
  6360. if err != nil {
  6361. return nil, err
  6362. }
  6363. if err := googleapi.CheckMediaResponse(res); err != nil {
  6364. res.Body.Close()
  6365. return nil, err
  6366. }
  6367. return res, nil
  6368. }
  6369. // Do executes the "drive.files.watch" call.
  6370. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  6371. // code is an error. Response headers are in either
  6372. // *Channel.ServerResponse.Header or (if a response was returned at all)
  6373. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6374. // check whether the returned error was because http.StatusNotModified
  6375. // was returned.
  6376. func (c *FilesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  6377. gensupport.SetOptions(c.urlParams_, opts...)
  6378. res, err := c.doRequest("json")
  6379. if res != nil && res.StatusCode == http.StatusNotModified {
  6380. if res.Body != nil {
  6381. res.Body.Close()
  6382. }
  6383. return nil, &googleapi.Error{
  6384. Code: res.StatusCode,
  6385. Header: res.Header,
  6386. }
  6387. }
  6388. if err != nil {
  6389. return nil, err
  6390. }
  6391. defer googleapi.CloseBody(res)
  6392. if err := googleapi.CheckResponse(res); err != nil {
  6393. return nil, err
  6394. }
  6395. ret := &Channel{
  6396. ServerResponse: googleapi.ServerResponse{
  6397. Header: res.Header,
  6398. HTTPStatusCode: res.StatusCode,
  6399. },
  6400. }
  6401. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6402. return nil, err
  6403. }
  6404. return ret, nil
  6405. // {
  6406. // "description": "Subscribe to changes on a file",
  6407. // "httpMethod": "POST",
  6408. // "id": "drive.files.watch",
  6409. // "parameterOrder": [
  6410. // "fileId"
  6411. // ],
  6412. // "parameters": {
  6413. // "acknowledgeAbuse": {
  6414. // "default": "false",
  6415. // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files.",
  6416. // "location": "query",
  6417. // "type": "boolean"
  6418. // },
  6419. // "fileId": {
  6420. // "description": "The ID for the file in question.",
  6421. // "location": "path",
  6422. // "required": true,
  6423. // "type": "string"
  6424. // },
  6425. // "projection": {
  6426. // "description": "This parameter is deprecated and has no function.",
  6427. // "enum": [
  6428. // "BASIC",
  6429. // "FULL"
  6430. // ],
  6431. // "enumDescriptions": [
  6432. // "Deprecated",
  6433. // "Deprecated"
  6434. // ],
  6435. // "location": "query",
  6436. // "type": "string"
  6437. // },
  6438. // "revisionId": {
  6439. // "description": "Specifies the Revision ID that should be downloaded. Ignored unless alt=media is specified.",
  6440. // "location": "query",
  6441. // "type": "string"
  6442. // },
  6443. // "updateViewedDate": {
  6444. // "default": "false",
  6445. // "description": "Deprecated: Use files.update with modifiedDateBehavior=noChange, updateViewedDate=true and an empty request body.",
  6446. // "location": "query",
  6447. // "type": "boolean"
  6448. // }
  6449. // },
  6450. // "path": "files/{fileId}/watch",
  6451. // "request": {
  6452. // "$ref": "Channel",
  6453. // "parameterName": "resource"
  6454. // },
  6455. // "response": {
  6456. // "$ref": "Channel"
  6457. // },
  6458. // "scopes": [
  6459. // "https://www.googleapis.com/auth/drive",
  6460. // "https://www.googleapis.com/auth/drive.appdata",
  6461. // "https://www.googleapis.com/auth/drive.apps.readonly",
  6462. // "https://www.googleapis.com/auth/drive.file",
  6463. // "https://www.googleapis.com/auth/drive.metadata",
  6464. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  6465. // "https://www.googleapis.com/auth/drive.photos.readonly",
  6466. // "https://www.googleapis.com/auth/drive.readonly"
  6467. // ],
  6468. // "supportsMediaDownload": true,
  6469. // "supportsSubscription": true,
  6470. // "useMediaDownloadService": true
  6471. // }
  6472. }
  6473. // method id "drive.parents.delete":
  6474. type ParentsDeleteCall struct {
  6475. s *Service
  6476. fileId string
  6477. parentId string
  6478. urlParams_ gensupport.URLParams
  6479. ctx_ context.Context
  6480. }
  6481. // Delete: Removes a parent from a file.
  6482. func (r *ParentsService) Delete(fileId string, parentId string) *ParentsDeleteCall {
  6483. c := &ParentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6484. c.fileId = fileId
  6485. c.parentId = parentId
  6486. return c
  6487. }
  6488. // Fields allows partial responses to be retrieved. See
  6489. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6490. // for more information.
  6491. func (c *ParentsDeleteCall) Fields(s ...googleapi.Field) *ParentsDeleteCall {
  6492. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6493. return c
  6494. }
  6495. // Context sets the context to be used in this call's Do method. Any
  6496. // pending HTTP request will be aborted if the provided context is
  6497. // canceled.
  6498. func (c *ParentsDeleteCall) Context(ctx context.Context) *ParentsDeleteCall {
  6499. c.ctx_ = ctx
  6500. return c
  6501. }
  6502. func (c *ParentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  6503. var body io.Reader = nil
  6504. c.urlParams_.Set("alt", alt)
  6505. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/parents/{parentId}")
  6506. urls += "?" + c.urlParams_.Encode()
  6507. req, _ := http.NewRequest("DELETE", urls, body)
  6508. googleapi.Expand(req.URL, map[string]string{
  6509. "fileId": c.fileId,
  6510. "parentId": c.parentId,
  6511. })
  6512. req.Header.Set("User-Agent", c.s.userAgent())
  6513. if c.ctx_ != nil {
  6514. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6515. }
  6516. return c.s.client.Do(req)
  6517. }
  6518. // Do executes the "drive.parents.delete" call.
  6519. func (c *ParentsDeleteCall) Do(opts ...googleapi.CallOption) error {
  6520. gensupport.SetOptions(c.urlParams_, opts...)
  6521. res, err := c.doRequest("json")
  6522. if err != nil {
  6523. return err
  6524. }
  6525. defer googleapi.CloseBody(res)
  6526. if err := googleapi.CheckResponse(res); err != nil {
  6527. return err
  6528. }
  6529. return nil
  6530. // {
  6531. // "description": "Removes a parent from a file.",
  6532. // "httpMethod": "DELETE",
  6533. // "id": "drive.parents.delete",
  6534. // "parameterOrder": [
  6535. // "fileId",
  6536. // "parentId"
  6537. // ],
  6538. // "parameters": {
  6539. // "fileId": {
  6540. // "description": "The ID of the file.",
  6541. // "location": "path",
  6542. // "required": true,
  6543. // "type": "string"
  6544. // },
  6545. // "parentId": {
  6546. // "description": "The ID of the parent.",
  6547. // "location": "path",
  6548. // "required": true,
  6549. // "type": "string"
  6550. // }
  6551. // },
  6552. // "path": "files/{fileId}/parents/{parentId}",
  6553. // "scopes": [
  6554. // "https://www.googleapis.com/auth/drive",
  6555. // "https://www.googleapis.com/auth/drive.file"
  6556. // ]
  6557. // }
  6558. }
  6559. // method id "drive.parents.get":
  6560. type ParentsGetCall struct {
  6561. s *Service
  6562. fileId string
  6563. parentId string
  6564. urlParams_ gensupport.URLParams
  6565. ifNoneMatch_ string
  6566. ctx_ context.Context
  6567. }
  6568. // Get: Gets a specific parent reference.
  6569. func (r *ParentsService) Get(fileId string, parentId string) *ParentsGetCall {
  6570. c := &ParentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6571. c.fileId = fileId
  6572. c.parentId = parentId
  6573. return c
  6574. }
  6575. // Fields allows partial responses to be retrieved. See
  6576. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6577. // for more information.
  6578. func (c *ParentsGetCall) Fields(s ...googleapi.Field) *ParentsGetCall {
  6579. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6580. return c
  6581. }
  6582. // IfNoneMatch sets the optional parameter which makes the operation
  6583. // fail if the object's ETag matches the given value. This is useful for
  6584. // getting updates only after the object has changed since the last
  6585. // request. Use googleapi.IsNotModified to check whether the response
  6586. // error from Do is the result of In-None-Match.
  6587. func (c *ParentsGetCall) IfNoneMatch(entityTag string) *ParentsGetCall {
  6588. c.ifNoneMatch_ = entityTag
  6589. return c
  6590. }
  6591. // Context sets the context to be used in this call's Do method. Any
  6592. // pending HTTP request will be aborted if the provided context is
  6593. // canceled.
  6594. func (c *ParentsGetCall) Context(ctx context.Context) *ParentsGetCall {
  6595. c.ctx_ = ctx
  6596. return c
  6597. }
  6598. func (c *ParentsGetCall) doRequest(alt string) (*http.Response, error) {
  6599. var body io.Reader = nil
  6600. c.urlParams_.Set("alt", alt)
  6601. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/parents/{parentId}")
  6602. urls += "?" + c.urlParams_.Encode()
  6603. req, _ := http.NewRequest("GET", urls, body)
  6604. googleapi.Expand(req.URL, map[string]string{
  6605. "fileId": c.fileId,
  6606. "parentId": c.parentId,
  6607. })
  6608. req.Header.Set("User-Agent", c.s.userAgent())
  6609. if c.ifNoneMatch_ != "" {
  6610. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  6611. }
  6612. if c.ctx_ != nil {
  6613. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6614. }
  6615. return c.s.client.Do(req)
  6616. }
  6617. // Do executes the "drive.parents.get" call.
  6618. // Exactly one of *ParentReference or error will be non-nil. Any non-2xx
  6619. // status code is an error. Response headers are in either
  6620. // *ParentReference.ServerResponse.Header or (if a response was returned
  6621. // at all) in error.(*googleapi.Error).Header. Use
  6622. // googleapi.IsNotModified to check whether the returned error was
  6623. // because http.StatusNotModified was returned.
  6624. func (c *ParentsGetCall) Do(opts ...googleapi.CallOption) (*ParentReference, error) {
  6625. gensupport.SetOptions(c.urlParams_, opts...)
  6626. res, err := c.doRequest("json")
  6627. if res != nil && res.StatusCode == http.StatusNotModified {
  6628. if res.Body != nil {
  6629. res.Body.Close()
  6630. }
  6631. return nil, &googleapi.Error{
  6632. Code: res.StatusCode,
  6633. Header: res.Header,
  6634. }
  6635. }
  6636. if err != nil {
  6637. return nil, err
  6638. }
  6639. defer googleapi.CloseBody(res)
  6640. if err := googleapi.CheckResponse(res); err != nil {
  6641. return nil, err
  6642. }
  6643. ret := &ParentReference{
  6644. ServerResponse: googleapi.ServerResponse{
  6645. Header: res.Header,
  6646. HTTPStatusCode: res.StatusCode,
  6647. },
  6648. }
  6649. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6650. return nil, err
  6651. }
  6652. return ret, nil
  6653. // {
  6654. // "description": "Gets a specific parent reference.",
  6655. // "httpMethod": "GET",
  6656. // "id": "drive.parents.get",
  6657. // "parameterOrder": [
  6658. // "fileId",
  6659. // "parentId"
  6660. // ],
  6661. // "parameters": {
  6662. // "fileId": {
  6663. // "description": "The ID of the file.",
  6664. // "location": "path",
  6665. // "required": true,
  6666. // "type": "string"
  6667. // },
  6668. // "parentId": {
  6669. // "description": "The ID of the parent.",
  6670. // "location": "path",
  6671. // "required": true,
  6672. // "type": "string"
  6673. // }
  6674. // },
  6675. // "path": "files/{fileId}/parents/{parentId}",
  6676. // "response": {
  6677. // "$ref": "ParentReference"
  6678. // },
  6679. // "scopes": [
  6680. // "https://www.googleapis.com/auth/drive",
  6681. // "https://www.googleapis.com/auth/drive.appdata",
  6682. // "https://www.googleapis.com/auth/drive.file",
  6683. // "https://www.googleapis.com/auth/drive.metadata",
  6684. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  6685. // "https://www.googleapis.com/auth/drive.photos.readonly",
  6686. // "https://www.googleapis.com/auth/drive.readonly"
  6687. // ]
  6688. // }
  6689. }
  6690. // method id "drive.parents.insert":
  6691. type ParentsInsertCall struct {
  6692. s *Service
  6693. fileId string
  6694. parentreference *ParentReference
  6695. urlParams_ gensupport.URLParams
  6696. ctx_ context.Context
  6697. }
  6698. // Insert: Adds a parent folder for a file.
  6699. func (r *ParentsService) Insert(fileId string, parentreference *ParentReference) *ParentsInsertCall {
  6700. c := &ParentsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6701. c.fileId = fileId
  6702. c.parentreference = parentreference
  6703. return c
  6704. }
  6705. // Fields allows partial responses to be retrieved. See
  6706. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6707. // for more information.
  6708. func (c *ParentsInsertCall) Fields(s ...googleapi.Field) *ParentsInsertCall {
  6709. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6710. return c
  6711. }
  6712. // Context sets the context to be used in this call's Do method. Any
  6713. // pending HTTP request will be aborted if the provided context is
  6714. // canceled.
  6715. func (c *ParentsInsertCall) Context(ctx context.Context) *ParentsInsertCall {
  6716. c.ctx_ = ctx
  6717. return c
  6718. }
  6719. func (c *ParentsInsertCall) doRequest(alt string) (*http.Response, error) {
  6720. var body io.Reader = nil
  6721. body, err := googleapi.WithoutDataWrapper.JSONReader(c.parentreference)
  6722. if err != nil {
  6723. return nil, err
  6724. }
  6725. ctype := "application/json"
  6726. c.urlParams_.Set("alt", alt)
  6727. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/parents")
  6728. urls += "?" + c.urlParams_.Encode()
  6729. req, _ := http.NewRequest("POST", urls, body)
  6730. googleapi.Expand(req.URL, map[string]string{
  6731. "fileId": c.fileId,
  6732. })
  6733. req.Header.Set("Content-Type", ctype)
  6734. req.Header.Set("User-Agent", c.s.userAgent())
  6735. if c.ctx_ != nil {
  6736. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6737. }
  6738. return c.s.client.Do(req)
  6739. }
  6740. // Do executes the "drive.parents.insert" call.
  6741. // Exactly one of *ParentReference or error will be non-nil. Any non-2xx
  6742. // status code is an error. Response headers are in either
  6743. // *ParentReference.ServerResponse.Header or (if a response was returned
  6744. // at all) in error.(*googleapi.Error).Header. Use
  6745. // googleapi.IsNotModified to check whether the returned error was
  6746. // because http.StatusNotModified was returned.
  6747. func (c *ParentsInsertCall) Do(opts ...googleapi.CallOption) (*ParentReference, error) {
  6748. gensupport.SetOptions(c.urlParams_, opts...)
  6749. res, err := c.doRequest("json")
  6750. if res != nil && res.StatusCode == http.StatusNotModified {
  6751. if res.Body != nil {
  6752. res.Body.Close()
  6753. }
  6754. return nil, &googleapi.Error{
  6755. Code: res.StatusCode,
  6756. Header: res.Header,
  6757. }
  6758. }
  6759. if err != nil {
  6760. return nil, err
  6761. }
  6762. defer googleapi.CloseBody(res)
  6763. if err := googleapi.CheckResponse(res); err != nil {
  6764. return nil, err
  6765. }
  6766. ret := &ParentReference{
  6767. ServerResponse: googleapi.ServerResponse{
  6768. Header: res.Header,
  6769. HTTPStatusCode: res.StatusCode,
  6770. },
  6771. }
  6772. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6773. return nil, err
  6774. }
  6775. return ret, nil
  6776. // {
  6777. // "description": "Adds a parent folder for a file.",
  6778. // "httpMethod": "POST",
  6779. // "id": "drive.parents.insert",
  6780. // "parameterOrder": [
  6781. // "fileId"
  6782. // ],
  6783. // "parameters": {
  6784. // "fileId": {
  6785. // "description": "The ID of the file.",
  6786. // "location": "path",
  6787. // "required": true,
  6788. // "type": "string"
  6789. // }
  6790. // },
  6791. // "path": "files/{fileId}/parents",
  6792. // "request": {
  6793. // "$ref": "ParentReference"
  6794. // },
  6795. // "response": {
  6796. // "$ref": "ParentReference"
  6797. // },
  6798. // "scopes": [
  6799. // "https://www.googleapis.com/auth/drive",
  6800. // "https://www.googleapis.com/auth/drive.appdata",
  6801. // "https://www.googleapis.com/auth/drive.file"
  6802. // ]
  6803. // }
  6804. }
  6805. // method id "drive.parents.list":
  6806. type ParentsListCall struct {
  6807. s *Service
  6808. fileId string
  6809. urlParams_ gensupport.URLParams
  6810. ifNoneMatch_ string
  6811. ctx_ context.Context
  6812. }
  6813. // List: Lists a file's parents.
  6814. func (r *ParentsService) List(fileId string) *ParentsListCall {
  6815. c := &ParentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6816. c.fileId = fileId
  6817. return c
  6818. }
  6819. // Fields allows partial responses to be retrieved. See
  6820. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6821. // for more information.
  6822. func (c *ParentsListCall) Fields(s ...googleapi.Field) *ParentsListCall {
  6823. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6824. return c
  6825. }
  6826. // IfNoneMatch sets the optional parameter which makes the operation
  6827. // fail if the object's ETag matches the given value. This is useful for
  6828. // getting updates only after the object has changed since the last
  6829. // request. Use googleapi.IsNotModified to check whether the response
  6830. // error from Do is the result of In-None-Match.
  6831. func (c *ParentsListCall) IfNoneMatch(entityTag string) *ParentsListCall {
  6832. c.ifNoneMatch_ = entityTag
  6833. return c
  6834. }
  6835. // Context sets the context to be used in this call's Do method. Any
  6836. // pending HTTP request will be aborted if the provided context is
  6837. // canceled.
  6838. func (c *ParentsListCall) Context(ctx context.Context) *ParentsListCall {
  6839. c.ctx_ = ctx
  6840. return c
  6841. }
  6842. func (c *ParentsListCall) doRequest(alt string) (*http.Response, error) {
  6843. var body io.Reader = nil
  6844. c.urlParams_.Set("alt", alt)
  6845. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/parents")
  6846. urls += "?" + c.urlParams_.Encode()
  6847. req, _ := http.NewRequest("GET", urls, body)
  6848. googleapi.Expand(req.URL, map[string]string{
  6849. "fileId": c.fileId,
  6850. })
  6851. req.Header.Set("User-Agent", c.s.userAgent())
  6852. if c.ifNoneMatch_ != "" {
  6853. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  6854. }
  6855. if c.ctx_ != nil {
  6856. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6857. }
  6858. return c.s.client.Do(req)
  6859. }
  6860. // Do executes the "drive.parents.list" call.
  6861. // Exactly one of *ParentList or error will be non-nil. Any non-2xx
  6862. // status code is an error. Response headers are in either
  6863. // *ParentList.ServerResponse.Header or (if a response was returned at
  6864. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6865. // to check whether the returned error was because
  6866. // http.StatusNotModified was returned.
  6867. func (c *ParentsListCall) Do(opts ...googleapi.CallOption) (*ParentList, error) {
  6868. gensupport.SetOptions(c.urlParams_, opts...)
  6869. res, err := c.doRequest("json")
  6870. if res != nil && res.StatusCode == http.StatusNotModified {
  6871. if res.Body != nil {
  6872. res.Body.Close()
  6873. }
  6874. return nil, &googleapi.Error{
  6875. Code: res.StatusCode,
  6876. Header: res.Header,
  6877. }
  6878. }
  6879. if err != nil {
  6880. return nil, err
  6881. }
  6882. defer googleapi.CloseBody(res)
  6883. if err := googleapi.CheckResponse(res); err != nil {
  6884. return nil, err
  6885. }
  6886. ret := &ParentList{
  6887. ServerResponse: googleapi.ServerResponse{
  6888. Header: res.Header,
  6889. HTTPStatusCode: res.StatusCode,
  6890. },
  6891. }
  6892. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6893. return nil, err
  6894. }
  6895. return ret, nil
  6896. // {
  6897. // "description": "Lists a file's parents.",
  6898. // "httpMethod": "GET",
  6899. // "id": "drive.parents.list",
  6900. // "parameterOrder": [
  6901. // "fileId"
  6902. // ],
  6903. // "parameters": {
  6904. // "fileId": {
  6905. // "description": "The ID of the file.",
  6906. // "location": "path",
  6907. // "required": true,
  6908. // "type": "string"
  6909. // }
  6910. // },
  6911. // "path": "files/{fileId}/parents",
  6912. // "response": {
  6913. // "$ref": "ParentList"
  6914. // },
  6915. // "scopes": [
  6916. // "https://www.googleapis.com/auth/drive",
  6917. // "https://www.googleapis.com/auth/drive.appdata",
  6918. // "https://www.googleapis.com/auth/drive.file",
  6919. // "https://www.googleapis.com/auth/drive.metadata",
  6920. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  6921. // "https://www.googleapis.com/auth/drive.photos.readonly",
  6922. // "https://www.googleapis.com/auth/drive.readonly"
  6923. // ]
  6924. // }
  6925. }
  6926. // method id "drive.permissions.delete":
  6927. type PermissionsDeleteCall struct {
  6928. s *Service
  6929. fileId string
  6930. permissionId string
  6931. urlParams_ gensupport.URLParams
  6932. ctx_ context.Context
  6933. }
  6934. // Delete: Deletes a permission from a file.
  6935. func (r *PermissionsService) Delete(fileId string, permissionId string) *PermissionsDeleteCall {
  6936. c := &PermissionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6937. c.fileId = fileId
  6938. c.permissionId = permissionId
  6939. return c
  6940. }
  6941. // Fields allows partial responses to be retrieved. See
  6942. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6943. // for more information.
  6944. func (c *PermissionsDeleteCall) Fields(s ...googleapi.Field) *PermissionsDeleteCall {
  6945. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6946. return c
  6947. }
  6948. // Context sets the context to be used in this call's Do method. Any
  6949. // pending HTTP request will be aborted if the provided context is
  6950. // canceled.
  6951. func (c *PermissionsDeleteCall) Context(ctx context.Context) *PermissionsDeleteCall {
  6952. c.ctx_ = ctx
  6953. return c
  6954. }
  6955. func (c *PermissionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  6956. var body io.Reader = nil
  6957. c.urlParams_.Set("alt", alt)
  6958. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  6959. urls += "?" + c.urlParams_.Encode()
  6960. req, _ := http.NewRequest("DELETE", urls, body)
  6961. googleapi.Expand(req.URL, map[string]string{
  6962. "fileId": c.fileId,
  6963. "permissionId": c.permissionId,
  6964. })
  6965. req.Header.Set("User-Agent", c.s.userAgent())
  6966. if c.ctx_ != nil {
  6967. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6968. }
  6969. return c.s.client.Do(req)
  6970. }
  6971. // Do executes the "drive.permissions.delete" call.
  6972. func (c *PermissionsDeleteCall) Do(opts ...googleapi.CallOption) error {
  6973. gensupport.SetOptions(c.urlParams_, opts...)
  6974. res, err := c.doRequest("json")
  6975. if err != nil {
  6976. return err
  6977. }
  6978. defer googleapi.CloseBody(res)
  6979. if err := googleapi.CheckResponse(res); err != nil {
  6980. return err
  6981. }
  6982. return nil
  6983. // {
  6984. // "description": "Deletes a permission from a file.",
  6985. // "httpMethod": "DELETE",
  6986. // "id": "drive.permissions.delete",
  6987. // "parameterOrder": [
  6988. // "fileId",
  6989. // "permissionId"
  6990. // ],
  6991. // "parameters": {
  6992. // "fileId": {
  6993. // "description": "The ID for the file.",
  6994. // "location": "path",
  6995. // "required": true,
  6996. // "type": "string"
  6997. // },
  6998. // "permissionId": {
  6999. // "description": "The ID for the permission.",
  7000. // "location": "path",
  7001. // "required": true,
  7002. // "type": "string"
  7003. // }
  7004. // },
  7005. // "path": "files/{fileId}/permissions/{permissionId}",
  7006. // "scopes": [
  7007. // "https://www.googleapis.com/auth/drive",
  7008. // "https://www.googleapis.com/auth/drive.file"
  7009. // ]
  7010. // }
  7011. }
  7012. // method id "drive.permissions.get":
  7013. type PermissionsGetCall struct {
  7014. s *Service
  7015. fileId string
  7016. permissionId string
  7017. urlParams_ gensupport.URLParams
  7018. ifNoneMatch_ string
  7019. ctx_ context.Context
  7020. }
  7021. // Get: Gets a permission by ID.
  7022. func (r *PermissionsService) Get(fileId string, permissionId string) *PermissionsGetCall {
  7023. c := &PermissionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7024. c.fileId = fileId
  7025. c.permissionId = permissionId
  7026. return c
  7027. }
  7028. // Fields allows partial responses to be retrieved. See
  7029. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7030. // for more information.
  7031. func (c *PermissionsGetCall) Fields(s ...googleapi.Field) *PermissionsGetCall {
  7032. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7033. return c
  7034. }
  7035. // IfNoneMatch sets the optional parameter which makes the operation
  7036. // fail if the object's ETag matches the given value. This is useful for
  7037. // getting updates only after the object has changed since the last
  7038. // request. Use googleapi.IsNotModified to check whether the response
  7039. // error from Do is the result of In-None-Match.
  7040. func (c *PermissionsGetCall) IfNoneMatch(entityTag string) *PermissionsGetCall {
  7041. c.ifNoneMatch_ = entityTag
  7042. return c
  7043. }
  7044. // Context sets the context to be used in this call's Do method. Any
  7045. // pending HTTP request will be aborted if the provided context is
  7046. // canceled.
  7047. func (c *PermissionsGetCall) Context(ctx context.Context) *PermissionsGetCall {
  7048. c.ctx_ = ctx
  7049. return c
  7050. }
  7051. func (c *PermissionsGetCall) doRequest(alt string) (*http.Response, error) {
  7052. var body io.Reader = nil
  7053. c.urlParams_.Set("alt", alt)
  7054. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  7055. urls += "?" + c.urlParams_.Encode()
  7056. req, _ := http.NewRequest("GET", urls, body)
  7057. googleapi.Expand(req.URL, map[string]string{
  7058. "fileId": c.fileId,
  7059. "permissionId": c.permissionId,
  7060. })
  7061. req.Header.Set("User-Agent", c.s.userAgent())
  7062. if c.ifNoneMatch_ != "" {
  7063. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  7064. }
  7065. if c.ctx_ != nil {
  7066. return ctxhttp.Do(c.ctx_, c.s.client, req)
  7067. }
  7068. return c.s.client.Do(req)
  7069. }
  7070. // Do executes the "drive.permissions.get" call.
  7071. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  7072. // status code is an error. Response headers are in either
  7073. // *Permission.ServerResponse.Header or (if a response was returned at
  7074. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7075. // to check whether the returned error was because
  7076. // http.StatusNotModified was returned.
  7077. func (c *PermissionsGetCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  7078. gensupport.SetOptions(c.urlParams_, opts...)
  7079. res, err := c.doRequest("json")
  7080. if res != nil && res.StatusCode == http.StatusNotModified {
  7081. if res.Body != nil {
  7082. res.Body.Close()
  7083. }
  7084. return nil, &googleapi.Error{
  7085. Code: res.StatusCode,
  7086. Header: res.Header,
  7087. }
  7088. }
  7089. if err != nil {
  7090. return nil, err
  7091. }
  7092. defer googleapi.CloseBody(res)
  7093. if err := googleapi.CheckResponse(res); err != nil {
  7094. return nil, err
  7095. }
  7096. ret := &Permission{
  7097. ServerResponse: googleapi.ServerResponse{
  7098. Header: res.Header,
  7099. HTTPStatusCode: res.StatusCode,
  7100. },
  7101. }
  7102. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  7103. return nil, err
  7104. }
  7105. return ret, nil
  7106. // {
  7107. // "description": "Gets a permission by ID.",
  7108. // "httpMethod": "GET",
  7109. // "id": "drive.permissions.get",
  7110. // "parameterOrder": [
  7111. // "fileId",
  7112. // "permissionId"
  7113. // ],
  7114. // "parameters": {
  7115. // "fileId": {
  7116. // "description": "The ID for the file.",
  7117. // "location": "path",
  7118. // "required": true,
  7119. // "type": "string"
  7120. // },
  7121. // "permissionId": {
  7122. // "description": "The ID for the permission.",
  7123. // "location": "path",
  7124. // "required": true,
  7125. // "type": "string"
  7126. // }
  7127. // },
  7128. // "path": "files/{fileId}/permissions/{permissionId}",
  7129. // "response": {
  7130. // "$ref": "Permission"
  7131. // },
  7132. // "scopes": [
  7133. // "https://www.googleapis.com/auth/drive",
  7134. // "https://www.googleapis.com/auth/drive.file",
  7135. // "https://www.googleapis.com/auth/drive.metadata",
  7136. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  7137. // "https://www.googleapis.com/auth/drive.photos.readonly",
  7138. // "https://www.googleapis.com/auth/drive.readonly"
  7139. // ]
  7140. // }
  7141. }
  7142. // method id "drive.permissions.getIdForEmail":
  7143. type PermissionsGetIdForEmailCall struct {
  7144. s *Service
  7145. email string
  7146. urlParams_ gensupport.URLParams
  7147. ifNoneMatch_ string
  7148. ctx_ context.Context
  7149. }
  7150. // GetIdForEmail: Returns the permission ID for an email address.
  7151. func (r *PermissionsService) GetIdForEmail(email string) *PermissionsGetIdForEmailCall {
  7152. c := &PermissionsGetIdForEmailCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7153. c.email = email
  7154. return c
  7155. }
  7156. // Fields allows partial responses to be retrieved. See
  7157. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7158. // for more information.
  7159. func (c *PermissionsGetIdForEmailCall) Fields(s ...googleapi.Field) *PermissionsGetIdForEmailCall {
  7160. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7161. return c
  7162. }
  7163. // IfNoneMatch sets the optional parameter which makes the operation
  7164. // fail if the object's ETag matches the given value. This is useful for
  7165. // getting updates only after the object has changed since the last
  7166. // request. Use googleapi.IsNotModified to check whether the response
  7167. // error from Do is the result of In-None-Match.
  7168. func (c *PermissionsGetIdForEmailCall) IfNoneMatch(entityTag string) *PermissionsGetIdForEmailCall {
  7169. c.ifNoneMatch_ = entityTag
  7170. return c
  7171. }
  7172. // Context sets the context to be used in this call's Do method. Any
  7173. // pending HTTP request will be aborted if the provided context is
  7174. // canceled.
  7175. func (c *PermissionsGetIdForEmailCall) Context(ctx context.Context) *PermissionsGetIdForEmailCall {
  7176. c.ctx_ = ctx
  7177. return c
  7178. }
  7179. func (c *PermissionsGetIdForEmailCall) doRequest(alt string) (*http.Response, error) {
  7180. var body io.Reader = nil
  7181. c.urlParams_.Set("alt", alt)
  7182. urls := googleapi.ResolveRelative(c.s.BasePath, "permissionIds/{email}")
  7183. urls += "?" + c.urlParams_.Encode()
  7184. req, _ := http.NewRequest("GET", urls, body)
  7185. googleapi.Expand(req.URL, map[string]string{
  7186. "email": c.email,
  7187. })
  7188. req.Header.Set("User-Agent", c.s.userAgent())
  7189. if c.ifNoneMatch_ != "" {
  7190. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  7191. }
  7192. if c.ctx_ != nil {
  7193. return ctxhttp.Do(c.ctx_, c.s.client, req)
  7194. }
  7195. return c.s.client.Do(req)
  7196. }
  7197. // Do executes the "drive.permissions.getIdForEmail" call.
  7198. // Exactly one of *PermissionId or error will be non-nil. Any non-2xx
  7199. // status code is an error. Response headers are in either
  7200. // *PermissionId.ServerResponse.Header or (if a response was returned at
  7201. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7202. // to check whether the returned error was because
  7203. // http.StatusNotModified was returned.
  7204. func (c *PermissionsGetIdForEmailCall) Do(opts ...googleapi.CallOption) (*PermissionId, error) {
  7205. gensupport.SetOptions(c.urlParams_, opts...)
  7206. res, err := c.doRequest("json")
  7207. if res != nil && res.StatusCode == http.StatusNotModified {
  7208. if res.Body != nil {
  7209. res.Body.Close()
  7210. }
  7211. return nil, &googleapi.Error{
  7212. Code: res.StatusCode,
  7213. Header: res.Header,
  7214. }
  7215. }
  7216. if err != nil {
  7217. return nil, err
  7218. }
  7219. defer googleapi.CloseBody(res)
  7220. if err := googleapi.CheckResponse(res); err != nil {
  7221. return nil, err
  7222. }
  7223. ret := &PermissionId{
  7224. ServerResponse: googleapi.ServerResponse{
  7225. Header: res.Header,
  7226. HTTPStatusCode: res.StatusCode,
  7227. },
  7228. }
  7229. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  7230. return nil, err
  7231. }
  7232. return ret, nil
  7233. // {
  7234. // "description": "Returns the permission ID for an email address.",
  7235. // "httpMethod": "GET",
  7236. // "id": "drive.permissions.getIdForEmail",
  7237. // "parameterOrder": [
  7238. // "email"
  7239. // ],
  7240. // "parameters": {
  7241. // "email": {
  7242. // "description": "The email address for which to return a permission ID",
  7243. // "location": "path",
  7244. // "required": true,
  7245. // "type": "string"
  7246. // }
  7247. // },
  7248. // "path": "permissionIds/{email}",
  7249. // "response": {
  7250. // "$ref": "PermissionId"
  7251. // },
  7252. // "scopes": [
  7253. // "https://www.googleapis.com/auth/drive",
  7254. // "https://www.googleapis.com/auth/drive.appdata",
  7255. // "https://www.googleapis.com/auth/drive.apps.readonly",
  7256. // "https://www.googleapis.com/auth/drive.file",
  7257. // "https://www.googleapis.com/auth/drive.metadata",
  7258. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  7259. // "https://www.googleapis.com/auth/drive.photos.readonly",
  7260. // "https://www.googleapis.com/auth/drive.readonly"
  7261. // ]
  7262. // }
  7263. }
  7264. // method id "drive.permissions.insert":
  7265. type PermissionsInsertCall struct {
  7266. s *Service
  7267. fileId string
  7268. permission *Permission
  7269. urlParams_ gensupport.URLParams
  7270. ctx_ context.Context
  7271. }
  7272. // Insert: Inserts a permission for a file.
  7273. func (r *PermissionsService) Insert(fileId string, permission *Permission) *PermissionsInsertCall {
  7274. c := &PermissionsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7275. c.fileId = fileId
  7276. c.permission = permission
  7277. return c
  7278. }
  7279. // EmailMessage sets the optional parameter "emailMessage": A custom
  7280. // message to include in notification emails.
  7281. func (c *PermissionsInsertCall) EmailMessage(emailMessage string) *PermissionsInsertCall {
  7282. c.urlParams_.Set("emailMessage", emailMessage)
  7283. return c
  7284. }
  7285. // SendNotificationEmails sets the optional parameter
  7286. // "sendNotificationEmails": Whether to send notification emails when
  7287. // sharing to users or groups. This parameter is ignored and an email is
  7288. // sent if the role is owner.
  7289. func (c *PermissionsInsertCall) SendNotificationEmails(sendNotificationEmails bool) *PermissionsInsertCall {
  7290. c.urlParams_.Set("sendNotificationEmails", fmt.Sprint(sendNotificationEmails))
  7291. return c
  7292. }
  7293. // Fields allows partial responses to be retrieved. See
  7294. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7295. // for more information.
  7296. func (c *PermissionsInsertCall) Fields(s ...googleapi.Field) *PermissionsInsertCall {
  7297. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7298. return c
  7299. }
  7300. // Context sets the context to be used in this call's Do method. Any
  7301. // pending HTTP request will be aborted if the provided context is
  7302. // canceled.
  7303. func (c *PermissionsInsertCall) Context(ctx context.Context) *PermissionsInsertCall {
  7304. c.ctx_ = ctx
  7305. return c
  7306. }
  7307. func (c *PermissionsInsertCall) doRequest(alt string) (*http.Response, error) {
  7308. var body io.Reader = nil
  7309. body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission)
  7310. if err != nil {
  7311. return nil, err
  7312. }
  7313. ctype := "application/json"
  7314. c.urlParams_.Set("alt", alt)
  7315. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions")
  7316. urls += "?" + c.urlParams_.Encode()
  7317. req, _ := http.NewRequest("POST", urls, body)
  7318. googleapi.Expand(req.URL, map[string]string{
  7319. "fileId": c.fileId,
  7320. })
  7321. req.Header.Set("Content-Type", ctype)
  7322. req.Header.Set("User-Agent", c.s.userAgent())
  7323. if c.ctx_ != nil {
  7324. return ctxhttp.Do(c.ctx_, c.s.client, req)
  7325. }
  7326. return c.s.client.Do(req)
  7327. }
  7328. // Do executes the "drive.permissions.insert" call.
  7329. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  7330. // status code is an error. Response headers are in either
  7331. // *Permission.ServerResponse.Header or (if a response was returned at
  7332. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7333. // to check whether the returned error was because
  7334. // http.StatusNotModified was returned.
  7335. func (c *PermissionsInsertCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  7336. gensupport.SetOptions(c.urlParams_, opts...)
  7337. res, err := c.doRequest("json")
  7338. if res != nil && res.StatusCode == http.StatusNotModified {
  7339. if res.Body != nil {
  7340. res.Body.Close()
  7341. }
  7342. return nil, &googleapi.Error{
  7343. Code: res.StatusCode,
  7344. Header: res.Header,
  7345. }
  7346. }
  7347. if err != nil {
  7348. return nil, err
  7349. }
  7350. defer googleapi.CloseBody(res)
  7351. if err := googleapi.CheckResponse(res); err != nil {
  7352. return nil, err
  7353. }
  7354. ret := &Permission{
  7355. ServerResponse: googleapi.ServerResponse{
  7356. Header: res.Header,
  7357. HTTPStatusCode: res.StatusCode,
  7358. },
  7359. }
  7360. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  7361. return nil, err
  7362. }
  7363. return ret, nil
  7364. // {
  7365. // "description": "Inserts a permission for a file.",
  7366. // "httpMethod": "POST",
  7367. // "id": "drive.permissions.insert",
  7368. // "parameterOrder": [
  7369. // "fileId"
  7370. // ],
  7371. // "parameters": {
  7372. // "emailMessage": {
  7373. // "description": "A custom message to include in notification emails.",
  7374. // "location": "query",
  7375. // "type": "string"
  7376. // },
  7377. // "fileId": {
  7378. // "description": "The ID for the file.",
  7379. // "location": "path",
  7380. // "required": true,
  7381. // "type": "string"
  7382. // },
  7383. // "sendNotificationEmails": {
  7384. // "default": "true",
  7385. // "description": "Whether to send notification emails when sharing to users or groups. This parameter is ignored and an email is sent if the role is owner.",
  7386. // "location": "query",
  7387. // "type": "boolean"
  7388. // }
  7389. // },
  7390. // "path": "files/{fileId}/permissions",
  7391. // "request": {
  7392. // "$ref": "Permission"
  7393. // },
  7394. // "response": {
  7395. // "$ref": "Permission"
  7396. // },
  7397. // "scopes": [
  7398. // "https://www.googleapis.com/auth/drive",
  7399. // "https://www.googleapis.com/auth/drive.file"
  7400. // ]
  7401. // }
  7402. }
  7403. // method id "drive.permissions.list":
  7404. type PermissionsListCall struct {
  7405. s *Service
  7406. fileId string
  7407. urlParams_ gensupport.URLParams
  7408. ifNoneMatch_ string
  7409. ctx_ context.Context
  7410. }
  7411. // List: Lists a file's permissions.
  7412. func (r *PermissionsService) List(fileId string) *PermissionsListCall {
  7413. c := &PermissionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7414. c.fileId = fileId
  7415. return c
  7416. }
  7417. // Fields allows partial responses to be retrieved. See
  7418. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7419. // for more information.
  7420. func (c *PermissionsListCall) Fields(s ...googleapi.Field) *PermissionsListCall {
  7421. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7422. return c
  7423. }
  7424. // IfNoneMatch sets the optional parameter which makes the operation
  7425. // fail if the object's ETag matches the given value. This is useful for
  7426. // getting updates only after the object has changed since the last
  7427. // request. Use googleapi.IsNotModified to check whether the response
  7428. // error from Do is the result of In-None-Match.
  7429. func (c *PermissionsListCall) IfNoneMatch(entityTag string) *PermissionsListCall {
  7430. c.ifNoneMatch_ = entityTag
  7431. return c
  7432. }
  7433. // Context sets the context to be used in this call's Do method. Any
  7434. // pending HTTP request will be aborted if the provided context is
  7435. // canceled.
  7436. func (c *PermissionsListCall) Context(ctx context.Context) *PermissionsListCall {
  7437. c.ctx_ = ctx
  7438. return c
  7439. }
  7440. func (c *PermissionsListCall) doRequest(alt string) (*http.Response, error) {
  7441. var body io.Reader = nil
  7442. c.urlParams_.Set("alt", alt)
  7443. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions")
  7444. urls += "?" + c.urlParams_.Encode()
  7445. req, _ := http.NewRequest("GET", urls, body)
  7446. googleapi.Expand(req.URL, map[string]string{
  7447. "fileId": c.fileId,
  7448. })
  7449. req.Header.Set("User-Agent", c.s.userAgent())
  7450. if c.ifNoneMatch_ != "" {
  7451. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  7452. }
  7453. if c.ctx_ != nil {
  7454. return ctxhttp.Do(c.ctx_, c.s.client, req)
  7455. }
  7456. return c.s.client.Do(req)
  7457. }
  7458. // Do executes the "drive.permissions.list" call.
  7459. // Exactly one of *PermissionList or error will be non-nil. Any non-2xx
  7460. // status code is an error. Response headers are in either
  7461. // *PermissionList.ServerResponse.Header or (if a response was returned
  7462. // at all) in error.(*googleapi.Error).Header. Use
  7463. // googleapi.IsNotModified to check whether the returned error was
  7464. // because http.StatusNotModified was returned.
  7465. func (c *PermissionsListCall) Do(opts ...googleapi.CallOption) (*PermissionList, error) {
  7466. gensupport.SetOptions(c.urlParams_, opts...)
  7467. res, err := c.doRequest("json")
  7468. if res != nil && res.StatusCode == http.StatusNotModified {
  7469. if res.Body != nil {
  7470. res.Body.Close()
  7471. }
  7472. return nil, &googleapi.Error{
  7473. Code: res.StatusCode,
  7474. Header: res.Header,
  7475. }
  7476. }
  7477. if err != nil {
  7478. return nil, err
  7479. }
  7480. defer googleapi.CloseBody(res)
  7481. if err := googleapi.CheckResponse(res); err != nil {
  7482. return nil, err
  7483. }
  7484. ret := &PermissionList{
  7485. ServerResponse: googleapi.ServerResponse{
  7486. Header: res.Header,
  7487. HTTPStatusCode: res.StatusCode,
  7488. },
  7489. }
  7490. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  7491. return nil, err
  7492. }
  7493. return ret, nil
  7494. // {
  7495. // "description": "Lists a file's permissions.",
  7496. // "httpMethod": "GET",
  7497. // "id": "drive.permissions.list",
  7498. // "parameterOrder": [
  7499. // "fileId"
  7500. // ],
  7501. // "parameters": {
  7502. // "fileId": {
  7503. // "description": "The ID for the file.",
  7504. // "location": "path",
  7505. // "required": true,
  7506. // "type": "string"
  7507. // }
  7508. // },
  7509. // "path": "files/{fileId}/permissions",
  7510. // "response": {
  7511. // "$ref": "PermissionList"
  7512. // },
  7513. // "scopes": [
  7514. // "https://www.googleapis.com/auth/drive",
  7515. // "https://www.googleapis.com/auth/drive.file",
  7516. // "https://www.googleapis.com/auth/drive.metadata",
  7517. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  7518. // "https://www.googleapis.com/auth/drive.photos.readonly",
  7519. // "https://www.googleapis.com/auth/drive.readonly"
  7520. // ]
  7521. // }
  7522. }
  7523. // method id "drive.permissions.patch":
  7524. type PermissionsPatchCall struct {
  7525. s *Service
  7526. fileId string
  7527. permissionId string
  7528. permission *Permission
  7529. urlParams_ gensupport.URLParams
  7530. ctx_ context.Context
  7531. }
  7532. // Patch: Updates a permission using patch semantics.
  7533. func (r *PermissionsService) Patch(fileId string, permissionId string, permission *Permission) *PermissionsPatchCall {
  7534. c := &PermissionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7535. c.fileId = fileId
  7536. c.permissionId = permissionId
  7537. c.permission = permission
  7538. return c
  7539. }
  7540. // TransferOwnership sets the optional parameter "transferOwnership":
  7541. // Whether changing a role to 'owner' downgrades the current owners to
  7542. // writers. Does nothing if the specified role is not 'owner'.
  7543. func (c *PermissionsPatchCall) TransferOwnership(transferOwnership bool) *PermissionsPatchCall {
  7544. c.urlParams_.Set("transferOwnership", fmt.Sprint(transferOwnership))
  7545. return c
  7546. }
  7547. // Fields allows partial responses to be retrieved. See
  7548. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7549. // for more information.
  7550. func (c *PermissionsPatchCall) Fields(s ...googleapi.Field) *PermissionsPatchCall {
  7551. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7552. return c
  7553. }
  7554. // Context sets the context to be used in this call's Do method. Any
  7555. // pending HTTP request will be aborted if the provided context is
  7556. // canceled.
  7557. func (c *PermissionsPatchCall) Context(ctx context.Context) *PermissionsPatchCall {
  7558. c.ctx_ = ctx
  7559. return c
  7560. }
  7561. func (c *PermissionsPatchCall) doRequest(alt string) (*http.Response, error) {
  7562. var body io.Reader = nil
  7563. body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission)
  7564. if err != nil {
  7565. return nil, err
  7566. }
  7567. ctype := "application/json"
  7568. c.urlParams_.Set("alt", alt)
  7569. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  7570. urls += "?" + c.urlParams_.Encode()
  7571. req, _ := http.NewRequest("PATCH", urls, body)
  7572. googleapi.Expand(req.URL, map[string]string{
  7573. "fileId": c.fileId,
  7574. "permissionId": c.permissionId,
  7575. })
  7576. req.Header.Set("Content-Type", ctype)
  7577. req.Header.Set("User-Agent", c.s.userAgent())
  7578. if c.ctx_ != nil {
  7579. return ctxhttp.Do(c.ctx_, c.s.client, req)
  7580. }
  7581. return c.s.client.Do(req)
  7582. }
  7583. // Do executes the "drive.permissions.patch" call.
  7584. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  7585. // status code is an error. Response headers are in either
  7586. // *Permission.ServerResponse.Header or (if a response was returned at
  7587. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7588. // to check whether the returned error was because
  7589. // http.StatusNotModified was returned.
  7590. func (c *PermissionsPatchCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  7591. gensupport.SetOptions(c.urlParams_, opts...)
  7592. res, err := c.doRequest("json")
  7593. if res != nil && res.StatusCode == http.StatusNotModified {
  7594. if res.Body != nil {
  7595. res.Body.Close()
  7596. }
  7597. return nil, &googleapi.Error{
  7598. Code: res.StatusCode,
  7599. Header: res.Header,
  7600. }
  7601. }
  7602. if err != nil {
  7603. return nil, err
  7604. }
  7605. defer googleapi.CloseBody(res)
  7606. if err := googleapi.CheckResponse(res); err != nil {
  7607. return nil, err
  7608. }
  7609. ret := &Permission{
  7610. ServerResponse: googleapi.ServerResponse{
  7611. Header: res.Header,
  7612. HTTPStatusCode: res.StatusCode,
  7613. },
  7614. }
  7615. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  7616. return nil, err
  7617. }
  7618. return ret, nil
  7619. // {
  7620. // "description": "Updates a permission using patch semantics.",
  7621. // "httpMethod": "PATCH",
  7622. // "id": "drive.permissions.patch",
  7623. // "parameterOrder": [
  7624. // "fileId",
  7625. // "permissionId"
  7626. // ],
  7627. // "parameters": {
  7628. // "fileId": {
  7629. // "description": "The ID for the file.",
  7630. // "location": "path",
  7631. // "required": true,
  7632. // "type": "string"
  7633. // },
  7634. // "permissionId": {
  7635. // "description": "The ID for the permission.",
  7636. // "location": "path",
  7637. // "required": true,
  7638. // "type": "string"
  7639. // },
  7640. // "transferOwnership": {
  7641. // "default": "false",
  7642. // "description": "Whether changing a role to 'owner' downgrades the current owners to writers. Does nothing if the specified role is not 'owner'.",
  7643. // "location": "query",
  7644. // "type": "boolean"
  7645. // }
  7646. // },
  7647. // "path": "files/{fileId}/permissions/{permissionId}",
  7648. // "request": {
  7649. // "$ref": "Permission"
  7650. // },
  7651. // "response": {
  7652. // "$ref": "Permission"
  7653. // },
  7654. // "scopes": [
  7655. // "https://www.googleapis.com/auth/drive",
  7656. // "https://www.googleapis.com/auth/drive.file"
  7657. // ]
  7658. // }
  7659. }
  7660. // method id "drive.permissions.update":
  7661. type PermissionsUpdateCall struct {
  7662. s *Service
  7663. fileId string
  7664. permissionId string
  7665. permission *Permission
  7666. urlParams_ gensupport.URLParams
  7667. ctx_ context.Context
  7668. }
  7669. // Update: Updates a permission.
  7670. func (r *PermissionsService) Update(fileId string, permissionId string, permission *Permission) *PermissionsUpdateCall {
  7671. c := &PermissionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7672. c.fileId = fileId
  7673. c.permissionId = permissionId
  7674. c.permission = permission
  7675. return c
  7676. }
  7677. // TransferOwnership sets the optional parameter "transferOwnership":
  7678. // Whether changing a role to 'owner' downgrades the current owners to
  7679. // writers. Does nothing if the specified role is not 'owner'.
  7680. func (c *PermissionsUpdateCall) TransferOwnership(transferOwnership bool) *PermissionsUpdateCall {
  7681. c.urlParams_.Set("transferOwnership", fmt.Sprint(transferOwnership))
  7682. return c
  7683. }
  7684. // Fields allows partial responses to be retrieved. See
  7685. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7686. // for more information.
  7687. func (c *PermissionsUpdateCall) Fields(s ...googleapi.Field) *PermissionsUpdateCall {
  7688. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7689. return c
  7690. }
  7691. // Context sets the context to be used in this call's Do method. Any
  7692. // pending HTTP request will be aborted if the provided context is
  7693. // canceled.
  7694. func (c *PermissionsUpdateCall) Context(ctx context.Context) *PermissionsUpdateCall {
  7695. c.ctx_ = ctx
  7696. return c
  7697. }
  7698. func (c *PermissionsUpdateCall) doRequest(alt string) (*http.Response, error) {
  7699. var body io.Reader = nil
  7700. body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission)
  7701. if err != nil {
  7702. return nil, err
  7703. }
  7704. ctype := "application/json"
  7705. c.urlParams_.Set("alt", alt)
  7706. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  7707. urls += "?" + c.urlParams_.Encode()
  7708. req, _ := http.NewRequest("PUT", urls, body)
  7709. googleapi.Expand(req.URL, map[string]string{
  7710. "fileId": c.fileId,
  7711. "permissionId": c.permissionId,
  7712. })
  7713. req.Header.Set("Content-Type", ctype)
  7714. req.Header.Set("User-Agent", c.s.userAgent())
  7715. if c.ctx_ != nil {
  7716. return ctxhttp.Do(c.ctx_, c.s.client, req)
  7717. }
  7718. return c.s.client.Do(req)
  7719. }
  7720. // Do executes the "drive.permissions.update" call.
  7721. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  7722. // status code is an error. Response headers are in either
  7723. // *Permission.ServerResponse.Header or (if a response was returned at
  7724. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7725. // to check whether the returned error was because
  7726. // http.StatusNotModified was returned.
  7727. func (c *PermissionsUpdateCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  7728. gensupport.SetOptions(c.urlParams_, opts...)
  7729. res, err := c.doRequest("json")
  7730. if res != nil && res.StatusCode == http.StatusNotModified {
  7731. if res.Body != nil {
  7732. res.Body.Close()
  7733. }
  7734. return nil, &googleapi.Error{
  7735. Code: res.StatusCode,
  7736. Header: res.Header,
  7737. }
  7738. }
  7739. if err != nil {
  7740. return nil, err
  7741. }
  7742. defer googleapi.CloseBody(res)
  7743. if err := googleapi.CheckResponse(res); err != nil {
  7744. return nil, err
  7745. }
  7746. ret := &Permission{
  7747. ServerResponse: googleapi.ServerResponse{
  7748. Header: res.Header,
  7749. HTTPStatusCode: res.StatusCode,
  7750. },
  7751. }
  7752. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  7753. return nil, err
  7754. }
  7755. return ret, nil
  7756. // {
  7757. // "description": "Updates a permission.",
  7758. // "httpMethod": "PUT",
  7759. // "id": "drive.permissions.update",
  7760. // "parameterOrder": [
  7761. // "fileId",
  7762. // "permissionId"
  7763. // ],
  7764. // "parameters": {
  7765. // "fileId": {
  7766. // "description": "The ID for the file.",
  7767. // "location": "path",
  7768. // "required": true,
  7769. // "type": "string"
  7770. // },
  7771. // "permissionId": {
  7772. // "description": "The ID for the permission.",
  7773. // "location": "path",
  7774. // "required": true,
  7775. // "type": "string"
  7776. // },
  7777. // "transferOwnership": {
  7778. // "default": "false",
  7779. // "description": "Whether changing a role to 'owner' downgrades the current owners to writers. Does nothing if the specified role is not 'owner'.",
  7780. // "location": "query",
  7781. // "type": "boolean"
  7782. // }
  7783. // },
  7784. // "path": "files/{fileId}/permissions/{permissionId}",
  7785. // "request": {
  7786. // "$ref": "Permission"
  7787. // },
  7788. // "response": {
  7789. // "$ref": "Permission"
  7790. // },
  7791. // "scopes": [
  7792. // "https://www.googleapis.com/auth/drive",
  7793. // "https://www.googleapis.com/auth/drive.file"
  7794. // ]
  7795. // }
  7796. }
  7797. // method id "drive.properties.delete":
  7798. type PropertiesDeleteCall struct {
  7799. s *Service
  7800. fileId string
  7801. propertyKey string
  7802. urlParams_ gensupport.URLParams
  7803. ctx_ context.Context
  7804. }
  7805. // Delete: Deletes a property.
  7806. func (r *PropertiesService) Delete(fileId string, propertyKey string) *PropertiesDeleteCall {
  7807. c := &PropertiesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7808. c.fileId = fileId
  7809. c.propertyKey = propertyKey
  7810. return c
  7811. }
  7812. // Visibility sets the optional parameter "visibility": The visibility
  7813. // of the property.
  7814. func (c *PropertiesDeleteCall) Visibility(visibility string) *PropertiesDeleteCall {
  7815. c.urlParams_.Set("visibility", visibility)
  7816. return c
  7817. }
  7818. // Fields allows partial responses to be retrieved. See
  7819. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7820. // for more information.
  7821. func (c *PropertiesDeleteCall) Fields(s ...googleapi.Field) *PropertiesDeleteCall {
  7822. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7823. return c
  7824. }
  7825. // Context sets the context to be used in this call's Do method. Any
  7826. // pending HTTP request will be aborted if the provided context is
  7827. // canceled.
  7828. func (c *PropertiesDeleteCall) Context(ctx context.Context) *PropertiesDeleteCall {
  7829. c.ctx_ = ctx
  7830. return c
  7831. }
  7832. func (c *PropertiesDeleteCall) doRequest(alt string) (*http.Response, error) {
  7833. var body io.Reader = nil
  7834. c.urlParams_.Set("alt", alt)
  7835. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties/{propertyKey}")
  7836. urls += "?" + c.urlParams_.Encode()
  7837. req, _ := http.NewRequest("DELETE", urls, body)
  7838. googleapi.Expand(req.URL, map[string]string{
  7839. "fileId": c.fileId,
  7840. "propertyKey": c.propertyKey,
  7841. })
  7842. req.Header.Set("User-Agent", c.s.userAgent())
  7843. if c.ctx_ != nil {
  7844. return ctxhttp.Do(c.ctx_, c.s.client, req)
  7845. }
  7846. return c.s.client.Do(req)
  7847. }
  7848. // Do executes the "drive.properties.delete" call.
  7849. func (c *PropertiesDeleteCall) Do(opts ...googleapi.CallOption) error {
  7850. gensupport.SetOptions(c.urlParams_, opts...)
  7851. res, err := c.doRequest("json")
  7852. if err != nil {
  7853. return err
  7854. }
  7855. defer googleapi.CloseBody(res)
  7856. if err := googleapi.CheckResponse(res); err != nil {
  7857. return err
  7858. }
  7859. return nil
  7860. // {
  7861. // "description": "Deletes a property.",
  7862. // "httpMethod": "DELETE",
  7863. // "id": "drive.properties.delete",
  7864. // "parameterOrder": [
  7865. // "fileId",
  7866. // "propertyKey"
  7867. // ],
  7868. // "parameters": {
  7869. // "fileId": {
  7870. // "description": "The ID of the file.",
  7871. // "location": "path",
  7872. // "required": true,
  7873. // "type": "string"
  7874. // },
  7875. // "propertyKey": {
  7876. // "description": "The key of the property.",
  7877. // "location": "path",
  7878. // "required": true,
  7879. // "type": "string"
  7880. // },
  7881. // "visibility": {
  7882. // "default": "private",
  7883. // "description": "The visibility of the property.",
  7884. // "location": "query",
  7885. // "type": "string"
  7886. // }
  7887. // },
  7888. // "path": "files/{fileId}/properties/{propertyKey}",
  7889. // "scopes": [
  7890. // "https://www.googleapis.com/auth/drive",
  7891. // "https://www.googleapis.com/auth/drive.appdata",
  7892. // "https://www.googleapis.com/auth/drive.file",
  7893. // "https://www.googleapis.com/auth/drive.metadata"
  7894. // ]
  7895. // }
  7896. }
  7897. // method id "drive.properties.get":
  7898. type PropertiesGetCall struct {
  7899. s *Service
  7900. fileId string
  7901. propertyKey string
  7902. urlParams_ gensupport.URLParams
  7903. ifNoneMatch_ string
  7904. ctx_ context.Context
  7905. }
  7906. // Get: Gets a property by its key.
  7907. func (r *PropertiesService) Get(fileId string, propertyKey string) *PropertiesGetCall {
  7908. c := &PropertiesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7909. c.fileId = fileId
  7910. c.propertyKey = propertyKey
  7911. return c
  7912. }
  7913. // Visibility sets the optional parameter "visibility": The visibility
  7914. // of the property.
  7915. func (c *PropertiesGetCall) Visibility(visibility string) *PropertiesGetCall {
  7916. c.urlParams_.Set("visibility", visibility)
  7917. return c
  7918. }
  7919. // Fields allows partial responses to be retrieved. See
  7920. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7921. // for more information.
  7922. func (c *PropertiesGetCall) Fields(s ...googleapi.Field) *PropertiesGetCall {
  7923. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7924. return c
  7925. }
  7926. // IfNoneMatch sets the optional parameter which makes the operation
  7927. // fail if the object's ETag matches the given value. This is useful for
  7928. // getting updates only after the object has changed since the last
  7929. // request. Use googleapi.IsNotModified to check whether the response
  7930. // error from Do is the result of In-None-Match.
  7931. func (c *PropertiesGetCall) IfNoneMatch(entityTag string) *PropertiesGetCall {
  7932. c.ifNoneMatch_ = entityTag
  7933. return c
  7934. }
  7935. // Context sets the context to be used in this call's Do method. Any
  7936. // pending HTTP request will be aborted if the provided context is
  7937. // canceled.
  7938. func (c *PropertiesGetCall) Context(ctx context.Context) *PropertiesGetCall {
  7939. c.ctx_ = ctx
  7940. return c
  7941. }
  7942. func (c *PropertiesGetCall) doRequest(alt string) (*http.Response, error) {
  7943. var body io.Reader = nil
  7944. c.urlParams_.Set("alt", alt)
  7945. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties/{propertyKey}")
  7946. urls += "?" + c.urlParams_.Encode()
  7947. req, _ := http.NewRequest("GET", urls, body)
  7948. googleapi.Expand(req.URL, map[string]string{
  7949. "fileId": c.fileId,
  7950. "propertyKey": c.propertyKey,
  7951. })
  7952. req.Header.Set("User-Agent", c.s.userAgent())
  7953. if c.ifNoneMatch_ != "" {
  7954. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  7955. }
  7956. if c.ctx_ != nil {
  7957. return ctxhttp.Do(c.ctx_, c.s.client, req)
  7958. }
  7959. return c.s.client.Do(req)
  7960. }
  7961. // Do executes the "drive.properties.get" call.
  7962. // Exactly one of *Property or error will be non-nil. Any non-2xx status
  7963. // code is an error. Response headers are in either
  7964. // *Property.ServerResponse.Header or (if a response was returned at
  7965. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7966. // to check whether the returned error was because
  7967. // http.StatusNotModified was returned.
  7968. func (c *PropertiesGetCall) Do(opts ...googleapi.CallOption) (*Property, error) {
  7969. gensupport.SetOptions(c.urlParams_, opts...)
  7970. res, err := c.doRequest("json")
  7971. if res != nil && res.StatusCode == http.StatusNotModified {
  7972. if res.Body != nil {
  7973. res.Body.Close()
  7974. }
  7975. return nil, &googleapi.Error{
  7976. Code: res.StatusCode,
  7977. Header: res.Header,
  7978. }
  7979. }
  7980. if err != nil {
  7981. return nil, err
  7982. }
  7983. defer googleapi.CloseBody(res)
  7984. if err := googleapi.CheckResponse(res); err != nil {
  7985. return nil, err
  7986. }
  7987. ret := &Property{
  7988. ServerResponse: googleapi.ServerResponse{
  7989. Header: res.Header,
  7990. HTTPStatusCode: res.StatusCode,
  7991. },
  7992. }
  7993. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  7994. return nil, err
  7995. }
  7996. return ret, nil
  7997. // {
  7998. // "description": "Gets a property by its key.",
  7999. // "httpMethod": "GET",
  8000. // "id": "drive.properties.get",
  8001. // "parameterOrder": [
  8002. // "fileId",
  8003. // "propertyKey"
  8004. // ],
  8005. // "parameters": {
  8006. // "fileId": {
  8007. // "description": "The ID of the file.",
  8008. // "location": "path",
  8009. // "required": true,
  8010. // "type": "string"
  8011. // },
  8012. // "propertyKey": {
  8013. // "description": "The key of the property.",
  8014. // "location": "path",
  8015. // "required": true,
  8016. // "type": "string"
  8017. // },
  8018. // "visibility": {
  8019. // "default": "private",
  8020. // "description": "The visibility of the property.",
  8021. // "location": "query",
  8022. // "type": "string"
  8023. // }
  8024. // },
  8025. // "path": "files/{fileId}/properties/{propertyKey}",
  8026. // "response": {
  8027. // "$ref": "Property"
  8028. // },
  8029. // "scopes": [
  8030. // "https://www.googleapis.com/auth/drive",
  8031. // "https://www.googleapis.com/auth/drive.appdata",
  8032. // "https://www.googleapis.com/auth/drive.file",
  8033. // "https://www.googleapis.com/auth/drive.metadata",
  8034. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  8035. // "https://www.googleapis.com/auth/drive.photos.readonly",
  8036. // "https://www.googleapis.com/auth/drive.readonly"
  8037. // ]
  8038. // }
  8039. }
  8040. // method id "drive.properties.insert":
  8041. type PropertiesInsertCall struct {
  8042. s *Service
  8043. fileId string
  8044. property *Property
  8045. urlParams_ gensupport.URLParams
  8046. ctx_ context.Context
  8047. }
  8048. // Insert: Adds a property to a file, or updates it if it already
  8049. // exists.
  8050. func (r *PropertiesService) Insert(fileId string, property *Property) *PropertiesInsertCall {
  8051. c := &PropertiesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8052. c.fileId = fileId
  8053. c.property = property
  8054. return c
  8055. }
  8056. // Fields allows partial responses to be retrieved. See
  8057. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8058. // for more information.
  8059. func (c *PropertiesInsertCall) Fields(s ...googleapi.Field) *PropertiesInsertCall {
  8060. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8061. return c
  8062. }
  8063. // Context sets the context to be used in this call's Do method. Any
  8064. // pending HTTP request will be aborted if the provided context is
  8065. // canceled.
  8066. func (c *PropertiesInsertCall) Context(ctx context.Context) *PropertiesInsertCall {
  8067. c.ctx_ = ctx
  8068. return c
  8069. }
  8070. func (c *PropertiesInsertCall) doRequest(alt string) (*http.Response, error) {
  8071. var body io.Reader = nil
  8072. body, err := googleapi.WithoutDataWrapper.JSONReader(c.property)
  8073. if err != nil {
  8074. return nil, err
  8075. }
  8076. ctype := "application/json"
  8077. c.urlParams_.Set("alt", alt)
  8078. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties")
  8079. urls += "?" + c.urlParams_.Encode()
  8080. req, _ := http.NewRequest("POST", urls, body)
  8081. googleapi.Expand(req.URL, map[string]string{
  8082. "fileId": c.fileId,
  8083. })
  8084. req.Header.Set("Content-Type", ctype)
  8085. req.Header.Set("User-Agent", c.s.userAgent())
  8086. if c.ctx_ != nil {
  8087. return ctxhttp.Do(c.ctx_, c.s.client, req)
  8088. }
  8089. return c.s.client.Do(req)
  8090. }
  8091. // Do executes the "drive.properties.insert" call.
  8092. // Exactly one of *Property or error will be non-nil. Any non-2xx status
  8093. // code is an error. Response headers are in either
  8094. // *Property.ServerResponse.Header or (if a response was returned at
  8095. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  8096. // to check whether the returned error was because
  8097. // http.StatusNotModified was returned.
  8098. func (c *PropertiesInsertCall) Do(opts ...googleapi.CallOption) (*Property, error) {
  8099. gensupport.SetOptions(c.urlParams_, opts...)
  8100. res, err := c.doRequest("json")
  8101. if res != nil && res.StatusCode == http.StatusNotModified {
  8102. if res.Body != nil {
  8103. res.Body.Close()
  8104. }
  8105. return nil, &googleapi.Error{
  8106. Code: res.StatusCode,
  8107. Header: res.Header,
  8108. }
  8109. }
  8110. if err != nil {
  8111. return nil, err
  8112. }
  8113. defer googleapi.CloseBody(res)
  8114. if err := googleapi.CheckResponse(res); err != nil {
  8115. return nil, err
  8116. }
  8117. ret := &Property{
  8118. ServerResponse: googleapi.ServerResponse{
  8119. Header: res.Header,
  8120. HTTPStatusCode: res.StatusCode,
  8121. },
  8122. }
  8123. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  8124. return nil, err
  8125. }
  8126. return ret, nil
  8127. // {
  8128. // "description": "Adds a property to a file, or updates it if it already exists.",
  8129. // "httpMethod": "POST",
  8130. // "id": "drive.properties.insert",
  8131. // "parameterOrder": [
  8132. // "fileId"
  8133. // ],
  8134. // "parameters": {
  8135. // "fileId": {
  8136. // "description": "The ID of the file.",
  8137. // "location": "path",
  8138. // "required": true,
  8139. // "type": "string"
  8140. // }
  8141. // },
  8142. // "path": "files/{fileId}/properties",
  8143. // "request": {
  8144. // "$ref": "Property"
  8145. // },
  8146. // "response": {
  8147. // "$ref": "Property"
  8148. // },
  8149. // "scopes": [
  8150. // "https://www.googleapis.com/auth/drive",
  8151. // "https://www.googleapis.com/auth/drive.appdata",
  8152. // "https://www.googleapis.com/auth/drive.file",
  8153. // "https://www.googleapis.com/auth/drive.metadata"
  8154. // ]
  8155. // }
  8156. }
  8157. // method id "drive.properties.list":
  8158. type PropertiesListCall struct {
  8159. s *Service
  8160. fileId string
  8161. urlParams_ gensupport.URLParams
  8162. ifNoneMatch_ string
  8163. ctx_ context.Context
  8164. }
  8165. // List: Lists a file's properties.
  8166. func (r *PropertiesService) List(fileId string) *PropertiesListCall {
  8167. c := &PropertiesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8168. c.fileId = fileId
  8169. return c
  8170. }
  8171. // Fields allows partial responses to be retrieved. See
  8172. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8173. // for more information.
  8174. func (c *PropertiesListCall) Fields(s ...googleapi.Field) *PropertiesListCall {
  8175. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8176. return c
  8177. }
  8178. // IfNoneMatch sets the optional parameter which makes the operation
  8179. // fail if the object's ETag matches the given value. This is useful for
  8180. // getting updates only after the object has changed since the last
  8181. // request. Use googleapi.IsNotModified to check whether the response
  8182. // error from Do is the result of In-None-Match.
  8183. func (c *PropertiesListCall) IfNoneMatch(entityTag string) *PropertiesListCall {
  8184. c.ifNoneMatch_ = entityTag
  8185. return c
  8186. }
  8187. // Context sets the context to be used in this call's Do method. Any
  8188. // pending HTTP request will be aborted if the provided context is
  8189. // canceled.
  8190. func (c *PropertiesListCall) Context(ctx context.Context) *PropertiesListCall {
  8191. c.ctx_ = ctx
  8192. return c
  8193. }
  8194. func (c *PropertiesListCall) doRequest(alt string) (*http.Response, error) {
  8195. var body io.Reader = nil
  8196. c.urlParams_.Set("alt", alt)
  8197. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties")
  8198. urls += "?" + c.urlParams_.Encode()
  8199. req, _ := http.NewRequest("GET", urls, body)
  8200. googleapi.Expand(req.URL, map[string]string{
  8201. "fileId": c.fileId,
  8202. })
  8203. req.Header.Set("User-Agent", c.s.userAgent())
  8204. if c.ifNoneMatch_ != "" {
  8205. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  8206. }
  8207. if c.ctx_ != nil {
  8208. return ctxhttp.Do(c.ctx_, c.s.client, req)
  8209. }
  8210. return c.s.client.Do(req)
  8211. }
  8212. // Do executes the "drive.properties.list" call.
  8213. // Exactly one of *PropertyList or error will be non-nil. Any non-2xx
  8214. // status code is an error. Response headers are in either
  8215. // *PropertyList.ServerResponse.Header or (if a response was returned at
  8216. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  8217. // to check whether the returned error was because
  8218. // http.StatusNotModified was returned.
  8219. func (c *PropertiesListCall) Do(opts ...googleapi.CallOption) (*PropertyList, error) {
  8220. gensupport.SetOptions(c.urlParams_, opts...)
  8221. res, err := c.doRequest("json")
  8222. if res != nil && res.StatusCode == http.StatusNotModified {
  8223. if res.Body != nil {
  8224. res.Body.Close()
  8225. }
  8226. return nil, &googleapi.Error{
  8227. Code: res.StatusCode,
  8228. Header: res.Header,
  8229. }
  8230. }
  8231. if err != nil {
  8232. return nil, err
  8233. }
  8234. defer googleapi.CloseBody(res)
  8235. if err := googleapi.CheckResponse(res); err != nil {
  8236. return nil, err
  8237. }
  8238. ret := &PropertyList{
  8239. ServerResponse: googleapi.ServerResponse{
  8240. Header: res.Header,
  8241. HTTPStatusCode: res.StatusCode,
  8242. },
  8243. }
  8244. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  8245. return nil, err
  8246. }
  8247. return ret, nil
  8248. // {
  8249. // "description": "Lists a file's properties.",
  8250. // "httpMethod": "GET",
  8251. // "id": "drive.properties.list",
  8252. // "parameterOrder": [
  8253. // "fileId"
  8254. // ],
  8255. // "parameters": {
  8256. // "fileId": {
  8257. // "description": "The ID of the file.",
  8258. // "location": "path",
  8259. // "required": true,
  8260. // "type": "string"
  8261. // }
  8262. // },
  8263. // "path": "files/{fileId}/properties",
  8264. // "response": {
  8265. // "$ref": "PropertyList"
  8266. // },
  8267. // "scopes": [
  8268. // "https://www.googleapis.com/auth/drive",
  8269. // "https://www.googleapis.com/auth/drive.appdata",
  8270. // "https://www.googleapis.com/auth/drive.file",
  8271. // "https://www.googleapis.com/auth/drive.metadata",
  8272. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  8273. // "https://www.googleapis.com/auth/drive.photos.readonly",
  8274. // "https://www.googleapis.com/auth/drive.readonly"
  8275. // ]
  8276. // }
  8277. }
  8278. // method id "drive.properties.patch":
  8279. type PropertiesPatchCall struct {
  8280. s *Service
  8281. fileId string
  8282. propertyKey string
  8283. property *Property
  8284. urlParams_ gensupport.URLParams
  8285. ctx_ context.Context
  8286. }
  8287. // Patch: Updates a property, or adds it if it doesn't exist. This
  8288. // method supports patch semantics.
  8289. func (r *PropertiesService) Patch(fileId string, propertyKey string, property *Property) *PropertiesPatchCall {
  8290. c := &PropertiesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8291. c.fileId = fileId
  8292. c.propertyKey = propertyKey
  8293. c.property = property
  8294. return c
  8295. }
  8296. // Visibility sets the optional parameter "visibility": The visibility
  8297. // of the property.
  8298. func (c *PropertiesPatchCall) Visibility(visibility string) *PropertiesPatchCall {
  8299. c.urlParams_.Set("visibility", visibility)
  8300. return c
  8301. }
  8302. // Fields allows partial responses to be retrieved. See
  8303. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8304. // for more information.
  8305. func (c *PropertiesPatchCall) Fields(s ...googleapi.Field) *PropertiesPatchCall {
  8306. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8307. return c
  8308. }
  8309. // Context sets the context to be used in this call's Do method. Any
  8310. // pending HTTP request will be aborted if the provided context is
  8311. // canceled.
  8312. func (c *PropertiesPatchCall) Context(ctx context.Context) *PropertiesPatchCall {
  8313. c.ctx_ = ctx
  8314. return c
  8315. }
  8316. func (c *PropertiesPatchCall) doRequest(alt string) (*http.Response, error) {
  8317. var body io.Reader = nil
  8318. body, err := googleapi.WithoutDataWrapper.JSONReader(c.property)
  8319. if err != nil {
  8320. return nil, err
  8321. }
  8322. ctype := "application/json"
  8323. c.urlParams_.Set("alt", alt)
  8324. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties/{propertyKey}")
  8325. urls += "?" + c.urlParams_.Encode()
  8326. req, _ := http.NewRequest("PATCH", urls, body)
  8327. googleapi.Expand(req.URL, map[string]string{
  8328. "fileId": c.fileId,
  8329. "propertyKey": c.propertyKey,
  8330. })
  8331. req.Header.Set("Content-Type", ctype)
  8332. req.Header.Set("User-Agent", c.s.userAgent())
  8333. if c.ctx_ != nil {
  8334. return ctxhttp.Do(c.ctx_, c.s.client, req)
  8335. }
  8336. return c.s.client.Do(req)
  8337. }
  8338. // Do executes the "drive.properties.patch" call.
  8339. // Exactly one of *Property or error will be non-nil. Any non-2xx status
  8340. // code is an error. Response headers are in either
  8341. // *Property.ServerResponse.Header or (if a response was returned at
  8342. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  8343. // to check whether the returned error was because
  8344. // http.StatusNotModified was returned.
  8345. func (c *PropertiesPatchCall) Do(opts ...googleapi.CallOption) (*Property, error) {
  8346. gensupport.SetOptions(c.urlParams_, opts...)
  8347. res, err := c.doRequest("json")
  8348. if res != nil && res.StatusCode == http.StatusNotModified {
  8349. if res.Body != nil {
  8350. res.Body.Close()
  8351. }
  8352. return nil, &googleapi.Error{
  8353. Code: res.StatusCode,
  8354. Header: res.Header,
  8355. }
  8356. }
  8357. if err != nil {
  8358. return nil, err
  8359. }
  8360. defer googleapi.CloseBody(res)
  8361. if err := googleapi.CheckResponse(res); err != nil {
  8362. return nil, err
  8363. }
  8364. ret := &Property{
  8365. ServerResponse: googleapi.ServerResponse{
  8366. Header: res.Header,
  8367. HTTPStatusCode: res.StatusCode,
  8368. },
  8369. }
  8370. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  8371. return nil, err
  8372. }
  8373. return ret, nil
  8374. // {
  8375. // "description": "Updates a property, or adds it if it doesn't exist. This method supports patch semantics.",
  8376. // "httpMethod": "PATCH",
  8377. // "id": "drive.properties.patch",
  8378. // "parameterOrder": [
  8379. // "fileId",
  8380. // "propertyKey"
  8381. // ],
  8382. // "parameters": {
  8383. // "fileId": {
  8384. // "description": "The ID of the file.",
  8385. // "location": "path",
  8386. // "required": true,
  8387. // "type": "string"
  8388. // },
  8389. // "propertyKey": {
  8390. // "description": "The key of the property.",
  8391. // "location": "path",
  8392. // "required": true,
  8393. // "type": "string"
  8394. // },
  8395. // "visibility": {
  8396. // "default": "private",
  8397. // "description": "The visibility of the property.",
  8398. // "location": "query",
  8399. // "type": "string"
  8400. // }
  8401. // },
  8402. // "path": "files/{fileId}/properties/{propertyKey}",
  8403. // "request": {
  8404. // "$ref": "Property"
  8405. // },
  8406. // "response": {
  8407. // "$ref": "Property"
  8408. // },
  8409. // "scopes": [
  8410. // "https://www.googleapis.com/auth/drive",
  8411. // "https://www.googleapis.com/auth/drive.appdata",
  8412. // "https://www.googleapis.com/auth/drive.file",
  8413. // "https://www.googleapis.com/auth/drive.metadata"
  8414. // ]
  8415. // }
  8416. }
  8417. // method id "drive.properties.update":
  8418. type PropertiesUpdateCall struct {
  8419. s *Service
  8420. fileId string
  8421. propertyKey string
  8422. property *Property
  8423. urlParams_ gensupport.URLParams
  8424. ctx_ context.Context
  8425. }
  8426. // Update: Updates a property, or adds it if it doesn't exist.
  8427. func (r *PropertiesService) Update(fileId string, propertyKey string, property *Property) *PropertiesUpdateCall {
  8428. c := &PropertiesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8429. c.fileId = fileId
  8430. c.propertyKey = propertyKey
  8431. c.property = property
  8432. return c
  8433. }
  8434. // Visibility sets the optional parameter "visibility": The visibility
  8435. // of the property.
  8436. func (c *PropertiesUpdateCall) Visibility(visibility string) *PropertiesUpdateCall {
  8437. c.urlParams_.Set("visibility", visibility)
  8438. return c
  8439. }
  8440. // Fields allows partial responses to be retrieved. See
  8441. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8442. // for more information.
  8443. func (c *PropertiesUpdateCall) Fields(s ...googleapi.Field) *PropertiesUpdateCall {
  8444. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8445. return c
  8446. }
  8447. // Context sets the context to be used in this call's Do method. Any
  8448. // pending HTTP request will be aborted if the provided context is
  8449. // canceled.
  8450. func (c *PropertiesUpdateCall) Context(ctx context.Context) *PropertiesUpdateCall {
  8451. c.ctx_ = ctx
  8452. return c
  8453. }
  8454. func (c *PropertiesUpdateCall) doRequest(alt string) (*http.Response, error) {
  8455. var body io.Reader = nil
  8456. body, err := googleapi.WithoutDataWrapper.JSONReader(c.property)
  8457. if err != nil {
  8458. return nil, err
  8459. }
  8460. ctype := "application/json"
  8461. c.urlParams_.Set("alt", alt)
  8462. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties/{propertyKey}")
  8463. urls += "?" + c.urlParams_.Encode()
  8464. req, _ := http.NewRequest("PUT", urls, body)
  8465. googleapi.Expand(req.URL, map[string]string{
  8466. "fileId": c.fileId,
  8467. "propertyKey": c.propertyKey,
  8468. })
  8469. req.Header.Set("Content-Type", ctype)
  8470. req.Header.Set("User-Agent", c.s.userAgent())
  8471. if c.ctx_ != nil {
  8472. return ctxhttp.Do(c.ctx_, c.s.client, req)
  8473. }
  8474. return c.s.client.Do(req)
  8475. }
  8476. // Do executes the "drive.properties.update" call.
  8477. // Exactly one of *Property or error will be non-nil. Any non-2xx status
  8478. // code is an error. Response headers are in either
  8479. // *Property.ServerResponse.Header or (if a response was returned at
  8480. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  8481. // to check whether the returned error was because
  8482. // http.StatusNotModified was returned.
  8483. func (c *PropertiesUpdateCall) Do(opts ...googleapi.CallOption) (*Property, error) {
  8484. gensupport.SetOptions(c.urlParams_, opts...)
  8485. res, err := c.doRequest("json")
  8486. if res != nil && res.StatusCode == http.StatusNotModified {
  8487. if res.Body != nil {
  8488. res.Body.Close()
  8489. }
  8490. return nil, &googleapi.Error{
  8491. Code: res.StatusCode,
  8492. Header: res.Header,
  8493. }
  8494. }
  8495. if err != nil {
  8496. return nil, err
  8497. }
  8498. defer googleapi.CloseBody(res)
  8499. if err := googleapi.CheckResponse(res); err != nil {
  8500. return nil, err
  8501. }
  8502. ret := &Property{
  8503. ServerResponse: googleapi.ServerResponse{
  8504. Header: res.Header,
  8505. HTTPStatusCode: res.StatusCode,
  8506. },
  8507. }
  8508. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  8509. return nil, err
  8510. }
  8511. return ret, nil
  8512. // {
  8513. // "description": "Updates a property, or adds it if it doesn't exist.",
  8514. // "httpMethod": "PUT",
  8515. // "id": "drive.properties.update",
  8516. // "parameterOrder": [
  8517. // "fileId",
  8518. // "propertyKey"
  8519. // ],
  8520. // "parameters": {
  8521. // "fileId": {
  8522. // "description": "The ID of the file.",
  8523. // "location": "path",
  8524. // "required": true,
  8525. // "type": "string"
  8526. // },
  8527. // "propertyKey": {
  8528. // "description": "The key of the property.",
  8529. // "location": "path",
  8530. // "required": true,
  8531. // "type": "string"
  8532. // },
  8533. // "visibility": {
  8534. // "default": "private",
  8535. // "description": "The visibility of the property.",
  8536. // "location": "query",
  8537. // "type": "string"
  8538. // }
  8539. // },
  8540. // "path": "files/{fileId}/properties/{propertyKey}",
  8541. // "request": {
  8542. // "$ref": "Property"
  8543. // },
  8544. // "response": {
  8545. // "$ref": "Property"
  8546. // },
  8547. // "scopes": [
  8548. // "https://www.googleapis.com/auth/drive",
  8549. // "https://www.googleapis.com/auth/drive.appdata",
  8550. // "https://www.googleapis.com/auth/drive.file",
  8551. // "https://www.googleapis.com/auth/drive.metadata"
  8552. // ]
  8553. // }
  8554. }
  8555. // method id "drive.realtime.get":
  8556. type RealtimeGetCall struct {
  8557. s *Service
  8558. fileId string
  8559. urlParams_ gensupport.URLParams
  8560. ifNoneMatch_ string
  8561. ctx_ context.Context
  8562. }
  8563. // Get: Exports the contents of the Realtime API data model associated
  8564. // with this file as JSON.
  8565. func (r *RealtimeService) Get(fileId string) *RealtimeGetCall {
  8566. c := &RealtimeGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8567. c.fileId = fileId
  8568. return c
  8569. }
  8570. // Revision sets the optional parameter "revision": The revision of the
  8571. // Realtime API data model to export. Revisions start at 1 (the initial
  8572. // empty data model) and are incremented with each change. If this
  8573. // parameter is excluded, the most recent data model will be returned.
  8574. func (c *RealtimeGetCall) Revision(revision int64) *RealtimeGetCall {
  8575. c.urlParams_.Set("revision", fmt.Sprint(revision))
  8576. return c
  8577. }
  8578. // Fields allows partial responses to be retrieved. See
  8579. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8580. // for more information.
  8581. func (c *RealtimeGetCall) Fields(s ...googleapi.Field) *RealtimeGetCall {
  8582. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8583. return c
  8584. }
  8585. // IfNoneMatch sets the optional parameter which makes the operation
  8586. // fail if the object's ETag matches the given value. This is useful for
  8587. // getting updates only after the object has changed since the last
  8588. // request. Use googleapi.IsNotModified to check whether the response
  8589. // error from Do is the result of In-None-Match.
  8590. func (c *RealtimeGetCall) IfNoneMatch(entityTag string) *RealtimeGetCall {
  8591. c.ifNoneMatch_ = entityTag
  8592. return c
  8593. }
  8594. // Context sets the context to be used in this call's Do and Download
  8595. // methods. Any pending HTTP request will be aborted if the provided
  8596. // context is canceled.
  8597. func (c *RealtimeGetCall) Context(ctx context.Context) *RealtimeGetCall {
  8598. c.ctx_ = ctx
  8599. return c
  8600. }
  8601. func (c *RealtimeGetCall) doRequest(alt string) (*http.Response, error) {
  8602. var body io.Reader = nil
  8603. c.urlParams_.Set("alt", alt)
  8604. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/realtime")
  8605. urls += "?" + c.urlParams_.Encode()
  8606. req, _ := http.NewRequest("GET", urls, body)
  8607. googleapi.Expand(req.URL, map[string]string{
  8608. "fileId": c.fileId,
  8609. })
  8610. req.Header.Set("User-Agent", c.s.userAgent())
  8611. if c.ifNoneMatch_ != "" {
  8612. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  8613. }
  8614. if c.ctx_ != nil {
  8615. return ctxhttp.Do(c.ctx_, c.s.client, req)
  8616. }
  8617. return c.s.client.Do(req)
  8618. }
  8619. // Download fetches the API endpoint's "media" value, instead of the normal
  8620. // API response value. If the returned error is nil, the Response is guaranteed to
  8621. // have a 2xx status code. Callers must close the Response.Body as usual.
  8622. func (c *RealtimeGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  8623. gensupport.SetOptions(c.urlParams_, opts...)
  8624. res, err := c.doRequest("media")
  8625. if err != nil {
  8626. return nil, err
  8627. }
  8628. if err := googleapi.CheckMediaResponse(res); err != nil {
  8629. res.Body.Close()
  8630. return nil, err
  8631. }
  8632. return res, nil
  8633. }
  8634. // Do executes the "drive.realtime.get" call.
  8635. func (c *RealtimeGetCall) Do(opts ...googleapi.CallOption) error {
  8636. gensupport.SetOptions(c.urlParams_, opts...)
  8637. res, err := c.doRequest("json")
  8638. if err != nil {
  8639. return err
  8640. }
  8641. defer googleapi.CloseBody(res)
  8642. if err := googleapi.CheckResponse(res); err != nil {
  8643. return err
  8644. }
  8645. return nil
  8646. // {
  8647. // "description": "Exports the contents of the Realtime API data model associated with this file as JSON.",
  8648. // "httpMethod": "GET",
  8649. // "id": "drive.realtime.get",
  8650. // "parameterOrder": [
  8651. // "fileId"
  8652. // ],
  8653. // "parameters": {
  8654. // "fileId": {
  8655. // "description": "The ID of the file that the Realtime API data model is associated with.",
  8656. // "location": "path",
  8657. // "required": true,
  8658. // "type": "string"
  8659. // },
  8660. // "revision": {
  8661. // "description": "The revision of the Realtime API data model to export. Revisions start at 1 (the initial empty data model) and are incremented with each change. If this parameter is excluded, the most recent data model will be returned.",
  8662. // "format": "int32",
  8663. // "location": "query",
  8664. // "minimum": "1",
  8665. // "type": "integer"
  8666. // }
  8667. // },
  8668. // "path": "files/{fileId}/realtime",
  8669. // "scopes": [
  8670. // "https://www.googleapis.com/auth/drive",
  8671. // "https://www.googleapis.com/auth/drive.file",
  8672. // "https://www.googleapis.com/auth/drive.readonly"
  8673. // ],
  8674. // "supportsMediaDownload": true
  8675. // }
  8676. }
  8677. // method id "drive.realtime.update":
  8678. type RealtimeUpdateCall struct {
  8679. s *Service
  8680. fileId string
  8681. urlParams_ gensupport.URLParams
  8682. media_ io.Reader
  8683. resumableBuffer_ *gensupport.ResumableBuffer
  8684. mediaType_ string
  8685. mediaSize_ int64 // mediaSize, if known. Used only for calls to progressUpdater_.
  8686. progressUpdater_ googleapi.ProgressUpdater
  8687. ctx_ context.Context
  8688. }
  8689. // Update: Overwrites the Realtime API data model associated with this
  8690. // file with the provided JSON data model.
  8691. func (r *RealtimeService) Update(fileId string) *RealtimeUpdateCall {
  8692. c := &RealtimeUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8693. c.fileId = fileId
  8694. return c
  8695. }
  8696. // BaseRevision sets the optional parameter "baseRevision": The revision
  8697. // of the model to diff the uploaded model against. If set, the uploaded
  8698. // model is diffed against the provided revision and those differences
  8699. // are merged with any changes made to the model after the provided
  8700. // revision. If not set, the uploaded model replaces the current model
  8701. // on the server.
  8702. func (c *RealtimeUpdateCall) BaseRevision(baseRevision string) *RealtimeUpdateCall {
  8703. c.urlParams_.Set("baseRevision", baseRevision)
  8704. return c
  8705. }
  8706. // Media specifies the media to upload in one or more chunks. The chunk
  8707. // size may be controlled by supplying a MediaOption generated by
  8708. // googleapi.ChunkSize. The chunk size defaults to
  8709. // googleapi.DefaultUploadChunkSize.
  8710. // At most one of Media and ResumableMedia may be set.
  8711. func (c *RealtimeUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *RealtimeUpdateCall {
  8712. opts := googleapi.ProcessMediaOptions(options)
  8713. chunkSize := opts.ChunkSize
  8714. r, c.mediaType_ = gensupport.DetermineContentType(r, opts.ContentType)
  8715. c.media_, c.resumableBuffer_ = gensupport.PrepareUpload(r, chunkSize)
  8716. return c
  8717. }
  8718. // ResumableMedia specifies the media to upload in chunks and can be
  8719. // canceled with ctx.
  8720. //
  8721. // Deprecated: use Media instead.
  8722. //
  8723. // At most one of Media and ResumableMedia may be set. mediaType
  8724. // identifies the MIME media type of the upload, such as "image/png". If
  8725. // mediaType is "", it will be auto-detected. The provided ctx will
  8726. // supersede any context previously provided to the Context method.
  8727. func (c *RealtimeUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *RealtimeUpdateCall {
  8728. c.ctx_ = ctx
  8729. rdr := gensupport.ReaderAtToReader(r, size)
  8730. rdr, c.mediaType_ = gensupport.DetermineContentType(rdr, mediaType)
  8731. c.resumableBuffer_ = gensupport.NewResumableBuffer(rdr, googleapi.DefaultUploadChunkSize)
  8732. c.media_ = nil
  8733. c.mediaSize_ = size
  8734. return c
  8735. }
  8736. // ProgressUpdater provides a callback function that will be called
  8737. // after every chunk. It should be a low-latency function in order to
  8738. // not slow down the upload operation. This should only be called when
  8739. // using ResumableMedia (as opposed to Media).
  8740. func (c *RealtimeUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *RealtimeUpdateCall {
  8741. c.progressUpdater_ = pu
  8742. return c
  8743. }
  8744. // Fields allows partial responses to be retrieved. See
  8745. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8746. // for more information.
  8747. func (c *RealtimeUpdateCall) Fields(s ...googleapi.Field) *RealtimeUpdateCall {
  8748. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8749. return c
  8750. }
  8751. // Context sets the context to be used in this call's Do method. Any
  8752. // pending HTTP request will be aborted if the provided context is
  8753. // canceled.
  8754. // This context will supersede any context previously provided to the
  8755. // ResumableMedia method.
  8756. func (c *RealtimeUpdateCall) Context(ctx context.Context) *RealtimeUpdateCall {
  8757. c.ctx_ = ctx
  8758. return c
  8759. }
  8760. func (c *RealtimeUpdateCall) doRequest(alt string) (*http.Response, error) {
  8761. var body io.Reader = nil
  8762. c.urlParams_.Set("alt", alt)
  8763. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/realtime")
  8764. if c.media_ != nil || c.resumableBuffer_ != nil {
  8765. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  8766. protocol := "multipart"
  8767. if c.resumableBuffer_ != nil {
  8768. protocol = "resumable"
  8769. }
  8770. c.urlParams_.Set("uploadType", protocol)
  8771. }
  8772. urls += "?" + c.urlParams_.Encode()
  8773. body = new(bytes.Buffer)
  8774. ctype := "application/json"
  8775. if c.media_ != nil {
  8776. var combined io.ReadCloser
  8777. combined, ctype = gensupport.CombineBodyMedia(body, ctype, c.media_, c.mediaType_)
  8778. defer combined.Close()
  8779. body = combined
  8780. }
  8781. req, _ := http.NewRequest("PUT", urls, body)
  8782. googleapi.Expand(req.URL, map[string]string{
  8783. "fileId": c.fileId,
  8784. })
  8785. if c.resumableBuffer_ != nil {
  8786. req.Header.Set("X-Upload-Content-Type", c.mediaType_)
  8787. }
  8788. req.Header.Set("Content-Type", ctype)
  8789. req.Header.Set("User-Agent", c.s.userAgent())
  8790. if c.ctx_ != nil {
  8791. return ctxhttp.Do(c.ctx_, c.s.client, req)
  8792. }
  8793. return c.s.client.Do(req)
  8794. }
  8795. // Do executes the "drive.realtime.update" call.
  8796. func (c *RealtimeUpdateCall) Do(opts ...googleapi.CallOption) error {
  8797. gensupport.SetOptions(c.urlParams_, opts...)
  8798. res, err := gensupport.Retry(c.ctx_, func() (*http.Response, error) {
  8799. return c.doRequest("json")
  8800. }, gensupport.DefaultBackoffStrategy())
  8801. if err != nil {
  8802. return err
  8803. }
  8804. defer googleapi.CloseBody(res)
  8805. if err := googleapi.CheckResponse(res); err != nil {
  8806. return err
  8807. }
  8808. if c.resumableBuffer_ != nil {
  8809. loc := res.Header.Get("Location")
  8810. rx := &gensupport.ResumableUpload{
  8811. Client: c.s.client,
  8812. UserAgent: c.s.userAgent(),
  8813. URI: loc,
  8814. Media: c.resumableBuffer_,
  8815. MediaType: c.mediaType_,
  8816. Callback: func(curr int64) {
  8817. if c.progressUpdater_ != nil {
  8818. c.progressUpdater_(curr, c.mediaSize_)
  8819. }
  8820. },
  8821. }
  8822. ctx := c.ctx_
  8823. if ctx == nil {
  8824. ctx = context.TODO()
  8825. }
  8826. res, err = rx.Upload(ctx)
  8827. if err != nil {
  8828. return err
  8829. }
  8830. defer res.Body.Close()
  8831. if err := googleapi.CheckResponse(res); err != nil {
  8832. return err
  8833. }
  8834. }
  8835. return nil
  8836. // {
  8837. // "description": "Overwrites the Realtime API data model associated with this file with the provided JSON data model.",
  8838. // "httpMethod": "PUT",
  8839. // "id": "drive.realtime.update",
  8840. // "mediaUpload": {
  8841. // "accept": [
  8842. // "*/*"
  8843. // ],
  8844. // "maxSize": "10MB",
  8845. // "protocols": {
  8846. // "resumable": {
  8847. // "multipart": true,
  8848. // "path": "/resumable/upload/drive/v2/files/{fileId}/realtime"
  8849. // },
  8850. // "simple": {
  8851. // "multipart": true,
  8852. // "path": "/upload/drive/v2/files/{fileId}/realtime"
  8853. // }
  8854. // }
  8855. // },
  8856. // "parameterOrder": [
  8857. // "fileId"
  8858. // ],
  8859. // "parameters": {
  8860. // "baseRevision": {
  8861. // "description": "The revision of the model to diff the uploaded model against. If set, the uploaded model is diffed against the provided revision and those differences are merged with any changes made to the model after the provided revision. If not set, the uploaded model replaces the current model on the server.",
  8862. // "location": "query",
  8863. // "type": "string"
  8864. // },
  8865. // "fileId": {
  8866. // "description": "The ID of the file that the Realtime API data model is associated with.",
  8867. // "location": "path",
  8868. // "required": true,
  8869. // "type": "string"
  8870. // }
  8871. // },
  8872. // "path": "files/{fileId}/realtime",
  8873. // "scopes": [
  8874. // "https://www.googleapis.com/auth/drive",
  8875. // "https://www.googleapis.com/auth/drive.file"
  8876. // ],
  8877. // "supportsMediaUpload": true
  8878. // }
  8879. }
  8880. // method id "drive.replies.delete":
  8881. type RepliesDeleteCall struct {
  8882. s *Service
  8883. fileId string
  8884. commentId string
  8885. replyId string
  8886. urlParams_ gensupport.URLParams
  8887. ctx_ context.Context
  8888. }
  8889. // Delete: Deletes a reply.
  8890. func (r *RepliesService) Delete(fileId string, commentId string, replyId string) *RepliesDeleteCall {
  8891. c := &RepliesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8892. c.fileId = fileId
  8893. c.commentId = commentId
  8894. c.replyId = replyId
  8895. return c
  8896. }
  8897. // Fields allows partial responses to be retrieved. See
  8898. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8899. // for more information.
  8900. func (c *RepliesDeleteCall) Fields(s ...googleapi.Field) *RepliesDeleteCall {
  8901. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8902. return c
  8903. }
  8904. // Context sets the context to be used in this call's Do method. Any
  8905. // pending HTTP request will be aborted if the provided context is
  8906. // canceled.
  8907. func (c *RepliesDeleteCall) Context(ctx context.Context) *RepliesDeleteCall {
  8908. c.ctx_ = ctx
  8909. return c
  8910. }
  8911. func (c *RepliesDeleteCall) doRequest(alt string) (*http.Response, error) {
  8912. var body io.Reader = nil
  8913. c.urlParams_.Set("alt", alt)
  8914. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  8915. urls += "?" + c.urlParams_.Encode()
  8916. req, _ := http.NewRequest("DELETE", urls, body)
  8917. googleapi.Expand(req.URL, map[string]string{
  8918. "fileId": c.fileId,
  8919. "commentId": c.commentId,
  8920. "replyId": c.replyId,
  8921. })
  8922. req.Header.Set("User-Agent", c.s.userAgent())
  8923. if c.ctx_ != nil {
  8924. return ctxhttp.Do(c.ctx_, c.s.client, req)
  8925. }
  8926. return c.s.client.Do(req)
  8927. }
  8928. // Do executes the "drive.replies.delete" call.
  8929. func (c *RepliesDeleteCall) Do(opts ...googleapi.CallOption) error {
  8930. gensupport.SetOptions(c.urlParams_, opts...)
  8931. res, err := c.doRequest("json")
  8932. if err != nil {
  8933. return err
  8934. }
  8935. defer googleapi.CloseBody(res)
  8936. if err := googleapi.CheckResponse(res); err != nil {
  8937. return err
  8938. }
  8939. return nil
  8940. // {
  8941. // "description": "Deletes a reply.",
  8942. // "httpMethod": "DELETE",
  8943. // "id": "drive.replies.delete",
  8944. // "parameterOrder": [
  8945. // "fileId",
  8946. // "commentId",
  8947. // "replyId"
  8948. // ],
  8949. // "parameters": {
  8950. // "commentId": {
  8951. // "description": "The ID of the comment.",
  8952. // "location": "path",
  8953. // "required": true,
  8954. // "type": "string"
  8955. // },
  8956. // "fileId": {
  8957. // "description": "The ID of the file.",
  8958. // "location": "path",
  8959. // "required": true,
  8960. // "type": "string"
  8961. // },
  8962. // "replyId": {
  8963. // "description": "The ID of the reply.",
  8964. // "location": "path",
  8965. // "required": true,
  8966. // "type": "string"
  8967. // }
  8968. // },
  8969. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  8970. // "scopes": [
  8971. // "https://www.googleapis.com/auth/drive",
  8972. // "https://www.googleapis.com/auth/drive.file"
  8973. // ]
  8974. // }
  8975. }
  8976. // method id "drive.replies.get":
  8977. type RepliesGetCall struct {
  8978. s *Service
  8979. fileId string
  8980. commentId string
  8981. replyId string
  8982. urlParams_ gensupport.URLParams
  8983. ifNoneMatch_ string
  8984. ctx_ context.Context
  8985. }
  8986. // Get: Gets a reply.
  8987. func (r *RepliesService) Get(fileId string, commentId string, replyId string) *RepliesGetCall {
  8988. c := &RepliesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8989. c.fileId = fileId
  8990. c.commentId = commentId
  8991. c.replyId = replyId
  8992. return c
  8993. }
  8994. // IncludeDeleted sets the optional parameter "includeDeleted": If set,
  8995. // this will succeed when retrieving a deleted reply.
  8996. func (c *RepliesGetCall) IncludeDeleted(includeDeleted bool) *RepliesGetCall {
  8997. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  8998. return c
  8999. }
  9000. // Fields allows partial responses to be retrieved. See
  9001. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9002. // for more information.
  9003. func (c *RepliesGetCall) Fields(s ...googleapi.Field) *RepliesGetCall {
  9004. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9005. return c
  9006. }
  9007. // IfNoneMatch sets the optional parameter which makes the operation
  9008. // fail if the object's ETag matches the given value. This is useful for
  9009. // getting updates only after the object has changed since the last
  9010. // request. Use googleapi.IsNotModified to check whether the response
  9011. // error from Do is the result of In-None-Match.
  9012. func (c *RepliesGetCall) IfNoneMatch(entityTag string) *RepliesGetCall {
  9013. c.ifNoneMatch_ = entityTag
  9014. return c
  9015. }
  9016. // Context sets the context to be used in this call's Do method. Any
  9017. // pending HTTP request will be aborted if the provided context is
  9018. // canceled.
  9019. func (c *RepliesGetCall) Context(ctx context.Context) *RepliesGetCall {
  9020. c.ctx_ = ctx
  9021. return c
  9022. }
  9023. func (c *RepliesGetCall) doRequest(alt string) (*http.Response, error) {
  9024. var body io.Reader = nil
  9025. c.urlParams_.Set("alt", alt)
  9026. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  9027. urls += "?" + c.urlParams_.Encode()
  9028. req, _ := http.NewRequest("GET", urls, body)
  9029. googleapi.Expand(req.URL, map[string]string{
  9030. "fileId": c.fileId,
  9031. "commentId": c.commentId,
  9032. "replyId": c.replyId,
  9033. })
  9034. req.Header.Set("User-Agent", c.s.userAgent())
  9035. if c.ifNoneMatch_ != "" {
  9036. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  9037. }
  9038. if c.ctx_ != nil {
  9039. return ctxhttp.Do(c.ctx_, c.s.client, req)
  9040. }
  9041. return c.s.client.Do(req)
  9042. }
  9043. // Do executes the "drive.replies.get" call.
  9044. // Exactly one of *CommentReply or error will be non-nil. Any non-2xx
  9045. // status code is an error. Response headers are in either
  9046. // *CommentReply.ServerResponse.Header or (if a response was returned at
  9047. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9048. // to check whether the returned error was because
  9049. // http.StatusNotModified was returned.
  9050. func (c *RepliesGetCall) Do(opts ...googleapi.CallOption) (*CommentReply, error) {
  9051. gensupport.SetOptions(c.urlParams_, opts...)
  9052. res, err := c.doRequest("json")
  9053. if res != nil && res.StatusCode == http.StatusNotModified {
  9054. if res.Body != nil {
  9055. res.Body.Close()
  9056. }
  9057. return nil, &googleapi.Error{
  9058. Code: res.StatusCode,
  9059. Header: res.Header,
  9060. }
  9061. }
  9062. if err != nil {
  9063. return nil, err
  9064. }
  9065. defer googleapi.CloseBody(res)
  9066. if err := googleapi.CheckResponse(res); err != nil {
  9067. return nil, err
  9068. }
  9069. ret := &CommentReply{
  9070. ServerResponse: googleapi.ServerResponse{
  9071. Header: res.Header,
  9072. HTTPStatusCode: res.StatusCode,
  9073. },
  9074. }
  9075. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  9076. return nil, err
  9077. }
  9078. return ret, nil
  9079. // {
  9080. // "description": "Gets a reply.",
  9081. // "httpMethod": "GET",
  9082. // "id": "drive.replies.get",
  9083. // "parameterOrder": [
  9084. // "fileId",
  9085. // "commentId",
  9086. // "replyId"
  9087. // ],
  9088. // "parameters": {
  9089. // "commentId": {
  9090. // "description": "The ID of the comment.",
  9091. // "location": "path",
  9092. // "required": true,
  9093. // "type": "string"
  9094. // },
  9095. // "fileId": {
  9096. // "description": "The ID of the file.",
  9097. // "location": "path",
  9098. // "required": true,
  9099. // "type": "string"
  9100. // },
  9101. // "includeDeleted": {
  9102. // "default": "false",
  9103. // "description": "If set, this will succeed when retrieving a deleted reply.",
  9104. // "location": "query",
  9105. // "type": "boolean"
  9106. // },
  9107. // "replyId": {
  9108. // "description": "The ID of the reply.",
  9109. // "location": "path",
  9110. // "required": true,
  9111. // "type": "string"
  9112. // }
  9113. // },
  9114. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  9115. // "response": {
  9116. // "$ref": "CommentReply"
  9117. // },
  9118. // "scopes": [
  9119. // "https://www.googleapis.com/auth/drive",
  9120. // "https://www.googleapis.com/auth/drive.file",
  9121. // "https://www.googleapis.com/auth/drive.readonly"
  9122. // ]
  9123. // }
  9124. }
  9125. // method id "drive.replies.insert":
  9126. type RepliesInsertCall struct {
  9127. s *Service
  9128. fileId string
  9129. commentId string
  9130. commentreply *CommentReply
  9131. urlParams_ gensupport.URLParams
  9132. ctx_ context.Context
  9133. }
  9134. // Insert: Creates a new reply to the given comment.
  9135. func (r *RepliesService) Insert(fileId string, commentId string, commentreply *CommentReply) *RepliesInsertCall {
  9136. c := &RepliesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9137. c.fileId = fileId
  9138. c.commentId = commentId
  9139. c.commentreply = commentreply
  9140. return c
  9141. }
  9142. // Fields allows partial responses to be retrieved. See
  9143. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9144. // for more information.
  9145. func (c *RepliesInsertCall) Fields(s ...googleapi.Field) *RepliesInsertCall {
  9146. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9147. return c
  9148. }
  9149. // Context sets the context to be used in this call's Do method. Any
  9150. // pending HTTP request will be aborted if the provided context is
  9151. // canceled.
  9152. func (c *RepliesInsertCall) Context(ctx context.Context) *RepliesInsertCall {
  9153. c.ctx_ = ctx
  9154. return c
  9155. }
  9156. func (c *RepliesInsertCall) doRequest(alt string) (*http.Response, error) {
  9157. var body io.Reader = nil
  9158. body, err := googleapi.WithoutDataWrapper.JSONReader(c.commentreply)
  9159. if err != nil {
  9160. return nil, err
  9161. }
  9162. ctype := "application/json"
  9163. c.urlParams_.Set("alt", alt)
  9164. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies")
  9165. urls += "?" + c.urlParams_.Encode()
  9166. req, _ := http.NewRequest("POST", urls, body)
  9167. googleapi.Expand(req.URL, map[string]string{
  9168. "fileId": c.fileId,
  9169. "commentId": c.commentId,
  9170. })
  9171. req.Header.Set("Content-Type", ctype)
  9172. req.Header.Set("User-Agent", c.s.userAgent())
  9173. if c.ctx_ != nil {
  9174. return ctxhttp.Do(c.ctx_, c.s.client, req)
  9175. }
  9176. return c.s.client.Do(req)
  9177. }
  9178. // Do executes the "drive.replies.insert" call.
  9179. // Exactly one of *CommentReply or error will be non-nil. Any non-2xx
  9180. // status code is an error. Response headers are in either
  9181. // *CommentReply.ServerResponse.Header or (if a response was returned at
  9182. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9183. // to check whether the returned error was because
  9184. // http.StatusNotModified was returned.
  9185. func (c *RepliesInsertCall) Do(opts ...googleapi.CallOption) (*CommentReply, error) {
  9186. gensupport.SetOptions(c.urlParams_, opts...)
  9187. res, err := c.doRequest("json")
  9188. if res != nil && res.StatusCode == http.StatusNotModified {
  9189. if res.Body != nil {
  9190. res.Body.Close()
  9191. }
  9192. return nil, &googleapi.Error{
  9193. Code: res.StatusCode,
  9194. Header: res.Header,
  9195. }
  9196. }
  9197. if err != nil {
  9198. return nil, err
  9199. }
  9200. defer googleapi.CloseBody(res)
  9201. if err := googleapi.CheckResponse(res); err != nil {
  9202. return nil, err
  9203. }
  9204. ret := &CommentReply{
  9205. ServerResponse: googleapi.ServerResponse{
  9206. Header: res.Header,
  9207. HTTPStatusCode: res.StatusCode,
  9208. },
  9209. }
  9210. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  9211. return nil, err
  9212. }
  9213. return ret, nil
  9214. // {
  9215. // "description": "Creates a new reply to the given comment.",
  9216. // "httpMethod": "POST",
  9217. // "id": "drive.replies.insert",
  9218. // "parameterOrder": [
  9219. // "fileId",
  9220. // "commentId"
  9221. // ],
  9222. // "parameters": {
  9223. // "commentId": {
  9224. // "description": "The ID of the comment.",
  9225. // "location": "path",
  9226. // "required": true,
  9227. // "type": "string"
  9228. // },
  9229. // "fileId": {
  9230. // "description": "The ID of the file.",
  9231. // "location": "path",
  9232. // "required": true,
  9233. // "type": "string"
  9234. // }
  9235. // },
  9236. // "path": "files/{fileId}/comments/{commentId}/replies",
  9237. // "request": {
  9238. // "$ref": "CommentReply"
  9239. // },
  9240. // "response": {
  9241. // "$ref": "CommentReply"
  9242. // },
  9243. // "scopes": [
  9244. // "https://www.googleapis.com/auth/drive",
  9245. // "https://www.googleapis.com/auth/drive.file"
  9246. // ]
  9247. // }
  9248. }
  9249. // method id "drive.replies.list":
  9250. type RepliesListCall struct {
  9251. s *Service
  9252. fileId string
  9253. commentId string
  9254. urlParams_ gensupport.URLParams
  9255. ifNoneMatch_ string
  9256. ctx_ context.Context
  9257. }
  9258. // List: Lists all of the replies to a comment.
  9259. func (r *RepliesService) List(fileId string, commentId string) *RepliesListCall {
  9260. c := &RepliesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9261. c.fileId = fileId
  9262. c.commentId = commentId
  9263. return c
  9264. }
  9265. // IncludeDeleted sets the optional parameter "includeDeleted": If set,
  9266. // all replies, including deleted replies (with content stripped) will
  9267. // be returned.
  9268. func (c *RepliesListCall) IncludeDeleted(includeDeleted bool) *RepliesListCall {
  9269. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  9270. return c
  9271. }
  9272. // MaxResults sets the optional parameter "maxResults": The maximum
  9273. // number of replies to include in the response, used for paging.
  9274. func (c *RepliesListCall) MaxResults(maxResults int64) *RepliesListCall {
  9275. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  9276. return c
  9277. }
  9278. // PageToken sets the optional parameter "pageToken": The continuation
  9279. // token, used to page through large result sets. To get the next page
  9280. // of results, set this parameter to the value of "nextPageToken" from
  9281. // the previous response.
  9282. func (c *RepliesListCall) PageToken(pageToken string) *RepliesListCall {
  9283. c.urlParams_.Set("pageToken", pageToken)
  9284. return c
  9285. }
  9286. // Fields allows partial responses to be retrieved. See
  9287. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9288. // for more information.
  9289. func (c *RepliesListCall) Fields(s ...googleapi.Field) *RepliesListCall {
  9290. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9291. return c
  9292. }
  9293. // IfNoneMatch sets the optional parameter which makes the operation
  9294. // fail if the object's ETag matches the given value. This is useful for
  9295. // getting updates only after the object has changed since the last
  9296. // request. Use googleapi.IsNotModified to check whether the response
  9297. // error from Do is the result of In-None-Match.
  9298. func (c *RepliesListCall) IfNoneMatch(entityTag string) *RepliesListCall {
  9299. c.ifNoneMatch_ = entityTag
  9300. return c
  9301. }
  9302. // Context sets the context to be used in this call's Do method. Any
  9303. // pending HTTP request will be aborted if the provided context is
  9304. // canceled.
  9305. func (c *RepliesListCall) Context(ctx context.Context) *RepliesListCall {
  9306. c.ctx_ = ctx
  9307. return c
  9308. }
  9309. func (c *RepliesListCall) doRequest(alt string) (*http.Response, error) {
  9310. var body io.Reader = nil
  9311. c.urlParams_.Set("alt", alt)
  9312. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies")
  9313. urls += "?" + c.urlParams_.Encode()
  9314. req, _ := http.NewRequest("GET", urls, body)
  9315. googleapi.Expand(req.URL, map[string]string{
  9316. "fileId": c.fileId,
  9317. "commentId": c.commentId,
  9318. })
  9319. req.Header.Set("User-Agent", c.s.userAgent())
  9320. if c.ifNoneMatch_ != "" {
  9321. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  9322. }
  9323. if c.ctx_ != nil {
  9324. return ctxhttp.Do(c.ctx_, c.s.client, req)
  9325. }
  9326. return c.s.client.Do(req)
  9327. }
  9328. // Do executes the "drive.replies.list" call.
  9329. // Exactly one of *CommentReplyList or error will be non-nil. Any
  9330. // non-2xx status code is an error. Response headers are in either
  9331. // *CommentReplyList.ServerResponse.Header or (if a response was
  9332. // returned at all) in error.(*googleapi.Error).Header. Use
  9333. // googleapi.IsNotModified to check whether the returned error was
  9334. // because http.StatusNotModified was returned.
  9335. func (c *RepliesListCall) Do(opts ...googleapi.CallOption) (*CommentReplyList, error) {
  9336. gensupport.SetOptions(c.urlParams_, opts...)
  9337. res, err := c.doRequest("json")
  9338. if res != nil && res.StatusCode == http.StatusNotModified {
  9339. if res.Body != nil {
  9340. res.Body.Close()
  9341. }
  9342. return nil, &googleapi.Error{
  9343. Code: res.StatusCode,
  9344. Header: res.Header,
  9345. }
  9346. }
  9347. if err != nil {
  9348. return nil, err
  9349. }
  9350. defer googleapi.CloseBody(res)
  9351. if err := googleapi.CheckResponse(res); err != nil {
  9352. return nil, err
  9353. }
  9354. ret := &CommentReplyList{
  9355. ServerResponse: googleapi.ServerResponse{
  9356. Header: res.Header,
  9357. HTTPStatusCode: res.StatusCode,
  9358. },
  9359. }
  9360. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  9361. return nil, err
  9362. }
  9363. return ret, nil
  9364. // {
  9365. // "description": "Lists all of the replies to a comment.",
  9366. // "httpMethod": "GET",
  9367. // "id": "drive.replies.list",
  9368. // "parameterOrder": [
  9369. // "fileId",
  9370. // "commentId"
  9371. // ],
  9372. // "parameters": {
  9373. // "commentId": {
  9374. // "description": "The ID of the comment.",
  9375. // "location": "path",
  9376. // "required": true,
  9377. // "type": "string"
  9378. // },
  9379. // "fileId": {
  9380. // "description": "The ID of the file.",
  9381. // "location": "path",
  9382. // "required": true,
  9383. // "type": "string"
  9384. // },
  9385. // "includeDeleted": {
  9386. // "default": "false",
  9387. // "description": "If set, all replies, including deleted replies (with content stripped) will be returned.",
  9388. // "location": "query",
  9389. // "type": "boolean"
  9390. // },
  9391. // "maxResults": {
  9392. // "default": "20",
  9393. // "description": "The maximum number of replies to include in the response, used for paging.",
  9394. // "format": "int32",
  9395. // "location": "query",
  9396. // "maximum": "100",
  9397. // "minimum": "0",
  9398. // "type": "integer"
  9399. // },
  9400. // "pageToken": {
  9401. // "description": "The continuation token, used to page through large result sets. To get the next page of results, set this parameter to the value of \"nextPageToken\" from the previous response.",
  9402. // "location": "query",
  9403. // "type": "string"
  9404. // }
  9405. // },
  9406. // "path": "files/{fileId}/comments/{commentId}/replies",
  9407. // "response": {
  9408. // "$ref": "CommentReplyList"
  9409. // },
  9410. // "scopes": [
  9411. // "https://www.googleapis.com/auth/drive",
  9412. // "https://www.googleapis.com/auth/drive.file",
  9413. // "https://www.googleapis.com/auth/drive.readonly"
  9414. // ]
  9415. // }
  9416. }
  9417. // Pages invokes f for each page of results.
  9418. // A non-nil error returned from f will halt the iteration.
  9419. // The provided context supersedes any context provided to the Context method.
  9420. func (c *RepliesListCall) Pages(ctx context.Context, f func(*CommentReplyList) error) error {
  9421. c.ctx_ = ctx
  9422. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  9423. for {
  9424. x, err := c.Do()
  9425. if err != nil {
  9426. return err
  9427. }
  9428. if err := f(x); err != nil {
  9429. return err
  9430. }
  9431. if x.NextPageToken == "" {
  9432. return nil
  9433. }
  9434. c.PageToken(x.NextPageToken)
  9435. }
  9436. }
  9437. // method id "drive.replies.patch":
  9438. type RepliesPatchCall struct {
  9439. s *Service
  9440. fileId string
  9441. commentId string
  9442. replyId string
  9443. commentreply *CommentReply
  9444. urlParams_ gensupport.URLParams
  9445. ctx_ context.Context
  9446. }
  9447. // Patch: Updates an existing reply. This method supports patch
  9448. // semantics.
  9449. func (r *RepliesService) Patch(fileId string, commentId string, replyId string, commentreply *CommentReply) *RepliesPatchCall {
  9450. c := &RepliesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9451. c.fileId = fileId
  9452. c.commentId = commentId
  9453. c.replyId = replyId
  9454. c.commentreply = commentreply
  9455. return c
  9456. }
  9457. // Fields allows partial responses to be retrieved. See
  9458. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9459. // for more information.
  9460. func (c *RepliesPatchCall) Fields(s ...googleapi.Field) *RepliesPatchCall {
  9461. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9462. return c
  9463. }
  9464. // Context sets the context to be used in this call's Do method. Any
  9465. // pending HTTP request will be aborted if the provided context is
  9466. // canceled.
  9467. func (c *RepliesPatchCall) Context(ctx context.Context) *RepliesPatchCall {
  9468. c.ctx_ = ctx
  9469. return c
  9470. }
  9471. func (c *RepliesPatchCall) doRequest(alt string) (*http.Response, error) {
  9472. var body io.Reader = nil
  9473. body, err := googleapi.WithoutDataWrapper.JSONReader(c.commentreply)
  9474. if err != nil {
  9475. return nil, err
  9476. }
  9477. ctype := "application/json"
  9478. c.urlParams_.Set("alt", alt)
  9479. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  9480. urls += "?" + c.urlParams_.Encode()
  9481. req, _ := http.NewRequest("PATCH", urls, body)
  9482. googleapi.Expand(req.URL, map[string]string{
  9483. "fileId": c.fileId,
  9484. "commentId": c.commentId,
  9485. "replyId": c.replyId,
  9486. })
  9487. req.Header.Set("Content-Type", ctype)
  9488. req.Header.Set("User-Agent", c.s.userAgent())
  9489. if c.ctx_ != nil {
  9490. return ctxhttp.Do(c.ctx_, c.s.client, req)
  9491. }
  9492. return c.s.client.Do(req)
  9493. }
  9494. // Do executes the "drive.replies.patch" call.
  9495. // Exactly one of *CommentReply or error will be non-nil. Any non-2xx
  9496. // status code is an error. Response headers are in either
  9497. // *CommentReply.ServerResponse.Header or (if a response was returned at
  9498. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9499. // to check whether the returned error was because
  9500. // http.StatusNotModified was returned.
  9501. func (c *RepliesPatchCall) Do(opts ...googleapi.CallOption) (*CommentReply, error) {
  9502. gensupport.SetOptions(c.urlParams_, opts...)
  9503. res, err := c.doRequest("json")
  9504. if res != nil && res.StatusCode == http.StatusNotModified {
  9505. if res.Body != nil {
  9506. res.Body.Close()
  9507. }
  9508. return nil, &googleapi.Error{
  9509. Code: res.StatusCode,
  9510. Header: res.Header,
  9511. }
  9512. }
  9513. if err != nil {
  9514. return nil, err
  9515. }
  9516. defer googleapi.CloseBody(res)
  9517. if err := googleapi.CheckResponse(res); err != nil {
  9518. return nil, err
  9519. }
  9520. ret := &CommentReply{
  9521. ServerResponse: googleapi.ServerResponse{
  9522. Header: res.Header,
  9523. HTTPStatusCode: res.StatusCode,
  9524. },
  9525. }
  9526. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  9527. return nil, err
  9528. }
  9529. return ret, nil
  9530. // {
  9531. // "description": "Updates an existing reply. This method supports patch semantics.",
  9532. // "httpMethod": "PATCH",
  9533. // "id": "drive.replies.patch",
  9534. // "parameterOrder": [
  9535. // "fileId",
  9536. // "commentId",
  9537. // "replyId"
  9538. // ],
  9539. // "parameters": {
  9540. // "commentId": {
  9541. // "description": "The ID of the comment.",
  9542. // "location": "path",
  9543. // "required": true,
  9544. // "type": "string"
  9545. // },
  9546. // "fileId": {
  9547. // "description": "The ID of the file.",
  9548. // "location": "path",
  9549. // "required": true,
  9550. // "type": "string"
  9551. // },
  9552. // "replyId": {
  9553. // "description": "The ID of the reply.",
  9554. // "location": "path",
  9555. // "required": true,
  9556. // "type": "string"
  9557. // }
  9558. // },
  9559. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  9560. // "request": {
  9561. // "$ref": "CommentReply"
  9562. // },
  9563. // "response": {
  9564. // "$ref": "CommentReply"
  9565. // },
  9566. // "scopes": [
  9567. // "https://www.googleapis.com/auth/drive",
  9568. // "https://www.googleapis.com/auth/drive.file"
  9569. // ]
  9570. // }
  9571. }
  9572. // method id "drive.replies.update":
  9573. type RepliesUpdateCall struct {
  9574. s *Service
  9575. fileId string
  9576. commentId string
  9577. replyId string
  9578. commentreply *CommentReply
  9579. urlParams_ gensupport.URLParams
  9580. ctx_ context.Context
  9581. }
  9582. // Update: Updates an existing reply.
  9583. func (r *RepliesService) Update(fileId string, commentId string, replyId string, commentreply *CommentReply) *RepliesUpdateCall {
  9584. c := &RepliesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9585. c.fileId = fileId
  9586. c.commentId = commentId
  9587. c.replyId = replyId
  9588. c.commentreply = commentreply
  9589. return c
  9590. }
  9591. // Fields allows partial responses to be retrieved. See
  9592. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9593. // for more information.
  9594. func (c *RepliesUpdateCall) Fields(s ...googleapi.Field) *RepliesUpdateCall {
  9595. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9596. return c
  9597. }
  9598. // Context sets the context to be used in this call's Do method. Any
  9599. // pending HTTP request will be aborted if the provided context is
  9600. // canceled.
  9601. func (c *RepliesUpdateCall) Context(ctx context.Context) *RepliesUpdateCall {
  9602. c.ctx_ = ctx
  9603. return c
  9604. }
  9605. func (c *RepliesUpdateCall) doRequest(alt string) (*http.Response, error) {
  9606. var body io.Reader = nil
  9607. body, err := googleapi.WithoutDataWrapper.JSONReader(c.commentreply)
  9608. if err != nil {
  9609. return nil, err
  9610. }
  9611. ctype := "application/json"
  9612. c.urlParams_.Set("alt", alt)
  9613. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  9614. urls += "?" + c.urlParams_.Encode()
  9615. req, _ := http.NewRequest("PUT", urls, body)
  9616. googleapi.Expand(req.URL, map[string]string{
  9617. "fileId": c.fileId,
  9618. "commentId": c.commentId,
  9619. "replyId": c.replyId,
  9620. })
  9621. req.Header.Set("Content-Type", ctype)
  9622. req.Header.Set("User-Agent", c.s.userAgent())
  9623. if c.ctx_ != nil {
  9624. return ctxhttp.Do(c.ctx_, c.s.client, req)
  9625. }
  9626. return c.s.client.Do(req)
  9627. }
  9628. // Do executes the "drive.replies.update" call.
  9629. // Exactly one of *CommentReply or error will be non-nil. Any non-2xx
  9630. // status code is an error. Response headers are in either
  9631. // *CommentReply.ServerResponse.Header or (if a response was returned at
  9632. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9633. // to check whether the returned error was because
  9634. // http.StatusNotModified was returned.
  9635. func (c *RepliesUpdateCall) Do(opts ...googleapi.CallOption) (*CommentReply, error) {
  9636. gensupport.SetOptions(c.urlParams_, opts...)
  9637. res, err := c.doRequest("json")
  9638. if res != nil && res.StatusCode == http.StatusNotModified {
  9639. if res.Body != nil {
  9640. res.Body.Close()
  9641. }
  9642. return nil, &googleapi.Error{
  9643. Code: res.StatusCode,
  9644. Header: res.Header,
  9645. }
  9646. }
  9647. if err != nil {
  9648. return nil, err
  9649. }
  9650. defer googleapi.CloseBody(res)
  9651. if err := googleapi.CheckResponse(res); err != nil {
  9652. return nil, err
  9653. }
  9654. ret := &CommentReply{
  9655. ServerResponse: googleapi.ServerResponse{
  9656. Header: res.Header,
  9657. HTTPStatusCode: res.StatusCode,
  9658. },
  9659. }
  9660. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  9661. return nil, err
  9662. }
  9663. return ret, nil
  9664. // {
  9665. // "description": "Updates an existing reply.",
  9666. // "httpMethod": "PUT",
  9667. // "id": "drive.replies.update",
  9668. // "parameterOrder": [
  9669. // "fileId",
  9670. // "commentId",
  9671. // "replyId"
  9672. // ],
  9673. // "parameters": {
  9674. // "commentId": {
  9675. // "description": "The ID of the comment.",
  9676. // "location": "path",
  9677. // "required": true,
  9678. // "type": "string"
  9679. // },
  9680. // "fileId": {
  9681. // "description": "The ID of the file.",
  9682. // "location": "path",
  9683. // "required": true,
  9684. // "type": "string"
  9685. // },
  9686. // "replyId": {
  9687. // "description": "The ID of the reply.",
  9688. // "location": "path",
  9689. // "required": true,
  9690. // "type": "string"
  9691. // }
  9692. // },
  9693. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  9694. // "request": {
  9695. // "$ref": "CommentReply"
  9696. // },
  9697. // "response": {
  9698. // "$ref": "CommentReply"
  9699. // },
  9700. // "scopes": [
  9701. // "https://www.googleapis.com/auth/drive",
  9702. // "https://www.googleapis.com/auth/drive.file"
  9703. // ]
  9704. // }
  9705. }
  9706. // method id "drive.revisions.delete":
  9707. type RevisionsDeleteCall struct {
  9708. s *Service
  9709. fileId string
  9710. revisionId string
  9711. urlParams_ gensupport.URLParams
  9712. ctx_ context.Context
  9713. }
  9714. // Delete: Removes a revision.
  9715. func (r *RevisionsService) Delete(fileId string, revisionId string) *RevisionsDeleteCall {
  9716. c := &RevisionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9717. c.fileId = fileId
  9718. c.revisionId = revisionId
  9719. return c
  9720. }
  9721. // Fields allows partial responses to be retrieved. See
  9722. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9723. // for more information.
  9724. func (c *RevisionsDeleteCall) Fields(s ...googleapi.Field) *RevisionsDeleteCall {
  9725. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9726. return c
  9727. }
  9728. // Context sets the context to be used in this call's Do method. Any
  9729. // pending HTTP request will be aborted if the provided context is
  9730. // canceled.
  9731. func (c *RevisionsDeleteCall) Context(ctx context.Context) *RevisionsDeleteCall {
  9732. c.ctx_ = ctx
  9733. return c
  9734. }
  9735. func (c *RevisionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  9736. var body io.Reader = nil
  9737. c.urlParams_.Set("alt", alt)
  9738. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  9739. urls += "?" + c.urlParams_.Encode()
  9740. req, _ := http.NewRequest("DELETE", urls, body)
  9741. googleapi.Expand(req.URL, map[string]string{
  9742. "fileId": c.fileId,
  9743. "revisionId": c.revisionId,
  9744. })
  9745. req.Header.Set("User-Agent", c.s.userAgent())
  9746. if c.ctx_ != nil {
  9747. return ctxhttp.Do(c.ctx_, c.s.client, req)
  9748. }
  9749. return c.s.client.Do(req)
  9750. }
  9751. // Do executes the "drive.revisions.delete" call.
  9752. func (c *RevisionsDeleteCall) Do(opts ...googleapi.CallOption) error {
  9753. gensupport.SetOptions(c.urlParams_, opts...)
  9754. res, err := c.doRequest("json")
  9755. if err != nil {
  9756. return err
  9757. }
  9758. defer googleapi.CloseBody(res)
  9759. if err := googleapi.CheckResponse(res); err != nil {
  9760. return err
  9761. }
  9762. return nil
  9763. // {
  9764. // "description": "Removes a revision.",
  9765. // "httpMethod": "DELETE",
  9766. // "id": "drive.revisions.delete",
  9767. // "parameterOrder": [
  9768. // "fileId",
  9769. // "revisionId"
  9770. // ],
  9771. // "parameters": {
  9772. // "fileId": {
  9773. // "description": "The ID of the file.",
  9774. // "location": "path",
  9775. // "required": true,
  9776. // "type": "string"
  9777. // },
  9778. // "revisionId": {
  9779. // "description": "The ID of the revision.",
  9780. // "location": "path",
  9781. // "required": true,
  9782. // "type": "string"
  9783. // }
  9784. // },
  9785. // "path": "files/{fileId}/revisions/{revisionId}",
  9786. // "scopes": [
  9787. // "https://www.googleapis.com/auth/drive",
  9788. // "https://www.googleapis.com/auth/drive.appdata",
  9789. // "https://www.googleapis.com/auth/drive.file"
  9790. // ]
  9791. // }
  9792. }
  9793. // method id "drive.revisions.get":
  9794. type RevisionsGetCall struct {
  9795. s *Service
  9796. fileId string
  9797. revisionId string
  9798. urlParams_ gensupport.URLParams
  9799. ifNoneMatch_ string
  9800. ctx_ context.Context
  9801. }
  9802. // Get: Gets a specific revision.
  9803. func (r *RevisionsService) Get(fileId string, revisionId string) *RevisionsGetCall {
  9804. c := &RevisionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9805. c.fileId = fileId
  9806. c.revisionId = revisionId
  9807. return c
  9808. }
  9809. // Fields allows partial responses to be retrieved. See
  9810. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9811. // for more information.
  9812. func (c *RevisionsGetCall) Fields(s ...googleapi.Field) *RevisionsGetCall {
  9813. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9814. return c
  9815. }
  9816. // IfNoneMatch sets the optional parameter which makes the operation
  9817. // fail if the object's ETag matches the given value. This is useful for
  9818. // getting updates only after the object has changed since the last
  9819. // request. Use googleapi.IsNotModified to check whether the response
  9820. // error from Do is the result of In-None-Match.
  9821. func (c *RevisionsGetCall) IfNoneMatch(entityTag string) *RevisionsGetCall {
  9822. c.ifNoneMatch_ = entityTag
  9823. return c
  9824. }
  9825. // Context sets the context to be used in this call's Do method. Any
  9826. // pending HTTP request will be aborted if the provided context is
  9827. // canceled.
  9828. func (c *RevisionsGetCall) Context(ctx context.Context) *RevisionsGetCall {
  9829. c.ctx_ = ctx
  9830. return c
  9831. }
  9832. func (c *RevisionsGetCall) doRequest(alt string) (*http.Response, error) {
  9833. var body io.Reader = nil
  9834. c.urlParams_.Set("alt", alt)
  9835. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  9836. urls += "?" + c.urlParams_.Encode()
  9837. req, _ := http.NewRequest("GET", urls, body)
  9838. googleapi.Expand(req.URL, map[string]string{
  9839. "fileId": c.fileId,
  9840. "revisionId": c.revisionId,
  9841. })
  9842. req.Header.Set("User-Agent", c.s.userAgent())
  9843. if c.ifNoneMatch_ != "" {
  9844. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  9845. }
  9846. if c.ctx_ != nil {
  9847. return ctxhttp.Do(c.ctx_, c.s.client, req)
  9848. }
  9849. return c.s.client.Do(req)
  9850. }
  9851. // Do executes the "drive.revisions.get" call.
  9852. // Exactly one of *Revision or error will be non-nil. Any non-2xx status
  9853. // code is an error. Response headers are in either
  9854. // *Revision.ServerResponse.Header or (if a response was returned at
  9855. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9856. // to check whether the returned error was because
  9857. // http.StatusNotModified was returned.
  9858. func (c *RevisionsGetCall) Do(opts ...googleapi.CallOption) (*Revision, error) {
  9859. gensupport.SetOptions(c.urlParams_, opts...)
  9860. res, err := c.doRequest("json")
  9861. if res != nil && res.StatusCode == http.StatusNotModified {
  9862. if res.Body != nil {
  9863. res.Body.Close()
  9864. }
  9865. return nil, &googleapi.Error{
  9866. Code: res.StatusCode,
  9867. Header: res.Header,
  9868. }
  9869. }
  9870. if err != nil {
  9871. return nil, err
  9872. }
  9873. defer googleapi.CloseBody(res)
  9874. if err := googleapi.CheckResponse(res); err != nil {
  9875. return nil, err
  9876. }
  9877. ret := &Revision{
  9878. ServerResponse: googleapi.ServerResponse{
  9879. Header: res.Header,
  9880. HTTPStatusCode: res.StatusCode,
  9881. },
  9882. }
  9883. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  9884. return nil, err
  9885. }
  9886. return ret, nil
  9887. // {
  9888. // "description": "Gets a specific revision.",
  9889. // "httpMethod": "GET",
  9890. // "id": "drive.revisions.get",
  9891. // "parameterOrder": [
  9892. // "fileId",
  9893. // "revisionId"
  9894. // ],
  9895. // "parameters": {
  9896. // "fileId": {
  9897. // "description": "The ID of the file.",
  9898. // "location": "path",
  9899. // "required": true,
  9900. // "type": "string"
  9901. // },
  9902. // "revisionId": {
  9903. // "description": "The ID of the revision.",
  9904. // "location": "path",
  9905. // "required": true,
  9906. // "type": "string"
  9907. // }
  9908. // },
  9909. // "path": "files/{fileId}/revisions/{revisionId}",
  9910. // "response": {
  9911. // "$ref": "Revision"
  9912. // },
  9913. // "scopes": [
  9914. // "https://www.googleapis.com/auth/drive",
  9915. // "https://www.googleapis.com/auth/drive.appdata",
  9916. // "https://www.googleapis.com/auth/drive.file",
  9917. // "https://www.googleapis.com/auth/drive.metadata",
  9918. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  9919. // "https://www.googleapis.com/auth/drive.photos.readonly",
  9920. // "https://www.googleapis.com/auth/drive.readonly"
  9921. // ]
  9922. // }
  9923. }
  9924. // method id "drive.revisions.list":
  9925. type RevisionsListCall struct {
  9926. s *Service
  9927. fileId string
  9928. urlParams_ gensupport.URLParams
  9929. ifNoneMatch_ string
  9930. ctx_ context.Context
  9931. }
  9932. // List: Lists a file's revisions.
  9933. func (r *RevisionsService) List(fileId string) *RevisionsListCall {
  9934. c := &RevisionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9935. c.fileId = fileId
  9936. return c
  9937. }
  9938. // Fields allows partial responses to be retrieved. See
  9939. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9940. // for more information.
  9941. func (c *RevisionsListCall) Fields(s ...googleapi.Field) *RevisionsListCall {
  9942. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9943. return c
  9944. }
  9945. // IfNoneMatch sets the optional parameter which makes the operation
  9946. // fail if the object's ETag matches the given value. This is useful for
  9947. // getting updates only after the object has changed since the last
  9948. // request. Use googleapi.IsNotModified to check whether the response
  9949. // error from Do is the result of In-None-Match.
  9950. func (c *RevisionsListCall) IfNoneMatch(entityTag string) *RevisionsListCall {
  9951. c.ifNoneMatch_ = entityTag
  9952. return c
  9953. }
  9954. // Context sets the context to be used in this call's Do method. Any
  9955. // pending HTTP request will be aborted if the provided context is
  9956. // canceled.
  9957. func (c *RevisionsListCall) Context(ctx context.Context) *RevisionsListCall {
  9958. c.ctx_ = ctx
  9959. return c
  9960. }
  9961. func (c *RevisionsListCall) doRequest(alt string) (*http.Response, error) {
  9962. var body io.Reader = nil
  9963. c.urlParams_.Set("alt", alt)
  9964. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions")
  9965. urls += "?" + c.urlParams_.Encode()
  9966. req, _ := http.NewRequest("GET", urls, body)
  9967. googleapi.Expand(req.URL, map[string]string{
  9968. "fileId": c.fileId,
  9969. })
  9970. req.Header.Set("User-Agent", c.s.userAgent())
  9971. if c.ifNoneMatch_ != "" {
  9972. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  9973. }
  9974. if c.ctx_ != nil {
  9975. return ctxhttp.Do(c.ctx_, c.s.client, req)
  9976. }
  9977. return c.s.client.Do(req)
  9978. }
  9979. // Do executes the "drive.revisions.list" call.
  9980. // Exactly one of *RevisionList or error will be non-nil. Any non-2xx
  9981. // status code is an error. Response headers are in either
  9982. // *RevisionList.ServerResponse.Header or (if a response was returned at
  9983. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9984. // to check whether the returned error was because
  9985. // http.StatusNotModified was returned.
  9986. func (c *RevisionsListCall) Do(opts ...googleapi.CallOption) (*RevisionList, error) {
  9987. gensupport.SetOptions(c.urlParams_, opts...)
  9988. res, err := c.doRequest("json")
  9989. if res != nil && res.StatusCode == http.StatusNotModified {
  9990. if res.Body != nil {
  9991. res.Body.Close()
  9992. }
  9993. return nil, &googleapi.Error{
  9994. Code: res.StatusCode,
  9995. Header: res.Header,
  9996. }
  9997. }
  9998. if err != nil {
  9999. return nil, err
  10000. }
  10001. defer googleapi.CloseBody(res)
  10002. if err := googleapi.CheckResponse(res); err != nil {
  10003. return nil, err
  10004. }
  10005. ret := &RevisionList{
  10006. ServerResponse: googleapi.ServerResponse{
  10007. Header: res.Header,
  10008. HTTPStatusCode: res.StatusCode,
  10009. },
  10010. }
  10011. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  10012. return nil, err
  10013. }
  10014. return ret, nil
  10015. // {
  10016. // "description": "Lists a file's revisions.",
  10017. // "httpMethod": "GET",
  10018. // "id": "drive.revisions.list",
  10019. // "parameterOrder": [
  10020. // "fileId"
  10021. // ],
  10022. // "parameters": {
  10023. // "fileId": {
  10024. // "description": "The ID of the file.",
  10025. // "location": "path",
  10026. // "required": true,
  10027. // "type": "string"
  10028. // }
  10029. // },
  10030. // "path": "files/{fileId}/revisions",
  10031. // "response": {
  10032. // "$ref": "RevisionList"
  10033. // },
  10034. // "scopes": [
  10035. // "https://www.googleapis.com/auth/drive",
  10036. // "https://www.googleapis.com/auth/drive.appdata",
  10037. // "https://www.googleapis.com/auth/drive.file",
  10038. // "https://www.googleapis.com/auth/drive.metadata",
  10039. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  10040. // "https://www.googleapis.com/auth/drive.photos.readonly",
  10041. // "https://www.googleapis.com/auth/drive.readonly"
  10042. // ]
  10043. // }
  10044. }
  10045. // method id "drive.revisions.patch":
  10046. type RevisionsPatchCall struct {
  10047. s *Service
  10048. fileId string
  10049. revisionId string
  10050. revision *Revision
  10051. urlParams_ gensupport.URLParams
  10052. ctx_ context.Context
  10053. }
  10054. // Patch: Updates a revision. This method supports patch semantics.
  10055. func (r *RevisionsService) Patch(fileId string, revisionId string, revision *Revision) *RevisionsPatchCall {
  10056. c := &RevisionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10057. c.fileId = fileId
  10058. c.revisionId = revisionId
  10059. c.revision = revision
  10060. return c
  10061. }
  10062. // Fields allows partial responses to be retrieved. See
  10063. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10064. // for more information.
  10065. func (c *RevisionsPatchCall) Fields(s ...googleapi.Field) *RevisionsPatchCall {
  10066. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10067. return c
  10068. }
  10069. // Context sets the context to be used in this call's Do method. Any
  10070. // pending HTTP request will be aborted if the provided context is
  10071. // canceled.
  10072. func (c *RevisionsPatchCall) Context(ctx context.Context) *RevisionsPatchCall {
  10073. c.ctx_ = ctx
  10074. return c
  10075. }
  10076. func (c *RevisionsPatchCall) doRequest(alt string) (*http.Response, error) {
  10077. var body io.Reader = nil
  10078. body, err := googleapi.WithoutDataWrapper.JSONReader(c.revision)
  10079. if err != nil {
  10080. return nil, err
  10081. }
  10082. ctype := "application/json"
  10083. c.urlParams_.Set("alt", alt)
  10084. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  10085. urls += "?" + c.urlParams_.Encode()
  10086. req, _ := http.NewRequest("PATCH", urls, body)
  10087. googleapi.Expand(req.URL, map[string]string{
  10088. "fileId": c.fileId,
  10089. "revisionId": c.revisionId,
  10090. })
  10091. req.Header.Set("Content-Type", ctype)
  10092. req.Header.Set("User-Agent", c.s.userAgent())
  10093. if c.ctx_ != nil {
  10094. return ctxhttp.Do(c.ctx_, c.s.client, req)
  10095. }
  10096. return c.s.client.Do(req)
  10097. }
  10098. // Do executes the "drive.revisions.patch" call.
  10099. // Exactly one of *Revision or error will be non-nil. Any non-2xx status
  10100. // code is an error. Response headers are in either
  10101. // *Revision.ServerResponse.Header or (if a response was returned at
  10102. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10103. // to check whether the returned error was because
  10104. // http.StatusNotModified was returned.
  10105. func (c *RevisionsPatchCall) Do(opts ...googleapi.CallOption) (*Revision, error) {
  10106. gensupport.SetOptions(c.urlParams_, opts...)
  10107. res, err := c.doRequest("json")
  10108. if res != nil && res.StatusCode == http.StatusNotModified {
  10109. if res.Body != nil {
  10110. res.Body.Close()
  10111. }
  10112. return nil, &googleapi.Error{
  10113. Code: res.StatusCode,
  10114. Header: res.Header,
  10115. }
  10116. }
  10117. if err != nil {
  10118. return nil, err
  10119. }
  10120. defer googleapi.CloseBody(res)
  10121. if err := googleapi.CheckResponse(res); err != nil {
  10122. return nil, err
  10123. }
  10124. ret := &Revision{
  10125. ServerResponse: googleapi.ServerResponse{
  10126. Header: res.Header,
  10127. HTTPStatusCode: res.StatusCode,
  10128. },
  10129. }
  10130. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  10131. return nil, err
  10132. }
  10133. return ret, nil
  10134. // {
  10135. // "description": "Updates a revision. This method supports patch semantics.",
  10136. // "httpMethod": "PATCH",
  10137. // "id": "drive.revisions.patch",
  10138. // "parameterOrder": [
  10139. // "fileId",
  10140. // "revisionId"
  10141. // ],
  10142. // "parameters": {
  10143. // "fileId": {
  10144. // "description": "The ID for the file.",
  10145. // "location": "path",
  10146. // "required": true,
  10147. // "type": "string"
  10148. // },
  10149. // "revisionId": {
  10150. // "description": "The ID for the revision.",
  10151. // "location": "path",
  10152. // "required": true,
  10153. // "type": "string"
  10154. // }
  10155. // },
  10156. // "path": "files/{fileId}/revisions/{revisionId}",
  10157. // "request": {
  10158. // "$ref": "Revision"
  10159. // },
  10160. // "response": {
  10161. // "$ref": "Revision"
  10162. // },
  10163. // "scopes": [
  10164. // "https://www.googleapis.com/auth/drive",
  10165. // "https://www.googleapis.com/auth/drive.appdata",
  10166. // "https://www.googleapis.com/auth/drive.file"
  10167. // ]
  10168. // }
  10169. }
  10170. // method id "drive.revisions.update":
  10171. type RevisionsUpdateCall struct {
  10172. s *Service
  10173. fileId string
  10174. revisionId string
  10175. revision *Revision
  10176. urlParams_ gensupport.URLParams
  10177. ctx_ context.Context
  10178. }
  10179. // Update: Updates a revision.
  10180. func (r *RevisionsService) Update(fileId string, revisionId string, revision *Revision) *RevisionsUpdateCall {
  10181. c := &RevisionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10182. c.fileId = fileId
  10183. c.revisionId = revisionId
  10184. c.revision = revision
  10185. return c
  10186. }
  10187. // Fields allows partial responses to be retrieved. See
  10188. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10189. // for more information.
  10190. func (c *RevisionsUpdateCall) Fields(s ...googleapi.Field) *RevisionsUpdateCall {
  10191. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10192. return c
  10193. }
  10194. // Context sets the context to be used in this call's Do method. Any
  10195. // pending HTTP request will be aborted if the provided context is
  10196. // canceled.
  10197. func (c *RevisionsUpdateCall) Context(ctx context.Context) *RevisionsUpdateCall {
  10198. c.ctx_ = ctx
  10199. return c
  10200. }
  10201. func (c *RevisionsUpdateCall) doRequest(alt string) (*http.Response, error) {
  10202. var body io.Reader = nil
  10203. body, err := googleapi.WithoutDataWrapper.JSONReader(c.revision)
  10204. if err != nil {
  10205. return nil, err
  10206. }
  10207. ctype := "application/json"
  10208. c.urlParams_.Set("alt", alt)
  10209. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  10210. urls += "?" + c.urlParams_.Encode()
  10211. req, _ := http.NewRequest("PUT", urls, body)
  10212. googleapi.Expand(req.URL, map[string]string{
  10213. "fileId": c.fileId,
  10214. "revisionId": c.revisionId,
  10215. })
  10216. req.Header.Set("Content-Type", ctype)
  10217. req.Header.Set("User-Agent", c.s.userAgent())
  10218. if c.ctx_ != nil {
  10219. return ctxhttp.Do(c.ctx_, c.s.client, req)
  10220. }
  10221. return c.s.client.Do(req)
  10222. }
  10223. // Do executes the "drive.revisions.update" call.
  10224. // Exactly one of *Revision or error will be non-nil. Any non-2xx status
  10225. // code is an error. Response headers are in either
  10226. // *Revision.ServerResponse.Header or (if a response was returned at
  10227. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10228. // to check whether the returned error was because
  10229. // http.StatusNotModified was returned.
  10230. func (c *RevisionsUpdateCall) Do(opts ...googleapi.CallOption) (*Revision, error) {
  10231. gensupport.SetOptions(c.urlParams_, opts...)
  10232. res, err := c.doRequest("json")
  10233. if res != nil && res.StatusCode == http.StatusNotModified {
  10234. if res.Body != nil {
  10235. res.Body.Close()
  10236. }
  10237. return nil, &googleapi.Error{
  10238. Code: res.StatusCode,
  10239. Header: res.Header,
  10240. }
  10241. }
  10242. if err != nil {
  10243. return nil, err
  10244. }
  10245. defer googleapi.CloseBody(res)
  10246. if err := googleapi.CheckResponse(res); err != nil {
  10247. return nil, err
  10248. }
  10249. ret := &Revision{
  10250. ServerResponse: googleapi.ServerResponse{
  10251. Header: res.Header,
  10252. HTTPStatusCode: res.StatusCode,
  10253. },
  10254. }
  10255. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  10256. return nil, err
  10257. }
  10258. return ret, nil
  10259. // {
  10260. // "description": "Updates a revision.",
  10261. // "httpMethod": "PUT",
  10262. // "id": "drive.revisions.update",
  10263. // "parameterOrder": [
  10264. // "fileId",
  10265. // "revisionId"
  10266. // ],
  10267. // "parameters": {
  10268. // "fileId": {
  10269. // "description": "The ID for the file.",
  10270. // "location": "path",
  10271. // "required": true,
  10272. // "type": "string"
  10273. // },
  10274. // "revisionId": {
  10275. // "description": "The ID for the revision.",
  10276. // "location": "path",
  10277. // "required": true,
  10278. // "type": "string"
  10279. // }
  10280. // },
  10281. // "path": "files/{fileId}/revisions/{revisionId}",
  10282. // "request": {
  10283. // "$ref": "Revision"
  10284. // },
  10285. // "response": {
  10286. // "$ref": "Revision"
  10287. // },
  10288. // "scopes": [
  10289. // "https://www.googleapis.com/auth/drive",
  10290. // "https://www.googleapis.com/auth/drive.appdata",
  10291. // "https://www.googleapis.com/auth/drive.file"
  10292. // ]
  10293. // }
  10294. }