blogger-gen.go 208 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801
  1. // Package blogger provides access to the Blogger API.
  2. //
  3. // See https://developers.google.com/blogger/docs/3.0/getting_started
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/blogger/v3"
  8. // ...
  9. // bloggerService, err := blogger.New(oauthHttpClient)
  10. package blogger // import "google.golang.org/api/blogger/v3"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "blogger:v3"
  41. const apiName = "blogger"
  42. const apiVersion = "v3"
  43. const basePath = "https://www.googleapis.com/blogger/v3/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // Manage your Blogger account
  47. BloggerScope = "https://www.googleapis.com/auth/blogger"
  48. // View your Blogger account
  49. BloggerReadonlyScope = "https://www.googleapis.com/auth/blogger.readonly"
  50. )
  51. func New(client *http.Client) (*Service, error) {
  52. if client == nil {
  53. return nil, errors.New("client is nil")
  54. }
  55. s := &Service{client: client, BasePath: basePath}
  56. s.BlogUserInfos = NewBlogUserInfosService(s)
  57. s.Blogs = NewBlogsService(s)
  58. s.Comments = NewCommentsService(s)
  59. s.PageViews = NewPageViewsService(s)
  60. s.Pages = NewPagesService(s)
  61. s.PostUserInfos = NewPostUserInfosService(s)
  62. s.Posts = NewPostsService(s)
  63. s.Users = NewUsersService(s)
  64. return s, nil
  65. }
  66. type Service struct {
  67. client *http.Client
  68. BasePath string // API endpoint base URL
  69. UserAgent string // optional additional User-Agent fragment
  70. BlogUserInfos *BlogUserInfosService
  71. Blogs *BlogsService
  72. Comments *CommentsService
  73. PageViews *PageViewsService
  74. Pages *PagesService
  75. PostUserInfos *PostUserInfosService
  76. Posts *PostsService
  77. Users *UsersService
  78. }
  79. func (s *Service) userAgent() string {
  80. if s.UserAgent == "" {
  81. return googleapi.UserAgent
  82. }
  83. return googleapi.UserAgent + " " + s.UserAgent
  84. }
  85. func NewBlogUserInfosService(s *Service) *BlogUserInfosService {
  86. rs := &BlogUserInfosService{s: s}
  87. return rs
  88. }
  89. type BlogUserInfosService struct {
  90. s *Service
  91. }
  92. func NewBlogsService(s *Service) *BlogsService {
  93. rs := &BlogsService{s: s}
  94. return rs
  95. }
  96. type BlogsService struct {
  97. s *Service
  98. }
  99. func NewCommentsService(s *Service) *CommentsService {
  100. rs := &CommentsService{s: s}
  101. return rs
  102. }
  103. type CommentsService struct {
  104. s *Service
  105. }
  106. func NewPageViewsService(s *Service) *PageViewsService {
  107. rs := &PageViewsService{s: s}
  108. return rs
  109. }
  110. type PageViewsService struct {
  111. s *Service
  112. }
  113. func NewPagesService(s *Service) *PagesService {
  114. rs := &PagesService{s: s}
  115. return rs
  116. }
  117. type PagesService struct {
  118. s *Service
  119. }
  120. func NewPostUserInfosService(s *Service) *PostUserInfosService {
  121. rs := &PostUserInfosService{s: s}
  122. return rs
  123. }
  124. type PostUserInfosService struct {
  125. s *Service
  126. }
  127. func NewPostsService(s *Service) *PostsService {
  128. rs := &PostsService{s: s}
  129. return rs
  130. }
  131. type PostsService struct {
  132. s *Service
  133. }
  134. func NewUsersService(s *Service) *UsersService {
  135. rs := &UsersService{s: s}
  136. return rs
  137. }
  138. type UsersService struct {
  139. s *Service
  140. }
  141. type Blog struct {
  142. // CustomMetaData: The JSON custom meta-data for the Blog
  143. CustomMetaData string `json:"customMetaData,omitempty"`
  144. // Description: The description of this blog. This is displayed
  145. // underneath the title.
  146. Description string `json:"description,omitempty"`
  147. // Id: The identifier for this resource.
  148. Id string `json:"id,omitempty"`
  149. // Kind: The kind of this entry. Always blogger#blog
  150. Kind string `json:"kind,omitempty"`
  151. // Locale: The locale this Blog is set to.
  152. Locale *BlogLocale `json:"locale,omitempty"`
  153. // Name: The name of this blog. This is displayed as the title.
  154. Name string `json:"name,omitempty"`
  155. // Pages: The container of pages in this blog.
  156. Pages *BlogPages `json:"pages,omitempty"`
  157. // Posts: The container of posts in this blog.
  158. Posts *BlogPosts `json:"posts,omitempty"`
  159. // Published: RFC 3339 date-time when this blog was published.
  160. Published string `json:"published,omitempty"`
  161. // SelfLink: The API REST URL to fetch this resource from.
  162. SelfLink string `json:"selfLink,omitempty"`
  163. // Status: The status of the blog.
  164. Status string `json:"status,omitempty"`
  165. // Updated: RFC 3339 date-time when this blog was last updated.
  166. Updated string `json:"updated,omitempty"`
  167. // Url: The URL where this blog is published.
  168. Url string `json:"url,omitempty"`
  169. // ServerResponse contains the HTTP response code and headers from the
  170. // server.
  171. googleapi.ServerResponse `json:"-"`
  172. // ForceSendFields is a list of field names (e.g. "CustomMetaData") to
  173. // unconditionally include in API requests. By default, fields with
  174. // empty values are omitted from API requests. However, any non-pointer,
  175. // non-interface field appearing in ForceSendFields will be sent to the
  176. // server regardless of whether the field is empty or not. This may be
  177. // used to include empty fields in Patch requests.
  178. ForceSendFields []string `json:"-"`
  179. }
  180. func (s *Blog) MarshalJSON() ([]byte, error) {
  181. type noMethod Blog
  182. raw := noMethod(*s)
  183. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  184. }
  185. // BlogLocale: The locale this Blog is set to.
  186. type BlogLocale struct {
  187. // Country: The country this blog's locale is set to.
  188. Country string `json:"country,omitempty"`
  189. // Language: The language this blog is authored in.
  190. Language string `json:"language,omitempty"`
  191. // Variant: The language variant this blog is authored in.
  192. Variant string `json:"variant,omitempty"`
  193. // ForceSendFields is a list of field names (e.g. "Country") to
  194. // unconditionally include in API requests. By default, fields with
  195. // empty values are omitted from API requests. However, any non-pointer,
  196. // non-interface field appearing in ForceSendFields will be sent to the
  197. // server regardless of whether the field is empty or not. This may be
  198. // used to include empty fields in Patch requests.
  199. ForceSendFields []string `json:"-"`
  200. }
  201. func (s *BlogLocale) MarshalJSON() ([]byte, error) {
  202. type noMethod BlogLocale
  203. raw := noMethod(*s)
  204. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  205. }
  206. // BlogPages: The container of pages in this blog.
  207. type BlogPages struct {
  208. // SelfLink: The URL of the container for pages in this blog.
  209. SelfLink string `json:"selfLink,omitempty"`
  210. // TotalItems: The count of pages in this blog.
  211. TotalItems int64 `json:"totalItems,omitempty"`
  212. // ForceSendFields is a list of field names (e.g. "SelfLink") to
  213. // unconditionally include in API requests. By default, fields with
  214. // empty values are omitted from API requests. However, any non-pointer,
  215. // non-interface field appearing in ForceSendFields will be sent to the
  216. // server regardless of whether the field is empty or not. This may be
  217. // used to include empty fields in Patch requests.
  218. ForceSendFields []string `json:"-"`
  219. }
  220. func (s *BlogPages) MarshalJSON() ([]byte, error) {
  221. type noMethod BlogPages
  222. raw := noMethod(*s)
  223. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  224. }
  225. // BlogPosts: The container of posts in this blog.
  226. type BlogPosts struct {
  227. // Items: The List of Posts for this Blog.
  228. Items []*Post `json:"items,omitempty"`
  229. // SelfLink: The URL of the container for posts in this blog.
  230. SelfLink string `json:"selfLink,omitempty"`
  231. // TotalItems: The count of posts in this blog.
  232. TotalItems int64 `json:"totalItems,omitempty"`
  233. // ForceSendFields is a list of field names (e.g. "Items") to
  234. // unconditionally include in API requests. By default, fields with
  235. // empty values are omitted from API requests. However, any non-pointer,
  236. // non-interface field appearing in ForceSendFields will be sent to the
  237. // server regardless of whether the field is empty or not. This may be
  238. // used to include empty fields in Patch requests.
  239. ForceSendFields []string `json:"-"`
  240. }
  241. func (s *BlogPosts) MarshalJSON() ([]byte, error) {
  242. type noMethod BlogPosts
  243. raw := noMethod(*s)
  244. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  245. }
  246. type BlogList struct {
  247. // BlogUserInfos: Admin level list of blog per-user information
  248. BlogUserInfos []*BlogUserInfo `json:"blogUserInfos,omitempty"`
  249. // Items: The list of Blogs this user has Authorship or Admin rights
  250. // over.
  251. Items []*Blog `json:"items,omitempty"`
  252. // Kind: The kind of this entity. Always blogger#blogList
  253. Kind string `json:"kind,omitempty"`
  254. // ServerResponse contains the HTTP response code and headers from the
  255. // server.
  256. googleapi.ServerResponse `json:"-"`
  257. // ForceSendFields is a list of field names (e.g. "BlogUserInfos") to
  258. // unconditionally include in API requests. By default, fields with
  259. // empty values are omitted from API requests. However, any non-pointer,
  260. // non-interface field appearing in ForceSendFields will be sent to the
  261. // server regardless of whether the field is empty or not. This may be
  262. // used to include empty fields in Patch requests.
  263. ForceSendFields []string `json:"-"`
  264. }
  265. func (s *BlogList) MarshalJSON() ([]byte, error) {
  266. type noMethod BlogList
  267. raw := noMethod(*s)
  268. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  269. }
  270. type BlogPerUserInfo struct {
  271. // BlogId: ID of the Blog resource
  272. BlogId string `json:"blogId,omitempty"`
  273. // HasAdminAccess: True if the user has Admin level access to the blog.
  274. HasAdminAccess bool `json:"hasAdminAccess,omitempty"`
  275. // Kind: The kind of this entity. Always blogger#blogPerUserInfo
  276. Kind string `json:"kind,omitempty"`
  277. // PhotosAlbumKey: The Photo Album Key for the user when adding photos
  278. // to the blog
  279. PhotosAlbumKey string `json:"photosAlbumKey,omitempty"`
  280. // Role: Access permissions that the user has for the blog (ADMIN,
  281. // AUTHOR, or READER).
  282. Role string `json:"role,omitempty"`
  283. // UserId: ID of the User
  284. UserId string `json:"userId,omitempty"`
  285. // ForceSendFields is a list of field names (e.g. "BlogId") to
  286. // unconditionally include in API requests. By default, fields with
  287. // empty values are omitted from API requests. However, any non-pointer,
  288. // non-interface field appearing in ForceSendFields will be sent to the
  289. // server regardless of whether the field is empty or not. This may be
  290. // used to include empty fields in Patch requests.
  291. ForceSendFields []string `json:"-"`
  292. }
  293. func (s *BlogPerUserInfo) MarshalJSON() ([]byte, error) {
  294. type noMethod BlogPerUserInfo
  295. raw := noMethod(*s)
  296. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  297. }
  298. type BlogUserInfo struct {
  299. // Blog: The Blog resource.
  300. Blog *Blog `json:"blog,omitempty"`
  301. // BlogUserInfo: Information about a User for the Blog.
  302. BlogUserInfo *BlogPerUserInfo `json:"blog_user_info,omitempty"`
  303. // Kind: The kind of this entity. Always blogger#blogUserInfo
  304. Kind string `json:"kind,omitempty"`
  305. // ServerResponse contains the HTTP response code and headers from the
  306. // server.
  307. googleapi.ServerResponse `json:"-"`
  308. // ForceSendFields is a list of field names (e.g. "Blog") to
  309. // unconditionally include in API requests. By default, fields with
  310. // empty values are omitted from API requests. However, any non-pointer,
  311. // non-interface field appearing in ForceSendFields will be sent to the
  312. // server regardless of whether the field is empty or not. This may be
  313. // used to include empty fields in Patch requests.
  314. ForceSendFields []string `json:"-"`
  315. }
  316. func (s *BlogUserInfo) MarshalJSON() ([]byte, error) {
  317. type noMethod BlogUserInfo
  318. raw := noMethod(*s)
  319. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  320. }
  321. type Comment struct {
  322. // Author: The author of this Comment.
  323. Author *CommentAuthor `json:"author,omitempty"`
  324. // Blog: Data about the blog containing this comment.
  325. Blog *CommentBlog `json:"blog,omitempty"`
  326. // Content: The actual content of the comment. May include HTML markup.
  327. Content string `json:"content,omitempty"`
  328. // Id: The identifier for this resource.
  329. Id string `json:"id,omitempty"`
  330. // InReplyTo: Data about the comment this is in reply to.
  331. InReplyTo *CommentInReplyTo `json:"inReplyTo,omitempty"`
  332. // Kind: The kind of this entry. Always blogger#comment
  333. Kind string `json:"kind,omitempty"`
  334. // Post: Data about the post containing this comment.
  335. Post *CommentPost `json:"post,omitempty"`
  336. // Published: RFC 3339 date-time when this comment was published.
  337. Published string `json:"published,omitempty"`
  338. // SelfLink: The API REST URL to fetch this resource from.
  339. SelfLink string `json:"selfLink,omitempty"`
  340. // Status: The status of the comment (only populated for admin users)
  341. Status string `json:"status,omitempty"`
  342. // Updated: RFC 3339 date-time when this comment was last updated.
  343. Updated string `json:"updated,omitempty"`
  344. // ServerResponse contains the HTTP response code and headers from the
  345. // server.
  346. googleapi.ServerResponse `json:"-"`
  347. // ForceSendFields is a list of field names (e.g. "Author") to
  348. // unconditionally include in API requests. By default, fields with
  349. // empty values are omitted from API requests. However, any non-pointer,
  350. // non-interface field appearing in ForceSendFields will be sent to the
  351. // server regardless of whether the field is empty or not. This may be
  352. // used to include empty fields in Patch requests.
  353. ForceSendFields []string `json:"-"`
  354. }
  355. func (s *Comment) MarshalJSON() ([]byte, error) {
  356. type noMethod Comment
  357. raw := noMethod(*s)
  358. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  359. }
  360. // CommentAuthor: The author of this Comment.
  361. type CommentAuthor struct {
  362. // DisplayName: The display name.
  363. DisplayName string `json:"displayName,omitempty"`
  364. // Id: The identifier of the Comment creator.
  365. Id string `json:"id,omitempty"`
  366. // Image: The comment creator's avatar.
  367. Image *CommentAuthorImage `json:"image,omitempty"`
  368. // Url: The URL of the Comment creator's Profile page.
  369. Url string `json:"url,omitempty"`
  370. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  371. // unconditionally include in API requests. By default, fields with
  372. // empty values are omitted from API requests. However, any non-pointer,
  373. // non-interface field appearing in ForceSendFields will be sent to the
  374. // server regardless of whether the field is empty or not. This may be
  375. // used to include empty fields in Patch requests.
  376. ForceSendFields []string `json:"-"`
  377. }
  378. func (s *CommentAuthor) MarshalJSON() ([]byte, error) {
  379. type noMethod CommentAuthor
  380. raw := noMethod(*s)
  381. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  382. }
  383. // CommentAuthorImage: The comment creator's avatar.
  384. type CommentAuthorImage struct {
  385. // Url: The comment creator's avatar URL.
  386. Url string `json:"url,omitempty"`
  387. // ForceSendFields is a list of field names (e.g. "Url") to
  388. // unconditionally include in API requests. By default, fields with
  389. // empty values are omitted from API requests. However, any non-pointer,
  390. // non-interface field appearing in ForceSendFields will be sent to the
  391. // server regardless of whether the field is empty or not. This may be
  392. // used to include empty fields in Patch requests.
  393. ForceSendFields []string `json:"-"`
  394. }
  395. func (s *CommentAuthorImage) MarshalJSON() ([]byte, error) {
  396. type noMethod CommentAuthorImage
  397. raw := noMethod(*s)
  398. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  399. }
  400. // CommentBlog: Data about the blog containing this comment.
  401. type CommentBlog struct {
  402. // Id: The identifier of the blog containing this comment.
  403. Id string `json:"id,omitempty"`
  404. // ForceSendFields is a list of field names (e.g. "Id") to
  405. // unconditionally include in API requests. By default, fields with
  406. // empty values are omitted from API requests. However, any non-pointer,
  407. // non-interface field appearing in ForceSendFields will be sent to the
  408. // server regardless of whether the field is empty or not. This may be
  409. // used to include empty fields in Patch requests.
  410. ForceSendFields []string `json:"-"`
  411. }
  412. func (s *CommentBlog) MarshalJSON() ([]byte, error) {
  413. type noMethod CommentBlog
  414. raw := noMethod(*s)
  415. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  416. }
  417. // CommentInReplyTo: Data about the comment this is in reply to.
  418. type CommentInReplyTo struct {
  419. // Id: The identified of the parent of this comment.
  420. Id string `json:"id,omitempty"`
  421. // ForceSendFields is a list of field names (e.g. "Id") to
  422. // unconditionally include in API requests. By default, fields with
  423. // empty values are omitted from API requests. However, any non-pointer,
  424. // non-interface field appearing in ForceSendFields will be sent to the
  425. // server regardless of whether the field is empty or not. This may be
  426. // used to include empty fields in Patch requests.
  427. ForceSendFields []string `json:"-"`
  428. }
  429. func (s *CommentInReplyTo) MarshalJSON() ([]byte, error) {
  430. type noMethod CommentInReplyTo
  431. raw := noMethod(*s)
  432. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  433. }
  434. // CommentPost: Data about the post containing this comment.
  435. type CommentPost struct {
  436. // Id: The identifier of the post containing this comment.
  437. Id string `json:"id,omitempty"`
  438. // ForceSendFields is a list of field names (e.g. "Id") to
  439. // unconditionally include in API requests. By default, fields with
  440. // empty values are omitted from API requests. However, any non-pointer,
  441. // non-interface field appearing in ForceSendFields will be sent to the
  442. // server regardless of whether the field is empty or not. This may be
  443. // used to include empty fields in Patch requests.
  444. ForceSendFields []string `json:"-"`
  445. }
  446. func (s *CommentPost) MarshalJSON() ([]byte, error) {
  447. type noMethod CommentPost
  448. raw := noMethod(*s)
  449. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  450. }
  451. type CommentList struct {
  452. // Etag: Etag of the response.
  453. Etag string `json:"etag,omitempty"`
  454. // Items: The List of Comments for a Post.
  455. Items []*Comment `json:"items,omitempty"`
  456. // Kind: The kind of this entry. Always blogger#commentList
  457. Kind string `json:"kind,omitempty"`
  458. // NextPageToken: Pagination token to fetch the next page, if one
  459. // exists.
  460. NextPageToken string `json:"nextPageToken,omitempty"`
  461. // PrevPageToken: Pagination token to fetch the previous page, if one
  462. // exists.
  463. PrevPageToken string `json:"prevPageToken,omitempty"`
  464. // ServerResponse contains the HTTP response code and headers from the
  465. // server.
  466. googleapi.ServerResponse `json:"-"`
  467. // ForceSendFields is a list of field names (e.g. "Etag") to
  468. // unconditionally include in API requests. By default, fields with
  469. // empty values are omitted from API requests. However, any non-pointer,
  470. // non-interface field appearing in ForceSendFields will be sent to the
  471. // server regardless of whether the field is empty or not. This may be
  472. // used to include empty fields in Patch requests.
  473. ForceSendFields []string `json:"-"`
  474. }
  475. func (s *CommentList) MarshalJSON() ([]byte, error) {
  476. type noMethod CommentList
  477. raw := noMethod(*s)
  478. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  479. }
  480. type Page struct {
  481. // Author: The author of this Page.
  482. Author *PageAuthor `json:"author,omitempty"`
  483. // Blog: Data about the blog containing this Page.
  484. Blog *PageBlog `json:"blog,omitempty"`
  485. // Content: The body content of this Page, in HTML.
  486. Content string `json:"content,omitempty"`
  487. // Etag: Etag of the resource.
  488. Etag string `json:"etag,omitempty"`
  489. // Id: The identifier for this resource.
  490. Id string `json:"id,omitempty"`
  491. // Kind: The kind of this entity. Always blogger#page
  492. Kind string `json:"kind,omitempty"`
  493. // Published: RFC 3339 date-time when this Page was published.
  494. Published string `json:"published,omitempty"`
  495. // SelfLink: The API REST URL to fetch this resource from.
  496. SelfLink string `json:"selfLink,omitempty"`
  497. // Status: The status of the page for admin resources (either LIVE or
  498. // DRAFT).
  499. Status string `json:"status,omitempty"`
  500. // Title: The title of this entity. This is the name displayed in the
  501. // Admin user interface.
  502. Title string `json:"title,omitempty"`
  503. // Updated: RFC 3339 date-time when this Page was last updated.
  504. Updated string `json:"updated,omitempty"`
  505. // Url: The URL that this Page is displayed at.
  506. Url string `json:"url,omitempty"`
  507. // ServerResponse contains the HTTP response code and headers from the
  508. // server.
  509. googleapi.ServerResponse `json:"-"`
  510. // ForceSendFields is a list of field names (e.g. "Author") to
  511. // unconditionally include in API requests. By default, fields with
  512. // empty values are omitted from API requests. However, any non-pointer,
  513. // non-interface field appearing in ForceSendFields will be sent to the
  514. // server regardless of whether the field is empty or not. This may be
  515. // used to include empty fields in Patch requests.
  516. ForceSendFields []string `json:"-"`
  517. }
  518. func (s *Page) MarshalJSON() ([]byte, error) {
  519. type noMethod Page
  520. raw := noMethod(*s)
  521. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  522. }
  523. // PageAuthor: The author of this Page.
  524. type PageAuthor struct {
  525. // DisplayName: The display name.
  526. DisplayName string `json:"displayName,omitempty"`
  527. // Id: The identifier of the Page creator.
  528. Id string `json:"id,omitempty"`
  529. // Image: The page author's avatar.
  530. Image *PageAuthorImage `json:"image,omitempty"`
  531. // Url: The URL of the Page creator's Profile page.
  532. Url string `json:"url,omitempty"`
  533. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  534. // unconditionally include in API requests. By default, fields with
  535. // empty values are omitted from API requests. However, any non-pointer,
  536. // non-interface field appearing in ForceSendFields will be sent to the
  537. // server regardless of whether the field is empty or not. This may be
  538. // used to include empty fields in Patch requests.
  539. ForceSendFields []string `json:"-"`
  540. }
  541. func (s *PageAuthor) MarshalJSON() ([]byte, error) {
  542. type noMethod PageAuthor
  543. raw := noMethod(*s)
  544. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  545. }
  546. // PageAuthorImage: The page author's avatar.
  547. type PageAuthorImage struct {
  548. // Url: The page author's avatar URL.
  549. Url string `json:"url,omitempty"`
  550. // ForceSendFields is a list of field names (e.g. "Url") to
  551. // unconditionally include in API requests. By default, fields with
  552. // empty values are omitted from API requests. However, any non-pointer,
  553. // non-interface field appearing in ForceSendFields will be sent to the
  554. // server regardless of whether the field is empty or not. This may be
  555. // used to include empty fields in Patch requests.
  556. ForceSendFields []string `json:"-"`
  557. }
  558. func (s *PageAuthorImage) MarshalJSON() ([]byte, error) {
  559. type noMethod PageAuthorImage
  560. raw := noMethod(*s)
  561. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  562. }
  563. // PageBlog: Data about the blog containing this Page.
  564. type PageBlog struct {
  565. // Id: The identifier of the blog containing this page.
  566. Id string `json:"id,omitempty"`
  567. // ForceSendFields is a list of field names (e.g. "Id") to
  568. // unconditionally include in API requests. By default, fields with
  569. // empty values are omitted from API requests. However, any non-pointer,
  570. // non-interface field appearing in ForceSendFields will be sent to the
  571. // server regardless of whether the field is empty or not. This may be
  572. // used to include empty fields in Patch requests.
  573. ForceSendFields []string `json:"-"`
  574. }
  575. func (s *PageBlog) MarshalJSON() ([]byte, error) {
  576. type noMethod PageBlog
  577. raw := noMethod(*s)
  578. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  579. }
  580. type PageList struct {
  581. // Etag: Etag of the response.
  582. Etag string `json:"etag,omitempty"`
  583. // Items: The list of Pages for a Blog.
  584. Items []*Page `json:"items,omitempty"`
  585. // Kind: The kind of this entity. Always blogger#pageList
  586. Kind string `json:"kind,omitempty"`
  587. // NextPageToken: Pagination token to fetch the next page, if one
  588. // exists.
  589. NextPageToken string `json:"nextPageToken,omitempty"`
  590. // ServerResponse contains the HTTP response code and headers from the
  591. // server.
  592. googleapi.ServerResponse `json:"-"`
  593. // ForceSendFields is a list of field names (e.g. "Etag") to
  594. // unconditionally include in API requests. By default, fields with
  595. // empty values are omitted from API requests. However, any non-pointer,
  596. // non-interface field appearing in ForceSendFields will be sent to the
  597. // server regardless of whether the field is empty or not. This may be
  598. // used to include empty fields in Patch requests.
  599. ForceSendFields []string `json:"-"`
  600. }
  601. func (s *PageList) MarshalJSON() ([]byte, error) {
  602. type noMethod PageList
  603. raw := noMethod(*s)
  604. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  605. }
  606. type Pageviews struct {
  607. // BlogId: Blog Id
  608. BlogId string `json:"blogId,omitempty"`
  609. // Counts: The container of posts in this blog.
  610. Counts []*PageviewsCounts `json:"counts,omitempty"`
  611. // Kind: The kind of this entry. Always blogger#page_views
  612. Kind string `json:"kind,omitempty"`
  613. // ServerResponse contains the HTTP response code and headers from the
  614. // server.
  615. googleapi.ServerResponse `json:"-"`
  616. // ForceSendFields is a list of field names (e.g. "BlogId") to
  617. // unconditionally include in API requests. By default, fields with
  618. // empty values are omitted from API requests. However, any non-pointer,
  619. // non-interface field appearing in ForceSendFields will be sent to the
  620. // server regardless of whether the field is empty or not. This may be
  621. // used to include empty fields in Patch requests.
  622. ForceSendFields []string `json:"-"`
  623. }
  624. func (s *Pageviews) MarshalJSON() ([]byte, error) {
  625. type noMethod Pageviews
  626. raw := noMethod(*s)
  627. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  628. }
  629. type PageviewsCounts struct {
  630. // Count: Count of page views for the given time range
  631. Count int64 `json:"count,omitempty,string"`
  632. // TimeRange: Time range the given count applies to
  633. TimeRange string `json:"timeRange,omitempty"`
  634. // ForceSendFields is a list of field names (e.g. "Count") to
  635. // unconditionally include in API requests. By default, fields with
  636. // empty values are omitted from API requests. However, any non-pointer,
  637. // non-interface field appearing in ForceSendFields will be sent to the
  638. // server regardless of whether the field is empty or not. This may be
  639. // used to include empty fields in Patch requests.
  640. ForceSendFields []string `json:"-"`
  641. }
  642. func (s *PageviewsCounts) MarshalJSON() ([]byte, error) {
  643. type noMethod PageviewsCounts
  644. raw := noMethod(*s)
  645. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  646. }
  647. type Post struct {
  648. // Author: The author of this Post.
  649. Author *PostAuthor `json:"author,omitempty"`
  650. // Blog: Data about the blog containing this Post.
  651. Blog *PostBlog `json:"blog,omitempty"`
  652. // Content: The content of the Post. May contain HTML markup.
  653. Content string `json:"content,omitempty"`
  654. // CustomMetaData: The JSON meta-data for the Post.
  655. CustomMetaData string `json:"customMetaData,omitempty"`
  656. // Etag: Etag of the resource.
  657. Etag string `json:"etag,omitempty"`
  658. // Id: The identifier of this Post.
  659. Id string `json:"id,omitempty"`
  660. // Images: Display image for the Post.
  661. Images []*PostImages `json:"images,omitempty"`
  662. // Kind: The kind of this entity. Always blogger#post
  663. Kind string `json:"kind,omitempty"`
  664. // Labels: The list of labels this Post was tagged with.
  665. Labels []string `json:"labels,omitempty"`
  666. // Location: The location for geotagged posts.
  667. Location *PostLocation `json:"location,omitempty"`
  668. // Published: RFC 3339 date-time when this Post was published.
  669. Published string `json:"published,omitempty"`
  670. // ReaderComments: Comment control and display setting for readers of
  671. // this post.
  672. ReaderComments string `json:"readerComments,omitempty"`
  673. // Replies: The container of comments on this Post.
  674. Replies *PostReplies `json:"replies,omitempty"`
  675. // SelfLink: The API REST URL to fetch this resource from.
  676. SelfLink string `json:"selfLink,omitempty"`
  677. // Status: Status of the post. Only set for admin-level requests
  678. Status string `json:"status,omitempty"`
  679. // Title: The title of the Post.
  680. Title string `json:"title,omitempty"`
  681. // TitleLink: The title link URL, similar to atom's related link.
  682. TitleLink string `json:"titleLink,omitempty"`
  683. // Updated: RFC 3339 date-time when this Post was last updated.
  684. Updated string `json:"updated,omitempty"`
  685. // Url: The URL where this Post is displayed.
  686. Url string `json:"url,omitempty"`
  687. // ServerResponse contains the HTTP response code and headers from the
  688. // server.
  689. googleapi.ServerResponse `json:"-"`
  690. // ForceSendFields is a list of field names (e.g. "Author") to
  691. // unconditionally include in API requests. By default, fields with
  692. // empty values are omitted from API requests. However, any non-pointer,
  693. // non-interface field appearing in ForceSendFields will be sent to the
  694. // server regardless of whether the field is empty or not. This may be
  695. // used to include empty fields in Patch requests.
  696. ForceSendFields []string `json:"-"`
  697. }
  698. func (s *Post) MarshalJSON() ([]byte, error) {
  699. type noMethod Post
  700. raw := noMethod(*s)
  701. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  702. }
  703. // PostAuthor: The author of this Post.
  704. type PostAuthor struct {
  705. // DisplayName: The display name.
  706. DisplayName string `json:"displayName,omitempty"`
  707. // Id: The identifier of the Post creator.
  708. Id string `json:"id,omitempty"`
  709. // Image: The Post author's avatar.
  710. Image *PostAuthorImage `json:"image,omitempty"`
  711. // Url: The URL of the Post creator's Profile page.
  712. Url string `json:"url,omitempty"`
  713. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  714. // unconditionally include in API requests. By default, fields with
  715. // empty values are omitted from API requests. However, any non-pointer,
  716. // non-interface field appearing in ForceSendFields will be sent to the
  717. // server regardless of whether the field is empty or not. This may be
  718. // used to include empty fields in Patch requests.
  719. ForceSendFields []string `json:"-"`
  720. }
  721. func (s *PostAuthor) MarshalJSON() ([]byte, error) {
  722. type noMethod PostAuthor
  723. raw := noMethod(*s)
  724. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  725. }
  726. // PostAuthorImage: The Post author's avatar.
  727. type PostAuthorImage struct {
  728. // Url: The Post author's avatar URL.
  729. Url string `json:"url,omitempty"`
  730. // ForceSendFields is a list of field names (e.g. "Url") to
  731. // unconditionally include in API requests. By default, fields with
  732. // empty values are omitted from API requests. However, any non-pointer,
  733. // non-interface field appearing in ForceSendFields will be sent to the
  734. // server regardless of whether the field is empty or not. This may be
  735. // used to include empty fields in Patch requests.
  736. ForceSendFields []string `json:"-"`
  737. }
  738. func (s *PostAuthorImage) MarshalJSON() ([]byte, error) {
  739. type noMethod PostAuthorImage
  740. raw := noMethod(*s)
  741. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  742. }
  743. // PostBlog: Data about the blog containing this Post.
  744. type PostBlog struct {
  745. // Id: The identifier of the Blog that contains this Post.
  746. Id string `json:"id,omitempty"`
  747. // ForceSendFields is a list of field names (e.g. "Id") to
  748. // unconditionally include in API requests. By default, fields with
  749. // empty values are omitted from API requests. However, any non-pointer,
  750. // non-interface field appearing in ForceSendFields will be sent to the
  751. // server regardless of whether the field is empty or not. This may be
  752. // used to include empty fields in Patch requests.
  753. ForceSendFields []string `json:"-"`
  754. }
  755. func (s *PostBlog) MarshalJSON() ([]byte, error) {
  756. type noMethod PostBlog
  757. raw := noMethod(*s)
  758. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  759. }
  760. type PostImages struct {
  761. Url string `json:"url,omitempty"`
  762. // ForceSendFields is a list of field names (e.g. "Url") to
  763. // unconditionally include in API requests. By default, fields with
  764. // empty values are omitted from API requests. However, any non-pointer,
  765. // non-interface field appearing in ForceSendFields will be sent to the
  766. // server regardless of whether the field is empty or not. This may be
  767. // used to include empty fields in Patch requests.
  768. ForceSendFields []string `json:"-"`
  769. }
  770. func (s *PostImages) MarshalJSON() ([]byte, error) {
  771. type noMethod PostImages
  772. raw := noMethod(*s)
  773. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  774. }
  775. // PostLocation: The location for geotagged posts.
  776. type PostLocation struct {
  777. // Lat: Location's latitude.
  778. Lat float64 `json:"lat,omitempty"`
  779. // Lng: Location's longitude.
  780. Lng float64 `json:"lng,omitempty"`
  781. // Name: Location name.
  782. Name string `json:"name,omitempty"`
  783. // Span: Location's viewport span. Can be used when rendering a map
  784. // preview.
  785. Span string `json:"span,omitempty"`
  786. // ForceSendFields is a list of field names (e.g. "Lat") to
  787. // unconditionally include in API requests. By default, fields with
  788. // empty values are omitted from API requests. However, any non-pointer,
  789. // non-interface field appearing in ForceSendFields will be sent to the
  790. // server regardless of whether the field is empty or not. This may be
  791. // used to include empty fields in Patch requests.
  792. ForceSendFields []string `json:"-"`
  793. }
  794. func (s *PostLocation) MarshalJSON() ([]byte, error) {
  795. type noMethod PostLocation
  796. raw := noMethod(*s)
  797. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  798. }
  799. // PostReplies: The container of comments on this Post.
  800. type PostReplies struct {
  801. // Items: The List of Comments for this Post.
  802. Items []*Comment `json:"items,omitempty"`
  803. // SelfLink: The URL of the comments on this post.
  804. SelfLink string `json:"selfLink,omitempty"`
  805. // TotalItems: The count of comments on this post.
  806. TotalItems int64 `json:"totalItems,omitempty,string"`
  807. // ForceSendFields is a list of field names (e.g. "Items") to
  808. // unconditionally include in API requests. By default, fields with
  809. // empty values are omitted from API requests. However, any non-pointer,
  810. // non-interface field appearing in ForceSendFields will be sent to the
  811. // server regardless of whether the field is empty or not. This may be
  812. // used to include empty fields in Patch requests.
  813. ForceSendFields []string `json:"-"`
  814. }
  815. func (s *PostReplies) MarshalJSON() ([]byte, error) {
  816. type noMethod PostReplies
  817. raw := noMethod(*s)
  818. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  819. }
  820. type PostList struct {
  821. // Etag: Etag of the response.
  822. Etag string `json:"etag,omitempty"`
  823. // Items: The list of Posts for this Blog.
  824. Items []*Post `json:"items,omitempty"`
  825. // Kind: The kind of this entity. Always blogger#postList
  826. Kind string `json:"kind,omitempty"`
  827. // NextPageToken: Pagination token to fetch the next page, if one
  828. // exists.
  829. NextPageToken string `json:"nextPageToken,omitempty"`
  830. // ServerResponse contains the HTTP response code and headers from the
  831. // server.
  832. googleapi.ServerResponse `json:"-"`
  833. // ForceSendFields is a list of field names (e.g. "Etag") to
  834. // unconditionally include in API requests. By default, fields with
  835. // empty values are omitted from API requests. However, any non-pointer,
  836. // non-interface field appearing in ForceSendFields will be sent to the
  837. // server regardless of whether the field is empty or not. This may be
  838. // used to include empty fields in Patch requests.
  839. ForceSendFields []string `json:"-"`
  840. }
  841. func (s *PostList) MarshalJSON() ([]byte, error) {
  842. type noMethod PostList
  843. raw := noMethod(*s)
  844. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  845. }
  846. type PostPerUserInfo struct {
  847. // BlogId: ID of the Blog that the post resource belongs to.
  848. BlogId string `json:"blogId,omitempty"`
  849. // HasEditAccess: True if the user has Author level access to the post.
  850. HasEditAccess bool `json:"hasEditAccess,omitempty"`
  851. // Kind: The kind of this entity. Always blogger#postPerUserInfo
  852. Kind string `json:"kind,omitempty"`
  853. // PostId: ID of the Post resource.
  854. PostId string `json:"postId,omitempty"`
  855. // UserId: ID of the User.
  856. UserId string `json:"userId,omitempty"`
  857. // ForceSendFields is a list of field names (e.g. "BlogId") to
  858. // unconditionally include in API requests. By default, fields with
  859. // empty values are omitted from API requests. However, any non-pointer,
  860. // non-interface field appearing in ForceSendFields will be sent to the
  861. // server regardless of whether the field is empty or not. This may be
  862. // used to include empty fields in Patch requests.
  863. ForceSendFields []string `json:"-"`
  864. }
  865. func (s *PostPerUserInfo) MarshalJSON() ([]byte, error) {
  866. type noMethod PostPerUserInfo
  867. raw := noMethod(*s)
  868. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  869. }
  870. type PostUserInfo struct {
  871. // Kind: The kind of this entity. Always blogger#postUserInfo
  872. Kind string `json:"kind,omitempty"`
  873. // Post: The Post resource.
  874. Post *Post `json:"post,omitempty"`
  875. // PostUserInfo: Information about a User for the Post.
  876. PostUserInfo *PostPerUserInfo `json:"post_user_info,omitempty"`
  877. // ServerResponse contains the HTTP response code and headers from the
  878. // server.
  879. googleapi.ServerResponse `json:"-"`
  880. // ForceSendFields is a list of field names (e.g. "Kind") to
  881. // unconditionally include in API requests. By default, fields with
  882. // empty values are omitted from API requests. However, any non-pointer,
  883. // non-interface field appearing in ForceSendFields will be sent to the
  884. // server regardless of whether the field is empty or not. This may be
  885. // used to include empty fields in Patch requests.
  886. ForceSendFields []string `json:"-"`
  887. }
  888. func (s *PostUserInfo) MarshalJSON() ([]byte, error) {
  889. type noMethod PostUserInfo
  890. raw := noMethod(*s)
  891. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  892. }
  893. type PostUserInfosList struct {
  894. // Items: The list of Posts with User information for the post, for this
  895. // Blog.
  896. Items []*PostUserInfo `json:"items,omitempty"`
  897. // Kind: The kind of this entity. Always blogger#postList
  898. Kind string `json:"kind,omitempty"`
  899. // NextPageToken: Pagination token to fetch the next page, if one
  900. // exists.
  901. NextPageToken string `json:"nextPageToken,omitempty"`
  902. // ServerResponse contains the HTTP response code and headers from the
  903. // server.
  904. googleapi.ServerResponse `json:"-"`
  905. // ForceSendFields is a list of field names (e.g. "Items") to
  906. // unconditionally include in API requests. By default, fields with
  907. // empty values are omitted from API requests. However, any non-pointer,
  908. // non-interface field appearing in ForceSendFields will be sent to the
  909. // server regardless of whether the field is empty or not. This may be
  910. // used to include empty fields in Patch requests.
  911. ForceSendFields []string `json:"-"`
  912. }
  913. func (s *PostUserInfosList) MarshalJSON() ([]byte, error) {
  914. type noMethod PostUserInfosList
  915. raw := noMethod(*s)
  916. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  917. }
  918. type User struct {
  919. // About: Profile summary information.
  920. About string `json:"about,omitempty"`
  921. // Blogs: The container of blogs for this user.
  922. Blogs *UserBlogs `json:"blogs,omitempty"`
  923. // Created: The timestamp of when this profile was created, in seconds
  924. // since epoch.
  925. Created string `json:"created,omitempty"`
  926. // DisplayName: The display name.
  927. DisplayName string `json:"displayName,omitempty"`
  928. // Id: The identifier for this User.
  929. Id string `json:"id,omitempty"`
  930. // Kind: The kind of this entity. Always blogger#user
  931. Kind string `json:"kind,omitempty"`
  932. // Locale: This user's locale
  933. Locale *UserLocale `json:"locale,omitempty"`
  934. // SelfLink: The API REST URL to fetch this resource from.
  935. SelfLink string `json:"selfLink,omitempty"`
  936. // Url: The user's profile page.
  937. Url string `json:"url,omitempty"`
  938. // ServerResponse contains the HTTP response code and headers from the
  939. // server.
  940. googleapi.ServerResponse `json:"-"`
  941. // ForceSendFields is a list of field names (e.g. "About") to
  942. // unconditionally include in API requests. By default, fields with
  943. // empty values are omitted from API requests. However, any non-pointer,
  944. // non-interface field appearing in ForceSendFields will be sent to the
  945. // server regardless of whether the field is empty or not. This may be
  946. // used to include empty fields in Patch requests.
  947. ForceSendFields []string `json:"-"`
  948. }
  949. func (s *User) MarshalJSON() ([]byte, error) {
  950. type noMethod User
  951. raw := noMethod(*s)
  952. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  953. }
  954. // UserBlogs: The container of blogs for this user.
  955. type UserBlogs struct {
  956. // SelfLink: The URL of the Blogs for this user.
  957. SelfLink string `json:"selfLink,omitempty"`
  958. // ForceSendFields is a list of field names (e.g. "SelfLink") to
  959. // unconditionally include in API requests. By default, fields with
  960. // empty values are omitted from API requests. However, any non-pointer,
  961. // non-interface field appearing in ForceSendFields will be sent to the
  962. // server regardless of whether the field is empty or not. This may be
  963. // used to include empty fields in Patch requests.
  964. ForceSendFields []string `json:"-"`
  965. }
  966. func (s *UserBlogs) MarshalJSON() ([]byte, error) {
  967. type noMethod UserBlogs
  968. raw := noMethod(*s)
  969. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  970. }
  971. // UserLocale: This user's locale
  972. type UserLocale struct {
  973. // Country: The user's country setting.
  974. Country string `json:"country,omitempty"`
  975. // Language: The user's language setting.
  976. Language string `json:"language,omitempty"`
  977. // Variant: The user's language variant setting.
  978. Variant string `json:"variant,omitempty"`
  979. // ForceSendFields is a list of field names (e.g. "Country") to
  980. // unconditionally include in API requests. By default, fields with
  981. // empty values are omitted from API requests. However, any non-pointer,
  982. // non-interface field appearing in ForceSendFields will be sent to the
  983. // server regardless of whether the field is empty or not. This may be
  984. // used to include empty fields in Patch requests.
  985. ForceSendFields []string `json:"-"`
  986. }
  987. func (s *UserLocale) MarshalJSON() ([]byte, error) {
  988. type noMethod UserLocale
  989. raw := noMethod(*s)
  990. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  991. }
  992. // method id "blogger.blogUserInfos.get":
  993. type BlogUserInfosGetCall struct {
  994. s *Service
  995. userId string
  996. blogId string
  997. urlParams_ gensupport.URLParams
  998. ifNoneMatch_ string
  999. ctx_ context.Context
  1000. }
  1001. // Get: Gets one blog and user info pair by blogId and userId.
  1002. func (r *BlogUserInfosService) Get(userId string, blogId string) *BlogUserInfosGetCall {
  1003. c := &BlogUserInfosGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1004. c.userId = userId
  1005. c.blogId = blogId
  1006. return c
  1007. }
  1008. // MaxPosts sets the optional parameter "maxPosts": Maximum number of
  1009. // posts to pull back with the blog.
  1010. func (c *BlogUserInfosGetCall) MaxPosts(maxPosts int64) *BlogUserInfosGetCall {
  1011. c.urlParams_.Set("maxPosts", fmt.Sprint(maxPosts))
  1012. return c
  1013. }
  1014. // Fields allows partial responses to be retrieved. See
  1015. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1016. // for more information.
  1017. func (c *BlogUserInfosGetCall) Fields(s ...googleapi.Field) *BlogUserInfosGetCall {
  1018. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1019. return c
  1020. }
  1021. // IfNoneMatch sets the optional parameter which makes the operation
  1022. // fail if the object's ETag matches the given value. This is useful for
  1023. // getting updates only after the object has changed since the last
  1024. // request. Use googleapi.IsNotModified to check whether the response
  1025. // error from Do is the result of In-None-Match.
  1026. func (c *BlogUserInfosGetCall) IfNoneMatch(entityTag string) *BlogUserInfosGetCall {
  1027. c.ifNoneMatch_ = entityTag
  1028. return c
  1029. }
  1030. // Context sets the context to be used in this call's Do method. Any
  1031. // pending HTTP request will be aborted if the provided context is
  1032. // canceled.
  1033. func (c *BlogUserInfosGetCall) Context(ctx context.Context) *BlogUserInfosGetCall {
  1034. c.ctx_ = ctx
  1035. return c
  1036. }
  1037. func (c *BlogUserInfosGetCall) doRequest(alt string) (*http.Response, error) {
  1038. var body io.Reader = nil
  1039. c.urlParams_.Set("alt", alt)
  1040. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userId}/blogs/{blogId}")
  1041. urls += "?" + c.urlParams_.Encode()
  1042. req, _ := http.NewRequest("GET", urls, body)
  1043. googleapi.Expand(req.URL, map[string]string{
  1044. "userId": c.userId,
  1045. "blogId": c.blogId,
  1046. })
  1047. req.Header.Set("User-Agent", c.s.userAgent())
  1048. if c.ifNoneMatch_ != "" {
  1049. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1050. }
  1051. if c.ctx_ != nil {
  1052. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1053. }
  1054. return c.s.client.Do(req)
  1055. }
  1056. // Do executes the "blogger.blogUserInfos.get" call.
  1057. // Exactly one of *BlogUserInfo or error will be non-nil. Any non-2xx
  1058. // status code is an error. Response headers are in either
  1059. // *BlogUserInfo.ServerResponse.Header or (if a response was returned at
  1060. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1061. // to check whether the returned error was because
  1062. // http.StatusNotModified was returned.
  1063. func (c *BlogUserInfosGetCall) Do(opts ...googleapi.CallOption) (*BlogUserInfo, error) {
  1064. gensupport.SetOptions(c.urlParams_, opts...)
  1065. res, err := c.doRequest("json")
  1066. if res != nil && res.StatusCode == http.StatusNotModified {
  1067. if res.Body != nil {
  1068. res.Body.Close()
  1069. }
  1070. return nil, &googleapi.Error{
  1071. Code: res.StatusCode,
  1072. Header: res.Header,
  1073. }
  1074. }
  1075. if err != nil {
  1076. return nil, err
  1077. }
  1078. defer googleapi.CloseBody(res)
  1079. if err := googleapi.CheckResponse(res); err != nil {
  1080. return nil, err
  1081. }
  1082. ret := &BlogUserInfo{
  1083. ServerResponse: googleapi.ServerResponse{
  1084. Header: res.Header,
  1085. HTTPStatusCode: res.StatusCode,
  1086. },
  1087. }
  1088. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1089. return nil, err
  1090. }
  1091. return ret, nil
  1092. // {
  1093. // "description": "Gets one blog and user info pair by blogId and userId.",
  1094. // "httpMethod": "GET",
  1095. // "id": "blogger.blogUserInfos.get",
  1096. // "parameterOrder": [
  1097. // "userId",
  1098. // "blogId"
  1099. // ],
  1100. // "parameters": {
  1101. // "blogId": {
  1102. // "description": "The ID of the blog to get.",
  1103. // "location": "path",
  1104. // "required": true,
  1105. // "type": "string"
  1106. // },
  1107. // "maxPosts": {
  1108. // "description": "Maximum number of posts to pull back with the blog.",
  1109. // "format": "uint32",
  1110. // "location": "query",
  1111. // "type": "integer"
  1112. // },
  1113. // "userId": {
  1114. // "description": "ID of the user whose blogs are to be fetched. Either the word 'self' (sans quote marks) or the user's profile identifier.",
  1115. // "location": "path",
  1116. // "required": true,
  1117. // "type": "string"
  1118. // }
  1119. // },
  1120. // "path": "users/{userId}/blogs/{blogId}",
  1121. // "response": {
  1122. // "$ref": "BlogUserInfo"
  1123. // },
  1124. // "scopes": [
  1125. // "https://www.googleapis.com/auth/blogger",
  1126. // "https://www.googleapis.com/auth/blogger.readonly"
  1127. // ]
  1128. // }
  1129. }
  1130. // method id "blogger.blogs.get":
  1131. type BlogsGetCall struct {
  1132. s *Service
  1133. blogId string
  1134. urlParams_ gensupport.URLParams
  1135. ifNoneMatch_ string
  1136. ctx_ context.Context
  1137. }
  1138. // Get: Gets one blog by ID.
  1139. func (r *BlogsService) Get(blogId string) *BlogsGetCall {
  1140. c := &BlogsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1141. c.blogId = blogId
  1142. return c
  1143. }
  1144. // MaxPosts sets the optional parameter "maxPosts": Maximum number of
  1145. // posts to pull back with the blog.
  1146. func (c *BlogsGetCall) MaxPosts(maxPosts int64) *BlogsGetCall {
  1147. c.urlParams_.Set("maxPosts", fmt.Sprint(maxPosts))
  1148. return c
  1149. }
  1150. // View sets the optional parameter "view": Access level with which to
  1151. // view the blog. Note that some fields require elevated access.
  1152. //
  1153. // Possible values:
  1154. // "ADMIN" - Admin level detail.
  1155. // "AUTHOR" - Author level detail.
  1156. // "READER" - Reader level detail.
  1157. func (c *BlogsGetCall) View(view string) *BlogsGetCall {
  1158. c.urlParams_.Set("view", view)
  1159. return c
  1160. }
  1161. // Fields allows partial responses to be retrieved. See
  1162. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1163. // for more information.
  1164. func (c *BlogsGetCall) Fields(s ...googleapi.Field) *BlogsGetCall {
  1165. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1166. return c
  1167. }
  1168. // IfNoneMatch sets the optional parameter which makes the operation
  1169. // fail if the object's ETag matches the given value. This is useful for
  1170. // getting updates only after the object has changed since the last
  1171. // request. Use googleapi.IsNotModified to check whether the response
  1172. // error from Do is the result of In-None-Match.
  1173. func (c *BlogsGetCall) IfNoneMatch(entityTag string) *BlogsGetCall {
  1174. c.ifNoneMatch_ = entityTag
  1175. return c
  1176. }
  1177. // Context sets the context to be used in this call's Do method. Any
  1178. // pending HTTP request will be aborted if the provided context is
  1179. // canceled.
  1180. func (c *BlogsGetCall) Context(ctx context.Context) *BlogsGetCall {
  1181. c.ctx_ = ctx
  1182. return c
  1183. }
  1184. func (c *BlogsGetCall) doRequest(alt string) (*http.Response, error) {
  1185. var body io.Reader = nil
  1186. c.urlParams_.Set("alt", alt)
  1187. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}")
  1188. urls += "?" + c.urlParams_.Encode()
  1189. req, _ := http.NewRequest("GET", urls, body)
  1190. googleapi.Expand(req.URL, map[string]string{
  1191. "blogId": c.blogId,
  1192. })
  1193. req.Header.Set("User-Agent", c.s.userAgent())
  1194. if c.ifNoneMatch_ != "" {
  1195. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1196. }
  1197. if c.ctx_ != nil {
  1198. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1199. }
  1200. return c.s.client.Do(req)
  1201. }
  1202. // Do executes the "blogger.blogs.get" call.
  1203. // Exactly one of *Blog or error will be non-nil. Any non-2xx status
  1204. // code is an error. Response headers are in either
  1205. // *Blog.ServerResponse.Header or (if a response was returned at all) in
  1206. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1207. // whether the returned error was because http.StatusNotModified was
  1208. // returned.
  1209. func (c *BlogsGetCall) Do(opts ...googleapi.CallOption) (*Blog, error) {
  1210. gensupport.SetOptions(c.urlParams_, opts...)
  1211. res, err := c.doRequest("json")
  1212. if res != nil && res.StatusCode == http.StatusNotModified {
  1213. if res.Body != nil {
  1214. res.Body.Close()
  1215. }
  1216. return nil, &googleapi.Error{
  1217. Code: res.StatusCode,
  1218. Header: res.Header,
  1219. }
  1220. }
  1221. if err != nil {
  1222. return nil, err
  1223. }
  1224. defer googleapi.CloseBody(res)
  1225. if err := googleapi.CheckResponse(res); err != nil {
  1226. return nil, err
  1227. }
  1228. ret := &Blog{
  1229. ServerResponse: googleapi.ServerResponse{
  1230. Header: res.Header,
  1231. HTTPStatusCode: res.StatusCode,
  1232. },
  1233. }
  1234. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1235. return nil, err
  1236. }
  1237. return ret, nil
  1238. // {
  1239. // "description": "Gets one blog by ID.",
  1240. // "httpMethod": "GET",
  1241. // "id": "blogger.blogs.get",
  1242. // "parameterOrder": [
  1243. // "blogId"
  1244. // ],
  1245. // "parameters": {
  1246. // "blogId": {
  1247. // "description": "The ID of the blog to get.",
  1248. // "location": "path",
  1249. // "required": true,
  1250. // "type": "string"
  1251. // },
  1252. // "maxPosts": {
  1253. // "description": "Maximum number of posts to pull back with the blog.",
  1254. // "format": "uint32",
  1255. // "location": "query",
  1256. // "type": "integer"
  1257. // },
  1258. // "view": {
  1259. // "description": "Access level with which to view the blog. Note that some fields require elevated access.",
  1260. // "enum": [
  1261. // "ADMIN",
  1262. // "AUTHOR",
  1263. // "READER"
  1264. // ],
  1265. // "enumDescriptions": [
  1266. // "Admin level detail.",
  1267. // "Author level detail.",
  1268. // "Reader level detail."
  1269. // ],
  1270. // "location": "query",
  1271. // "type": "string"
  1272. // }
  1273. // },
  1274. // "path": "blogs/{blogId}",
  1275. // "response": {
  1276. // "$ref": "Blog"
  1277. // },
  1278. // "scopes": [
  1279. // "https://www.googleapis.com/auth/blogger",
  1280. // "https://www.googleapis.com/auth/blogger.readonly"
  1281. // ]
  1282. // }
  1283. }
  1284. // method id "blogger.blogs.getByUrl":
  1285. type BlogsGetByUrlCall struct {
  1286. s *Service
  1287. urlParams_ gensupport.URLParams
  1288. ifNoneMatch_ string
  1289. ctx_ context.Context
  1290. }
  1291. // GetByUrl: Retrieve a Blog by URL.
  1292. func (r *BlogsService) GetByUrl(url string) *BlogsGetByUrlCall {
  1293. c := &BlogsGetByUrlCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1294. c.urlParams_.Set("url", url)
  1295. return c
  1296. }
  1297. // View sets the optional parameter "view": Access level with which to
  1298. // view the blog. Note that some fields require elevated access.
  1299. //
  1300. // Possible values:
  1301. // "ADMIN" - Admin level detail.
  1302. // "AUTHOR" - Author level detail.
  1303. // "READER" - Reader level detail.
  1304. func (c *BlogsGetByUrlCall) View(view string) *BlogsGetByUrlCall {
  1305. c.urlParams_.Set("view", view)
  1306. return c
  1307. }
  1308. // Fields allows partial responses to be retrieved. See
  1309. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1310. // for more information.
  1311. func (c *BlogsGetByUrlCall) Fields(s ...googleapi.Field) *BlogsGetByUrlCall {
  1312. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1313. return c
  1314. }
  1315. // IfNoneMatch sets the optional parameter which makes the operation
  1316. // fail if the object's ETag matches the given value. This is useful for
  1317. // getting updates only after the object has changed since the last
  1318. // request. Use googleapi.IsNotModified to check whether the response
  1319. // error from Do is the result of In-None-Match.
  1320. func (c *BlogsGetByUrlCall) IfNoneMatch(entityTag string) *BlogsGetByUrlCall {
  1321. c.ifNoneMatch_ = entityTag
  1322. return c
  1323. }
  1324. // Context sets the context to be used in this call's Do method. Any
  1325. // pending HTTP request will be aborted if the provided context is
  1326. // canceled.
  1327. func (c *BlogsGetByUrlCall) Context(ctx context.Context) *BlogsGetByUrlCall {
  1328. c.ctx_ = ctx
  1329. return c
  1330. }
  1331. func (c *BlogsGetByUrlCall) doRequest(alt string) (*http.Response, error) {
  1332. var body io.Reader = nil
  1333. c.urlParams_.Set("alt", alt)
  1334. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/byurl")
  1335. urls += "?" + c.urlParams_.Encode()
  1336. req, _ := http.NewRequest("GET", urls, body)
  1337. googleapi.SetOpaque(req.URL)
  1338. req.Header.Set("User-Agent", c.s.userAgent())
  1339. if c.ifNoneMatch_ != "" {
  1340. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1341. }
  1342. if c.ctx_ != nil {
  1343. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1344. }
  1345. return c.s.client.Do(req)
  1346. }
  1347. // Do executes the "blogger.blogs.getByUrl" call.
  1348. // Exactly one of *Blog or error will be non-nil. Any non-2xx status
  1349. // code is an error. Response headers are in either
  1350. // *Blog.ServerResponse.Header or (if a response was returned at all) in
  1351. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1352. // whether the returned error was because http.StatusNotModified was
  1353. // returned.
  1354. func (c *BlogsGetByUrlCall) Do(opts ...googleapi.CallOption) (*Blog, error) {
  1355. gensupport.SetOptions(c.urlParams_, opts...)
  1356. res, err := c.doRequest("json")
  1357. if res != nil && res.StatusCode == http.StatusNotModified {
  1358. if res.Body != nil {
  1359. res.Body.Close()
  1360. }
  1361. return nil, &googleapi.Error{
  1362. Code: res.StatusCode,
  1363. Header: res.Header,
  1364. }
  1365. }
  1366. if err != nil {
  1367. return nil, err
  1368. }
  1369. defer googleapi.CloseBody(res)
  1370. if err := googleapi.CheckResponse(res); err != nil {
  1371. return nil, err
  1372. }
  1373. ret := &Blog{
  1374. ServerResponse: googleapi.ServerResponse{
  1375. Header: res.Header,
  1376. HTTPStatusCode: res.StatusCode,
  1377. },
  1378. }
  1379. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1380. return nil, err
  1381. }
  1382. return ret, nil
  1383. // {
  1384. // "description": "Retrieve a Blog by URL.",
  1385. // "httpMethod": "GET",
  1386. // "id": "blogger.blogs.getByUrl",
  1387. // "parameterOrder": [
  1388. // "url"
  1389. // ],
  1390. // "parameters": {
  1391. // "url": {
  1392. // "description": "The URL of the blog to retrieve.",
  1393. // "location": "query",
  1394. // "required": true,
  1395. // "type": "string"
  1396. // },
  1397. // "view": {
  1398. // "description": "Access level with which to view the blog. Note that some fields require elevated access.",
  1399. // "enum": [
  1400. // "ADMIN",
  1401. // "AUTHOR",
  1402. // "READER"
  1403. // ],
  1404. // "enumDescriptions": [
  1405. // "Admin level detail.",
  1406. // "Author level detail.",
  1407. // "Reader level detail."
  1408. // ],
  1409. // "location": "query",
  1410. // "type": "string"
  1411. // }
  1412. // },
  1413. // "path": "blogs/byurl",
  1414. // "response": {
  1415. // "$ref": "Blog"
  1416. // },
  1417. // "scopes": [
  1418. // "https://www.googleapis.com/auth/blogger",
  1419. // "https://www.googleapis.com/auth/blogger.readonly"
  1420. // ]
  1421. // }
  1422. }
  1423. // method id "blogger.blogs.listByUser":
  1424. type BlogsListByUserCall struct {
  1425. s *Service
  1426. userId string
  1427. urlParams_ gensupport.URLParams
  1428. ifNoneMatch_ string
  1429. ctx_ context.Context
  1430. }
  1431. // ListByUser: Retrieves a list of blogs, possibly filtered.
  1432. func (r *BlogsService) ListByUser(userId string) *BlogsListByUserCall {
  1433. c := &BlogsListByUserCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1434. c.userId = userId
  1435. return c
  1436. }
  1437. // FetchUserInfo sets the optional parameter "fetchUserInfo": Whether
  1438. // the response is a list of blogs with per-user information instead of
  1439. // just blogs.
  1440. func (c *BlogsListByUserCall) FetchUserInfo(fetchUserInfo bool) *BlogsListByUserCall {
  1441. c.urlParams_.Set("fetchUserInfo", fmt.Sprint(fetchUserInfo))
  1442. return c
  1443. }
  1444. // Role sets the optional parameter "role": User access types for blogs
  1445. // to include in the results, e.g. AUTHOR will return blogs where the
  1446. // user has author level access. If no roles are specified, defaults to
  1447. // ADMIN and AUTHOR roles.
  1448. //
  1449. // Possible values:
  1450. // "ADMIN" - Admin role - Blogs where the user has Admin level access.
  1451. // "AUTHOR" - Author role - Blogs where the user has Author level
  1452. // access.
  1453. // "READER" - Reader role - Blogs where the user has Reader level
  1454. // access (to a private blog).
  1455. func (c *BlogsListByUserCall) Role(role ...string) *BlogsListByUserCall {
  1456. c.urlParams_.SetMulti("role", append([]string{}, role...))
  1457. return c
  1458. }
  1459. // Status sets the optional parameter "status": Blog statuses to include
  1460. // in the result (default: Live blogs only). Note that ADMIN access is
  1461. // required to view deleted blogs.
  1462. //
  1463. // Possible values:
  1464. // "DELETED" - Blog has been deleted by an administrator.
  1465. // "LIVE" (default) - Blog is currently live.
  1466. func (c *BlogsListByUserCall) Status(status ...string) *BlogsListByUserCall {
  1467. c.urlParams_.SetMulti("status", append([]string{}, status...))
  1468. return c
  1469. }
  1470. // View sets the optional parameter "view": Access level with which to
  1471. // view the blogs. Note that some fields require elevated access.
  1472. //
  1473. // Possible values:
  1474. // "ADMIN" - Admin level detail.
  1475. // "AUTHOR" - Author level detail.
  1476. // "READER" - Reader level detail.
  1477. func (c *BlogsListByUserCall) View(view string) *BlogsListByUserCall {
  1478. c.urlParams_.Set("view", view)
  1479. return c
  1480. }
  1481. // Fields allows partial responses to be retrieved. See
  1482. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1483. // for more information.
  1484. func (c *BlogsListByUserCall) Fields(s ...googleapi.Field) *BlogsListByUserCall {
  1485. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1486. return c
  1487. }
  1488. // IfNoneMatch sets the optional parameter which makes the operation
  1489. // fail if the object's ETag matches the given value. This is useful for
  1490. // getting updates only after the object has changed since the last
  1491. // request. Use googleapi.IsNotModified to check whether the response
  1492. // error from Do is the result of In-None-Match.
  1493. func (c *BlogsListByUserCall) IfNoneMatch(entityTag string) *BlogsListByUserCall {
  1494. c.ifNoneMatch_ = entityTag
  1495. return c
  1496. }
  1497. // Context sets the context to be used in this call's Do method. Any
  1498. // pending HTTP request will be aborted if the provided context is
  1499. // canceled.
  1500. func (c *BlogsListByUserCall) Context(ctx context.Context) *BlogsListByUserCall {
  1501. c.ctx_ = ctx
  1502. return c
  1503. }
  1504. func (c *BlogsListByUserCall) doRequest(alt string) (*http.Response, error) {
  1505. var body io.Reader = nil
  1506. c.urlParams_.Set("alt", alt)
  1507. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userId}/blogs")
  1508. urls += "?" + c.urlParams_.Encode()
  1509. req, _ := http.NewRequest("GET", urls, body)
  1510. googleapi.Expand(req.URL, map[string]string{
  1511. "userId": c.userId,
  1512. })
  1513. req.Header.Set("User-Agent", c.s.userAgent())
  1514. if c.ifNoneMatch_ != "" {
  1515. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1516. }
  1517. if c.ctx_ != nil {
  1518. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1519. }
  1520. return c.s.client.Do(req)
  1521. }
  1522. // Do executes the "blogger.blogs.listByUser" call.
  1523. // Exactly one of *BlogList or error will be non-nil. Any non-2xx status
  1524. // code is an error. Response headers are in either
  1525. // *BlogList.ServerResponse.Header or (if a response was returned at
  1526. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1527. // to check whether the returned error was because
  1528. // http.StatusNotModified was returned.
  1529. func (c *BlogsListByUserCall) Do(opts ...googleapi.CallOption) (*BlogList, error) {
  1530. gensupport.SetOptions(c.urlParams_, opts...)
  1531. res, err := c.doRequest("json")
  1532. if res != nil && res.StatusCode == http.StatusNotModified {
  1533. if res.Body != nil {
  1534. res.Body.Close()
  1535. }
  1536. return nil, &googleapi.Error{
  1537. Code: res.StatusCode,
  1538. Header: res.Header,
  1539. }
  1540. }
  1541. if err != nil {
  1542. return nil, err
  1543. }
  1544. defer googleapi.CloseBody(res)
  1545. if err := googleapi.CheckResponse(res); err != nil {
  1546. return nil, err
  1547. }
  1548. ret := &BlogList{
  1549. ServerResponse: googleapi.ServerResponse{
  1550. Header: res.Header,
  1551. HTTPStatusCode: res.StatusCode,
  1552. },
  1553. }
  1554. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1555. return nil, err
  1556. }
  1557. return ret, nil
  1558. // {
  1559. // "description": "Retrieves a list of blogs, possibly filtered.",
  1560. // "httpMethod": "GET",
  1561. // "id": "blogger.blogs.listByUser",
  1562. // "parameterOrder": [
  1563. // "userId"
  1564. // ],
  1565. // "parameters": {
  1566. // "fetchUserInfo": {
  1567. // "description": "Whether the response is a list of blogs with per-user information instead of just blogs.",
  1568. // "location": "query",
  1569. // "type": "boolean"
  1570. // },
  1571. // "role": {
  1572. // "description": "User access types for blogs to include in the results, e.g. AUTHOR will return blogs where the user has author level access. If no roles are specified, defaults to ADMIN and AUTHOR roles.",
  1573. // "enum": [
  1574. // "ADMIN",
  1575. // "AUTHOR",
  1576. // "READER"
  1577. // ],
  1578. // "enumDescriptions": [
  1579. // "Admin role - Blogs where the user has Admin level access.",
  1580. // "Author role - Blogs where the user has Author level access.",
  1581. // "Reader role - Blogs where the user has Reader level access (to a private blog)."
  1582. // ],
  1583. // "location": "query",
  1584. // "repeated": true,
  1585. // "type": "string"
  1586. // },
  1587. // "status": {
  1588. // "default": "LIVE",
  1589. // "description": "Blog statuses to include in the result (default: Live blogs only). Note that ADMIN access is required to view deleted blogs.",
  1590. // "enum": [
  1591. // "DELETED",
  1592. // "LIVE"
  1593. // ],
  1594. // "enumDescriptions": [
  1595. // "Blog has been deleted by an administrator.",
  1596. // "Blog is currently live."
  1597. // ],
  1598. // "location": "query",
  1599. // "repeated": true,
  1600. // "type": "string"
  1601. // },
  1602. // "userId": {
  1603. // "description": "ID of the user whose blogs are to be fetched. Either the word 'self' (sans quote marks) or the user's profile identifier.",
  1604. // "location": "path",
  1605. // "required": true,
  1606. // "type": "string"
  1607. // },
  1608. // "view": {
  1609. // "description": "Access level with which to view the blogs. Note that some fields require elevated access.",
  1610. // "enum": [
  1611. // "ADMIN",
  1612. // "AUTHOR",
  1613. // "READER"
  1614. // ],
  1615. // "enumDescriptions": [
  1616. // "Admin level detail.",
  1617. // "Author level detail.",
  1618. // "Reader level detail."
  1619. // ],
  1620. // "location": "query",
  1621. // "type": "string"
  1622. // }
  1623. // },
  1624. // "path": "users/{userId}/blogs",
  1625. // "response": {
  1626. // "$ref": "BlogList"
  1627. // },
  1628. // "scopes": [
  1629. // "https://www.googleapis.com/auth/blogger",
  1630. // "https://www.googleapis.com/auth/blogger.readonly"
  1631. // ]
  1632. // }
  1633. }
  1634. // method id "blogger.comments.approve":
  1635. type CommentsApproveCall struct {
  1636. s *Service
  1637. blogId string
  1638. postId string
  1639. commentId string
  1640. urlParams_ gensupport.URLParams
  1641. ctx_ context.Context
  1642. }
  1643. // Approve: Marks a comment as not spam.
  1644. func (r *CommentsService) Approve(blogId string, postId string, commentId string) *CommentsApproveCall {
  1645. c := &CommentsApproveCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1646. c.blogId = blogId
  1647. c.postId = postId
  1648. c.commentId = commentId
  1649. return c
  1650. }
  1651. // Fields allows partial responses to be retrieved. See
  1652. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1653. // for more information.
  1654. func (c *CommentsApproveCall) Fields(s ...googleapi.Field) *CommentsApproveCall {
  1655. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1656. return c
  1657. }
  1658. // Context sets the context to be used in this call's Do method. Any
  1659. // pending HTTP request will be aborted if the provided context is
  1660. // canceled.
  1661. func (c *CommentsApproveCall) Context(ctx context.Context) *CommentsApproveCall {
  1662. c.ctx_ = ctx
  1663. return c
  1664. }
  1665. func (c *CommentsApproveCall) doRequest(alt string) (*http.Response, error) {
  1666. var body io.Reader = nil
  1667. c.urlParams_.Set("alt", alt)
  1668. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}/comments/{commentId}/approve")
  1669. urls += "?" + c.urlParams_.Encode()
  1670. req, _ := http.NewRequest("POST", urls, body)
  1671. googleapi.Expand(req.URL, map[string]string{
  1672. "blogId": c.blogId,
  1673. "postId": c.postId,
  1674. "commentId": c.commentId,
  1675. })
  1676. req.Header.Set("User-Agent", c.s.userAgent())
  1677. if c.ctx_ != nil {
  1678. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1679. }
  1680. return c.s.client.Do(req)
  1681. }
  1682. // Do executes the "blogger.comments.approve" call.
  1683. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  1684. // code is an error. Response headers are in either
  1685. // *Comment.ServerResponse.Header or (if a response was returned at all)
  1686. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1687. // check whether the returned error was because http.StatusNotModified
  1688. // was returned.
  1689. func (c *CommentsApproveCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  1690. gensupport.SetOptions(c.urlParams_, opts...)
  1691. res, err := c.doRequest("json")
  1692. if res != nil && res.StatusCode == http.StatusNotModified {
  1693. if res.Body != nil {
  1694. res.Body.Close()
  1695. }
  1696. return nil, &googleapi.Error{
  1697. Code: res.StatusCode,
  1698. Header: res.Header,
  1699. }
  1700. }
  1701. if err != nil {
  1702. return nil, err
  1703. }
  1704. defer googleapi.CloseBody(res)
  1705. if err := googleapi.CheckResponse(res); err != nil {
  1706. return nil, err
  1707. }
  1708. ret := &Comment{
  1709. ServerResponse: googleapi.ServerResponse{
  1710. Header: res.Header,
  1711. HTTPStatusCode: res.StatusCode,
  1712. },
  1713. }
  1714. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1715. return nil, err
  1716. }
  1717. return ret, nil
  1718. // {
  1719. // "description": "Marks a comment as not spam.",
  1720. // "httpMethod": "POST",
  1721. // "id": "blogger.comments.approve",
  1722. // "parameterOrder": [
  1723. // "blogId",
  1724. // "postId",
  1725. // "commentId"
  1726. // ],
  1727. // "parameters": {
  1728. // "blogId": {
  1729. // "description": "The ID of the Blog.",
  1730. // "location": "path",
  1731. // "required": true,
  1732. // "type": "string"
  1733. // },
  1734. // "commentId": {
  1735. // "description": "The ID of the comment to mark as not spam.",
  1736. // "location": "path",
  1737. // "required": true,
  1738. // "type": "string"
  1739. // },
  1740. // "postId": {
  1741. // "description": "The ID of the Post.",
  1742. // "location": "path",
  1743. // "required": true,
  1744. // "type": "string"
  1745. // }
  1746. // },
  1747. // "path": "blogs/{blogId}/posts/{postId}/comments/{commentId}/approve",
  1748. // "response": {
  1749. // "$ref": "Comment"
  1750. // },
  1751. // "scopes": [
  1752. // "https://www.googleapis.com/auth/blogger"
  1753. // ]
  1754. // }
  1755. }
  1756. // method id "blogger.comments.delete":
  1757. type CommentsDeleteCall struct {
  1758. s *Service
  1759. blogId string
  1760. postId string
  1761. commentId string
  1762. urlParams_ gensupport.URLParams
  1763. ctx_ context.Context
  1764. }
  1765. // Delete: Delete a comment by ID.
  1766. func (r *CommentsService) Delete(blogId string, postId string, commentId string) *CommentsDeleteCall {
  1767. c := &CommentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1768. c.blogId = blogId
  1769. c.postId = postId
  1770. c.commentId = commentId
  1771. return c
  1772. }
  1773. // Fields allows partial responses to be retrieved. See
  1774. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1775. // for more information.
  1776. func (c *CommentsDeleteCall) Fields(s ...googleapi.Field) *CommentsDeleteCall {
  1777. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1778. return c
  1779. }
  1780. // Context sets the context to be used in this call's Do method. Any
  1781. // pending HTTP request will be aborted if the provided context is
  1782. // canceled.
  1783. func (c *CommentsDeleteCall) Context(ctx context.Context) *CommentsDeleteCall {
  1784. c.ctx_ = ctx
  1785. return c
  1786. }
  1787. func (c *CommentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1788. var body io.Reader = nil
  1789. c.urlParams_.Set("alt", alt)
  1790. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}/comments/{commentId}")
  1791. urls += "?" + c.urlParams_.Encode()
  1792. req, _ := http.NewRequest("DELETE", urls, body)
  1793. googleapi.Expand(req.URL, map[string]string{
  1794. "blogId": c.blogId,
  1795. "postId": c.postId,
  1796. "commentId": c.commentId,
  1797. })
  1798. req.Header.Set("User-Agent", c.s.userAgent())
  1799. if c.ctx_ != nil {
  1800. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1801. }
  1802. return c.s.client.Do(req)
  1803. }
  1804. // Do executes the "blogger.comments.delete" call.
  1805. func (c *CommentsDeleteCall) Do(opts ...googleapi.CallOption) error {
  1806. gensupport.SetOptions(c.urlParams_, opts...)
  1807. res, err := c.doRequest("json")
  1808. if err != nil {
  1809. return err
  1810. }
  1811. defer googleapi.CloseBody(res)
  1812. if err := googleapi.CheckResponse(res); err != nil {
  1813. return err
  1814. }
  1815. return nil
  1816. // {
  1817. // "description": "Delete a comment by ID.",
  1818. // "httpMethod": "DELETE",
  1819. // "id": "blogger.comments.delete",
  1820. // "parameterOrder": [
  1821. // "blogId",
  1822. // "postId",
  1823. // "commentId"
  1824. // ],
  1825. // "parameters": {
  1826. // "blogId": {
  1827. // "description": "The ID of the Blog.",
  1828. // "location": "path",
  1829. // "required": true,
  1830. // "type": "string"
  1831. // },
  1832. // "commentId": {
  1833. // "description": "The ID of the comment to delete.",
  1834. // "location": "path",
  1835. // "required": true,
  1836. // "type": "string"
  1837. // },
  1838. // "postId": {
  1839. // "description": "The ID of the Post.",
  1840. // "location": "path",
  1841. // "required": true,
  1842. // "type": "string"
  1843. // }
  1844. // },
  1845. // "path": "blogs/{blogId}/posts/{postId}/comments/{commentId}",
  1846. // "scopes": [
  1847. // "https://www.googleapis.com/auth/blogger"
  1848. // ]
  1849. // }
  1850. }
  1851. // method id "blogger.comments.get":
  1852. type CommentsGetCall struct {
  1853. s *Service
  1854. blogId string
  1855. postId string
  1856. commentId string
  1857. urlParams_ gensupport.URLParams
  1858. ifNoneMatch_ string
  1859. ctx_ context.Context
  1860. }
  1861. // Get: Gets one comment by ID.
  1862. func (r *CommentsService) Get(blogId string, postId string, commentId string) *CommentsGetCall {
  1863. c := &CommentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1864. c.blogId = blogId
  1865. c.postId = postId
  1866. c.commentId = commentId
  1867. return c
  1868. }
  1869. // View sets the optional parameter "view": Access level for the
  1870. // requested comment (default: READER). Note that some comments will
  1871. // require elevated permissions, for example comments where the parent
  1872. // posts which is in a draft state, or comments that are pending
  1873. // moderation.
  1874. //
  1875. // Possible values:
  1876. // "ADMIN" - Admin level detail
  1877. // "AUTHOR" - Author level detail
  1878. // "READER" - Admin level detail
  1879. func (c *CommentsGetCall) View(view string) *CommentsGetCall {
  1880. c.urlParams_.Set("view", view)
  1881. return c
  1882. }
  1883. // Fields allows partial responses to be retrieved. See
  1884. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1885. // for more information.
  1886. func (c *CommentsGetCall) Fields(s ...googleapi.Field) *CommentsGetCall {
  1887. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1888. return c
  1889. }
  1890. // IfNoneMatch sets the optional parameter which makes the operation
  1891. // fail if the object's ETag matches the given value. This is useful for
  1892. // getting updates only after the object has changed since the last
  1893. // request. Use googleapi.IsNotModified to check whether the response
  1894. // error from Do is the result of In-None-Match.
  1895. func (c *CommentsGetCall) IfNoneMatch(entityTag string) *CommentsGetCall {
  1896. c.ifNoneMatch_ = entityTag
  1897. return c
  1898. }
  1899. // Context sets the context to be used in this call's Do method. Any
  1900. // pending HTTP request will be aborted if the provided context is
  1901. // canceled.
  1902. func (c *CommentsGetCall) Context(ctx context.Context) *CommentsGetCall {
  1903. c.ctx_ = ctx
  1904. return c
  1905. }
  1906. func (c *CommentsGetCall) doRequest(alt string) (*http.Response, error) {
  1907. var body io.Reader = nil
  1908. c.urlParams_.Set("alt", alt)
  1909. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}/comments/{commentId}")
  1910. urls += "?" + c.urlParams_.Encode()
  1911. req, _ := http.NewRequest("GET", urls, body)
  1912. googleapi.Expand(req.URL, map[string]string{
  1913. "blogId": c.blogId,
  1914. "postId": c.postId,
  1915. "commentId": c.commentId,
  1916. })
  1917. req.Header.Set("User-Agent", c.s.userAgent())
  1918. if c.ifNoneMatch_ != "" {
  1919. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1920. }
  1921. if c.ctx_ != nil {
  1922. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1923. }
  1924. return c.s.client.Do(req)
  1925. }
  1926. // Do executes the "blogger.comments.get" call.
  1927. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  1928. // code is an error. Response headers are in either
  1929. // *Comment.ServerResponse.Header or (if a response was returned at all)
  1930. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1931. // check whether the returned error was because http.StatusNotModified
  1932. // was returned.
  1933. func (c *CommentsGetCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  1934. gensupport.SetOptions(c.urlParams_, opts...)
  1935. res, err := c.doRequest("json")
  1936. if res != nil && res.StatusCode == http.StatusNotModified {
  1937. if res.Body != nil {
  1938. res.Body.Close()
  1939. }
  1940. return nil, &googleapi.Error{
  1941. Code: res.StatusCode,
  1942. Header: res.Header,
  1943. }
  1944. }
  1945. if err != nil {
  1946. return nil, err
  1947. }
  1948. defer googleapi.CloseBody(res)
  1949. if err := googleapi.CheckResponse(res); err != nil {
  1950. return nil, err
  1951. }
  1952. ret := &Comment{
  1953. ServerResponse: googleapi.ServerResponse{
  1954. Header: res.Header,
  1955. HTTPStatusCode: res.StatusCode,
  1956. },
  1957. }
  1958. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1959. return nil, err
  1960. }
  1961. return ret, nil
  1962. // {
  1963. // "description": "Gets one comment by ID.",
  1964. // "httpMethod": "GET",
  1965. // "id": "blogger.comments.get",
  1966. // "parameterOrder": [
  1967. // "blogId",
  1968. // "postId",
  1969. // "commentId"
  1970. // ],
  1971. // "parameters": {
  1972. // "blogId": {
  1973. // "description": "ID of the blog to containing the comment.",
  1974. // "location": "path",
  1975. // "required": true,
  1976. // "type": "string"
  1977. // },
  1978. // "commentId": {
  1979. // "description": "The ID of the comment to get.",
  1980. // "location": "path",
  1981. // "required": true,
  1982. // "type": "string"
  1983. // },
  1984. // "postId": {
  1985. // "description": "ID of the post to fetch posts from.",
  1986. // "location": "path",
  1987. // "required": true,
  1988. // "type": "string"
  1989. // },
  1990. // "view": {
  1991. // "description": "Access level for the requested comment (default: READER). Note that some comments will require elevated permissions, for example comments where the parent posts which is in a draft state, or comments that are pending moderation.",
  1992. // "enum": [
  1993. // "ADMIN",
  1994. // "AUTHOR",
  1995. // "READER"
  1996. // ],
  1997. // "enumDescriptions": [
  1998. // "Admin level detail",
  1999. // "Author level detail",
  2000. // "Admin level detail"
  2001. // ],
  2002. // "location": "query",
  2003. // "type": "string"
  2004. // }
  2005. // },
  2006. // "path": "blogs/{blogId}/posts/{postId}/comments/{commentId}",
  2007. // "response": {
  2008. // "$ref": "Comment"
  2009. // },
  2010. // "scopes": [
  2011. // "https://www.googleapis.com/auth/blogger",
  2012. // "https://www.googleapis.com/auth/blogger.readonly"
  2013. // ]
  2014. // }
  2015. }
  2016. // method id "blogger.comments.list":
  2017. type CommentsListCall struct {
  2018. s *Service
  2019. blogId string
  2020. postId string
  2021. urlParams_ gensupport.URLParams
  2022. ifNoneMatch_ string
  2023. ctx_ context.Context
  2024. }
  2025. // List: Retrieves the comments for a post, possibly filtered.
  2026. func (r *CommentsService) List(blogId string, postId string) *CommentsListCall {
  2027. c := &CommentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2028. c.blogId = blogId
  2029. c.postId = postId
  2030. return c
  2031. }
  2032. // EndDate sets the optional parameter "endDate": Latest date of comment
  2033. // to fetch, a date-time with RFC 3339 formatting.
  2034. func (c *CommentsListCall) EndDate(endDate string) *CommentsListCall {
  2035. c.urlParams_.Set("endDate", endDate)
  2036. return c
  2037. }
  2038. // FetchBodies sets the optional parameter "fetchBodies": Whether the
  2039. // body content of the comments is included.
  2040. func (c *CommentsListCall) FetchBodies(fetchBodies bool) *CommentsListCall {
  2041. c.urlParams_.Set("fetchBodies", fmt.Sprint(fetchBodies))
  2042. return c
  2043. }
  2044. // MaxResults sets the optional parameter "maxResults": Maximum number
  2045. // of comments to include in the result.
  2046. func (c *CommentsListCall) MaxResults(maxResults int64) *CommentsListCall {
  2047. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2048. return c
  2049. }
  2050. // PageToken sets the optional parameter "pageToken": Continuation token
  2051. // if request is paged.
  2052. func (c *CommentsListCall) PageToken(pageToken string) *CommentsListCall {
  2053. c.urlParams_.Set("pageToken", pageToken)
  2054. return c
  2055. }
  2056. // StartDate sets the optional parameter "startDate": Earliest date of
  2057. // comment to fetch, a date-time with RFC 3339 formatting.
  2058. func (c *CommentsListCall) StartDate(startDate string) *CommentsListCall {
  2059. c.urlParams_.Set("startDate", startDate)
  2060. return c
  2061. }
  2062. // Status sets the optional parameter "status":
  2063. //
  2064. // Possible values:
  2065. // "emptied" - Comments that have had their content removed
  2066. // "live" - Comments that are publicly visible
  2067. // "pending" - Comments that are awaiting administrator approval
  2068. // "spam" - Comments marked as spam by the administrator
  2069. func (c *CommentsListCall) Status(status ...string) *CommentsListCall {
  2070. c.urlParams_.SetMulti("status", append([]string{}, status...))
  2071. return c
  2072. }
  2073. // View sets the optional parameter "view": Access level with which to
  2074. // view the returned result. Note that some fields require elevated
  2075. // access.
  2076. //
  2077. // Possible values:
  2078. // "ADMIN" - Admin level detail
  2079. // "AUTHOR" - Author level detail
  2080. // "READER" - Reader level detail
  2081. func (c *CommentsListCall) View(view string) *CommentsListCall {
  2082. c.urlParams_.Set("view", view)
  2083. return c
  2084. }
  2085. // Fields allows partial responses to be retrieved. See
  2086. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2087. // for more information.
  2088. func (c *CommentsListCall) Fields(s ...googleapi.Field) *CommentsListCall {
  2089. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2090. return c
  2091. }
  2092. // IfNoneMatch sets the optional parameter which makes the operation
  2093. // fail if the object's ETag matches the given value. This is useful for
  2094. // getting updates only after the object has changed since the last
  2095. // request. Use googleapi.IsNotModified to check whether the response
  2096. // error from Do is the result of In-None-Match.
  2097. func (c *CommentsListCall) IfNoneMatch(entityTag string) *CommentsListCall {
  2098. c.ifNoneMatch_ = entityTag
  2099. return c
  2100. }
  2101. // Context sets the context to be used in this call's Do method. Any
  2102. // pending HTTP request will be aborted if the provided context is
  2103. // canceled.
  2104. func (c *CommentsListCall) Context(ctx context.Context) *CommentsListCall {
  2105. c.ctx_ = ctx
  2106. return c
  2107. }
  2108. func (c *CommentsListCall) doRequest(alt string) (*http.Response, error) {
  2109. var body io.Reader = nil
  2110. c.urlParams_.Set("alt", alt)
  2111. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}/comments")
  2112. urls += "?" + c.urlParams_.Encode()
  2113. req, _ := http.NewRequest("GET", urls, body)
  2114. googleapi.Expand(req.URL, map[string]string{
  2115. "blogId": c.blogId,
  2116. "postId": c.postId,
  2117. })
  2118. req.Header.Set("User-Agent", c.s.userAgent())
  2119. if c.ifNoneMatch_ != "" {
  2120. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2121. }
  2122. if c.ctx_ != nil {
  2123. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2124. }
  2125. return c.s.client.Do(req)
  2126. }
  2127. // Do executes the "blogger.comments.list" call.
  2128. // Exactly one of *CommentList or error will be non-nil. Any non-2xx
  2129. // status code is an error. Response headers are in either
  2130. // *CommentList.ServerResponse.Header or (if a response was returned at
  2131. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2132. // to check whether the returned error was because
  2133. // http.StatusNotModified was returned.
  2134. func (c *CommentsListCall) Do(opts ...googleapi.CallOption) (*CommentList, error) {
  2135. gensupport.SetOptions(c.urlParams_, opts...)
  2136. res, err := c.doRequest("json")
  2137. if res != nil && res.StatusCode == http.StatusNotModified {
  2138. if res.Body != nil {
  2139. res.Body.Close()
  2140. }
  2141. return nil, &googleapi.Error{
  2142. Code: res.StatusCode,
  2143. Header: res.Header,
  2144. }
  2145. }
  2146. if err != nil {
  2147. return nil, err
  2148. }
  2149. defer googleapi.CloseBody(res)
  2150. if err := googleapi.CheckResponse(res); err != nil {
  2151. return nil, err
  2152. }
  2153. ret := &CommentList{
  2154. ServerResponse: googleapi.ServerResponse{
  2155. Header: res.Header,
  2156. HTTPStatusCode: res.StatusCode,
  2157. },
  2158. }
  2159. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2160. return nil, err
  2161. }
  2162. return ret, nil
  2163. // {
  2164. // "description": "Retrieves the comments for a post, possibly filtered.",
  2165. // "httpMethod": "GET",
  2166. // "id": "blogger.comments.list",
  2167. // "parameterOrder": [
  2168. // "blogId",
  2169. // "postId"
  2170. // ],
  2171. // "parameters": {
  2172. // "blogId": {
  2173. // "description": "ID of the blog to fetch comments from.",
  2174. // "location": "path",
  2175. // "required": true,
  2176. // "type": "string"
  2177. // },
  2178. // "endDate": {
  2179. // "description": "Latest date of comment to fetch, a date-time with RFC 3339 formatting.",
  2180. // "format": "date-time",
  2181. // "location": "query",
  2182. // "type": "string"
  2183. // },
  2184. // "fetchBodies": {
  2185. // "description": "Whether the body content of the comments is included.",
  2186. // "location": "query",
  2187. // "type": "boolean"
  2188. // },
  2189. // "maxResults": {
  2190. // "description": "Maximum number of comments to include in the result.",
  2191. // "format": "uint32",
  2192. // "location": "query",
  2193. // "type": "integer"
  2194. // },
  2195. // "pageToken": {
  2196. // "description": "Continuation token if request is paged.",
  2197. // "location": "query",
  2198. // "type": "string"
  2199. // },
  2200. // "postId": {
  2201. // "description": "ID of the post to fetch posts from.",
  2202. // "location": "path",
  2203. // "required": true,
  2204. // "type": "string"
  2205. // },
  2206. // "startDate": {
  2207. // "description": "Earliest date of comment to fetch, a date-time with RFC 3339 formatting.",
  2208. // "format": "date-time",
  2209. // "location": "query",
  2210. // "type": "string"
  2211. // },
  2212. // "status": {
  2213. // "enum": [
  2214. // "emptied",
  2215. // "live",
  2216. // "pending",
  2217. // "spam"
  2218. // ],
  2219. // "enumDescriptions": [
  2220. // "Comments that have had their content removed",
  2221. // "Comments that are publicly visible",
  2222. // "Comments that are awaiting administrator approval",
  2223. // "Comments marked as spam by the administrator"
  2224. // ],
  2225. // "location": "query",
  2226. // "repeated": true,
  2227. // "type": "string"
  2228. // },
  2229. // "view": {
  2230. // "description": "Access level with which to view the returned result. Note that some fields require elevated access.",
  2231. // "enum": [
  2232. // "ADMIN",
  2233. // "AUTHOR",
  2234. // "READER"
  2235. // ],
  2236. // "enumDescriptions": [
  2237. // "Admin level detail",
  2238. // "Author level detail",
  2239. // "Reader level detail"
  2240. // ],
  2241. // "location": "query",
  2242. // "type": "string"
  2243. // }
  2244. // },
  2245. // "path": "blogs/{blogId}/posts/{postId}/comments",
  2246. // "response": {
  2247. // "$ref": "CommentList"
  2248. // },
  2249. // "scopes": [
  2250. // "https://www.googleapis.com/auth/blogger",
  2251. // "https://www.googleapis.com/auth/blogger.readonly"
  2252. // ]
  2253. // }
  2254. }
  2255. // Pages invokes f for each page of results.
  2256. // A non-nil error returned from f will halt the iteration.
  2257. // The provided context supersedes any context provided to the Context method.
  2258. func (c *CommentsListCall) Pages(ctx context.Context, f func(*CommentList) error) error {
  2259. c.ctx_ = ctx
  2260. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2261. for {
  2262. x, err := c.Do()
  2263. if err != nil {
  2264. return err
  2265. }
  2266. if err := f(x); err != nil {
  2267. return err
  2268. }
  2269. if x.NextPageToken == "" {
  2270. return nil
  2271. }
  2272. c.PageToken(x.NextPageToken)
  2273. }
  2274. }
  2275. // method id "blogger.comments.listByBlog":
  2276. type CommentsListByBlogCall struct {
  2277. s *Service
  2278. blogId string
  2279. urlParams_ gensupport.URLParams
  2280. ifNoneMatch_ string
  2281. ctx_ context.Context
  2282. }
  2283. // ListByBlog: Retrieves the comments for a blog, across all posts,
  2284. // possibly filtered.
  2285. func (r *CommentsService) ListByBlog(blogId string) *CommentsListByBlogCall {
  2286. c := &CommentsListByBlogCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2287. c.blogId = blogId
  2288. return c
  2289. }
  2290. // EndDate sets the optional parameter "endDate": Latest date of comment
  2291. // to fetch, a date-time with RFC 3339 formatting.
  2292. func (c *CommentsListByBlogCall) EndDate(endDate string) *CommentsListByBlogCall {
  2293. c.urlParams_.Set("endDate", endDate)
  2294. return c
  2295. }
  2296. // FetchBodies sets the optional parameter "fetchBodies": Whether the
  2297. // body content of the comments is included.
  2298. func (c *CommentsListByBlogCall) FetchBodies(fetchBodies bool) *CommentsListByBlogCall {
  2299. c.urlParams_.Set("fetchBodies", fmt.Sprint(fetchBodies))
  2300. return c
  2301. }
  2302. // MaxResults sets the optional parameter "maxResults": Maximum number
  2303. // of comments to include in the result.
  2304. func (c *CommentsListByBlogCall) MaxResults(maxResults int64) *CommentsListByBlogCall {
  2305. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2306. return c
  2307. }
  2308. // PageToken sets the optional parameter "pageToken": Continuation token
  2309. // if request is paged.
  2310. func (c *CommentsListByBlogCall) PageToken(pageToken string) *CommentsListByBlogCall {
  2311. c.urlParams_.Set("pageToken", pageToken)
  2312. return c
  2313. }
  2314. // StartDate sets the optional parameter "startDate": Earliest date of
  2315. // comment to fetch, a date-time with RFC 3339 formatting.
  2316. func (c *CommentsListByBlogCall) StartDate(startDate string) *CommentsListByBlogCall {
  2317. c.urlParams_.Set("startDate", startDate)
  2318. return c
  2319. }
  2320. // Status sets the optional parameter "status":
  2321. //
  2322. // Possible values:
  2323. // "emptied" - Comments that have had their content removed
  2324. // "live" - Comments that are publicly visible
  2325. // "pending" - Comments that are awaiting administrator approval
  2326. // "spam" - Comments marked as spam by the administrator
  2327. func (c *CommentsListByBlogCall) Status(status ...string) *CommentsListByBlogCall {
  2328. c.urlParams_.SetMulti("status", append([]string{}, status...))
  2329. return c
  2330. }
  2331. // Fields allows partial responses to be retrieved. See
  2332. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2333. // for more information.
  2334. func (c *CommentsListByBlogCall) Fields(s ...googleapi.Field) *CommentsListByBlogCall {
  2335. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2336. return c
  2337. }
  2338. // IfNoneMatch sets the optional parameter which makes the operation
  2339. // fail if the object's ETag matches the given value. This is useful for
  2340. // getting updates only after the object has changed since the last
  2341. // request. Use googleapi.IsNotModified to check whether the response
  2342. // error from Do is the result of In-None-Match.
  2343. func (c *CommentsListByBlogCall) IfNoneMatch(entityTag string) *CommentsListByBlogCall {
  2344. c.ifNoneMatch_ = entityTag
  2345. return c
  2346. }
  2347. // Context sets the context to be used in this call's Do method. Any
  2348. // pending HTTP request will be aborted if the provided context is
  2349. // canceled.
  2350. func (c *CommentsListByBlogCall) Context(ctx context.Context) *CommentsListByBlogCall {
  2351. c.ctx_ = ctx
  2352. return c
  2353. }
  2354. func (c *CommentsListByBlogCall) doRequest(alt string) (*http.Response, error) {
  2355. var body io.Reader = nil
  2356. c.urlParams_.Set("alt", alt)
  2357. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/comments")
  2358. urls += "?" + c.urlParams_.Encode()
  2359. req, _ := http.NewRequest("GET", urls, body)
  2360. googleapi.Expand(req.URL, map[string]string{
  2361. "blogId": c.blogId,
  2362. })
  2363. req.Header.Set("User-Agent", c.s.userAgent())
  2364. if c.ifNoneMatch_ != "" {
  2365. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2366. }
  2367. if c.ctx_ != nil {
  2368. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2369. }
  2370. return c.s.client.Do(req)
  2371. }
  2372. // Do executes the "blogger.comments.listByBlog" call.
  2373. // Exactly one of *CommentList or error will be non-nil. Any non-2xx
  2374. // status code is an error. Response headers are in either
  2375. // *CommentList.ServerResponse.Header or (if a response was returned at
  2376. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2377. // to check whether the returned error was because
  2378. // http.StatusNotModified was returned.
  2379. func (c *CommentsListByBlogCall) Do(opts ...googleapi.CallOption) (*CommentList, error) {
  2380. gensupport.SetOptions(c.urlParams_, opts...)
  2381. res, err := c.doRequest("json")
  2382. if res != nil && res.StatusCode == http.StatusNotModified {
  2383. if res.Body != nil {
  2384. res.Body.Close()
  2385. }
  2386. return nil, &googleapi.Error{
  2387. Code: res.StatusCode,
  2388. Header: res.Header,
  2389. }
  2390. }
  2391. if err != nil {
  2392. return nil, err
  2393. }
  2394. defer googleapi.CloseBody(res)
  2395. if err := googleapi.CheckResponse(res); err != nil {
  2396. return nil, err
  2397. }
  2398. ret := &CommentList{
  2399. ServerResponse: googleapi.ServerResponse{
  2400. Header: res.Header,
  2401. HTTPStatusCode: res.StatusCode,
  2402. },
  2403. }
  2404. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2405. return nil, err
  2406. }
  2407. return ret, nil
  2408. // {
  2409. // "description": "Retrieves the comments for a blog, across all posts, possibly filtered.",
  2410. // "httpMethod": "GET",
  2411. // "id": "blogger.comments.listByBlog",
  2412. // "parameterOrder": [
  2413. // "blogId"
  2414. // ],
  2415. // "parameters": {
  2416. // "blogId": {
  2417. // "description": "ID of the blog to fetch comments from.",
  2418. // "location": "path",
  2419. // "required": true,
  2420. // "type": "string"
  2421. // },
  2422. // "endDate": {
  2423. // "description": "Latest date of comment to fetch, a date-time with RFC 3339 formatting.",
  2424. // "format": "date-time",
  2425. // "location": "query",
  2426. // "type": "string"
  2427. // },
  2428. // "fetchBodies": {
  2429. // "description": "Whether the body content of the comments is included.",
  2430. // "location": "query",
  2431. // "type": "boolean"
  2432. // },
  2433. // "maxResults": {
  2434. // "description": "Maximum number of comments to include in the result.",
  2435. // "format": "uint32",
  2436. // "location": "query",
  2437. // "type": "integer"
  2438. // },
  2439. // "pageToken": {
  2440. // "description": "Continuation token if request is paged.",
  2441. // "location": "query",
  2442. // "type": "string"
  2443. // },
  2444. // "startDate": {
  2445. // "description": "Earliest date of comment to fetch, a date-time with RFC 3339 formatting.",
  2446. // "format": "date-time",
  2447. // "location": "query",
  2448. // "type": "string"
  2449. // },
  2450. // "status": {
  2451. // "enum": [
  2452. // "emptied",
  2453. // "live",
  2454. // "pending",
  2455. // "spam"
  2456. // ],
  2457. // "enumDescriptions": [
  2458. // "Comments that have had their content removed",
  2459. // "Comments that are publicly visible",
  2460. // "Comments that are awaiting administrator approval",
  2461. // "Comments marked as spam by the administrator"
  2462. // ],
  2463. // "location": "query",
  2464. // "repeated": true,
  2465. // "type": "string"
  2466. // }
  2467. // },
  2468. // "path": "blogs/{blogId}/comments",
  2469. // "response": {
  2470. // "$ref": "CommentList"
  2471. // },
  2472. // "scopes": [
  2473. // "https://www.googleapis.com/auth/blogger",
  2474. // "https://www.googleapis.com/auth/blogger.readonly"
  2475. // ]
  2476. // }
  2477. }
  2478. // Pages invokes f for each page of results.
  2479. // A non-nil error returned from f will halt the iteration.
  2480. // The provided context supersedes any context provided to the Context method.
  2481. func (c *CommentsListByBlogCall) Pages(ctx context.Context, f func(*CommentList) error) error {
  2482. c.ctx_ = ctx
  2483. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2484. for {
  2485. x, err := c.Do()
  2486. if err != nil {
  2487. return err
  2488. }
  2489. if err := f(x); err != nil {
  2490. return err
  2491. }
  2492. if x.NextPageToken == "" {
  2493. return nil
  2494. }
  2495. c.PageToken(x.NextPageToken)
  2496. }
  2497. }
  2498. // method id "blogger.comments.markAsSpam":
  2499. type CommentsMarkAsSpamCall struct {
  2500. s *Service
  2501. blogId string
  2502. postId string
  2503. commentId string
  2504. urlParams_ gensupport.URLParams
  2505. ctx_ context.Context
  2506. }
  2507. // MarkAsSpam: Marks a comment as spam.
  2508. func (r *CommentsService) MarkAsSpam(blogId string, postId string, commentId string) *CommentsMarkAsSpamCall {
  2509. c := &CommentsMarkAsSpamCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2510. c.blogId = blogId
  2511. c.postId = postId
  2512. c.commentId = commentId
  2513. return c
  2514. }
  2515. // Fields allows partial responses to be retrieved. See
  2516. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2517. // for more information.
  2518. func (c *CommentsMarkAsSpamCall) Fields(s ...googleapi.Field) *CommentsMarkAsSpamCall {
  2519. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2520. return c
  2521. }
  2522. // Context sets the context to be used in this call's Do method. Any
  2523. // pending HTTP request will be aborted if the provided context is
  2524. // canceled.
  2525. func (c *CommentsMarkAsSpamCall) Context(ctx context.Context) *CommentsMarkAsSpamCall {
  2526. c.ctx_ = ctx
  2527. return c
  2528. }
  2529. func (c *CommentsMarkAsSpamCall) doRequest(alt string) (*http.Response, error) {
  2530. var body io.Reader = nil
  2531. c.urlParams_.Set("alt", alt)
  2532. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}/comments/{commentId}/spam")
  2533. urls += "?" + c.urlParams_.Encode()
  2534. req, _ := http.NewRequest("POST", urls, body)
  2535. googleapi.Expand(req.URL, map[string]string{
  2536. "blogId": c.blogId,
  2537. "postId": c.postId,
  2538. "commentId": c.commentId,
  2539. })
  2540. req.Header.Set("User-Agent", c.s.userAgent())
  2541. if c.ctx_ != nil {
  2542. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2543. }
  2544. return c.s.client.Do(req)
  2545. }
  2546. // Do executes the "blogger.comments.markAsSpam" call.
  2547. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  2548. // code is an error. Response headers are in either
  2549. // *Comment.ServerResponse.Header or (if a response was returned at all)
  2550. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2551. // check whether the returned error was because http.StatusNotModified
  2552. // was returned.
  2553. func (c *CommentsMarkAsSpamCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  2554. gensupport.SetOptions(c.urlParams_, opts...)
  2555. res, err := c.doRequest("json")
  2556. if res != nil && res.StatusCode == http.StatusNotModified {
  2557. if res.Body != nil {
  2558. res.Body.Close()
  2559. }
  2560. return nil, &googleapi.Error{
  2561. Code: res.StatusCode,
  2562. Header: res.Header,
  2563. }
  2564. }
  2565. if err != nil {
  2566. return nil, err
  2567. }
  2568. defer googleapi.CloseBody(res)
  2569. if err := googleapi.CheckResponse(res); err != nil {
  2570. return nil, err
  2571. }
  2572. ret := &Comment{
  2573. ServerResponse: googleapi.ServerResponse{
  2574. Header: res.Header,
  2575. HTTPStatusCode: res.StatusCode,
  2576. },
  2577. }
  2578. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2579. return nil, err
  2580. }
  2581. return ret, nil
  2582. // {
  2583. // "description": "Marks a comment as spam.",
  2584. // "httpMethod": "POST",
  2585. // "id": "blogger.comments.markAsSpam",
  2586. // "parameterOrder": [
  2587. // "blogId",
  2588. // "postId",
  2589. // "commentId"
  2590. // ],
  2591. // "parameters": {
  2592. // "blogId": {
  2593. // "description": "The ID of the Blog.",
  2594. // "location": "path",
  2595. // "required": true,
  2596. // "type": "string"
  2597. // },
  2598. // "commentId": {
  2599. // "description": "The ID of the comment to mark as spam.",
  2600. // "location": "path",
  2601. // "required": true,
  2602. // "type": "string"
  2603. // },
  2604. // "postId": {
  2605. // "description": "The ID of the Post.",
  2606. // "location": "path",
  2607. // "required": true,
  2608. // "type": "string"
  2609. // }
  2610. // },
  2611. // "path": "blogs/{blogId}/posts/{postId}/comments/{commentId}/spam",
  2612. // "response": {
  2613. // "$ref": "Comment"
  2614. // },
  2615. // "scopes": [
  2616. // "https://www.googleapis.com/auth/blogger"
  2617. // ]
  2618. // }
  2619. }
  2620. // method id "blogger.comments.removeContent":
  2621. type CommentsRemoveContentCall struct {
  2622. s *Service
  2623. blogId string
  2624. postId string
  2625. commentId string
  2626. urlParams_ gensupport.URLParams
  2627. ctx_ context.Context
  2628. }
  2629. // RemoveContent: Removes the content of a comment.
  2630. func (r *CommentsService) RemoveContent(blogId string, postId string, commentId string) *CommentsRemoveContentCall {
  2631. c := &CommentsRemoveContentCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2632. c.blogId = blogId
  2633. c.postId = postId
  2634. c.commentId = commentId
  2635. return c
  2636. }
  2637. // Fields allows partial responses to be retrieved. See
  2638. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2639. // for more information.
  2640. func (c *CommentsRemoveContentCall) Fields(s ...googleapi.Field) *CommentsRemoveContentCall {
  2641. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2642. return c
  2643. }
  2644. // Context sets the context to be used in this call's Do method. Any
  2645. // pending HTTP request will be aborted if the provided context is
  2646. // canceled.
  2647. func (c *CommentsRemoveContentCall) Context(ctx context.Context) *CommentsRemoveContentCall {
  2648. c.ctx_ = ctx
  2649. return c
  2650. }
  2651. func (c *CommentsRemoveContentCall) doRequest(alt string) (*http.Response, error) {
  2652. var body io.Reader = nil
  2653. c.urlParams_.Set("alt", alt)
  2654. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}/comments/{commentId}/removecontent")
  2655. urls += "?" + c.urlParams_.Encode()
  2656. req, _ := http.NewRequest("POST", urls, body)
  2657. googleapi.Expand(req.URL, map[string]string{
  2658. "blogId": c.blogId,
  2659. "postId": c.postId,
  2660. "commentId": c.commentId,
  2661. })
  2662. req.Header.Set("User-Agent", c.s.userAgent())
  2663. if c.ctx_ != nil {
  2664. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2665. }
  2666. return c.s.client.Do(req)
  2667. }
  2668. // Do executes the "blogger.comments.removeContent" call.
  2669. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  2670. // code is an error. Response headers are in either
  2671. // *Comment.ServerResponse.Header or (if a response was returned at all)
  2672. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2673. // check whether the returned error was because http.StatusNotModified
  2674. // was returned.
  2675. func (c *CommentsRemoveContentCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  2676. gensupport.SetOptions(c.urlParams_, opts...)
  2677. res, err := c.doRequest("json")
  2678. if res != nil && res.StatusCode == http.StatusNotModified {
  2679. if res.Body != nil {
  2680. res.Body.Close()
  2681. }
  2682. return nil, &googleapi.Error{
  2683. Code: res.StatusCode,
  2684. Header: res.Header,
  2685. }
  2686. }
  2687. if err != nil {
  2688. return nil, err
  2689. }
  2690. defer googleapi.CloseBody(res)
  2691. if err := googleapi.CheckResponse(res); err != nil {
  2692. return nil, err
  2693. }
  2694. ret := &Comment{
  2695. ServerResponse: googleapi.ServerResponse{
  2696. Header: res.Header,
  2697. HTTPStatusCode: res.StatusCode,
  2698. },
  2699. }
  2700. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2701. return nil, err
  2702. }
  2703. return ret, nil
  2704. // {
  2705. // "description": "Removes the content of a comment.",
  2706. // "httpMethod": "POST",
  2707. // "id": "blogger.comments.removeContent",
  2708. // "parameterOrder": [
  2709. // "blogId",
  2710. // "postId",
  2711. // "commentId"
  2712. // ],
  2713. // "parameters": {
  2714. // "blogId": {
  2715. // "description": "The ID of the Blog.",
  2716. // "location": "path",
  2717. // "required": true,
  2718. // "type": "string"
  2719. // },
  2720. // "commentId": {
  2721. // "description": "The ID of the comment to delete content from.",
  2722. // "location": "path",
  2723. // "required": true,
  2724. // "type": "string"
  2725. // },
  2726. // "postId": {
  2727. // "description": "The ID of the Post.",
  2728. // "location": "path",
  2729. // "required": true,
  2730. // "type": "string"
  2731. // }
  2732. // },
  2733. // "path": "blogs/{blogId}/posts/{postId}/comments/{commentId}/removecontent",
  2734. // "response": {
  2735. // "$ref": "Comment"
  2736. // },
  2737. // "scopes": [
  2738. // "https://www.googleapis.com/auth/blogger"
  2739. // ]
  2740. // }
  2741. }
  2742. // method id "blogger.pageViews.get":
  2743. type PageViewsGetCall struct {
  2744. s *Service
  2745. blogId string
  2746. urlParams_ gensupport.URLParams
  2747. ifNoneMatch_ string
  2748. ctx_ context.Context
  2749. }
  2750. // Get: Retrieve pageview stats for a Blog.
  2751. func (r *PageViewsService) Get(blogId string) *PageViewsGetCall {
  2752. c := &PageViewsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2753. c.blogId = blogId
  2754. return c
  2755. }
  2756. // Range sets the optional parameter "range":
  2757. //
  2758. // Possible values:
  2759. // "30DAYS" - Page view counts from the last thirty days.
  2760. // "7DAYS" - Page view counts from the last seven days.
  2761. // "all" - Total page view counts from all time.
  2762. func (c *PageViewsGetCall) Range(range_ ...string) *PageViewsGetCall {
  2763. c.urlParams_.SetMulti("range", append([]string{}, range_...))
  2764. return c
  2765. }
  2766. // Fields allows partial responses to be retrieved. See
  2767. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2768. // for more information.
  2769. func (c *PageViewsGetCall) Fields(s ...googleapi.Field) *PageViewsGetCall {
  2770. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2771. return c
  2772. }
  2773. // IfNoneMatch sets the optional parameter which makes the operation
  2774. // fail if the object's ETag matches the given value. This is useful for
  2775. // getting updates only after the object has changed since the last
  2776. // request. Use googleapi.IsNotModified to check whether the response
  2777. // error from Do is the result of In-None-Match.
  2778. func (c *PageViewsGetCall) IfNoneMatch(entityTag string) *PageViewsGetCall {
  2779. c.ifNoneMatch_ = entityTag
  2780. return c
  2781. }
  2782. // Context sets the context to be used in this call's Do method. Any
  2783. // pending HTTP request will be aborted if the provided context is
  2784. // canceled.
  2785. func (c *PageViewsGetCall) Context(ctx context.Context) *PageViewsGetCall {
  2786. c.ctx_ = ctx
  2787. return c
  2788. }
  2789. func (c *PageViewsGetCall) doRequest(alt string) (*http.Response, error) {
  2790. var body io.Reader = nil
  2791. c.urlParams_.Set("alt", alt)
  2792. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pageviews")
  2793. urls += "?" + c.urlParams_.Encode()
  2794. req, _ := http.NewRequest("GET", urls, body)
  2795. googleapi.Expand(req.URL, map[string]string{
  2796. "blogId": c.blogId,
  2797. })
  2798. req.Header.Set("User-Agent", c.s.userAgent())
  2799. if c.ifNoneMatch_ != "" {
  2800. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2801. }
  2802. if c.ctx_ != nil {
  2803. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2804. }
  2805. return c.s.client.Do(req)
  2806. }
  2807. // Do executes the "blogger.pageViews.get" call.
  2808. // Exactly one of *Pageviews or error will be non-nil. Any non-2xx
  2809. // status code is an error. Response headers are in either
  2810. // *Pageviews.ServerResponse.Header or (if a response was returned at
  2811. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2812. // to check whether the returned error was because
  2813. // http.StatusNotModified was returned.
  2814. func (c *PageViewsGetCall) Do(opts ...googleapi.CallOption) (*Pageviews, error) {
  2815. gensupport.SetOptions(c.urlParams_, opts...)
  2816. res, err := c.doRequest("json")
  2817. if res != nil && res.StatusCode == http.StatusNotModified {
  2818. if res.Body != nil {
  2819. res.Body.Close()
  2820. }
  2821. return nil, &googleapi.Error{
  2822. Code: res.StatusCode,
  2823. Header: res.Header,
  2824. }
  2825. }
  2826. if err != nil {
  2827. return nil, err
  2828. }
  2829. defer googleapi.CloseBody(res)
  2830. if err := googleapi.CheckResponse(res); err != nil {
  2831. return nil, err
  2832. }
  2833. ret := &Pageviews{
  2834. ServerResponse: googleapi.ServerResponse{
  2835. Header: res.Header,
  2836. HTTPStatusCode: res.StatusCode,
  2837. },
  2838. }
  2839. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2840. return nil, err
  2841. }
  2842. return ret, nil
  2843. // {
  2844. // "description": "Retrieve pageview stats for a Blog.",
  2845. // "httpMethod": "GET",
  2846. // "id": "blogger.pageViews.get",
  2847. // "parameterOrder": [
  2848. // "blogId"
  2849. // ],
  2850. // "parameters": {
  2851. // "blogId": {
  2852. // "description": "The ID of the blog to get.",
  2853. // "location": "path",
  2854. // "required": true,
  2855. // "type": "string"
  2856. // },
  2857. // "range": {
  2858. // "enum": [
  2859. // "30DAYS",
  2860. // "7DAYS",
  2861. // "all"
  2862. // ],
  2863. // "enumDescriptions": [
  2864. // "Page view counts from the last thirty days.",
  2865. // "Page view counts from the last seven days.",
  2866. // "Total page view counts from all time."
  2867. // ],
  2868. // "location": "query",
  2869. // "repeated": true,
  2870. // "type": "string"
  2871. // }
  2872. // },
  2873. // "path": "blogs/{blogId}/pageviews",
  2874. // "response": {
  2875. // "$ref": "Pageviews"
  2876. // },
  2877. // "scopes": [
  2878. // "https://www.googleapis.com/auth/blogger"
  2879. // ]
  2880. // }
  2881. }
  2882. // method id "blogger.pages.delete":
  2883. type PagesDeleteCall struct {
  2884. s *Service
  2885. blogId string
  2886. pageId string
  2887. urlParams_ gensupport.URLParams
  2888. ctx_ context.Context
  2889. }
  2890. // Delete: Delete a page by ID.
  2891. func (r *PagesService) Delete(blogId string, pageId string) *PagesDeleteCall {
  2892. c := &PagesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2893. c.blogId = blogId
  2894. c.pageId = pageId
  2895. return c
  2896. }
  2897. // Fields allows partial responses to be retrieved. See
  2898. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2899. // for more information.
  2900. func (c *PagesDeleteCall) Fields(s ...googleapi.Field) *PagesDeleteCall {
  2901. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2902. return c
  2903. }
  2904. // Context sets the context to be used in this call's Do method. Any
  2905. // pending HTTP request will be aborted if the provided context is
  2906. // canceled.
  2907. func (c *PagesDeleteCall) Context(ctx context.Context) *PagesDeleteCall {
  2908. c.ctx_ = ctx
  2909. return c
  2910. }
  2911. func (c *PagesDeleteCall) doRequest(alt string) (*http.Response, error) {
  2912. var body io.Reader = nil
  2913. c.urlParams_.Set("alt", alt)
  2914. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pages/{pageId}")
  2915. urls += "?" + c.urlParams_.Encode()
  2916. req, _ := http.NewRequest("DELETE", urls, body)
  2917. googleapi.Expand(req.URL, map[string]string{
  2918. "blogId": c.blogId,
  2919. "pageId": c.pageId,
  2920. })
  2921. req.Header.Set("User-Agent", c.s.userAgent())
  2922. if c.ctx_ != nil {
  2923. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2924. }
  2925. return c.s.client.Do(req)
  2926. }
  2927. // Do executes the "blogger.pages.delete" call.
  2928. func (c *PagesDeleteCall) Do(opts ...googleapi.CallOption) error {
  2929. gensupport.SetOptions(c.urlParams_, opts...)
  2930. res, err := c.doRequest("json")
  2931. if err != nil {
  2932. return err
  2933. }
  2934. defer googleapi.CloseBody(res)
  2935. if err := googleapi.CheckResponse(res); err != nil {
  2936. return err
  2937. }
  2938. return nil
  2939. // {
  2940. // "description": "Delete a page by ID.",
  2941. // "httpMethod": "DELETE",
  2942. // "id": "blogger.pages.delete",
  2943. // "parameterOrder": [
  2944. // "blogId",
  2945. // "pageId"
  2946. // ],
  2947. // "parameters": {
  2948. // "blogId": {
  2949. // "description": "The ID of the Blog.",
  2950. // "location": "path",
  2951. // "required": true,
  2952. // "type": "string"
  2953. // },
  2954. // "pageId": {
  2955. // "description": "The ID of the Page.",
  2956. // "location": "path",
  2957. // "required": true,
  2958. // "type": "string"
  2959. // }
  2960. // },
  2961. // "path": "blogs/{blogId}/pages/{pageId}",
  2962. // "scopes": [
  2963. // "https://www.googleapis.com/auth/blogger"
  2964. // ]
  2965. // }
  2966. }
  2967. // method id "blogger.pages.get":
  2968. type PagesGetCall struct {
  2969. s *Service
  2970. blogId string
  2971. pageId string
  2972. urlParams_ gensupport.URLParams
  2973. ifNoneMatch_ string
  2974. ctx_ context.Context
  2975. }
  2976. // Get: Gets one blog page by ID.
  2977. func (r *PagesService) Get(blogId string, pageId string) *PagesGetCall {
  2978. c := &PagesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2979. c.blogId = blogId
  2980. c.pageId = pageId
  2981. return c
  2982. }
  2983. // View sets the optional parameter "view":
  2984. //
  2985. // Possible values:
  2986. // "ADMIN" - Admin level detail
  2987. // "AUTHOR" - Author level detail
  2988. // "READER" - Reader level detail
  2989. func (c *PagesGetCall) View(view string) *PagesGetCall {
  2990. c.urlParams_.Set("view", view)
  2991. return c
  2992. }
  2993. // Fields allows partial responses to be retrieved. See
  2994. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2995. // for more information.
  2996. func (c *PagesGetCall) Fields(s ...googleapi.Field) *PagesGetCall {
  2997. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2998. return c
  2999. }
  3000. // IfNoneMatch sets the optional parameter which makes the operation
  3001. // fail if the object's ETag matches the given value. This is useful for
  3002. // getting updates only after the object has changed since the last
  3003. // request. Use googleapi.IsNotModified to check whether the response
  3004. // error from Do is the result of In-None-Match.
  3005. func (c *PagesGetCall) IfNoneMatch(entityTag string) *PagesGetCall {
  3006. c.ifNoneMatch_ = entityTag
  3007. return c
  3008. }
  3009. // Context sets the context to be used in this call's Do method. Any
  3010. // pending HTTP request will be aborted if the provided context is
  3011. // canceled.
  3012. func (c *PagesGetCall) Context(ctx context.Context) *PagesGetCall {
  3013. c.ctx_ = ctx
  3014. return c
  3015. }
  3016. func (c *PagesGetCall) doRequest(alt string) (*http.Response, error) {
  3017. var body io.Reader = nil
  3018. c.urlParams_.Set("alt", alt)
  3019. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pages/{pageId}")
  3020. urls += "?" + c.urlParams_.Encode()
  3021. req, _ := http.NewRequest("GET", urls, body)
  3022. googleapi.Expand(req.URL, map[string]string{
  3023. "blogId": c.blogId,
  3024. "pageId": c.pageId,
  3025. })
  3026. req.Header.Set("User-Agent", c.s.userAgent())
  3027. if c.ifNoneMatch_ != "" {
  3028. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3029. }
  3030. if c.ctx_ != nil {
  3031. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3032. }
  3033. return c.s.client.Do(req)
  3034. }
  3035. // Do executes the "blogger.pages.get" call.
  3036. // Exactly one of *Page or error will be non-nil. Any non-2xx status
  3037. // code is an error. Response headers are in either
  3038. // *Page.ServerResponse.Header or (if a response was returned at all) in
  3039. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3040. // whether the returned error was because http.StatusNotModified was
  3041. // returned.
  3042. func (c *PagesGetCall) Do(opts ...googleapi.CallOption) (*Page, error) {
  3043. gensupport.SetOptions(c.urlParams_, opts...)
  3044. res, err := c.doRequest("json")
  3045. if res != nil && res.StatusCode == http.StatusNotModified {
  3046. if res.Body != nil {
  3047. res.Body.Close()
  3048. }
  3049. return nil, &googleapi.Error{
  3050. Code: res.StatusCode,
  3051. Header: res.Header,
  3052. }
  3053. }
  3054. if err != nil {
  3055. return nil, err
  3056. }
  3057. defer googleapi.CloseBody(res)
  3058. if err := googleapi.CheckResponse(res); err != nil {
  3059. return nil, err
  3060. }
  3061. ret := &Page{
  3062. ServerResponse: googleapi.ServerResponse{
  3063. Header: res.Header,
  3064. HTTPStatusCode: res.StatusCode,
  3065. },
  3066. }
  3067. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3068. return nil, err
  3069. }
  3070. return ret, nil
  3071. // {
  3072. // "description": "Gets one blog page by ID.",
  3073. // "httpMethod": "GET",
  3074. // "id": "blogger.pages.get",
  3075. // "parameterOrder": [
  3076. // "blogId",
  3077. // "pageId"
  3078. // ],
  3079. // "parameters": {
  3080. // "blogId": {
  3081. // "description": "ID of the blog containing the page.",
  3082. // "location": "path",
  3083. // "required": true,
  3084. // "type": "string"
  3085. // },
  3086. // "pageId": {
  3087. // "description": "The ID of the page to get.",
  3088. // "location": "path",
  3089. // "required": true,
  3090. // "type": "string"
  3091. // },
  3092. // "view": {
  3093. // "enum": [
  3094. // "ADMIN",
  3095. // "AUTHOR",
  3096. // "READER"
  3097. // ],
  3098. // "enumDescriptions": [
  3099. // "Admin level detail",
  3100. // "Author level detail",
  3101. // "Reader level detail"
  3102. // ],
  3103. // "location": "query",
  3104. // "type": "string"
  3105. // }
  3106. // },
  3107. // "path": "blogs/{blogId}/pages/{pageId}",
  3108. // "response": {
  3109. // "$ref": "Page"
  3110. // },
  3111. // "scopes": [
  3112. // "https://www.googleapis.com/auth/blogger",
  3113. // "https://www.googleapis.com/auth/blogger.readonly"
  3114. // ]
  3115. // }
  3116. }
  3117. // method id "blogger.pages.insert":
  3118. type PagesInsertCall struct {
  3119. s *Service
  3120. blogId string
  3121. page *Page
  3122. urlParams_ gensupport.URLParams
  3123. ctx_ context.Context
  3124. }
  3125. // Insert: Add a page.
  3126. func (r *PagesService) Insert(blogId string, page *Page) *PagesInsertCall {
  3127. c := &PagesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3128. c.blogId = blogId
  3129. c.page = page
  3130. return c
  3131. }
  3132. // IsDraft sets the optional parameter "isDraft": Whether to create the
  3133. // page as a draft (default: false).
  3134. func (c *PagesInsertCall) IsDraft(isDraft bool) *PagesInsertCall {
  3135. c.urlParams_.Set("isDraft", fmt.Sprint(isDraft))
  3136. return c
  3137. }
  3138. // Fields allows partial responses to be retrieved. See
  3139. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3140. // for more information.
  3141. func (c *PagesInsertCall) Fields(s ...googleapi.Field) *PagesInsertCall {
  3142. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3143. return c
  3144. }
  3145. // Context sets the context to be used in this call's Do method. Any
  3146. // pending HTTP request will be aborted if the provided context is
  3147. // canceled.
  3148. func (c *PagesInsertCall) Context(ctx context.Context) *PagesInsertCall {
  3149. c.ctx_ = ctx
  3150. return c
  3151. }
  3152. func (c *PagesInsertCall) doRequest(alt string) (*http.Response, error) {
  3153. var body io.Reader = nil
  3154. body, err := googleapi.WithoutDataWrapper.JSONReader(c.page)
  3155. if err != nil {
  3156. return nil, err
  3157. }
  3158. ctype := "application/json"
  3159. c.urlParams_.Set("alt", alt)
  3160. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pages")
  3161. urls += "?" + c.urlParams_.Encode()
  3162. req, _ := http.NewRequest("POST", urls, body)
  3163. googleapi.Expand(req.URL, map[string]string{
  3164. "blogId": c.blogId,
  3165. })
  3166. req.Header.Set("Content-Type", ctype)
  3167. req.Header.Set("User-Agent", c.s.userAgent())
  3168. if c.ctx_ != nil {
  3169. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3170. }
  3171. return c.s.client.Do(req)
  3172. }
  3173. // Do executes the "blogger.pages.insert" call.
  3174. // Exactly one of *Page or error will be non-nil. Any non-2xx status
  3175. // code is an error. Response headers are in either
  3176. // *Page.ServerResponse.Header or (if a response was returned at all) in
  3177. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3178. // whether the returned error was because http.StatusNotModified was
  3179. // returned.
  3180. func (c *PagesInsertCall) Do(opts ...googleapi.CallOption) (*Page, error) {
  3181. gensupport.SetOptions(c.urlParams_, opts...)
  3182. res, err := c.doRequest("json")
  3183. if res != nil && res.StatusCode == http.StatusNotModified {
  3184. if res.Body != nil {
  3185. res.Body.Close()
  3186. }
  3187. return nil, &googleapi.Error{
  3188. Code: res.StatusCode,
  3189. Header: res.Header,
  3190. }
  3191. }
  3192. if err != nil {
  3193. return nil, err
  3194. }
  3195. defer googleapi.CloseBody(res)
  3196. if err := googleapi.CheckResponse(res); err != nil {
  3197. return nil, err
  3198. }
  3199. ret := &Page{
  3200. ServerResponse: googleapi.ServerResponse{
  3201. Header: res.Header,
  3202. HTTPStatusCode: res.StatusCode,
  3203. },
  3204. }
  3205. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3206. return nil, err
  3207. }
  3208. return ret, nil
  3209. // {
  3210. // "description": "Add a page.",
  3211. // "httpMethod": "POST",
  3212. // "id": "blogger.pages.insert",
  3213. // "parameterOrder": [
  3214. // "blogId"
  3215. // ],
  3216. // "parameters": {
  3217. // "blogId": {
  3218. // "description": "ID of the blog to add the page to.",
  3219. // "location": "path",
  3220. // "required": true,
  3221. // "type": "string"
  3222. // },
  3223. // "isDraft": {
  3224. // "description": "Whether to create the page as a draft (default: false).",
  3225. // "location": "query",
  3226. // "type": "boolean"
  3227. // }
  3228. // },
  3229. // "path": "blogs/{blogId}/pages",
  3230. // "request": {
  3231. // "$ref": "Page"
  3232. // },
  3233. // "response": {
  3234. // "$ref": "Page"
  3235. // },
  3236. // "scopes": [
  3237. // "https://www.googleapis.com/auth/blogger"
  3238. // ]
  3239. // }
  3240. }
  3241. // method id "blogger.pages.list":
  3242. type PagesListCall struct {
  3243. s *Service
  3244. blogId string
  3245. urlParams_ gensupport.URLParams
  3246. ifNoneMatch_ string
  3247. ctx_ context.Context
  3248. }
  3249. // List: Retrieves the pages for a blog, optionally including non-LIVE
  3250. // statuses.
  3251. func (r *PagesService) List(blogId string) *PagesListCall {
  3252. c := &PagesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3253. c.blogId = blogId
  3254. return c
  3255. }
  3256. // FetchBodies sets the optional parameter "fetchBodies": Whether to
  3257. // retrieve the Page bodies.
  3258. func (c *PagesListCall) FetchBodies(fetchBodies bool) *PagesListCall {
  3259. c.urlParams_.Set("fetchBodies", fmt.Sprint(fetchBodies))
  3260. return c
  3261. }
  3262. // MaxResults sets the optional parameter "maxResults": Maximum number
  3263. // of Pages to fetch.
  3264. func (c *PagesListCall) MaxResults(maxResults int64) *PagesListCall {
  3265. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3266. return c
  3267. }
  3268. // PageToken sets the optional parameter "pageToken": Continuation token
  3269. // if the request is paged.
  3270. func (c *PagesListCall) PageToken(pageToken string) *PagesListCall {
  3271. c.urlParams_.Set("pageToken", pageToken)
  3272. return c
  3273. }
  3274. // Status sets the optional parameter "status":
  3275. //
  3276. // Possible values:
  3277. // "draft" - Draft (unpublished) Pages
  3278. // "live" - Pages that are publicly visible
  3279. func (c *PagesListCall) Status(status ...string) *PagesListCall {
  3280. c.urlParams_.SetMulti("status", append([]string{}, status...))
  3281. return c
  3282. }
  3283. // View sets the optional parameter "view": Access level with which to
  3284. // view the returned result. Note that some fields require elevated
  3285. // access.
  3286. //
  3287. // Possible values:
  3288. // "ADMIN" - Admin level detail
  3289. // "AUTHOR" - Author level detail
  3290. // "READER" - Reader level detail
  3291. func (c *PagesListCall) View(view string) *PagesListCall {
  3292. c.urlParams_.Set("view", view)
  3293. return c
  3294. }
  3295. // Fields allows partial responses to be retrieved. See
  3296. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3297. // for more information.
  3298. func (c *PagesListCall) Fields(s ...googleapi.Field) *PagesListCall {
  3299. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3300. return c
  3301. }
  3302. // IfNoneMatch sets the optional parameter which makes the operation
  3303. // fail if the object's ETag matches the given value. This is useful for
  3304. // getting updates only after the object has changed since the last
  3305. // request. Use googleapi.IsNotModified to check whether the response
  3306. // error from Do is the result of In-None-Match.
  3307. func (c *PagesListCall) IfNoneMatch(entityTag string) *PagesListCall {
  3308. c.ifNoneMatch_ = entityTag
  3309. return c
  3310. }
  3311. // Context sets the context to be used in this call's Do method. Any
  3312. // pending HTTP request will be aborted if the provided context is
  3313. // canceled.
  3314. func (c *PagesListCall) Context(ctx context.Context) *PagesListCall {
  3315. c.ctx_ = ctx
  3316. return c
  3317. }
  3318. func (c *PagesListCall) doRequest(alt string) (*http.Response, error) {
  3319. var body io.Reader = nil
  3320. c.urlParams_.Set("alt", alt)
  3321. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pages")
  3322. urls += "?" + c.urlParams_.Encode()
  3323. req, _ := http.NewRequest("GET", urls, body)
  3324. googleapi.Expand(req.URL, map[string]string{
  3325. "blogId": c.blogId,
  3326. })
  3327. req.Header.Set("User-Agent", c.s.userAgent())
  3328. if c.ifNoneMatch_ != "" {
  3329. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3330. }
  3331. if c.ctx_ != nil {
  3332. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3333. }
  3334. return c.s.client.Do(req)
  3335. }
  3336. // Do executes the "blogger.pages.list" call.
  3337. // Exactly one of *PageList or error will be non-nil. Any non-2xx status
  3338. // code is an error. Response headers are in either
  3339. // *PageList.ServerResponse.Header or (if a response was returned at
  3340. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3341. // to check whether the returned error was because
  3342. // http.StatusNotModified was returned.
  3343. func (c *PagesListCall) Do(opts ...googleapi.CallOption) (*PageList, error) {
  3344. gensupport.SetOptions(c.urlParams_, opts...)
  3345. res, err := c.doRequest("json")
  3346. if res != nil && res.StatusCode == http.StatusNotModified {
  3347. if res.Body != nil {
  3348. res.Body.Close()
  3349. }
  3350. return nil, &googleapi.Error{
  3351. Code: res.StatusCode,
  3352. Header: res.Header,
  3353. }
  3354. }
  3355. if err != nil {
  3356. return nil, err
  3357. }
  3358. defer googleapi.CloseBody(res)
  3359. if err := googleapi.CheckResponse(res); err != nil {
  3360. return nil, err
  3361. }
  3362. ret := &PageList{
  3363. ServerResponse: googleapi.ServerResponse{
  3364. Header: res.Header,
  3365. HTTPStatusCode: res.StatusCode,
  3366. },
  3367. }
  3368. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3369. return nil, err
  3370. }
  3371. return ret, nil
  3372. // {
  3373. // "description": "Retrieves the pages for a blog, optionally including non-LIVE statuses.",
  3374. // "httpMethod": "GET",
  3375. // "id": "blogger.pages.list",
  3376. // "parameterOrder": [
  3377. // "blogId"
  3378. // ],
  3379. // "parameters": {
  3380. // "blogId": {
  3381. // "description": "ID of the blog to fetch Pages from.",
  3382. // "location": "path",
  3383. // "required": true,
  3384. // "type": "string"
  3385. // },
  3386. // "fetchBodies": {
  3387. // "description": "Whether to retrieve the Page bodies.",
  3388. // "location": "query",
  3389. // "type": "boolean"
  3390. // },
  3391. // "maxResults": {
  3392. // "description": "Maximum number of Pages to fetch.",
  3393. // "format": "uint32",
  3394. // "location": "query",
  3395. // "type": "integer"
  3396. // },
  3397. // "pageToken": {
  3398. // "description": "Continuation token if the request is paged.",
  3399. // "location": "query",
  3400. // "type": "string"
  3401. // },
  3402. // "status": {
  3403. // "enum": [
  3404. // "draft",
  3405. // "live"
  3406. // ],
  3407. // "enumDescriptions": [
  3408. // "Draft (unpublished) Pages",
  3409. // "Pages that are publicly visible"
  3410. // ],
  3411. // "location": "query",
  3412. // "repeated": true,
  3413. // "type": "string"
  3414. // },
  3415. // "view": {
  3416. // "description": "Access level with which to view the returned result. Note that some fields require elevated access.",
  3417. // "enum": [
  3418. // "ADMIN",
  3419. // "AUTHOR",
  3420. // "READER"
  3421. // ],
  3422. // "enumDescriptions": [
  3423. // "Admin level detail",
  3424. // "Author level detail",
  3425. // "Reader level detail"
  3426. // ],
  3427. // "location": "query",
  3428. // "type": "string"
  3429. // }
  3430. // },
  3431. // "path": "blogs/{blogId}/pages",
  3432. // "response": {
  3433. // "$ref": "PageList"
  3434. // },
  3435. // "scopes": [
  3436. // "https://www.googleapis.com/auth/blogger",
  3437. // "https://www.googleapis.com/auth/blogger.readonly"
  3438. // ]
  3439. // }
  3440. }
  3441. // Pages invokes f for each page of results.
  3442. // A non-nil error returned from f will halt the iteration.
  3443. // The provided context supersedes any context provided to the Context method.
  3444. func (c *PagesListCall) Pages(ctx context.Context, f func(*PageList) error) error {
  3445. c.ctx_ = ctx
  3446. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3447. for {
  3448. x, err := c.Do()
  3449. if err != nil {
  3450. return err
  3451. }
  3452. if err := f(x); err != nil {
  3453. return err
  3454. }
  3455. if x.NextPageToken == "" {
  3456. return nil
  3457. }
  3458. c.PageToken(x.NextPageToken)
  3459. }
  3460. }
  3461. // method id "blogger.pages.patch":
  3462. type PagesPatchCall struct {
  3463. s *Service
  3464. blogId string
  3465. pageId string
  3466. page *Page
  3467. urlParams_ gensupport.URLParams
  3468. ctx_ context.Context
  3469. }
  3470. // Patch: Update a page. This method supports patch semantics.
  3471. func (r *PagesService) Patch(blogId string, pageId string, page *Page) *PagesPatchCall {
  3472. c := &PagesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3473. c.blogId = blogId
  3474. c.pageId = pageId
  3475. c.page = page
  3476. return c
  3477. }
  3478. // Publish sets the optional parameter "publish": Whether a publish
  3479. // action should be performed when the page is updated (default: false).
  3480. func (c *PagesPatchCall) Publish(publish bool) *PagesPatchCall {
  3481. c.urlParams_.Set("publish", fmt.Sprint(publish))
  3482. return c
  3483. }
  3484. // Revert sets the optional parameter "revert": Whether a revert action
  3485. // should be performed when the page is updated (default: false).
  3486. func (c *PagesPatchCall) Revert(revert bool) *PagesPatchCall {
  3487. c.urlParams_.Set("revert", fmt.Sprint(revert))
  3488. return c
  3489. }
  3490. // Fields allows partial responses to be retrieved. See
  3491. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3492. // for more information.
  3493. func (c *PagesPatchCall) Fields(s ...googleapi.Field) *PagesPatchCall {
  3494. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3495. return c
  3496. }
  3497. // Context sets the context to be used in this call's Do method. Any
  3498. // pending HTTP request will be aborted if the provided context is
  3499. // canceled.
  3500. func (c *PagesPatchCall) Context(ctx context.Context) *PagesPatchCall {
  3501. c.ctx_ = ctx
  3502. return c
  3503. }
  3504. func (c *PagesPatchCall) doRequest(alt string) (*http.Response, error) {
  3505. var body io.Reader = nil
  3506. body, err := googleapi.WithoutDataWrapper.JSONReader(c.page)
  3507. if err != nil {
  3508. return nil, err
  3509. }
  3510. ctype := "application/json"
  3511. c.urlParams_.Set("alt", alt)
  3512. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pages/{pageId}")
  3513. urls += "?" + c.urlParams_.Encode()
  3514. req, _ := http.NewRequest("PATCH", urls, body)
  3515. googleapi.Expand(req.URL, map[string]string{
  3516. "blogId": c.blogId,
  3517. "pageId": c.pageId,
  3518. })
  3519. req.Header.Set("Content-Type", ctype)
  3520. req.Header.Set("User-Agent", c.s.userAgent())
  3521. if c.ctx_ != nil {
  3522. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3523. }
  3524. return c.s.client.Do(req)
  3525. }
  3526. // Do executes the "blogger.pages.patch" call.
  3527. // Exactly one of *Page or error will be non-nil. Any non-2xx status
  3528. // code is an error. Response headers are in either
  3529. // *Page.ServerResponse.Header or (if a response was returned at all) in
  3530. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3531. // whether the returned error was because http.StatusNotModified was
  3532. // returned.
  3533. func (c *PagesPatchCall) Do(opts ...googleapi.CallOption) (*Page, error) {
  3534. gensupport.SetOptions(c.urlParams_, opts...)
  3535. res, err := c.doRequest("json")
  3536. if res != nil && res.StatusCode == http.StatusNotModified {
  3537. if res.Body != nil {
  3538. res.Body.Close()
  3539. }
  3540. return nil, &googleapi.Error{
  3541. Code: res.StatusCode,
  3542. Header: res.Header,
  3543. }
  3544. }
  3545. if err != nil {
  3546. return nil, err
  3547. }
  3548. defer googleapi.CloseBody(res)
  3549. if err := googleapi.CheckResponse(res); err != nil {
  3550. return nil, err
  3551. }
  3552. ret := &Page{
  3553. ServerResponse: googleapi.ServerResponse{
  3554. Header: res.Header,
  3555. HTTPStatusCode: res.StatusCode,
  3556. },
  3557. }
  3558. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3559. return nil, err
  3560. }
  3561. return ret, nil
  3562. // {
  3563. // "description": "Update a page. This method supports patch semantics.",
  3564. // "httpMethod": "PATCH",
  3565. // "id": "blogger.pages.patch",
  3566. // "parameterOrder": [
  3567. // "blogId",
  3568. // "pageId"
  3569. // ],
  3570. // "parameters": {
  3571. // "blogId": {
  3572. // "description": "The ID of the Blog.",
  3573. // "location": "path",
  3574. // "required": true,
  3575. // "type": "string"
  3576. // },
  3577. // "pageId": {
  3578. // "description": "The ID of the Page.",
  3579. // "location": "path",
  3580. // "required": true,
  3581. // "type": "string"
  3582. // },
  3583. // "publish": {
  3584. // "description": "Whether a publish action should be performed when the page is updated (default: false).",
  3585. // "location": "query",
  3586. // "type": "boolean"
  3587. // },
  3588. // "revert": {
  3589. // "description": "Whether a revert action should be performed when the page is updated (default: false).",
  3590. // "location": "query",
  3591. // "type": "boolean"
  3592. // }
  3593. // },
  3594. // "path": "blogs/{blogId}/pages/{pageId}",
  3595. // "request": {
  3596. // "$ref": "Page"
  3597. // },
  3598. // "response": {
  3599. // "$ref": "Page"
  3600. // },
  3601. // "scopes": [
  3602. // "https://www.googleapis.com/auth/blogger"
  3603. // ]
  3604. // }
  3605. }
  3606. // method id "blogger.pages.publish":
  3607. type PagesPublishCall struct {
  3608. s *Service
  3609. blogId string
  3610. pageId string
  3611. urlParams_ gensupport.URLParams
  3612. ctx_ context.Context
  3613. }
  3614. // Publish: Publishes a draft page.
  3615. func (r *PagesService) Publish(blogId string, pageId string) *PagesPublishCall {
  3616. c := &PagesPublishCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3617. c.blogId = blogId
  3618. c.pageId = pageId
  3619. return c
  3620. }
  3621. // Fields allows partial responses to be retrieved. See
  3622. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3623. // for more information.
  3624. func (c *PagesPublishCall) Fields(s ...googleapi.Field) *PagesPublishCall {
  3625. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3626. return c
  3627. }
  3628. // Context sets the context to be used in this call's Do method. Any
  3629. // pending HTTP request will be aborted if the provided context is
  3630. // canceled.
  3631. func (c *PagesPublishCall) Context(ctx context.Context) *PagesPublishCall {
  3632. c.ctx_ = ctx
  3633. return c
  3634. }
  3635. func (c *PagesPublishCall) doRequest(alt string) (*http.Response, error) {
  3636. var body io.Reader = nil
  3637. c.urlParams_.Set("alt", alt)
  3638. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pages/{pageId}/publish")
  3639. urls += "?" + c.urlParams_.Encode()
  3640. req, _ := http.NewRequest("POST", urls, body)
  3641. googleapi.Expand(req.URL, map[string]string{
  3642. "blogId": c.blogId,
  3643. "pageId": c.pageId,
  3644. })
  3645. req.Header.Set("User-Agent", c.s.userAgent())
  3646. if c.ctx_ != nil {
  3647. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3648. }
  3649. return c.s.client.Do(req)
  3650. }
  3651. // Do executes the "blogger.pages.publish" call.
  3652. // Exactly one of *Page or error will be non-nil. Any non-2xx status
  3653. // code is an error. Response headers are in either
  3654. // *Page.ServerResponse.Header or (if a response was returned at all) in
  3655. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3656. // whether the returned error was because http.StatusNotModified was
  3657. // returned.
  3658. func (c *PagesPublishCall) Do(opts ...googleapi.CallOption) (*Page, error) {
  3659. gensupport.SetOptions(c.urlParams_, opts...)
  3660. res, err := c.doRequest("json")
  3661. if res != nil && res.StatusCode == http.StatusNotModified {
  3662. if res.Body != nil {
  3663. res.Body.Close()
  3664. }
  3665. return nil, &googleapi.Error{
  3666. Code: res.StatusCode,
  3667. Header: res.Header,
  3668. }
  3669. }
  3670. if err != nil {
  3671. return nil, err
  3672. }
  3673. defer googleapi.CloseBody(res)
  3674. if err := googleapi.CheckResponse(res); err != nil {
  3675. return nil, err
  3676. }
  3677. ret := &Page{
  3678. ServerResponse: googleapi.ServerResponse{
  3679. Header: res.Header,
  3680. HTTPStatusCode: res.StatusCode,
  3681. },
  3682. }
  3683. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3684. return nil, err
  3685. }
  3686. return ret, nil
  3687. // {
  3688. // "description": "Publishes a draft page.",
  3689. // "httpMethod": "POST",
  3690. // "id": "blogger.pages.publish",
  3691. // "parameterOrder": [
  3692. // "blogId",
  3693. // "pageId"
  3694. // ],
  3695. // "parameters": {
  3696. // "blogId": {
  3697. // "description": "The ID of the blog.",
  3698. // "location": "path",
  3699. // "required": true,
  3700. // "type": "string"
  3701. // },
  3702. // "pageId": {
  3703. // "description": "The ID of the page.",
  3704. // "location": "path",
  3705. // "required": true,
  3706. // "type": "string"
  3707. // }
  3708. // },
  3709. // "path": "blogs/{blogId}/pages/{pageId}/publish",
  3710. // "response": {
  3711. // "$ref": "Page"
  3712. // },
  3713. // "scopes": [
  3714. // "https://www.googleapis.com/auth/blogger"
  3715. // ]
  3716. // }
  3717. }
  3718. // method id "blogger.pages.revert":
  3719. type PagesRevertCall struct {
  3720. s *Service
  3721. blogId string
  3722. pageId string
  3723. urlParams_ gensupport.URLParams
  3724. ctx_ context.Context
  3725. }
  3726. // Revert: Revert a published or scheduled page to draft state.
  3727. func (r *PagesService) Revert(blogId string, pageId string) *PagesRevertCall {
  3728. c := &PagesRevertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3729. c.blogId = blogId
  3730. c.pageId = pageId
  3731. return c
  3732. }
  3733. // Fields allows partial responses to be retrieved. See
  3734. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3735. // for more information.
  3736. func (c *PagesRevertCall) Fields(s ...googleapi.Field) *PagesRevertCall {
  3737. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3738. return c
  3739. }
  3740. // Context sets the context to be used in this call's Do method. Any
  3741. // pending HTTP request will be aborted if the provided context is
  3742. // canceled.
  3743. func (c *PagesRevertCall) Context(ctx context.Context) *PagesRevertCall {
  3744. c.ctx_ = ctx
  3745. return c
  3746. }
  3747. func (c *PagesRevertCall) doRequest(alt string) (*http.Response, error) {
  3748. var body io.Reader = nil
  3749. c.urlParams_.Set("alt", alt)
  3750. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pages/{pageId}/revert")
  3751. urls += "?" + c.urlParams_.Encode()
  3752. req, _ := http.NewRequest("POST", urls, body)
  3753. googleapi.Expand(req.URL, map[string]string{
  3754. "blogId": c.blogId,
  3755. "pageId": c.pageId,
  3756. })
  3757. req.Header.Set("User-Agent", c.s.userAgent())
  3758. if c.ctx_ != nil {
  3759. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3760. }
  3761. return c.s.client.Do(req)
  3762. }
  3763. // Do executes the "blogger.pages.revert" call.
  3764. // Exactly one of *Page or error will be non-nil. Any non-2xx status
  3765. // code is an error. Response headers are in either
  3766. // *Page.ServerResponse.Header or (if a response was returned at all) in
  3767. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3768. // whether the returned error was because http.StatusNotModified was
  3769. // returned.
  3770. func (c *PagesRevertCall) Do(opts ...googleapi.CallOption) (*Page, error) {
  3771. gensupport.SetOptions(c.urlParams_, opts...)
  3772. res, err := c.doRequest("json")
  3773. if res != nil && res.StatusCode == http.StatusNotModified {
  3774. if res.Body != nil {
  3775. res.Body.Close()
  3776. }
  3777. return nil, &googleapi.Error{
  3778. Code: res.StatusCode,
  3779. Header: res.Header,
  3780. }
  3781. }
  3782. if err != nil {
  3783. return nil, err
  3784. }
  3785. defer googleapi.CloseBody(res)
  3786. if err := googleapi.CheckResponse(res); err != nil {
  3787. return nil, err
  3788. }
  3789. ret := &Page{
  3790. ServerResponse: googleapi.ServerResponse{
  3791. Header: res.Header,
  3792. HTTPStatusCode: res.StatusCode,
  3793. },
  3794. }
  3795. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3796. return nil, err
  3797. }
  3798. return ret, nil
  3799. // {
  3800. // "description": "Revert a published or scheduled page to draft state.",
  3801. // "httpMethod": "POST",
  3802. // "id": "blogger.pages.revert",
  3803. // "parameterOrder": [
  3804. // "blogId",
  3805. // "pageId"
  3806. // ],
  3807. // "parameters": {
  3808. // "blogId": {
  3809. // "description": "The ID of the blog.",
  3810. // "location": "path",
  3811. // "required": true,
  3812. // "type": "string"
  3813. // },
  3814. // "pageId": {
  3815. // "description": "The ID of the page.",
  3816. // "location": "path",
  3817. // "required": true,
  3818. // "type": "string"
  3819. // }
  3820. // },
  3821. // "path": "blogs/{blogId}/pages/{pageId}/revert",
  3822. // "response": {
  3823. // "$ref": "Page"
  3824. // },
  3825. // "scopes": [
  3826. // "https://www.googleapis.com/auth/blogger"
  3827. // ]
  3828. // }
  3829. }
  3830. // method id "blogger.pages.update":
  3831. type PagesUpdateCall struct {
  3832. s *Service
  3833. blogId string
  3834. pageId string
  3835. page *Page
  3836. urlParams_ gensupport.URLParams
  3837. ctx_ context.Context
  3838. }
  3839. // Update: Update a page.
  3840. func (r *PagesService) Update(blogId string, pageId string, page *Page) *PagesUpdateCall {
  3841. c := &PagesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3842. c.blogId = blogId
  3843. c.pageId = pageId
  3844. c.page = page
  3845. return c
  3846. }
  3847. // Publish sets the optional parameter "publish": Whether a publish
  3848. // action should be performed when the page is updated (default: false).
  3849. func (c *PagesUpdateCall) Publish(publish bool) *PagesUpdateCall {
  3850. c.urlParams_.Set("publish", fmt.Sprint(publish))
  3851. return c
  3852. }
  3853. // Revert sets the optional parameter "revert": Whether a revert action
  3854. // should be performed when the page is updated (default: false).
  3855. func (c *PagesUpdateCall) Revert(revert bool) *PagesUpdateCall {
  3856. c.urlParams_.Set("revert", fmt.Sprint(revert))
  3857. return c
  3858. }
  3859. // Fields allows partial responses to be retrieved. See
  3860. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3861. // for more information.
  3862. func (c *PagesUpdateCall) Fields(s ...googleapi.Field) *PagesUpdateCall {
  3863. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3864. return c
  3865. }
  3866. // Context sets the context to be used in this call's Do method. Any
  3867. // pending HTTP request will be aborted if the provided context is
  3868. // canceled.
  3869. func (c *PagesUpdateCall) Context(ctx context.Context) *PagesUpdateCall {
  3870. c.ctx_ = ctx
  3871. return c
  3872. }
  3873. func (c *PagesUpdateCall) doRequest(alt string) (*http.Response, error) {
  3874. var body io.Reader = nil
  3875. body, err := googleapi.WithoutDataWrapper.JSONReader(c.page)
  3876. if err != nil {
  3877. return nil, err
  3878. }
  3879. ctype := "application/json"
  3880. c.urlParams_.Set("alt", alt)
  3881. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pages/{pageId}")
  3882. urls += "?" + c.urlParams_.Encode()
  3883. req, _ := http.NewRequest("PUT", urls, body)
  3884. googleapi.Expand(req.URL, map[string]string{
  3885. "blogId": c.blogId,
  3886. "pageId": c.pageId,
  3887. })
  3888. req.Header.Set("Content-Type", ctype)
  3889. req.Header.Set("User-Agent", c.s.userAgent())
  3890. if c.ctx_ != nil {
  3891. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3892. }
  3893. return c.s.client.Do(req)
  3894. }
  3895. // Do executes the "blogger.pages.update" call.
  3896. // Exactly one of *Page or error will be non-nil. Any non-2xx status
  3897. // code is an error. Response headers are in either
  3898. // *Page.ServerResponse.Header or (if a response was returned at all) in
  3899. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3900. // whether the returned error was because http.StatusNotModified was
  3901. // returned.
  3902. func (c *PagesUpdateCall) Do(opts ...googleapi.CallOption) (*Page, error) {
  3903. gensupport.SetOptions(c.urlParams_, opts...)
  3904. res, err := c.doRequest("json")
  3905. if res != nil && res.StatusCode == http.StatusNotModified {
  3906. if res.Body != nil {
  3907. res.Body.Close()
  3908. }
  3909. return nil, &googleapi.Error{
  3910. Code: res.StatusCode,
  3911. Header: res.Header,
  3912. }
  3913. }
  3914. if err != nil {
  3915. return nil, err
  3916. }
  3917. defer googleapi.CloseBody(res)
  3918. if err := googleapi.CheckResponse(res); err != nil {
  3919. return nil, err
  3920. }
  3921. ret := &Page{
  3922. ServerResponse: googleapi.ServerResponse{
  3923. Header: res.Header,
  3924. HTTPStatusCode: res.StatusCode,
  3925. },
  3926. }
  3927. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3928. return nil, err
  3929. }
  3930. return ret, nil
  3931. // {
  3932. // "description": "Update a page.",
  3933. // "httpMethod": "PUT",
  3934. // "id": "blogger.pages.update",
  3935. // "parameterOrder": [
  3936. // "blogId",
  3937. // "pageId"
  3938. // ],
  3939. // "parameters": {
  3940. // "blogId": {
  3941. // "description": "The ID of the Blog.",
  3942. // "location": "path",
  3943. // "required": true,
  3944. // "type": "string"
  3945. // },
  3946. // "pageId": {
  3947. // "description": "The ID of the Page.",
  3948. // "location": "path",
  3949. // "required": true,
  3950. // "type": "string"
  3951. // },
  3952. // "publish": {
  3953. // "description": "Whether a publish action should be performed when the page is updated (default: false).",
  3954. // "location": "query",
  3955. // "type": "boolean"
  3956. // },
  3957. // "revert": {
  3958. // "description": "Whether a revert action should be performed when the page is updated (default: false).",
  3959. // "location": "query",
  3960. // "type": "boolean"
  3961. // }
  3962. // },
  3963. // "path": "blogs/{blogId}/pages/{pageId}",
  3964. // "request": {
  3965. // "$ref": "Page"
  3966. // },
  3967. // "response": {
  3968. // "$ref": "Page"
  3969. // },
  3970. // "scopes": [
  3971. // "https://www.googleapis.com/auth/blogger"
  3972. // ]
  3973. // }
  3974. }
  3975. // method id "blogger.postUserInfos.get":
  3976. type PostUserInfosGetCall struct {
  3977. s *Service
  3978. userId string
  3979. blogId string
  3980. postId string
  3981. urlParams_ gensupport.URLParams
  3982. ifNoneMatch_ string
  3983. ctx_ context.Context
  3984. }
  3985. // Get: Gets one post and user info pair, by post ID and user ID. The
  3986. // post user info contains per-user information about the post, such as
  3987. // access rights, specific to the user.
  3988. func (r *PostUserInfosService) Get(userId string, blogId string, postId string) *PostUserInfosGetCall {
  3989. c := &PostUserInfosGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3990. c.userId = userId
  3991. c.blogId = blogId
  3992. c.postId = postId
  3993. return c
  3994. }
  3995. // MaxComments sets the optional parameter "maxComments": Maximum number
  3996. // of comments to pull back on a post.
  3997. func (c *PostUserInfosGetCall) MaxComments(maxComments int64) *PostUserInfosGetCall {
  3998. c.urlParams_.Set("maxComments", fmt.Sprint(maxComments))
  3999. return c
  4000. }
  4001. // Fields allows partial responses to be retrieved. See
  4002. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4003. // for more information.
  4004. func (c *PostUserInfosGetCall) Fields(s ...googleapi.Field) *PostUserInfosGetCall {
  4005. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4006. return c
  4007. }
  4008. // IfNoneMatch sets the optional parameter which makes the operation
  4009. // fail if the object's ETag matches the given value. This is useful for
  4010. // getting updates only after the object has changed since the last
  4011. // request. Use googleapi.IsNotModified to check whether the response
  4012. // error from Do is the result of In-None-Match.
  4013. func (c *PostUserInfosGetCall) IfNoneMatch(entityTag string) *PostUserInfosGetCall {
  4014. c.ifNoneMatch_ = entityTag
  4015. return c
  4016. }
  4017. // Context sets the context to be used in this call's Do method. Any
  4018. // pending HTTP request will be aborted if the provided context is
  4019. // canceled.
  4020. func (c *PostUserInfosGetCall) Context(ctx context.Context) *PostUserInfosGetCall {
  4021. c.ctx_ = ctx
  4022. return c
  4023. }
  4024. func (c *PostUserInfosGetCall) doRequest(alt string) (*http.Response, error) {
  4025. var body io.Reader = nil
  4026. c.urlParams_.Set("alt", alt)
  4027. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userId}/blogs/{blogId}/posts/{postId}")
  4028. urls += "?" + c.urlParams_.Encode()
  4029. req, _ := http.NewRequest("GET", urls, body)
  4030. googleapi.Expand(req.URL, map[string]string{
  4031. "userId": c.userId,
  4032. "blogId": c.blogId,
  4033. "postId": c.postId,
  4034. })
  4035. req.Header.Set("User-Agent", c.s.userAgent())
  4036. if c.ifNoneMatch_ != "" {
  4037. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4038. }
  4039. if c.ctx_ != nil {
  4040. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4041. }
  4042. return c.s.client.Do(req)
  4043. }
  4044. // Do executes the "blogger.postUserInfos.get" call.
  4045. // Exactly one of *PostUserInfo or error will be non-nil. Any non-2xx
  4046. // status code is an error. Response headers are in either
  4047. // *PostUserInfo.ServerResponse.Header or (if a response was returned at
  4048. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4049. // to check whether the returned error was because
  4050. // http.StatusNotModified was returned.
  4051. func (c *PostUserInfosGetCall) Do(opts ...googleapi.CallOption) (*PostUserInfo, error) {
  4052. gensupport.SetOptions(c.urlParams_, opts...)
  4053. res, err := c.doRequest("json")
  4054. if res != nil && res.StatusCode == http.StatusNotModified {
  4055. if res.Body != nil {
  4056. res.Body.Close()
  4057. }
  4058. return nil, &googleapi.Error{
  4059. Code: res.StatusCode,
  4060. Header: res.Header,
  4061. }
  4062. }
  4063. if err != nil {
  4064. return nil, err
  4065. }
  4066. defer googleapi.CloseBody(res)
  4067. if err := googleapi.CheckResponse(res); err != nil {
  4068. return nil, err
  4069. }
  4070. ret := &PostUserInfo{
  4071. ServerResponse: googleapi.ServerResponse{
  4072. Header: res.Header,
  4073. HTTPStatusCode: res.StatusCode,
  4074. },
  4075. }
  4076. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4077. return nil, err
  4078. }
  4079. return ret, nil
  4080. // {
  4081. // "description": "Gets one post and user info pair, by post ID and user ID. The post user info contains per-user information about the post, such as access rights, specific to the user.",
  4082. // "httpMethod": "GET",
  4083. // "id": "blogger.postUserInfos.get",
  4084. // "parameterOrder": [
  4085. // "userId",
  4086. // "blogId",
  4087. // "postId"
  4088. // ],
  4089. // "parameters": {
  4090. // "blogId": {
  4091. // "description": "The ID of the blog.",
  4092. // "location": "path",
  4093. // "required": true,
  4094. // "type": "string"
  4095. // },
  4096. // "maxComments": {
  4097. // "description": "Maximum number of comments to pull back on a post.",
  4098. // "format": "uint32",
  4099. // "location": "query",
  4100. // "type": "integer"
  4101. // },
  4102. // "postId": {
  4103. // "description": "The ID of the post to get.",
  4104. // "location": "path",
  4105. // "required": true,
  4106. // "type": "string"
  4107. // },
  4108. // "userId": {
  4109. // "description": "ID of the user for the per-user information to be fetched. Either the word 'self' (sans quote marks) or the user's profile identifier.",
  4110. // "location": "path",
  4111. // "required": true,
  4112. // "type": "string"
  4113. // }
  4114. // },
  4115. // "path": "users/{userId}/blogs/{blogId}/posts/{postId}",
  4116. // "response": {
  4117. // "$ref": "PostUserInfo"
  4118. // },
  4119. // "scopes": [
  4120. // "https://www.googleapis.com/auth/blogger",
  4121. // "https://www.googleapis.com/auth/blogger.readonly"
  4122. // ]
  4123. // }
  4124. }
  4125. // method id "blogger.postUserInfos.list":
  4126. type PostUserInfosListCall struct {
  4127. s *Service
  4128. userId string
  4129. blogId string
  4130. urlParams_ gensupport.URLParams
  4131. ifNoneMatch_ string
  4132. ctx_ context.Context
  4133. }
  4134. // List: Retrieves a list of post and post user info pairs, possibly
  4135. // filtered. The post user info contains per-user information about the
  4136. // post, such as access rights, specific to the user.
  4137. func (r *PostUserInfosService) List(userId string, blogId string) *PostUserInfosListCall {
  4138. c := &PostUserInfosListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4139. c.userId = userId
  4140. c.blogId = blogId
  4141. return c
  4142. }
  4143. // EndDate sets the optional parameter "endDate": Latest post date to
  4144. // fetch, a date-time with RFC 3339 formatting.
  4145. func (c *PostUserInfosListCall) EndDate(endDate string) *PostUserInfosListCall {
  4146. c.urlParams_.Set("endDate", endDate)
  4147. return c
  4148. }
  4149. // FetchBodies sets the optional parameter "fetchBodies": Whether the
  4150. // body content of posts is included. Default is false.
  4151. func (c *PostUserInfosListCall) FetchBodies(fetchBodies bool) *PostUserInfosListCall {
  4152. c.urlParams_.Set("fetchBodies", fmt.Sprint(fetchBodies))
  4153. return c
  4154. }
  4155. // Labels sets the optional parameter "labels": Comma-separated list of
  4156. // labels to search for.
  4157. func (c *PostUserInfosListCall) Labels(labels string) *PostUserInfosListCall {
  4158. c.urlParams_.Set("labels", labels)
  4159. return c
  4160. }
  4161. // MaxResults sets the optional parameter "maxResults": Maximum number
  4162. // of posts to fetch.
  4163. func (c *PostUserInfosListCall) MaxResults(maxResults int64) *PostUserInfosListCall {
  4164. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4165. return c
  4166. }
  4167. // OrderBy sets the optional parameter "orderBy": Sort order applied to
  4168. // search results. Default is published.
  4169. //
  4170. // Possible values:
  4171. // "published" - Order by the date the post was published
  4172. // "updated" - Order by the date the post was last updated
  4173. func (c *PostUserInfosListCall) OrderBy(orderBy string) *PostUserInfosListCall {
  4174. c.urlParams_.Set("orderBy", orderBy)
  4175. return c
  4176. }
  4177. // PageToken sets the optional parameter "pageToken": Continuation token
  4178. // if the request is paged.
  4179. func (c *PostUserInfosListCall) PageToken(pageToken string) *PostUserInfosListCall {
  4180. c.urlParams_.Set("pageToken", pageToken)
  4181. return c
  4182. }
  4183. // StartDate sets the optional parameter "startDate": Earliest post date
  4184. // to fetch, a date-time with RFC 3339 formatting.
  4185. func (c *PostUserInfosListCall) StartDate(startDate string) *PostUserInfosListCall {
  4186. c.urlParams_.Set("startDate", startDate)
  4187. return c
  4188. }
  4189. // Status sets the optional parameter "status":
  4190. //
  4191. // Possible values:
  4192. // "draft" - Draft posts
  4193. // "live" - Published posts
  4194. // "scheduled" - Posts that are scheduled to publish in future.
  4195. func (c *PostUserInfosListCall) Status(status ...string) *PostUserInfosListCall {
  4196. c.urlParams_.SetMulti("status", append([]string{}, status...))
  4197. return c
  4198. }
  4199. // View sets the optional parameter "view": Access level with which to
  4200. // view the returned result. Note that some fields require elevated
  4201. // access.
  4202. //
  4203. // Possible values:
  4204. // "ADMIN" - Admin level detail
  4205. // "AUTHOR" - Author level detail
  4206. // "READER" - Reader level detail
  4207. func (c *PostUserInfosListCall) View(view string) *PostUserInfosListCall {
  4208. c.urlParams_.Set("view", view)
  4209. return c
  4210. }
  4211. // Fields allows partial responses to be retrieved. See
  4212. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4213. // for more information.
  4214. func (c *PostUserInfosListCall) Fields(s ...googleapi.Field) *PostUserInfosListCall {
  4215. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4216. return c
  4217. }
  4218. // IfNoneMatch sets the optional parameter which makes the operation
  4219. // fail if the object's ETag matches the given value. This is useful for
  4220. // getting updates only after the object has changed since the last
  4221. // request. Use googleapi.IsNotModified to check whether the response
  4222. // error from Do is the result of In-None-Match.
  4223. func (c *PostUserInfosListCall) IfNoneMatch(entityTag string) *PostUserInfosListCall {
  4224. c.ifNoneMatch_ = entityTag
  4225. return c
  4226. }
  4227. // Context sets the context to be used in this call's Do method. Any
  4228. // pending HTTP request will be aborted if the provided context is
  4229. // canceled.
  4230. func (c *PostUserInfosListCall) Context(ctx context.Context) *PostUserInfosListCall {
  4231. c.ctx_ = ctx
  4232. return c
  4233. }
  4234. func (c *PostUserInfosListCall) doRequest(alt string) (*http.Response, error) {
  4235. var body io.Reader = nil
  4236. c.urlParams_.Set("alt", alt)
  4237. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userId}/blogs/{blogId}/posts")
  4238. urls += "?" + c.urlParams_.Encode()
  4239. req, _ := http.NewRequest("GET", urls, body)
  4240. googleapi.Expand(req.URL, map[string]string{
  4241. "userId": c.userId,
  4242. "blogId": c.blogId,
  4243. })
  4244. req.Header.Set("User-Agent", c.s.userAgent())
  4245. if c.ifNoneMatch_ != "" {
  4246. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4247. }
  4248. if c.ctx_ != nil {
  4249. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4250. }
  4251. return c.s.client.Do(req)
  4252. }
  4253. // Do executes the "blogger.postUserInfos.list" call.
  4254. // Exactly one of *PostUserInfosList or error will be non-nil. Any
  4255. // non-2xx status code is an error. Response headers are in either
  4256. // *PostUserInfosList.ServerResponse.Header or (if a response was
  4257. // returned at all) in error.(*googleapi.Error).Header. Use
  4258. // googleapi.IsNotModified to check whether the returned error was
  4259. // because http.StatusNotModified was returned.
  4260. func (c *PostUserInfosListCall) Do(opts ...googleapi.CallOption) (*PostUserInfosList, error) {
  4261. gensupport.SetOptions(c.urlParams_, opts...)
  4262. res, err := c.doRequest("json")
  4263. if res != nil && res.StatusCode == http.StatusNotModified {
  4264. if res.Body != nil {
  4265. res.Body.Close()
  4266. }
  4267. return nil, &googleapi.Error{
  4268. Code: res.StatusCode,
  4269. Header: res.Header,
  4270. }
  4271. }
  4272. if err != nil {
  4273. return nil, err
  4274. }
  4275. defer googleapi.CloseBody(res)
  4276. if err := googleapi.CheckResponse(res); err != nil {
  4277. return nil, err
  4278. }
  4279. ret := &PostUserInfosList{
  4280. ServerResponse: googleapi.ServerResponse{
  4281. Header: res.Header,
  4282. HTTPStatusCode: res.StatusCode,
  4283. },
  4284. }
  4285. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4286. return nil, err
  4287. }
  4288. return ret, nil
  4289. // {
  4290. // "description": "Retrieves a list of post and post user info pairs, possibly filtered. The post user info contains per-user information about the post, such as access rights, specific to the user.",
  4291. // "httpMethod": "GET",
  4292. // "id": "blogger.postUserInfos.list",
  4293. // "parameterOrder": [
  4294. // "userId",
  4295. // "blogId"
  4296. // ],
  4297. // "parameters": {
  4298. // "blogId": {
  4299. // "description": "ID of the blog to fetch posts from.",
  4300. // "location": "path",
  4301. // "required": true,
  4302. // "type": "string"
  4303. // },
  4304. // "endDate": {
  4305. // "description": "Latest post date to fetch, a date-time with RFC 3339 formatting.",
  4306. // "format": "date-time",
  4307. // "location": "query",
  4308. // "type": "string"
  4309. // },
  4310. // "fetchBodies": {
  4311. // "default": "false",
  4312. // "description": "Whether the body content of posts is included. Default is false.",
  4313. // "location": "query",
  4314. // "type": "boolean"
  4315. // },
  4316. // "labels": {
  4317. // "description": "Comma-separated list of labels to search for.",
  4318. // "location": "query",
  4319. // "type": "string"
  4320. // },
  4321. // "maxResults": {
  4322. // "description": "Maximum number of posts to fetch.",
  4323. // "format": "uint32",
  4324. // "location": "query",
  4325. // "type": "integer"
  4326. // },
  4327. // "orderBy": {
  4328. // "default": "PUBLISHED",
  4329. // "description": "Sort order applied to search results. Default is published.",
  4330. // "enum": [
  4331. // "published",
  4332. // "updated"
  4333. // ],
  4334. // "enumDescriptions": [
  4335. // "Order by the date the post was published",
  4336. // "Order by the date the post was last updated"
  4337. // ],
  4338. // "location": "query",
  4339. // "type": "string"
  4340. // },
  4341. // "pageToken": {
  4342. // "description": "Continuation token if the request is paged.",
  4343. // "location": "query",
  4344. // "type": "string"
  4345. // },
  4346. // "startDate": {
  4347. // "description": "Earliest post date to fetch, a date-time with RFC 3339 formatting.",
  4348. // "format": "date-time",
  4349. // "location": "query",
  4350. // "type": "string"
  4351. // },
  4352. // "status": {
  4353. // "enum": [
  4354. // "draft",
  4355. // "live",
  4356. // "scheduled"
  4357. // ],
  4358. // "enumDescriptions": [
  4359. // "Draft posts",
  4360. // "Published posts",
  4361. // "Posts that are scheduled to publish in future."
  4362. // ],
  4363. // "location": "query",
  4364. // "repeated": true,
  4365. // "type": "string"
  4366. // },
  4367. // "userId": {
  4368. // "description": "ID of the user for the per-user information to be fetched. Either the word 'self' (sans quote marks) or the user's profile identifier.",
  4369. // "location": "path",
  4370. // "required": true,
  4371. // "type": "string"
  4372. // },
  4373. // "view": {
  4374. // "description": "Access level with which to view the returned result. Note that some fields require elevated access.",
  4375. // "enum": [
  4376. // "ADMIN",
  4377. // "AUTHOR",
  4378. // "READER"
  4379. // ],
  4380. // "enumDescriptions": [
  4381. // "Admin level detail",
  4382. // "Author level detail",
  4383. // "Reader level detail"
  4384. // ],
  4385. // "location": "query",
  4386. // "type": "string"
  4387. // }
  4388. // },
  4389. // "path": "users/{userId}/blogs/{blogId}/posts",
  4390. // "response": {
  4391. // "$ref": "PostUserInfosList"
  4392. // },
  4393. // "scopes": [
  4394. // "https://www.googleapis.com/auth/blogger",
  4395. // "https://www.googleapis.com/auth/blogger.readonly"
  4396. // ]
  4397. // }
  4398. }
  4399. // Pages invokes f for each page of results.
  4400. // A non-nil error returned from f will halt the iteration.
  4401. // The provided context supersedes any context provided to the Context method.
  4402. func (c *PostUserInfosListCall) Pages(ctx context.Context, f func(*PostUserInfosList) error) error {
  4403. c.ctx_ = ctx
  4404. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4405. for {
  4406. x, err := c.Do()
  4407. if err != nil {
  4408. return err
  4409. }
  4410. if err := f(x); err != nil {
  4411. return err
  4412. }
  4413. if x.NextPageToken == "" {
  4414. return nil
  4415. }
  4416. c.PageToken(x.NextPageToken)
  4417. }
  4418. }
  4419. // method id "blogger.posts.delete":
  4420. type PostsDeleteCall struct {
  4421. s *Service
  4422. blogId string
  4423. postId string
  4424. urlParams_ gensupport.URLParams
  4425. ctx_ context.Context
  4426. }
  4427. // Delete: Delete a post by ID.
  4428. func (r *PostsService) Delete(blogId string, postId string) *PostsDeleteCall {
  4429. c := &PostsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4430. c.blogId = blogId
  4431. c.postId = postId
  4432. return c
  4433. }
  4434. // Fields allows partial responses to be retrieved. See
  4435. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4436. // for more information.
  4437. func (c *PostsDeleteCall) Fields(s ...googleapi.Field) *PostsDeleteCall {
  4438. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4439. return c
  4440. }
  4441. // Context sets the context to be used in this call's Do method. Any
  4442. // pending HTTP request will be aborted if the provided context is
  4443. // canceled.
  4444. func (c *PostsDeleteCall) Context(ctx context.Context) *PostsDeleteCall {
  4445. c.ctx_ = ctx
  4446. return c
  4447. }
  4448. func (c *PostsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4449. var body io.Reader = nil
  4450. c.urlParams_.Set("alt", alt)
  4451. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}")
  4452. urls += "?" + c.urlParams_.Encode()
  4453. req, _ := http.NewRequest("DELETE", urls, body)
  4454. googleapi.Expand(req.URL, map[string]string{
  4455. "blogId": c.blogId,
  4456. "postId": c.postId,
  4457. })
  4458. req.Header.Set("User-Agent", c.s.userAgent())
  4459. if c.ctx_ != nil {
  4460. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4461. }
  4462. return c.s.client.Do(req)
  4463. }
  4464. // Do executes the "blogger.posts.delete" call.
  4465. func (c *PostsDeleteCall) Do(opts ...googleapi.CallOption) error {
  4466. gensupport.SetOptions(c.urlParams_, opts...)
  4467. res, err := c.doRequest("json")
  4468. if err != nil {
  4469. return err
  4470. }
  4471. defer googleapi.CloseBody(res)
  4472. if err := googleapi.CheckResponse(res); err != nil {
  4473. return err
  4474. }
  4475. return nil
  4476. // {
  4477. // "description": "Delete a post by ID.",
  4478. // "httpMethod": "DELETE",
  4479. // "id": "blogger.posts.delete",
  4480. // "parameterOrder": [
  4481. // "blogId",
  4482. // "postId"
  4483. // ],
  4484. // "parameters": {
  4485. // "blogId": {
  4486. // "description": "The ID of the Blog.",
  4487. // "location": "path",
  4488. // "required": true,
  4489. // "type": "string"
  4490. // },
  4491. // "postId": {
  4492. // "description": "The ID of the Post.",
  4493. // "location": "path",
  4494. // "required": true,
  4495. // "type": "string"
  4496. // }
  4497. // },
  4498. // "path": "blogs/{blogId}/posts/{postId}",
  4499. // "scopes": [
  4500. // "https://www.googleapis.com/auth/blogger"
  4501. // ]
  4502. // }
  4503. }
  4504. // method id "blogger.posts.get":
  4505. type PostsGetCall struct {
  4506. s *Service
  4507. blogId string
  4508. postId string
  4509. urlParams_ gensupport.URLParams
  4510. ifNoneMatch_ string
  4511. ctx_ context.Context
  4512. }
  4513. // Get: Get a post by ID.
  4514. func (r *PostsService) Get(blogId string, postId string) *PostsGetCall {
  4515. c := &PostsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4516. c.blogId = blogId
  4517. c.postId = postId
  4518. return c
  4519. }
  4520. // FetchBody sets the optional parameter "fetchBody": Whether the body
  4521. // content of the post is included (default: true). This should be set
  4522. // to false when the post bodies are not required, to help minimize
  4523. // traffic.
  4524. func (c *PostsGetCall) FetchBody(fetchBody bool) *PostsGetCall {
  4525. c.urlParams_.Set("fetchBody", fmt.Sprint(fetchBody))
  4526. return c
  4527. }
  4528. // FetchImages sets the optional parameter "fetchImages": Whether image
  4529. // URL metadata for each post is included (default: false).
  4530. func (c *PostsGetCall) FetchImages(fetchImages bool) *PostsGetCall {
  4531. c.urlParams_.Set("fetchImages", fmt.Sprint(fetchImages))
  4532. return c
  4533. }
  4534. // MaxComments sets the optional parameter "maxComments": Maximum number
  4535. // of comments to pull back on a post.
  4536. func (c *PostsGetCall) MaxComments(maxComments int64) *PostsGetCall {
  4537. c.urlParams_.Set("maxComments", fmt.Sprint(maxComments))
  4538. return c
  4539. }
  4540. // View sets the optional parameter "view": Access level with which to
  4541. // view the returned result. Note that some fields require elevated
  4542. // access.
  4543. //
  4544. // Possible values:
  4545. // "ADMIN" - Admin level detail
  4546. // "AUTHOR" - Author level detail
  4547. // "READER" - Reader level detail
  4548. func (c *PostsGetCall) View(view string) *PostsGetCall {
  4549. c.urlParams_.Set("view", view)
  4550. return c
  4551. }
  4552. // Fields allows partial responses to be retrieved. See
  4553. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4554. // for more information.
  4555. func (c *PostsGetCall) Fields(s ...googleapi.Field) *PostsGetCall {
  4556. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4557. return c
  4558. }
  4559. // IfNoneMatch sets the optional parameter which makes the operation
  4560. // fail if the object's ETag matches the given value. This is useful for
  4561. // getting updates only after the object has changed since the last
  4562. // request. Use googleapi.IsNotModified to check whether the response
  4563. // error from Do is the result of In-None-Match.
  4564. func (c *PostsGetCall) IfNoneMatch(entityTag string) *PostsGetCall {
  4565. c.ifNoneMatch_ = entityTag
  4566. return c
  4567. }
  4568. // Context sets the context to be used in this call's Do method. Any
  4569. // pending HTTP request will be aborted if the provided context is
  4570. // canceled.
  4571. func (c *PostsGetCall) Context(ctx context.Context) *PostsGetCall {
  4572. c.ctx_ = ctx
  4573. return c
  4574. }
  4575. func (c *PostsGetCall) doRequest(alt string) (*http.Response, error) {
  4576. var body io.Reader = nil
  4577. c.urlParams_.Set("alt", alt)
  4578. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}")
  4579. urls += "?" + c.urlParams_.Encode()
  4580. req, _ := http.NewRequest("GET", urls, body)
  4581. googleapi.Expand(req.URL, map[string]string{
  4582. "blogId": c.blogId,
  4583. "postId": c.postId,
  4584. })
  4585. req.Header.Set("User-Agent", c.s.userAgent())
  4586. if c.ifNoneMatch_ != "" {
  4587. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4588. }
  4589. if c.ctx_ != nil {
  4590. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4591. }
  4592. return c.s.client.Do(req)
  4593. }
  4594. // Do executes the "blogger.posts.get" call.
  4595. // Exactly one of *Post or error will be non-nil. Any non-2xx status
  4596. // code is an error. Response headers are in either
  4597. // *Post.ServerResponse.Header or (if a response was returned at all) in
  4598. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4599. // whether the returned error was because http.StatusNotModified was
  4600. // returned.
  4601. func (c *PostsGetCall) Do(opts ...googleapi.CallOption) (*Post, error) {
  4602. gensupport.SetOptions(c.urlParams_, opts...)
  4603. res, err := c.doRequest("json")
  4604. if res != nil && res.StatusCode == http.StatusNotModified {
  4605. if res.Body != nil {
  4606. res.Body.Close()
  4607. }
  4608. return nil, &googleapi.Error{
  4609. Code: res.StatusCode,
  4610. Header: res.Header,
  4611. }
  4612. }
  4613. if err != nil {
  4614. return nil, err
  4615. }
  4616. defer googleapi.CloseBody(res)
  4617. if err := googleapi.CheckResponse(res); err != nil {
  4618. return nil, err
  4619. }
  4620. ret := &Post{
  4621. ServerResponse: googleapi.ServerResponse{
  4622. Header: res.Header,
  4623. HTTPStatusCode: res.StatusCode,
  4624. },
  4625. }
  4626. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4627. return nil, err
  4628. }
  4629. return ret, nil
  4630. // {
  4631. // "description": "Get a post by ID.",
  4632. // "httpMethod": "GET",
  4633. // "id": "blogger.posts.get",
  4634. // "parameterOrder": [
  4635. // "blogId",
  4636. // "postId"
  4637. // ],
  4638. // "parameters": {
  4639. // "blogId": {
  4640. // "description": "ID of the blog to fetch the post from.",
  4641. // "location": "path",
  4642. // "required": true,
  4643. // "type": "string"
  4644. // },
  4645. // "fetchBody": {
  4646. // "default": "true",
  4647. // "description": "Whether the body content of the post is included (default: true). This should be set to false when the post bodies are not required, to help minimize traffic.",
  4648. // "location": "query",
  4649. // "type": "boolean"
  4650. // },
  4651. // "fetchImages": {
  4652. // "description": "Whether image URL metadata for each post is included (default: false).",
  4653. // "location": "query",
  4654. // "type": "boolean"
  4655. // },
  4656. // "maxComments": {
  4657. // "description": "Maximum number of comments to pull back on a post.",
  4658. // "format": "uint32",
  4659. // "location": "query",
  4660. // "type": "integer"
  4661. // },
  4662. // "postId": {
  4663. // "description": "The ID of the post",
  4664. // "location": "path",
  4665. // "required": true,
  4666. // "type": "string"
  4667. // },
  4668. // "view": {
  4669. // "description": "Access level with which to view the returned result. Note that some fields require elevated access.",
  4670. // "enum": [
  4671. // "ADMIN",
  4672. // "AUTHOR",
  4673. // "READER"
  4674. // ],
  4675. // "enumDescriptions": [
  4676. // "Admin level detail",
  4677. // "Author level detail",
  4678. // "Reader level detail"
  4679. // ],
  4680. // "location": "query",
  4681. // "type": "string"
  4682. // }
  4683. // },
  4684. // "path": "blogs/{blogId}/posts/{postId}",
  4685. // "response": {
  4686. // "$ref": "Post"
  4687. // },
  4688. // "scopes": [
  4689. // "https://www.googleapis.com/auth/blogger",
  4690. // "https://www.googleapis.com/auth/blogger.readonly"
  4691. // ]
  4692. // }
  4693. }
  4694. // method id "blogger.posts.getByPath":
  4695. type PostsGetByPathCall struct {
  4696. s *Service
  4697. blogId string
  4698. urlParams_ gensupport.URLParams
  4699. ifNoneMatch_ string
  4700. ctx_ context.Context
  4701. }
  4702. // GetByPath: Retrieve a Post by Path.
  4703. func (r *PostsService) GetByPath(blogId string, path string) *PostsGetByPathCall {
  4704. c := &PostsGetByPathCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4705. c.blogId = blogId
  4706. c.urlParams_.Set("path", path)
  4707. return c
  4708. }
  4709. // MaxComments sets the optional parameter "maxComments": Maximum number
  4710. // of comments to pull back on a post.
  4711. func (c *PostsGetByPathCall) MaxComments(maxComments int64) *PostsGetByPathCall {
  4712. c.urlParams_.Set("maxComments", fmt.Sprint(maxComments))
  4713. return c
  4714. }
  4715. // View sets the optional parameter "view": Access level with which to
  4716. // view the returned result. Note that some fields require elevated
  4717. // access.
  4718. //
  4719. // Possible values:
  4720. // "ADMIN" - Admin level detail
  4721. // "AUTHOR" - Author level detail
  4722. // "READER" - Reader level detail
  4723. func (c *PostsGetByPathCall) View(view string) *PostsGetByPathCall {
  4724. c.urlParams_.Set("view", view)
  4725. return c
  4726. }
  4727. // Fields allows partial responses to be retrieved. See
  4728. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4729. // for more information.
  4730. func (c *PostsGetByPathCall) Fields(s ...googleapi.Field) *PostsGetByPathCall {
  4731. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4732. return c
  4733. }
  4734. // IfNoneMatch sets the optional parameter which makes the operation
  4735. // fail if the object's ETag matches the given value. This is useful for
  4736. // getting updates only after the object has changed since the last
  4737. // request. Use googleapi.IsNotModified to check whether the response
  4738. // error from Do is the result of In-None-Match.
  4739. func (c *PostsGetByPathCall) IfNoneMatch(entityTag string) *PostsGetByPathCall {
  4740. c.ifNoneMatch_ = entityTag
  4741. return c
  4742. }
  4743. // Context sets the context to be used in this call's Do method. Any
  4744. // pending HTTP request will be aborted if the provided context is
  4745. // canceled.
  4746. func (c *PostsGetByPathCall) Context(ctx context.Context) *PostsGetByPathCall {
  4747. c.ctx_ = ctx
  4748. return c
  4749. }
  4750. func (c *PostsGetByPathCall) doRequest(alt string) (*http.Response, error) {
  4751. var body io.Reader = nil
  4752. c.urlParams_.Set("alt", alt)
  4753. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/bypath")
  4754. urls += "?" + c.urlParams_.Encode()
  4755. req, _ := http.NewRequest("GET", urls, body)
  4756. googleapi.Expand(req.URL, map[string]string{
  4757. "blogId": c.blogId,
  4758. })
  4759. req.Header.Set("User-Agent", c.s.userAgent())
  4760. if c.ifNoneMatch_ != "" {
  4761. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4762. }
  4763. if c.ctx_ != nil {
  4764. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4765. }
  4766. return c.s.client.Do(req)
  4767. }
  4768. // Do executes the "blogger.posts.getByPath" call.
  4769. // Exactly one of *Post or error will be non-nil. Any non-2xx status
  4770. // code is an error. Response headers are in either
  4771. // *Post.ServerResponse.Header or (if a response was returned at all) in
  4772. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4773. // whether the returned error was because http.StatusNotModified was
  4774. // returned.
  4775. func (c *PostsGetByPathCall) Do(opts ...googleapi.CallOption) (*Post, error) {
  4776. gensupport.SetOptions(c.urlParams_, opts...)
  4777. res, err := c.doRequest("json")
  4778. if res != nil && res.StatusCode == http.StatusNotModified {
  4779. if res.Body != nil {
  4780. res.Body.Close()
  4781. }
  4782. return nil, &googleapi.Error{
  4783. Code: res.StatusCode,
  4784. Header: res.Header,
  4785. }
  4786. }
  4787. if err != nil {
  4788. return nil, err
  4789. }
  4790. defer googleapi.CloseBody(res)
  4791. if err := googleapi.CheckResponse(res); err != nil {
  4792. return nil, err
  4793. }
  4794. ret := &Post{
  4795. ServerResponse: googleapi.ServerResponse{
  4796. Header: res.Header,
  4797. HTTPStatusCode: res.StatusCode,
  4798. },
  4799. }
  4800. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4801. return nil, err
  4802. }
  4803. return ret, nil
  4804. // {
  4805. // "description": "Retrieve a Post by Path.",
  4806. // "httpMethod": "GET",
  4807. // "id": "blogger.posts.getByPath",
  4808. // "parameterOrder": [
  4809. // "blogId",
  4810. // "path"
  4811. // ],
  4812. // "parameters": {
  4813. // "blogId": {
  4814. // "description": "ID of the blog to fetch the post from.",
  4815. // "location": "path",
  4816. // "required": true,
  4817. // "type": "string"
  4818. // },
  4819. // "maxComments": {
  4820. // "description": "Maximum number of comments to pull back on a post.",
  4821. // "format": "uint32",
  4822. // "location": "query",
  4823. // "type": "integer"
  4824. // },
  4825. // "path": {
  4826. // "description": "Path of the Post to retrieve.",
  4827. // "location": "query",
  4828. // "required": true,
  4829. // "type": "string"
  4830. // },
  4831. // "view": {
  4832. // "description": "Access level with which to view the returned result. Note that some fields require elevated access.",
  4833. // "enum": [
  4834. // "ADMIN",
  4835. // "AUTHOR",
  4836. // "READER"
  4837. // ],
  4838. // "enumDescriptions": [
  4839. // "Admin level detail",
  4840. // "Author level detail",
  4841. // "Reader level detail"
  4842. // ],
  4843. // "location": "query",
  4844. // "type": "string"
  4845. // }
  4846. // },
  4847. // "path": "blogs/{blogId}/posts/bypath",
  4848. // "response": {
  4849. // "$ref": "Post"
  4850. // },
  4851. // "scopes": [
  4852. // "https://www.googleapis.com/auth/blogger",
  4853. // "https://www.googleapis.com/auth/blogger.readonly"
  4854. // ]
  4855. // }
  4856. }
  4857. // method id "blogger.posts.insert":
  4858. type PostsInsertCall struct {
  4859. s *Service
  4860. blogId string
  4861. post *Post
  4862. urlParams_ gensupport.URLParams
  4863. ctx_ context.Context
  4864. }
  4865. // Insert: Add a post.
  4866. func (r *PostsService) Insert(blogId string, post *Post) *PostsInsertCall {
  4867. c := &PostsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4868. c.blogId = blogId
  4869. c.post = post
  4870. return c
  4871. }
  4872. // FetchBody sets the optional parameter "fetchBody": Whether the body
  4873. // content of the post is included with the result (default: true).
  4874. func (c *PostsInsertCall) FetchBody(fetchBody bool) *PostsInsertCall {
  4875. c.urlParams_.Set("fetchBody", fmt.Sprint(fetchBody))
  4876. return c
  4877. }
  4878. // FetchImages sets the optional parameter "fetchImages": Whether image
  4879. // URL metadata for each post is included in the returned result
  4880. // (default: false).
  4881. func (c *PostsInsertCall) FetchImages(fetchImages bool) *PostsInsertCall {
  4882. c.urlParams_.Set("fetchImages", fmt.Sprint(fetchImages))
  4883. return c
  4884. }
  4885. // IsDraft sets the optional parameter "isDraft": Whether to create the
  4886. // post as a draft (default: false).
  4887. func (c *PostsInsertCall) IsDraft(isDraft bool) *PostsInsertCall {
  4888. c.urlParams_.Set("isDraft", fmt.Sprint(isDraft))
  4889. return c
  4890. }
  4891. // Fields allows partial responses to be retrieved. See
  4892. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4893. // for more information.
  4894. func (c *PostsInsertCall) Fields(s ...googleapi.Field) *PostsInsertCall {
  4895. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4896. return c
  4897. }
  4898. // Context sets the context to be used in this call's Do method. Any
  4899. // pending HTTP request will be aborted if the provided context is
  4900. // canceled.
  4901. func (c *PostsInsertCall) Context(ctx context.Context) *PostsInsertCall {
  4902. c.ctx_ = ctx
  4903. return c
  4904. }
  4905. func (c *PostsInsertCall) doRequest(alt string) (*http.Response, error) {
  4906. var body io.Reader = nil
  4907. body, err := googleapi.WithoutDataWrapper.JSONReader(c.post)
  4908. if err != nil {
  4909. return nil, err
  4910. }
  4911. ctype := "application/json"
  4912. c.urlParams_.Set("alt", alt)
  4913. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts")
  4914. urls += "?" + c.urlParams_.Encode()
  4915. req, _ := http.NewRequest("POST", urls, body)
  4916. googleapi.Expand(req.URL, map[string]string{
  4917. "blogId": c.blogId,
  4918. })
  4919. req.Header.Set("Content-Type", ctype)
  4920. req.Header.Set("User-Agent", c.s.userAgent())
  4921. if c.ctx_ != nil {
  4922. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4923. }
  4924. return c.s.client.Do(req)
  4925. }
  4926. // Do executes the "blogger.posts.insert" call.
  4927. // Exactly one of *Post or error will be non-nil. Any non-2xx status
  4928. // code is an error. Response headers are in either
  4929. // *Post.ServerResponse.Header or (if a response was returned at all) in
  4930. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4931. // whether the returned error was because http.StatusNotModified was
  4932. // returned.
  4933. func (c *PostsInsertCall) Do(opts ...googleapi.CallOption) (*Post, error) {
  4934. gensupport.SetOptions(c.urlParams_, opts...)
  4935. res, err := c.doRequest("json")
  4936. if res != nil && res.StatusCode == http.StatusNotModified {
  4937. if res.Body != nil {
  4938. res.Body.Close()
  4939. }
  4940. return nil, &googleapi.Error{
  4941. Code: res.StatusCode,
  4942. Header: res.Header,
  4943. }
  4944. }
  4945. if err != nil {
  4946. return nil, err
  4947. }
  4948. defer googleapi.CloseBody(res)
  4949. if err := googleapi.CheckResponse(res); err != nil {
  4950. return nil, err
  4951. }
  4952. ret := &Post{
  4953. ServerResponse: googleapi.ServerResponse{
  4954. Header: res.Header,
  4955. HTTPStatusCode: res.StatusCode,
  4956. },
  4957. }
  4958. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4959. return nil, err
  4960. }
  4961. return ret, nil
  4962. // {
  4963. // "description": "Add a post.",
  4964. // "httpMethod": "POST",
  4965. // "id": "blogger.posts.insert",
  4966. // "parameterOrder": [
  4967. // "blogId"
  4968. // ],
  4969. // "parameters": {
  4970. // "blogId": {
  4971. // "description": "ID of the blog to add the post to.",
  4972. // "location": "path",
  4973. // "required": true,
  4974. // "type": "string"
  4975. // },
  4976. // "fetchBody": {
  4977. // "default": "true",
  4978. // "description": "Whether the body content of the post is included with the result (default: true).",
  4979. // "location": "query",
  4980. // "type": "boolean"
  4981. // },
  4982. // "fetchImages": {
  4983. // "description": "Whether image URL metadata for each post is included in the returned result (default: false).",
  4984. // "location": "query",
  4985. // "type": "boolean"
  4986. // },
  4987. // "isDraft": {
  4988. // "description": "Whether to create the post as a draft (default: false).",
  4989. // "location": "query",
  4990. // "type": "boolean"
  4991. // }
  4992. // },
  4993. // "path": "blogs/{blogId}/posts",
  4994. // "request": {
  4995. // "$ref": "Post"
  4996. // },
  4997. // "response": {
  4998. // "$ref": "Post"
  4999. // },
  5000. // "scopes": [
  5001. // "https://www.googleapis.com/auth/blogger"
  5002. // ]
  5003. // }
  5004. }
  5005. // method id "blogger.posts.list":
  5006. type PostsListCall struct {
  5007. s *Service
  5008. blogId string
  5009. urlParams_ gensupport.URLParams
  5010. ifNoneMatch_ string
  5011. ctx_ context.Context
  5012. }
  5013. // List: Retrieves a list of posts, possibly filtered.
  5014. func (r *PostsService) List(blogId string) *PostsListCall {
  5015. c := &PostsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5016. c.blogId = blogId
  5017. return c
  5018. }
  5019. // EndDate sets the optional parameter "endDate": Latest post date to
  5020. // fetch, a date-time with RFC 3339 formatting.
  5021. func (c *PostsListCall) EndDate(endDate string) *PostsListCall {
  5022. c.urlParams_.Set("endDate", endDate)
  5023. return c
  5024. }
  5025. // FetchBodies sets the optional parameter "fetchBodies": Whether the
  5026. // body content of posts is included (default: true). This should be set
  5027. // to false when the post bodies are not required, to help minimize
  5028. // traffic.
  5029. func (c *PostsListCall) FetchBodies(fetchBodies bool) *PostsListCall {
  5030. c.urlParams_.Set("fetchBodies", fmt.Sprint(fetchBodies))
  5031. return c
  5032. }
  5033. // FetchImages sets the optional parameter "fetchImages": Whether image
  5034. // URL metadata for each post is included.
  5035. func (c *PostsListCall) FetchImages(fetchImages bool) *PostsListCall {
  5036. c.urlParams_.Set("fetchImages", fmt.Sprint(fetchImages))
  5037. return c
  5038. }
  5039. // Labels sets the optional parameter "labels": Comma-separated list of
  5040. // labels to search for.
  5041. func (c *PostsListCall) Labels(labels string) *PostsListCall {
  5042. c.urlParams_.Set("labels", labels)
  5043. return c
  5044. }
  5045. // MaxResults sets the optional parameter "maxResults": Maximum number
  5046. // of posts to fetch.
  5047. func (c *PostsListCall) MaxResults(maxResults int64) *PostsListCall {
  5048. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5049. return c
  5050. }
  5051. // OrderBy sets the optional parameter "orderBy": Sort search results
  5052. //
  5053. // Possible values:
  5054. // "published" - Order by the date the post was published
  5055. // "updated" - Order by the date the post was last updated
  5056. func (c *PostsListCall) OrderBy(orderBy string) *PostsListCall {
  5057. c.urlParams_.Set("orderBy", orderBy)
  5058. return c
  5059. }
  5060. // PageToken sets the optional parameter "pageToken": Continuation token
  5061. // if the request is paged.
  5062. func (c *PostsListCall) PageToken(pageToken string) *PostsListCall {
  5063. c.urlParams_.Set("pageToken", pageToken)
  5064. return c
  5065. }
  5066. // StartDate sets the optional parameter "startDate": Earliest post date
  5067. // to fetch, a date-time with RFC 3339 formatting.
  5068. func (c *PostsListCall) StartDate(startDate string) *PostsListCall {
  5069. c.urlParams_.Set("startDate", startDate)
  5070. return c
  5071. }
  5072. // Status sets the optional parameter "status": Statuses to include in
  5073. // the results.
  5074. //
  5075. // Possible values:
  5076. // "draft" - Draft (non-published) posts.
  5077. // "live" - Published posts
  5078. // "scheduled" - Posts that are scheduled to publish in the future.
  5079. func (c *PostsListCall) Status(status ...string) *PostsListCall {
  5080. c.urlParams_.SetMulti("status", append([]string{}, status...))
  5081. return c
  5082. }
  5083. // View sets the optional parameter "view": Access level with which to
  5084. // view the returned result. Note that some fields require escalated
  5085. // access.
  5086. //
  5087. // Possible values:
  5088. // "ADMIN" - Admin level detail
  5089. // "AUTHOR" - Author level detail
  5090. // "READER" - Reader level detail
  5091. func (c *PostsListCall) View(view string) *PostsListCall {
  5092. c.urlParams_.Set("view", view)
  5093. return c
  5094. }
  5095. // Fields allows partial responses to be retrieved. See
  5096. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5097. // for more information.
  5098. func (c *PostsListCall) Fields(s ...googleapi.Field) *PostsListCall {
  5099. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5100. return c
  5101. }
  5102. // IfNoneMatch sets the optional parameter which makes the operation
  5103. // fail if the object's ETag matches the given value. This is useful for
  5104. // getting updates only after the object has changed since the last
  5105. // request. Use googleapi.IsNotModified to check whether the response
  5106. // error from Do is the result of In-None-Match.
  5107. func (c *PostsListCall) IfNoneMatch(entityTag string) *PostsListCall {
  5108. c.ifNoneMatch_ = entityTag
  5109. return c
  5110. }
  5111. // Context sets the context to be used in this call's Do method. Any
  5112. // pending HTTP request will be aborted if the provided context is
  5113. // canceled.
  5114. func (c *PostsListCall) Context(ctx context.Context) *PostsListCall {
  5115. c.ctx_ = ctx
  5116. return c
  5117. }
  5118. func (c *PostsListCall) doRequest(alt string) (*http.Response, error) {
  5119. var body io.Reader = nil
  5120. c.urlParams_.Set("alt", alt)
  5121. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts")
  5122. urls += "?" + c.urlParams_.Encode()
  5123. req, _ := http.NewRequest("GET", urls, body)
  5124. googleapi.Expand(req.URL, map[string]string{
  5125. "blogId": c.blogId,
  5126. })
  5127. req.Header.Set("User-Agent", c.s.userAgent())
  5128. if c.ifNoneMatch_ != "" {
  5129. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  5130. }
  5131. if c.ctx_ != nil {
  5132. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5133. }
  5134. return c.s.client.Do(req)
  5135. }
  5136. // Do executes the "blogger.posts.list" call.
  5137. // Exactly one of *PostList or error will be non-nil. Any non-2xx status
  5138. // code is an error. Response headers are in either
  5139. // *PostList.ServerResponse.Header or (if a response was returned at
  5140. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5141. // to check whether the returned error was because
  5142. // http.StatusNotModified was returned.
  5143. func (c *PostsListCall) Do(opts ...googleapi.CallOption) (*PostList, error) {
  5144. gensupport.SetOptions(c.urlParams_, opts...)
  5145. res, err := c.doRequest("json")
  5146. if res != nil && res.StatusCode == http.StatusNotModified {
  5147. if res.Body != nil {
  5148. res.Body.Close()
  5149. }
  5150. return nil, &googleapi.Error{
  5151. Code: res.StatusCode,
  5152. Header: res.Header,
  5153. }
  5154. }
  5155. if err != nil {
  5156. return nil, err
  5157. }
  5158. defer googleapi.CloseBody(res)
  5159. if err := googleapi.CheckResponse(res); err != nil {
  5160. return nil, err
  5161. }
  5162. ret := &PostList{
  5163. ServerResponse: googleapi.ServerResponse{
  5164. Header: res.Header,
  5165. HTTPStatusCode: res.StatusCode,
  5166. },
  5167. }
  5168. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5169. return nil, err
  5170. }
  5171. return ret, nil
  5172. // {
  5173. // "description": "Retrieves a list of posts, possibly filtered.",
  5174. // "httpMethod": "GET",
  5175. // "id": "blogger.posts.list",
  5176. // "parameterOrder": [
  5177. // "blogId"
  5178. // ],
  5179. // "parameters": {
  5180. // "blogId": {
  5181. // "description": "ID of the blog to fetch posts from.",
  5182. // "location": "path",
  5183. // "required": true,
  5184. // "type": "string"
  5185. // },
  5186. // "endDate": {
  5187. // "description": "Latest post date to fetch, a date-time with RFC 3339 formatting.",
  5188. // "format": "date-time",
  5189. // "location": "query",
  5190. // "type": "string"
  5191. // },
  5192. // "fetchBodies": {
  5193. // "default": "true",
  5194. // "description": "Whether the body content of posts is included (default: true). This should be set to false when the post bodies are not required, to help minimize traffic.",
  5195. // "location": "query",
  5196. // "type": "boolean"
  5197. // },
  5198. // "fetchImages": {
  5199. // "description": "Whether image URL metadata for each post is included.",
  5200. // "location": "query",
  5201. // "type": "boolean"
  5202. // },
  5203. // "labels": {
  5204. // "description": "Comma-separated list of labels to search for.",
  5205. // "location": "query",
  5206. // "type": "string"
  5207. // },
  5208. // "maxResults": {
  5209. // "description": "Maximum number of posts to fetch.",
  5210. // "format": "uint32",
  5211. // "location": "query",
  5212. // "type": "integer"
  5213. // },
  5214. // "orderBy": {
  5215. // "default": "PUBLISHED",
  5216. // "description": "Sort search results",
  5217. // "enum": [
  5218. // "published",
  5219. // "updated"
  5220. // ],
  5221. // "enumDescriptions": [
  5222. // "Order by the date the post was published",
  5223. // "Order by the date the post was last updated"
  5224. // ],
  5225. // "location": "query",
  5226. // "type": "string"
  5227. // },
  5228. // "pageToken": {
  5229. // "description": "Continuation token if the request is paged.",
  5230. // "location": "query",
  5231. // "type": "string"
  5232. // },
  5233. // "startDate": {
  5234. // "description": "Earliest post date to fetch, a date-time with RFC 3339 formatting.",
  5235. // "format": "date-time",
  5236. // "location": "query",
  5237. // "type": "string"
  5238. // },
  5239. // "status": {
  5240. // "description": "Statuses to include in the results.",
  5241. // "enum": [
  5242. // "draft",
  5243. // "live",
  5244. // "scheduled"
  5245. // ],
  5246. // "enumDescriptions": [
  5247. // "Draft (non-published) posts.",
  5248. // "Published posts",
  5249. // "Posts that are scheduled to publish in the future."
  5250. // ],
  5251. // "location": "query",
  5252. // "repeated": true,
  5253. // "type": "string"
  5254. // },
  5255. // "view": {
  5256. // "description": "Access level with which to view the returned result. Note that some fields require escalated access.",
  5257. // "enum": [
  5258. // "ADMIN",
  5259. // "AUTHOR",
  5260. // "READER"
  5261. // ],
  5262. // "enumDescriptions": [
  5263. // "Admin level detail",
  5264. // "Author level detail",
  5265. // "Reader level detail"
  5266. // ],
  5267. // "location": "query",
  5268. // "type": "string"
  5269. // }
  5270. // },
  5271. // "path": "blogs/{blogId}/posts",
  5272. // "response": {
  5273. // "$ref": "PostList"
  5274. // },
  5275. // "scopes": [
  5276. // "https://www.googleapis.com/auth/blogger",
  5277. // "https://www.googleapis.com/auth/blogger.readonly"
  5278. // ]
  5279. // }
  5280. }
  5281. // Pages invokes f for each page of results.
  5282. // A non-nil error returned from f will halt the iteration.
  5283. // The provided context supersedes any context provided to the Context method.
  5284. func (c *PostsListCall) Pages(ctx context.Context, f func(*PostList) error) error {
  5285. c.ctx_ = ctx
  5286. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5287. for {
  5288. x, err := c.Do()
  5289. if err != nil {
  5290. return err
  5291. }
  5292. if err := f(x); err != nil {
  5293. return err
  5294. }
  5295. if x.NextPageToken == "" {
  5296. return nil
  5297. }
  5298. c.PageToken(x.NextPageToken)
  5299. }
  5300. }
  5301. // method id "blogger.posts.patch":
  5302. type PostsPatchCall struct {
  5303. s *Service
  5304. blogId string
  5305. postId string
  5306. post *Post
  5307. urlParams_ gensupport.URLParams
  5308. ctx_ context.Context
  5309. }
  5310. // Patch: Update a post. This method supports patch semantics.
  5311. func (r *PostsService) Patch(blogId string, postId string, post *Post) *PostsPatchCall {
  5312. c := &PostsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5313. c.blogId = blogId
  5314. c.postId = postId
  5315. c.post = post
  5316. return c
  5317. }
  5318. // FetchBody sets the optional parameter "fetchBody": Whether the body
  5319. // content of the post is included with the result (default: true).
  5320. func (c *PostsPatchCall) FetchBody(fetchBody bool) *PostsPatchCall {
  5321. c.urlParams_.Set("fetchBody", fmt.Sprint(fetchBody))
  5322. return c
  5323. }
  5324. // FetchImages sets the optional parameter "fetchImages": Whether image
  5325. // URL metadata for each post is included in the returned result
  5326. // (default: false).
  5327. func (c *PostsPatchCall) FetchImages(fetchImages bool) *PostsPatchCall {
  5328. c.urlParams_.Set("fetchImages", fmt.Sprint(fetchImages))
  5329. return c
  5330. }
  5331. // MaxComments sets the optional parameter "maxComments": Maximum number
  5332. // of comments to retrieve with the returned post.
  5333. func (c *PostsPatchCall) MaxComments(maxComments int64) *PostsPatchCall {
  5334. c.urlParams_.Set("maxComments", fmt.Sprint(maxComments))
  5335. return c
  5336. }
  5337. // Publish sets the optional parameter "publish": Whether a publish
  5338. // action should be performed when the post is updated (default: false).
  5339. func (c *PostsPatchCall) Publish(publish bool) *PostsPatchCall {
  5340. c.urlParams_.Set("publish", fmt.Sprint(publish))
  5341. return c
  5342. }
  5343. // Revert sets the optional parameter "revert": Whether a revert action
  5344. // should be performed when the post is updated (default: false).
  5345. func (c *PostsPatchCall) Revert(revert bool) *PostsPatchCall {
  5346. c.urlParams_.Set("revert", fmt.Sprint(revert))
  5347. return c
  5348. }
  5349. // Fields allows partial responses to be retrieved. See
  5350. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5351. // for more information.
  5352. func (c *PostsPatchCall) Fields(s ...googleapi.Field) *PostsPatchCall {
  5353. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5354. return c
  5355. }
  5356. // Context sets the context to be used in this call's Do method. Any
  5357. // pending HTTP request will be aborted if the provided context is
  5358. // canceled.
  5359. func (c *PostsPatchCall) Context(ctx context.Context) *PostsPatchCall {
  5360. c.ctx_ = ctx
  5361. return c
  5362. }
  5363. func (c *PostsPatchCall) doRequest(alt string) (*http.Response, error) {
  5364. var body io.Reader = nil
  5365. body, err := googleapi.WithoutDataWrapper.JSONReader(c.post)
  5366. if err != nil {
  5367. return nil, err
  5368. }
  5369. ctype := "application/json"
  5370. c.urlParams_.Set("alt", alt)
  5371. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}")
  5372. urls += "?" + c.urlParams_.Encode()
  5373. req, _ := http.NewRequest("PATCH", urls, body)
  5374. googleapi.Expand(req.URL, map[string]string{
  5375. "blogId": c.blogId,
  5376. "postId": c.postId,
  5377. })
  5378. req.Header.Set("Content-Type", ctype)
  5379. req.Header.Set("User-Agent", c.s.userAgent())
  5380. if c.ctx_ != nil {
  5381. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5382. }
  5383. return c.s.client.Do(req)
  5384. }
  5385. // Do executes the "blogger.posts.patch" call.
  5386. // Exactly one of *Post or error will be non-nil. Any non-2xx status
  5387. // code is an error. Response headers are in either
  5388. // *Post.ServerResponse.Header or (if a response was returned at all) in
  5389. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5390. // whether the returned error was because http.StatusNotModified was
  5391. // returned.
  5392. func (c *PostsPatchCall) Do(opts ...googleapi.CallOption) (*Post, error) {
  5393. gensupport.SetOptions(c.urlParams_, opts...)
  5394. res, err := c.doRequest("json")
  5395. if res != nil && res.StatusCode == http.StatusNotModified {
  5396. if res.Body != nil {
  5397. res.Body.Close()
  5398. }
  5399. return nil, &googleapi.Error{
  5400. Code: res.StatusCode,
  5401. Header: res.Header,
  5402. }
  5403. }
  5404. if err != nil {
  5405. return nil, err
  5406. }
  5407. defer googleapi.CloseBody(res)
  5408. if err := googleapi.CheckResponse(res); err != nil {
  5409. return nil, err
  5410. }
  5411. ret := &Post{
  5412. ServerResponse: googleapi.ServerResponse{
  5413. Header: res.Header,
  5414. HTTPStatusCode: res.StatusCode,
  5415. },
  5416. }
  5417. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5418. return nil, err
  5419. }
  5420. return ret, nil
  5421. // {
  5422. // "description": "Update a post. This method supports patch semantics.",
  5423. // "httpMethod": "PATCH",
  5424. // "id": "blogger.posts.patch",
  5425. // "parameterOrder": [
  5426. // "blogId",
  5427. // "postId"
  5428. // ],
  5429. // "parameters": {
  5430. // "blogId": {
  5431. // "description": "The ID of the Blog.",
  5432. // "location": "path",
  5433. // "required": true,
  5434. // "type": "string"
  5435. // },
  5436. // "fetchBody": {
  5437. // "default": "true",
  5438. // "description": "Whether the body content of the post is included with the result (default: true).",
  5439. // "location": "query",
  5440. // "type": "boolean"
  5441. // },
  5442. // "fetchImages": {
  5443. // "description": "Whether image URL metadata for each post is included in the returned result (default: false).",
  5444. // "location": "query",
  5445. // "type": "boolean"
  5446. // },
  5447. // "maxComments": {
  5448. // "description": "Maximum number of comments to retrieve with the returned post.",
  5449. // "format": "uint32",
  5450. // "location": "query",
  5451. // "type": "integer"
  5452. // },
  5453. // "postId": {
  5454. // "description": "The ID of the Post.",
  5455. // "location": "path",
  5456. // "required": true,
  5457. // "type": "string"
  5458. // },
  5459. // "publish": {
  5460. // "description": "Whether a publish action should be performed when the post is updated (default: false).",
  5461. // "location": "query",
  5462. // "type": "boolean"
  5463. // },
  5464. // "revert": {
  5465. // "description": "Whether a revert action should be performed when the post is updated (default: false).",
  5466. // "location": "query",
  5467. // "type": "boolean"
  5468. // }
  5469. // },
  5470. // "path": "blogs/{blogId}/posts/{postId}",
  5471. // "request": {
  5472. // "$ref": "Post"
  5473. // },
  5474. // "response": {
  5475. // "$ref": "Post"
  5476. // },
  5477. // "scopes": [
  5478. // "https://www.googleapis.com/auth/blogger"
  5479. // ]
  5480. // }
  5481. }
  5482. // method id "blogger.posts.publish":
  5483. type PostsPublishCall struct {
  5484. s *Service
  5485. blogId string
  5486. postId string
  5487. urlParams_ gensupport.URLParams
  5488. ctx_ context.Context
  5489. }
  5490. // Publish: Publishes a draft post, optionally at the specific time of
  5491. // the given publishDate parameter.
  5492. func (r *PostsService) Publish(blogId string, postId string) *PostsPublishCall {
  5493. c := &PostsPublishCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5494. c.blogId = blogId
  5495. c.postId = postId
  5496. return c
  5497. }
  5498. // PublishDate sets the optional parameter "publishDate": Optional date
  5499. // and time to schedule the publishing of the Blog. If no publishDate
  5500. // parameter is given, the post is either published at the a previously
  5501. // saved schedule date (if present), or the current time. If a future
  5502. // date is given, the post will be scheduled to be published.
  5503. func (c *PostsPublishCall) PublishDate(publishDate string) *PostsPublishCall {
  5504. c.urlParams_.Set("publishDate", publishDate)
  5505. return c
  5506. }
  5507. // Fields allows partial responses to be retrieved. See
  5508. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5509. // for more information.
  5510. func (c *PostsPublishCall) Fields(s ...googleapi.Field) *PostsPublishCall {
  5511. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5512. return c
  5513. }
  5514. // Context sets the context to be used in this call's Do method. Any
  5515. // pending HTTP request will be aborted if the provided context is
  5516. // canceled.
  5517. func (c *PostsPublishCall) Context(ctx context.Context) *PostsPublishCall {
  5518. c.ctx_ = ctx
  5519. return c
  5520. }
  5521. func (c *PostsPublishCall) doRequest(alt string) (*http.Response, error) {
  5522. var body io.Reader = nil
  5523. c.urlParams_.Set("alt", alt)
  5524. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}/publish")
  5525. urls += "?" + c.urlParams_.Encode()
  5526. req, _ := http.NewRequest("POST", urls, body)
  5527. googleapi.Expand(req.URL, map[string]string{
  5528. "blogId": c.blogId,
  5529. "postId": c.postId,
  5530. })
  5531. req.Header.Set("User-Agent", c.s.userAgent())
  5532. if c.ctx_ != nil {
  5533. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5534. }
  5535. return c.s.client.Do(req)
  5536. }
  5537. // Do executes the "blogger.posts.publish" call.
  5538. // Exactly one of *Post or error will be non-nil. Any non-2xx status
  5539. // code is an error. Response headers are in either
  5540. // *Post.ServerResponse.Header or (if a response was returned at all) in
  5541. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5542. // whether the returned error was because http.StatusNotModified was
  5543. // returned.
  5544. func (c *PostsPublishCall) Do(opts ...googleapi.CallOption) (*Post, error) {
  5545. gensupport.SetOptions(c.urlParams_, opts...)
  5546. res, err := c.doRequest("json")
  5547. if res != nil && res.StatusCode == http.StatusNotModified {
  5548. if res.Body != nil {
  5549. res.Body.Close()
  5550. }
  5551. return nil, &googleapi.Error{
  5552. Code: res.StatusCode,
  5553. Header: res.Header,
  5554. }
  5555. }
  5556. if err != nil {
  5557. return nil, err
  5558. }
  5559. defer googleapi.CloseBody(res)
  5560. if err := googleapi.CheckResponse(res); err != nil {
  5561. return nil, err
  5562. }
  5563. ret := &Post{
  5564. ServerResponse: googleapi.ServerResponse{
  5565. Header: res.Header,
  5566. HTTPStatusCode: res.StatusCode,
  5567. },
  5568. }
  5569. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5570. return nil, err
  5571. }
  5572. return ret, nil
  5573. // {
  5574. // "description": "Publishes a draft post, optionally at the specific time of the given publishDate parameter.",
  5575. // "httpMethod": "POST",
  5576. // "id": "blogger.posts.publish",
  5577. // "parameterOrder": [
  5578. // "blogId",
  5579. // "postId"
  5580. // ],
  5581. // "parameters": {
  5582. // "blogId": {
  5583. // "description": "The ID of the Blog.",
  5584. // "location": "path",
  5585. // "required": true,
  5586. // "type": "string"
  5587. // },
  5588. // "postId": {
  5589. // "description": "The ID of the Post.",
  5590. // "location": "path",
  5591. // "required": true,
  5592. // "type": "string"
  5593. // },
  5594. // "publishDate": {
  5595. // "description": "Optional date and time to schedule the publishing of the Blog. If no publishDate parameter is given, the post is either published at the a previously saved schedule date (if present), or the current time. If a future date is given, the post will be scheduled to be published.",
  5596. // "format": "date-time",
  5597. // "location": "query",
  5598. // "type": "string"
  5599. // }
  5600. // },
  5601. // "path": "blogs/{blogId}/posts/{postId}/publish",
  5602. // "response": {
  5603. // "$ref": "Post"
  5604. // },
  5605. // "scopes": [
  5606. // "https://www.googleapis.com/auth/blogger"
  5607. // ]
  5608. // }
  5609. }
  5610. // method id "blogger.posts.revert":
  5611. type PostsRevertCall struct {
  5612. s *Service
  5613. blogId string
  5614. postId string
  5615. urlParams_ gensupport.URLParams
  5616. ctx_ context.Context
  5617. }
  5618. // Revert: Revert a published or scheduled post to draft state.
  5619. func (r *PostsService) Revert(blogId string, postId string) *PostsRevertCall {
  5620. c := &PostsRevertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5621. c.blogId = blogId
  5622. c.postId = postId
  5623. return c
  5624. }
  5625. // Fields allows partial responses to be retrieved. See
  5626. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5627. // for more information.
  5628. func (c *PostsRevertCall) Fields(s ...googleapi.Field) *PostsRevertCall {
  5629. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5630. return c
  5631. }
  5632. // Context sets the context to be used in this call's Do method. Any
  5633. // pending HTTP request will be aborted if the provided context is
  5634. // canceled.
  5635. func (c *PostsRevertCall) Context(ctx context.Context) *PostsRevertCall {
  5636. c.ctx_ = ctx
  5637. return c
  5638. }
  5639. func (c *PostsRevertCall) doRequest(alt string) (*http.Response, error) {
  5640. var body io.Reader = nil
  5641. c.urlParams_.Set("alt", alt)
  5642. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}/revert")
  5643. urls += "?" + c.urlParams_.Encode()
  5644. req, _ := http.NewRequest("POST", urls, body)
  5645. googleapi.Expand(req.URL, map[string]string{
  5646. "blogId": c.blogId,
  5647. "postId": c.postId,
  5648. })
  5649. req.Header.Set("User-Agent", c.s.userAgent())
  5650. if c.ctx_ != nil {
  5651. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5652. }
  5653. return c.s.client.Do(req)
  5654. }
  5655. // Do executes the "blogger.posts.revert" call.
  5656. // Exactly one of *Post or error will be non-nil. Any non-2xx status
  5657. // code is an error. Response headers are in either
  5658. // *Post.ServerResponse.Header or (if a response was returned at all) in
  5659. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5660. // whether the returned error was because http.StatusNotModified was
  5661. // returned.
  5662. func (c *PostsRevertCall) Do(opts ...googleapi.CallOption) (*Post, error) {
  5663. gensupport.SetOptions(c.urlParams_, opts...)
  5664. res, err := c.doRequest("json")
  5665. if res != nil && res.StatusCode == http.StatusNotModified {
  5666. if res.Body != nil {
  5667. res.Body.Close()
  5668. }
  5669. return nil, &googleapi.Error{
  5670. Code: res.StatusCode,
  5671. Header: res.Header,
  5672. }
  5673. }
  5674. if err != nil {
  5675. return nil, err
  5676. }
  5677. defer googleapi.CloseBody(res)
  5678. if err := googleapi.CheckResponse(res); err != nil {
  5679. return nil, err
  5680. }
  5681. ret := &Post{
  5682. ServerResponse: googleapi.ServerResponse{
  5683. Header: res.Header,
  5684. HTTPStatusCode: res.StatusCode,
  5685. },
  5686. }
  5687. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5688. return nil, err
  5689. }
  5690. return ret, nil
  5691. // {
  5692. // "description": "Revert a published or scheduled post to draft state.",
  5693. // "httpMethod": "POST",
  5694. // "id": "blogger.posts.revert",
  5695. // "parameterOrder": [
  5696. // "blogId",
  5697. // "postId"
  5698. // ],
  5699. // "parameters": {
  5700. // "blogId": {
  5701. // "description": "The ID of the Blog.",
  5702. // "location": "path",
  5703. // "required": true,
  5704. // "type": "string"
  5705. // },
  5706. // "postId": {
  5707. // "description": "The ID of the Post.",
  5708. // "location": "path",
  5709. // "required": true,
  5710. // "type": "string"
  5711. // }
  5712. // },
  5713. // "path": "blogs/{blogId}/posts/{postId}/revert",
  5714. // "response": {
  5715. // "$ref": "Post"
  5716. // },
  5717. // "scopes": [
  5718. // "https://www.googleapis.com/auth/blogger"
  5719. // ]
  5720. // }
  5721. }
  5722. // method id "blogger.posts.search":
  5723. type PostsSearchCall struct {
  5724. s *Service
  5725. blogId string
  5726. urlParams_ gensupport.URLParams
  5727. ifNoneMatch_ string
  5728. ctx_ context.Context
  5729. }
  5730. // Search: Search for a post.
  5731. func (r *PostsService) Search(blogId string, q string) *PostsSearchCall {
  5732. c := &PostsSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5733. c.blogId = blogId
  5734. c.urlParams_.Set("q", q)
  5735. return c
  5736. }
  5737. // FetchBodies sets the optional parameter "fetchBodies": Whether the
  5738. // body content of posts is included (default: true). This should be set
  5739. // to false when the post bodies are not required, to help minimize
  5740. // traffic.
  5741. func (c *PostsSearchCall) FetchBodies(fetchBodies bool) *PostsSearchCall {
  5742. c.urlParams_.Set("fetchBodies", fmt.Sprint(fetchBodies))
  5743. return c
  5744. }
  5745. // OrderBy sets the optional parameter "orderBy": Sort search results
  5746. //
  5747. // Possible values:
  5748. // "published" - Order by the date the post was published
  5749. // "updated" - Order by the date the post was last updated
  5750. func (c *PostsSearchCall) OrderBy(orderBy string) *PostsSearchCall {
  5751. c.urlParams_.Set("orderBy", orderBy)
  5752. return c
  5753. }
  5754. // Fields allows partial responses to be retrieved. See
  5755. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5756. // for more information.
  5757. func (c *PostsSearchCall) Fields(s ...googleapi.Field) *PostsSearchCall {
  5758. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5759. return c
  5760. }
  5761. // IfNoneMatch sets the optional parameter which makes the operation
  5762. // fail if the object's ETag matches the given value. This is useful for
  5763. // getting updates only after the object has changed since the last
  5764. // request. Use googleapi.IsNotModified to check whether the response
  5765. // error from Do is the result of In-None-Match.
  5766. func (c *PostsSearchCall) IfNoneMatch(entityTag string) *PostsSearchCall {
  5767. c.ifNoneMatch_ = entityTag
  5768. return c
  5769. }
  5770. // Context sets the context to be used in this call's Do method. Any
  5771. // pending HTTP request will be aborted if the provided context is
  5772. // canceled.
  5773. func (c *PostsSearchCall) Context(ctx context.Context) *PostsSearchCall {
  5774. c.ctx_ = ctx
  5775. return c
  5776. }
  5777. func (c *PostsSearchCall) doRequest(alt string) (*http.Response, error) {
  5778. var body io.Reader = nil
  5779. c.urlParams_.Set("alt", alt)
  5780. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/search")
  5781. urls += "?" + c.urlParams_.Encode()
  5782. req, _ := http.NewRequest("GET", urls, body)
  5783. googleapi.Expand(req.URL, map[string]string{
  5784. "blogId": c.blogId,
  5785. })
  5786. req.Header.Set("User-Agent", c.s.userAgent())
  5787. if c.ifNoneMatch_ != "" {
  5788. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  5789. }
  5790. if c.ctx_ != nil {
  5791. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5792. }
  5793. return c.s.client.Do(req)
  5794. }
  5795. // Do executes the "blogger.posts.search" call.
  5796. // Exactly one of *PostList or error will be non-nil. Any non-2xx status
  5797. // code is an error. Response headers are in either
  5798. // *PostList.ServerResponse.Header or (if a response was returned at
  5799. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5800. // to check whether the returned error was because
  5801. // http.StatusNotModified was returned.
  5802. func (c *PostsSearchCall) Do(opts ...googleapi.CallOption) (*PostList, error) {
  5803. gensupport.SetOptions(c.urlParams_, opts...)
  5804. res, err := c.doRequest("json")
  5805. if res != nil && res.StatusCode == http.StatusNotModified {
  5806. if res.Body != nil {
  5807. res.Body.Close()
  5808. }
  5809. return nil, &googleapi.Error{
  5810. Code: res.StatusCode,
  5811. Header: res.Header,
  5812. }
  5813. }
  5814. if err != nil {
  5815. return nil, err
  5816. }
  5817. defer googleapi.CloseBody(res)
  5818. if err := googleapi.CheckResponse(res); err != nil {
  5819. return nil, err
  5820. }
  5821. ret := &PostList{
  5822. ServerResponse: googleapi.ServerResponse{
  5823. Header: res.Header,
  5824. HTTPStatusCode: res.StatusCode,
  5825. },
  5826. }
  5827. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5828. return nil, err
  5829. }
  5830. return ret, nil
  5831. // {
  5832. // "description": "Search for a post.",
  5833. // "httpMethod": "GET",
  5834. // "id": "blogger.posts.search",
  5835. // "parameterOrder": [
  5836. // "blogId",
  5837. // "q"
  5838. // ],
  5839. // "parameters": {
  5840. // "blogId": {
  5841. // "description": "ID of the blog to fetch the post from.",
  5842. // "location": "path",
  5843. // "required": true,
  5844. // "type": "string"
  5845. // },
  5846. // "fetchBodies": {
  5847. // "default": "true",
  5848. // "description": "Whether the body content of posts is included (default: true). This should be set to false when the post bodies are not required, to help minimize traffic.",
  5849. // "location": "query",
  5850. // "type": "boolean"
  5851. // },
  5852. // "orderBy": {
  5853. // "default": "PUBLISHED",
  5854. // "description": "Sort search results",
  5855. // "enum": [
  5856. // "published",
  5857. // "updated"
  5858. // ],
  5859. // "enumDescriptions": [
  5860. // "Order by the date the post was published",
  5861. // "Order by the date the post was last updated"
  5862. // ],
  5863. // "location": "query",
  5864. // "type": "string"
  5865. // },
  5866. // "q": {
  5867. // "description": "Query terms to search this blog for matching posts.",
  5868. // "location": "query",
  5869. // "required": true,
  5870. // "type": "string"
  5871. // }
  5872. // },
  5873. // "path": "blogs/{blogId}/posts/search",
  5874. // "response": {
  5875. // "$ref": "PostList"
  5876. // },
  5877. // "scopes": [
  5878. // "https://www.googleapis.com/auth/blogger",
  5879. // "https://www.googleapis.com/auth/blogger.readonly"
  5880. // ]
  5881. // }
  5882. }
  5883. // method id "blogger.posts.update":
  5884. type PostsUpdateCall struct {
  5885. s *Service
  5886. blogId string
  5887. postId string
  5888. post *Post
  5889. urlParams_ gensupport.URLParams
  5890. ctx_ context.Context
  5891. }
  5892. // Update: Update a post.
  5893. func (r *PostsService) Update(blogId string, postId string, post *Post) *PostsUpdateCall {
  5894. c := &PostsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5895. c.blogId = blogId
  5896. c.postId = postId
  5897. c.post = post
  5898. return c
  5899. }
  5900. // FetchBody sets the optional parameter "fetchBody": Whether the body
  5901. // content of the post is included with the result (default: true).
  5902. func (c *PostsUpdateCall) FetchBody(fetchBody bool) *PostsUpdateCall {
  5903. c.urlParams_.Set("fetchBody", fmt.Sprint(fetchBody))
  5904. return c
  5905. }
  5906. // FetchImages sets the optional parameter "fetchImages": Whether image
  5907. // URL metadata for each post is included in the returned result
  5908. // (default: false).
  5909. func (c *PostsUpdateCall) FetchImages(fetchImages bool) *PostsUpdateCall {
  5910. c.urlParams_.Set("fetchImages", fmt.Sprint(fetchImages))
  5911. return c
  5912. }
  5913. // MaxComments sets the optional parameter "maxComments": Maximum number
  5914. // of comments to retrieve with the returned post.
  5915. func (c *PostsUpdateCall) MaxComments(maxComments int64) *PostsUpdateCall {
  5916. c.urlParams_.Set("maxComments", fmt.Sprint(maxComments))
  5917. return c
  5918. }
  5919. // Publish sets the optional parameter "publish": Whether a publish
  5920. // action should be performed when the post is updated (default: false).
  5921. func (c *PostsUpdateCall) Publish(publish bool) *PostsUpdateCall {
  5922. c.urlParams_.Set("publish", fmt.Sprint(publish))
  5923. return c
  5924. }
  5925. // Revert sets the optional parameter "revert": Whether a revert action
  5926. // should be performed when the post is updated (default: false).
  5927. func (c *PostsUpdateCall) Revert(revert bool) *PostsUpdateCall {
  5928. c.urlParams_.Set("revert", fmt.Sprint(revert))
  5929. return c
  5930. }
  5931. // Fields allows partial responses to be retrieved. See
  5932. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5933. // for more information.
  5934. func (c *PostsUpdateCall) Fields(s ...googleapi.Field) *PostsUpdateCall {
  5935. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5936. return c
  5937. }
  5938. // Context sets the context to be used in this call's Do method. Any
  5939. // pending HTTP request will be aborted if the provided context is
  5940. // canceled.
  5941. func (c *PostsUpdateCall) Context(ctx context.Context) *PostsUpdateCall {
  5942. c.ctx_ = ctx
  5943. return c
  5944. }
  5945. func (c *PostsUpdateCall) doRequest(alt string) (*http.Response, error) {
  5946. var body io.Reader = nil
  5947. body, err := googleapi.WithoutDataWrapper.JSONReader(c.post)
  5948. if err != nil {
  5949. return nil, err
  5950. }
  5951. ctype := "application/json"
  5952. c.urlParams_.Set("alt", alt)
  5953. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}")
  5954. urls += "?" + c.urlParams_.Encode()
  5955. req, _ := http.NewRequest("PUT", urls, body)
  5956. googleapi.Expand(req.URL, map[string]string{
  5957. "blogId": c.blogId,
  5958. "postId": c.postId,
  5959. })
  5960. req.Header.Set("Content-Type", ctype)
  5961. req.Header.Set("User-Agent", c.s.userAgent())
  5962. if c.ctx_ != nil {
  5963. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5964. }
  5965. return c.s.client.Do(req)
  5966. }
  5967. // Do executes the "blogger.posts.update" call.
  5968. // Exactly one of *Post or error will be non-nil. Any non-2xx status
  5969. // code is an error. Response headers are in either
  5970. // *Post.ServerResponse.Header or (if a response was returned at all) in
  5971. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5972. // whether the returned error was because http.StatusNotModified was
  5973. // returned.
  5974. func (c *PostsUpdateCall) Do(opts ...googleapi.CallOption) (*Post, error) {
  5975. gensupport.SetOptions(c.urlParams_, opts...)
  5976. res, err := c.doRequest("json")
  5977. if res != nil && res.StatusCode == http.StatusNotModified {
  5978. if res.Body != nil {
  5979. res.Body.Close()
  5980. }
  5981. return nil, &googleapi.Error{
  5982. Code: res.StatusCode,
  5983. Header: res.Header,
  5984. }
  5985. }
  5986. if err != nil {
  5987. return nil, err
  5988. }
  5989. defer googleapi.CloseBody(res)
  5990. if err := googleapi.CheckResponse(res); err != nil {
  5991. return nil, err
  5992. }
  5993. ret := &Post{
  5994. ServerResponse: googleapi.ServerResponse{
  5995. Header: res.Header,
  5996. HTTPStatusCode: res.StatusCode,
  5997. },
  5998. }
  5999. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6000. return nil, err
  6001. }
  6002. return ret, nil
  6003. // {
  6004. // "description": "Update a post.",
  6005. // "httpMethod": "PUT",
  6006. // "id": "blogger.posts.update",
  6007. // "parameterOrder": [
  6008. // "blogId",
  6009. // "postId"
  6010. // ],
  6011. // "parameters": {
  6012. // "blogId": {
  6013. // "description": "The ID of the Blog.",
  6014. // "location": "path",
  6015. // "required": true,
  6016. // "type": "string"
  6017. // },
  6018. // "fetchBody": {
  6019. // "default": "true",
  6020. // "description": "Whether the body content of the post is included with the result (default: true).",
  6021. // "location": "query",
  6022. // "type": "boolean"
  6023. // },
  6024. // "fetchImages": {
  6025. // "description": "Whether image URL metadata for each post is included in the returned result (default: false).",
  6026. // "location": "query",
  6027. // "type": "boolean"
  6028. // },
  6029. // "maxComments": {
  6030. // "description": "Maximum number of comments to retrieve with the returned post.",
  6031. // "format": "uint32",
  6032. // "location": "query",
  6033. // "type": "integer"
  6034. // },
  6035. // "postId": {
  6036. // "description": "The ID of the Post.",
  6037. // "location": "path",
  6038. // "required": true,
  6039. // "type": "string"
  6040. // },
  6041. // "publish": {
  6042. // "description": "Whether a publish action should be performed when the post is updated (default: false).",
  6043. // "location": "query",
  6044. // "type": "boolean"
  6045. // },
  6046. // "revert": {
  6047. // "description": "Whether a revert action should be performed when the post is updated (default: false).",
  6048. // "location": "query",
  6049. // "type": "boolean"
  6050. // }
  6051. // },
  6052. // "path": "blogs/{blogId}/posts/{postId}",
  6053. // "request": {
  6054. // "$ref": "Post"
  6055. // },
  6056. // "response": {
  6057. // "$ref": "Post"
  6058. // },
  6059. // "scopes": [
  6060. // "https://www.googleapis.com/auth/blogger"
  6061. // ]
  6062. // }
  6063. }
  6064. // method id "blogger.users.get":
  6065. type UsersGetCall struct {
  6066. s *Service
  6067. userId string
  6068. urlParams_ gensupport.URLParams
  6069. ifNoneMatch_ string
  6070. ctx_ context.Context
  6071. }
  6072. // Get: Gets one user by ID.
  6073. func (r *UsersService) Get(userId string) *UsersGetCall {
  6074. c := &UsersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6075. c.userId = userId
  6076. return c
  6077. }
  6078. // Fields allows partial responses to be retrieved. See
  6079. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6080. // for more information.
  6081. func (c *UsersGetCall) Fields(s ...googleapi.Field) *UsersGetCall {
  6082. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6083. return c
  6084. }
  6085. // IfNoneMatch sets the optional parameter which makes the operation
  6086. // fail if the object's ETag matches the given value. This is useful for
  6087. // getting updates only after the object has changed since the last
  6088. // request. Use googleapi.IsNotModified to check whether the response
  6089. // error from Do is the result of In-None-Match.
  6090. func (c *UsersGetCall) IfNoneMatch(entityTag string) *UsersGetCall {
  6091. c.ifNoneMatch_ = entityTag
  6092. return c
  6093. }
  6094. // Context sets the context to be used in this call's Do method. Any
  6095. // pending HTTP request will be aborted if the provided context is
  6096. // canceled.
  6097. func (c *UsersGetCall) Context(ctx context.Context) *UsersGetCall {
  6098. c.ctx_ = ctx
  6099. return c
  6100. }
  6101. func (c *UsersGetCall) doRequest(alt string) (*http.Response, error) {
  6102. var body io.Reader = nil
  6103. c.urlParams_.Set("alt", alt)
  6104. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userId}")
  6105. urls += "?" + c.urlParams_.Encode()
  6106. req, _ := http.NewRequest("GET", urls, body)
  6107. googleapi.Expand(req.URL, map[string]string{
  6108. "userId": c.userId,
  6109. })
  6110. req.Header.Set("User-Agent", c.s.userAgent())
  6111. if c.ifNoneMatch_ != "" {
  6112. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  6113. }
  6114. if c.ctx_ != nil {
  6115. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6116. }
  6117. return c.s.client.Do(req)
  6118. }
  6119. // Do executes the "blogger.users.get" call.
  6120. // Exactly one of *User or error will be non-nil. Any non-2xx status
  6121. // code is an error. Response headers are in either
  6122. // *User.ServerResponse.Header or (if a response was returned at all) in
  6123. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6124. // whether the returned error was because http.StatusNotModified was
  6125. // returned.
  6126. func (c *UsersGetCall) Do(opts ...googleapi.CallOption) (*User, error) {
  6127. gensupport.SetOptions(c.urlParams_, opts...)
  6128. res, err := c.doRequest("json")
  6129. if res != nil && res.StatusCode == http.StatusNotModified {
  6130. if res.Body != nil {
  6131. res.Body.Close()
  6132. }
  6133. return nil, &googleapi.Error{
  6134. Code: res.StatusCode,
  6135. Header: res.Header,
  6136. }
  6137. }
  6138. if err != nil {
  6139. return nil, err
  6140. }
  6141. defer googleapi.CloseBody(res)
  6142. if err := googleapi.CheckResponse(res); err != nil {
  6143. return nil, err
  6144. }
  6145. ret := &User{
  6146. ServerResponse: googleapi.ServerResponse{
  6147. Header: res.Header,
  6148. HTTPStatusCode: res.StatusCode,
  6149. },
  6150. }
  6151. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6152. return nil, err
  6153. }
  6154. return ret, nil
  6155. // {
  6156. // "description": "Gets one user by ID.",
  6157. // "httpMethod": "GET",
  6158. // "id": "blogger.users.get",
  6159. // "parameterOrder": [
  6160. // "userId"
  6161. // ],
  6162. // "parameters": {
  6163. // "userId": {
  6164. // "description": "The ID of the user to get.",
  6165. // "location": "path",
  6166. // "required": true,
  6167. // "type": "string"
  6168. // }
  6169. // },
  6170. // "path": "users/{userId}",
  6171. // "response": {
  6172. // "$ref": "User"
  6173. // },
  6174. // "scopes": [
  6175. // "https://www.googleapis.com/auth/blogger",
  6176. // "https://www.googleapis.com/auth/blogger.readonly"
  6177. // ]
  6178. // }
  6179. }