adsense-gen.go 249 KB

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