adsense-gen.go 233 KB

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