adsense-gen.go 200 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060
  1. // Package adsense provides access to the AdSense Management API.
  2. //
  3. // See https://developers.google.com/adsense/management/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/adsense/v1.2"
  8. // ...
  9. // adsenseService, err := adsense.New(oauthHttpClient)
  10. package adsense // import "google.golang.org/api/adsense/v1.2"
  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 = "adsense:v1.2"
  41. const apiName = "adsense"
  42. const apiVersion = "v1.2"
  43. const basePath = "https://www.googleapis.com/adsense/v1.2/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage your AdSense data
  47. AdsenseScope = "https://www.googleapis.com/auth/adsense"
  48. // View your AdSense data
  49. AdsenseReadonlyScope = "https://www.googleapis.com/auth/adsense.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.Accounts = NewAccountsService(s)
  57. s.Adclients = NewAdclientsService(s)
  58. s.Adunits = NewAdunitsService(s)
  59. s.Customchannels = NewCustomchannelsService(s)
  60. s.Reports = NewReportsService(s)
  61. s.Savedadstyles = NewSavedadstylesService(s)
  62. s.Urlchannels = NewUrlchannelsService(s)
  63. return s, nil
  64. }
  65. type Service struct {
  66. client *http.Client
  67. BasePath string // API endpoint base URL
  68. UserAgent string // optional additional User-Agent fragment
  69. Accounts *AccountsService
  70. Adclients *AdclientsService
  71. Adunits *AdunitsService
  72. Customchannels *CustomchannelsService
  73. Reports *ReportsService
  74. Savedadstyles *SavedadstylesService
  75. Urlchannels *UrlchannelsService
  76. }
  77. func (s *Service) userAgent() string {
  78. if s.UserAgent == "" {
  79. return googleapi.UserAgent
  80. }
  81. return googleapi.UserAgent + " " + s.UserAgent
  82. }
  83. func NewAccountsService(s *Service) *AccountsService {
  84. rs := &AccountsService{s: s}
  85. rs.Adclients = NewAccountsAdclientsService(s)
  86. rs.Adunits = NewAccountsAdunitsService(s)
  87. rs.Customchannels = NewAccountsCustomchannelsService(s)
  88. rs.Reports = NewAccountsReportsService(s)
  89. rs.Savedadstyles = NewAccountsSavedadstylesService(s)
  90. rs.Urlchannels = NewAccountsUrlchannelsService(s)
  91. return rs
  92. }
  93. type AccountsService struct {
  94. s *Service
  95. Adclients *AccountsAdclientsService
  96. Adunits *AccountsAdunitsService
  97. Customchannels *AccountsCustomchannelsService
  98. Reports *AccountsReportsService
  99. Savedadstyles *AccountsSavedadstylesService
  100. Urlchannels *AccountsUrlchannelsService
  101. }
  102. func NewAccountsAdclientsService(s *Service) *AccountsAdclientsService {
  103. rs := &AccountsAdclientsService{s: s}
  104. return rs
  105. }
  106. type AccountsAdclientsService struct {
  107. s *Service
  108. }
  109. func NewAccountsAdunitsService(s *Service) *AccountsAdunitsService {
  110. rs := &AccountsAdunitsService{s: s}
  111. rs.Customchannels = NewAccountsAdunitsCustomchannelsService(s)
  112. return rs
  113. }
  114. type AccountsAdunitsService struct {
  115. s *Service
  116. Customchannels *AccountsAdunitsCustomchannelsService
  117. }
  118. func NewAccountsAdunitsCustomchannelsService(s *Service) *AccountsAdunitsCustomchannelsService {
  119. rs := &AccountsAdunitsCustomchannelsService{s: s}
  120. return rs
  121. }
  122. type AccountsAdunitsCustomchannelsService struct {
  123. s *Service
  124. }
  125. func NewAccountsCustomchannelsService(s *Service) *AccountsCustomchannelsService {
  126. rs := &AccountsCustomchannelsService{s: s}
  127. rs.Adunits = NewAccountsCustomchannelsAdunitsService(s)
  128. return rs
  129. }
  130. type AccountsCustomchannelsService struct {
  131. s *Service
  132. Adunits *AccountsCustomchannelsAdunitsService
  133. }
  134. func NewAccountsCustomchannelsAdunitsService(s *Service) *AccountsCustomchannelsAdunitsService {
  135. rs := &AccountsCustomchannelsAdunitsService{s: s}
  136. return rs
  137. }
  138. type AccountsCustomchannelsAdunitsService struct {
  139. s *Service
  140. }
  141. func NewAccountsReportsService(s *Service) *AccountsReportsService {
  142. rs := &AccountsReportsService{s: s}
  143. rs.Saved = NewAccountsReportsSavedService(s)
  144. return rs
  145. }
  146. type AccountsReportsService struct {
  147. s *Service
  148. Saved *AccountsReportsSavedService
  149. }
  150. func NewAccountsReportsSavedService(s *Service) *AccountsReportsSavedService {
  151. rs := &AccountsReportsSavedService{s: s}
  152. return rs
  153. }
  154. type AccountsReportsSavedService struct {
  155. s *Service
  156. }
  157. func NewAccountsSavedadstylesService(s *Service) *AccountsSavedadstylesService {
  158. rs := &AccountsSavedadstylesService{s: s}
  159. return rs
  160. }
  161. type AccountsSavedadstylesService struct {
  162. s *Service
  163. }
  164. func NewAccountsUrlchannelsService(s *Service) *AccountsUrlchannelsService {
  165. rs := &AccountsUrlchannelsService{s: s}
  166. return rs
  167. }
  168. type AccountsUrlchannelsService struct {
  169. s *Service
  170. }
  171. func NewAdclientsService(s *Service) *AdclientsService {
  172. rs := &AdclientsService{s: s}
  173. return rs
  174. }
  175. type AdclientsService struct {
  176. s *Service
  177. }
  178. func NewAdunitsService(s *Service) *AdunitsService {
  179. rs := &AdunitsService{s: s}
  180. rs.Customchannels = NewAdunitsCustomchannelsService(s)
  181. return rs
  182. }
  183. type AdunitsService struct {
  184. s *Service
  185. Customchannels *AdunitsCustomchannelsService
  186. }
  187. func NewAdunitsCustomchannelsService(s *Service) *AdunitsCustomchannelsService {
  188. rs := &AdunitsCustomchannelsService{s: s}
  189. return rs
  190. }
  191. type AdunitsCustomchannelsService struct {
  192. s *Service
  193. }
  194. func NewCustomchannelsService(s *Service) *CustomchannelsService {
  195. rs := &CustomchannelsService{s: s}
  196. rs.Adunits = NewCustomchannelsAdunitsService(s)
  197. return rs
  198. }
  199. type CustomchannelsService struct {
  200. s *Service
  201. Adunits *CustomchannelsAdunitsService
  202. }
  203. func NewCustomchannelsAdunitsService(s *Service) *CustomchannelsAdunitsService {
  204. rs := &CustomchannelsAdunitsService{s: s}
  205. return rs
  206. }
  207. type CustomchannelsAdunitsService struct {
  208. s *Service
  209. }
  210. func NewReportsService(s *Service) *ReportsService {
  211. rs := &ReportsService{s: s}
  212. rs.Saved = NewReportsSavedService(s)
  213. return rs
  214. }
  215. type ReportsService struct {
  216. s *Service
  217. Saved *ReportsSavedService
  218. }
  219. func NewReportsSavedService(s *Service) *ReportsSavedService {
  220. rs := &ReportsSavedService{s: s}
  221. return rs
  222. }
  223. type ReportsSavedService struct {
  224. s *Service
  225. }
  226. func NewSavedadstylesService(s *Service) *SavedadstylesService {
  227. rs := &SavedadstylesService{s: s}
  228. return rs
  229. }
  230. type SavedadstylesService struct {
  231. s *Service
  232. }
  233. func NewUrlchannelsService(s *Service) *UrlchannelsService {
  234. rs := &UrlchannelsService{s: s}
  235. return rs
  236. }
  237. type UrlchannelsService struct {
  238. s *Service
  239. }
  240. type Account struct {
  241. // Id: Unique identifier of this account.
  242. Id string `json:"id,omitempty"`
  243. // Kind: Kind of resource this is, in this case adsense#account.
  244. Kind string `json:"kind,omitempty"`
  245. // Name: Name of this account.
  246. Name string `json:"name,omitempty"`
  247. // Premium: Whether this account is premium.
  248. Premium bool `json:"premium,omitempty"`
  249. // SubAccounts: Sub accounts of the this account.
  250. SubAccounts []*Account `json:"subAccounts,omitempty"`
  251. // ServerResponse contains the HTTP response code and headers from the
  252. // server.
  253. googleapi.ServerResponse `json:"-"`
  254. // ForceSendFields is a list of field names (e.g. "Id") to
  255. // unconditionally include in API requests. By default, fields with
  256. // empty values are omitted from API requests. However, any non-pointer,
  257. // non-interface field appearing in ForceSendFields will be sent to the
  258. // server regardless of whether the field is empty or not. This may be
  259. // used to include empty fields in Patch requests.
  260. ForceSendFields []string `json:"-"`
  261. }
  262. func (s *Account) MarshalJSON() ([]byte, error) {
  263. type noMethod Account
  264. raw := noMethod(*s)
  265. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  266. }
  267. type Accounts struct {
  268. // Etag: ETag of this response for caching purposes.
  269. Etag string `json:"etag,omitempty"`
  270. // Items: The accounts returned in this list response.
  271. Items []*Account `json:"items,omitempty"`
  272. // Kind: Kind of list this is, in this case adsense#accounts.
  273. Kind string `json:"kind,omitempty"`
  274. // NextPageToken: Continuation token used to page through accounts. To
  275. // retrieve the next page of results, set the next request's "pageToken"
  276. // value to this.
  277. NextPageToken string `json:"nextPageToken,omitempty"`
  278. // ServerResponse contains the HTTP response code and headers from the
  279. // server.
  280. googleapi.ServerResponse `json:"-"`
  281. // ForceSendFields is a list of field names (e.g. "Etag") to
  282. // unconditionally include in API requests. By default, fields with
  283. // empty values are omitted from API requests. However, any non-pointer,
  284. // non-interface field appearing in ForceSendFields will be sent to the
  285. // server regardless of whether the field is empty or not. This may be
  286. // used to include empty fields in Patch requests.
  287. ForceSendFields []string `json:"-"`
  288. }
  289. func (s *Accounts) MarshalJSON() ([]byte, error) {
  290. type noMethod Accounts
  291. raw := noMethod(*s)
  292. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  293. }
  294. type AdClient struct {
  295. // ArcOptIn: Whether this ad client is opted in to ARC.
  296. ArcOptIn bool `json:"arcOptIn,omitempty"`
  297. // Id: Unique identifier of this ad client.
  298. Id string `json:"id,omitempty"`
  299. // Kind: Kind of resource this is, in this case adsense#adClient.
  300. Kind string `json:"kind,omitempty"`
  301. // ProductCode: This ad client's product code, which corresponds to the
  302. // PRODUCT_CODE report dimension.
  303. ProductCode string `json:"productCode,omitempty"`
  304. // SupportsReporting: Whether this ad client supports being reported on.
  305. SupportsReporting bool `json:"supportsReporting,omitempty"`
  306. // ForceSendFields is a list of field names (e.g. "ArcOptIn") to
  307. // unconditionally include in API requests. By default, fields with
  308. // empty values are omitted from API requests. However, any non-pointer,
  309. // non-interface field appearing in ForceSendFields will be sent to the
  310. // server regardless of whether the field is empty or not. This may be
  311. // used to include empty fields in Patch requests.
  312. ForceSendFields []string `json:"-"`
  313. }
  314. func (s *AdClient) MarshalJSON() ([]byte, error) {
  315. type noMethod AdClient
  316. raw := noMethod(*s)
  317. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  318. }
  319. type AdClients struct {
  320. // Etag: ETag of this response for caching purposes.
  321. Etag string `json:"etag,omitempty"`
  322. // Items: The ad clients returned in this list response.
  323. Items []*AdClient `json:"items,omitempty"`
  324. // Kind: Kind of list this is, in this case adsense#adClients.
  325. Kind string `json:"kind,omitempty"`
  326. // NextPageToken: Continuation token used to page through ad clients. To
  327. // retrieve the next page of results, set the next request's "pageToken"
  328. // value to this.
  329. NextPageToken string `json:"nextPageToken,omitempty"`
  330. // ServerResponse contains the HTTP response code and headers from the
  331. // server.
  332. googleapi.ServerResponse `json:"-"`
  333. // ForceSendFields is a list of field names (e.g. "Etag") to
  334. // unconditionally include in API requests. By default, fields with
  335. // empty values are omitted from API requests. However, any non-pointer,
  336. // non-interface field appearing in ForceSendFields will be sent to the
  337. // server regardless of whether the field is empty or not. This may be
  338. // used to include empty fields in Patch requests.
  339. ForceSendFields []string `json:"-"`
  340. }
  341. func (s *AdClients) MarshalJSON() ([]byte, error) {
  342. type noMethod AdClients
  343. raw := noMethod(*s)
  344. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  345. }
  346. type AdStyle struct {
  347. // Colors: The colors which are included in the style. These are
  348. // represented as six hexadecimal characters, similar to HTML color
  349. // codes, but without the leading hash.
  350. Colors *AdStyleColors `json:"colors,omitempty"`
  351. // Corners: The style of the corners in the ad.
  352. Corners string `json:"corners,omitempty"`
  353. // Font: The font which is included in the style.
  354. Font *AdStyleFont `json:"font,omitempty"`
  355. // Kind: Kind this is, in this case adsense#adStyle.
  356. Kind string `json:"kind,omitempty"`
  357. // ForceSendFields is a list of field names (e.g. "Colors") to
  358. // unconditionally include in API requests. By default, fields with
  359. // empty values are omitted from API requests. However, any non-pointer,
  360. // non-interface field appearing in ForceSendFields will be sent to the
  361. // server regardless of whether the field is empty or not. This may be
  362. // used to include empty fields in Patch requests.
  363. ForceSendFields []string `json:"-"`
  364. }
  365. func (s *AdStyle) MarshalJSON() ([]byte, error) {
  366. type noMethod AdStyle
  367. raw := noMethod(*s)
  368. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  369. }
  370. // AdStyleColors: The colors which are included in the style. These are
  371. // represented as six hexadecimal characters, similar to HTML color
  372. // codes, but without the leading hash.
  373. type AdStyleColors struct {
  374. // Background: The color of the ad background.
  375. Background string `json:"background,omitempty"`
  376. // Border: The color of the ad border.
  377. Border string `json:"border,omitempty"`
  378. // Text: The color of the ad text.
  379. Text string `json:"text,omitempty"`
  380. // Title: The color of the ad title.
  381. Title string `json:"title,omitempty"`
  382. // Url: The color of the ad url.
  383. Url string `json:"url,omitempty"`
  384. // ForceSendFields is a list of field names (e.g. "Background") to
  385. // unconditionally include in API requests. By default, fields with
  386. // empty values are omitted from API requests. However, any non-pointer,
  387. // non-interface field appearing in ForceSendFields will be sent to the
  388. // server regardless of whether the field is empty or not. This may be
  389. // used to include empty fields in Patch requests.
  390. ForceSendFields []string `json:"-"`
  391. }
  392. func (s *AdStyleColors) MarshalJSON() ([]byte, error) {
  393. type noMethod AdStyleColors
  394. raw := noMethod(*s)
  395. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  396. }
  397. // AdStyleFont: The font which is included in the style.
  398. type AdStyleFont struct {
  399. // Family: The family of the font.
  400. Family string `json:"family,omitempty"`
  401. // Size: The size of the font.
  402. Size string `json:"size,omitempty"`
  403. // ForceSendFields is a list of field names (e.g. "Family") to
  404. // unconditionally include in API requests. By default, fields with
  405. // empty values are omitted from API requests. However, any non-pointer,
  406. // non-interface field appearing in ForceSendFields will be sent to the
  407. // server regardless of whether the field is empty or not. This may be
  408. // used to include empty fields in Patch requests.
  409. ForceSendFields []string `json:"-"`
  410. }
  411. func (s *AdStyleFont) MarshalJSON() ([]byte, error) {
  412. type noMethod AdStyleFont
  413. raw := noMethod(*s)
  414. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  415. }
  416. type AdUnit struct {
  417. // Code: Identity code of this ad unit, not necessarily unique across ad
  418. // clients.
  419. Code string `json:"code,omitempty"`
  420. // ContentAdsSettings: Settings specific to content ads (AFC) and
  421. // highend mobile content ads (AFMC - deprecated).
  422. ContentAdsSettings *AdUnitContentAdsSettings `json:"contentAdsSettings,omitempty"`
  423. // CustomStyle: Custom style information specific to this ad unit.
  424. CustomStyle *AdStyle `json:"customStyle,omitempty"`
  425. // FeedAdsSettings: Settings specific to feed ads (AFF) - deprecated.
  426. FeedAdsSettings *AdUnitFeedAdsSettings `json:"feedAdsSettings,omitempty"`
  427. // Id: Unique identifier of this ad unit. This should be considered an
  428. // opaque identifier; it is not safe to rely on it being in any
  429. // particular format.
  430. Id string `json:"id,omitempty"`
  431. // Kind: Kind of resource this is, in this case adsense#adUnit.
  432. Kind string `json:"kind,omitempty"`
  433. // MobileContentAdsSettings: Settings specific to WAP mobile content ads
  434. // (AFMC) - deprecated.
  435. MobileContentAdsSettings *AdUnitMobileContentAdsSettings `json:"mobileContentAdsSettings,omitempty"`
  436. // Name: Name of this ad unit.
  437. Name string `json:"name,omitempty"`
  438. // SavedStyleId: ID of the saved ad style which holds this ad unit's
  439. // style information.
  440. SavedStyleId string `json:"savedStyleId,omitempty"`
  441. // Status: Status of this ad unit. Possible values are:
  442. // NEW: Indicates that the ad unit was created within the last seven
  443. // days and does not yet have any activity associated with it.
  444. //
  445. // ACTIVE: Indicates that there has been activity on this ad unit in the
  446. // last seven days.
  447. //
  448. // INACTIVE: Indicates that there has been no activity on this ad unit
  449. // in the last seven days.
  450. Status string `json:"status,omitempty"`
  451. // ServerResponse contains the HTTP response code and headers from the
  452. // server.
  453. googleapi.ServerResponse `json:"-"`
  454. // ForceSendFields is a list of field names (e.g. "Code") to
  455. // unconditionally include in API requests. By default, fields with
  456. // empty values are omitted from API requests. However, any non-pointer,
  457. // non-interface field appearing in ForceSendFields will be sent to the
  458. // server regardless of whether the field is empty or not. This may be
  459. // used to include empty fields in Patch requests.
  460. ForceSendFields []string `json:"-"`
  461. }
  462. func (s *AdUnit) MarshalJSON() ([]byte, error) {
  463. type noMethod AdUnit
  464. raw := noMethod(*s)
  465. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  466. }
  467. // AdUnitContentAdsSettings: Settings specific to content ads (AFC) and
  468. // highend mobile content ads (AFMC - deprecated).
  469. type AdUnitContentAdsSettings struct {
  470. // BackupOption: The backup option to be used in instances where no ad
  471. // is available.
  472. BackupOption *AdUnitContentAdsSettingsBackupOption `json:"backupOption,omitempty"`
  473. // Size: Size of this ad unit.
  474. Size string `json:"size,omitempty"`
  475. // Type: Type of this ad unit.
  476. Type string `json:"type,omitempty"`
  477. // ForceSendFields is a list of field names (e.g. "BackupOption") to
  478. // unconditionally include in API requests. By default, fields with
  479. // empty values are omitted from API requests. However, any non-pointer,
  480. // non-interface field appearing in ForceSendFields will be sent to the
  481. // server regardless of whether the field is empty or not. This may be
  482. // used to include empty fields in Patch requests.
  483. ForceSendFields []string `json:"-"`
  484. }
  485. func (s *AdUnitContentAdsSettings) MarshalJSON() ([]byte, error) {
  486. type noMethod AdUnitContentAdsSettings
  487. raw := noMethod(*s)
  488. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  489. }
  490. // AdUnitContentAdsSettingsBackupOption: The backup option to be used in
  491. // instances where no ad is available.
  492. type AdUnitContentAdsSettingsBackupOption struct {
  493. // Color: Color to use when type is set to COLOR.
  494. Color string `json:"color,omitempty"`
  495. // Type: Type of the backup option. Possible values are BLANK, COLOR and
  496. // URL.
  497. Type string `json:"type,omitempty"`
  498. // Url: URL to use when type is set to URL.
  499. Url string `json:"url,omitempty"`
  500. // ForceSendFields is a list of field names (e.g. "Color") to
  501. // unconditionally include in API requests. By default, fields with
  502. // empty values are omitted from API requests. However, any non-pointer,
  503. // non-interface field appearing in ForceSendFields will be sent to the
  504. // server regardless of whether the field is empty or not. This may be
  505. // used to include empty fields in Patch requests.
  506. ForceSendFields []string `json:"-"`
  507. }
  508. func (s *AdUnitContentAdsSettingsBackupOption) MarshalJSON() ([]byte, error) {
  509. type noMethod AdUnitContentAdsSettingsBackupOption
  510. raw := noMethod(*s)
  511. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  512. }
  513. // AdUnitFeedAdsSettings: Settings specific to feed ads (AFF) -
  514. // deprecated.
  515. type AdUnitFeedAdsSettings struct {
  516. // AdPosition: The position of the ads relative to the feed entries.
  517. AdPosition string `json:"adPosition,omitempty"`
  518. // Frequency: The frequency at which ads should appear in the feed (i.e.
  519. // every N entries).
  520. Frequency int64 `json:"frequency,omitempty"`
  521. // MinimumWordCount: The minimum length an entry should be in order to
  522. // have attached ads.
  523. MinimumWordCount int64 `json:"minimumWordCount,omitempty"`
  524. // Type: The type of ads which should appear.
  525. Type string `json:"type,omitempty"`
  526. // ForceSendFields is a list of field names (e.g. "AdPosition") to
  527. // unconditionally include in API requests. By default, fields with
  528. // empty values are omitted from API requests. However, any non-pointer,
  529. // non-interface field appearing in ForceSendFields will be sent to the
  530. // server regardless of whether the field is empty or not. This may be
  531. // used to include empty fields in Patch requests.
  532. ForceSendFields []string `json:"-"`
  533. }
  534. func (s *AdUnitFeedAdsSettings) MarshalJSON() ([]byte, error) {
  535. type noMethod AdUnitFeedAdsSettings
  536. raw := noMethod(*s)
  537. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  538. }
  539. // AdUnitMobileContentAdsSettings: Settings specific to WAP mobile
  540. // content ads (AFMC) - deprecated.
  541. type AdUnitMobileContentAdsSettings struct {
  542. // MarkupLanguage: The markup language to use for this ad unit.
  543. MarkupLanguage string `json:"markupLanguage,omitempty"`
  544. // ScriptingLanguage: The scripting language to use for this ad unit.
  545. ScriptingLanguage string `json:"scriptingLanguage,omitempty"`
  546. // Size: Size of this ad unit.
  547. Size string `json:"size,omitempty"`
  548. // Type: Type of this ad unit.
  549. Type string `json:"type,omitempty"`
  550. // ForceSendFields is a list of field names (e.g. "MarkupLanguage") 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 *AdUnitMobileContentAdsSettings) MarshalJSON() ([]byte, error) {
  559. type noMethod AdUnitMobileContentAdsSettings
  560. raw := noMethod(*s)
  561. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  562. }
  563. type AdUnits struct {
  564. // Etag: ETag of this response for caching purposes.
  565. Etag string `json:"etag,omitempty"`
  566. // Items: The ad units returned in this list response.
  567. Items []*AdUnit `json:"items,omitempty"`
  568. // Kind: Kind of list this is, in this case adsense#adUnits.
  569. Kind string `json:"kind,omitempty"`
  570. // NextPageToken: Continuation token used to page through ad units. To
  571. // retrieve the next page of results, set the next request's "pageToken"
  572. // value to this.
  573. NextPageToken string `json:"nextPageToken,omitempty"`
  574. // ServerResponse contains the HTTP response code and headers from the
  575. // server.
  576. googleapi.ServerResponse `json:"-"`
  577. // ForceSendFields is a list of field names (e.g. "Etag") to
  578. // unconditionally include in API requests. By default, fields with
  579. // empty values are omitted from API requests. However, any non-pointer,
  580. // non-interface field appearing in ForceSendFields will be sent to the
  581. // server regardless of whether the field is empty or not. This may be
  582. // used to include empty fields in Patch requests.
  583. ForceSendFields []string `json:"-"`
  584. }
  585. func (s *AdUnits) MarshalJSON() ([]byte, error) {
  586. type noMethod AdUnits
  587. raw := noMethod(*s)
  588. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  589. }
  590. type AdsenseReportsGenerateResponse struct {
  591. // Averages: The averages of the report. This is the same length as any
  592. // other row in the report; cells corresponding to dimension columns are
  593. // empty.
  594. Averages []string `json:"averages,omitempty"`
  595. // Headers: The header information of the columns requested in the
  596. // report. This is a list of headers; one for each dimension in the
  597. // request, followed by one for each metric in the request.
  598. Headers []*AdsenseReportsGenerateResponseHeaders `json:"headers,omitempty"`
  599. // Kind: Kind this is, in this case adsense#report.
  600. Kind string `json:"kind,omitempty"`
  601. // Rows: The output rows of the report. Each row is a list of cells; one
  602. // for each dimension in the request, followed by one for each metric in
  603. // the request. The dimension cells contain strings, and the metric
  604. // cells contain numbers.
  605. Rows [][]string `json:"rows,omitempty"`
  606. // TotalMatchedRows: The total number of rows matched by the report
  607. // request. Fewer rows may be returned in the response due to being
  608. // limited by the row count requested or the report row limit.
  609. TotalMatchedRows int64 `json:"totalMatchedRows,omitempty,string"`
  610. // Totals: The totals of the report. This is the same length as any
  611. // other row in the report; cells corresponding to dimension columns are
  612. // empty.
  613. Totals []string `json:"totals,omitempty"`
  614. // Warnings: Any warnings associated with generation of the report.
  615. Warnings []string `json:"warnings,omitempty"`
  616. // ServerResponse contains the HTTP response code and headers from the
  617. // server.
  618. googleapi.ServerResponse `json:"-"`
  619. // ForceSendFields is a list of field names (e.g. "Averages") to
  620. // unconditionally include in API requests. By default, fields with
  621. // empty values are omitted from API requests. However, any non-pointer,
  622. // non-interface field appearing in ForceSendFields will be sent to the
  623. // server regardless of whether the field is empty or not. This may be
  624. // used to include empty fields in Patch requests.
  625. ForceSendFields []string `json:"-"`
  626. }
  627. func (s *AdsenseReportsGenerateResponse) MarshalJSON() ([]byte, error) {
  628. type noMethod AdsenseReportsGenerateResponse
  629. raw := noMethod(*s)
  630. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  631. }
  632. type AdsenseReportsGenerateResponseHeaders struct {
  633. // Currency: The currency of this column. Only present if the header
  634. // type is METRIC_CURRENCY.
  635. Currency string `json:"currency,omitempty"`
  636. // Name: The name of the header.
  637. Name string `json:"name,omitempty"`
  638. // Type: The type of the header; one of DIMENSION, METRIC_TALLY,
  639. // METRIC_RATIO, or METRIC_CURRENCY.
  640. Type string `json:"type,omitempty"`
  641. // ForceSendFields is a list of field names (e.g. "Currency") to
  642. // unconditionally include in API requests. By default, fields with
  643. // empty values are omitted from API requests. However, any non-pointer,
  644. // non-interface field appearing in ForceSendFields will be sent to the
  645. // server regardless of whether the field is empty or not. This may be
  646. // used to include empty fields in Patch requests.
  647. ForceSendFields []string `json:"-"`
  648. }
  649. func (s *AdsenseReportsGenerateResponseHeaders) MarshalJSON() ([]byte, error) {
  650. type noMethod AdsenseReportsGenerateResponseHeaders
  651. raw := noMethod(*s)
  652. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  653. }
  654. type CustomChannel struct {
  655. // Code: Code of this custom channel, not necessarily unique across ad
  656. // clients.
  657. Code string `json:"code,omitempty"`
  658. // Id: Unique identifier of this custom channel. This should be
  659. // considered an opaque identifier; it is not safe to rely on it being
  660. // in any particular format.
  661. Id string `json:"id,omitempty"`
  662. // Kind: Kind of resource this is, in this case adsense#customChannel.
  663. Kind string `json:"kind,omitempty"`
  664. // Name: Name of this custom channel.
  665. Name string `json:"name,omitempty"`
  666. // TargetingInfo: The targeting information of this custom channel, if
  667. // activated.
  668. TargetingInfo *CustomChannelTargetingInfo `json:"targetingInfo,omitempty"`
  669. // ServerResponse contains the HTTP response code and headers from the
  670. // server.
  671. googleapi.ServerResponse `json:"-"`
  672. // ForceSendFields is a list of field names (e.g. "Code") to
  673. // unconditionally include in API requests. By default, fields with
  674. // empty values are omitted from API requests. However, any non-pointer,
  675. // non-interface field appearing in ForceSendFields will be sent to the
  676. // server regardless of whether the field is empty or not. This may be
  677. // used to include empty fields in Patch requests.
  678. ForceSendFields []string `json:"-"`
  679. }
  680. func (s *CustomChannel) MarshalJSON() ([]byte, error) {
  681. type noMethod CustomChannel
  682. raw := noMethod(*s)
  683. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  684. }
  685. // CustomChannelTargetingInfo: The targeting information of this custom
  686. // channel, if activated.
  687. type CustomChannelTargetingInfo struct {
  688. // AdsAppearOn: The name used to describe this channel externally.
  689. AdsAppearOn string `json:"adsAppearOn,omitempty"`
  690. // Description: The external description of the channel.
  691. Description string `json:"description,omitempty"`
  692. // Location: The locations in which ads appear. (Only valid for content
  693. // and mobile content ads (deprecated)). Acceptable values for content
  694. // ads are: TOP_LEFT, TOP_CENTER, TOP_RIGHT, MIDDLE_LEFT, MIDDLE_CENTER,
  695. // MIDDLE_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT,
  696. // MULTIPLE_LOCATIONS. Acceptable values for mobile content ads
  697. // (deprecated) are: TOP, MIDDLE, BOTTOM, MULTIPLE_LOCATIONS.
  698. Location string `json:"location,omitempty"`
  699. // SiteLanguage: The language of the sites ads will be displayed on.
  700. SiteLanguage string `json:"siteLanguage,omitempty"`
  701. // ForceSendFields is a list of field names (e.g. "AdsAppearOn") to
  702. // unconditionally include in API requests. By default, fields with
  703. // empty values are omitted from API requests. However, any non-pointer,
  704. // non-interface field appearing in ForceSendFields will be sent to the
  705. // server regardless of whether the field is empty or not. This may be
  706. // used to include empty fields in Patch requests.
  707. ForceSendFields []string `json:"-"`
  708. }
  709. func (s *CustomChannelTargetingInfo) MarshalJSON() ([]byte, error) {
  710. type noMethod CustomChannelTargetingInfo
  711. raw := noMethod(*s)
  712. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  713. }
  714. type CustomChannels struct {
  715. // Etag: ETag of this response for caching purposes.
  716. Etag string `json:"etag,omitempty"`
  717. // Items: The custom channels returned in this list response.
  718. Items []*CustomChannel `json:"items,omitempty"`
  719. // Kind: Kind of list this is, in this case adsense#customChannels.
  720. Kind string `json:"kind,omitempty"`
  721. // NextPageToken: Continuation token used to page through custom
  722. // channels. To retrieve the next page of results, set the next
  723. // request's "pageToken" value to this.
  724. NextPageToken string `json:"nextPageToken,omitempty"`
  725. // ServerResponse contains the HTTP response code and headers from the
  726. // server.
  727. googleapi.ServerResponse `json:"-"`
  728. // ForceSendFields is a list of field names (e.g. "Etag") to
  729. // unconditionally include in API requests. By default, fields with
  730. // empty values are omitted from API requests. However, any non-pointer,
  731. // non-interface field appearing in ForceSendFields will be sent to the
  732. // server regardless of whether the field is empty or not. This may be
  733. // used to include empty fields in Patch requests.
  734. ForceSendFields []string `json:"-"`
  735. }
  736. func (s *CustomChannels) MarshalJSON() ([]byte, error) {
  737. type noMethod CustomChannels
  738. raw := noMethod(*s)
  739. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  740. }
  741. type SavedAdStyle struct {
  742. // AdStyle: The AdStyle itself.
  743. AdStyle *AdStyle `json:"adStyle,omitempty"`
  744. // Id: Unique identifier of this saved ad style. This should be
  745. // considered an opaque identifier; it is not safe to rely on it being
  746. // in any particular format.
  747. Id string `json:"id,omitempty"`
  748. // Kind: Kind of resource this is, in this case adsense#savedAdStyle.
  749. Kind string `json:"kind,omitempty"`
  750. // Name: The user selected name of this SavedAdStyle.
  751. Name string `json:"name,omitempty"`
  752. // ServerResponse contains the HTTP response code and headers from the
  753. // server.
  754. googleapi.ServerResponse `json:"-"`
  755. // ForceSendFields is a list of field names (e.g. "AdStyle") to
  756. // unconditionally include in API requests. By default, fields with
  757. // empty values are omitted from API requests. However, any non-pointer,
  758. // non-interface field appearing in ForceSendFields will be sent to the
  759. // server regardless of whether the field is empty or not. This may be
  760. // used to include empty fields in Patch requests.
  761. ForceSendFields []string `json:"-"`
  762. }
  763. func (s *SavedAdStyle) MarshalJSON() ([]byte, error) {
  764. type noMethod SavedAdStyle
  765. raw := noMethod(*s)
  766. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  767. }
  768. type SavedAdStyles struct {
  769. // Etag: ETag of this response for caching purposes.
  770. Etag string `json:"etag,omitempty"`
  771. // Items: The saved ad styles returned in this list response.
  772. Items []*SavedAdStyle `json:"items,omitempty"`
  773. // Kind: Kind of list this is, in this case adsense#savedAdStyles.
  774. Kind string `json:"kind,omitempty"`
  775. // NextPageToken: Continuation token used to page through ad units. To
  776. // retrieve the next page of results, set the next request's "pageToken"
  777. // value to this.
  778. NextPageToken string `json:"nextPageToken,omitempty"`
  779. // ServerResponse contains the HTTP response code and headers from the
  780. // server.
  781. googleapi.ServerResponse `json:"-"`
  782. // ForceSendFields is a list of field names (e.g. "Etag") to
  783. // unconditionally include in API requests. By default, fields with
  784. // empty values are omitted from API requests. However, any non-pointer,
  785. // non-interface field appearing in ForceSendFields will be sent to the
  786. // server regardless of whether the field is empty or not. This may be
  787. // used to include empty fields in Patch requests.
  788. ForceSendFields []string `json:"-"`
  789. }
  790. func (s *SavedAdStyles) MarshalJSON() ([]byte, error) {
  791. type noMethod SavedAdStyles
  792. raw := noMethod(*s)
  793. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  794. }
  795. type SavedReport struct {
  796. // Id: Unique identifier of this saved report.
  797. Id string `json:"id,omitempty"`
  798. // Kind: Kind of resource this is, in this case adsense#savedReport.
  799. Kind string `json:"kind,omitempty"`
  800. // Name: This saved report's name.
  801. Name string `json:"name,omitempty"`
  802. // ForceSendFields is a list of field names (e.g. "Id") to
  803. // unconditionally include in API requests. By default, fields with
  804. // empty values are omitted from API requests. However, any non-pointer,
  805. // non-interface field appearing in ForceSendFields will be sent to the
  806. // server regardless of whether the field is empty or not. This may be
  807. // used to include empty fields in Patch requests.
  808. ForceSendFields []string `json:"-"`
  809. }
  810. func (s *SavedReport) MarshalJSON() ([]byte, error) {
  811. type noMethod SavedReport
  812. raw := noMethod(*s)
  813. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  814. }
  815. type SavedReports struct {
  816. // Etag: ETag of this response for caching purposes.
  817. Etag string `json:"etag,omitempty"`
  818. // Items: The saved reports returned in this list response.
  819. Items []*SavedReport `json:"items,omitempty"`
  820. // Kind: Kind of list this is, in this case adsense#savedReports.
  821. Kind string `json:"kind,omitempty"`
  822. // NextPageToken: Continuation token used to page through saved reports.
  823. // To retrieve the next page of results, set the next request's
  824. // "pageToken" value to this.
  825. NextPageToken string `json:"nextPageToken,omitempty"`
  826. // ServerResponse contains the HTTP response code and headers from the
  827. // server.
  828. googleapi.ServerResponse `json:"-"`
  829. // ForceSendFields is a list of field names (e.g. "Etag") to
  830. // unconditionally include in API requests. By default, fields with
  831. // empty values are omitted from API requests. However, any non-pointer,
  832. // non-interface field appearing in ForceSendFields will be sent to the
  833. // server regardless of whether the field is empty or not. This may be
  834. // used to include empty fields in Patch requests.
  835. ForceSendFields []string `json:"-"`
  836. }
  837. func (s *SavedReports) MarshalJSON() ([]byte, error) {
  838. type noMethod SavedReports
  839. raw := noMethod(*s)
  840. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  841. }
  842. type UrlChannel struct {
  843. // Id: Unique identifier of this URL channel. This should be considered
  844. // an opaque identifier; it is not safe to rely on it being in any
  845. // particular format.
  846. Id string `json:"id,omitempty"`
  847. // Kind: Kind of resource this is, in this case adsense#urlChannel.
  848. Kind string `json:"kind,omitempty"`
  849. // UrlPattern: URL Pattern of this URL channel. Does not include
  850. // "http://" or "https://". Example: www.example.com/home
  851. UrlPattern string `json:"urlPattern,omitempty"`
  852. // ForceSendFields is a list of field names (e.g. "Id") to
  853. // unconditionally include in API requests. By default, fields with
  854. // empty values are omitted from API requests. However, any non-pointer,
  855. // non-interface field appearing in ForceSendFields will be sent to the
  856. // server regardless of whether the field is empty or not. This may be
  857. // used to include empty fields in Patch requests.
  858. ForceSendFields []string `json:"-"`
  859. }
  860. func (s *UrlChannel) MarshalJSON() ([]byte, error) {
  861. type noMethod UrlChannel
  862. raw := noMethod(*s)
  863. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  864. }
  865. type UrlChannels struct {
  866. // Etag: ETag of this response for caching purposes.
  867. Etag string `json:"etag,omitempty"`
  868. // Items: The URL channels returned in this list response.
  869. Items []*UrlChannel `json:"items,omitempty"`
  870. // Kind: Kind of list this is, in this case adsense#urlChannels.
  871. Kind string `json:"kind,omitempty"`
  872. // NextPageToken: Continuation token used to page through URL channels.
  873. // To retrieve the next page of results, set the next request's
  874. // "pageToken" value to this.
  875. NextPageToken string `json:"nextPageToken,omitempty"`
  876. // ServerResponse contains the HTTP response code and headers from the
  877. // server.
  878. googleapi.ServerResponse `json:"-"`
  879. // ForceSendFields is a list of field names (e.g. "Etag") to
  880. // unconditionally include in API requests. By default, fields with
  881. // empty values are omitted from API requests. However, any non-pointer,
  882. // non-interface field appearing in ForceSendFields will be sent to the
  883. // server regardless of whether the field is empty or not. This may be
  884. // used to include empty fields in Patch requests.
  885. ForceSendFields []string `json:"-"`
  886. }
  887. func (s *UrlChannels) MarshalJSON() ([]byte, error) {
  888. type noMethod UrlChannels
  889. raw := noMethod(*s)
  890. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  891. }
  892. // method id "adsense.accounts.get":
  893. type AccountsGetCall struct {
  894. s *Service
  895. accountId string
  896. urlParams_ gensupport.URLParams
  897. ifNoneMatch_ string
  898. ctx_ context.Context
  899. }
  900. // Get: Get information about the selected AdSense account.
  901. func (r *AccountsService) Get(accountId string) *AccountsGetCall {
  902. c := &AccountsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  903. c.accountId = accountId
  904. return c
  905. }
  906. // Tree sets the optional parameter "tree": Whether the tree of sub
  907. // accounts should be returned.
  908. func (c *AccountsGetCall) Tree(tree bool) *AccountsGetCall {
  909. c.urlParams_.Set("tree", fmt.Sprint(tree))
  910. return c
  911. }
  912. // Fields allows partial responses to be retrieved. See
  913. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  914. // for more information.
  915. func (c *AccountsGetCall) Fields(s ...googleapi.Field) *AccountsGetCall {
  916. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  917. return c
  918. }
  919. // IfNoneMatch sets the optional parameter which makes the operation
  920. // fail if the object's ETag matches the given value. This is useful for
  921. // getting updates only after the object has changed since the last
  922. // request. Use googleapi.IsNotModified to check whether the response
  923. // error from Do is the result of In-None-Match.
  924. func (c *AccountsGetCall) IfNoneMatch(entityTag string) *AccountsGetCall {
  925. c.ifNoneMatch_ = entityTag
  926. return c
  927. }
  928. // Context sets the context to be used in this call's Do method. Any
  929. // pending HTTP request will be aborted if the provided context is
  930. // canceled.
  931. func (c *AccountsGetCall) Context(ctx context.Context) *AccountsGetCall {
  932. c.ctx_ = ctx
  933. return c
  934. }
  935. func (c *AccountsGetCall) doRequest(alt string) (*http.Response, error) {
  936. var body io.Reader = nil
  937. c.urlParams_.Set("alt", alt)
  938. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}")
  939. urls += "?" + c.urlParams_.Encode()
  940. req, _ := http.NewRequest("GET", urls, body)
  941. googleapi.Expand(req.URL, map[string]string{
  942. "accountId": c.accountId,
  943. })
  944. req.Header.Set("User-Agent", c.s.userAgent())
  945. if c.ifNoneMatch_ != "" {
  946. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  947. }
  948. if c.ctx_ != nil {
  949. return ctxhttp.Do(c.ctx_, c.s.client, req)
  950. }
  951. return c.s.client.Do(req)
  952. }
  953. // Do executes the "adsense.accounts.get" call.
  954. // Exactly one of *Account or error will be non-nil. Any non-2xx status
  955. // code is an error. Response headers are in either
  956. // *Account.ServerResponse.Header or (if a response was returned at all)
  957. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  958. // check whether the returned error was because http.StatusNotModified
  959. // was returned.
  960. func (c *AccountsGetCall) Do(opts ...googleapi.CallOption) (*Account, error) {
  961. gensupport.SetOptions(c.urlParams_, opts...)
  962. res, err := c.doRequest("json")
  963. if res != nil && res.StatusCode == http.StatusNotModified {
  964. if res.Body != nil {
  965. res.Body.Close()
  966. }
  967. return nil, &googleapi.Error{
  968. Code: res.StatusCode,
  969. Header: res.Header,
  970. }
  971. }
  972. if err != nil {
  973. return nil, err
  974. }
  975. defer googleapi.CloseBody(res)
  976. if err := googleapi.CheckResponse(res); err != nil {
  977. return nil, err
  978. }
  979. ret := &Account{
  980. ServerResponse: googleapi.ServerResponse{
  981. Header: res.Header,
  982. HTTPStatusCode: res.StatusCode,
  983. },
  984. }
  985. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  986. return nil, err
  987. }
  988. return ret, nil
  989. // {
  990. // "description": "Get information about the selected AdSense account.",
  991. // "httpMethod": "GET",
  992. // "id": "adsense.accounts.get",
  993. // "parameterOrder": [
  994. // "accountId"
  995. // ],
  996. // "parameters": {
  997. // "accountId": {
  998. // "description": "Account to get information about.",
  999. // "location": "path",
  1000. // "required": true,
  1001. // "type": "string"
  1002. // },
  1003. // "tree": {
  1004. // "description": "Whether the tree of sub accounts should be returned.",
  1005. // "location": "query",
  1006. // "type": "boolean"
  1007. // }
  1008. // },
  1009. // "path": "accounts/{accountId}",
  1010. // "response": {
  1011. // "$ref": "Account"
  1012. // },
  1013. // "scopes": [
  1014. // "https://www.googleapis.com/auth/adsense",
  1015. // "https://www.googleapis.com/auth/adsense.readonly"
  1016. // ]
  1017. // }
  1018. }
  1019. // method id "adsense.accounts.list":
  1020. type AccountsListCall struct {
  1021. s *Service
  1022. urlParams_ gensupport.URLParams
  1023. ifNoneMatch_ string
  1024. ctx_ context.Context
  1025. }
  1026. // List: List all accounts available to this AdSense account.
  1027. func (r *AccountsService) List() *AccountsListCall {
  1028. c := &AccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1029. return c
  1030. }
  1031. // MaxResults sets the optional parameter "maxResults": The maximum
  1032. // number of accounts to include in the response, used for paging.
  1033. func (c *AccountsListCall) MaxResults(maxResults int64) *AccountsListCall {
  1034. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1035. return c
  1036. }
  1037. // PageToken sets the optional parameter "pageToken": A continuation
  1038. // token, used to page through accounts. To retrieve the next page, set
  1039. // this parameter to the value of "nextPageToken" from the previous
  1040. // response.
  1041. func (c *AccountsListCall) PageToken(pageToken string) *AccountsListCall {
  1042. c.urlParams_.Set("pageToken", pageToken)
  1043. return c
  1044. }
  1045. // Fields allows partial responses to be retrieved. See
  1046. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1047. // for more information.
  1048. func (c *AccountsListCall) Fields(s ...googleapi.Field) *AccountsListCall {
  1049. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1050. return c
  1051. }
  1052. // IfNoneMatch sets the optional parameter which makes the operation
  1053. // fail if the object's ETag matches the given value. This is useful for
  1054. // getting updates only after the object has changed since the last
  1055. // request. Use googleapi.IsNotModified to check whether the response
  1056. // error from Do is the result of In-None-Match.
  1057. func (c *AccountsListCall) IfNoneMatch(entityTag string) *AccountsListCall {
  1058. c.ifNoneMatch_ = entityTag
  1059. return c
  1060. }
  1061. // Context sets the context to be used in this call's Do method. Any
  1062. // pending HTTP request will be aborted if the provided context is
  1063. // canceled.
  1064. func (c *AccountsListCall) Context(ctx context.Context) *AccountsListCall {
  1065. c.ctx_ = ctx
  1066. return c
  1067. }
  1068. func (c *AccountsListCall) doRequest(alt string) (*http.Response, error) {
  1069. var body io.Reader = nil
  1070. c.urlParams_.Set("alt", alt)
  1071. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts")
  1072. urls += "?" + c.urlParams_.Encode()
  1073. req, _ := http.NewRequest("GET", urls, body)
  1074. googleapi.SetOpaque(req.URL)
  1075. req.Header.Set("User-Agent", c.s.userAgent())
  1076. if c.ifNoneMatch_ != "" {
  1077. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1078. }
  1079. if c.ctx_ != nil {
  1080. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1081. }
  1082. return c.s.client.Do(req)
  1083. }
  1084. // Do executes the "adsense.accounts.list" call.
  1085. // Exactly one of *Accounts or error will be non-nil. Any non-2xx status
  1086. // code is an error. Response headers are in either
  1087. // *Accounts.ServerResponse.Header or (if a response was returned at
  1088. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1089. // to check whether the returned error was because
  1090. // http.StatusNotModified was returned.
  1091. func (c *AccountsListCall) Do(opts ...googleapi.CallOption) (*Accounts, error) {
  1092. gensupport.SetOptions(c.urlParams_, opts...)
  1093. res, err := c.doRequest("json")
  1094. if res != nil && res.StatusCode == http.StatusNotModified {
  1095. if res.Body != nil {
  1096. res.Body.Close()
  1097. }
  1098. return nil, &googleapi.Error{
  1099. Code: res.StatusCode,
  1100. Header: res.Header,
  1101. }
  1102. }
  1103. if err != nil {
  1104. return nil, err
  1105. }
  1106. defer googleapi.CloseBody(res)
  1107. if err := googleapi.CheckResponse(res); err != nil {
  1108. return nil, err
  1109. }
  1110. ret := &Accounts{
  1111. ServerResponse: googleapi.ServerResponse{
  1112. Header: res.Header,
  1113. HTTPStatusCode: res.StatusCode,
  1114. },
  1115. }
  1116. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1117. return nil, err
  1118. }
  1119. return ret, nil
  1120. // {
  1121. // "description": "List all accounts available to this AdSense account.",
  1122. // "httpMethod": "GET",
  1123. // "id": "adsense.accounts.list",
  1124. // "parameters": {
  1125. // "maxResults": {
  1126. // "description": "The maximum number of accounts to include in the response, used for paging.",
  1127. // "format": "int32",
  1128. // "location": "query",
  1129. // "maximum": "10000",
  1130. // "minimum": "0",
  1131. // "type": "integer"
  1132. // },
  1133. // "pageToken": {
  1134. // "description": "A continuation token, used to page through accounts. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  1135. // "location": "query",
  1136. // "type": "string"
  1137. // }
  1138. // },
  1139. // "path": "accounts",
  1140. // "response": {
  1141. // "$ref": "Accounts"
  1142. // },
  1143. // "scopes": [
  1144. // "https://www.googleapis.com/auth/adsense",
  1145. // "https://www.googleapis.com/auth/adsense.readonly"
  1146. // ]
  1147. // }
  1148. }
  1149. // Pages invokes f for each page of results.
  1150. // A non-nil error returned from f will halt the iteration.
  1151. // The provided context supersedes any context provided to the Context method.
  1152. func (c *AccountsListCall) Pages(ctx context.Context, f func(*Accounts) error) error {
  1153. c.ctx_ = ctx
  1154. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1155. for {
  1156. x, err := c.Do()
  1157. if err != nil {
  1158. return err
  1159. }
  1160. if err := f(x); err != nil {
  1161. return err
  1162. }
  1163. if x.NextPageToken == "" {
  1164. return nil
  1165. }
  1166. c.PageToken(x.NextPageToken)
  1167. }
  1168. }
  1169. // method id "adsense.accounts.adclients.list":
  1170. type AccountsAdclientsListCall struct {
  1171. s *Service
  1172. accountId string
  1173. urlParams_ gensupport.URLParams
  1174. ifNoneMatch_ string
  1175. ctx_ context.Context
  1176. }
  1177. // List: List all ad clients in the specified account.
  1178. func (r *AccountsAdclientsService) List(accountId string) *AccountsAdclientsListCall {
  1179. c := &AccountsAdclientsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1180. c.accountId = accountId
  1181. return c
  1182. }
  1183. // MaxResults sets the optional parameter "maxResults": The maximum
  1184. // number of ad clients to include in the response, used for paging.
  1185. func (c *AccountsAdclientsListCall) MaxResults(maxResults int64) *AccountsAdclientsListCall {
  1186. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1187. return c
  1188. }
  1189. // PageToken sets the optional parameter "pageToken": A continuation
  1190. // token, used to page through ad clients. To retrieve the next page,
  1191. // set this parameter to the value of "nextPageToken" from the previous
  1192. // response.
  1193. func (c *AccountsAdclientsListCall) PageToken(pageToken string) *AccountsAdclientsListCall {
  1194. c.urlParams_.Set("pageToken", pageToken)
  1195. return c
  1196. }
  1197. // Fields allows partial responses to be retrieved. See
  1198. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1199. // for more information.
  1200. func (c *AccountsAdclientsListCall) Fields(s ...googleapi.Field) *AccountsAdclientsListCall {
  1201. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1202. return c
  1203. }
  1204. // IfNoneMatch sets the optional parameter which makes the operation
  1205. // fail if the object's ETag matches the given value. This is useful for
  1206. // getting updates only after the object has changed since the last
  1207. // request. Use googleapi.IsNotModified to check whether the response
  1208. // error from Do is the result of In-None-Match.
  1209. func (c *AccountsAdclientsListCall) IfNoneMatch(entityTag string) *AccountsAdclientsListCall {
  1210. c.ifNoneMatch_ = entityTag
  1211. return c
  1212. }
  1213. // Context sets the context to be used in this call's Do method. Any
  1214. // pending HTTP request will be aborted if the provided context is
  1215. // canceled.
  1216. func (c *AccountsAdclientsListCall) Context(ctx context.Context) *AccountsAdclientsListCall {
  1217. c.ctx_ = ctx
  1218. return c
  1219. }
  1220. func (c *AccountsAdclientsListCall) doRequest(alt string) (*http.Response, error) {
  1221. var body io.Reader = nil
  1222. c.urlParams_.Set("alt", alt)
  1223. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients")
  1224. urls += "?" + c.urlParams_.Encode()
  1225. req, _ := http.NewRequest("GET", urls, body)
  1226. googleapi.Expand(req.URL, map[string]string{
  1227. "accountId": c.accountId,
  1228. })
  1229. req.Header.Set("User-Agent", c.s.userAgent())
  1230. if c.ifNoneMatch_ != "" {
  1231. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1232. }
  1233. if c.ctx_ != nil {
  1234. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1235. }
  1236. return c.s.client.Do(req)
  1237. }
  1238. // Do executes the "adsense.accounts.adclients.list" call.
  1239. // Exactly one of *AdClients or error will be non-nil. Any non-2xx
  1240. // status code is an error. Response headers are in either
  1241. // *AdClients.ServerResponse.Header or (if a response was returned at
  1242. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1243. // to check whether the returned error was because
  1244. // http.StatusNotModified was returned.
  1245. func (c *AccountsAdclientsListCall) Do(opts ...googleapi.CallOption) (*AdClients, error) {
  1246. gensupport.SetOptions(c.urlParams_, opts...)
  1247. res, err := c.doRequest("json")
  1248. if res != nil && res.StatusCode == http.StatusNotModified {
  1249. if res.Body != nil {
  1250. res.Body.Close()
  1251. }
  1252. return nil, &googleapi.Error{
  1253. Code: res.StatusCode,
  1254. Header: res.Header,
  1255. }
  1256. }
  1257. if err != nil {
  1258. return nil, err
  1259. }
  1260. defer googleapi.CloseBody(res)
  1261. if err := googleapi.CheckResponse(res); err != nil {
  1262. return nil, err
  1263. }
  1264. ret := &AdClients{
  1265. ServerResponse: googleapi.ServerResponse{
  1266. Header: res.Header,
  1267. HTTPStatusCode: res.StatusCode,
  1268. },
  1269. }
  1270. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1271. return nil, err
  1272. }
  1273. return ret, nil
  1274. // {
  1275. // "description": "List all ad clients in the specified account.",
  1276. // "httpMethod": "GET",
  1277. // "id": "adsense.accounts.adclients.list",
  1278. // "parameterOrder": [
  1279. // "accountId"
  1280. // ],
  1281. // "parameters": {
  1282. // "accountId": {
  1283. // "description": "Account for which to list ad clients.",
  1284. // "location": "path",
  1285. // "required": true,
  1286. // "type": "string"
  1287. // },
  1288. // "maxResults": {
  1289. // "description": "The maximum number of ad clients to include in the response, used for paging.",
  1290. // "format": "int32",
  1291. // "location": "query",
  1292. // "maximum": "10000",
  1293. // "minimum": "0",
  1294. // "type": "integer"
  1295. // },
  1296. // "pageToken": {
  1297. // "description": "A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  1298. // "location": "query",
  1299. // "type": "string"
  1300. // }
  1301. // },
  1302. // "path": "accounts/{accountId}/adclients",
  1303. // "response": {
  1304. // "$ref": "AdClients"
  1305. // },
  1306. // "scopes": [
  1307. // "https://www.googleapis.com/auth/adsense",
  1308. // "https://www.googleapis.com/auth/adsense.readonly"
  1309. // ]
  1310. // }
  1311. }
  1312. // Pages invokes f for each page of results.
  1313. // A non-nil error returned from f will halt the iteration.
  1314. // The provided context supersedes any context provided to the Context method.
  1315. func (c *AccountsAdclientsListCall) Pages(ctx context.Context, f func(*AdClients) error) error {
  1316. c.ctx_ = ctx
  1317. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1318. for {
  1319. x, err := c.Do()
  1320. if err != nil {
  1321. return err
  1322. }
  1323. if err := f(x); err != nil {
  1324. return err
  1325. }
  1326. if x.NextPageToken == "" {
  1327. return nil
  1328. }
  1329. c.PageToken(x.NextPageToken)
  1330. }
  1331. }
  1332. // method id "adsense.accounts.adunits.get":
  1333. type AccountsAdunitsGetCall struct {
  1334. s *Service
  1335. accountId string
  1336. adClientId string
  1337. adUnitId string
  1338. urlParams_ gensupport.URLParams
  1339. ifNoneMatch_ string
  1340. ctx_ context.Context
  1341. }
  1342. // Get: Gets the specified ad unit in the specified ad client for the
  1343. // specified account.
  1344. func (r *AccountsAdunitsService) Get(accountId string, adClientId string, adUnitId string) *AccountsAdunitsGetCall {
  1345. c := &AccountsAdunitsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1346. c.accountId = accountId
  1347. c.adClientId = adClientId
  1348. c.adUnitId = adUnitId
  1349. return c
  1350. }
  1351. // Fields allows partial responses to be retrieved. See
  1352. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1353. // for more information.
  1354. func (c *AccountsAdunitsGetCall) Fields(s ...googleapi.Field) *AccountsAdunitsGetCall {
  1355. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1356. return c
  1357. }
  1358. // IfNoneMatch sets the optional parameter which makes the operation
  1359. // fail if the object's ETag matches the given value. This is useful for
  1360. // getting updates only after the object has changed since the last
  1361. // request. Use googleapi.IsNotModified to check whether the response
  1362. // error from Do is the result of In-None-Match.
  1363. func (c *AccountsAdunitsGetCall) IfNoneMatch(entityTag string) *AccountsAdunitsGetCall {
  1364. c.ifNoneMatch_ = entityTag
  1365. return c
  1366. }
  1367. // Context sets the context to be used in this call's Do method. Any
  1368. // pending HTTP request will be aborted if the provided context is
  1369. // canceled.
  1370. func (c *AccountsAdunitsGetCall) Context(ctx context.Context) *AccountsAdunitsGetCall {
  1371. c.ctx_ = ctx
  1372. return c
  1373. }
  1374. func (c *AccountsAdunitsGetCall) doRequest(alt string) (*http.Response, error) {
  1375. var body io.Reader = nil
  1376. c.urlParams_.Set("alt", alt)
  1377. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}")
  1378. urls += "?" + c.urlParams_.Encode()
  1379. req, _ := http.NewRequest("GET", urls, body)
  1380. googleapi.Expand(req.URL, map[string]string{
  1381. "accountId": c.accountId,
  1382. "adClientId": c.adClientId,
  1383. "adUnitId": c.adUnitId,
  1384. })
  1385. req.Header.Set("User-Agent", c.s.userAgent())
  1386. if c.ifNoneMatch_ != "" {
  1387. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1388. }
  1389. if c.ctx_ != nil {
  1390. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1391. }
  1392. return c.s.client.Do(req)
  1393. }
  1394. // Do executes the "adsense.accounts.adunits.get" call.
  1395. // Exactly one of *AdUnit or error will be non-nil. Any non-2xx status
  1396. // code is an error. Response headers are in either
  1397. // *AdUnit.ServerResponse.Header or (if a response was returned at all)
  1398. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1399. // check whether the returned error was because http.StatusNotModified
  1400. // was returned.
  1401. func (c *AccountsAdunitsGetCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
  1402. gensupport.SetOptions(c.urlParams_, opts...)
  1403. res, err := c.doRequest("json")
  1404. if res != nil && res.StatusCode == http.StatusNotModified {
  1405. if res.Body != nil {
  1406. res.Body.Close()
  1407. }
  1408. return nil, &googleapi.Error{
  1409. Code: res.StatusCode,
  1410. Header: res.Header,
  1411. }
  1412. }
  1413. if err != nil {
  1414. return nil, err
  1415. }
  1416. defer googleapi.CloseBody(res)
  1417. if err := googleapi.CheckResponse(res); err != nil {
  1418. return nil, err
  1419. }
  1420. ret := &AdUnit{
  1421. ServerResponse: googleapi.ServerResponse{
  1422. Header: res.Header,
  1423. HTTPStatusCode: res.StatusCode,
  1424. },
  1425. }
  1426. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1427. return nil, err
  1428. }
  1429. return ret, nil
  1430. // {
  1431. // "description": "Gets the specified ad unit in the specified ad client for the specified account.",
  1432. // "httpMethod": "GET",
  1433. // "id": "adsense.accounts.adunits.get",
  1434. // "parameterOrder": [
  1435. // "accountId",
  1436. // "adClientId",
  1437. // "adUnitId"
  1438. // ],
  1439. // "parameters": {
  1440. // "accountId": {
  1441. // "description": "Account to which the ad client belongs.",
  1442. // "location": "path",
  1443. // "required": true,
  1444. // "type": "string"
  1445. // },
  1446. // "adClientId": {
  1447. // "description": "Ad client for which to get the ad unit.",
  1448. // "location": "path",
  1449. // "required": true,
  1450. // "type": "string"
  1451. // },
  1452. // "adUnitId": {
  1453. // "description": "Ad unit to retrieve.",
  1454. // "location": "path",
  1455. // "required": true,
  1456. // "type": "string"
  1457. // }
  1458. // },
  1459. // "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}",
  1460. // "response": {
  1461. // "$ref": "AdUnit"
  1462. // },
  1463. // "scopes": [
  1464. // "https://www.googleapis.com/auth/adsense",
  1465. // "https://www.googleapis.com/auth/adsense.readonly"
  1466. // ]
  1467. // }
  1468. }
  1469. // method id "adsense.accounts.adunits.list":
  1470. type AccountsAdunitsListCall struct {
  1471. s *Service
  1472. accountId string
  1473. adClientId string
  1474. urlParams_ gensupport.URLParams
  1475. ifNoneMatch_ string
  1476. ctx_ context.Context
  1477. }
  1478. // List: List all ad units in the specified ad client for the specified
  1479. // account.
  1480. func (r *AccountsAdunitsService) List(accountId string, adClientId string) *AccountsAdunitsListCall {
  1481. c := &AccountsAdunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1482. c.accountId = accountId
  1483. c.adClientId = adClientId
  1484. return c
  1485. }
  1486. // IncludeInactive sets the optional parameter "includeInactive":
  1487. // Whether to include inactive ad units. Default: true.
  1488. func (c *AccountsAdunitsListCall) IncludeInactive(includeInactive bool) *AccountsAdunitsListCall {
  1489. c.urlParams_.Set("includeInactive", fmt.Sprint(includeInactive))
  1490. return c
  1491. }
  1492. // MaxResults sets the optional parameter "maxResults": The maximum
  1493. // number of ad units to include in the response, used for paging.
  1494. func (c *AccountsAdunitsListCall) MaxResults(maxResults int64) *AccountsAdunitsListCall {
  1495. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1496. return c
  1497. }
  1498. // PageToken sets the optional parameter "pageToken": A continuation
  1499. // token, used to page through ad units. To retrieve the next page, set
  1500. // this parameter to the value of "nextPageToken" from the previous
  1501. // response.
  1502. func (c *AccountsAdunitsListCall) PageToken(pageToken string) *AccountsAdunitsListCall {
  1503. c.urlParams_.Set("pageToken", pageToken)
  1504. return c
  1505. }
  1506. // Fields allows partial responses to be retrieved. See
  1507. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1508. // for more information.
  1509. func (c *AccountsAdunitsListCall) Fields(s ...googleapi.Field) *AccountsAdunitsListCall {
  1510. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1511. return c
  1512. }
  1513. // IfNoneMatch sets the optional parameter which makes the operation
  1514. // fail if the object's ETag matches the given value. This is useful for
  1515. // getting updates only after the object has changed since the last
  1516. // request. Use googleapi.IsNotModified to check whether the response
  1517. // error from Do is the result of In-None-Match.
  1518. func (c *AccountsAdunitsListCall) IfNoneMatch(entityTag string) *AccountsAdunitsListCall {
  1519. c.ifNoneMatch_ = entityTag
  1520. return c
  1521. }
  1522. // Context sets the context to be used in this call's Do method. Any
  1523. // pending HTTP request will be aborted if the provided context is
  1524. // canceled.
  1525. func (c *AccountsAdunitsListCall) Context(ctx context.Context) *AccountsAdunitsListCall {
  1526. c.ctx_ = ctx
  1527. return c
  1528. }
  1529. func (c *AccountsAdunitsListCall) doRequest(alt string) (*http.Response, error) {
  1530. var body io.Reader = nil
  1531. c.urlParams_.Set("alt", alt)
  1532. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits")
  1533. urls += "?" + c.urlParams_.Encode()
  1534. req, _ := http.NewRequest("GET", urls, body)
  1535. googleapi.Expand(req.URL, map[string]string{
  1536. "accountId": c.accountId,
  1537. "adClientId": c.adClientId,
  1538. })
  1539. req.Header.Set("User-Agent", c.s.userAgent())
  1540. if c.ifNoneMatch_ != "" {
  1541. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1542. }
  1543. if c.ctx_ != nil {
  1544. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1545. }
  1546. return c.s.client.Do(req)
  1547. }
  1548. // Do executes the "adsense.accounts.adunits.list" call.
  1549. // Exactly one of *AdUnits or error will be non-nil. Any non-2xx status
  1550. // code is an error. Response headers are in either
  1551. // *AdUnits.ServerResponse.Header or (if a response was returned at all)
  1552. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1553. // check whether the returned error was because http.StatusNotModified
  1554. // was returned.
  1555. func (c *AccountsAdunitsListCall) Do(opts ...googleapi.CallOption) (*AdUnits, error) {
  1556. gensupport.SetOptions(c.urlParams_, opts...)
  1557. res, err := c.doRequest("json")
  1558. if res != nil && res.StatusCode == http.StatusNotModified {
  1559. if res.Body != nil {
  1560. res.Body.Close()
  1561. }
  1562. return nil, &googleapi.Error{
  1563. Code: res.StatusCode,
  1564. Header: res.Header,
  1565. }
  1566. }
  1567. if err != nil {
  1568. return nil, err
  1569. }
  1570. defer googleapi.CloseBody(res)
  1571. if err := googleapi.CheckResponse(res); err != nil {
  1572. return nil, err
  1573. }
  1574. ret := &AdUnits{
  1575. ServerResponse: googleapi.ServerResponse{
  1576. Header: res.Header,
  1577. HTTPStatusCode: res.StatusCode,
  1578. },
  1579. }
  1580. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1581. return nil, err
  1582. }
  1583. return ret, nil
  1584. // {
  1585. // "description": "List all ad units in the specified ad client for the specified account.",
  1586. // "httpMethod": "GET",
  1587. // "id": "adsense.accounts.adunits.list",
  1588. // "parameterOrder": [
  1589. // "accountId",
  1590. // "adClientId"
  1591. // ],
  1592. // "parameters": {
  1593. // "accountId": {
  1594. // "description": "Account to which the ad client belongs.",
  1595. // "location": "path",
  1596. // "required": true,
  1597. // "type": "string"
  1598. // },
  1599. // "adClientId": {
  1600. // "description": "Ad client for which to list ad units.",
  1601. // "location": "path",
  1602. // "required": true,
  1603. // "type": "string"
  1604. // },
  1605. // "includeInactive": {
  1606. // "description": "Whether to include inactive ad units. Default: true.",
  1607. // "location": "query",
  1608. // "type": "boolean"
  1609. // },
  1610. // "maxResults": {
  1611. // "description": "The maximum number of ad units to include in the response, used for paging.",
  1612. // "format": "int32",
  1613. // "location": "query",
  1614. // "maximum": "10000",
  1615. // "minimum": "0",
  1616. // "type": "integer"
  1617. // },
  1618. // "pageToken": {
  1619. // "description": "A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  1620. // "location": "query",
  1621. // "type": "string"
  1622. // }
  1623. // },
  1624. // "path": "accounts/{accountId}/adclients/{adClientId}/adunits",
  1625. // "response": {
  1626. // "$ref": "AdUnits"
  1627. // },
  1628. // "scopes": [
  1629. // "https://www.googleapis.com/auth/adsense",
  1630. // "https://www.googleapis.com/auth/adsense.readonly"
  1631. // ]
  1632. // }
  1633. }
  1634. // Pages invokes f for each page of results.
  1635. // A non-nil error returned from f will halt the iteration.
  1636. // The provided context supersedes any context provided to the Context method.
  1637. func (c *AccountsAdunitsListCall) Pages(ctx context.Context, f func(*AdUnits) error) error {
  1638. c.ctx_ = ctx
  1639. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1640. for {
  1641. x, err := c.Do()
  1642. if err != nil {
  1643. return err
  1644. }
  1645. if err := f(x); err != nil {
  1646. return err
  1647. }
  1648. if x.NextPageToken == "" {
  1649. return nil
  1650. }
  1651. c.PageToken(x.NextPageToken)
  1652. }
  1653. }
  1654. // method id "adsense.accounts.adunits.customchannels.list":
  1655. type AccountsAdunitsCustomchannelsListCall struct {
  1656. s *Service
  1657. accountId string
  1658. adClientId string
  1659. adUnitId string
  1660. urlParams_ gensupport.URLParams
  1661. ifNoneMatch_ string
  1662. ctx_ context.Context
  1663. }
  1664. // List: List all custom channels which the specified ad unit belongs
  1665. // to.
  1666. func (r *AccountsAdunitsCustomchannelsService) List(accountId string, adClientId string, adUnitId string) *AccountsAdunitsCustomchannelsListCall {
  1667. c := &AccountsAdunitsCustomchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1668. c.accountId = accountId
  1669. c.adClientId = adClientId
  1670. c.adUnitId = adUnitId
  1671. return c
  1672. }
  1673. // MaxResults sets the optional parameter "maxResults": The maximum
  1674. // number of custom channels to include in the response, used for
  1675. // paging.
  1676. func (c *AccountsAdunitsCustomchannelsListCall) MaxResults(maxResults int64) *AccountsAdunitsCustomchannelsListCall {
  1677. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1678. return c
  1679. }
  1680. // PageToken sets the optional parameter "pageToken": A continuation
  1681. // token, used to page through custom channels. To retrieve the next
  1682. // page, set this parameter to the value of "nextPageToken" from the
  1683. // previous response.
  1684. func (c *AccountsAdunitsCustomchannelsListCall) PageToken(pageToken string) *AccountsAdunitsCustomchannelsListCall {
  1685. c.urlParams_.Set("pageToken", pageToken)
  1686. return c
  1687. }
  1688. // Fields allows partial responses to be retrieved. See
  1689. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1690. // for more information.
  1691. func (c *AccountsAdunitsCustomchannelsListCall) Fields(s ...googleapi.Field) *AccountsAdunitsCustomchannelsListCall {
  1692. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1693. return c
  1694. }
  1695. // IfNoneMatch sets the optional parameter which makes the operation
  1696. // fail if the object's ETag matches the given value. This is useful for
  1697. // getting updates only after the object has changed since the last
  1698. // request. Use googleapi.IsNotModified to check whether the response
  1699. // error from Do is the result of In-None-Match.
  1700. func (c *AccountsAdunitsCustomchannelsListCall) IfNoneMatch(entityTag string) *AccountsAdunitsCustomchannelsListCall {
  1701. c.ifNoneMatch_ = entityTag
  1702. return c
  1703. }
  1704. // Context sets the context to be used in this call's Do method. Any
  1705. // pending HTTP request will be aborted if the provided context is
  1706. // canceled.
  1707. func (c *AccountsAdunitsCustomchannelsListCall) Context(ctx context.Context) *AccountsAdunitsCustomchannelsListCall {
  1708. c.ctx_ = ctx
  1709. return c
  1710. }
  1711. func (c *AccountsAdunitsCustomchannelsListCall) doRequest(alt string) (*http.Response, error) {
  1712. var body io.Reader = nil
  1713. c.urlParams_.Set("alt", alt)
  1714. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/customchannels")
  1715. urls += "?" + c.urlParams_.Encode()
  1716. req, _ := http.NewRequest("GET", urls, body)
  1717. googleapi.Expand(req.URL, map[string]string{
  1718. "accountId": c.accountId,
  1719. "adClientId": c.adClientId,
  1720. "adUnitId": c.adUnitId,
  1721. })
  1722. req.Header.Set("User-Agent", c.s.userAgent())
  1723. if c.ifNoneMatch_ != "" {
  1724. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1725. }
  1726. if c.ctx_ != nil {
  1727. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1728. }
  1729. return c.s.client.Do(req)
  1730. }
  1731. // Do executes the "adsense.accounts.adunits.customchannels.list" call.
  1732. // Exactly one of *CustomChannels or error will be non-nil. Any non-2xx
  1733. // status code is an error. Response headers are in either
  1734. // *CustomChannels.ServerResponse.Header or (if a response was returned
  1735. // at all) in error.(*googleapi.Error).Header. Use
  1736. // googleapi.IsNotModified to check whether the returned error was
  1737. // because http.StatusNotModified was returned.
  1738. func (c *AccountsAdunitsCustomchannelsListCall) Do(opts ...googleapi.CallOption) (*CustomChannels, error) {
  1739. gensupport.SetOptions(c.urlParams_, opts...)
  1740. res, err := c.doRequest("json")
  1741. if res != nil && res.StatusCode == http.StatusNotModified {
  1742. if res.Body != nil {
  1743. res.Body.Close()
  1744. }
  1745. return nil, &googleapi.Error{
  1746. Code: res.StatusCode,
  1747. Header: res.Header,
  1748. }
  1749. }
  1750. if err != nil {
  1751. return nil, err
  1752. }
  1753. defer googleapi.CloseBody(res)
  1754. if err := googleapi.CheckResponse(res); err != nil {
  1755. return nil, err
  1756. }
  1757. ret := &CustomChannels{
  1758. ServerResponse: googleapi.ServerResponse{
  1759. Header: res.Header,
  1760. HTTPStatusCode: res.StatusCode,
  1761. },
  1762. }
  1763. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1764. return nil, err
  1765. }
  1766. return ret, nil
  1767. // {
  1768. // "description": "List all custom channels which the specified ad unit belongs to.",
  1769. // "httpMethod": "GET",
  1770. // "id": "adsense.accounts.adunits.customchannels.list",
  1771. // "parameterOrder": [
  1772. // "accountId",
  1773. // "adClientId",
  1774. // "adUnitId"
  1775. // ],
  1776. // "parameters": {
  1777. // "accountId": {
  1778. // "description": "Account to which the ad client belongs.",
  1779. // "location": "path",
  1780. // "required": true,
  1781. // "type": "string"
  1782. // },
  1783. // "adClientId": {
  1784. // "description": "Ad client which contains the ad unit.",
  1785. // "location": "path",
  1786. // "required": true,
  1787. // "type": "string"
  1788. // },
  1789. // "adUnitId": {
  1790. // "description": "Ad unit for which to list custom channels.",
  1791. // "location": "path",
  1792. // "required": true,
  1793. // "type": "string"
  1794. // },
  1795. // "maxResults": {
  1796. // "description": "The maximum number of custom channels to include in the response, used for paging.",
  1797. // "format": "int32",
  1798. // "location": "query",
  1799. // "maximum": "10000",
  1800. // "minimum": "0",
  1801. // "type": "integer"
  1802. // },
  1803. // "pageToken": {
  1804. // "description": "A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  1805. // "location": "query",
  1806. // "type": "string"
  1807. // }
  1808. // },
  1809. // "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/customchannels",
  1810. // "response": {
  1811. // "$ref": "CustomChannels"
  1812. // },
  1813. // "scopes": [
  1814. // "https://www.googleapis.com/auth/adsense",
  1815. // "https://www.googleapis.com/auth/adsense.readonly"
  1816. // ]
  1817. // }
  1818. }
  1819. // Pages invokes f for each page of results.
  1820. // A non-nil error returned from f will halt the iteration.
  1821. // The provided context supersedes any context provided to the Context method.
  1822. func (c *AccountsAdunitsCustomchannelsListCall) Pages(ctx context.Context, f func(*CustomChannels) error) error {
  1823. c.ctx_ = ctx
  1824. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1825. for {
  1826. x, err := c.Do()
  1827. if err != nil {
  1828. return err
  1829. }
  1830. if err := f(x); err != nil {
  1831. return err
  1832. }
  1833. if x.NextPageToken == "" {
  1834. return nil
  1835. }
  1836. c.PageToken(x.NextPageToken)
  1837. }
  1838. }
  1839. // method id "adsense.accounts.customchannels.get":
  1840. type AccountsCustomchannelsGetCall struct {
  1841. s *Service
  1842. accountId string
  1843. adClientId string
  1844. customChannelId string
  1845. urlParams_ gensupport.URLParams
  1846. ifNoneMatch_ string
  1847. ctx_ context.Context
  1848. }
  1849. // Get: Get the specified custom channel from the specified ad client
  1850. // for the specified account.
  1851. func (r *AccountsCustomchannelsService) Get(accountId string, adClientId string, customChannelId string) *AccountsCustomchannelsGetCall {
  1852. c := &AccountsCustomchannelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1853. c.accountId = accountId
  1854. c.adClientId = adClientId
  1855. c.customChannelId = customChannelId
  1856. return c
  1857. }
  1858. // Fields allows partial responses to be retrieved. See
  1859. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1860. // for more information.
  1861. func (c *AccountsCustomchannelsGetCall) Fields(s ...googleapi.Field) *AccountsCustomchannelsGetCall {
  1862. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1863. return c
  1864. }
  1865. // IfNoneMatch sets the optional parameter which makes the operation
  1866. // fail if the object's ETag matches the given value. This is useful for
  1867. // getting updates only after the object has changed since the last
  1868. // request. Use googleapi.IsNotModified to check whether the response
  1869. // error from Do is the result of In-None-Match.
  1870. func (c *AccountsCustomchannelsGetCall) IfNoneMatch(entityTag string) *AccountsCustomchannelsGetCall {
  1871. c.ifNoneMatch_ = entityTag
  1872. return c
  1873. }
  1874. // Context sets the context to be used in this call's Do method. Any
  1875. // pending HTTP request will be aborted if the provided context is
  1876. // canceled.
  1877. func (c *AccountsCustomchannelsGetCall) Context(ctx context.Context) *AccountsCustomchannelsGetCall {
  1878. c.ctx_ = ctx
  1879. return c
  1880. }
  1881. func (c *AccountsCustomchannelsGetCall) doRequest(alt string) (*http.Response, error) {
  1882. var body io.Reader = nil
  1883. c.urlParams_.Set("alt", alt)
  1884. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}")
  1885. urls += "?" + c.urlParams_.Encode()
  1886. req, _ := http.NewRequest("GET", urls, body)
  1887. googleapi.Expand(req.URL, map[string]string{
  1888. "accountId": c.accountId,
  1889. "adClientId": c.adClientId,
  1890. "customChannelId": c.customChannelId,
  1891. })
  1892. req.Header.Set("User-Agent", c.s.userAgent())
  1893. if c.ifNoneMatch_ != "" {
  1894. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1895. }
  1896. if c.ctx_ != nil {
  1897. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1898. }
  1899. return c.s.client.Do(req)
  1900. }
  1901. // Do executes the "adsense.accounts.customchannels.get" call.
  1902. // Exactly one of *CustomChannel or error will be non-nil. Any non-2xx
  1903. // status code is an error. Response headers are in either
  1904. // *CustomChannel.ServerResponse.Header or (if a response was returned
  1905. // at all) in error.(*googleapi.Error).Header. Use
  1906. // googleapi.IsNotModified to check whether the returned error was
  1907. // because http.StatusNotModified was returned.
  1908. func (c *AccountsCustomchannelsGetCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
  1909. gensupport.SetOptions(c.urlParams_, opts...)
  1910. res, err := c.doRequest("json")
  1911. if res != nil && res.StatusCode == http.StatusNotModified {
  1912. if res.Body != nil {
  1913. res.Body.Close()
  1914. }
  1915. return nil, &googleapi.Error{
  1916. Code: res.StatusCode,
  1917. Header: res.Header,
  1918. }
  1919. }
  1920. if err != nil {
  1921. return nil, err
  1922. }
  1923. defer googleapi.CloseBody(res)
  1924. if err := googleapi.CheckResponse(res); err != nil {
  1925. return nil, err
  1926. }
  1927. ret := &CustomChannel{
  1928. ServerResponse: googleapi.ServerResponse{
  1929. Header: res.Header,
  1930. HTTPStatusCode: res.StatusCode,
  1931. },
  1932. }
  1933. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1934. return nil, err
  1935. }
  1936. return ret, nil
  1937. // {
  1938. // "description": "Get the specified custom channel from the specified ad client for the specified account.",
  1939. // "httpMethod": "GET",
  1940. // "id": "adsense.accounts.customchannels.get",
  1941. // "parameterOrder": [
  1942. // "accountId",
  1943. // "adClientId",
  1944. // "customChannelId"
  1945. // ],
  1946. // "parameters": {
  1947. // "accountId": {
  1948. // "description": "Account to which the ad client belongs.",
  1949. // "location": "path",
  1950. // "required": true,
  1951. // "type": "string"
  1952. // },
  1953. // "adClientId": {
  1954. // "description": "Ad client which contains the custom channel.",
  1955. // "location": "path",
  1956. // "required": true,
  1957. // "type": "string"
  1958. // },
  1959. // "customChannelId": {
  1960. // "description": "Custom channel to retrieve.",
  1961. // "location": "path",
  1962. // "required": true,
  1963. // "type": "string"
  1964. // }
  1965. // },
  1966. // "path": "accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}",
  1967. // "response": {
  1968. // "$ref": "CustomChannel"
  1969. // },
  1970. // "scopes": [
  1971. // "https://www.googleapis.com/auth/adsense",
  1972. // "https://www.googleapis.com/auth/adsense.readonly"
  1973. // ]
  1974. // }
  1975. }
  1976. // method id "adsense.accounts.customchannels.list":
  1977. type AccountsCustomchannelsListCall struct {
  1978. s *Service
  1979. accountId string
  1980. adClientId string
  1981. urlParams_ gensupport.URLParams
  1982. ifNoneMatch_ string
  1983. ctx_ context.Context
  1984. }
  1985. // List: List all custom channels in the specified ad client for the
  1986. // specified account.
  1987. func (r *AccountsCustomchannelsService) List(accountId string, adClientId string) *AccountsCustomchannelsListCall {
  1988. c := &AccountsCustomchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1989. c.accountId = accountId
  1990. c.adClientId = adClientId
  1991. return c
  1992. }
  1993. // MaxResults sets the optional parameter "maxResults": The maximum
  1994. // number of custom channels to include in the response, used for
  1995. // paging.
  1996. func (c *AccountsCustomchannelsListCall) MaxResults(maxResults int64) *AccountsCustomchannelsListCall {
  1997. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1998. return c
  1999. }
  2000. // PageToken sets the optional parameter "pageToken": A continuation
  2001. // token, used to page through custom channels. To retrieve the next
  2002. // page, set this parameter to the value of "nextPageToken" from the
  2003. // previous response.
  2004. func (c *AccountsCustomchannelsListCall) PageToken(pageToken string) *AccountsCustomchannelsListCall {
  2005. c.urlParams_.Set("pageToken", pageToken)
  2006. return c
  2007. }
  2008. // Fields allows partial responses to be retrieved. See
  2009. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2010. // for more information.
  2011. func (c *AccountsCustomchannelsListCall) Fields(s ...googleapi.Field) *AccountsCustomchannelsListCall {
  2012. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2013. return c
  2014. }
  2015. // IfNoneMatch sets the optional parameter which makes the operation
  2016. // fail if the object's ETag matches the given value. This is useful for
  2017. // getting updates only after the object has changed since the last
  2018. // request. Use googleapi.IsNotModified to check whether the response
  2019. // error from Do is the result of In-None-Match.
  2020. func (c *AccountsCustomchannelsListCall) IfNoneMatch(entityTag string) *AccountsCustomchannelsListCall {
  2021. c.ifNoneMatch_ = entityTag
  2022. return c
  2023. }
  2024. // Context sets the context to be used in this call's Do method. Any
  2025. // pending HTTP request will be aborted if the provided context is
  2026. // canceled.
  2027. func (c *AccountsCustomchannelsListCall) Context(ctx context.Context) *AccountsCustomchannelsListCall {
  2028. c.ctx_ = ctx
  2029. return c
  2030. }
  2031. func (c *AccountsCustomchannelsListCall) doRequest(alt string) (*http.Response, error) {
  2032. var body io.Reader = nil
  2033. c.urlParams_.Set("alt", alt)
  2034. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/customchannels")
  2035. urls += "?" + c.urlParams_.Encode()
  2036. req, _ := http.NewRequest("GET", urls, body)
  2037. googleapi.Expand(req.URL, map[string]string{
  2038. "accountId": c.accountId,
  2039. "adClientId": c.adClientId,
  2040. })
  2041. req.Header.Set("User-Agent", c.s.userAgent())
  2042. if c.ifNoneMatch_ != "" {
  2043. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2044. }
  2045. if c.ctx_ != nil {
  2046. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2047. }
  2048. return c.s.client.Do(req)
  2049. }
  2050. // Do executes the "adsense.accounts.customchannels.list" call.
  2051. // Exactly one of *CustomChannels or error will be non-nil. Any non-2xx
  2052. // status code is an error. Response headers are in either
  2053. // *CustomChannels.ServerResponse.Header or (if a response was returned
  2054. // at all) in error.(*googleapi.Error).Header. Use
  2055. // googleapi.IsNotModified to check whether the returned error was
  2056. // because http.StatusNotModified was returned.
  2057. func (c *AccountsCustomchannelsListCall) Do(opts ...googleapi.CallOption) (*CustomChannels, error) {
  2058. gensupport.SetOptions(c.urlParams_, opts...)
  2059. res, err := c.doRequest("json")
  2060. if res != nil && res.StatusCode == http.StatusNotModified {
  2061. if res.Body != nil {
  2062. res.Body.Close()
  2063. }
  2064. return nil, &googleapi.Error{
  2065. Code: res.StatusCode,
  2066. Header: res.Header,
  2067. }
  2068. }
  2069. if err != nil {
  2070. return nil, err
  2071. }
  2072. defer googleapi.CloseBody(res)
  2073. if err := googleapi.CheckResponse(res); err != nil {
  2074. return nil, err
  2075. }
  2076. ret := &CustomChannels{
  2077. ServerResponse: googleapi.ServerResponse{
  2078. Header: res.Header,
  2079. HTTPStatusCode: res.StatusCode,
  2080. },
  2081. }
  2082. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2083. return nil, err
  2084. }
  2085. return ret, nil
  2086. // {
  2087. // "description": "List all custom channels in the specified ad client for the specified account.",
  2088. // "httpMethod": "GET",
  2089. // "id": "adsense.accounts.customchannels.list",
  2090. // "parameterOrder": [
  2091. // "accountId",
  2092. // "adClientId"
  2093. // ],
  2094. // "parameters": {
  2095. // "accountId": {
  2096. // "description": "Account to which the ad client belongs.",
  2097. // "location": "path",
  2098. // "required": true,
  2099. // "type": "string"
  2100. // },
  2101. // "adClientId": {
  2102. // "description": "Ad client for which to list custom channels.",
  2103. // "location": "path",
  2104. // "required": true,
  2105. // "type": "string"
  2106. // },
  2107. // "maxResults": {
  2108. // "description": "The maximum number of custom channels to include in the response, used for paging.",
  2109. // "format": "int32",
  2110. // "location": "query",
  2111. // "maximum": "10000",
  2112. // "minimum": "0",
  2113. // "type": "integer"
  2114. // },
  2115. // "pageToken": {
  2116. // "description": "A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  2117. // "location": "query",
  2118. // "type": "string"
  2119. // }
  2120. // },
  2121. // "path": "accounts/{accountId}/adclients/{adClientId}/customchannels",
  2122. // "response": {
  2123. // "$ref": "CustomChannels"
  2124. // },
  2125. // "scopes": [
  2126. // "https://www.googleapis.com/auth/adsense",
  2127. // "https://www.googleapis.com/auth/adsense.readonly"
  2128. // ]
  2129. // }
  2130. }
  2131. // Pages invokes f for each page of results.
  2132. // A non-nil error returned from f will halt the iteration.
  2133. // The provided context supersedes any context provided to the Context method.
  2134. func (c *AccountsCustomchannelsListCall) Pages(ctx context.Context, f func(*CustomChannels) error) error {
  2135. c.ctx_ = ctx
  2136. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2137. for {
  2138. x, err := c.Do()
  2139. if err != nil {
  2140. return err
  2141. }
  2142. if err := f(x); err != nil {
  2143. return err
  2144. }
  2145. if x.NextPageToken == "" {
  2146. return nil
  2147. }
  2148. c.PageToken(x.NextPageToken)
  2149. }
  2150. }
  2151. // method id "adsense.accounts.customchannels.adunits.list":
  2152. type AccountsCustomchannelsAdunitsListCall struct {
  2153. s *Service
  2154. accountId string
  2155. adClientId string
  2156. customChannelId string
  2157. urlParams_ gensupport.URLParams
  2158. ifNoneMatch_ string
  2159. ctx_ context.Context
  2160. }
  2161. // List: List all ad units in the specified custom channel.
  2162. func (r *AccountsCustomchannelsAdunitsService) List(accountId string, adClientId string, customChannelId string) *AccountsCustomchannelsAdunitsListCall {
  2163. c := &AccountsCustomchannelsAdunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2164. c.accountId = accountId
  2165. c.adClientId = adClientId
  2166. c.customChannelId = customChannelId
  2167. return c
  2168. }
  2169. // IncludeInactive sets the optional parameter "includeInactive":
  2170. // Whether to include inactive ad units. Default: true.
  2171. func (c *AccountsCustomchannelsAdunitsListCall) IncludeInactive(includeInactive bool) *AccountsCustomchannelsAdunitsListCall {
  2172. c.urlParams_.Set("includeInactive", fmt.Sprint(includeInactive))
  2173. return c
  2174. }
  2175. // MaxResults sets the optional parameter "maxResults": The maximum
  2176. // number of ad units to include in the response, used for paging.
  2177. func (c *AccountsCustomchannelsAdunitsListCall) MaxResults(maxResults int64) *AccountsCustomchannelsAdunitsListCall {
  2178. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2179. return c
  2180. }
  2181. // PageToken sets the optional parameter "pageToken": A continuation
  2182. // token, used to page through ad units. To retrieve the next page, set
  2183. // this parameter to the value of "nextPageToken" from the previous
  2184. // response.
  2185. func (c *AccountsCustomchannelsAdunitsListCall) PageToken(pageToken string) *AccountsCustomchannelsAdunitsListCall {
  2186. c.urlParams_.Set("pageToken", pageToken)
  2187. return c
  2188. }
  2189. // Fields allows partial responses to be retrieved. See
  2190. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2191. // for more information.
  2192. func (c *AccountsCustomchannelsAdunitsListCall) Fields(s ...googleapi.Field) *AccountsCustomchannelsAdunitsListCall {
  2193. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2194. return c
  2195. }
  2196. // IfNoneMatch sets the optional parameter which makes the operation
  2197. // fail if the object's ETag matches the given value. This is useful for
  2198. // getting updates only after the object has changed since the last
  2199. // request. Use googleapi.IsNotModified to check whether the response
  2200. // error from Do is the result of In-None-Match.
  2201. func (c *AccountsCustomchannelsAdunitsListCall) IfNoneMatch(entityTag string) *AccountsCustomchannelsAdunitsListCall {
  2202. c.ifNoneMatch_ = entityTag
  2203. return c
  2204. }
  2205. // Context sets the context to be used in this call's Do method. Any
  2206. // pending HTTP request will be aborted if the provided context is
  2207. // canceled.
  2208. func (c *AccountsCustomchannelsAdunitsListCall) Context(ctx context.Context) *AccountsCustomchannelsAdunitsListCall {
  2209. c.ctx_ = ctx
  2210. return c
  2211. }
  2212. func (c *AccountsCustomchannelsAdunitsListCall) doRequest(alt string) (*http.Response, error) {
  2213. var body io.Reader = nil
  2214. c.urlParams_.Set("alt", alt)
  2215. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}/adunits")
  2216. urls += "?" + c.urlParams_.Encode()
  2217. req, _ := http.NewRequest("GET", urls, body)
  2218. googleapi.Expand(req.URL, map[string]string{
  2219. "accountId": c.accountId,
  2220. "adClientId": c.adClientId,
  2221. "customChannelId": c.customChannelId,
  2222. })
  2223. req.Header.Set("User-Agent", c.s.userAgent())
  2224. if c.ifNoneMatch_ != "" {
  2225. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2226. }
  2227. if c.ctx_ != nil {
  2228. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2229. }
  2230. return c.s.client.Do(req)
  2231. }
  2232. // Do executes the "adsense.accounts.customchannels.adunits.list" call.
  2233. // Exactly one of *AdUnits or error will be non-nil. Any non-2xx status
  2234. // code is an error. Response headers are in either
  2235. // *AdUnits.ServerResponse.Header or (if a response was returned at all)
  2236. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2237. // check whether the returned error was because http.StatusNotModified
  2238. // was returned.
  2239. func (c *AccountsCustomchannelsAdunitsListCall) Do(opts ...googleapi.CallOption) (*AdUnits, error) {
  2240. gensupport.SetOptions(c.urlParams_, opts...)
  2241. res, err := c.doRequest("json")
  2242. if res != nil && res.StatusCode == http.StatusNotModified {
  2243. if res.Body != nil {
  2244. res.Body.Close()
  2245. }
  2246. return nil, &googleapi.Error{
  2247. Code: res.StatusCode,
  2248. Header: res.Header,
  2249. }
  2250. }
  2251. if err != nil {
  2252. return nil, err
  2253. }
  2254. defer googleapi.CloseBody(res)
  2255. if err := googleapi.CheckResponse(res); err != nil {
  2256. return nil, err
  2257. }
  2258. ret := &AdUnits{
  2259. ServerResponse: googleapi.ServerResponse{
  2260. Header: res.Header,
  2261. HTTPStatusCode: res.StatusCode,
  2262. },
  2263. }
  2264. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2265. return nil, err
  2266. }
  2267. return ret, nil
  2268. // {
  2269. // "description": "List all ad units in the specified custom channel.",
  2270. // "httpMethod": "GET",
  2271. // "id": "adsense.accounts.customchannels.adunits.list",
  2272. // "parameterOrder": [
  2273. // "accountId",
  2274. // "adClientId",
  2275. // "customChannelId"
  2276. // ],
  2277. // "parameters": {
  2278. // "accountId": {
  2279. // "description": "Account to which the ad client belongs.",
  2280. // "location": "path",
  2281. // "required": true,
  2282. // "type": "string"
  2283. // },
  2284. // "adClientId": {
  2285. // "description": "Ad client which contains the custom channel.",
  2286. // "location": "path",
  2287. // "required": true,
  2288. // "type": "string"
  2289. // },
  2290. // "customChannelId": {
  2291. // "description": "Custom channel for which to list ad units.",
  2292. // "location": "path",
  2293. // "required": true,
  2294. // "type": "string"
  2295. // },
  2296. // "includeInactive": {
  2297. // "description": "Whether to include inactive ad units. Default: true.",
  2298. // "location": "query",
  2299. // "type": "boolean"
  2300. // },
  2301. // "maxResults": {
  2302. // "description": "The maximum number of ad units to include in the response, used for paging.",
  2303. // "format": "int32",
  2304. // "location": "query",
  2305. // "maximum": "10000",
  2306. // "minimum": "0",
  2307. // "type": "integer"
  2308. // },
  2309. // "pageToken": {
  2310. // "description": "A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  2311. // "location": "query",
  2312. // "type": "string"
  2313. // }
  2314. // },
  2315. // "path": "accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}/adunits",
  2316. // "response": {
  2317. // "$ref": "AdUnits"
  2318. // },
  2319. // "scopes": [
  2320. // "https://www.googleapis.com/auth/adsense",
  2321. // "https://www.googleapis.com/auth/adsense.readonly"
  2322. // ]
  2323. // }
  2324. }
  2325. // Pages invokes f for each page of results.
  2326. // A non-nil error returned from f will halt the iteration.
  2327. // The provided context supersedes any context provided to the Context method.
  2328. func (c *AccountsCustomchannelsAdunitsListCall) Pages(ctx context.Context, f func(*AdUnits) error) error {
  2329. c.ctx_ = ctx
  2330. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2331. for {
  2332. x, err := c.Do()
  2333. if err != nil {
  2334. return err
  2335. }
  2336. if err := f(x); err != nil {
  2337. return err
  2338. }
  2339. if x.NextPageToken == "" {
  2340. return nil
  2341. }
  2342. c.PageToken(x.NextPageToken)
  2343. }
  2344. }
  2345. // method id "adsense.accounts.reports.generate":
  2346. type AccountsReportsGenerateCall struct {
  2347. s *Service
  2348. accountId string
  2349. urlParams_ gensupport.URLParams
  2350. ifNoneMatch_ string
  2351. ctx_ context.Context
  2352. }
  2353. // Generate: Generate an AdSense report based on the report request sent
  2354. // in the query parameters. Returns the result as JSON; to retrieve
  2355. // output in CSV format specify "alt=csv" as a query parameter.
  2356. func (r *AccountsReportsService) Generate(accountId string, startDate string, endDate string) *AccountsReportsGenerateCall {
  2357. c := &AccountsReportsGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2358. c.accountId = accountId
  2359. c.urlParams_.Set("startDate", startDate)
  2360. c.urlParams_.Set("endDate", endDate)
  2361. return c
  2362. }
  2363. // Currency sets the optional parameter "currency": Optional currency to
  2364. // use when reporting on monetary metrics. Defaults to the account's
  2365. // currency if not set.
  2366. func (c *AccountsReportsGenerateCall) Currency(currency string) *AccountsReportsGenerateCall {
  2367. c.urlParams_.Set("currency", currency)
  2368. return c
  2369. }
  2370. // Dimension sets the optional parameter "dimension": Dimensions to base
  2371. // the report on.
  2372. func (c *AccountsReportsGenerateCall) Dimension(dimension ...string) *AccountsReportsGenerateCall {
  2373. c.urlParams_.SetMulti("dimension", append([]string{}, dimension...))
  2374. return c
  2375. }
  2376. // Filter sets the optional parameter "filter": Filters to be run on the
  2377. // report.
  2378. func (c *AccountsReportsGenerateCall) Filter(filter ...string) *AccountsReportsGenerateCall {
  2379. c.urlParams_.SetMulti("filter", append([]string{}, filter...))
  2380. return c
  2381. }
  2382. // Locale sets the optional parameter "locale": Optional locale to use
  2383. // for translating report output to a local language. Defaults to
  2384. // "en_US" if not specified.
  2385. func (c *AccountsReportsGenerateCall) Locale(locale string) *AccountsReportsGenerateCall {
  2386. c.urlParams_.Set("locale", locale)
  2387. return c
  2388. }
  2389. // MaxResults sets the optional parameter "maxResults": The maximum
  2390. // number of rows of report data to return.
  2391. func (c *AccountsReportsGenerateCall) MaxResults(maxResults int64) *AccountsReportsGenerateCall {
  2392. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2393. return c
  2394. }
  2395. // Metric sets the optional parameter "metric": Numeric columns to
  2396. // include in the report.
  2397. func (c *AccountsReportsGenerateCall) Metric(metric ...string) *AccountsReportsGenerateCall {
  2398. c.urlParams_.SetMulti("metric", append([]string{}, metric...))
  2399. return c
  2400. }
  2401. // Sort sets the optional parameter "sort": The name of a dimension or
  2402. // metric to sort the resulting report on, optionally prefixed with "+"
  2403. // to sort ascending or "-" to sort descending. If no prefix is
  2404. // specified, the column is sorted ascending.
  2405. func (c *AccountsReportsGenerateCall) Sort(sort ...string) *AccountsReportsGenerateCall {
  2406. c.urlParams_.SetMulti("sort", append([]string{}, sort...))
  2407. return c
  2408. }
  2409. // StartIndex sets the optional parameter "startIndex": Index of the
  2410. // first row of report data to return.
  2411. func (c *AccountsReportsGenerateCall) StartIndex(startIndex int64) *AccountsReportsGenerateCall {
  2412. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  2413. return c
  2414. }
  2415. // Fields allows partial responses to be retrieved. See
  2416. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2417. // for more information.
  2418. func (c *AccountsReportsGenerateCall) Fields(s ...googleapi.Field) *AccountsReportsGenerateCall {
  2419. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2420. return c
  2421. }
  2422. // IfNoneMatch sets the optional parameter which makes the operation
  2423. // fail if the object's ETag matches the given value. This is useful for
  2424. // getting updates only after the object has changed since the last
  2425. // request. Use googleapi.IsNotModified to check whether the response
  2426. // error from Do is the result of In-None-Match.
  2427. func (c *AccountsReportsGenerateCall) IfNoneMatch(entityTag string) *AccountsReportsGenerateCall {
  2428. c.ifNoneMatch_ = entityTag
  2429. return c
  2430. }
  2431. // Context sets the context to be used in this call's Do and Download
  2432. // methods. Any pending HTTP request will be aborted if the provided
  2433. // context is canceled.
  2434. func (c *AccountsReportsGenerateCall) Context(ctx context.Context) *AccountsReportsGenerateCall {
  2435. c.ctx_ = ctx
  2436. return c
  2437. }
  2438. func (c *AccountsReportsGenerateCall) doRequest(alt string) (*http.Response, error) {
  2439. var body io.Reader = nil
  2440. c.urlParams_.Set("alt", alt)
  2441. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/reports")
  2442. urls += "?" + c.urlParams_.Encode()
  2443. req, _ := http.NewRequest("GET", urls, body)
  2444. googleapi.Expand(req.URL, map[string]string{
  2445. "accountId": c.accountId,
  2446. })
  2447. req.Header.Set("User-Agent", c.s.userAgent())
  2448. if c.ifNoneMatch_ != "" {
  2449. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2450. }
  2451. if c.ctx_ != nil {
  2452. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2453. }
  2454. return c.s.client.Do(req)
  2455. }
  2456. // Download fetches the API endpoint's "media" value, instead of the normal
  2457. // API response value. If the returned error is nil, the Response is guaranteed to
  2458. // have a 2xx status code. Callers must close the Response.Body as usual.
  2459. func (c *AccountsReportsGenerateCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  2460. gensupport.SetOptions(c.urlParams_, opts...)
  2461. res, err := c.doRequest("media")
  2462. if err != nil {
  2463. return nil, err
  2464. }
  2465. if err := googleapi.CheckMediaResponse(res); err != nil {
  2466. res.Body.Close()
  2467. return nil, err
  2468. }
  2469. return res, nil
  2470. }
  2471. // Do executes the "adsense.accounts.reports.generate" call.
  2472. // Exactly one of *AdsenseReportsGenerateResponse or error will be
  2473. // non-nil. Any non-2xx status code is an error. Response headers are in
  2474. // either *AdsenseReportsGenerateResponse.ServerResponse.Header or (if a
  2475. // response was returned at all) in error.(*googleapi.Error).Header. Use
  2476. // googleapi.IsNotModified to check whether the returned error was
  2477. // because http.StatusNotModified was returned.
  2478. func (c *AccountsReportsGenerateCall) Do(opts ...googleapi.CallOption) (*AdsenseReportsGenerateResponse, error) {
  2479. gensupport.SetOptions(c.urlParams_, opts...)
  2480. res, err := c.doRequest("json")
  2481. if res != nil && res.StatusCode == http.StatusNotModified {
  2482. if res.Body != nil {
  2483. res.Body.Close()
  2484. }
  2485. return nil, &googleapi.Error{
  2486. Code: res.StatusCode,
  2487. Header: res.Header,
  2488. }
  2489. }
  2490. if err != nil {
  2491. return nil, err
  2492. }
  2493. defer googleapi.CloseBody(res)
  2494. if err := googleapi.CheckResponse(res); err != nil {
  2495. return nil, err
  2496. }
  2497. ret := &AdsenseReportsGenerateResponse{
  2498. ServerResponse: googleapi.ServerResponse{
  2499. Header: res.Header,
  2500. HTTPStatusCode: res.StatusCode,
  2501. },
  2502. }
  2503. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2504. return nil, err
  2505. }
  2506. return ret, nil
  2507. // {
  2508. // "description": "Generate an AdSense report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify \"alt=csv\" as a query parameter.",
  2509. // "httpMethod": "GET",
  2510. // "id": "adsense.accounts.reports.generate",
  2511. // "parameterOrder": [
  2512. // "accountId",
  2513. // "startDate",
  2514. // "endDate"
  2515. // ],
  2516. // "parameters": {
  2517. // "accountId": {
  2518. // "description": "Account upon which to report.",
  2519. // "location": "path",
  2520. // "required": true,
  2521. // "type": "string"
  2522. // },
  2523. // "currency": {
  2524. // "description": "Optional currency to use when reporting on monetary metrics. Defaults to the account's currency if not set.",
  2525. // "location": "query",
  2526. // "pattern": "[a-zA-Z]+",
  2527. // "type": "string"
  2528. // },
  2529. // "dimension": {
  2530. // "description": "Dimensions to base the report on.",
  2531. // "location": "query",
  2532. // "pattern": "[a-zA-Z_]+",
  2533. // "repeated": true,
  2534. // "type": "string"
  2535. // },
  2536. // "endDate": {
  2537. // "description": "End of the date range to report on in \"YYYY-MM-DD\" format, inclusive.",
  2538. // "location": "query",
  2539. // "pattern": "\\d{4}-\\d{2}-\\d{2}|(today|startOfMonth|startOfYear)(([\\-\\+]\\d+[dwmy]){0,3}?)",
  2540. // "required": true,
  2541. // "type": "string"
  2542. // },
  2543. // "filter": {
  2544. // "description": "Filters to be run on the report.",
  2545. // "location": "query",
  2546. // "pattern": "[a-zA-Z_]+(==|=@).+",
  2547. // "repeated": true,
  2548. // "type": "string"
  2549. // },
  2550. // "locale": {
  2551. // "description": "Optional locale to use for translating report output to a local language. Defaults to \"en_US\" if not specified.",
  2552. // "location": "query",
  2553. // "pattern": "[a-zA-Z_]+",
  2554. // "type": "string"
  2555. // },
  2556. // "maxResults": {
  2557. // "description": "The maximum number of rows of report data to return.",
  2558. // "format": "int32",
  2559. // "location": "query",
  2560. // "maximum": "50000",
  2561. // "minimum": "0",
  2562. // "type": "integer"
  2563. // },
  2564. // "metric": {
  2565. // "description": "Numeric columns to include in the report.",
  2566. // "location": "query",
  2567. // "pattern": "[a-zA-Z_]+",
  2568. // "repeated": true,
  2569. // "type": "string"
  2570. // },
  2571. // "sort": {
  2572. // "description": "The name of a dimension or metric to sort the resulting report on, optionally prefixed with \"+\" to sort ascending or \"-\" to sort descending. If no prefix is specified, the column is sorted ascending.",
  2573. // "location": "query",
  2574. // "pattern": "(\\+|-)?[a-zA-Z_]+",
  2575. // "repeated": true,
  2576. // "type": "string"
  2577. // },
  2578. // "startDate": {
  2579. // "description": "Start of the date range to report on in \"YYYY-MM-DD\" format, inclusive.",
  2580. // "location": "query",
  2581. // "pattern": "\\d{4}-\\d{2}-\\d{2}|(today|startOfMonth|startOfYear)(([\\-\\+]\\d+[dwmy]){0,3}?)",
  2582. // "required": true,
  2583. // "type": "string"
  2584. // },
  2585. // "startIndex": {
  2586. // "description": "Index of the first row of report data to return.",
  2587. // "format": "int32",
  2588. // "location": "query",
  2589. // "maximum": "5000",
  2590. // "minimum": "0",
  2591. // "type": "integer"
  2592. // }
  2593. // },
  2594. // "path": "accounts/{accountId}/reports",
  2595. // "response": {
  2596. // "$ref": "AdsenseReportsGenerateResponse"
  2597. // },
  2598. // "scopes": [
  2599. // "https://www.googleapis.com/auth/adsense",
  2600. // "https://www.googleapis.com/auth/adsense.readonly"
  2601. // ],
  2602. // "supportsMediaDownload": true
  2603. // }
  2604. }
  2605. // method id "adsense.accounts.reports.saved.generate":
  2606. type AccountsReportsSavedGenerateCall struct {
  2607. s *Service
  2608. accountId string
  2609. savedReportId string
  2610. urlParams_ gensupport.URLParams
  2611. ifNoneMatch_ string
  2612. ctx_ context.Context
  2613. }
  2614. // Generate: Generate an AdSense report based on the saved report ID
  2615. // sent in the query parameters.
  2616. func (r *AccountsReportsSavedService) Generate(accountId string, savedReportId string) *AccountsReportsSavedGenerateCall {
  2617. c := &AccountsReportsSavedGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2618. c.accountId = accountId
  2619. c.savedReportId = savedReportId
  2620. return c
  2621. }
  2622. // Locale sets the optional parameter "locale": Optional locale to use
  2623. // for translating report output to a local language. Defaults to
  2624. // "en_US" if not specified.
  2625. func (c *AccountsReportsSavedGenerateCall) Locale(locale string) *AccountsReportsSavedGenerateCall {
  2626. c.urlParams_.Set("locale", locale)
  2627. return c
  2628. }
  2629. // MaxResults sets the optional parameter "maxResults": The maximum
  2630. // number of rows of report data to return.
  2631. func (c *AccountsReportsSavedGenerateCall) MaxResults(maxResults int64) *AccountsReportsSavedGenerateCall {
  2632. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2633. return c
  2634. }
  2635. // StartIndex sets the optional parameter "startIndex": Index of the
  2636. // first row of report data to return.
  2637. func (c *AccountsReportsSavedGenerateCall) StartIndex(startIndex int64) *AccountsReportsSavedGenerateCall {
  2638. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  2639. return c
  2640. }
  2641. // Fields allows partial responses to be retrieved. See
  2642. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2643. // for more information.
  2644. func (c *AccountsReportsSavedGenerateCall) Fields(s ...googleapi.Field) *AccountsReportsSavedGenerateCall {
  2645. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2646. return c
  2647. }
  2648. // IfNoneMatch sets the optional parameter which makes the operation
  2649. // fail if the object's ETag matches the given value. This is useful for
  2650. // getting updates only after the object has changed since the last
  2651. // request. Use googleapi.IsNotModified to check whether the response
  2652. // error from Do is the result of In-None-Match.
  2653. func (c *AccountsReportsSavedGenerateCall) IfNoneMatch(entityTag string) *AccountsReportsSavedGenerateCall {
  2654. c.ifNoneMatch_ = entityTag
  2655. return c
  2656. }
  2657. // Context sets the context to be used in this call's Do method. Any
  2658. // pending HTTP request will be aborted if the provided context is
  2659. // canceled.
  2660. func (c *AccountsReportsSavedGenerateCall) Context(ctx context.Context) *AccountsReportsSavedGenerateCall {
  2661. c.ctx_ = ctx
  2662. return c
  2663. }
  2664. func (c *AccountsReportsSavedGenerateCall) doRequest(alt string) (*http.Response, error) {
  2665. var body io.Reader = nil
  2666. c.urlParams_.Set("alt", alt)
  2667. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/reports/{savedReportId}")
  2668. urls += "?" + c.urlParams_.Encode()
  2669. req, _ := http.NewRequest("GET", urls, body)
  2670. googleapi.Expand(req.URL, map[string]string{
  2671. "accountId": c.accountId,
  2672. "savedReportId": c.savedReportId,
  2673. })
  2674. req.Header.Set("User-Agent", c.s.userAgent())
  2675. if c.ifNoneMatch_ != "" {
  2676. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2677. }
  2678. if c.ctx_ != nil {
  2679. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2680. }
  2681. return c.s.client.Do(req)
  2682. }
  2683. // Do executes the "adsense.accounts.reports.saved.generate" call.
  2684. // Exactly one of *AdsenseReportsGenerateResponse or error will be
  2685. // non-nil. Any non-2xx status code is an error. Response headers are in
  2686. // either *AdsenseReportsGenerateResponse.ServerResponse.Header or (if a
  2687. // response was returned at all) in error.(*googleapi.Error).Header. Use
  2688. // googleapi.IsNotModified to check whether the returned error was
  2689. // because http.StatusNotModified was returned.
  2690. func (c *AccountsReportsSavedGenerateCall) Do(opts ...googleapi.CallOption) (*AdsenseReportsGenerateResponse, error) {
  2691. gensupport.SetOptions(c.urlParams_, opts...)
  2692. res, err := c.doRequest("json")
  2693. if res != nil && res.StatusCode == http.StatusNotModified {
  2694. if res.Body != nil {
  2695. res.Body.Close()
  2696. }
  2697. return nil, &googleapi.Error{
  2698. Code: res.StatusCode,
  2699. Header: res.Header,
  2700. }
  2701. }
  2702. if err != nil {
  2703. return nil, err
  2704. }
  2705. defer googleapi.CloseBody(res)
  2706. if err := googleapi.CheckResponse(res); err != nil {
  2707. return nil, err
  2708. }
  2709. ret := &AdsenseReportsGenerateResponse{
  2710. ServerResponse: googleapi.ServerResponse{
  2711. Header: res.Header,
  2712. HTTPStatusCode: res.StatusCode,
  2713. },
  2714. }
  2715. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2716. return nil, err
  2717. }
  2718. return ret, nil
  2719. // {
  2720. // "description": "Generate an AdSense report based on the saved report ID sent in the query parameters.",
  2721. // "httpMethod": "GET",
  2722. // "id": "adsense.accounts.reports.saved.generate",
  2723. // "parameterOrder": [
  2724. // "accountId",
  2725. // "savedReportId"
  2726. // ],
  2727. // "parameters": {
  2728. // "accountId": {
  2729. // "description": "Account to which the saved reports belong.",
  2730. // "location": "path",
  2731. // "required": true,
  2732. // "type": "string"
  2733. // },
  2734. // "locale": {
  2735. // "description": "Optional locale to use for translating report output to a local language. Defaults to \"en_US\" if not specified.",
  2736. // "location": "query",
  2737. // "pattern": "[a-zA-Z_]+",
  2738. // "type": "string"
  2739. // },
  2740. // "maxResults": {
  2741. // "description": "The maximum number of rows of report data to return.",
  2742. // "format": "int32",
  2743. // "location": "query",
  2744. // "maximum": "50000",
  2745. // "minimum": "0",
  2746. // "type": "integer"
  2747. // },
  2748. // "savedReportId": {
  2749. // "description": "The saved report to retrieve.",
  2750. // "location": "path",
  2751. // "required": true,
  2752. // "type": "string"
  2753. // },
  2754. // "startIndex": {
  2755. // "description": "Index of the first row of report data to return.",
  2756. // "format": "int32",
  2757. // "location": "query",
  2758. // "maximum": "5000",
  2759. // "minimum": "0",
  2760. // "type": "integer"
  2761. // }
  2762. // },
  2763. // "path": "accounts/{accountId}/reports/{savedReportId}",
  2764. // "response": {
  2765. // "$ref": "AdsenseReportsGenerateResponse"
  2766. // },
  2767. // "scopes": [
  2768. // "https://www.googleapis.com/auth/adsense",
  2769. // "https://www.googleapis.com/auth/adsense.readonly"
  2770. // ]
  2771. // }
  2772. }
  2773. // method id "adsense.accounts.reports.saved.list":
  2774. type AccountsReportsSavedListCall struct {
  2775. s *Service
  2776. accountId string
  2777. urlParams_ gensupport.URLParams
  2778. ifNoneMatch_ string
  2779. ctx_ context.Context
  2780. }
  2781. // List: List all saved reports in the specified AdSense account.
  2782. func (r *AccountsReportsSavedService) List(accountId string) *AccountsReportsSavedListCall {
  2783. c := &AccountsReportsSavedListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2784. c.accountId = accountId
  2785. return c
  2786. }
  2787. // MaxResults sets the optional parameter "maxResults": The maximum
  2788. // number of saved reports to include in the response, used for paging.
  2789. func (c *AccountsReportsSavedListCall) MaxResults(maxResults int64) *AccountsReportsSavedListCall {
  2790. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2791. return c
  2792. }
  2793. // PageToken sets the optional parameter "pageToken": A continuation
  2794. // token, used to page through saved reports. To retrieve the next page,
  2795. // set this parameter to the value of "nextPageToken" from the previous
  2796. // response.
  2797. func (c *AccountsReportsSavedListCall) PageToken(pageToken string) *AccountsReportsSavedListCall {
  2798. c.urlParams_.Set("pageToken", pageToken)
  2799. return c
  2800. }
  2801. // Fields allows partial responses to be retrieved. See
  2802. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2803. // for more information.
  2804. func (c *AccountsReportsSavedListCall) Fields(s ...googleapi.Field) *AccountsReportsSavedListCall {
  2805. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2806. return c
  2807. }
  2808. // IfNoneMatch sets the optional parameter which makes the operation
  2809. // fail if the object's ETag matches the given value. This is useful for
  2810. // getting updates only after the object has changed since the last
  2811. // request. Use googleapi.IsNotModified to check whether the response
  2812. // error from Do is the result of In-None-Match.
  2813. func (c *AccountsReportsSavedListCall) IfNoneMatch(entityTag string) *AccountsReportsSavedListCall {
  2814. c.ifNoneMatch_ = entityTag
  2815. return c
  2816. }
  2817. // Context sets the context to be used in this call's Do method. Any
  2818. // pending HTTP request will be aborted if the provided context is
  2819. // canceled.
  2820. func (c *AccountsReportsSavedListCall) Context(ctx context.Context) *AccountsReportsSavedListCall {
  2821. c.ctx_ = ctx
  2822. return c
  2823. }
  2824. func (c *AccountsReportsSavedListCall) doRequest(alt string) (*http.Response, error) {
  2825. var body io.Reader = nil
  2826. c.urlParams_.Set("alt", alt)
  2827. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/reports/saved")
  2828. urls += "?" + c.urlParams_.Encode()
  2829. req, _ := http.NewRequest("GET", urls, body)
  2830. googleapi.Expand(req.URL, map[string]string{
  2831. "accountId": c.accountId,
  2832. })
  2833. req.Header.Set("User-Agent", c.s.userAgent())
  2834. if c.ifNoneMatch_ != "" {
  2835. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2836. }
  2837. if c.ctx_ != nil {
  2838. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2839. }
  2840. return c.s.client.Do(req)
  2841. }
  2842. // Do executes the "adsense.accounts.reports.saved.list" call.
  2843. // Exactly one of *SavedReports or error will be non-nil. Any non-2xx
  2844. // status code is an error. Response headers are in either
  2845. // *SavedReports.ServerResponse.Header or (if a response was returned at
  2846. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2847. // to check whether the returned error was because
  2848. // http.StatusNotModified was returned.
  2849. func (c *AccountsReportsSavedListCall) Do(opts ...googleapi.CallOption) (*SavedReports, error) {
  2850. gensupport.SetOptions(c.urlParams_, opts...)
  2851. res, err := c.doRequest("json")
  2852. if res != nil && res.StatusCode == http.StatusNotModified {
  2853. if res.Body != nil {
  2854. res.Body.Close()
  2855. }
  2856. return nil, &googleapi.Error{
  2857. Code: res.StatusCode,
  2858. Header: res.Header,
  2859. }
  2860. }
  2861. if err != nil {
  2862. return nil, err
  2863. }
  2864. defer googleapi.CloseBody(res)
  2865. if err := googleapi.CheckResponse(res); err != nil {
  2866. return nil, err
  2867. }
  2868. ret := &SavedReports{
  2869. ServerResponse: googleapi.ServerResponse{
  2870. Header: res.Header,
  2871. HTTPStatusCode: res.StatusCode,
  2872. },
  2873. }
  2874. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2875. return nil, err
  2876. }
  2877. return ret, nil
  2878. // {
  2879. // "description": "List all saved reports in the specified AdSense account.",
  2880. // "httpMethod": "GET",
  2881. // "id": "adsense.accounts.reports.saved.list",
  2882. // "parameterOrder": [
  2883. // "accountId"
  2884. // ],
  2885. // "parameters": {
  2886. // "accountId": {
  2887. // "description": "Account to which the saved reports belong.",
  2888. // "location": "path",
  2889. // "required": true,
  2890. // "type": "string"
  2891. // },
  2892. // "maxResults": {
  2893. // "description": "The maximum number of saved reports to include in the response, used for paging.",
  2894. // "format": "int32",
  2895. // "location": "query",
  2896. // "maximum": "100",
  2897. // "minimum": "0",
  2898. // "type": "integer"
  2899. // },
  2900. // "pageToken": {
  2901. // "description": "A continuation token, used to page through saved reports. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  2902. // "location": "query",
  2903. // "type": "string"
  2904. // }
  2905. // },
  2906. // "path": "accounts/{accountId}/reports/saved",
  2907. // "response": {
  2908. // "$ref": "SavedReports"
  2909. // },
  2910. // "scopes": [
  2911. // "https://www.googleapis.com/auth/adsense",
  2912. // "https://www.googleapis.com/auth/adsense.readonly"
  2913. // ]
  2914. // }
  2915. }
  2916. // Pages invokes f for each page of results.
  2917. // A non-nil error returned from f will halt the iteration.
  2918. // The provided context supersedes any context provided to the Context method.
  2919. func (c *AccountsReportsSavedListCall) Pages(ctx context.Context, f func(*SavedReports) error) error {
  2920. c.ctx_ = ctx
  2921. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2922. for {
  2923. x, err := c.Do()
  2924. if err != nil {
  2925. return err
  2926. }
  2927. if err := f(x); err != nil {
  2928. return err
  2929. }
  2930. if x.NextPageToken == "" {
  2931. return nil
  2932. }
  2933. c.PageToken(x.NextPageToken)
  2934. }
  2935. }
  2936. // method id "adsense.accounts.savedadstyles.get":
  2937. type AccountsSavedadstylesGetCall struct {
  2938. s *Service
  2939. accountId string
  2940. savedAdStyleId string
  2941. urlParams_ gensupport.URLParams
  2942. ifNoneMatch_ string
  2943. ctx_ context.Context
  2944. }
  2945. // Get: List a specific saved ad style for the specified account.
  2946. func (r *AccountsSavedadstylesService) Get(accountId string, savedAdStyleId string) *AccountsSavedadstylesGetCall {
  2947. c := &AccountsSavedadstylesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2948. c.accountId = accountId
  2949. c.savedAdStyleId = savedAdStyleId
  2950. return c
  2951. }
  2952. // Fields allows partial responses to be retrieved. See
  2953. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2954. // for more information.
  2955. func (c *AccountsSavedadstylesGetCall) Fields(s ...googleapi.Field) *AccountsSavedadstylesGetCall {
  2956. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2957. return c
  2958. }
  2959. // IfNoneMatch sets the optional parameter which makes the operation
  2960. // fail if the object's ETag matches the given value. This is useful for
  2961. // getting updates only after the object has changed since the last
  2962. // request. Use googleapi.IsNotModified to check whether the response
  2963. // error from Do is the result of In-None-Match.
  2964. func (c *AccountsSavedadstylesGetCall) IfNoneMatch(entityTag string) *AccountsSavedadstylesGetCall {
  2965. c.ifNoneMatch_ = entityTag
  2966. return c
  2967. }
  2968. // Context sets the context to be used in this call's Do method. Any
  2969. // pending HTTP request will be aborted if the provided context is
  2970. // canceled.
  2971. func (c *AccountsSavedadstylesGetCall) Context(ctx context.Context) *AccountsSavedadstylesGetCall {
  2972. c.ctx_ = ctx
  2973. return c
  2974. }
  2975. func (c *AccountsSavedadstylesGetCall) doRequest(alt string) (*http.Response, error) {
  2976. var body io.Reader = nil
  2977. c.urlParams_.Set("alt", alt)
  2978. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/savedadstyles/{savedAdStyleId}")
  2979. urls += "?" + c.urlParams_.Encode()
  2980. req, _ := http.NewRequest("GET", urls, body)
  2981. googleapi.Expand(req.URL, map[string]string{
  2982. "accountId": c.accountId,
  2983. "savedAdStyleId": c.savedAdStyleId,
  2984. })
  2985. req.Header.Set("User-Agent", c.s.userAgent())
  2986. if c.ifNoneMatch_ != "" {
  2987. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2988. }
  2989. if c.ctx_ != nil {
  2990. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2991. }
  2992. return c.s.client.Do(req)
  2993. }
  2994. // Do executes the "adsense.accounts.savedadstyles.get" call.
  2995. // Exactly one of *SavedAdStyle or error will be non-nil. Any non-2xx
  2996. // status code is an error. Response headers are in either
  2997. // *SavedAdStyle.ServerResponse.Header or (if a response was returned at
  2998. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2999. // to check whether the returned error was because
  3000. // http.StatusNotModified was returned.
  3001. func (c *AccountsSavedadstylesGetCall) Do(opts ...googleapi.CallOption) (*SavedAdStyle, error) {
  3002. gensupport.SetOptions(c.urlParams_, opts...)
  3003. res, err := c.doRequest("json")
  3004. if res != nil && res.StatusCode == http.StatusNotModified {
  3005. if res.Body != nil {
  3006. res.Body.Close()
  3007. }
  3008. return nil, &googleapi.Error{
  3009. Code: res.StatusCode,
  3010. Header: res.Header,
  3011. }
  3012. }
  3013. if err != nil {
  3014. return nil, err
  3015. }
  3016. defer googleapi.CloseBody(res)
  3017. if err := googleapi.CheckResponse(res); err != nil {
  3018. return nil, err
  3019. }
  3020. ret := &SavedAdStyle{
  3021. ServerResponse: googleapi.ServerResponse{
  3022. Header: res.Header,
  3023. HTTPStatusCode: res.StatusCode,
  3024. },
  3025. }
  3026. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3027. return nil, err
  3028. }
  3029. return ret, nil
  3030. // {
  3031. // "description": "List a specific saved ad style for the specified account.",
  3032. // "httpMethod": "GET",
  3033. // "id": "adsense.accounts.savedadstyles.get",
  3034. // "parameterOrder": [
  3035. // "accountId",
  3036. // "savedAdStyleId"
  3037. // ],
  3038. // "parameters": {
  3039. // "accountId": {
  3040. // "description": "Account for which to get the saved ad style.",
  3041. // "location": "path",
  3042. // "required": true,
  3043. // "type": "string"
  3044. // },
  3045. // "savedAdStyleId": {
  3046. // "description": "Saved ad style to retrieve.",
  3047. // "location": "path",
  3048. // "required": true,
  3049. // "type": "string"
  3050. // }
  3051. // },
  3052. // "path": "accounts/{accountId}/savedadstyles/{savedAdStyleId}",
  3053. // "response": {
  3054. // "$ref": "SavedAdStyle"
  3055. // },
  3056. // "scopes": [
  3057. // "https://www.googleapis.com/auth/adsense",
  3058. // "https://www.googleapis.com/auth/adsense.readonly"
  3059. // ]
  3060. // }
  3061. }
  3062. // method id "adsense.accounts.savedadstyles.list":
  3063. type AccountsSavedadstylesListCall struct {
  3064. s *Service
  3065. accountId string
  3066. urlParams_ gensupport.URLParams
  3067. ifNoneMatch_ string
  3068. ctx_ context.Context
  3069. }
  3070. // List: List all saved ad styles in the specified account.
  3071. func (r *AccountsSavedadstylesService) List(accountId string) *AccountsSavedadstylesListCall {
  3072. c := &AccountsSavedadstylesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3073. c.accountId = accountId
  3074. return c
  3075. }
  3076. // MaxResults sets the optional parameter "maxResults": The maximum
  3077. // number of saved ad styles to include in the response, used for
  3078. // paging.
  3079. func (c *AccountsSavedadstylesListCall) MaxResults(maxResults int64) *AccountsSavedadstylesListCall {
  3080. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3081. return c
  3082. }
  3083. // PageToken sets the optional parameter "pageToken": A continuation
  3084. // token, used to page through saved ad styles. To retrieve the next
  3085. // page, set this parameter to the value of "nextPageToken" from the
  3086. // previous response.
  3087. func (c *AccountsSavedadstylesListCall) PageToken(pageToken string) *AccountsSavedadstylesListCall {
  3088. c.urlParams_.Set("pageToken", pageToken)
  3089. return c
  3090. }
  3091. // Fields allows partial responses to be retrieved. See
  3092. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3093. // for more information.
  3094. func (c *AccountsSavedadstylesListCall) Fields(s ...googleapi.Field) *AccountsSavedadstylesListCall {
  3095. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3096. return c
  3097. }
  3098. // IfNoneMatch sets the optional parameter which makes the operation
  3099. // fail if the object's ETag matches the given value. This is useful for
  3100. // getting updates only after the object has changed since the last
  3101. // request. Use googleapi.IsNotModified to check whether the response
  3102. // error from Do is the result of In-None-Match.
  3103. func (c *AccountsSavedadstylesListCall) IfNoneMatch(entityTag string) *AccountsSavedadstylesListCall {
  3104. c.ifNoneMatch_ = entityTag
  3105. return c
  3106. }
  3107. // Context sets the context to be used in this call's Do method. Any
  3108. // pending HTTP request will be aborted if the provided context is
  3109. // canceled.
  3110. func (c *AccountsSavedadstylesListCall) Context(ctx context.Context) *AccountsSavedadstylesListCall {
  3111. c.ctx_ = ctx
  3112. return c
  3113. }
  3114. func (c *AccountsSavedadstylesListCall) doRequest(alt string) (*http.Response, error) {
  3115. var body io.Reader = nil
  3116. c.urlParams_.Set("alt", alt)
  3117. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/savedadstyles")
  3118. urls += "?" + c.urlParams_.Encode()
  3119. req, _ := http.NewRequest("GET", urls, body)
  3120. googleapi.Expand(req.URL, map[string]string{
  3121. "accountId": c.accountId,
  3122. })
  3123. req.Header.Set("User-Agent", c.s.userAgent())
  3124. if c.ifNoneMatch_ != "" {
  3125. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3126. }
  3127. if c.ctx_ != nil {
  3128. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3129. }
  3130. return c.s.client.Do(req)
  3131. }
  3132. // Do executes the "adsense.accounts.savedadstyles.list" call.
  3133. // Exactly one of *SavedAdStyles or error will be non-nil. Any non-2xx
  3134. // status code is an error. Response headers are in either
  3135. // *SavedAdStyles.ServerResponse.Header or (if a response was returned
  3136. // at all) in error.(*googleapi.Error).Header. Use
  3137. // googleapi.IsNotModified to check whether the returned error was
  3138. // because http.StatusNotModified was returned.
  3139. func (c *AccountsSavedadstylesListCall) Do(opts ...googleapi.CallOption) (*SavedAdStyles, error) {
  3140. gensupport.SetOptions(c.urlParams_, opts...)
  3141. res, err := c.doRequest("json")
  3142. if res != nil && res.StatusCode == http.StatusNotModified {
  3143. if res.Body != nil {
  3144. res.Body.Close()
  3145. }
  3146. return nil, &googleapi.Error{
  3147. Code: res.StatusCode,
  3148. Header: res.Header,
  3149. }
  3150. }
  3151. if err != nil {
  3152. return nil, err
  3153. }
  3154. defer googleapi.CloseBody(res)
  3155. if err := googleapi.CheckResponse(res); err != nil {
  3156. return nil, err
  3157. }
  3158. ret := &SavedAdStyles{
  3159. ServerResponse: googleapi.ServerResponse{
  3160. Header: res.Header,
  3161. HTTPStatusCode: res.StatusCode,
  3162. },
  3163. }
  3164. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3165. return nil, err
  3166. }
  3167. return ret, nil
  3168. // {
  3169. // "description": "List all saved ad styles in the specified account.",
  3170. // "httpMethod": "GET",
  3171. // "id": "adsense.accounts.savedadstyles.list",
  3172. // "parameterOrder": [
  3173. // "accountId"
  3174. // ],
  3175. // "parameters": {
  3176. // "accountId": {
  3177. // "description": "Account for which to list saved ad styles.",
  3178. // "location": "path",
  3179. // "required": true,
  3180. // "type": "string"
  3181. // },
  3182. // "maxResults": {
  3183. // "description": "The maximum number of saved ad styles to include in the response, used for paging.",
  3184. // "format": "int32",
  3185. // "location": "query",
  3186. // "maximum": "10000",
  3187. // "minimum": "0",
  3188. // "type": "integer"
  3189. // },
  3190. // "pageToken": {
  3191. // "description": "A continuation token, used to page through saved ad styles. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  3192. // "location": "query",
  3193. // "type": "string"
  3194. // }
  3195. // },
  3196. // "path": "accounts/{accountId}/savedadstyles",
  3197. // "response": {
  3198. // "$ref": "SavedAdStyles"
  3199. // },
  3200. // "scopes": [
  3201. // "https://www.googleapis.com/auth/adsense",
  3202. // "https://www.googleapis.com/auth/adsense.readonly"
  3203. // ]
  3204. // }
  3205. }
  3206. // Pages invokes f for each page of results.
  3207. // A non-nil error returned from f will halt the iteration.
  3208. // The provided context supersedes any context provided to the Context method.
  3209. func (c *AccountsSavedadstylesListCall) Pages(ctx context.Context, f func(*SavedAdStyles) error) error {
  3210. c.ctx_ = ctx
  3211. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3212. for {
  3213. x, err := c.Do()
  3214. if err != nil {
  3215. return err
  3216. }
  3217. if err := f(x); err != nil {
  3218. return err
  3219. }
  3220. if x.NextPageToken == "" {
  3221. return nil
  3222. }
  3223. c.PageToken(x.NextPageToken)
  3224. }
  3225. }
  3226. // method id "adsense.accounts.urlchannels.list":
  3227. type AccountsUrlchannelsListCall struct {
  3228. s *Service
  3229. accountId string
  3230. adClientId string
  3231. urlParams_ gensupport.URLParams
  3232. ifNoneMatch_ string
  3233. ctx_ context.Context
  3234. }
  3235. // List: List all URL channels in the specified ad client for the
  3236. // specified account.
  3237. func (r *AccountsUrlchannelsService) List(accountId string, adClientId string) *AccountsUrlchannelsListCall {
  3238. c := &AccountsUrlchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3239. c.accountId = accountId
  3240. c.adClientId = adClientId
  3241. return c
  3242. }
  3243. // MaxResults sets the optional parameter "maxResults": The maximum
  3244. // number of URL channels to include in the response, used for paging.
  3245. func (c *AccountsUrlchannelsListCall) MaxResults(maxResults int64) *AccountsUrlchannelsListCall {
  3246. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3247. return c
  3248. }
  3249. // PageToken sets the optional parameter "pageToken": A continuation
  3250. // token, used to page through URL channels. To retrieve the next page,
  3251. // set this parameter to the value of "nextPageToken" from the previous
  3252. // response.
  3253. func (c *AccountsUrlchannelsListCall) PageToken(pageToken string) *AccountsUrlchannelsListCall {
  3254. c.urlParams_.Set("pageToken", pageToken)
  3255. return c
  3256. }
  3257. // Fields allows partial responses to be retrieved. See
  3258. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3259. // for more information.
  3260. func (c *AccountsUrlchannelsListCall) Fields(s ...googleapi.Field) *AccountsUrlchannelsListCall {
  3261. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3262. return c
  3263. }
  3264. // IfNoneMatch sets the optional parameter which makes the operation
  3265. // fail if the object's ETag matches the given value. This is useful for
  3266. // getting updates only after the object has changed since the last
  3267. // request. Use googleapi.IsNotModified to check whether the response
  3268. // error from Do is the result of In-None-Match.
  3269. func (c *AccountsUrlchannelsListCall) IfNoneMatch(entityTag string) *AccountsUrlchannelsListCall {
  3270. c.ifNoneMatch_ = entityTag
  3271. return c
  3272. }
  3273. // Context sets the context to be used in this call's Do method. Any
  3274. // pending HTTP request will be aborted if the provided context is
  3275. // canceled.
  3276. func (c *AccountsUrlchannelsListCall) Context(ctx context.Context) *AccountsUrlchannelsListCall {
  3277. c.ctx_ = ctx
  3278. return c
  3279. }
  3280. func (c *AccountsUrlchannelsListCall) doRequest(alt string) (*http.Response, error) {
  3281. var body io.Reader = nil
  3282. c.urlParams_.Set("alt", alt)
  3283. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/urlchannels")
  3284. urls += "?" + c.urlParams_.Encode()
  3285. req, _ := http.NewRequest("GET", urls, body)
  3286. googleapi.Expand(req.URL, map[string]string{
  3287. "accountId": c.accountId,
  3288. "adClientId": c.adClientId,
  3289. })
  3290. req.Header.Set("User-Agent", c.s.userAgent())
  3291. if c.ifNoneMatch_ != "" {
  3292. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3293. }
  3294. if c.ctx_ != nil {
  3295. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3296. }
  3297. return c.s.client.Do(req)
  3298. }
  3299. // Do executes the "adsense.accounts.urlchannels.list" call.
  3300. // Exactly one of *UrlChannels or error will be non-nil. Any non-2xx
  3301. // status code is an error. Response headers are in either
  3302. // *UrlChannels.ServerResponse.Header or (if a response was returned at
  3303. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3304. // to check whether the returned error was because
  3305. // http.StatusNotModified was returned.
  3306. func (c *AccountsUrlchannelsListCall) Do(opts ...googleapi.CallOption) (*UrlChannels, error) {
  3307. gensupport.SetOptions(c.urlParams_, opts...)
  3308. res, err := c.doRequest("json")
  3309. if res != nil && res.StatusCode == http.StatusNotModified {
  3310. if res.Body != nil {
  3311. res.Body.Close()
  3312. }
  3313. return nil, &googleapi.Error{
  3314. Code: res.StatusCode,
  3315. Header: res.Header,
  3316. }
  3317. }
  3318. if err != nil {
  3319. return nil, err
  3320. }
  3321. defer googleapi.CloseBody(res)
  3322. if err := googleapi.CheckResponse(res); err != nil {
  3323. return nil, err
  3324. }
  3325. ret := &UrlChannels{
  3326. ServerResponse: googleapi.ServerResponse{
  3327. Header: res.Header,
  3328. HTTPStatusCode: res.StatusCode,
  3329. },
  3330. }
  3331. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3332. return nil, err
  3333. }
  3334. return ret, nil
  3335. // {
  3336. // "description": "List all URL channels in the specified ad client for the specified account.",
  3337. // "httpMethod": "GET",
  3338. // "id": "adsense.accounts.urlchannels.list",
  3339. // "parameterOrder": [
  3340. // "accountId",
  3341. // "adClientId"
  3342. // ],
  3343. // "parameters": {
  3344. // "accountId": {
  3345. // "description": "Account to which the ad client belongs.",
  3346. // "location": "path",
  3347. // "required": true,
  3348. // "type": "string"
  3349. // },
  3350. // "adClientId": {
  3351. // "description": "Ad client for which to list URL channels.",
  3352. // "location": "path",
  3353. // "required": true,
  3354. // "type": "string"
  3355. // },
  3356. // "maxResults": {
  3357. // "description": "The maximum number of URL channels to include in the response, used for paging.",
  3358. // "format": "int32",
  3359. // "location": "query",
  3360. // "maximum": "10000",
  3361. // "minimum": "0",
  3362. // "type": "integer"
  3363. // },
  3364. // "pageToken": {
  3365. // "description": "A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  3366. // "location": "query",
  3367. // "type": "string"
  3368. // }
  3369. // },
  3370. // "path": "accounts/{accountId}/adclients/{adClientId}/urlchannels",
  3371. // "response": {
  3372. // "$ref": "UrlChannels"
  3373. // },
  3374. // "scopes": [
  3375. // "https://www.googleapis.com/auth/adsense",
  3376. // "https://www.googleapis.com/auth/adsense.readonly"
  3377. // ]
  3378. // }
  3379. }
  3380. // Pages invokes f for each page of results.
  3381. // A non-nil error returned from f will halt the iteration.
  3382. // The provided context supersedes any context provided to the Context method.
  3383. func (c *AccountsUrlchannelsListCall) Pages(ctx context.Context, f func(*UrlChannels) error) error {
  3384. c.ctx_ = ctx
  3385. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3386. for {
  3387. x, err := c.Do()
  3388. if err != nil {
  3389. return err
  3390. }
  3391. if err := f(x); err != nil {
  3392. return err
  3393. }
  3394. if x.NextPageToken == "" {
  3395. return nil
  3396. }
  3397. c.PageToken(x.NextPageToken)
  3398. }
  3399. }
  3400. // method id "adsense.adclients.list":
  3401. type AdclientsListCall struct {
  3402. s *Service
  3403. urlParams_ gensupport.URLParams
  3404. ifNoneMatch_ string
  3405. ctx_ context.Context
  3406. }
  3407. // List: List all ad clients in this AdSense account.
  3408. func (r *AdclientsService) List() *AdclientsListCall {
  3409. c := &AdclientsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3410. return c
  3411. }
  3412. // MaxResults sets the optional parameter "maxResults": The maximum
  3413. // number of ad clients to include in the response, used for paging.
  3414. func (c *AdclientsListCall) MaxResults(maxResults int64) *AdclientsListCall {
  3415. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3416. return c
  3417. }
  3418. // PageToken sets the optional parameter "pageToken": A continuation
  3419. // token, used to page through ad clients. To retrieve the next page,
  3420. // set this parameter to the value of "nextPageToken" from the previous
  3421. // response.
  3422. func (c *AdclientsListCall) PageToken(pageToken string) *AdclientsListCall {
  3423. c.urlParams_.Set("pageToken", pageToken)
  3424. return c
  3425. }
  3426. // Fields allows partial responses to be retrieved. See
  3427. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3428. // for more information.
  3429. func (c *AdclientsListCall) Fields(s ...googleapi.Field) *AdclientsListCall {
  3430. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3431. return c
  3432. }
  3433. // IfNoneMatch sets the optional parameter which makes the operation
  3434. // fail if the object's ETag matches the given value. This is useful for
  3435. // getting updates only after the object has changed since the last
  3436. // request. Use googleapi.IsNotModified to check whether the response
  3437. // error from Do is the result of In-None-Match.
  3438. func (c *AdclientsListCall) IfNoneMatch(entityTag string) *AdclientsListCall {
  3439. c.ifNoneMatch_ = entityTag
  3440. return c
  3441. }
  3442. // Context sets the context to be used in this call's Do method. Any
  3443. // pending HTTP request will be aborted if the provided context is
  3444. // canceled.
  3445. func (c *AdclientsListCall) Context(ctx context.Context) *AdclientsListCall {
  3446. c.ctx_ = ctx
  3447. return c
  3448. }
  3449. func (c *AdclientsListCall) doRequest(alt string) (*http.Response, error) {
  3450. var body io.Reader = nil
  3451. c.urlParams_.Set("alt", alt)
  3452. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients")
  3453. urls += "?" + c.urlParams_.Encode()
  3454. req, _ := http.NewRequest("GET", urls, body)
  3455. googleapi.SetOpaque(req.URL)
  3456. req.Header.Set("User-Agent", c.s.userAgent())
  3457. if c.ifNoneMatch_ != "" {
  3458. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3459. }
  3460. if c.ctx_ != nil {
  3461. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3462. }
  3463. return c.s.client.Do(req)
  3464. }
  3465. // Do executes the "adsense.adclients.list" call.
  3466. // Exactly one of *AdClients or error will be non-nil. Any non-2xx
  3467. // status code is an error. Response headers are in either
  3468. // *AdClients.ServerResponse.Header or (if a response was returned at
  3469. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3470. // to check whether the returned error was because
  3471. // http.StatusNotModified was returned.
  3472. func (c *AdclientsListCall) Do(opts ...googleapi.CallOption) (*AdClients, error) {
  3473. gensupport.SetOptions(c.urlParams_, opts...)
  3474. res, err := c.doRequest("json")
  3475. if res != nil && res.StatusCode == http.StatusNotModified {
  3476. if res.Body != nil {
  3477. res.Body.Close()
  3478. }
  3479. return nil, &googleapi.Error{
  3480. Code: res.StatusCode,
  3481. Header: res.Header,
  3482. }
  3483. }
  3484. if err != nil {
  3485. return nil, err
  3486. }
  3487. defer googleapi.CloseBody(res)
  3488. if err := googleapi.CheckResponse(res); err != nil {
  3489. return nil, err
  3490. }
  3491. ret := &AdClients{
  3492. ServerResponse: googleapi.ServerResponse{
  3493. Header: res.Header,
  3494. HTTPStatusCode: res.StatusCode,
  3495. },
  3496. }
  3497. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3498. return nil, err
  3499. }
  3500. return ret, nil
  3501. // {
  3502. // "description": "List all ad clients in this AdSense account.",
  3503. // "httpMethod": "GET",
  3504. // "id": "adsense.adclients.list",
  3505. // "parameters": {
  3506. // "maxResults": {
  3507. // "description": "The maximum number of ad clients to include in the response, used for paging.",
  3508. // "format": "int32",
  3509. // "location": "query",
  3510. // "maximum": "10000",
  3511. // "minimum": "0",
  3512. // "type": "integer"
  3513. // },
  3514. // "pageToken": {
  3515. // "description": "A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  3516. // "location": "query",
  3517. // "type": "string"
  3518. // }
  3519. // },
  3520. // "path": "adclients",
  3521. // "response": {
  3522. // "$ref": "AdClients"
  3523. // },
  3524. // "scopes": [
  3525. // "https://www.googleapis.com/auth/adsense",
  3526. // "https://www.googleapis.com/auth/adsense.readonly"
  3527. // ]
  3528. // }
  3529. }
  3530. // Pages invokes f for each page of results.
  3531. // A non-nil error returned from f will halt the iteration.
  3532. // The provided context supersedes any context provided to the Context method.
  3533. func (c *AdclientsListCall) Pages(ctx context.Context, f func(*AdClients) error) error {
  3534. c.ctx_ = ctx
  3535. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3536. for {
  3537. x, err := c.Do()
  3538. if err != nil {
  3539. return err
  3540. }
  3541. if err := f(x); err != nil {
  3542. return err
  3543. }
  3544. if x.NextPageToken == "" {
  3545. return nil
  3546. }
  3547. c.PageToken(x.NextPageToken)
  3548. }
  3549. }
  3550. // method id "adsense.adunits.get":
  3551. type AdunitsGetCall struct {
  3552. s *Service
  3553. adClientId string
  3554. adUnitId string
  3555. urlParams_ gensupport.URLParams
  3556. ifNoneMatch_ string
  3557. ctx_ context.Context
  3558. }
  3559. // Get: Gets the specified ad unit in the specified ad client.
  3560. func (r *AdunitsService) Get(adClientId string, adUnitId string) *AdunitsGetCall {
  3561. c := &AdunitsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3562. c.adClientId = adClientId
  3563. c.adUnitId = adUnitId
  3564. return c
  3565. }
  3566. // Fields allows partial responses to be retrieved. See
  3567. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3568. // for more information.
  3569. func (c *AdunitsGetCall) Fields(s ...googleapi.Field) *AdunitsGetCall {
  3570. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3571. return c
  3572. }
  3573. // IfNoneMatch sets the optional parameter which makes the operation
  3574. // fail if the object's ETag matches the given value. This is useful for
  3575. // getting updates only after the object has changed since the last
  3576. // request. Use googleapi.IsNotModified to check whether the response
  3577. // error from Do is the result of In-None-Match.
  3578. func (c *AdunitsGetCall) IfNoneMatch(entityTag string) *AdunitsGetCall {
  3579. c.ifNoneMatch_ = entityTag
  3580. return c
  3581. }
  3582. // Context sets the context to be used in this call's Do method. Any
  3583. // pending HTTP request will be aborted if the provided context is
  3584. // canceled.
  3585. func (c *AdunitsGetCall) Context(ctx context.Context) *AdunitsGetCall {
  3586. c.ctx_ = ctx
  3587. return c
  3588. }
  3589. func (c *AdunitsGetCall) doRequest(alt string) (*http.Response, error) {
  3590. var body io.Reader = nil
  3591. c.urlParams_.Set("alt", alt)
  3592. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/adunits/{adUnitId}")
  3593. urls += "?" + c.urlParams_.Encode()
  3594. req, _ := http.NewRequest("GET", urls, body)
  3595. googleapi.Expand(req.URL, map[string]string{
  3596. "adClientId": c.adClientId,
  3597. "adUnitId": c.adUnitId,
  3598. })
  3599. req.Header.Set("User-Agent", c.s.userAgent())
  3600. if c.ifNoneMatch_ != "" {
  3601. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3602. }
  3603. if c.ctx_ != nil {
  3604. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3605. }
  3606. return c.s.client.Do(req)
  3607. }
  3608. // Do executes the "adsense.adunits.get" call.
  3609. // Exactly one of *AdUnit or error will be non-nil. Any non-2xx status
  3610. // code is an error. Response headers are in either
  3611. // *AdUnit.ServerResponse.Header or (if a response was returned at all)
  3612. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3613. // check whether the returned error was because http.StatusNotModified
  3614. // was returned.
  3615. func (c *AdunitsGetCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
  3616. gensupport.SetOptions(c.urlParams_, opts...)
  3617. res, err := c.doRequest("json")
  3618. if res != nil && res.StatusCode == http.StatusNotModified {
  3619. if res.Body != nil {
  3620. res.Body.Close()
  3621. }
  3622. return nil, &googleapi.Error{
  3623. Code: res.StatusCode,
  3624. Header: res.Header,
  3625. }
  3626. }
  3627. if err != nil {
  3628. return nil, err
  3629. }
  3630. defer googleapi.CloseBody(res)
  3631. if err := googleapi.CheckResponse(res); err != nil {
  3632. return nil, err
  3633. }
  3634. ret := &AdUnit{
  3635. ServerResponse: googleapi.ServerResponse{
  3636. Header: res.Header,
  3637. HTTPStatusCode: res.StatusCode,
  3638. },
  3639. }
  3640. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3641. return nil, err
  3642. }
  3643. return ret, nil
  3644. // {
  3645. // "description": "Gets the specified ad unit in the specified ad client.",
  3646. // "httpMethod": "GET",
  3647. // "id": "adsense.adunits.get",
  3648. // "parameterOrder": [
  3649. // "adClientId",
  3650. // "adUnitId"
  3651. // ],
  3652. // "parameters": {
  3653. // "adClientId": {
  3654. // "description": "Ad client for which to get the ad unit.",
  3655. // "location": "path",
  3656. // "required": true,
  3657. // "type": "string"
  3658. // },
  3659. // "adUnitId": {
  3660. // "description": "Ad unit to retrieve.",
  3661. // "location": "path",
  3662. // "required": true,
  3663. // "type": "string"
  3664. // }
  3665. // },
  3666. // "path": "adclients/{adClientId}/adunits/{adUnitId}",
  3667. // "response": {
  3668. // "$ref": "AdUnit"
  3669. // },
  3670. // "scopes": [
  3671. // "https://www.googleapis.com/auth/adsense",
  3672. // "https://www.googleapis.com/auth/adsense.readonly"
  3673. // ]
  3674. // }
  3675. }
  3676. // method id "adsense.adunits.list":
  3677. type AdunitsListCall struct {
  3678. s *Service
  3679. adClientId string
  3680. urlParams_ gensupport.URLParams
  3681. ifNoneMatch_ string
  3682. ctx_ context.Context
  3683. }
  3684. // List: List all ad units in the specified ad client for this AdSense
  3685. // account.
  3686. func (r *AdunitsService) List(adClientId string) *AdunitsListCall {
  3687. c := &AdunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3688. c.adClientId = adClientId
  3689. return c
  3690. }
  3691. // IncludeInactive sets the optional parameter "includeInactive":
  3692. // Whether to include inactive ad units. Default: true.
  3693. func (c *AdunitsListCall) IncludeInactive(includeInactive bool) *AdunitsListCall {
  3694. c.urlParams_.Set("includeInactive", fmt.Sprint(includeInactive))
  3695. return c
  3696. }
  3697. // MaxResults sets the optional parameter "maxResults": The maximum
  3698. // number of ad units to include in the response, used for paging.
  3699. func (c *AdunitsListCall) MaxResults(maxResults int64) *AdunitsListCall {
  3700. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3701. return c
  3702. }
  3703. // PageToken sets the optional parameter "pageToken": A continuation
  3704. // token, used to page through ad units. To retrieve the next page, set
  3705. // this parameter to the value of "nextPageToken" from the previous
  3706. // response.
  3707. func (c *AdunitsListCall) PageToken(pageToken string) *AdunitsListCall {
  3708. c.urlParams_.Set("pageToken", pageToken)
  3709. return c
  3710. }
  3711. // Fields allows partial responses to be retrieved. See
  3712. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3713. // for more information.
  3714. func (c *AdunitsListCall) Fields(s ...googleapi.Field) *AdunitsListCall {
  3715. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3716. return c
  3717. }
  3718. // IfNoneMatch sets the optional parameter which makes the operation
  3719. // fail if the object's ETag matches the given value. This is useful for
  3720. // getting updates only after the object has changed since the last
  3721. // request. Use googleapi.IsNotModified to check whether the response
  3722. // error from Do is the result of In-None-Match.
  3723. func (c *AdunitsListCall) IfNoneMatch(entityTag string) *AdunitsListCall {
  3724. c.ifNoneMatch_ = entityTag
  3725. return c
  3726. }
  3727. // Context sets the context to be used in this call's Do method. Any
  3728. // pending HTTP request will be aborted if the provided context is
  3729. // canceled.
  3730. func (c *AdunitsListCall) Context(ctx context.Context) *AdunitsListCall {
  3731. c.ctx_ = ctx
  3732. return c
  3733. }
  3734. func (c *AdunitsListCall) doRequest(alt string) (*http.Response, error) {
  3735. var body io.Reader = nil
  3736. c.urlParams_.Set("alt", alt)
  3737. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/adunits")
  3738. urls += "?" + c.urlParams_.Encode()
  3739. req, _ := http.NewRequest("GET", urls, body)
  3740. googleapi.Expand(req.URL, map[string]string{
  3741. "adClientId": c.adClientId,
  3742. })
  3743. req.Header.Set("User-Agent", c.s.userAgent())
  3744. if c.ifNoneMatch_ != "" {
  3745. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3746. }
  3747. if c.ctx_ != nil {
  3748. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3749. }
  3750. return c.s.client.Do(req)
  3751. }
  3752. // Do executes the "adsense.adunits.list" call.
  3753. // Exactly one of *AdUnits or error will be non-nil. Any non-2xx status
  3754. // code is an error. Response headers are in either
  3755. // *AdUnits.ServerResponse.Header or (if a response was returned at all)
  3756. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3757. // check whether the returned error was because http.StatusNotModified
  3758. // was returned.
  3759. func (c *AdunitsListCall) Do(opts ...googleapi.CallOption) (*AdUnits, error) {
  3760. gensupport.SetOptions(c.urlParams_, opts...)
  3761. res, err := c.doRequest("json")
  3762. if res != nil && res.StatusCode == http.StatusNotModified {
  3763. if res.Body != nil {
  3764. res.Body.Close()
  3765. }
  3766. return nil, &googleapi.Error{
  3767. Code: res.StatusCode,
  3768. Header: res.Header,
  3769. }
  3770. }
  3771. if err != nil {
  3772. return nil, err
  3773. }
  3774. defer googleapi.CloseBody(res)
  3775. if err := googleapi.CheckResponse(res); err != nil {
  3776. return nil, err
  3777. }
  3778. ret := &AdUnits{
  3779. ServerResponse: googleapi.ServerResponse{
  3780. Header: res.Header,
  3781. HTTPStatusCode: res.StatusCode,
  3782. },
  3783. }
  3784. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3785. return nil, err
  3786. }
  3787. return ret, nil
  3788. // {
  3789. // "description": "List all ad units in the specified ad client for this AdSense account.",
  3790. // "httpMethod": "GET",
  3791. // "id": "adsense.adunits.list",
  3792. // "parameterOrder": [
  3793. // "adClientId"
  3794. // ],
  3795. // "parameters": {
  3796. // "adClientId": {
  3797. // "description": "Ad client for which to list ad units.",
  3798. // "location": "path",
  3799. // "required": true,
  3800. // "type": "string"
  3801. // },
  3802. // "includeInactive": {
  3803. // "description": "Whether to include inactive ad units. Default: true.",
  3804. // "location": "query",
  3805. // "type": "boolean"
  3806. // },
  3807. // "maxResults": {
  3808. // "description": "The maximum number of ad units to include in the response, used for paging.",
  3809. // "format": "int32",
  3810. // "location": "query",
  3811. // "maximum": "10000",
  3812. // "minimum": "0",
  3813. // "type": "integer"
  3814. // },
  3815. // "pageToken": {
  3816. // "description": "A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  3817. // "location": "query",
  3818. // "type": "string"
  3819. // }
  3820. // },
  3821. // "path": "adclients/{adClientId}/adunits",
  3822. // "response": {
  3823. // "$ref": "AdUnits"
  3824. // },
  3825. // "scopes": [
  3826. // "https://www.googleapis.com/auth/adsense",
  3827. // "https://www.googleapis.com/auth/adsense.readonly"
  3828. // ]
  3829. // }
  3830. }
  3831. // Pages invokes f for each page of results.
  3832. // A non-nil error returned from f will halt the iteration.
  3833. // The provided context supersedes any context provided to the Context method.
  3834. func (c *AdunitsListCall) Pages(ctx context.Context, f func(*AdUnits) error) error {
  3835. c.ctx_ = ctx
  3836. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3837. for {
  3838. x, err := c.Do()
  3839. if err != nil {
  3840. return err
  3841. }
  3842. if err := f(x); err != nil {
  3843. return err
  3844. }
  3845. if x.NextPageToken == "" {
  3846. return nil
  3847. }
  3848. c.PageToken(x.NextPageToken)
  3849. }
  3850. }
  3851. // method id "adsense.adunits.customchannels.list":
  3852. type AdunitsCustomchannelsListCall struct {
  3853. s *Service
  3854. adClientId string
  3855. adUnitId string
  3856. urlParams_ gensupport.URLParams
  3857. ifNoneMatch_ string
  3858. ctx_ context.Context
  3859. }
  3860. // List: List all custom channels which the specified ad unit belongs
  3861. // to.
  3862. func (r *AdunitsCustomchannelsService) List(adClientId string, adUnitId string) *AdunitsCustomchannelsListCall {
  3863. c := &AdunitsCustomchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3864. c.adClientId = adClientId
  3865. c.adUnitId = adUnitId
  3866. return c
  3867. }
  3868. // MaxResults sets the optional parameter "maxResults": The maximum
  3869. // number of custom channels to include in the response, used for
  3870. // paging.
  3871. func (c *AdunitsCustomchannelsListCall) MaxResults(maxResults int64) *AdunitsCustomchannelsListCall {
  3872. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3873. return c
  3874. }
  3875. // PageToken sets the optional parameter "pageToken": A continuation
  3876. // token, used to page through custom channels. To retrieve the next
  3877. // page, set this parameter to the value of "nextPageToken" from the
  3878. // previous response.
  3879. func (c *AdunitsCustomchannelsListCall) PageToken(pageToken string) *AdunitsCustomchannelsListCall {
  3880. c.urlParams_.Set("pageToken", pageToken)
  3881. return c
  3882. }
  3883. // Fields allows partial responses to be retrieved. See
  3884. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3885. // for more information.
  3886. func (c *AdunitsCustomchannelsListCall) Fields(s ...googleapi.Field) *AdunitsCustomchannelsListCall {
  3887. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3888. return c
  3889. }
  3890. // IfNoneMatch sets the optional parameter which makes the operation
  3891. // fail if the object's ETag matches the given value. This is useful for
  3892. // getting updates only after the object has changed since the last
  3893. // request. Use googleapi.IsNotModified to check whether the response
  3894. // error from Do is the result of In-None-Match.
  3895. func (c *AdunitsCustomchannelsListCall) IfNoneMatch(entityTag string) *AdunitsCustomchannelsListCall {
  3896. c.ifNoneMatch_ = entityTag
  3897. return c
  3898. }
  3899. // Context sets the context to be used in this call's Do method. Any
  3900. // pending HTTP request will be aborted if the provided context is
  3901. // canceled.
  3902. func (c *AdunitsCustomchannelsListCall) Context(ctx context.Context) *AdunitsCustomchannelsListCall {
  3903. c.ctx_ = ctx
  3904. return c
  3905. }
  3906. func (c *AdunitsCustomchannelsListCall) doRequest(alt string) (*http.Response, error) {
  3907. var body io.Reader = nil
  3908. c.urlParams_.Set("alt", alt)
  3909. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/adunits/{adUnitId}/customchannels")
  3910. urls += "?" + c.urlParams_.Encode()
  3911. req, _ := http.NewRequest("GET", urls, body)
  3912. googleapi.Expand(req.URL, map[string]string{
  3913. "adClientId": c.adClientId,
  3914. "adUnitId": c.adUnitId,
  3915. })
  3916. req.Header.Set("User-Agent", c.s.userAgent())
  3917. if c.ifNoneMatch_ != "" {
  3918. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3919. }
  3920. if c.ctx_ != nil {
  3921. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3922. }
  3923. return c.s.client.Do(req)
  3924. }
  3925. // Do executes the "adsense.adunits.customchannels.list" call.
  3926. // Exactly one of *CustomChannels or error will be non-nil. Any non-2xx
  3927. // status code is an error. Response headers are in either
  3928. // *CustomChannels.ServerResponse.Header or (if a response was returned
  3929. // at all) in error.(*googleapi.Error).Header. Use
  3930. // googleapi.IsNotModified to check whether the returned error was
  3931. // because http.StatusNotModified was returned.
  3932. func (c *AdunitsCustomchannelsListCall) Do(opts ...googleapi.CallOption) (*CustomChannels, error) {
  3933. gensupport.SetOptions(c.urlParams_, opts...)
  3934. res, err := c.doRequest("json")
  3935. if res != nil && res.StatusCode == http.StatusNotModified {
  3936. if res.Body != nil {
  3937. res.Body.Close()
  3938. }
  3939. return nil, &googleapi.Error{
  3940. Code: res.StatusCode,
  3941. Header: res.Header,
  3942. }
  3943. }
  3944. if err != nil {
  3945. return nil, err
  3946. }
  3947. defer googleapi.CloseBody(res)
  3948. if err := googleapi.CheckResponse(res); err != nil {
  3949. return nil, err
  3950. }
  3951. ret := &CustomChannels{
  3952. ServerResponse: googleapi.ServerResponse{
  3953. Header: res.Header,
  3954. HTTPStatusCode: res.StatusCode,
  3955. },
  3956. }
  3957. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3958. return nil, err
  3959. }
  3960. return ret, nil
  3961. // {
  3962. // "description": "List all custom channels which the specified ad unit belongs to.",
  3963. // "httpMethod": "GET",
  3964. // "id": "adsense.adunits.customchannels.list",
  3965. // "parameterOrder": [
  3966. // "adClientId",
  3967. // "adUnitId"
  3968. // ],
  3969. // "parameters": {
  3970. // "adClientId": {
  3971. // "description": "Ad client which contains the ad unit.",
  3972. // "location": "path",
  3973. // "required": true,
  3974. // "type": "string"
  3975. // },
  3976. // "adUnitId": {
  3977. // "description": "Ad unit for which to list custom channels.",
  3978. // "location": "path",
  3979. // "required": true,
  3980. // "type": "string"
  3981. // },
  3982. // "maxResults": {
  3983. // "description": "The maximum number of custom channels to include in the response, used for paging.",
  3984. // "format": "int32",
  3985. // "location": "query",
  3986. // "maximum": "10000",
  3987. // "minimum": "0",
  3988. // "type": "integer"
  3989. // },
  3990. // "pageToken": {
  3991. // "description": "A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  3992. // "location": "query",
  3993. // "type": "string"
  3994. // }
  3995. // },
  3996. // "path": "adclients/{adClientId}/adunits/{adUnitId}/customchannels",
  3997. // "response": {
  3998. // "$ref": "CustomChannels"
  3999. // },
  4000. // "scopes": [
  4001. // "https://www.googleapis.com/auth/adsense",
  4002. // "https://www.googleapis.com/auth/adsense.readonly"
  4003. // ]
  4004. // }
  4005. }
  4006. // Pages invokes f for each page of results.
  4007. // A non-nil error returned from f will halt the iteration.
  4008. // The provided context supersedes any context provided to the Context method.
  4009. func (c *AdunitsCustomchannelsListCall) Pages(ctx context.Context, f func(*CustomChannels) error) error {
  4010. c.ctx_ = ctx
  4011. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4012. for {
  4013. x, err := c.Do()
  4014. if err != nil {
  4015. return err
  4016. }
  4017. if err := f(x); err != nil {
  4018. return err
  4019. }
  4020. if x.NextPageToken == "" {
  4021. return nil
  4022. }
  4023. c.PageToken(x.NextPageToken)
  4024. }
  4025. }
  4026. // method id "adsense.customchannels.get":
  4027. type CustomchannelsGetCall struct {
  4028. s *Service
  4029. adClientId string
  4030. customChannelId string
  4031. urlParams_ gensupport.URLParams
  4032. ifNoneMatch_ string
  4033. ctx_ context.Context
  4034. }
  4035. // Get: Get the specified custom channel from the specified ad client.
  4036. func (r *CustomchannelsService) Get(adClientId string, customChannelId string) *CustomchannelsGetCall {
  4037. c := &CustomchannelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4038. c.adClientId = adClientId
  4039. c.customChannelId = customChannelId
  4040. return c
  4041. }
  4042. // Fields allows partial responses to be retrieved. See
  4043. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4044. // for more information.
  4045. func (c *CustomchannelsGetCall) Fields(s ...googleapi.Field) *CustomchannelsGetCall {
  4046. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4047. return c
  4048. }
  4049. // IfNoneMatch sets the optional parameter which makes the operation
  4050. // fail if the object's ETag matches the given value. This is useful for
  4051. // getting updates only after the object has changed since the last
  4052. // request. Use googleapi.IsNotModified to check whether the response
  4053. // error from Do is the result of In-None-Match.
  4054. func (c *CustomchannelsGetCall) IfNoneMatch(entityTag string) *CustomchannelsGetCall {
  4055. c.ifNoneMatch_ = entityTag
  4056. return c
  4057. }
  4058. // Context sets the context to be used in this call's Do method. Any
  4059. // pending HTTP request will be aborted if the provided context is
  4060. // canceled.
  4061. func (c *CustomchannelsGetCall) Context(ctx context.Context) *CustomchannelsGetCall {
  4062. c.ctx_ = ctx
  4063. return c
  4064. }
  4065. func (c *CustomchannelsGetCall) doRequest(alt string) (*http.Response, error) {
  4066. var body io.Reader = nil
  4067. c.urlParams_.Set("alt", alt)
  4068. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels/{customChannelId}")
  4069. urls += "?" + c.urlParams_.Encode()
  4070. req, _ := http.NewRequest("GET", urls, body)
  4071. googleapi.Expand(req.URL, map[string]string{
  4072. "adClientId": c.adClientId,
  4073. "customChannelId": c.customChannelId,
  4074. })
  4075. req.Header.Set("User-Agent", c.s.userAgent())
  4076. if c.ifNoneMatch_ != "" {
  4077. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4078. }
  4079. if c.ctx_ != nil {
  4080. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4081. }
  4082. return c.s.client.Do(req)
  4083. }
  4084. // Do executes the "adsense.customchannels.get" call.
  4085. // Exactly one of *CustomChannel or error will be non-nil. Any non-2xx
  4086. // status code is an error. Response headers are in either
  4087. // *CustomChannel.ServerResponse.Header or (if a response was returned
  4088. // at all) in error.(*googleapi.Error).Header. Use
  4089. // googleapi.IsNotModified to check whether the returned error was
  4090. // because http.StatusNotModified was returned.
  4091. func (c *CustomchannelsGetCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
  4092. gensupport.SetOptions(c.urlParams_, opts...)
  4093. res, err := c.doRequest("json")
  4094. if res != nil && res.StatusCode == http.StatusNotModified {
  4095. if res.Body != nil {
  4096. res.Body.Close()
  4097. }
  4098. return nil, &googleapi.Error{
  4099. Code: res.StatusCode,
  4100. Header: res.Header,
  4101. }
  4102. }
  4103. if err != nil {
  4104. return nil, err
  4105. }
  4106. defer googleapi.CloseBody(res)
  4107. if err := googleapi.CheckResponse(res); err != nil {
  4108. return nil, err
  4109. }
  4110. ret := &CustomChannel{
  4111. ServerResponse: googleapi.ServerResponse{
  4112. Header: res.Header,
  4113. HTTPStatusCode: res.StatusCode,
  4114. },
  4115. }
  4116. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4117. return nil, err
  4118. }
  4119. return ret, nil
  4120. // {
  4121. // "description": "Get the specified custom channel from the specified ad client.",
  4122. // "httpMethod": "GET",
  4123. // "id": "adsense.customchannels.get",
  4124. // "parameterOrder": [
  4125. // "adClientId",
  4126. // "customChannelId"
  4127. // ],
  4128. // "parameters": {
  4129. // "adClientId": {
  4130. // "description": "Ad client which contains the custom channel.",
  4131. // "location": "path",
  4132. // "required": true,
  4133. // "type": "string"
  4134. // },
  4135. // "customChannelId": {
  4136. // "description": "Custom channel to retrieve.",
  4137. // "location": "path",
  4138. // "required": true,
  4139. // "type": "string"
  4140. // }
  4141. // },
  4142. // "path": "adclients/{adClientId}/customchannels/{customChannelId}",
  4143. // "response": {
  4144. // "$ref": "CustomChannel"
  4145. // },
  4146. // "scopes": [
  4147. // "https://www.googleapis.com/auth/adsense",
  4148. // "https://www.googleapis.com/auth/adsense.readonly"
  4149. // ]
  4150. // }
  4151. }
  4152. // method id "adsense.customchannels.list":
  4153. type CustomchannelsListCall struct {
  4154. s *Service
  4155. adClientId string
  4156. urlParams_ gensupport.URLParams
  4157. ifNoneMatch_ string
  4158. ctx_ context.Context
  4159. }
  4160. // List: List all custom channels in the specified ad client for this
  4161. // AdSense account.
  4162. func (r *CustomchannelsService) List(adClientId string) *CustomchannelsListCall {
  4163. c := &CustomchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4164. c.adClientId = adClientId
  4165. return c
  4166. }
  4167. // MaxResults sets the optional parameter "maxResults": The maximum
  4168. // number of custom channels to include in the response, used for
  4169. // paging.
  4170. func (c *CustomchannelsListCall) MaxResults(maxResults int64) *CustomchannelsListCall {
  4171. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4172. return c
  4173. }
  4174. // PageToken sets the optional parameter "pageToken": A continuation
  4175. // token, used to page through custom channels. To retrieve the next
  4176. // page, set this parameter to the value of "nextPageToken" from the
  4177. // previous response.
  4178. func (c *CustomchannelsListCall) PageToken(pageToken string) *CustomchannelsListCall {
  4179. c.urlParams_.Set("pageToken", pageToken)
  4180. return c
  4181. }
  4182. // Fields allows partial responses to be retrieved. See
  4183. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4184. // for more information.
  4185. func (c *CustomchannelsListCall) Fields(s ...googleapi.Field) *CustomchannelsListCall {
  4186. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4187. return c
  4188. }
  4189. // IfNoneMatch sets the optional parameter which makes the operation
  4190. // fail if the object's ETag matches the given value. This is useful for
  4191. // getting updates only after the object has changed since the last
  4192. // request. Use googleapi.IsNotModified to check whether the response
  4193. // error from Do is the result of In-None-Match.
  4194. func (c *CustomchannelsListCall) IfNoneMatch(entityTag string) *CustomchannelsListCall {
  4195. c.ifNoneMatch_ = entityTag
  4196. return c
  4197. }
  4198. // Context sets the context to be used in this call's Do method. Any
  4199. // pending HTTP request will be aborted if the provided context is
  4200. // canceled.
  4201. func (c *CustomchannelsListCall) Context(ctx context.Context) *CustomchannelsListCall {
  4202. c.ctx_ = ctx
  4203. return c
  4204. }
  4205. func (c *CustomchannelsListCall) doRequest(alt string) (*http.Response, error) {
  4206. var body io.Reader = nil
  4207. c.urlParams_.Set("alt", alt)
  4208. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels")
  4209. urls += "?" + c.urlParams_.Encode()
  4210. req, _ := http.NewRequest("GET", urls, body)
  4211. googleapi.Expand(req.URL, map[string]string{
  4212. "adClientId": c.adClientId,
  4213. })
  4214. req.Header.Set("User-Agent", c.s.userAgent())
  4215. if c.ifNoneMatch_ != "" {
  4216. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4217. }
  4218. if c.ctx_ != nil {
  4219. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4220. }
  4221. return c.s.client.Do(req)
  4222. }
  4223. // Do executes the "adsense.customchannels.list" call.
  4224. // Exactly one of *CustomChannels or error will be non-nil. Any non-2xx
  4225. // status code is an error. Response headers are in either
  4226. // *CustomChannels.ServerResponse.Header or (if a response was returned
  4227. // at all) in error.(*googleapi.Error).Header. Use
  4228. // googleapi.IsNotModified to check whether the returned error was
  4229. // because http.StatusNotModified was returned.
  4230. func (c *CustomchannelsListCall) Do(opts ...googleapi.CallOption) (*CustomChannels, error) {
  4231. gensupport.SetOptions(c.urlParams_, opts...)
  4232. res, err := c.doRequest("json")
  4233. if res != nil && res.StatusCode == http.StatusNotModified {
  4234. if res.Body != nil {
  4235. res.Body.Close()
  4236. }
  4237. return nil, &googleapi.Error{
  4238. Code: res.StatusCode,
  4239. Header: res.Header,
  4240. }
  4241. }
  4242. if err != nil {
  4243. return nil, err
  4244. }
  4245. defer googleapi.CloseBody(res)
  4246. if err := googleapi.CheckResponse(res); err != nil {
  4247. return nil, err
  4248. }
  4249. ret := &CustomChannels{
  4250. ServerResponse: googleapi.ServerResponse{
  4251. Header: res.Header,
  4252. HTTPStatusCode: res.StatusCode,
  4253. },
  4254. }
  4255. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4256. return nil, err
  4257. }
  4258. return ret, nil
  4259. // {
  4260. // "description": "List all custom channels in the specified ad client for this AdSense account.",
  4261. // "httpMethod": "GET",
  4262. // "id": "adsense.customchannels.list",
  4263. // "parameterOrder": [
  4264. // "adClientId"
  4265. // ],
  4266. // "parameters": {
  4267. // "adClientId": {
  4268. // "description": "Ad client for which to list custom channels.",
  4269. // "location": "path",
  4270. // "required": true,
  4271. // "type": "string"
  4272. // },
  4273. // "maxResults": {
  4274. // "description": "The maximum number of custom channels to include in the response, used for paging.",
  4275. // "format": "int32",
  4276. // "location": "query",
  4277. // "maximum": "10000",
  4278. // "minimum": "0",
  4279. // "type": "integer"
  4280. // },
  4281. // "pageToken": {
  4282. // "description": "A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  4283. // "location": "query",
  4284. // "type": "string"
  4285. // }
  4286. // },
  4287. // "path": "adclients/{adClientId}/customchannels",
  4288. // "response": {
  4289. // "$ref": "CustomChannels"
  4290. // },
  4291. // "scopes": [
  4292. // "https://www.googleapis.com/auth/adsense",
  4293. // "https://www.googleapis.com/auth/adsense.readonly"
  4294. // ]
  4295. // }
  4296. }
  4297. // Pages invokes f for each page of results.
  4298. // A non-nil error returned from f will halt the iteration.
  4299. // The provided context supersedes any context provided to the Context method.
  4300. func (c *CustomchannelsListCall) Pages(ctx context.Context, f func(*CustomChannels) error) error {
  4301. c.ctx_ = ctx
  4302. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4303. for {
  4304. x, err := c.Do()
  4305. if err != nil {
  4306. return err
  4307. }
  4308. if err := f(x); err != nil {
  4309. return err
  4310. }
  4311. if x.NextPageToken == "" {
  4312. return nil
  4313. }
  4314. c.PageToken(x.NextPageToken)
  4315. }
  4316. }
  4317. // method id "adsense.customchannels.adunits.list":
  4318. type CustomchannelsAdunitsListCall struct {
  4319. s *Service
  4320. adClientId string
  4321. customChannelId string
  4322. urlParams_ gensupport.URLParams
  4323. ifNoneMatch_ string
  4324. ctx_ context.Context
  4325. }
  4326. // List: List all ad units in the specified custom channel.
  4327. func (r *CustomchannelsAdunitsService) List(adClientId string, customChannelId string) *CustomchannelsAdunitsListCall {
  4328. c := &CustomchannelsAdunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4329. c.adClientId = adClientId
  4330. c.customChannelId = customChannelId
  4331. return c
  4332. }
  4333. // IncludeInactive sets the optional parameter "includeInactive":
  4334. // Whether to include inactive ad units. Default: true.
  4335. func (c *CustomchannelsAdunitsListCall) IncludeInactive(includeInactive bool) *CustomchannelsAdunitsListCall {
  4336. c.urlParams_.Set("includeInactive", fmt.Sprint(includeInactive))
  4337. return c
  4338. }
  4339. // MaxResults sets the optional parameter "maxResults": The maximum
  4340. // number of ad units to include in the response, used for paging.
  4341. func (c *CustomchannelsAdunitsListCall) MaxResults(maxResults int64) *CustomchannelsAdunitsListCall {
  4342. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4343. return c
  4344. }
  4345. // PageToken sets the optional parameter "pageToken": A continuation
  4346. // token, used to page through ad units. To retrieve the next page, set
  4347. // this parameter to the value of "nextPageToken" from the previous
  4348. // response.
  4349. func (c *CustomchannelsAdunitsListCall) PageToken(pageToken string) *CustomchannelsAdunitsListCall {
  4350. c.urlParams_.Set("pageToken", pageToken)
  4351. return c
  4352. }
  4353. // Fields allows partial responses to be retrieved. See
  4354. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4355. // for more information.
  4356. func (c *CustomchannelsAdunitsListCall) Fields(s ...googleapi.Field) *CustomchannelsAdunitsListCall {
  4357. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4358. return c
  4359. }
  4360. // IfNoneMatch sets the optional parameter which makes the operation
  4361. // fail if the object's ETag matches the given value. This is useful for
  4362. // getting updates only after the object has changed since the last
  4363. // request. Use googleapi.IsNotModified to check whether the response
  4364. // error from Do is the result of In-None-Match.
  4365. func (c *CustomchannelsAdunitsListCall) IfNoneMatch(entityTag string) *CustomchannelsAdunitsListCall {
  4366. c.ifNoneMatch_ = entityTag
  4367. return c
  4368. }
  4369. // Context sets the context to be used in this call's Do method. Any
  4370. // pending HTTP request will be aborted if the provided context is
  4371. // canceled.
  4372. func (c *CustomchannelsAdunitsListCall) Context(ctx context.Context) *CustomchannelsAdunitsListCall {
  4373. c.ctx_ = ctx
  4374. return c
  4375. }
  4376. func (c *CustomchannelsAdunitsListCall) doRequest(alt string) (*http.Response, error) {
  4377. var body io.Reader = nil
  4378. c.urlParams_.Set("alt", alt)
  4379. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels/{customChannelId}/adunits")
  4380. urls += "?" + c.urlParams_.Encode()
  4381. req, _ := http.NewRequest("GET", urls, body)
  4382. googleapi.Expand(req.URL, map[string]string{
  4383. "adClientId": c.adClientId,
  4384. "customChannelId": c.customChannelId,
  4385. })
  4386. req.Header.Set("User-Agent", c.s.userAgent())
  4387. if c.ifNoneMatch_ != "" {
  4388. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4389. }
  4390. if c.ctx_ != nil {
  4391. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4392. }
  4393. return c.s.client.Do(req)
  4394. }
  4395. // Do executes the "adsense.customchannels.adunits.list" call.
  4396. // Exactly one of *AdUnits or error will be non-nil. Any non-2xx status
  4397. // code is an error. Response headers are in either
  4398. // *AdUnits.ServerResponse.Header or (if a response was returned at all)
  4399. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4400. // check whether the returned error was because http.StatusNotModified
  4401. // was returned.
  4402. func (c *CustomchannelsAdunitsListCall) Do(opts ...googleapi.CallOption) (*AdUnits, error) {
  4403. gensupport.SetOptions(c.urlParams_, opts...)
  4404. res, err := c.doRequest("json")
  4405. if res != nil && res.StatusCode == http.StatusNotModified {
  4406. if res.Body != nil {
  4407. res.Body.Close()
  4408. }
  4409. return nil, &googleapi.Error{
  4410. Code: res.StatusCode,
  4411. Header: res.Header,
  4412. }
  4413. }
  4414. if err != nil {
  4415. return nil, err
  4416. }
  4417. defer googleapi.CloseBody(res)
  4418. if err := googleapi.CheckResponse(res); err != nil {
  4419. return nil, err
  4420. }
  4421. ret := &AdUnits{
  4422. ServerResponse: googleapi.ServerResponse{
  4423. Header: res.Header,
  4424. HTTPStatusCode: res.StatusCode,
  4425. },
  4426. }
  4427. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4428. return nil, err
  4429. }
  4430. return ret, nil
  4431. // {
  4432. // "description": "List all ad units in the specified custom channel.",
  4433. // "httpMethod": "GET",
  4434. // "id": "adsense.customchannels.adunits.list",
  4435. // "parameterOrder": [
  4436. // "adClientId",
  4437. // "customChannelId"
  4438. // ],
  4439. // "parameters": {
  4440. // "adClientId": {
  4441. // "description": "Ad client which contains the custom channel.",
  4442. // "location": "path",
  4443. // "required": true,
  4444. // "type": "string"
  4445. // },
  4446. // "customChannelId": {
  4447. // "description": "Custom channel for which to list ad units.",
  4448. // "location": "path",
  4449. // "required": true,
  4450. // "type": "string"
  4451. // },
  4452. // "includeInactive": {
  4453. // "description": "Whether to include inactive ad units. Default: true.",
  4454. // "location": "query",
  4455. // "type": "boolean"
  4456. // },
  4457. // "maxResults": {
  4458. // "description": "The maximum number of ad units to include in the response, used for paging.",
  4459. // "format": "int32",
  4460. // "location": "query",
  4461. // "maximum": "10000",
  4462. // "minimum": "0",
  4463. // "type": "integer"
  4464. // },
  4465. // "pageToken": {
  4466. // "description": "A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  4467. // "location": "query",
  4468. // "type": "string"
  4469. // }
  4470. // },
  4471. // "path": "adclients/{adClientId}/customchannels/{customChannelId}/adunits",
  4472. // "response": {
  4473. // "$ref": "AdUnits"
  4474. // },
  4475. // "scopes": [
  4476. // "https://www.googleapis.com/auth/adsense",
  4477. // "https://www.googleapis.com/auth/adsense.readonly"
  4478. // ]
  4479. // }
  4480. }
  4481. // Pages invokes f for each page of results.
  4482. // A non-nil error returned from f will halt the iteration.
  4483. // The provided context supersedes any context provided to the Context method.
  4484. func (c *CustomchannelsAdunitsListCall) Pages(ctx context.Context, f func(*AdUnits) error) error {
  4485. c.ctx_ = ctx
  4486. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4487. for {
  4488. x, err := c.Do()
  4489. if err != nil {
  4490. return err
  4491. }
  4492. if err := f(x); err != nil {
  4493. return err
  4494. }
  4495. if x.NextPageToken == "" {
  4496. return nil
  4497. }
  4498. c.PageToken(x.NextPageToken)
  4499. }
  4500. }
  4501. // method id "adsense.reports.generate":
  4502. type ReportsGenerateCall struct {
  4503. s *Service
  4504. urlParams_ gensupport.URLParams
  4505. ifNoneMatch_ string
  4506. ctx_ context.Context
  4507. }
  4508. // Generate: Generate an AdSense report based on the report request sent
  4509. // in the query parameters. Returns the result as JSON; to retrieve
  4510. // output in CSV format specify "alt=csv" as a query parameter.
  4511. func (r *ReportsService) Generate(startDate string, endDate string) *ReportsGenerateCall {
  4512. c := &ReportsGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4513. c.urlParams_.Set("startDate", startDate)
  4514. c.urlParams_.Set("endDate", endDate)
  4515. return c
  4516. }
  4517. // AccountId sets the optional parameter "accountId": Accounts upon
  4518. // which to report.
  4519. func (c *ReportsGenerateCall) AccountId(accountId ...string) *ReportsGenerateCall {
  4520. c.urlParams_.SetMulti("accountId", append([]string{}, accountId...))
  4521. return c
  4522. }
  4523. // Currency sets the optional parameter "currency": Optional currency to
  4524. // use when reporting on monetary metrics. Defaults to the account's
  4525. // currency if not set.
  4526. func (c *ReportsGenerateCall) Currency(currency string) *ReportsGenerateCall {
  4527. c.urlParams_.Set("currency", currency)
  4528. return c
  4529. }
  4530. // Dimension sets the optional parameter "dimension": Dimensions to base
  4531. // the report on.
  4532. func (c *ReportsGenerateCall) Dimension(dimension ...string) *ReportsGenerateCall {
  4533. c.urlParams_.SetMulti("dimension", append([]string{}, dimension...))
  4534. return c
  4535. }
  4536. // Filter sets the optional parameter "filter": Filters to be run on the
  4537. // report.
  4538. func (c *ReportsGenerateCall) Filter(filter ...string) *ReportsGenerateCall {
  4539. c.urlParams_.SetMulti("filter", append([]string{}, filter...))
  4540. return c
  4541. }
  4542. // Locale sets the optional parameter "locale": Optional locale to use
  4543. // for translating report output to a local language. Defaults to
  4544. // "en_US" if not specified.
  4545. func (c *ReportsGenerateCall) Locale(locale string) *ReportsGenerateCall {
  4546. c.urlParams_.Set("locale", locale)
  4547. return c
  4548. }
  4549. // MaxResults sets the optional parameter "maxResults": The maximum
  4550. // number of rows of report data to return.
  4551. func (c *ReportsGenerateCall) MaxResults(maxResults int64) *ReportsGenerateCall {
  4552. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4553. return c
  4554. }
  4555. // Metric sets the optional parameter "metric": Numeric columns to
  4556. // include in the report.
  4557. func (c *ReportsGenerateCall) Metric(metric ...string) *ReportsGenerateCall {
  4558. c.urlParams_.SetMulti("metric", append([]string{}, metric...))
  4559. return c
  4560. }
  4561. // Sort sets the optional parameter "sort": The name of a dimension or
  4562. // metric to sort the resulting report on, optionally prefixed with "+"
  4563. // to sort ascending or "-" to sort descending. If no prefix is
  4564. // specified, the column is sorted ascending.
  4565. func (c *ReportsGenerateCall) Sort(sort ...string) *ReportsGenerateCall {
  4566. c.urlParams_.SetMulti("sort", append([]string{}, sort...))
  4567. return c
  4568. }
  4569. // StartIndex sets the optional parameter "startIndex": Index of the
  4570. // first row of report data to return.
  4571. func (c *ReportsGenerateCall) StartIndex(startIndex int64) *ReportsGenerateCall {
  4572. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  4573. return c
  4574. }
  4575. // Fields allows partial responses to be retrieved. See
  4576. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4577. // for more information.
  4578. func (c *ReportsGenerateCall) Fields(s ...googleapi.Field) *ReportsGenerateCall {
  4579. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4580. return c
  4581. }
  4582. // IfNoneMatch sets the optional parameter which makes the operation
  4583. // fail if the object's ETag matches the given value. This is useful for
  4584. // getting updates only after the object has changed since the last
  4585. // request. Use googleapi.IsNotModified to check whether the response
  4586. // error from Do is the result of In-None-Match.
  4587. func (c *ReportsGenerateCall) IfNoneMatch(entityTag string) *ReportsGenerateCall {
  4588. c.ifNoneMatch_ = entityTag
  4589. return c
  4590. }
  4591. // Context sets the context to be used in this call's Do and Download
  4592. // methods. Any pending HTTP request will be aborted if the provided
  4593. // context is canceled.
  4594. func (c *ReportsGenerateCall) Context(ctx context.Context) *ReportsGenerateCall {
  4595. c.ctx_ = ctx
  4596. return c
  4597. }
  4598. func (c *ReportsGenerateCall) doRequest(alt string) (*http.Response, error) {
  4599. var body io.Reader = nil
  4600. c.urlParams_.Set("alt", alt)
  4601. urls := googleapi.ResolveRelative(c.s.BasePath, "reports")
  4602. urls += "?" + c.urlParams_.Encode()
  4603. req, _ := http.NewRequest("GET", urls, body)
  4604. googleapi.SetOpaque(req.URL)
  4605. req.Header.Set("User-Agent", c.s.userAgent())
  4606. if c.ifNoneMatch_ != "" {
  4607. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4608. }
  4609. if c.ctx_ != nil {
  4610. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4611. }
  4612. return c.s.client.Do(req)
  4613. }
  4614. // Download fetches the API endpoint's "media" value, instead of the normal
  4615. // API response value. If the returned error is nil, the Response is guaranteed to
  4616. // have a 2xx status code. Callers must close the Response.Body as usual.
  4617. func (c *ReportsGenerateCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  4618. gensupport.SetOptions(c.urlParams_, opts...)
  4619. res, err := c.doRequest("media")
  4620. if err != nil {
  4621. return nil, err
  4622. }
  4623. if err := googleapi.CheckMediaResponse(res); err != nil {
  4624. res.Body.Close()
  4625. return nil, err
  4626. }
  4627. return res, nil
  4628. }
  4629. // Do executes the "adsense.reports.generate" call.
  4630. // Exactly one of *AdsenseReportsGenerateResponse or error will be
  4631. // non-nil. Any non-2xx status code is an error. Response headers are in
  4632. // either *AdsenseReportsGenerateResponse.ServerResponse.Header or (if a
  4633. // response was returned at all) in error.(*googleapi.Error).Header. Use
  4634. // googleapi.IsNotModified to check whether the returned error was
  4635. // because http.StatusNotModified was returned.
  4636. func (c *ReportsGenerateCall) Do(opts ...googleapi.CallOption) (*AdsenseReportsGenerateResponse, error) {
  4637. gensupport.SetOptions(c.urlParams_, opts...)
  4638. res, err := c.doRequest("json")
  4639. if res != nil && res.StatusCode == http.StatusNotModified {
  4640. if res.Body != nil {
  4641. res.Body.Close()
  4642. }
  4643. return nil, &googleapi.Error{
  4644. Code: res.StatusCode,
  4645. Header: res.Header,
  4646. }
  4647. }
  4648. if err != nil {
  4649. return nil, err
  4650. }
  4651. defer googleapi.CloseBody(res)
  4652. if err := googleapi.CheckResponse(res); err != nil {
  4653. return nil, err
  4654. }
  4655. ret := &AdsenseReportsGenerateResponse{
  4656. ServerResponse: googleapi.ServerResponse{
  4657. Header: res.Header,
  4658. HTTPStatusCode: res.StatusCode,
  4659. },
  4660. }
  4661. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4662. return nil, err
  4663. }
  4664. return ret, nil
  4665. // {
  4666. // "description": "Generate an AdSense report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify \"alt=csv\" as a query parameter.",
  4667. // "httpMethod": "GET",
  4668. // "id": "adsense.reports.generate",
  4669. // "parameterOrder": [
  4670. // "startDate",
  4671. // "endDate"
  4672. // ],
  4673. // "parameters": {
  4674. // "accountId": {
  4675. // "description": "Accounts upon which to report.",
  4676. // "location": "query",
  4677. // "repeated": true,
  4678. // "type": "string"
  4679. // },
  4680. // "currency": {
  4681. // "description": "Optional currency to use when reporting on monetary metrics. Defaults to the account's currency if not set.",
  4682. // "location": "query",
  4683. // "pattern": "[a-zA-Z]+",
  4684. // "type": "string"
  4685. // },
  4686. // "dimension": {
  4687. // "description": "Dimensions to base the report on.",
  4688. // "location": "query",
  4689. // "pattern": "[a-zA-Z_]+",
  4690. // "repeated": true,
  4691. // "type": "string"
  4692. // },
  4693. // "endDate": {
  4694. // "description": "End of the date range to report on in \"YYYY-MM-DD\" format, inclusive.",
  4695. // "location": "query",
  4696. // "pattern": "\\d{4}-\\d{2}-\\d{2}|(today|startOfMonth|startOfYear)(([\\-\\+]\\d+[dwmy]){0,3}?)",
  4697. // "required": true,
  4698. // "type": "string"
  4699. // },
  4700. // "filter": {
  4701. // "description": "Filters to be run on the report.",
  4702. // "location": "query",
  4703. // "pattern": "[a-zA-Z_]+(==|=@).+",
  4704. // "repeated": true,
  4705. // "type": "string"
  4706. // },
  4707. // "locale": {
  4708. // "description": "Optional locale to use for translating report output to a local language. Defaults to \"en_US\" if not specified.",
  4709. // "location": "query",
  4710. // "pattern": "[a-zA-Z_]+",
  4711. // "type": "string"
  4712. // },
  4713. // "maxResults": {
  4714. // "description": "The maximum number of rows of report data to return.",
  4715. // "format": "int32",
  4716. // "location": "query",
  4717. // "maximum": "50000",
  4718. // "minimum": "0",
  4719. // "type": "integer"
  4720. // },
  4721. // "metric": {
  4722. // "description": "Numeric columns to include in the report.",
  4723. // "location": "query",
  4724. // "pattern": "[a-zA-Z_]+",
  4725. // "repeated": true,
  4726. // "type": "string"
  4727. // },
  4728. // "sort": {
  4729. // "description": "The name of a dimension or metric to sort the resulting report on, optionally prefixed with \"+\" to sort ascending or \"-\" to sort descending. If no prefix is specified, the column is sorted ascending.",
  4730. // "location": "query",
  4731. // "pattern": "(\\+|-)?[a-zA-Z_]+",
  4732. // "repeated": true,
  4733. // "type": "string"
  4734. // },
  4735. // "startDate": {
  4736. // "description": "Start of the date range to report on in \"YYYY-MM-DD\" format, inclusive.",
  4737. // "location": "query",
  4738. // "pattern": "\\d{4}-\\d{2}-\\d{2}|(today|startOfMonth|startOfYear)(([\\-\\+]\\d+[dwmy]){0,3}?)",
  4739. // "required": true,
  4740. // "type": "string"
  4741. // },
  4742. // "startIndex": {
  4743. // "description": "Index of the first row of report data to return.",
  4744. // "format": "int32",
  4745. // "location": "query",
  4746. // "maximum": "5000",
  4747. // "minimum": "0",
  4748. // "type": "integer"
  4749. // }
  4750. // },
  4751. // "path": "reports",
  4752. // "response": {
  4753. // "$ref": "AdsenseReportsGenerateResponse"
  4754. // },
  4755. // "scopes": [
  4756. // "https://www.googleapis.com/auth/adsense",
  4757. // "https://www.googleapis.com/auth/adsense.readonly"
  4758. // ],
  4759. // "supportsMediaDownload": true
  4760. // }
  4761. }
  4762. // method id "adsense.reports.saved.generate":
  4763. type ReportsSavedGenerateCall struct {
  4764. s *Service
  4765. savedReportId string
  4766. urlParams_ gensupport.URLParams
  4767. ifNoneMatch_ string
  4768. ctx_ context.Context
  4769. }
  4770. // Generate: Generate an AdSense report based on the saved report ID
  4771. // sent in the query parameters.
  4772. func (r *ReportsSavedService) Generate(savedReportId string) *ReportsSavedGenerateCall {
  4773. c := &ReportsSavedGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4774. c.savedReportId = savedReportId
  4775. return c
  4776. }
  4777. // Locale sets the optional parameter "locale": Optional locale to use
  4778. // for translating report output to a local language. Defaults to
  4779. // "en_US" if not specified.
  4780. func (c *ReportsSavedGenerateCall) Locale(locale string) *ReportsSavedGenerateCall {
  4781. c.urlParams_.Set("locale", locale)
  4782. return c
  4783. }
  4784. // MaxResults sets the optional parameter "maxResults": The maximum
  4785. // number of rows of report data to return.
  4786. func (c *ReportsSavedGenerateCall) MaxResults(maxResults int64) *ReportsSavedGenerateCall {
  4787. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4788. return c
  4789. }
  4790. // StartIndex sets the optional parameter "startIndex": Index of the
  4791. // first row of report data to return.
  4792. func (c *ReportsSavedGenerateCall) StartIndex(startIndex int64) *ReportsSavedGenerateCall {
  4793. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  4794. return c
  4795. }
  4796. // Fields allows partial responses to be retrieved. See
  4797. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4798. // for more information.
  4799. func (c *ReportsSavedGenerateCall) Fields(s ...googleapi.Field) *ReportsSavedGenerateCall {
  4800. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4801. return c
  4802. }
  4803. // IfNoneMatch sets the optional parameter which makes the operation
  4804. // fail if the object's ETag matches the given value. This is useful for
  4805. // getting updates only after the object has changed since the last
  4806. // request. Use googleapi.IsNotModified to check whether the response
  4807. // error from Do is the result of In-None-Match.
  4808. func (c *ReportsSavedGenerateCall) IfNoneMatch(entityTag string) *ReportsSavedGenerateCall {
  4809. c.ifNoneMatch_ = entityTag
  4810. return c
  4811. }
  4812. // Context sets the context to be used in this call's Do method. Any
  4813. // pending HTTP request will be aborted if the provided context is
  4814. // canceled.
  4815. func (c *ReportsSavedGenerateCall) Context(ctx context.Context) *ReportsSavedGenerateCall {
  4816. c.ctx_ = ctx
  4817. return c
  4818. }
  4819. func (c *ReportsSavedGenerateCall) doRequest(alt string) (*http.Response, error) {
  4820. var body io.Reader = nil
  4821. c.urlParams_.Set("alt", alt)
  4822. urls := googleapi.ResolveRelative(c.s.BasePath, "reports/{savedReportId}")
  4823. urls += "?" + c.urlParams_.Encode()
  4824. req, _ := http.NewRequest("GET", urls, body)
  4825. googleapi.Expand(req.URL, map[string]string{
  4826. "savedReportId": c.savedReportId,
  4827. })
  4828. req.Header.Set("User-Agent", c.s.userAgent())
  4829. if c.ifNoneMatch_ != "" {
  4830. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4831. }
  4832. if c.ctx_ != nil {
  4833. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4834. }
  4835. return c.s.client.Do(req)
  4836. }
  4837. // Do executes the "adsense.reports.saved.generate" call.
  4838. // Exactly one of *AdsenseReportsGenerateResponse or error will be
  4839. // non-nil. Any non-2xx status code is an error. Response headers are in
  4840. // either *AdsenseReportsGenerateResponse.ServerResponse.Header or (if a
  4841. // response was returned at all) in error.(*googleapi.Error).Header. Use
  4842. // googleapi.IsNotModified to check whether the returned error was
  4843. // because http.StatusNotModified was returned.
  4844. func (c *ReportsSavedGenerateCall) Do(opts ...googleapi.CallOption) (*AdsenseReportsGenerateResponse, error) {
  4845. gensupport.SetOptions(c.urlParams_, opts...)
  4846. res, err := c.doRequest("json")
  4847. if res != nil && res.StatusCode == http.StatusNotModified {
  4848. if res.Body != nil {
  4849. res.Body.Close()
  4850. }
  4851. return nil, &googleapi.Error{
  4852. Code: res.StatusCode,
  4853. Header: res.Header,
  4854. }
  4855. }
  4856. if err != nil {
  4857. return nil, err
  4858. }
  4859. defer googleapi.CloseBody(res)
  4860. if err := googleapi.CheckResponse(res); err != nil {
  4861. return nil, err
  4862. }
  4863. ret := &AdsenseReportsGenerateResponse{
  4864. ServerResponse: googleapi.ServerResponse{
  4865. Header: res.Header,
  4866. HTTPStatusCode: res.StatusCode,
  4867. },
  4868. }
  4869. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4870. return nil, err
  4871. }
  4872. return ret, nil
  4873. // {
  4874. // "description": "Generate an AdSense report based on the saved report ID sent in the query parameters.",
  4875. // "httpMethod": "GET",
  4876. // "id": "adsense.reports.saved.generate",
  4877. // "parameterOrder": [
  4878. // "savedReportId"
  4879. // ],
  4880. // "parameters": {
  4881. // "locale": {
  4882. // "description": "Optional locale to use for translating report output to a local language. Defaults to \"en_US\" if not specified.",
  4883. // "location": "query",
  4884. // "pattern": "[a-zA-Z_]+",
  4885. // "type": "string"
  4886. // },
  4887. // "maxResults": {
  4888. // "description": "The maximum number of rows of report data to return.",
  4889. // "format": "int32",
  4890. // "location": "query",
  4891. // "maximum": "50000",
  4892. // "minimum": "0",
  4893. // "type": "integer"
  4894. // },
  4895. // "savedReportId": {
  4896. // "description": "The saved report to retrieve.",
  4897. // "location": "path",
  4898. // "required": true,
  4899. // "type": "string"
  4900. // },
  4901. // "startIndex": {
  4902. // "description": "Index of the first row of report data to return.",
  4903. // "format": "int32",
  4904. // "location": "query",
  4905. // "maximum": "5000",
  4906. // "minimum": "0",
  4907. // "type": "integer"
  4908. // }
  4909. // },
  4910. // "path": "reports/{savedReportId}",
  4911. // "response": {
  4912. // "$ref": "AdsenseReportsGenerateResponse"
  4913. // },
  4914. // "scopes": [
  4915. // "https://www.googleapis.com/auth/adsense",
  4916. // "https://www.googleapis.com/auth/adsense.readonly"
  4917. // ]
  4918. // }
  4919. }
  4920. // method id "adsense.reports.saved.list":
  4921. type ReportsSavedListCall struct {
  4922. s *Service
  4923. urlParams_ gensupport.URLParams
  4924. ifNoneMatch_ string
  4925. ctx_ context.Context
  4926. }
  4927. // List: List all saved reports in this AdSense account.
  4928. func (r *ReportsSavedService) List() *ReportsSavedListCall {
  4929. c := &ReportsSavedListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4930. return c
  4931. }
  4932. // MaxResults sets the optional parameter "maxResults": The maximum
  4933. // number of saved reports to include in the response, used for paging.
  4934. func (c *ReportsSavedListCall) MaxResults(maxResults int64) *ReportsSavedListCall {
  4935. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4936. return c
  4937. }
  4938. // PageToken sets the optional parameter "pageToken": A continuation
  4939. // token, used to page through saved reports. To retrieve the next page,
  4940. // set this parameter to the value of "nextPageToken" from the previous
  4941. // response.
  4942. func (c *ReportsSavedListCall) PageToken(pageToken string) *ReportsSavedListCall {
  4943. c.urlParams_.Set("pageToken", pageToken)
  4944. return c
  4945. }
  4946. // Fields allows partial responses to be retrieved. See
  4947. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4948. // for more information.
  4949. func (c *ReportsSavedListCall) Fields(s ...googleapi.Field) *ReportsSavedListCall {
  4950. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4951. return c
  4952. }
  4953. // IfNoneMatch sets the optional parameter which makes the operation
  4954. // fail if the object's ETag matches the given value. This is useful for
  4955. // getting updates only after the object has changed since the last
  4956. // request. Use googleapi.IsNotModified to check whether the response
  4957. // error from Do is the result of In-None-Match.
  4958. func (c *ReportsSavedListCall) IfNoneMatch(entityTag string) *ReportsSavedListCall {
  4959. c.ifNoneMatch_ = entityTag
  4960. return c
  4961. }
  4962. // Context sets the context to be used in this call's Do method. Any
  4963. // pending HTTP request will be aborted if the provided context is
  4964. // canceled.
  4965. func (c *ReportsSavedListCall) Context(ctx context.Context) *ReportsSavedListCall {
  4966. c.ctx_ = ctx
  4967. return c
  4968. }
  4969. func (c *ReportsSavedListCall) doRequest(alt string) (*http.Response, error) {
  4970. var body io.Reader = nil
  4971. c.urlParams_.Set("alt", alt)
  4972. urls := googleapi.ResolveRelative(c.s.BasePath, "reports/saved")
  4973. urls += "?" + c.urlParams_.Encode()
  4974. req, _ := http.NewRequest("GET", urls, body)
  4975. googleapi.SetOpaque(req.URL)
  4976. req.Header.Set("User-Agent", c.s.userAgent())
  4977. if c.ifNoneMatch_ != "" {
  4978. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4979. }
  4980. if c.ctx_ != nil {
  4981. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4982. }
  4983. return c.s.client.Do(req)
  4984. }
  4985. // Do executes the "adsense.reports.saved.list" call.
  4986. // Exactly one of *SavedReports or error will be non-nil. Any non-2xx
  4987. // status code is an error. Response headers are in either
  4988. // *SavedReports.ServerResponse.Header or (if a response was returned at
  4989. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4990. // to check whether the returned error was because
  4991. // http.StatusNotModified was returned.
  4992. func (c *ReportsSavedListCall) Do(opts ...googleapi.CallOption) (*SavedReports, error) {
  4993. gensupport.SetOptions(c.urlParams_, opts...)
  4994. res, err := c.doRequest("json")
  4995. if res != nil && res.StatusCode == http.StatusNotModified {
  4996. if res.Body != nil {
  4997. res.Body.Close()
  4998. }
  4999. return nil, &googleapi.Error{
  5000. Code: res.StatusCode,
  5001. Header: res.Header,
  5002. }
  5003. }
  5004. if err != nil {
  5005. return nil, err
  5006. }
  5007. defer googleapi.CloseBody(res)
  5008. if err := googleapi.CheckResponse(res); err != nil {
  5009. return nil, err
  5010. }
  5011. ret := &SavedReports{
  5012. ServerResponse: googleapi.ServerResponse{
  5013. Header: res.Header,
  5014. HTTPStatusCode: res.StatusCode,
  5015. },
  5016. }
  5017. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5018. return nil, err
  5019. }
  5020. return ret, nil
  5021. // {
  5022. // "description": "List all saved reports in this AdSense account.",
  5023. // "httpMethod": "GET",
  5024. // "id": "adsense.reports.saved.list",
  5025. // "parameters": {
  5026. // "maxResults": {
  5027. // "description": "The maximum number of saved reports to include in the response, used for paging.",
  5028. // "format": "int32",
  5029. // "location": "query",
  5030. // "maximum": "100",
  5031. // "minimum": "0",
  5032. // "type": "integer"
  5033. // },
  5034. // "pageToken": {
  5035. // "description": "A continuation token, used to page through saved reports. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  5036. // "location": "query",
  5037. // "type": "string"
  5038. // }
  5039. // },
  5040. // "path": "reports/saved",
  5041. // "response": {
  5042. // "$ref": "SavedReports"
  5043. // },
  5044. // "scopes": [
  5045. // "https://www.googleapis.com/auth/adsense",
  5046. // "https://www.googleapis.com/auth/adsense.readonly"
  5047. // ]
  5048. // }
  5049. }
  5050. // Pages invokes f for each page of results.
  5051. // A non-nil error returned from f will halt the iteration.
  5052. // The provided context supersedes any context provided to the Context method.
  5053. func (c *ReportsSavedListCall) Pages(ctx context.Context, f func(*SavedReports) error) error {
  5054. c.ctx_ = ctx
  5055. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5056. for {
  5057. x, err := c.Do()
  5058. if err != nil {
  5059. return err
  5060. }
  5061. if err := f(x); err != nil {
  5062. return err
  5063. }
  5064. if x.NextPageToken == "" {
  5065. return nil
  5066. }
  5067. c.PageToken(x.NextPageToken)
  5068. }
  5069. }
  5070. // method id "adsense.savedadstyles.get":
  5071. type SavedadstylesGetCall struct {
  5072. s *Service
  5073. savedAdStyleId string
  5074. urlParams_ gensupport.URLParams
  5075. ifNoneMatch_ string
  5076. ctx_ context.Context
  5077. }
  5078. // Get: Get a specific saved ad style from the user's account.
  5079. func (r *SavedadstylesService) Get(savedAdStyleId string) *SavedadstylesGetCall {
  5080. c := &SavedadstylesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5081. c.savedAdStyleId = savedAdStyleId
  5082. return c
  5083. }
  5084. // Fields allows partial responses to be retrieved. See
  5085. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5086. // for more information.
  5087. func (c *SavedadstylesGetCall) Fields(s ...googleapi.Field) *SavedadstylesGetCall {
  5088. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5089. return c
  5090. }
  5091. // IfNoneMatch sets the optional parameter which makes the operation
  5092. // fail if the object's ETag matches the given value. This is useful for
  5093. // getting updates only after the object has changed since the last
  5094. // request. Use googleapi.IsNotModified to check whether the response
  5095. // error from Do is the result of In-None-Match.
  5096. func (c *SavedadstylesGetCall) IfNoneMatch(entityTag string) *SavedadstylesGetCall {
  5097. c.ifNoneMatch_ = entityTag
  5098. return c
  5099. }
  5100. // Context sets the context to be used in this call's Do method. Any
  5101. // pending HTTP request will be aborted if the provided context is
  5102. // canceled.
  5103. func (c *SavedadstylesGetCall) Context(ctx context.Context) *SavedadstylesGetCall {
  5104. c.ctx_ = ctx
  5105. return c
  5106. }
  5107. func (c *SavedadstylesGetCall) doRequest(alt string) (*http.Response, error) {
  5108. var body io.Reader = nil
  5109. c.urlParams_.Set("alt", alt)
  5110. urls := googleapi.ResolveRelative(c.s.BasePath, "savedadstyles/{savedAdStyleId}")
  5111. urls += "?" + c.urlParams_.Encode()
  5112. req, _ := http.NewRequest("GET", urls, body)
  5113. googleapi.Expand(req.URL, map[string]string{
  5114. "savedAdStyleId": c.savedAdStyleId,
  5115. })
  5116. req.Header.Set("User-Agent", c.s.userAgent())
  5117. if c.ifNoneMatch_ != "" {
  5118. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  5119. }
  5120. if c.ctx_ != nil {
  5121. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5122. }
  5123. return c.s.client.Do(req)
  5124. }
  5125. // Do executes the "adsense.savedadstyles.get" call.
  5126. // Exactly one of *SavedAdStyle or error will be non-nil. Any non-2xx
  5127. // status code is an error. Response headers are in either
  5128. // *SavedAdStyle.ServerResponse.Header or (if a response was returned at
  5129. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5130. // to check whether the returned error was because
  5131. // http.StatusNotModified was returned.
  5132. func (c *SavedadstylesGetCall) Do(opts ...googleapi.CallOption) (*SavedAdStyle, error) {
  5133. gensupport.SetOptions(c.urlParams_, opts...)
  5134. res, err := c.doRequest("json")
  5135. if res != nil && res.StatusCode == http.StatusNotModified {
  5136. if res.Body != nil {
  5137. res.Body.Close()
  5138. }
  5139. return nil, &googleapi.Error{
  5140. Code: res.StatusCode,
  5141. Header: res.Header,
  5142. }
  5143. }
  5144. if err != nil {
  5145. return nil, err
  5146. }
  5147. defer googleapi.CloseBody(res)
  5148. if err := googleapi.CheckResponse(res); err != nil {
  5149. return nil, err
  5150. }
  5151. ret := &SavedAdStyle{
  5152. ServerResponse: googleapi.ServerResponse{
  5153. Header: res.Header,
  5154. HTTPStatusCode: res.StatusCode,
  5155. },
  5156. }
  5157. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5158. return nil, err
  5159. }
  5160. return ret, nil
  5161. // {
  5162. // "description": "Get a specific saved ad style from the user's account.",
  5163. // "httpMethod": "GET",
  5164. // "id": "adsense.savedadstyles.get",
  5165. // "parameterOrder": [
  5166. // "savedAdStyleId"
  5167. // ],
  5168. // "parameters": {
  5169. // "savedAdStyleId": {
  5170. // "description": "Saved ad style to retrieve.",
  5171. // "location": "path",
  5172. // "required": true,
  5173. // "type": "string"
  5174. // }
  5175. // },
  5176. // "path": "savedadstyles/{savedAdStyleId}",
  5177. // "response": {
  5178. // "$ref": "SavedAdStyle"
  5179. // },
  5180. // "scopes": [
  5181. // "https://www.googleapis.com/auth/adsense",
  5182. // "https://www.googleapis.com/auth/adsense.readonly"
  5183. // ]
  5184. // }
  5185. }
  5186. // method id "adsense.savedadstyles.list":
  5187. type SavedadstylesListCall struct {
  5188. s *Service
  5189. urlParams_ gensupport.URLParams
  5190. ifNoneMatch_ string
  5191. ctx_ context.Context
  5192. }
  5193. // List: List all saved ad styles in the user's account.
  5194. func (r *SavedadstylesService) List() *SavedadstylesListCall {
  5195. c := &SavedadstylesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5196. return c
  5197. }
  5198. // MaxResults sets the optional parameter "maxResults": The maximum
  5199. // number of saved ad styles to include in the response, used for
  5200. // paging.
  5201. func (c *SavedadstylesListCall) MaxResults(maxResults int64) *SavedadstylesListCall {
  5202. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5203. return c
  5204. }
  5205. // PageToken sets the optional parameter "pageToken": A continuation
  5206. // token, used to page through saved ad styles. To retrieve the next
  5207. // page, set this parameter to the value of "nextPageToken" from the
  5208. // previous response.
  5209. func (c *SavedadstylesListCall) PageToken(pageToken string) *SavedadstylesListCall {
  5210. c.urlParams_.Set("pageToken", pageToken)
  5211. return c
  5212. }
  5213. // Fields allows partial responses to be retrieved. See
  5214. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5215. // for more information.
  5216. func (c *SavedadstylesListCall) Fields(s ...googleapi.Field) *SavedadstylesListCall {
  5217. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5218. return c
  5219. }
  5220. // IfNoneMatch sets the optional parameter which makes the operation
  5221. // fail if the object's ETag matches the given value. This is useful for
  5222. // getting updates only after the object has changed since the last
  5223. // request. Use googleapi.IsNotModified to check whether the response
  5224. // error from Do is the result of In-None-Match.
  5225. func (c *SavedadstylesListCall) IfNoneMatch(entityTag string) *SavedadstylesListCall {
  5226. c.ifNoneMatch_ = entityTag
  5227. return c
  5228. }
  5229. // Context sets the context to be used in this call's Do method. Any
  5230. // pending HTTP request will be aborted if the provided context is
  5231. // canceled.
  5232. func (c *SavedadstylesListCall) Context(ctx context.Context) *SavedadstylesListCall {
  5233. c.ctx_ = ctx
  5234. return c
  5235. }
  5236. func (c *SavedadstylesListCall) doRequest(alt string) (*http.Response, error) {
  5237. var body io.Reader = nil
  5238. c.urlParams_.Set("alt", alt)
  5239. urls := googleapi.ResolveRelative(c.s.BasePath, "savedadstyles")
  5240. urls += "?" + c.urlParams_.Encode()
  5241. req, _ := http.NewRequest("GET", urls, body)
  5242. googleapi.SetOpaque(req.URL)
  5243. req.Header.Set("User-Agent", c.s.userAgent())
  5244. if c.ifNoneMatch_ != "" {
  5245. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  5246. }
  5247. if c.ctx_ != nil {
  5248. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5249. }
  5250. return c.s.client.Do(req)
  5251. }
  5252. // Do executes the "adsense.savedadstyles.list" call.
  5253. // Exactly one of *SavedAdStyles or error will be non-nil. Any non-2xx
  5254. // status code is an error. Response headers are in either
  5255. // *SavedAdStyles.ServerResponse.Header or (if a response was returned
  5256. // at all) in error.(*googleapi.Error).Header. Use
  5257. // googleapi.IsNotModified to check whether the returned error was
  5258. // because http.StatusNotModified was returned.
  5259. func (c *SavedadstylesListCall) Do(opts ...googleapi.CallOption) (*SavedAdStyles, error) {
  5260. gensupport.SetOptions(c.urlParams_, opts...)
  5261. res, err := c.doRequest("json")
  5262. if res != nil && res.StatusCode == http.StatusNotModified {
  5263. if res.Body != nil {
  5264. res.Body.Close()
  5265. }
  5266. return nil, &googleapi.Error{
  5267. Code: res.StatusCode,
  5268. Header: res.Header,
  5269. }
  5270. }
  5271. if err != nil {
  5272. return nil, err
  5273. }
  5274. defer googleapi.CloseBody(res)
  5275. if err := googleapi.CheckResponse(res); err != nil {
  5276. return nil, err
  5277. }
  5278. ret := &SavedAdStyles{
  5279. ServerResponse: googleapi.ServerResponse{
  5280. Header: res.Header,
  5281. HTTPStatusCode: res.StatusCode,
  5282. },
  5283. }
  5284. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5285. return nil, err
  5286. }
  5287. return ret, nil
  5288. // {
  5289. // "description": "List all saved ad styles in the user's account.",
  5290. // "httpMethod": "GET",
  5291. // "id": "adsense.savedadstyles.list",
  5292. // "parameters": {
  5293. // "maxResults": {
  5294. // "description": "The maximum number of saved ad styles to include in the response, used for paging.",
  5295. // "format": "int32",
  5296. // "location": "query",
  5297. // "maximum": "10000",
  5298. // "minimum": "0",
  5299. // "type": "integer"
  5300. // },
  5301. // "pageToken": {
  5302. // "description": "A continuation token, used to page through saved ad styles. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  5303. // "location": "query",
  5304. // "type": "string"
  5305. // }
  5306. // },
  5307. // "path": "savedadstyles",
  5308. // "response": {
  5309. // "$ref": "SavedAdStyles"
  5310. // },
  5311. // "scopes": [
  5312. // "https://www.googleapis.com/auth/adsense",
  5313. // "https://www.googleapis.com/auth/adsense.readonly"
  5314. // ]
  5315. // }
  5316. }
  5317. // Pages invokes f for each page of results.
  5318. // A non-nil error returned from f will halt the iteration.
  5319. // The provided context supersedes any context provided to the Context method.
  5320. func (c *SavedadstylesListCall) Pages(ctx context.Context, f func(*SavedAdStyles) error) error {
  5321. c.ctx_ = ctx
  5322. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5323. for {
  5324. x, err := c.Do()
  5325. if err != nil {
  5326. return err
  5327. }
  5328. if err := f(x); err != nil {
  5329. return err
  5330. }
  5331. if x.NextPageToken == "" {
  5332. return nil
  5333. }
  5334. c.PageToken(x.NextPageToken)
  5335. }
  5336. }
  5337. // method id "adsense.urlchannels.list":
  5338. type UrlchannelsListCall struct {
  5339. s *Service
  5340. adClientId string
  5341. urlParams_ gensupport.URLParams
  5342. ifNoneMatch_ string
  5343. ctx_ context.Context
  5344. }
  5345. // List: List all URL channels in the specified ad client for this
  5346. // AdSense account.
  5347. func (r *UrlchannelsService) List(adClientId string) *UrlchannelsListCall {
  5348. c := &UrlchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5349. c.adClientId = adClientId
  5350. return c
  5351. }
  5352. // MaxResults sets the optional parameter "maxResults": The maximum
  5353. // number of URL channels to include in the response, used for paging.
  5354. func (c *UrlchannelsListCall) MaxResults(maxResults int64) *UrlchannelsListCall {
  5355. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5356. return c
  5357. }
  5358. // PageToken sets the optional parameter "pageToken": A continuation
  5359. // token, used to page through URL channels. To retrieve the next page,
  5360. // set this parameter to the value of "nextPageToken" from the previous
  5361. // response.
  5362. func (c *UrlchannelsListCall) PageToken(pageToken string) *UrlchannelsListCall {
  5363. c.urlParams_.Set("pageToken", pageToken)
  5364. return c
  5365. }
  5366. // Fields allows partial responses to be retrieved. See
  5367. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5368. // for more information.
  5369. func (c *UrlchannelsListCall) Fields(s ...googleapi.Field) *UrlchannelsListCall {
  5370. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5371. return c
  5372. }
  5373. // IfNoneMatch sets the optional parameter which makes the operation
  5374. // fail if the object's ETag matches the given value. This is useful for
  5375. // getting updates only after the object has changed since the last
  5376. // request. Use googleapi.IsNotModified to check whether the response
  5377. // error from Do is the result of In-None-Match.
  5378. func (c *UrlchannelsListCall) IfNoneMatch(entityTag string) *UrlchannelsListCall {
  5379. c.ifNoneMatch_ = entityTag
  5380. return c
  5381. }
  5382. // Context sets the context to be used in this call's Do method. Any
  5383. // pending HTTP request will be aborted if the provided context is
  5384. // canceled.
  5385. func (c *UrlchannelsListCall) Context(ctx context.Context) *UrlchannelsListCall {
  5386. c.ctx_ = ctx
  5387. return c
  5388. }
  5389. func (c *UrlchannelsListCall) doRequest(alt string) (*http.Response, error) {
  5390. var body io.Reader = nil
  5391. c.urlParams_.Set("alt", alt)
  5392. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/urlchannels")
  5393. urls += "?" + c.urlParams_.Encode()
  5394. req, _ := http.NewRequest("GET", urls, body)
  5395. googleapi.Expand(req.URL, map[string]string{
  5396. "adClientId": c.adClientId,
  5397. })
  5398. req.Header.Set("User-Agent", c.s.userAgent())
  5399. if c.ifNoneMatch_ != "" {
  5400. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  5401. }
  5402. if c.ctx_ != nil {
  5403. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5404. }
  5405. return c.s.client.Do(req)
  5406. }
  5407. // Do executes the "adsense.urlchannels.list" call.
  5408. // Exactly one of *UrlChannels or error will be non-nil. Any non-2xx
  5409. // status code is an error. Response headers are in either
  5410. // *UrlChannels.ServerResponse.Header or (if a response was returned at
  5411. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5412. // to check whether the returned error was because
  5413. // http.StatusNotModified was returned.
  5414. func (c *UrlchannelsListCall) Do(opts ...googleapi.CallOption) (*UrlChannels, error) {
  5415. gensupport.SetOptions(c.urlParams_, opts...)
  5416. res, err := c.doRequest("json")
  5417. if res != nil && res.StatusCode == http.StatusNotModified {
  5418. if res.Body != nil {
  5419. res.Body.Close()
  5420. }
  5421. return nil, &googleapi.Error{
  5422. Code: res.StatusCode,
  5423. Header: res.Header,
  5424. }
  5425. }
  5426. if err != nil {
  5427. return nil, err
  5428. }
  5429. defer googleapi.CloseBody(res)
  5430. if err := googleapi.CheckResponse(res); err != nil {
  5431. return nil, err
  5432. }
  5433. ret := &UrlChannels{
  5434. ServerResponse: googleapi.ServerResponse{
  5435. Header: res.Header,
  5436. HTTPStatusCode: res.StatusCode,
  5437. },
  5438. }
  5439. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5440. return nil, err
  5441. }
  5442. return ret, nil
  5443. // {
  5444. // "description": "List all URL channels in the specified ad client for this AdSense account.",
  5445. // "httpMethod": "GET",
  5446. // "id": "adsense.urlchannels.list",
  5447. // "parameterOrder": [
  5448. // "adClientId"
  5449. // ],
  5450. // "parameters": {
  5451. // "adClientId": {
  5452. // "description": "Ad client for which to list URL channels.",
  5453. // "location": "path",
  5454. // "required": true,
  5455. // "type": "string"
  5456. // },
  5457. // "maxResults": {
  5458. // "description": "The maximum number of URL channels to include in the response, used for paging.",
  5459. // "format": "int32",
  5460. // "location": "query",
  5461. // "maximum": "10000",
  5462. // "minimum": "0",
  5463. // "type": "integer"
  5464. // },
  5465. // "pageToken": {
  5466. // "description": "A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  5467. // "location": "query",
  5468. // "type": "string"
  5469. // }
  5470. // },
  5471. // "path": "adclients/{adClientId}/urlchannels",
  5472. // "response": {
  5473. // "$ref": "UrlChannels"
  5474. // },
  5475. // "scopes": [
  5476. // "https://www.googleapis.com/auth/adsense",
  5477. // "https://www.googleapis.com/auth/adsense.readonly"
  5478. // ]
  5479. // }
  5480. }
  5481. // Pages invokes f for each page of results.
  5482. // A non-nil error returned from f will halt the iteration.
  5483. // The provided context supersedes any context provided to the Context method.
  5484. func (c *UrlchannelsListCall) Pages(ctx context.Context, f func(*UrlChannels) error) error {
  5485. c.ctx_ = ctx
  5486. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5487. for {
  5488. x, err := c.Do()
  5489. if err != nil {
  5490. return err
  5491. }
  5492. if err := f(x); err != nil {
  5493. return err
  5494. }
  5495. if x.NextPageToken == "" {
  5496. return nil
  5497. }
  5498. c.PageToken(x.NextPageToken)
  5499. }
  5500. }