gan-gen.go 123 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615
  1. // Package gan provides access to the Google Affiliate Network API.
  2. //
  3. // See https://developers.google.com/affiliate-network/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/gan/v1beta1"
  8. // ...
  9. // ganService, err := gan.New(oauthHttpClient)
  10. package gan // import "google.golang.org/api/gan/v1beta1"
  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 = "gan:v1beta1"
  41. const apiName = "gan"
  42. const apiVersion = "v1beta1"
  43. const basePath = "https://www.googleapis.com/gan/v1beta1/"
  44. func New(client *http.Client) (*Service, error) {
  45. if client == nil {
  46. return nil, errors.New("client is nil")
  47. }
  48. s := &Service{client: client, BasePath: basePath}
  49. s.Advertisers = NewAdvertisersService(s)
  50. s.CcOffers = NewCcOffersService(s)
  51. s.Events = NewEventsService(s)
  52. s.Links = NewLinksService(s)
  53. s.Publishers = NewPublishersService(s)
  54. s.Reports = NewReportsService(s)
  55. return s, nil
  56. }
  57. type Service struct {
  58. client *http.Client
  59. BasePath string // API endpoint base URL
  60. UserAgent string // optional additional User-Agent fragment
  61. Advertisers *AdvertisersService
  62. CcOffers *CcOffersService
  63. Events *EventsService
  64. Links *LinksService
  65. Publishers *PublishersService
  66. Reports *ReportsService
  67. }
  68. func (s *Service) userAgent() string {
  69. if s.UserAgent == "" {
  70. return googleapi.UserAgent
  71. }
  72. return googleapi.UserAgent + " " + s.UserAgent
  73. }
  74. func NewAdvertisersService(s *Service) *AdvertisersService {
  75. rs := &AdvertisersService{s: s}
  76. return rs
  77. }
  78. type AdvertisersService struct {
  79. s *Service
  80. }
  81. func NewCcOffersService(s *Service) *CcOffersService {
  82. rs := &CcOffersService{s: s}
  83. return rs
  84. }
  85. type CcOffersService struct {
  86. s *Service
  87. }
  88. func NewEventsService(s *Service) *EventsService {
  89. rs := &EventsService{s: s}
  90. return rs
  91. }
  92. type EventsService struct {
  93. s *Service
  94. }
  95. func NewLinksService(s *Service) *LinksService {
  96. rs := &LinksService{s: s}
  97. return rs
  98. }
  99. type LinksService struct {
  100. s *Service
  101. }
  102. func NewPublishersService(s *Service) *PublishersService {
  103. rs := &PublishersService{s: s}
  104. return rs
  105. }
  106. type PublishersService struct {
  107. s *Service
  108. }
  109. func NewReportsService(s *Service) *ReportsService {
  110. rs := &ReportsService{s: s}
  111. return rs
  112. }
  113. type ReportsService struct {
  114. s *Service
  115. }
  116. // Advertiser: An AdvertiserResource.
  117. type Advertiser struct {
  118. // AllowPublisherCreatedLinks: True if the advertiser allows publisher
  119. // created links, otherwise false.
  120. AllowPublisherCreatedLinks bool `json:"allowPublisherCreatedLinks,omitempty"`
  121. // Category: Category that this advertiser belongs to. A valid list of
  122. // categories can be found here:
  123. // http://www.google.com/support/affiliatenetwork/advertiser/bin/answer.py?hl=en&answer=107581
  124. Category string `json:"category,omitempty"`
  125. // CommissionDuration: The longest possible length of a commission (how
  126. // long the cookies on the customer's browser last before they expire).
  127. CommissionDuration int64 `json:"commissionDuration,omitempty"`
  128. // ContactEmail: Email that this advertiser would like publishers to
  129. // contact them with.
  130. ContactEmail string `json:"contactEmail,omitempty"`
  131. // ContactPhone: Phone that this advertiser would like publishers to
  132. // contact them with.
  133. ContactPhone string `json:"contactPhone,omitempty"`
  134. // DefaultLinkId: The default link id for this advertiser.
  135. DefaultLinkId int64 `json:"defaultLinkId,omitempty,string"`
  136. // Description: Description of the website the advertiser advertises
  137. // from.
  138. Description string `json:"description,omitempty"`
  139. // EpcNinetyDayAverage: The sum of fees paid to publishers divided by
  140. // the total number of clicks over the past three months. This value
  141. // should be multiplied by 100 at the time of display.
  142. EpcNinetyDayAverage *Money `json:"epcNinetyDayAverage,omitempty"`
  143. // EpcSevenDayAverage: The sum of fees paid to publishers divided by the
  144. // total number of clicks over the past seven days. This value should be
  145. // multiplied by 100 at the time of display.
  146. EpcSevenDayAverage *Money `json:"epcSevenDayAverage,omitempty"`
  147. // Id: The ID of this advertiser.
  148. Id int64 `json:"id,omitempty,string"`
  149. // Item: The requested advertiser.
  150. Item *Advertiser `json:"item,omitempty"`
  151. // JoinDate: Date that this advertiser was approved as a Google
  152. // Affiliate Network advertiser.
  153. JoinDate string `json:"joinDate,omitempty"`
  154. // Kind: The kind for an advertiser.
  155. Kind string `json:"kind,omitempty"`
  156. // LogoUrl: URL to the logo this advertiser uses on the Google Affiliate
  157. // Network.
  158. LogoUrl string `json:"logoUrl,omitempty"`
  159. // MerchantCenterIds: List of merchant center ids for this advertiser
  160. MerchantCenterIds googleapi.Int64s `json:"merchantCenterIds,omitempty"`
  161. // Name: The name of this advertiser.
  162. Name string `json:"name,omitempty"`
  163. // PayoutRank: A rank based on commissions paid to publishers over the
  164. // past 90 days. A number between 1 and 4 where 4 means the top quartile
  165. // (most money paid) and 1 means the bottom quartile (least money paid).
  166. PayoutRank string `json:"payoutRank,omitempty"`
  167. // ProductFeedsEnabled: Allows advertisers to submit product listings to
  168. // Google Product Search.
  169. ProductFeedsEnabled bool `json:"productFeedsEnabled,omitempty"`
  170. // RedirectDomains: List of redirect URLs for this advertiser
  171. RedirectDomains []string `json:"redirectDomains,omitempty"`
  172. // SiteUrl: URL of the website this advertiser advertises from.
  173. SiteUrl string `json:"siteUrl,omitempty"`
  174. // Status: The status of the requesting publisher's relationship this
  175. // advertiser.
  176. Status string `json:"status,omitempty"`
  177. // ServerResponse contains the HTTP response code and headers from the
  178. // server.
  179. googleapi.ServerResponse `json:"-"`
  180. // ForceSendFields is a list of field names (e.g.
  181. // "AllowPublisherCreatedLinks") to unconditionally include in API
  182. // requests. By default, fields with empty values are omitted from API
  183. // requests. However, any non-pointer, non-interface field appearing in
  184. // ForceSendFields will be sent to the server regardless of whether the
  185. // field is empty or not. This may be used to include empty fields in
  186. // Patch requests.
  187. ForceSendFields []string `json:"-"`
  188. }
  189. func (s *Advertiser) MarshalJSON() ([]byte, error) {
  190. type noMethod Advertiser
  191. raw := noMethod(*s)
  192. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  193. }
  194. type Advertisers struct {
  195. // Items: The advertiser list.
  196. Items []*Advertiser `json:"items,omitempty"`
  197. // Kind: The kind for a page of advertisers.
  198. Kind string `json:"kind,omitempty"`
  199. // NextPageToken: The 'pageToken' to pass to the next request to get the
  200. // next page, if there are more to retrieve.
  201. NextPageToken string `json:"nextPageToken,omitempty"`
  202. // ServerResponse contains the HTTP response code and headers from the
  203. // server.
  204. googleapi.ServerResponse `json:"-"`
  205. // ForceSendFields is a list of field names (e.g. "Items") to
  206. // unconditionally include in API requests. By default, fields with
  207. // empty values are omitted from API requests. However, any non-pointer,
  208. // non-interface field appearing in ForceSendFields will be sent to the
  209. // server regardless of whether the field is empty or not. This may be
  210. // used to include empty fields in Patch requests.
  211. ForceSendFields []string `json:"-"`
  212. }
  213. func (s *Advertisers) MarshalJSON() ([]byte, error) {
  214. type noMethod Advertisers
  215. raw := noMethod(*s)
  216. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  217. }
  218. // CcOffer: A credit card offer. There are many possible result fields.
  219. // We provide two different views of the data, or "projections." The
  220. // "full" projection includes every result field. And the "summary"
  221. // projection, which is the default, includes a smaller subset of the
  222. // fields. The fields included in the summary projection are marked as
  223. // such in their descriptions.
  224. type CcOffer struct {
  225. // AdditionalCardBenefits: More marketing copy about the card's
  226. // benefits. A summary field.
  227. AdditionalCardBenefits []string `json:"additionalCardBenefits,omitempty"`
  228. // AdditionalCardHolderFee: Any extra fees levied on card holders.
  229. AdditionalCardHolderFee string `json:"additionalCardHolderFee,omitempty"`
  230. // AgeMinimum: The youngest a recipient of this card may be.
  231. AgeMinimum float64 `json:"ageMinimum,omitempty"`
  232. // AgeMinimumDetails: Text describing the details of the age minimum
  233. // restriction.
  234. AgeMinimumDetails string `json:"ageMinimumDetails,omitempty"`
  235. // AnnualFee: The ongoing annual fee, in dollars.
  236. AnnualFee float64 `json:"annualFee,omitempty"`
  237. // AnnualFeeDisplay: Text describing the annual fee, including any
  238. // difference for the first year. A summary field.
  239. AnnualFeeDisplay string `json:"annualFeeDisplay,omitempty"`
  240. // AnnualRewardMaximum: The largest number of units you may accumulate
  241. // in a year.
  242. AnnualRewardMaximum float64 `json:"annualRewardMaximum,omitempty"`
  243. // ApprovedCategories: Possible categories for this card, eg "Low
  244. // Interest" or "Good." A summary field.
  245. ApprovedCategories []string `json:"approvedCategories,omitempty"`
  246. // AprDisplay: Text describing the purchase APR. A summary field.
  247. AprDisplay string `json:"aprDisplay,omitempty"`
  248. // BalanceComputationMethod: Text describing how the balance is
  249. // computed. A summary field.
  250. BalanceComputationMethod string `json:"balanceComputationMethod,omitempty"`
  251. // BalanceTransferTerms: Text describing the terms for balance
  252. // transfers. A summary field.
  253. BalanceTransferTerms string `json:"balanceTransferTerms,omitempty"`
  254. // BonusRewards: For cards with rewards programs, extra circumstances
  255. // whereby additional rewards may be granted.
  256. BonusRewards []*CcOfferBonusRewards `json:"bonusRewards,omitempty"`
  257. // CarRentalInsurance: If you get coverage when you use the card for the
  258. // given activity, this field describes it.
  259. CarRentalInsurance string `json:"carRentalInsurance,omitempty"`
  260. // CardBenefits: A list of what the issuer thinks are the most important
  261. // benefits of the card. Usually summarizes the rewards program, if
  262. // there is one. A summary field.
  263. CardBenefits []string `json:"cardBenefits,omitempty"`
  264. // CardName: The issuer's name for the card, including any trademark or
  265. // service mark designators. A summary field.
  266. CardName string `json:"cardName,omitempty"`
  267. // CardType: What kind of credit card this is, for example secured or
  268. // unsecured.
  269. CardType string `json:"cardType,omitempty"`
  270. // CashAdvanceTerms: Text describing the terms for cash advances. A
  271. // summary field.
  272. CashAdvanceTerms string `json:"cashAdvanceTerms,omitempty"`
  273. // CreditLimitMax: The high end for credit limits the issuer imposes on
  274. // recipients of this card.
  275. CreditLimitMax float64 `json:"creditLimitMax,omitempty"`
  276. // CreditLimitMin: The low end for credit limits the issuer imposes on
  277. // recipients of this card.
  278. CreditLimitMin float64 `json:"creditLimitMin,omitempty"`
  279. // CreditRatingDisplay: Text describing the credit ratings required for
  280. // recipients of this card, for example "Excellent/Good." A summary
  281. // field.
  282. CreditRatingDisplay string `json:"creditRatingDisplay,omitempty"`
  283. // DefaultFees: Fees for defaulting on your payments.
  284. DefaultFees []*CcOfferDefaultFees `json:"defaultFees,omitempty"`
  285. // Disclaimer: A notice that, if present, is referenced via an asterisk
  286. // by many of the other summary fields. If this field is present, it
  287. // will always start with an asterisk ("*"), and must be prominently
  288. // displayed with the offer. A summary field.
  289. Disclaimer string `json:"disclaimer,omitempty"`
  290. // EmergencyInsurance: If you get coverage when you use the card for the
  291. // given activity, this field describes it.
  292. EmergencyInsurance string `json:"emergencyInsurance,omitempty"`
  293. // ExistingCustomerOnly: Whether this card is only available to existing
  294. // customers of the issuer.
  295. ExistingCustomerOnly bool `json:"existingCustomerOnly,omitempty"`
  296. // ExtendedWarranty: If you get coverage when you use the card for the
  297. // given activity, this field describes it.
  298. ExtendedWarranty string `json:"extendedWarranty,omitempty"`
  299. // FirstYearAnnualFee: The annual fee for the first year, if different
  300. // from the ongoing fee. Optional.
  301. FirstYearAnnualFee float64 `json:"firstYearAnnualFee,omitempty"`
  302. // FlightAccidentInsurance: If you get coverage when you use the card
  303. // for the given activity, this field describes it.
  304. FlightAccidentInsurance string `json:"flightAccidentInsurance,omitempty"`
  305. // ForeignCurrencyTransactionFee: Fee for each transaction involving a
  306. // foreign currency.
  307. ForeignCurrencyTransactionFee string `json:"foreignCurrencyTransactionFee,omitempty"`
  308. // FraudLiability: If you get coverage when you use the card for the
  309. // given activity, this field describes it.
  310. FraudLiability string `json:"fraudLiability,omitempty"`
  311. // GracePeriodDisplay: Text describing the grace period before finance
  312. // charges apply. A summary field.
  313. GracePeriodDisplay string `json:"gracePeriodDisplay,omitempty"`
  314. // ImageUrl: The link to the image of the card that is shown on Connect
  315. // Commerce. A summary field.
  316. ImageUrl string `json:"imageUrl,omitempty"`
  317. // InitialSetupAndProcessingFee: Fee for setting up the card.
  318. InitialSetupAndProcessingFee string `json:"initialSetupAndProcessingFee,omitempty"`
  319. // IntroBalanceTransferTerms: Text describing the terms for introductory
  320. // period balance transfers. A summary field.
  321. IntroBalanceTransferTerms string `json:"introBalanceTransferTerms,omitempty"`
  322. // IntroCashAdvanceTerms: Text describing the terms for introductory
  323. // period cash advances. A summary field.
  324. IntroCashAdvanceTerms string `json:"introCashAdvanceTerms,omitempty"`
  325. // IntroPurchaseTerms: Text describing the terms for introductory period
  326. // purchases. A summary field.
  327. IntroPurchaseTerms string `json:"introPurchaseTerms,omitempty"`
  328. // Issuer: Name of card issuer. A summary field.
  329. Issuer string `json:"issuer,omitempty"`
  330. // IssuerId: The Google Affiliate Network ID of the advertiser making
  331. // this offer.
  332. IssuerId string `json:"issuerId,omitempty"`
  333. // IssuerWebsite: The generic link to the issuer's site.
  334. IssuerWebsite string `json:"issuerWebsite,omitempty"`
  335. // Kind: The kind for one credit card offer. A summary field.
  336. Kind string `json:"kind,omitempty"`
  337. // LandingPageUrl: The link to the issuer's page for this card. A
  338. // summary field.
  339. LandingPageUrl string `json:"landingPageUrl,omitempty"`
  340. // LatePaymentFee: Text describing how much a late payment will cost, eg
  341. // "up to $35." A summary field.
  342. LatePaymentFee string `json:"latePaymentFee,omitempty"`
  343. // LuggageInsurance: If you get coverage when you use the card for the
  344. // given activity, this field describes it.
  345. LuggageInsurance string `json:"luggageInsurance,omitempty"`
  346. // MaxPurchaseRate: The highest interest rate the issuer charges on this
  347. // card. Expressed as an absolute number, not as a percentage.
  348. MaxPurchaseRate float64 `json:"maxPurchaseRate,omitempty"`
  349. // MinPurchaseRate: The lowest interest rate the issuer charges on this
  350. // card. Expressed as an absolute number, not as a percentage.
  351. MinPurchaseRate float64 `json:"minPurchaseRate,omitempty"`
  352. // MinimumFinanceCharge: Text describing how much missing the grace
  353. // period will cost.
  354. MinimumFinanceCharge string `json:"minimumFinanceCharge,omitempty"`
  355. // Network: Which network (eg Visa) the card belongs to. A summary
  356. // field.
  357. Network string `json:"network,omitempty"`
  358. // OfferId: This offer's ID. A summary field.
  359. OfferId string `json:"offerId,omitempty"`
  360. // OffersImmediateCashReward: Whether a cash reward program lets you get
  361. // cash back sooner than end of year or other longish period.
  362. OffersImmediateCashReward bool `json:"offersImmediateCashReward,omitempty"`
  363. // OverLimitFee: Fee for exceeding the card's charge limit.
  364. OverLimitFee string `json:"overLimitFee,omitempty"`
  365. // ProhibitedCategories: Categories in which the issuer does not wish
  366. // the card to be displayed. A summary field.
  367. ProhibitedCategories []string `json:"prohibitedCategories,omitempty"`
  368. // PurchaseRateAdditionalDetails: Text describing any additional details
  369. // for the purchase rate. A summary field.
  370. PurchaseRateAdditionalDetails string `json:"purchaseRateAdditionalDetails,omitempty"`
  371. // PurchaseRateType: Fixed or variable.
  372. PurchaseRateType string `json:"purchaseRateType,omitempty"`
  373. // ReturnedPaymentFee: Text describing the fee for a payment that
  374. // doesn't clear. A summary field.
  375. ReturnedPaymentFee string `json:"returnedPaymentFee,omitempty"`
  376. // RewardPartner: The company that redeems the rewards, if different
  377. // from the issuer.
  378. RewardPartner string `json:"rewardPartner,omitempty"`
  379. // RewardUnit: For cards with rewards programs, the unit of reward. For
  380. // example, miles, cash back, points.
  381. RewardUnit string `json:"rewardUnit,omitempty"`
  382. // Rewards: For cards with rewards programs, detailed rules about how
  383. // the program works.
  384. Rewards []*CcOfferRewards `json:"rewards,omitempty"`
  385. // RewardsExpire: Whether accumulated rewards ever expire.
  386. RewardsExpire bool `json:"rewardsExpire,omitempty"`
  387. // RewardsHaveBlackoutDates: For airline miles rewards, tells whether
  388. // blackout dates apply to the miles.
  389. RewardsHaveBlackoutDates bool `json:"rewardsHaveBlackoutDates,omitempty"`
  390. // StatementCopyFee: Fee for requesting a copy of your statement.
  391. StatementCopyFee string `json:"statementCopyFee,omitempty"`
  392. // TrackingUrl: The link to ping to register a click on this offer. A
  393. // summary field.
  394. TrackingUrl string `json:"trackingUrl,omitempty"`
  395. // TravelInsurance: If you get coverage when you use the card for the
  396. // given activity, this field describes it.
  397. TravelInsurance string `json:"travelInsurance,omitempty"`
  398. // VariableRatesLastUpdated: When variable rates were last updated.
  399. VariableRatesLastUpdated string `json:"variableRatesLastUpdated,omitempty"`
  400. // VariableRatesUpdateFrequency: How often variable rates are updated.
  401. VariableRatesUpdateFrequency string `json:"variableRatesUpdateFrequency,omitempty"`
  402. // ForceSendFields is a list of field names (e.g.
  403. // "AdditionalCardBenefits") to unconditionally include in API requests.
  404. // By default, fields with empty values are omitted from API requests.
  405. // However, any non-pointer, non-interface field appearing in
  406. // ForceSendFields will be sent to the server regardless of whether the
  407. // field is empty or not. This may be used to include empty fields in
  408. // Patch requests.
  409. ForceSendFields []string `json:"-"`
  410. }
  411. func (s *CcOffer) MarshalJSON() ([]byte, error) {
  412. type noMethod CcOffer
  413. raw := noMethod(*s)
  414. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  415. }
  416. type CcOfferBonusRewards struct {
  417. // Amount: How many units of reward will be granted.
  418. Amount float64 `json:"amount,omitempty"`
  419. // Details: The circumstances under which this rule applies, for
  420. // example, booking a flight via Orbitz.
  421. Details string `json:"details,omitempty"`
  422. // ForceSendFields is a list of field names (e.g. "Amount") to
  423. // unconditionally include in API requests. By default, fields with
  424. // empty values are omitted from API requests. However, any non-pointer,
  425. // non-interface field appearing in ForceSendFields will be sent to the
  426. // server regardless of whether the field is empty or not. This may be
  427. // used to include empty fields in Patch requests.
  428. ForceSendFields []string `json:"-"`
  429. }
  430. func (s *CcOfferBonusRewards) MarshalJSON() ([]byte, error) {
  431. type noMethod CcOfferBonusRewards
  432. raw := noMethod(*s)
  433. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  434. }
  435. type CcOfferDefaultFees struct {
  436. // Category: The type of charge, for example Purchases.
  437. Category string `json:"category,omitempty"`
  438. // MaxRate: The highest rate the issuer may charge for defaulting on
  439. // debt in this category. Expressed as an absolute number, not as a
  440. // percentage.
  441. MaxRate float64 `json:"maxRate,omitempty"`
  442. // MinRate: The lowest rate the issuer may charge for defaulting on debt
  443. // in this category. Expressed as an absolute number, not as a
  444. // percentage.
  445. MinRate float64 `json:"minRate,omitempty"`
  446. // RateType: Fixed or variable.
  447. RateType string `json:"rateType,omitempty"`
  448. // ForceSendFields is a list of field names (e.g. "Category") to
  449. // unconditionally include in API requests. By default, fields with
  450. // empty values are omitted from API requests. However, any non-pointer,
  451. // non-interface field appearing in ForceSendFields will be sent to the
  452. // server regardless of whether the field is empty or not. This may be
  453. // used to include empty fields in Patch requests.
  454. ForceSendFields []string `json:"-"`
  455. }
  456. func (s *CcOfferDefaultFees) MarshalJSON() ([]byte, error) {
  457. type noMethod CcOfferDefaultFees
  458. raw := noMethod(*s)
  459. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  460. }
  461. type CcOfferRewards struct {
  462. // AdditionalDetails: Other limits, for example, if this rule only
  463. // applies during an introductory period.
  464. AdditionalDetails string `json:"additionalDetails,omitempty"`
  465. // Amount: The number of units rewarded per purchase dollar.
  466. Amount float64 `json:"amount,omitempty"`
  467. // Category: The kind of purchases covered by this rule.
  468. Category string `json:"category,omitempty"`
  469. // ExpirationMonths: How long rewards granted by this rule last.
  470. ExpirationMonths float64 `json:"expirationMonths,omitempty"`
  471. // MaxRewardTier: The maximum purchase amount in the given category for
  472. // this rule to apply.
  473. MaxRewardTier float64 `json:"maxRewardTier,omitempty"`
  474. // MinRewardTier: The minimum purchase amount in the given category
  475. // before this rule applies.
  476. MinRewardTier float64 `json:"minRewardTier,omitempty"`
  477. // ForceSendFields is a list of field names (e.g. "AdditionalDetails")
  478. // to unconditionally include in API requests. By default, fields with
  479. // empty values are omitted from API requests. However, any non-pointer,
  480. // non-interface field appearing in ForceSendFields will be sent to the
  481. // server regardless of whether the field is empty or not. This may be
  482. // used to include empty fields in Patch requests.
  483. ForceSendFields []string `json:"-"`
  484. }
  485. func (s *CcOfferRewards) MarshalJSON() ([]byte, error) {
  486. type noMethod CcOfferRewards
  487. raw := noMethod(*s)
  488. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  489. }
  490. type CcOffers struct {
  491. // Items: The credit card offers.
  492. Items []*CcOffer `json:"items,omitempty"`
  493. // Kind: The kind for a page of credit card offers.
  494. Kind string `json:"kind,omitempty"`
  495. // ServerResponse contains the HTTP response code and headers from the
  496. // server.
  497. googleapi.ServerResponse `json:"-"`
  498. // ForceSendFields is a list of field names (e.g. "Items") to
  499. // unconditionally include in API requests. By default, fields with
  500. // empty values are omitted from API requests. However, any non-pointer,
  501. // non-interface field appearing in ForceSendFields will be sent to the
  502. // server regardless of whether the field is empty or not. This may be
  503. // used to include empty fields in Patch requests.
  504. ForceSendFields []string `json:"-"`
  505. }
  506. func (s *CcOffers) MarshalJSON() ([]byte, error) {
  507. type noMethod CcOffers
  508. raw := noMethod(*s)
  509. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  510. }
  511. // Event: An EventResource.
  512. type Event struct {
  513. // AdvertiserId: The ID of advertiser for this event.
  514. AdvertiserId int64 `json:"advertiserId,omitempty,string"`
  515. // AdvertiserName: The name of the advertiser for this event.
  516. AdvertiserName string `json:"advertiserName,omitempty"`
  517. // ChargeId: The charge ID for this event. Only returned for charge
  518. // events.
  519. ChargeId string `json:"chargeId,omitempty"`
  520. // ChargeType: Charge type of the event
  521. // (other|slotting_fee|monthly_minimum|tier_bonus|debit|credit). Only
  522. // returned for charge events.
  523. ChargeType string `json:"chargeType,omitempty"`
  524. // CommissionableSales: Amount of money exchanged during the
  525. // transaction. Only returned for charge and conversion events.
  526. CommissionableSales *Money `json:"commissionableSales,omitempty"`
  527. // Earnings: Earnings by the publisher.
  528. Earnings *Money `json:"earnings,omitempty"`
  529. // EventDate: The date-time this event was initiated as a RFC 3339
  530. // date-time value.
  531. EventDate string `json:"eventDate,omitempty"`
  532. // Kind: The kind for one event.
  533. Kind string `json:"kind,omitempty"`
  534. // MemberId: The ID of the member attached to this event. Only returned
  535. // for conversion events.
  536. MemberId string `json:"memberId,omitempty"`
  537. // ModifyDate: The date-time this event was last modified as a RFC 3339
  538. // date-time value.
  539. ModifyDate string `json:"modifyDate,omitempty"`
  540. // NetworkFee: Fee that the advertiser paid to the Google Affiliate
  541. // Network.
  542. NetworkFee *Money `json:"networkFee,omitempty"`
  543. // OrderId: The order ID for this event. Only returned for conversion
  544. // events.
  545. OrderId string `json:"orderId,omitempty"`
  546. // Products: Products associated with the event.
  547. Products []*EventProducts `json:"products,omitempty"`
  548. // PublisherFee: Fee that the advertiser paid to the publisher.
  549. PublisherFee *Money `json:"publisherFee,omitempty"`
  550. // PublisherId: The ID of the publisher for this event.
  551. PublisherId int64 `json:"publisherId,omitempty,string"`
  552. // PublisherName: The name of the publisher for this event.
  553. PublisherName string `json:"publisherName,omitempty"`
  554. // Status: Status of the event (active|canceled). Only returned for
  555. // charge and conversion events.
  556. Status string `json:"status,omitempty"`
  557. // Type: Type of the event (action|transaction|charge).
  558. Type string `json:"type,omitempty"`
  559. // ForceSendFields is a list of field names (e.g. "AdvertiserId") to
  560. // unconditionally include in API requests. By default, fields with
  561. // empty values are omitted from API requests. However, any non-pointer,
  562. // non-interface field appearing in ForceSendFields will be sent to the
  563. // server regardless of whether the field is empty or not. This may be
  564. // used to include empty fields in Patch requests.
  565. ForceSendFields []string `json:"-"`
  566. }
  567. func (s *Event) MarshalJSON() ([]byte, error) {
  568. type noMethod Event
  569. raw := noMethod(*s)
  570. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  571. }
  572. type EventProducts struct {
  573. // CategoryId: Id of the category this product belongs to.
  574. CategoryId string `json:"categoryId,omitempty"`
  575. // CategoryName: Name of the category this product belongs to.
  576. CategoryName string `json:"categoryName,omitempty"`
  577. // Earnings: Amount earned by the publisher on this product.
  578. Earnings *Money `json:"earnings,omitempty"`
  579. // NetworkFee: Fee that the advertiser paid to the Google Affiliate
  580. // Network for this product.
  581. NetworkFee *Money `json:"networkFee,omitempty"`
  582. // PublisherFee: Fee that the advertiser paid to the publisehr for this
  583. // product.
  584. PublisherFee *Money `json:"publisherFee,omitempty"`
  585. // Quantity: Quantity of this product bought/exchanged.
  586. Quantity int64 `json:"quantity,omitempty,string"`
  587. // Sku: Sku of this product.
  588. Sku string `json:"sku,omitempty"`
  589. // SkuName: Sku name of this product.
  590. SkuName string `json:"skuName,omitempty"`
  591. // UnitPrice: Price per unit of this product.
  592. UnitPrice *Money `json:"unitPrice,omitempty"`
  593. // ForceSendFields is a list of field names (e.g. "CategoryId") to
  594. // unconditionally include in API requests. By default, fields with
  595. // empty values are omitted from API requests. However, any non-pointer,
  596. // non-interface field appearing in ForceSendFields will be sent to the
  597. // server regardless of whether the field is empty or not. This may be
  598. // used to include empty fields in Patch requests.
  599. ForceSendFields []string `json:"-"`
  600. }
  601. func (s *EventProducts) MarshalJSON() ([]byte, error) {
  602. type noMethod EventProducts
  603. raw := noMethod(*s)
  604. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  605. }
  606. type Events struct {
  607. // Items: The event list.
  608. Items []*Event `json:"items,omitempty"`
  609. // Kind: The kind for a page of events.
  610. Kind string `json:"kind,omitempty"`
  611. // NextPageToken: The 'pageToken' to pass to the next request to get the
  612. // next page, if there are more to retrieve.
  613. NextPageToken string `json:"nextPageToken,omitempty"`
  614. // ServerResponse contains the HTTP response code and headers from the
  615. // server.
  616. googleapi.ServerResponse `json:"-"`
  617. // ForceSendFields is a list of field names (e.g. "Items") to
  618. // unconditionally include in API requests. By default, fields with
  619. // empty values are omitted from API requests. However, any non-pointer,
  620. // non-interface field appearing in ForceSendFields will be sent to the
  621. // server regardless of whether the field is empty or not. This may be
  622. // used to include empty fields in Patch requests.
  623. ForceSendFields []string `json:"-"`
  624. }
  625. func (s *Events) MarshalJSON() ([]byte, error) {
  626. type noMethod Events
  627. raw := noMethod(*s)
  628. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  629. }
  630. // Link: A LinkResource.
  631. type Link struct {
  632. // AdvertiserId: The advertiser id for the advertiser who owns this
  633. // link.
  634. AdvertiserId int64 `json:"advertiserId,omitempty,string"`
  635. // Authorship: Authorship
  636. Authorship string `json:"authorship,omitempty"`
  637. // Availability: Availability.
  638. Availability string `json:"availability,omitempty"`
  639. // ClickTrackingUrl: Tracking url for clicks.
  640. ClickTrackingUrl string `json:"clickTrackingUrl,omitempty"`
  641. // CreateDate: Date that this link was created.
  642. CreateDate string `json:"createDate,omitempty"`
  643. // Description: Description.
  644. Description string `json:"description,omitempty"`
  645. // DestinationUrl: The destination URL for the link.
  646. DestinationUrl string `json:"destinationUrl,omitempty"`
  647. // Duration: Duration
  648. Duration string `json:"duration,omitempty"`
  649. // EndDate: Date that this link becomes inactive.
  650. EndDate string `json:"endDate,omitempty"`
  651. // EpcNinetyDayAverage: The sum of fees paid to publishers divided by
  652. // the total number of clicks over the past three months on this link.
  653. // This value should be multiplied by 100 at the time of display.
  654. EpcNinetyDayAverage *Money `json:"epcNinetyDayAverage,omitempty"`
  655. // EpcSevenDayAverage: The sum of fees paid to publishers divided by the
  656. // total number of clicks over the past seven days on this link. This
  657. // value should be multiplied by 100 at the time of display.
  658. EpcSevenDayAverage *Money `json:"epcSevenDayAverage,omitempty"`
  659. // Id: The ID of this link.
  660. Id int64 `json:"id,omitempty,string"`
  661. // ImageAltText: image alt text.
  662. ImageAltText string `json:"imageAltText,omitempty"`
  663. // ImpressionTrackingUrl: Tracking url for impressions.
  664. ImpressionTrackingUrl string `json:"impressionTrackingUrl,omitempty"`
  665. // IsActive: Flag for if this link is active.
  666. IsActive bool `json:"isActive,omitempty"`
  667. // Kind: The kind for one entity.
  668. Kind string `json:"kind,omitempty"`
  669. // LinkType: The link type.
  670. LinkType string `json:"linkType,omitempty"`
  671. // Name: The logical name for this link.
  672. Name string `json:"name,omitempty"`
  673. // PromotionType: Promotion Type
  674. PromotionType string `json:"promotionType,omitempty"`
  675. // SpecialOffers: Special offers on the link.
  676. SpecialOffers *LinkSpecialOffers `json:"specialOffers,omitempty"`
  677. // StartDate: Date that this link becomes active.
  678. StartDate string `json:"startDate,omitempty"`
  679. // ServerResponse contains the HTTP response code and headers from the
  680. // server.
  681. googleapi.ServerResponse `json:"-"`
  682. // ForceSendFields is a list of field names (e.g. "AdvertiserId") to
  683. // unconditionally include in API requests. By default, fields with
  684. // empty values are omitted from API requests. However, any non-pointer,
  685. // non-interface field appearing in ForceSendFields will be sent to the
  686. // server regardless of whether the field is empty or not. This may be
  687. // used to include empty fields in Patch requests.
  688. ForceSendFields []string `json:"-"`
  689. }
  690. func (s *Link) MarshalJSON() ([]byte, error) {
  691. type noMethod Link
  692. raw := noMethod(*s)
  693. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  694. }
  695. // LinkSpecialOffers: Special offers on the link.
  696. type LinkSpecialOffers struct {
  697. // FreeGift: Whether there is a free gift
  698. FreeGift bool `json:"freeGift,omitempty"`
  699. // FreeShipping: Whether there is free shipping
  700. FreeShipping bool `json:"freeShipping,omitempty"`
  701. // FreeShippingMin: Minimum purchase amount for free shipping promotion
  702. FreeShippingMin *Money `json:"freeShippingMin,omitempty"`
  703. // PercentOff: Percent off on the purchase
  704. PercentOff float64 `json:"percentOff,omitempty"`
  705. // PercentOffMin: Minimum purchase amount for percent off promotion
  706. PercentOffMin *Money `json:"percentOffMin,omitempty"`
  707. // PriceCut: Price cut on the purchase
  708. PriceCut *Money `json:"priceCut,omitempty"`
  709. // PriceCutMin: Minimum purchase amount for price cut promotion
  710. PriceCutMin *Money `json:"priceCutMin,omitempty"`
  711. // PromotionCodes: List of promotion code associated with the link
  712. PromotionCodes []string `json:"promotionCodes,omitempty"`
  713. // ForceSendFields is a list of field names (e.g. "FreeGift") to
  714. // unconditionally include in API requests. By default, fields with
  715. // empty values are omitted from API requests. However, any non-pointer,
  716. // non-interface field appearing in ForceSendFields will be sent to the
  717. // server regardless of whether the field is empty or not. This may be
  718. // used to include empty fields in Patch requests.
  719. ForceSendFields []string `json:"-"`
  720. }
  721. func (s *LinkSpecialOffers) MarshalJSON() ([]byte, error) {
  722. type noMethod LinkSpecialOffers
  723. raw := noMethod(*s)
  724. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  725. }
  726. type Links struct {
  727. // Items: The links.
  728. Items []*Link `json:"items,omitempty"`
  729. // Kind: The kind for a page of links.
  730. Kind string `json:"kind,omitempty"`
  731. // NextPageToken: The next page token.
  732. NextPageToken string `json:"nextPageToken,omitempty"`
  733. // ServerResponse contains the HTTP response code and headers from the
  734. // server.
  735. googleapi.ServerResponse `json:"-"`
  736. // ForceSendFields is a list of field names (e.g. "Items") to
  737. // unconditionally include in API requests. By default, fields with
  738. // empty values are omitted from API requests. However, any non-pointer,
  739. // non-interface field appearing in ForceSendFields will be sent to the
  740. // server regardless of whether the field is empty or not. This may be
  741. // used to include empty fields in Patch requests.
  742. ForceSendFields []string `json:"-"`
  743. }
  744. func (s *Links) MarshalJSON() ([]byte, error) {
  745. type noMethod Links
  746. raw := noMethod(*s)
  747. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  748. }
  749. // Money: An ApiMoneyProto.
  750. type Money struct {
  751. // Amount: The amount of money.
  752. Amount float64 `json:"amount,omitempty"`
  753. // CurrencyCode: The 3-letter code of the currency in question.
  754. CurrencyCode string `json:"currencyCode,omitempty"`
  755. // ForceSendFields is a list of field names (e.g. "Amount") to
  756. // unconditionally include in API requests. By default, fields with
  757. // empty values are omitted from API requests. However, any non-pointer,
  758. // non-interface field appearing in ForceSendFields will be sent to the
  759. // server regardless of whether the field is empty or not. This may be
  760. // used to include empty fields in Patch requests.
  761. ForceSendFields []string `json:"-"`
  762. }
  763. func (s *Money) MarshalJSON() ([]byte, error) {
  764. type noMethod Money
  765. raw := noMethod(*s)
  766. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  767. }
  768. // Publisher: A PublisherResource.
  769. type Publisher struct {
  770. // Classification: Classification that this publisher belongs to. See
  771. // this link for all publisher classifications:
  772. // http://www.google.com/support/affiliatenetwork/advertiser/bin/answer.py?hl=en&answer=107625&ctx=cb&src=cb&cbid=-k5fihzthfaik&cbrank=4
  773. Classification string `json:"classification,omitempty"`
  774. // EpcNinetyDayAverage: The sum of fees paid to this publisher divided
  775. // by the total number of clicks over the past three months. Values are
  776. // multiplied by 100 for display purposes.
  777. EpcNinetyDayAverage *Money `json:"epcNinetyDayAverage,omitempty"`
  778. // EpcSevenDayAverage: The sum of fees paid to this publisher divided by
  779. // the total number of clicks over the past seven days. Values are
  780. // multiplied by 100 for display purposes.
  781. EpcSevenDayAverage *Money `json:"epcSevenDayAverage,omitempty"`
  782. // Id: The ID of this publisher.
  783. Id int64 `json:"id,omitempty,string"`
  784. // Item: The requested publisher.
  785. Item *Publisher `json:"item,omitempty"`
  786. // JoinDate: Date that this publisher was approved as a Google Affiliate
  787. // Network publisher.
  788. JoinDate string `json:"joinDate,omitempty"`
  789. // Kind: The kind for a publisher.
  790. Kind string `json:"kind,omitempty"`
  791. // Name: The name of this publisher.
  792. Name string `json:"name,omitempty"`
  793. // PayoutRank: A rank based on commissions paid to this publisher over
  794. // the past 90 days. A number between 1 and 4 where 4 means the top
  795. // quartile (most money paid) and 1 means the bottom quartile (least
  796. // money paid).
  797. PayoutRank string `json:"payoutRank,omitempty"`
  798. // Sites: Websites that this publisher uses to advertise.
  799. Sites []string `json:"sites,omitempty"`
  800. // Status: The status of the requesting advertiser's relationship with
  801. // this publisher.
  802. Status string `json:"status,omitempty"`
  803. // ServerResponse contains the HTTP response code and headers from the
  804. // server.
  805. googleapi.ServerResponse `json:"-"`
  806. // ForceSendFields is a list of field names (e.g. "Classification") to
  807. // unconditionally include in API requests. By default, fields with
  808. // empty values are omitted from API requests. However, any non-pointer,
  809. // non-interface field appearing in ForceSendFields will be sent to the
  810. // server regardless of whether the field is empty or not. This may be
  811. // used to include empty fields in Patch requests.
  812. ForceSendFields []string `json:"-"`
  813. }
  814. func (s *Publisher) MarshalJSON() ([]byte, error) {
  815. type noMethod Publisher
  816. raw := noMethod(*s)
  817. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  818. }
  819. type Publishers struct {
  820. // Items: The entity list.
  821. Items []*Publisher `json:"items,omitempty"`
  822. // Kind: The kind for a page of entities.
  823. Kind string `json:"kind,omitempty"`
  824. // NextPageToken: The 'pageToken' to pass to the next request to get the
  825. // next page, if there are more to retrieve.
  826. NextPageToken string `json:"nextPageToken,omitempty"`
  827. // ServerResponse contains the HTTP response code and headers from the
  828. // server.
  829. googleapi.ServerResponse `json:"-"`
  830. // ForceSendFields is a list of field names (e.g. "Items") to
  831. // unconditionally include in API requests. By default, fields with
  832. // empty values are omitted from API requests. However, any non-pointer,
  833. // non-interface field appearing in ForceSendFields will be sent to the
  834. // server regardless of whether the field is empty or not. This may be
  835. // used to include empty fields in Patch requests.
  836. ForceSendFields []string `json:"-"`
  837. }
  838. func (s *Publishers) MarshalJSON() ([]byte, error) {
  839. type noMethod Publishers
  840. raw := noMethod(*s)
  841. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  842. }
  843. // Report: A ReportResource representing a report of a certain type
  844. // either for an advertiser or publisher.
  845. type Report struct {
  846. // ColumnNames: The column names for the report
  847. ColumnNames []string `json:"column_names,omitempty"`
  848. // EndDate: The end of the date range for this report, exclusive.
  849. EndDate string `json:"end_date,omitempty"`
  850. // Kind: The kind for a report.
  851. Kind string `json:"kind,omitempty"`
  852. // MatchingRowCount: The number of matching rows before paging is
  853. // applied.
  854. MatchingRowCount int64 `json:"matching_row_count,omitempty,string"`
  855. // Rows: The rows of data for the report
  856. Rows [][]interface{} `json:"rows,omitempty"`
  857. // StartDate: The start of the date range for this report, inclusive.
  858. StartDate string `json:"start_date,omitempty"`
  859. // TotalsRows: The totals rows for the report
  860. TotalsRows [][]interface{} `json:"totals_rows,omitempty"`
  861. // Type: The report type.
  862. Type string `json:"type,omitempty"`
  863. // ServerResponse contains the HTTP response code and headers from the
  864. // server.
  865. googleapi.ServerResponse `json:"-"`
  866. // ForceSendFields is a list of field names (e.g. "ColumnNames") to
  867. // unconditionally include in API requests. By default, fields with
  868. // empty values are omitted from API requests. However, any non-pointer,
  869. // non-interface field appearing in ForceSendFields will be sent to the
  870. // server regardless of whether the field is empty or not. This may be
  871. // used to include empty fields in Patch requests.
  872. ForceSendFields []string `json:"-"`
  873. }
  874. func (s *Report) MarshalJSON() ([]byte, error) {
  875. type noMethod Report
  876. raw := noMethod(*s)
  877. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  878. }
  879. // method id "gan.advertisers.get":
  880. type AdvertisersGetCall struct {
  881. s *Service
  882. role string
  883. roleId string
  884. urlParams_ gensupport.URLParams
  885. ifNoneMatch_ string
  886. ctx_ context.Context
  887. }
  888. // Get: Retrieves data about a single advertiser if that the requesting
  889. // advertiser/publisher has access to it. Only publishers can lookup
  890. // advertisers. Advertisers can request information about themselves by
  891. // omitting the advertiserId query parameter.
  892. func (r *AdvertisersService) Get(role string, roleId string) *AdvertisersGetCall {
  893. c := &AdvertisersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  894. c.role = role
  895. c.roleId = roleId
  896. return c
  897. }
  898. // AdvertiserId sets the optional parameter "advertiserId": The ID of
  899. // the advertiser to look up.
  900. func (c *AdvertisersGetCall) AdvertiserId(advertiserId string) *AdvertisersGetCall {
  901. c.urlParams_.Set("advertiserId", advertiserId)
  902. return c
  903. }
  904. // Fields allows partial responses to be retrieved. See
  905. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  906. // for more information.
  907. func (c *AdvertisersGetCall) Fields(s ...googleapi.Field) *AdvertisersGetCall {
  908. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  909. return c
  910. }
  911. // IfNoneMatch sets the optional parameter which makes the operation
  912. // fail if the object's ETag matches the given value. This is useful for
  913. // getting updates only after the object has changed since the last
  914. // request. Use googleapi.IsNotModified to check whether the response
  915. // error from Do is the result of In-None-Match.
  916. func (c *AdvertisersGetCall) IfNoneMatch(entityTag string) *AdvertisersGetCall {
  917. c.ifNoneMatch_ = entityTag
  918. return c
  919. }
  920. // Context sets the context to be used in this call's Do method. Any
  921. // pending HTTP request will be aborted if the provided context is
  922. // canceled.
  923. func (c *AdvertisersGetCall) Context(ctx context.Context) *AdvertisersGetCall {
  924. c.ctx_ = ctx
  925. return c
  926. }
  927. func (c *AdvertisersGetCall) doRequest(alt string) (*http.Response, error) {
  928. var body io.Reader = nil
  929. c.urlParams_.Set("alt", alt)
  930. urls := googleapi.ResolveRelative(c.s.BasePath, "{role}/{roleId}/advertiser")
  931. urls += "?" + c.urlParams_.Encode()
  932. req, _ := http.NewRequest("GET", urls, body)
  933. googleapi.Expand(req.URL, map[string]string{
  934. "role": c.role,
  935. "roleId": c.roleId,
  936. })
  937. req.Header.Set("User-Agent", c.s.userAgent())
  938. if c.ifNoneMatch_ != "" {
  939. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  940. }
  941. if c.ctx_ != nil {
  942. return ctxhttp.Do(c.ctx_, c.s.client, req)
  943. }
  944. return c.s.client.Do(req)
  945. }
  946. // Do executes the "gan.advertisers.get" call.
  947. // Exactly one of *Advertiser or error will be non-nil. Any non-2xx
  948. // status code is an error. Response headers are in either
  949. // *Advertiser.ServerResponse.Header or (if a response was returned at
  950. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  951. // to check whether the returned error was because
  952. // http.StatusNotModified was returned.
  953. func (c *AdvertisersGetCall) Do(opts ...googleapi.CallOption) (*Advertiser, error) {
  954. gensupport.SetOptions(c.urlParams_, opts...)
  955. res, err := c.doRequest("json")
  956. if res != nil && res.StatusCode == http.StatusNotModified {
  957. if res.Body != nil {
  958. res.Body.Close()
  959. }
  960. return nil, &googleapi.Error{
  961. Code: res.StatusCode,
  962. Header: res.Header,
  963. }
  964. }
  965. if err != nil {
  966. return nil, err
  967. }
  968. defer googleapi.CloseBody(res)
  969. if err := googleapi.CheckResponse(res); err != nil {
  970. return nil, err
  971. }
  972. ret := &Advertiser{
  973. ServerResponse: googleapi.ServerResponse{
  974. Header: res.Header,
  975. HTTPStatusCode: res.StatusCode,
  976. },
  977. }
  978. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  979. return nil, err
  980. }
  981. return ret, nil
  982. // {
  983. // "description": "Retrieves data about a single advertiser if that the requesting advertiser/publisher has access to it. Only publishers can lookup advertisers. Advertisers can request information about themselves by omitting the advertiserId query parameter.",
  984. // "httpMethod": "GET",
  985. // "id": "gan.advertisers.get",
  986. // "parameterOrder": [
  987. // "role",
  988. // "roleId"
  989. // ],
  990. // "parameters": {
  991. // "advertiserId": {
  992. // "description": "The ID of the advertiser to look up. Optional.",
  993. // "location": "query",
  994. // "type": "string"
  995. // },
  996. // "role": {
  997. // "description": "The role of the requester. Valid values: 'advertisers' or 'publishers'.",
  998. // "enum": [
  999. // "advertisers",
  1000. // "publishers"
  1001. // ],
  1002. // "enumDescriptions": [
  1003. // "The requester is requesting as an advertiser.",
  1004. // "The requester is requesting as a publisher."
  1005. // ],
  1006. // "location": "path",
  1007. // "required": true,
  1008. // "type": "string"
  1009. // },
  1010. // "roleId": {
  1011. // "description": "The ID of the requesting advertiser or publisher.",
  1012. // "location": "path",
  1013. // "required": true,
  1014. // "type": "string"
  1015. // }
  1016. // },
  1017. // "path": "{role}/{roleId}/advertiser",
  1018. // "response": {
  1019. // "$ref": "Advertiser"
  1020. // }
  1021. // }
  1022. }
  1023. // method id "gan.advertisers.list":
  1024. type AdvertisersListCall struct {
  1025. s *Service
  1026. role string
  1027. roleId string
  1028. urlParams_ gensupport.URLParams
  1029. ifNoneMatch_ string
  1030. ctx_ context.Context
  1031. }
  1032. // List: Retrieves data about all advertisers that the requesting
  1033. // advertiser/publisher has access to.
  1034. func (r *AdvertisersService) List(role string, roleId string) *AdvertisersListCall {
  1035. c := &AdvertisersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1036. c.role = role
  1037. c.roleId = roleId
  1038. return c
  1039. }
  1040. // AdvertiserCategory sets the optional parameter "advertiserCategory":
  1041. // Caret(^) delimted list of advertiser categories. Valid categories are
  1042. // defined here:
  1043. // http://www.google.com/support/affiliatenetwork/advertiser/bin/answer.py?hl=en&answer=107581. Filters out all advertisers not in one of the given advertiser
  1044. // categories.
  1045. func (c *AdvertisersListCall) AdvertiserCategory(advertiserCategory string) *AdvertisersListCall {
  1046. c.urlParams_.Set("advertiserCategory", advertiserCategory)
  1047. return c
  1048. }
  1049. // MaxResults sets the optional parameter "maxResults": Max number of
  1050. // items to return in this page. Defaults to 20.
  1051. func (c *AdvertisersListCall) MaxResults(maxResults int64) *AdvertisersListCall {
  1052. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1053. return c
  1054. }
  1055. // MinNinetyDayEpc sets the optional parameter "minNinetyDayEpc":
  1056. // Filters out all advertisers that have a ninety day EPC average lower
  1057. // than the given value (inclusive). Min value: 0.0.
  1058. func (c *AdvertisersListCall) MinNinetyDayEpc(minNinetyDayEpc float64) *AdvertisersListCall {
  1059. c.urlParams_.Set("minNinetyDayEpc", fmt.Sprint(minNinetyDayEpc))
  1060. return c
  1061. }
  1062. // MinPayoutRank sets the optional parameter "minPayoutRank": A value
  1063. // between 1 and 4, where 1 represents the quartile of advertisers with
  1064. // the lowest ranks and 4 represents the quartile of advertisers with
  1065. // the highest ranks. Filters out all advertisers with a lower rank than
  1066. // the given quartile. For example if a 2 was given only advertisers
  1067. // with a payout rank of 25 or higher would be included.
  1068. func (c *AdvertisersListCall) MinPayoutRank(minPayoutRank int64) *AdvertisersListCall {
  1069. c.urlParams_.Set("minPayoutRank", fmt.Sprint(minPayoutRank))
  1070. return c
  1071. }
  1072. // MinSevenDayEpc sets the optional parameter "minSevenDayEpc": Filters
  1073. // out all advertisers that have a seven day EPC average lower than the
  1074. // given value (inclusive). Min value: 0.0.
  1075. func (c *AdvertisersListCall) MinSevenDayEpc(minSevenDayEpc float64) *AdvertisersListCall {
  1076. c.urlParams_.Set("minSevenDayEpc", fmt.Sprint(minSevenDayEpc))
  1077. return c
  1078. }
  1079. // PageToken sets the optional parameter "pageToken": The value of
  1080. // 'nextPageToken' from the previous page.
  1081. func (c *AdvertisersListCall) PageToken(pageToken string) *AdvertisersListCall {
  1082. c.urlParams_.Set("pageToken", pageToken)
  1083. return c
  1084. }
  1085. // RelationshipStatus sets the optional parameter "relationshipStatus":
  1086. // Filters out all advertisers for which do not have the given
  1087. // relationship status with the requesting publisher.
  1088. //
  1089. // Possible values:
  1090. // "approved" - An advertiser that has approved your application.
  1091. // "available" - An advertiser program that's accepting new
  1092. // publishers.
  1093. // "deactivated" - Deactivated means either the advertiser has removed
  1094. // you from their program, or it could also mean that you chose to
  1095. // remove yourself from the advertiser's program.
  1096. // "declined" - An advertiser that did not approve your application.
  1097. // "pending" - An advertiser program that you've already applied to,
  1098. // but they haven't yet decided to approve or decline your application.
  1099. func (c *AdvertisersListCall) RelationshipStatus(relationshipStatus string) *AdvertisersListCall {
  1100. c.urlParams_.Set("relationshipStatus", relationshipStatus)
  1101. return c
  1102. }
  1103. // Fields allows partial responses to be retrieved. See
  1104. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1105. // for more information.
  1106. func (c *AdvertisersListCall) Fields(s ...googleapi.Field) *AdvertisersListCall {
  1107. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1108. return c
  1109. }
  1110. // IfNoneMatch sets the optional parameter which makes the operation
  1111. // fail if the object's ETag matches the given value. This is useful for
  1112. // getting updates only after the object has changed since the last
  1113. // request. Use googleapi.IsNotModified to check whether the response
  1114. // error from Do is the result of In-None-Match.
  1115. func (c *AdvertisersListCall) IfNoneMatch(entityTag string) *AdvertisersListCall {
  1116. c.ifNoneMatch_ = entityTag
  1117. return c
  1118. }
  1119. // Context sets the context to be used in this call's Do method. Any
  1120. // pending HTTP request will be aborted if the provided context is
  1121. // canceled.
  1122. func (c *AdvertisersListCall) Context(ctx context.Context) *AdvertisersListCall {
  1123. c.ctx_ = ctx
  1124. return c
  1125. }
  1126. func (c *AdvertisersListCall) doRequest(alt string) (*http.Response, error) {
  1127. var body io.Reader = nil
  1128. c.urlParams_.Set("alt", alt)
  1129. urls := googleapi.ResolveRelative(c.s.BasePath, "{role}/{roleId}/advertisers")
  1130. urls += "?" + c.urlParams_.Encode()
  1131. req, _ := http.NewRequest("GET", urls, body)
  1132. googleapi.Expand(req.URL, map[string]string{
  1133. "role": c.role,
  1134. "roleId": c.roleId,
  1135. })
  1136. req.Header.Set("User-Agent", c.s.userAgent())
  1137. if c.ifNoneMatch_ != "" {
  1138. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1139. }
  1140. if c.ctx_ != nil {
  1141. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1142. }
  1143. return c.s.client.Do(req)
  1144. }
  1145. // Do executes the "gan.advertisers.list" call.
  1146. // Exactly one of *Advertisers or error will be non-nil. Any non-2xx
  1147. // status code is an error. Response headers are in either
  1148. // *Advertisers.ServerResponse.Header or (if a response was returned at
  1149. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1150. // to check whether the returned error was because
  1151. // http.StatusNotModified was returned.
  1152. func (c *AdvertisersListCall) Do(opts ...googleapi.CallOption) (*Advertisers, error) {
  1153. gensupport.SetOptions(c.urlParams_, opts...)
  1154. res, err := c.doRequest("json")
  1155. if res != nil && res.StatusCode == http.StatusNotModified {
  1156. if res.Body != nil {
  1157. res.Body.Close()
  1158. }
  1159. return nil, &googleapi.Error{
  1160. Code: res.StatusCode,
  1161. Header: res.Header,
  1162. }
  1163. }
  1164. if err != nil {
  1165. return nil, err
  1166. }
  1167. defer googleapi.CloseBody(res)
  1168. if err := googleapi.CheckResponse(res); err != nil {
  1169. return nil, err
  1170. }
  1171. ret := &Advertisers{
  1172. ServerResponse: googleapi.ServerResponse{
  1173. Header: res.Header,
  1174. HTTPStatusCode: res.StatusCode,
  1175. },
  1176. }
  1177. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1178. return nil, err
  1179. }
  1180. return ret, nil
  1181. // {
  1182. // "description": "Retrieves data about all advertisers that the requesting advertiser/publisher has access to.",
  1183. // "httpMethod": "GET",
  1184. // "id": "gan.advertisers.list",
  1185. // "parameterOrder": [
  1186. // "role",
  1187. // "roleId"
  1188. // ],
  1189. // "parameters": {
  1190. // "advertiserCategory": {
  1191. // "description": "Caret(^) delimted list of advertiser categories. Valid categories are defined here: http://www.google.com/support/affiliatenetwork/advertiser/bin/answer.py?hl=en\u0026answer=107581. Filters out all advertisers not in one of the given advertiser categories. Optional.",
  1192. // "location": "query",
  1193. // "type": "string"
  1194. // },
  1195. // "maxResults": {
  1196. // "description": "Max number of items to return in this page. Optional. Defaults to 20.",
  1197. // "format": "uint32",
  1198. // "location": "query",
  1199. // "maximum": "100",
  1200. // "minimum": "0",
  1201. // "type": "integer"
  1202. // },
  1203. // "minNinetyDayEpc": {
  1204. // "description": "Filters out all advertisers that have a ninety day EPC average lower than the given value (inclusive). Min value: 0.0. Optional.",
  1205. // "format": "double",
  1206. // "location": "query",
  1207. // "type": "number"
  1208. // },
  1209. // "minPayoutRank": {
  1210. // "description": "A value between 1 and 4, where 1 represents the quartile of advertisers with the lowest ranks and 4 represents the quartile of advertisers with the highest ranks. Filters out all advertisers with a lower rank than the given quartile. For example if a 2 was given only advertisers with a payout rank of 25 or higher would be included. Optional.",
  1211. // "format": "int32",
  1212. // "location": "query",
  1213. // "maximum": "4",
  1214. // "minimum": "1",
  1215. // "type": "integer"
  1216. // },
  1217. // "minSevenDayEpc": {
  1218. // "description": "Filters out all advertisers that have a seven day EPC average lower than the given value (inclusive). Min value: 0.0. Optional.",
  1219. // "format": "double",
  1220. // "location": "query",
  1221. // "type": "number"
  1222. // },
  1223. // "pageToken": {
  1224. // "description": "The value of 'nextPageToken' from the previous page. Optional.",
  1225. // "location": "query",
  1226. // "type": "string"
  1227. // },
  1228. // "relationshipStatus": {
  1229. // "description": "Filters out all advertisers for which do not have the given relationship status with the requesting publisher.",
  1230. // "enum": [
  1231. // "approved",
  1232. // "available",
  1233. // "deactivated",
  1234. // "declined",
  1235. // "pending"
  1236. // ],
  1237. // "enumDescriptions": [
  1238. // "An advertiser that has approved your application.",
  1239. // "An advertiser program that's accepting new publishers.",
  1240. // "Deactivated means either the advertiser has removed you from their program, or it could also mean that you chose to remove yourself from the advertiser's program.",
  1241. // "An advertiser that did not approve your application.",
  1242. // "An advertiser program that you've already applied to, but they haven't yet decided to approve or decline your application."
  1243. // ],
  1244. // "location": "query",
  1245. // "type": "string"
  1246. // },
  1247. // "role": {
  1248. // "description": "The role of the requester. Valid values: 'advertisers' or 'publishers'.",
  1249. // "enum": [
  1250. // "advertisers",
  1251. // "publishers"
  1252. // ],
  1253. // "enumDescriptions": [
  1254. // "The requester is requesting as an advertiser.",
  1255. // "The requester is requesting as a publisher."
  1256. // ],
  1257. // "location": "path",
  1258. // "required": true,
  1259. // "type": "string"
  1260. // },
  1261. // "roleId": {
  1262. // "description": "The ID of the requesting advertiser or publisher.",
  1263. // "location": "path",
  1264. // "required": true,
  1265. // "type": "string"
  1266. // }
  1267. // },
  1268. // "path": "{role}/{roleId}/advertisers",
  1269. // "response": {
  1270. // "$ref": "Advertisers"
  1271. // }
  1272. // }
  1273. }
  1274. // Pages invokes f for each page of results.
  1275. // A non-nil error returned from f will halt the iteration.
  1276. // The provided context supersedes any context provided to the Context method.
  1277. func (c *AdvertisersListCall) Pages(ctx context.Context, f func(*Advertisers) error) error {
  1278. c.ctx_ = ctx
  1279. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1280. for {
  1281. x, err := c.Do()
  1282. if err != nil {
  1283. return err
  1284. }
  1285. if err := f(x); err != nil {
  1286. return err
  1287. }
  1288. if x.NextPageToken == "" {
  1289. return nil
  1290. }
  1291. c.PageToken(x.NextPageToken)
  1292. }
  1293. }
  1294. // method id "gan.ccOffers.list":
  1295. type CcOffersListCall struct {
  1296. s *Service
  1297. publisher string
  1298. urlParams_ gensupport.URLParams
  1299. ifNoneMatch_ string
  1300. ctx_ context.Context
  1301. }
  1302. // List: Retrieves credit card offers for the given publisher.
  1303. func (r *CcOffersService) List(publisher string) *CcOffersListCall {
  1304. c := &CcOffersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1305. c.publisher = publisher
  1306. return c
  1307. }
  1308. // Advertiser sets the optional parameter "advertiser": The advertiser
  1309. // ID of a card issuer whose offers to include. Optional, may be
  1310. // repeated.
  1311. func (c *CcOffersListCall) Advertiser(advertiser ...string) *CcOffersListCall {
  1312. c.urlParams_.SetMulti("advertiser", append([]string{}, advertiser...))
  1313. return c
  1314. }
  1315. // Projection sets the optional parameter "projection": The set of
  1316. // fields to return.
  1317. //
  1318. // Possible values:
  1319. // "full" - Include all offer fields. This is the default.
  1320. // "summary" - Include only the basic fields needed to display an
  1321. // offer.
  1322. func (c *CcOffersListCall) Projection(projection string) *CcOffersListCall {
  1323. c.urlParams_.Set("projection", projection)
  1324. return c
  1325. }
  1326. // Fields allows partial responses to be retrieved. See
  1327. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1328. // for more information.
  1329. func (c *CcOffersListCall) Fields(s ...googleapi.Field) *CcOffersListCall {
  1330. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1331. return c
  1332. }
  1333. // IfNoneMatch sets the optional parameter which makes the operation
  1334. // fail if the object's ETag matches the given value. This is useful for
  1335. // getting updates only after the object has changed since the last
  1336. // request. Use googleapi.IsNotModified to check whether the response
  1337. // error from Do is the result of In-None-Match.
  1338. func (c *CcOffersListCall) IfNoneMatch(entityTag string) *CcOffersListCall {
  1339. c.ifNoneMatch_ = entityTag
  1340. return c
  1341. }
  1342. // Context sets the context to be used in this call's Do method. Any
  1343. // pending HTTP request will be aborted if the provided context is
  1344. // canceled.
  1345. func (c *CcOffersListCall) Context(ctx context.Context) *CcOffersListCall {
  1346. c.ctx_ = ctx
  1347. return c
  1348. }
  1349. func (c *CcOffersListCall) doRequest(alt string) (*http.Response, error) {
  1350. var body io.Reader = nil
  1351. c.urlParams_.Set("alt", alt)
  1352. urls := googleapi.ResolveRelative(c.s.BasePath, "publishers/{publisher}/ccOffers")
  1353. urls += "?" + c.urlParams_.Encode()
  1354. req, _ := http.NewRequest("GET", urls, body)
  1355. googleapi.Expand(req.URL, map[string]string{
  1356. "publisher": c.publisher,
  1357. })
  1358. req.Header.Set("User-Agent", c.s.userAgent())
  1359. if c.ifNoneMatch_ != "" {
  1360. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1361. }
  1362. if c.ctx_ != nil {
  1363. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1364. }
  1365. return c.s.client.Do(req)
  1366. }
  1367. // Do executes the "gan.ccOffers.list" call.
  1368. // Exactly one of *CcOffers or error will be non-nil. Any non-2xx status
  1369. // code is an error. Response headers are in either
  1370. // *CcOffers.ServerResponse.Header or (if a response was returned at
  1371. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1372. // to check whether the returned error was because
  1373. // http.StatusNotModified was returned.
  1374. func (c *CcOffersListCall) Do(opts ...googleapi.CallOption) (*CcOffers, error) {
  1375. gensupport.SetOptions(c.urlParams_, opts...)
  1376. res, err := c.doRequest("json")
  1377. if res != nil && res.StatusCode == http.StatusNotModified {
  1378. if res.Body != nil {
  1379. res.Body.Close()
  1380. }
  1381. return nil, &googleapi.Error{
  1382. Code: res.StatusCode,
  1383. Header: res.Header,
  1384. }
  1385. }
  1386. if err != nil {
  1387. return nil, err
  1388. }
  1389. defer googleapi.CloseBody(res)
  1390. if err := googleapi.CheckResponse(res); err != nil {
  1391. return nil, err
  1392. }
  1393. ret := &CcOffers{
  1394. ServerResponse: googleapi.ServerResponse{
  1395. Header: res.Header,
  1396. HTTPStatusCode: res.StatusCode,
  1397. },
  1398. }
  1399. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1400. return nil, err
  1401. }
  1402. return ret, nil
  1403. // {
  1404. // "description": "Retrieves credit card offers for the given publisher.",
  1405. // "httpMethod": "GET",
  1406. // "id": "gan.ccOffers.list",
  1407. // "parameterOrder": [
  1408. // "publisher"
  1409. // ],
  1410. // "parameters": {
  1411. // "advertiser": {
  1412. // "description": "The advertiser ID of a card issuer whose offers to include. Optional, may be repeated.",
  1413. // "location": "query",
  1414. // "repeated": true,
  1415. // "type": "string"
  1416. // },
  1417. // "projection": {
  1418. // "description": "The set of fields to return.",
  1419. // "enum": [
  1420. // "full",
  1421. // "summary"
  1422. // ],
  1423. // "enumDescriptions": [
  1424. // "Include all offer fields. This is the default.",
  1425. // "Include only the basic fields needed to display an offer."
  1426. // ],
  1427. // "location": "query",
  1428. // "type": "string"
  1429. // },
  1430. // "publisher": {
  1431. // "description": "The ID of the publisher in question.",
  1432. // "location": "path",
  1433. // "required": true,
  1434. // "type": "string"
  1435. // }
  1436. // },
  1437. // "path": "publishers/{publisher}/ccOffers",
  1438. // "response": {
  1439. // "$ref": "CcOffers"
  1440. // }
  1441. // }
  1442. }
  1443. // method id "gan.events.list":
  1444. type EventsListCall struct {
  1445. s *Service
  1446. role string
  1447. roleId string
  1448. urlParams_ gensupport.URLParams
  1449. ifNoneMatch_ string
  1450. ctx_ context.Context
  1451. }
  1452. // List: Retrieves event data for a given advertiser/publisher.
  1453. func (r *EventsService) List(role string, roleId string) *EventsListCall {
  1454. c := &EventsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1455. c.role = role
  1456. c.roleId = roleId
  1457. return c
  1458. }
  1459. // AdvertiserId sets the optional parameter "advertiserId": Caret(^)
  1460. // delimited list of advertiser IDs. Filters out all events that do not
  1461. // reference one of the given advertiser IDs. Only used when under
  1462. // publishers role.
  1463. func (c *EventsListCall) AdvertiserId(advertiserId string) *EventsListCall {
  1464. c.urlParams_.Set("advertiserId", advertiserId)
  1465. return c
  1466. }
  1467. // ChargeType sets the optional parameter "chargeType": Filters out all
  1468. // charge events that are not of the given charge type. Valid values:
  1469. // 'other', 'slotting_fee', 'monthly_minimum', 'tier_bonus', 'credit',
  1470. // 'debit'.
  1471. //
  1472. // Possible values:
  1473. // "credit" - A credit increases the publisher's payout amount and
  1474. // decreases the advertiser's invoice amount.
  1475. // "debit" - A debit reduces the publisher's payout and increases the
  1476. // advertiser's invoice amount.
  1477. // "monthly_minimum" - A payment made to Google by an advertiser as a
  1478. // minimum monthly network fee.
  1479. // "other" - Catch all. Default if unset
  1480. // "slotting_fee" - A one time payment made from an advertiser to a
  1481. // publisher.
  1482. // "tier_bonus" - A payment from an advertiser to a publisher for the
  1483. // publisher maintaining a high tier level
  1484. func (c *EventsListCall) ChargeType(chargeType string) *EventsListCall {
  1485. c.urlParams_.Set("chargeType", chargeType)
  1486. return c
  1487. }
  1488. // EventDateMax sets the optional parameter "eventDateMax": Filters out
  1489. // all events later than given date. Defaults to 24 hours after
  1490. // eventMin.
  1491. func (c *EventsListCall) EventDateMax(eventDateMax string) *EventsListCall {
  1492. c.urlParams_.Set("eventDateMax", eventDateMax)
  1493. return c
  1494. }
  1495. // EventDateMin sets the optional parameter "eventDateMin": Filters out
  1496. // all events earlier than given date. Defaults to 24 hours from
  1497. // current date/time.
  1498. func (c *EventsListCall) EventDateMin(eventDateMin string) *EventsListCall {
  1499. c.urlParams_.Set("eventDateMin", eventDateMin)
  1500. return c
  1501. }
  1502. // LinkId sets the optional parameter "linkId": Caret(^) delimited list
  1503. // of link IDs. Filters out all events that do not reference one of the
  1504. // given link IDs.
  1505. func (c *EventsListCall) LinkId(linkId string) *EventsListCall {
  1506. c.urlParams_.Set("linkId", linkId)
  1507. return c
  1508. }
  1509. // MaxResults sets the optional parameter "maxResults": Max number of
  1510. // offers to return in this page. Defaults to 20.
  1511. func (c *EventsListCall) MaxResults(maxResults int64) *EventsListCall {
  1512. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1513. return c
  1514. }
  1515. // MemberId sets the optional parameter "memberId": Caret(^) delimited
  1516. // list of member IDs. Filters out all events that do not reference one
  1517. // of the given member IDs.
  1518. func (c *EventsListCall) MemberId(memberId string) *EventsListCall {
  1519. c.urlParams_.Set("memberId", memberId)
  1520. return c
  1521. }
  1522. // ModifyDateMax sets the optional parameter "modifyDateMax": Filters
  1523. // out all events modified later than given date. Defaults to 24 hours
  1524. // after modifyDateMin, if modifyDateMin is explicitly set.
  1525. func (c *EventsListCall) ModifyDateMax(modifyDateMax string) *EventsListCall {
  1526. c.urlParams_.Set("modifyDateMax", modifyDateMax)
  1527. return c
  1528. }
  1529. // ModifyDateMin sets the optional parameter "modifyDateMin": Filters
  1530. // out all events modified earlier than given date. Defaults to 24
  1531. // hours before the current modifyDateMax, if modifyDateMax is
  1532. // explicitly set.
  1533. func (c *EventsListCall) ModifyDateMin(modifyDateMin string) *EventsListCall {
  1534. c.urlParams_.Set("modifyDateMin", modifyDateMin)
  1535. return c
  1536. }
  1537. // OrderId sets the optional parameter "orderId": Caret(^) delimited
  1538. // list of order IDs. Filters out all events that do not reference one
  1539. // of the given order IDs.
  1540. func (c *EventsListCall) OrderId(orderId string) *EventsListCall {
  1541. c.urlParams_.Set("orderId", orderId)
  1542. return c
  1543. }
  1544. // PageToken sets the optional parameter "pageToken": The value of
  1545. // 'nextPageToken' from the previous page.
  1546. func (c *EventsListCall) PageToken(pageToken string) *EventsListCall {
  1547. c.urlParams_.Set("pageToken", pageToken)
  1548. return c
  1549. }
  1550. // ProductCategory sets the optional parameter "productCategory":
  1551. // Caret(^) delimited list of product categories. Filters out all events
  1552. // that do not reference a product in one of the given product
  1553. // categories.
  1554. func (c *EventsListCall) ProductCategory(productCategory string) *EventsListCall {
  1555. c.urlParams_.Set("productCategory", productCategory)
  1556. return c
  1557. }
  1558. // PublisherId sets the optional parameter "publisherId": Caret(^)
  1559. // delimited list of publisher IDs. Filters out all events that do not
  1560. // reference one of the given publishers IDs. Only used when under
  1561. // advertiser role.
  1562. func (c *EventsListCall) PublisherId(publisherId string) *EventsListCall {
  1563. c.urlParams_.Set("publisherId", publisherId)
  1564. return c
  1565. }
  1566. // Sku sets the optional parameter "sku": Caret(^) delimited list of
  1567. // SKUs. Filters out all events that do not reference one of the given
  1568. // SKU.
  1569. func (c *EventsListCall) Sku(sku string) *EventsListCall {
  1570. c.urlParams_.Set("sku", sku)
  1571. return c
  1572. }
  1573. // Status sets the optional parameter "status": Filters out all events
  1574. // that do not have the given status. Valid values: 'active',
  1575. // 'canceled'.
  1576. //
  1577. // Possible values:
  1578. // "active" - Event is currently active.
  1579. // "canceled" - Event is currently canceled.
  1580. func (c *EventsListCall) Status(status string) *EventsListCall {
  1581. c.urlParams_.Set("status", status)
  1582. return c
  1583. }
  1584. // Type sets the optional parameter "type": Filters out all events that
  1585. // are not of the given type. Valid values: 'action', 'transaction',
  1586. // 'charge'.
  1587. //
  1588. // Possible values:
  1589. // "action" - The completion of an application, sign-up, or other
  1590. // process. For example, an action occurs if a user clicks an ad for a
  1591. // credit card and completes an application for that card.
  1592. // "charge" - A charge event is typically a payment between an
  1593. // advertiser, publisher or Google.
  1594. // "transaction" - A conversion event, typically an e-commerce
  1595. // transaction. Some advertisers use a transaction to record other types
  1596. // of events, such as magazine subscriptions.
  1597. func (c *EventsListCall) Type(type_ string) *EventsListCall {
  1598. c.urlParams_.Set("type", type_)
  1599. return c
  1600. }
  1601. // Fields allows partial responses to be retrieved. See
  1602. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1603. // for more information.
  1604. func (c *EventsListCall) Fields(s ...googleapi.Field) *EventsListCall {
  1605. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1606. return c
  1607. }
  1608. // IfNoneMatch sets the optional parameter which makes the operation
  1609. // fail if the object's ETag matches the given value. This is useful for
  1610. // getting updates only after the object has changed since the last
  1611. // request. Use googleapi.IsNotModified to check whether the response
  1612. // error from Do is the result of In-None-Match.
  1613. func (c *EventsListCall) IfNoneMatch(entityTag string) *EventsListCall {
  1614. c.ifNoneMatch_ = entityTag
  1615. return c
  1616. }
  1617. // Context sets the context to be used in this call's Do method. Any
  1618. // pending HTTP request will be aborted if the provided context is
  1619. // canceled.
  1620. func (c *EventsListCall) Context(ctx context.Context) *EventsListCall {
  1621. c.ctx_ = ctx
  1622. return c
  1623. }
  1624. func (c *EventsListCall) doRequest(alt string) (*http.Response, error) {
  1625. var body io.Reader = nil
  1626. c.urlParams_.Set("alt", alt)
  1627. urls := googleapi.ResolveRelative(c.s.BasePath, "{role}/{roleId}/events")
  1628. urls += "?" + c.urlParams_.Encode()
  1629. req, _ := http.NewRequest("GET", urls, body)
  1630. googleapi.Expand(req.URL, map[string]string{
  1631. "role": c.role,
  1632. "roleId": c.roleId,
  1633. })
  1634. req.Header.Set("User-Agent", c.s.userAgent())
  1635. if c.ifNoneMatch_ != "" {
  1636. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1637. }
  1638. if c.ctx_ != nil {
  1639. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1640. }
  1641. return c.s.client.Do(req)
  1642. }
  1643. // Do executes the "gan.events.list" call.
  1644. // Exactly one of *Events or error will be non-nil. Any non-2xx status
  1645. // code is an error. Response headers are in either
  1646. // *Events.ServerResponse.Header or (if a response was returned at all)
  1647. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1648. // check whether the returned error was because http.StatusNotModified
  1649. // was returned.
  1650. func (c *EventsListCall) Do(opts ...googleapi.CallOption) (*Events, error) {
  1651. gensupport.SetOptions(c.urlParams_, opts...)
  1652. res, err := c.doRequest("json")
  1653. if res != nil && res.StatusCode == http.StatusNotModified {
  1654. if res.Body != nil {
  1655. res.Body.Close()
  1656. }
  1657. return nil, &googleapi.Error{
  1658. Code: res.StatusCode,
  1659. Header: res.Header,
  1660. }
  1661. }
  1662. if err != nil {
  1663. return nil, err
  1664. }
  1665. defer googleapi.CloseBody(res)
  1666. if err := googleapi.CheckResponse(res); err != nil {
  1667. return nil, err
  1668. }
  1669. ret := &Events{
  1670. ServerResponse: googleapi.ServerResponse{
  1671. Header: res.Header,
  1672. HTTPStatusCode: res.StatusCode,
  1673. },
  1674. }
  1675. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1676. return nil, err
  1677. }
  1678. return ret, nil
  1679. // {
  1680. // "description": "Retrieves event data for a given advertiser/publisher.",
  1681. // "httpMethod": "GET",
  1682. // "id": "gan.events.list",
  1683. // "parameterOrder": [
  1684. // "role",
  1685. // "roleId"
  1686. // ],
  1687. // "parameters": {
  1688. // "advertiserId": {
  1689. // "description": "Caret(^) delimited list of advertiser IDs. Filters out all events that do not reference one of the given advertiser IDs. Only used when under publishers role. Optional.",
  1690. // "location": "query",
  1691. // "type": "string"
  1692. // },
  1693. // "chargeType": {
  1694. // "description": "Filters out all charge events that are not of the given charge type. Valid values: 'other', 'slotting_fee', 'monthly_minimum', 'tier_bonus', 'credit', 'debit'. Optional.",
  1695. // "enum": [
  1696. // "credit",
  1697. // "debit",
  1698. // "monthly_minimum",
  1699. // "other",
  1700. // "slotting_fee",
  1701. // "tier_bonus"
  1702. // ],
  1703. // "enumDescriptions": [
  1704. // "A credit increases the publisher's payout amount and decreases the advertiser's invoice amount.",
  1705. // "A debit reduces the publisher's payout and increases the advertiser's invoice amount.",
  1706. // "A payment made to Google by an advertiser as a minimum monthly network fee.",
  1707. // "Catch all. Default if unset",
  1708. // "A one time payment made from an advertiser to a publisher.",
  1709. // "A payment from an advertiser to a publisher for the publisher maintaining a high tier level"
  1710. // ],
  1711. // "location": "query",
  1712. // "type": "string"
  1713. // },
  1714. // "eventDateMax": {
  1715. // "description": "Filters out all events later than given date. Optional. Defaults to 24 hours after eventMin.",
  1716. // "location": "query",
  1717. // "type": "string"
  1718. // },
  1719. // "eventDateMin": {
  1720. // "description": "Filters out all events earlier than given date. Optional. Defaults to 24 hours from current date/time.",
  1721. // "location": "query",
  1722. // "type": "string"
  1723. // },
  1724. // "linkId": {
  1725. // "description": "Caret(^) delimited list of link IDs. Filters out all events that do not reference one of the given link IDs. Optional.",
  1726. // "location": "query",
  1727. // "type": "string"
  1728. // },
  1729. // "maxResults": {
  1730. // "description": "Max number of offers to return in this page. Optional. Defaults to 20.",
  1731. // "format": "uint32",
  1732. // "location": "query",
  1733. // "maximum": "100",
  1734. // "minimum": "0",
  1735. // "type": "integer"
  1736. // },
  1737. // "memberId": {
  1738. // "description": "Caret(^) delimited list of member IDs. Filters out all events that do not reference one of the given member IDs. Optional.",
  1739. // "location": "query",
  1740. // "type": "string"
  1741. // },
  1742. // "modifyDateMax": {
  1743. // "description": "Filters out all events modified later than given date. Optional. Defaults to 24 hours after modifyDateMin, if modifyDateMin is explicitly set.",
  1744. // "location": "query",
  1745. // "type": "string"
  1746. // },
  1747. // "modifyDateMin": {
  1748. // "description": "Filters out all events modified earlier than given date. Optional. Defaults to 24 hours before the current modifyDateMax, if modifyDateMax is explicitly set.",
  1749. // "location": "query",
  1750. // "type": "string"
  1751. // },
  1752. // "orderId": {
  1753. // "description": "Caret(^) delimited list of order IDs. Filters out all events that do not reference one of the given order IDs. Optional.",
  1754. // "location": "query",
  1755. // "type": "string"
  1756. // },
  1757. // "pageToken": {
  1758. // "description": "The value of 'nextPageToken' from the previous page. Optional.",
  1759. // "location": "query",
  1760. // "type": "string"
  1761. // },
  1762. // "productCategory": {
  1763. // "description": "Caret(^) delimited list of product categories. Filters out all events that do not reference a product in one of the given product categories. Optional.",
  1764. // "location": "query",
  1765. // "type": "string"
  1766. // },
  1767. // "publisherId": {
  1768. // "description": "Caret(^) delimited list of publisher IDs. Filters out all events that do not reference one of the given publishers IDs. Only used when under advertiser role. Optional.",
  1769. // "location": "query",
  1770. // "type": "string"
  1771. // },
  1772. // "role": {
  1773. // "description": "The role of the requester. Valid values: 'advertisers' or 'publishers'.",
  1774. // "enum": [
  1775. // "advertisers",
  1776. // "publishers"
  1777. // ],
  1778. // "enumDescriptions": [
  1779. // "The requester is requesting as an advertiser.",
  1780. // "The requester is requesting as a publisher."
  1781. // ],
  1782. // "location": "path",
  1783. // "required": true,
  1784. // "type": "string"
  1785. // },
  1786. // "roleId": {
  1787. // "description": "The ID of the requesting advertiser or publisher.",
  1788. // "location": "path",
  1789. // "required": true,
  1790. // "type": "string"
  1791. // },
  1792. // "sku": {
  1793. // "description": "Caret(^) delimited list of SKUs. Filters out all events that do not reference one of the given SKU. Optional.",
  1794. // "location": "query",
  1795. // "type": "string"
  1796. // },
  1797. // "status": {
  1798. // "description": "Filters out all events that do not have the given status. Valid values: 'active', 'canceled'. Optional.",
  1799. // "enum": [
  1800. // "active",
  1801. // "canceled"
  1802. // ],
  1803. // "enumDescriptions": [
  1804. // "Event is currently active.",
  1805. // "Event is currently canceled."
  1806. // ],
  1807. // "location": "query",
  1808. // "type": "string"
  1809. // },
  1810. // "type": {
  1811. // "description": "Filters out all events that are not of the given type. Valid values: 'action', 'transaction', 'charge'. Optional.",
  1812. // "enum": [
  1813. // "action",
  1814. // "charge",
  1815. // "transaction"
  1816. // ],
  1817. // "enumDescriptions": [
  1818. // "The completion of an application, sign-up, or other process. For example, an action occurs if a user clicks an ad for a credit card and completes an application for that card.",
  1819. // "A charge event is typically a payment between an advertiser, publisher or Google.",
  1820. // "A conversion event, typically an e-commerce transaction. Some advertisers use a transaction to record other types of events, such as magazine subscriptions."
  1821. // ],
  1822. // "location": "query",
  1823. // "type": "string"
  1824. // }
  1825. // },
  1826. // "path": "{role}/{roleId}/events",
  1827. // "response": {
  1828. // "$ref": "Events"
  1829. // }
  1830. // }
  1831. }
  1832. // Pages invokes f for each page of results.
  1833. // A non-nil error returned from f will halt the iteration.
  1834. // The provided context supersedes any context provided to the Context method.
  1835. func (c *EventsListCall) Pages(ctx context.Context, f func(*Events) error) error {
  1836. c.ctx_ = ctx
  1837. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1838. for {
  1839. x, err := c.Do()
  1840. if err != nil {
  1841. return err
  1842. }
  1843. if err := f(x); err != nil {
  1844. return err
  1845. }
  1846. if x.NextPageToken == "" {
  1847. return nil
  1848. }
  1849. c.PageToken(x.NextPageToken)
  1850. }
  1851. }
  1852. // method id "gan.links.get":
  1853. type LinksGetCall struct {
  1854. s *Service
  1855. role string
  1856. roleId string
  1857. linkId int64
  1858. urlParams_ gensupport.URLParams
  1859. ifNoneMatch_ string
  1860. ctx_ context.Context
  1861. }
  1862. // Get: Retrieves data about a single link if the requesting
  1863. // advertiser/publisher has access to it. Advertisers can look up their
  1864. // own links. Publishers can look up visible links or links belonging to
  1865. // advertisers they are in a relationship with.
  1866. func (r *LinksService) Get(role string, roleId string, linkId int64) *LinksGetCall {
  1867. c := &LinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1868. c.role = role
  1869. c.roleId = roleId
  1870. c.linkId = linkId
  1871. return c
  1872. }
  1873. // Fields allows partial responses to be retrieved. See
  1874. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1875. // for more information.
  1876. func (c *LinksGetCall) Fields(s ...googleapi.Field) *LinksGetCall {
  1877. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1878. return c
  1879. }
  1880. // IfNoneMatch sets the optional parameter which makes the operation
  1881. // fail if the object's ETag matches the given value. This is useful for
  1882. // getting updates only after the object has changed since the last
  1883. // request. Use googleapi.IsNotModified to check whether the response
  1884. // error from Do is the result of In-None-Match.
  1885. func (c *LinksGetCall) IfNoneMatch(entityTag string) *LinksGetCall {
  1886. c.ifNoneMatch_ = entityTag
  1887. return c
  1888. }
  1889. // Context sets the context to be used in this call's Do method. Any
  1890. // pending HTTP request will be aborted if the provided context is
  1891. // canceled.
  1892. func (c *LinksGetCall) Context(ctx context.Context) *LinksGetCall {
  1893. c.ctx_ = ctx
  1894. return c
  1895. }
  1896. func (c *LinksGetCall) doRequest(alt string) (*http.Response, error) {
  1897. var body io.Reader = nil
  1898. c.urlParams_.Set("alt", alt)
  1899. urls := googleapi.ResolveRelative(c.s.BasePath, "{role}/{roleId}/link/{linkId}")
  1900. urls += "?" + c.urlParams_.Encode()
  1901. req, _ := http.NewRequest("GET", urls, body)
  1902. googleapi.Expand(req.URL, map[string]string{
  1903. "role": c.role,
  1904. "roleId": c.roleId,
  1905. "linkId": strconv.FormatInt(c.linkId, 10),
  1906. })
  1907. req.Header.Set("User-Agent", c.s.userAgent())
  1908. if c.ifNoneMatch_ != "" {
  1909. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1910. }
  1911. if c.ctx_ != nil {
  1912. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1913. }
  1914. return c.s.client.Do(req)
  1915. }
  1916. // Do executes the "gan.links.get" call.
  1917. // Exactly one of *Link or error will be non-nil. Any non-2xx status
  1918. // code is an error. Response headers are in either
  1919. // *Link.ServerResponse.Header or (if a response was returned at all) in
  1920. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1921. // whether the returned error was because http.StatusNotModified was
  1922. // returned.
  1923. func (c *LinksGetCall) Do(opts ...googleapi.CallOption) (*Link, error) {
  1924. gensupport.SetOptions(c.urlParams_, opts...)
  1925. res, err := c.doRequest("json")
  1926. if res != nil && res.StatusCode == http.StatusNotModified {
  1927. if res.Body != nil {
  1928. res.Body.Close()
  1929. }
  1930. return nil, &googleapi.Error{
  1931. Code: res.StatusCode,
  1932. Header: res.Header,
  1933. }
  1934. }
  1935. if err != nil {
  1936. return nil, err
  1937. }
  1938. defer googleapi.CloseBody(res)
  1939. if err := googleapi.CheckResponse(res); err != nil {
  1940. return nil, err
  1941. }
  1942. ret := &Link{
  1943. ServerResponse: googleapi.ServerResponse{
  1944. Header: res.Header,
  1945. HTTPStatusCode: res.StatusCode,
  1946. },
  1947. }
  1948. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1949. return nil, err
  1950. }
  1951. return ret, nil
  1952. // {
  1953. // "description": "Retrieves data about a single link if the requesting advertiser/publisher has access to it. Advertisers can look up their own links. Publishers can look up visible links or links belonging to advertisers they are in a relationship with.",
  1954. // "httpMethod": "GET",
  1955. // "id": "gan.links.get",
  1956. // "parameterOrder": [
  1957. // "role",
  1958. // "roleId",
  1959. // "linkId"
  1960. // ],
  1961. // "parameters": {
  1962. // "linkId": {
  1963. // "description": "The ID of the link to look up.",
  1964. // "format": "int64",
  1965. // "location": "path",
  1966. // "required": true,
  1967. // "type": "string"
  1968. // },
  1969. // "role": {
  1970. // "description": "The role of the requester. Valid values: 'advertisers' or 'publishers'.",
  1971. // "enum": [
  1972. // "advertisers",
  1973. // "publishers"
  1974. // ],
  1975. // "enumDescriptions": [
  1976. // "The requester is requesting as an advertiser.",
  1977. // "The requester is requesting as a publisher."
  1978. // ],
  1979. // "location": "path",
  1980. // "required": true,
  1981. // "type": "string"
  1982. // },
  1983. // "roleId": {
  1984. // "description": "The ID of the requesting advertiser or publisher.",
  1985. // "location": "path",
  1986. // "required": true,
  1987. // "type": "string"
  1988. // }
  1989. // },
  1990. // "path": "{role}/{roleId}/link/{linkId}",
  1991. // "response": {
  1992. // "$ref": "Link"
  1993. // }
  1994. // }
  1995. }
  1996. // method id "gan.links.insert":
  1997. type LinksInsertCall struct {
  1998. s *Service
  1999. role string
  2000. roleId string
  2001. link *Link
  2002. urlParams_ gensupport.URLParams
  2003. ctx_ context.Context
  2004. }
  2005. // Insert: Inserts a new link.
  2006. func (r *LinksService) Insert(role string, roleId string, link *Link) *LinksInsertCall {
  2007. c := &LinksInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2008. c.role = role
  2009. c.roleId = roleId
  2010. c.link = link
  2011. return c
  2012. }
  2013. // Fields allows partial responses to be retrieved. See
  2014. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2015. // for more information.
  2016. func (c *LinksInsertCall) Fields(s ...googleapi.Field) *LinksInsertCall {
  2017. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  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 *LinksInsertCall) Context(ctx context.Context) *LinksInsertCall {
  2024. c.ctx_ = ctx
  2025. return c
  2026. }
  2027. func (c *LinksInsertCall) doRequest(alt string) (*http.Response, error) {
  2028. var body io.Reader = nil
  2029. body, err := googleapi.WithoutDataWrapper.JSONReader(c.link)
  2030. if err != nil {
  2031. return nil, err
  2032. }
  2033. ctype := "application/json"
  2034. c.urlParams_.Set("alt", alt)
  2035. urls := googleapi.ResolveRelative(c.s.BasePath, "{role}/{roleId}/link")
  2036. urls += "?" + c.urlParams_.Encode()
  2037. req, _ := http.NewRequest("POST", urls, body)
  2038. googleapi.Expand(req.URL, map[string]string{
  2039. "role": c.role,
  2040. "roleId": c.roleId,
  2041. })
  2042. req.Header.Set("Content-Type", ctype)
  2043. req.Header.Set("User-Agent", c.s.userAgent())
  2044. if c.ctx_ != nil {
  2045. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2046. }
  2047. return c.s.client.Do(req)
  2048. }
  2049. // Do executes the "gan.links.insert" call.
  2050. // Exactly one of *Link or error will be non-nil. Any non-2xx status
  2051. // code is an error. Response headers are in either
  2052. // *Link.ServerResponse.Header or (if a response was returned at all) in
  2053. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2054. // whether the returned error was because http.StatusNotModified was
  2055. // returned.
  2056. func (c *LinksInsertCall) Do(opts ...googleapi.CallOption) (*Link, error) {
  2057. gensupport.SetOptions(c.urlParams_, opts...)
  2058. res, err := c.doRequest("json")
  2059. if res != nil && res.StatusCode == http.StatusNotModified {
  2060. if res.Body != nil {
  2061. res.Body.Close()
  2062. }
  2063. return nil, &googleapi.Error{
  2064. Code: res.StatusCode,
  2065. Header: res.Header,
  2066. }
  2067. }
  2068. if err != nil {
  2069. return nil, err
  2070. }
  2071. defer googleapi.CloseBody(res)
  2072. if err := googleapi.CheckResponse(res); err != nil {
  2073. return nil, err
  2074. }
  2075. ret := &Link{
  2076. ServerResponse: googleapi.ServerResponse{
  2077. Header: res.Header,
  2078. HTTPStatusCode: res.StatusCode,
  2079. },
  2080. }
  2081. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2082. return nil, err
  2083. }
  2084. return ret, nil
  2085. // {
  2086. // "description": "Inserts a new link.",
  2087. // "httpMethod": "POST",
  2088. // "id": "gan.links.insert",
  2089. // "parameterOrder": [
  2090. // "role",
  2091. // "roleId"
  2092. // ],
  2093. // "parameters": {
  2094. // "role": {
  2095. // "description": "The role of the requester. Valid values: 'advertisers' or 'publishers'.",
  2096. // "enum": [
  2097. // "advertisers",
  2098. // "publishers"
  2099. // ],
  2100. // "enumDescriptions": [
  2101. // "The requester is requesting as an advertiser.",
  2102. // "The requester is requesting as a publisher."
  2103. // ],
  2104. // "location": "path",
  2105. // "required": true,
  2106. // "type": "string"
  2107. // },
  2108. // "roleId": {
  2109. // "description": "The ID of the requesting advertiser or publisher.",
  2110. // "location": "path",
  2111. // "required": true,
  2112. // "type": "string"
  2113. // }
  2114. // },
  2115. // "path": "{role}/{roleId}/link",
  2116. // "request": {
  2117. // "$ref": "Link"
  2118. // },
  2119. // "response": {
  2120. // "$ref": "Link"
  2121. // }
  2122. // }
  2123. }
  2124. // method id "gan.links.list":
  2125. type LinksListCall struct {
  2126. s *Service
  2127. role string
  2128. roleId string
  2129. urlParams_ gensupport.URLParams
  2130. ifNoneMatch_ string
  2131. ctx_ context.Context
  2132. }
  2133. // List: Retrieves all links that match the query parameters.
  2134. func (r *LinksService) List(role string, roleId string) *LinksListCall {
  2135. c := &LinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2136. c.role = role
  2137. c.roleId = roleId
  2138. return c
  2139. }
  2140. // AdvertiserId sets the optional parameter "advertiserId": Limits the
  2141. // resulting links to the ones belonging to the listed advertisers.
  2142. func (c *LinksListCall) AdvertiserId(advertiserId ...int64) *LinksListCall {
  2143. var advertiserId_ []string
  2144. for _, v := range advertiserId {
  2145. advertiserId_ = append(advertiserId_, fmt.Sprint(v))
  2146. }
  2147. c.urlParams_.SetMulti("advertiserId", advertiserId_)
  2148. return c
  2149. }
  2150. // AssetSize sets the optional parameter "assetSize": The size of the
  2151. // given asset.
  2152. func (c *LinksListCall) AssetSize(assetSize ...string) *LinksListCall {
  2153. c.urlParams_.SetMulti("assetSize", append([]string{}, assetSize...))
  2154. return c
  2155. }
  2156. // Authorship sets the optional parameter "authorship": The role of the
  2157. // author of the link.
  2158. //
  2159. // Possible values:
  2160. // "advertiser"
  2161. // "publisher"
  2162. func (c *LinksListCall) Authorship(authorship string) *LinksListCall {
  2163. c.urlParams_.Set("authorship", authorship)
  2164. return c
  2165. }
  2166. // CreateDateMax sets the optional parameter "createDateMax": The end of
  2167. // the create date range.
  2168. func (c *LinksListCall) CreateDateMax(createDateMax string) *LinksListCall {
  2169. c.urlParams_.Set("createDateMax", createDateMax)
  2170. return c
  2171. }
  2172. // CreateDateMin sets the optional parameter "createDateMin": The
  2173. // beginning of the create date range.
  2174. func (c *LinksListCall) CreateDateMin(createDateMin string) *LinksListCall {
  2175. c.urlParams_.Set("createDateMin", createDateMin)
  2176. return c
  2177. }
  2178. // LinkType sets the optional parameter "linkType": The type of the
  2179. // link.
  2180. //
  2181. // Possible values:
  2182. // "banner"
  2183. // "text"
  2184. func (c *LinksListCall) LinkType(linkType string) *LinksListCall {
  2185. c.urlParams_.Set("linkType", linkType)
  2186. return c
  2187. }
  2188. // MaxResults sets the optional parameter "maxResults": Max number of
  2189. // items to return in this page. Defaults to 20.
  2190. func (c *LinksListCall) MaxResults(maxResults int64) *LinksListCall {
  2191. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2192. return c
  2193. }
  2194. // PageToken sets the optional parameter "pageToken": The value of
  2195. // 'nextPageToken' from the previous page.
  2196. func (c *LinksListCall) PageToken(pageToken string) *LinksListCall {
  2197. c.urlParams_.Set("pageToken", pageToken)
  2198. return c
  2199. }
  2200. // PromotionType sets the optional parameter "promotionType": The
  2201. // promotion type.
  2202. //
  2203. // Possible values:
  2204. // "coupon"
  2205. // "free_gift"
  2206. // "free_shipping"
  2207. // "percent_off"
  2208. // "price_cut"
  2209. func (c *LinksListCall) PromotionType(promotionType ...string) *LinksListCall {
  2210. c.urlParams_.SetMulti("promotionType", append([]string{}, promotionType...))
  2211. return c
  2212. }
  2213. // RelationshipStatus sets the optional parameter "relationshipStatus":
  2214. // The status of the relationship.
  2215. //
  2216. // Possible values:
  2217. // "approved"
  2218. // "available"
  2219. func (c *LinksListCall) RelationshipStatus(relationshipStatus string) *LinksListCall {
  2220. c.urlParams_.Set("relationshipStatus", relationshipStatus)
  2221. return c
  2222. }
  2223. // SearchText sets the optional parameter "searchText": Field for full
  2224. // text search across title and merchandising text, supports link id
  2225. // search.
  2226. func (c *LinksListCall) SearchText(searchText string) *LinksListCall {
  2227. c.urlParams_.Set("searchText", searchText)
  2228. return c
  2229. }
  2230. // StartDateMax sets the optional parameter "startDateMax": The end of
  2231. // the start date range.
  2232. func (c *LinksListCall) StartDateMax(startDateMax string) *LinksListCall {
  2233. c.urlParams_.Set("startDateMax", startDateMax)
  2234. return c
  2235. }
  2236. // StartDateMin sets the optional parameter "startDateMin": The
  2237. // beginning of the start date range.
  2238. func (c *LinksListCall) StartDateMin(startDateMin string) *LinksListCall {
  2239. c.urlParams_.Set("startDateMin", startDateMin)
  2240. return c
  2241. }
  2242. // Fields allows partial responses to be retrieved. See
  2243. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2244. // for more information.
  2245. func (c *LinksListCall) Fields(s ...googleapi.Field) *LinksListCall {
  2246. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2247. return c
  2248. }
  2249. // IfNoneMatch sets the optional parameter which makes the operation
  2250. // fail if the object's ETag matches the given value. This is useful for
  2251. // getting updates only after the object has changed since the last
  2252. // request. Use googleapi.IsNotModified to check whether the response
  2253. // error from Do is the result of In-None-Match.
  2254. func (c *LinksListCall) IfNoneMatch(entityTag string) *LinksListCall {
  2255. c.ifNoneMatch_ = entityTag
  2256. return c
  2257. }
  2258. // Context sets the context to be used in this call's Do method. Any
  2259. // pending HTTP request will be aborted if the provided context is
  2260. // canceled.
  2261. func (c *LinksListCall) Context(ctx context.Context) *LinksListCall {
  2262. c.ctx_ = ctx
  2263. return c
  2264. }
  2265. func (c *LinksListCall) doRequest(alt string) (*http.Response, error) {
  2266. var body io.Reader = nil
  2267. c.urlParams_.Set("alt", alt)
  2268. urls := googleapi.ResolveRelative(c.s.BasePath, "{role}/{roleId}/links")
  2269. urls += "?" + c.urlParams_.Encode()
  2270. req, _ := http.NewRequest("GET", urls, body)
  2271. googleapi.Expand(req.URL, map[string]string{
  2272. "role": c.role,
  2273. "roleId": c.roleId,
  2274. })
  2275. req.Header.Set("User-Agent", c.s.userAgent())
  2276. if c.ifNoneMatch_ != "" {
  2277. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2278. }
  2279. if c.ctx_ != nil {
  2280. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2281. }
  2282. return c.s.client.Do(req)
  2283. }
  2284. // Do executes the "gan.links.list" call.
  2285. // Exactly one of *Links or error will be non-nil. Any non-2xx status
  2286. // code is an error. Response headers are in either
  2287. // *Links.ServerResponse.Header or (if a response was returned at all)
  2288. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2289. // check whether the returned error was because http.StatusNotModified
  2290. // was returned.
  2291. func (c *LinksListCall) Do(opts ...googleapi.CallOption) (*Links, error) {
  2292. gensupport.SetOptions(c.urlParams_, opts...)
  2293. res, err := c.doRequest("json")
  2294. if res != nil && res.StatusCode == http.StatusNotModified {
  2295. if res.Body != nil {
  2296. res.Body.Close()
  2297. }
  2298. return nil, &googleapi.Error{
  2299. Code: res.StatusCode,
  2300. Header: res.Header,
  2301. }
  2302. }
  2303. if err != nil {
  2304. return nil, err
  2305. }
  2306. defer googleapi.CloseBody(res)
  2307. if err := googleapi.CheckResponse(res); err != nil {
  2308. return nil, err
  2309. }
  2310. ret := &Links{
  2311. ServerResponse: googleapi.ServerResponse{
  2312. Header: res.Header,
  2313. HTTPStatusCode: res.StatusCode,
  2314. },
  2315. }
  2316. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2317. return nil, err
  2318. }
  2319. return ret, nil
  2320. // {
  2321. // "description": "Retrieves all links that match the query parameters.",
  2322. // "httpMethod": "GET",
  2323. // "id": "gan.links.list",
  2324. // "parameterOrder": [
  2325. // "role",
  2326. // "roleId"
  2327. // ],
  2328. // "parameters": {
  2329. // "advertiserId": {
  2330. // "description": "Limits the resulting links to the ones belonging to the listed advertisers.",
  2331. // "format": "int64",
  2332. // "location": "query",
  2333. // "repeated": true,
  2334. // "type": "string"
  2335. // },
  2336. // "assetSize": {
  2337. // "description": "The size of the given asset.",
  2338. // "location": "query",
  2339. // "repeated": true,
  2340. // "type": "string"
  2341. // },
  2342. // "authorship": {
  2343. // "description": "The role of the author of the link.",
  2344. // "enum": [
  2345. // "advertiser",
  2346. // "publisher"
  2347. // ],
  2348. // "enumDescriptions": [
  2349. // "",
  2350. // ""
  2351. // ],
  2352. // "location": "query",
  2353. // "type": "string"
  2354. // },
  2355. // "createDateMax": {
  2356. // "description": "The end of the create date range.",
  2357. // "location": "query",
  2358. // "type": "string"
  2359. // },
  2360. // "createDateMin": {
  2361. // "description": "The beginning of the create date range.",
  2362. // "location": "query",
  2363. // "type": "string"
  2364. // },
  2365. // "linkType": {
  2366. // "description": "The type of the link.",
  2367. // "enum": [
  2368. // "banner",
  2369. // "text"
  2370. // ],
  2371. // "enumDescriptions": [
  2372. // "",
  2373. // ""
  2374. // ],
  2375. // "location": "query",
  2376. // "type": "string"
  2377. // },
  2378. // "maxResults": {
  2379. // "description": "Max number of items to return in this page. Optional. Defaults to 20.",
  2380. // "format": "uint32",
  2381. // "location": "query",
  2382. // "maximum": "100",
  2383. // "minimum": "0",
  2384. // "type": "integer"
  2385. // },
  2386. // "pageToken": {
  2387. // "description": "The value of 'nextPageToken' from the previous page. Optional.",
  2388. // "location": "query",
  2389. // "type": "string"
  2390. // },
  2391. // "promotionType": {
  2392. // "description": "The promotion type.",
  2393. // "enum": [
  2394. // "coupon",
  2395. // "free_gift",
  2396. // "free_shipping",
  2397. // "percent_off",
  2398. // "price_cut"
  2399. // ],
  2400. // "enumDescriptions": [
  2401. // "",
  2402. // "",
  2403. // "",
  2404. // "",
  2405. // ""
  2406. // ],
  2407. // "location": "query",
  2408. // "repeated": true,
  2409. // "type": "string"
  2410. // },
  2411. // "relationshipStatus": {
  2412. // "description": "The status of the relationship.",
  2413. // "enum": [
  2414. // "approved",
  2415. // "available"
  2416. // ],
  2417. // "enumDescriptions": [
  2418. // "",
  2419. // ""
  2420. // ],
  2421. // "location": "query",
  2422. // "type": "string"
  2423. // },
  2424. // "role": {
  2425. // "description": "The role of the requester. Valid values: 'advertisers' or 'publishers'.",
  2426. // "enum": [
  2427. // "advertisers",
  2428. // "publishers"
  2429. // ],
  2430. // "enumDescriptions": [
  2431. // "The requester is requesting as an advertiser.",
  2432. // "The requester is requesting as a publisher."
  2433. // ],
  2434. // "location": "path",
  2435. // "required": true,
  2436. // "type": "string"
  2437. // },
  2438. // "roleId": {
  2439. // "description": "The ID of the requesting advertiser or publisher.",
  2440. // "location": "path",
  2441. // "required": true,
  2442. // "type": "string"
  2443. // },
  2444. // "searchText": {
  2445. // "description": "Field for full text search across title and merchandising text, supports link id search.",
  2446. // "location": "query",
  2447. // "type": "string"
  2448. // },
  2449. // "startDateMax": {
  2450. // "description": "The end of the start date range.",
  2451. // "location": "query",
  2452. // "type": "string"
  2453. // },
  2454. // "startDateMin": {
  2455. // "description": "The beginning of the start date range.",
  2456. // "location": "query",
  2457. // "type": "string"
  2458. // }
  2459. // },
  2460. // "path": "{role}/{roleId}/links",
  2461. // "response": {
  2462. // "$ref": "Links"
  2463. // }
  2464. // }
  2465. }
  2466. // Pages invokes f for each page of results.
  2467. // A non-nil error returned from f will halt the iteration.
  2468. // The provided context supersedes any context provided to the Context method.
  2469. func (c *LinksListCall) Pages(ctx context.Context, f func(*Links) error) error {
  2470. c.ctx_ = ctx
  2471. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2472. for {
  2473. x, err := c.Do()
  2474. if err != nil {
  2475. return err
  2476. }
  2477. if err := f(x); err != nil {
  2478. return err
  2479. }
  2480. if x.NextPageToken == "" {
  2481. return nil
  2482. }
  2483. c.PageToken(x.NextPageToken)
  2484. }
  2485. }
  2486. // method id "gan.publishers.get":
  2487. type PublishersGetCall struct {
  2488. s *Service
  2489. role string
  2490. roleId string
  2491. urlParams_ gensupport.URLParams
  2492. ifNoneMatch_ string
  2493. ctx_ context.Context
  2494. }
  2495. // Get: Retrieves data about a single advertiser if that the requesting
  2496. // advertiser/publisher has access to it. Only advertisers can look up
  2497. // publishers. Publishers can request information about themselves by
  2498. // omitting the publisherId query parameter.
  2499. func (r *PublishersService) Get(role string, roleId string) *PublishersGetCall {
  2500. c := &PublishersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2501. c.role = role
  2502. c.roleId = roleId
  2503. return c
  2504. }
  2505. // PublisherId sets the optional parameter "publisherId": The ID of the
  2506. // publisher to look up.
  2507. func (c *PublishersGetCall) PublisherId(publisherId string) *PublishersGetCall {
  2508. c.urlParams_.Set("publisherId", publisherId)
  2509. return c
  2510. }
  2511. // Fields allows partial responses to be retrieved. See
  2512. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2513. // for more information.
  2514. func (c *PublishersGetCall) Fields(s ...googleapi.Field) *PublishersGetCall {
  2515. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2516. return c
  2517. }
  2518. // IfNoneMatch sets the optional parameter which makes the operation
  2519. // fail if the object's ETag matches the given value. This is useful for
  2520. // getting updates only after the object has changed since the last
  2521. // request. Use googleapi.IsNotModified to check whether the response
  2522. // error from Do is the result of In-None-Match.
  2523. func (c *PublishersGetCall) IfNoneMatch(entityTag string) *PublishersGetCall {
  2524. c.ifNoneMatch_ = entityTag
  2525. return c
  2526. }
  2527. // Context sets the context to be used in this call's Do method. Any
  2528. // pending HTTP request will be aborted if the provided context is
  2529. // canceled.
  2530. func (c *PublishersGetCall) Context(ctx context.Context) *PublishersGetCall {
  2531. c.ctx_ = ctx
  2532. return c
  2533. }
  2534. func (c *PublishersGetCall) doRequest(alt string) (*http.Response, error) {
  2535. var body io.Reader = nil
  2536. c.urlParams_.Set("alt", alt)
  2537. urls := googleapi.ResolveRelative(c.s.BasePath, "{role}/{roleId}/publisher")
  2538. urls += "?" + c.urlParams_.Encode()
  2539. req, _ := http.NewRequest("GET", urls, body)
  2540. googleapi.Expand(req.URL, map[string]string{
  2541. "role": c.role,
  2542. "roleId": c.roleId,
  2543. })
  2544. req.Header.Set("User-Agent", c.s.userAgent())
  2545. if c.ifNoneMatch_ != "" {
  2546. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2547. }
  2548. if c.ctx_ != nil {
  2549. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2550. }
  2551. return c.s.client.Do(req)
  2552. }
  2553. // Do executes the "gan.publishers.get" call.
  2554. // Exactly one of *Publisher or error will be non-nil. Any non-2xx
  2555. // status code is an error. Response headers are in either
  2556. // *Publisher.ServerResponse.Header or (if a response was returned at
  2557. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2558. // to check whether the returned error was because
  2559. // http.StatusNotModified was returned.
  2560. func (c *PublishersGetCall) Do(opts ...googleapi.CallOption) (*Publisher, error) {
  2561. gensupport.SetOptions(c.urlParams_, opts...)
  2562. res, err := c.doRequest("json")
  2563. if res != nil && res.StatusCode == http.StatusNotModified {
  2564. if res.Body != nil {
  2565. res.Body.Close()
  2566. }
  2567. return nil, &googleapi.Error{
  2568. Code: res.StatusCode,
  2569. Header: res.Header,
  2570. }
  2571. }
  2572. if err != nil {
  2573. return nil, err
  2574. }
  2575. defer googleapi.CloseBody(res)
  2576. if err := googleapi.CheckResponse(res); err != nil {
  2577. return nil, err
  2578. }
  2579. ret := &Publisher{
  2580. ServerResponse: googleapi.ServerResponse{
  2581. Header: res.Header,
  2582. HTTPStatusCode: res.StatusCode,
  2583. },
  2584. }
  2585. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2586. return nil, err
  2587. }
  2588. return ret, nil
  2589. // {
  2590. // "description": "Retrieves data about a single advertiser if that the requesting advertiser/publisher has access to it. Only advertisers can look up publishers. Publishers can request information about themselves by omitting the publisherId query parameter.",
  2591. // "httpMethod": "GET",
  2592. // "id": "gan.publishers.get",
  2593. // "parameterOrder": [
  2594. // "role",
  2595. // "roleId"
  2596. // ],
  2597. // "parameters": {
  2598. // "publisherId": {
  2599. // "description": "The ID of the publisher to look up. Optional.",
  2600. // "location": "query",
  2601. // "type": "string"
  2602. // },
  2603. // "role": {
  2604. // "description": "The role of the requester. Valid values: 'advertisers' or 'publishers'.",
  2605. // "enum": [
  2606. // "advertisers",
  2607. // "publishers"
  2608. // ],
  2609. // "enumDescriptions": [
  2610. // "The requester is requesting as an advertiser.",
  2611. // "The requester is requesting as a publisher."
  2612. // ],
  2613. // "location": "path",
  2614. // "required": true,
  2615. // "type": "string"
  2616. // },
  2617. // "roleId": {
  2618. // "description": "The ID of the requesting advertiser or publisher.",
  2619. // "location": "path",
  2620. // "required": true,
  2621. // "type": "string"
  2622. // }
  2623. // },
  2624. // "path": "{role}/{roleId}/publisher",
  2625. // "response": {
  2626. // "$ref": "Publisher"
  2627. // }
  2628. // }
  2629. }
  2630. // method id "gan.publishers.list":
  2631. type PublishersListCall struct {
  2632. s *Service
  2633. role string
  2634. roleId string
  2635. urlParams_ gensupport.URLParams
  2636. ifNoneMatch_ string
  2637. ctx_ context.Context
  2638. }
  2639. // List: Retrieves data about all publishers that the requesting
  2640. // advertiser/publisher has access to.
  2641. func (r *PublishersService) List(role string, roleId string) *PublishersListCall {
  2642. c := &PublishersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2643. c.role = role
  2644. c.roleId = roleId
  2645. return c
  2646. }
  2647. // MaxResults sets the optional parameter "maxResults": Max number of
  2648. // items to return in this page. Defaults to 20.
  2649. func (c *PublishersListCall) MaxResults(maxResults int64) *PublishersListCall {
  2650. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2651. return c
  2652. }
  2653. // MinNinetyDayEpc sets the optional parameter "minNinetyDayEpc":
  2654. // Filters out all publishers that have a ninety day EPC average lower
  2655. // than the given value (inclusive). Min value: 0.0.
  2656. func (c *PublishersListCall) MinNinetyDayEpc(minNinetyDayEpc float64) *PublishersListCall {
  2657. c.urlParams_.Set("minNinetyDayEpc", fmt.Sprint(minNinetyDayEpc))
  2658. return c
  2659. }
  2660. // MinPayoutRank sets the optional parameter "minPayoutRank": A value
  2661. // between 1 and 4, where 1 represents the quartile of publishers with
  2662. // the lowest ranks and 4 represents the quartile of publishers with the
  2663. // highest ranks. Filters out all publishers with a lower rank than the
  2664. // given quartile. For example if a 2 was given only publishers with a
  2665. // payout rank of 25 or higher would be included.
  2666. func (c *PublishersListCall) MinPayoutRank(minPayoutRank int64) *PublishersListCall {
  2667. c.urlParams_.Set("minPayoutRank", fmt.Sprint(minPayoutRank))
  2668. return c
  2669. }
  2670. // MinSevenDayEpc sets the optional parameter "minSevenDayEpc": Filters
  2671. // out all publishers that have a seven day EPC average lower than the
  2672. // given value (inclusive). Min value 0.0.
  2673. func (c *PublishersListCall) MinSevenDayEpc(minSevenDayEpc float64) *PublishersListCall {
  2674. c.urlParams_.Set("minSevenDayEpc", fmt.Sprint(minSevenDayEpc))
  2675. return c
  2676. }
  2677. // PageToken sets the optional parameter "pageToken": The value of
  2678. // 'nextPageToken' from the previous page.
  2679. func (c *PublishersListCall) PageToken(pageToken string) *PublishersListCall {
  2680. c.urlParams_.Set("pageToken", pageToken)
  2681. return c
  2682. }
  2683. // PublisherCategory sets the optional parameter "publisherCategory":
  2684. // Caret(^) delimted list of publisher categories. Valid categories:
  2685. // (unclassified|community_and_content|shopping_and_promotion|loyalty_and
  2686. // _rewards|network|search_specialist|comparison_shopping|email).
  2687. // Filters out all publishers not in one of the given advertiser
  2688. // categories.
  2689. func (c *PublishersListCall) PublisherCategory(publisherCategory string) *PublishersListCall {
  2690. c.urlParams_.Set("publisherCategory", publisherCategory)
  2691. return c
  2692. }
  2693. // RelationshipStatus sets the optional parameter "relationshipStatus":
  2694. // Filters out all publishers for which do not have the given
  2695. // relationship status with the requesting publisher.
  2696. //
  2697. // Possible values:
  2698. // "approved" - Publishers you've approved to your program.
  2699. // "available" - Publishers available for you to recruit.
  2700. // "deactivated" - A publisher that you terminated from your program.
  2701. // Publishers also have the ability to remove themselves from your
  2702. // program.
  2703. // "declined" - A publisher that you did not approve to your program.
  2704. // "pending" - Publishers that have applied to your program. We
  2705. // recommend reviewing and deciding on pending publishers on a weekly
  2706. // basis.
  2707. func (c *PublishersListCall) RelationshipStatus(relationshipStatus string) *PublishersListCall {
  2708. c.urlParams_.Set("relationshipStatus", relationshipStatus)
  2709. return c
  2710. }
  2711. // Fields allows partial responses to be retrieved. See
  2712. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2713. // for more information.
  2714. func (c *PublishersListCall) Fields(s ...googleapi.Field) *PublishersListCall {
  2715. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2716. return c
  2717. }
  2718. // IfNoneMatch sets the optional parameter which makes the operation
  2719. // fail if the object's ETag matches the given value. This is useful for
  2720. // getting updates only after the object has changed since the last
  2721. // request. Use googleapi.IsNotModified to check whether the response
  2722. // error from Do is the result of In-None-Match.
  2723. func (c *PublishersListCall) IfNoneMatch(entityTag string) *PublishersListCall {
  2724. c.ifNoneMatch_ = entityTag
  2725. return c
  2726. }
  2727. // Context sets the context to be used in this call's Do method. Any
  2728. // pending HTTP request will be aborted if the provided context is
  2729. // canceled.
  2730. func (c *PublishersListCall) Context(ctx context.Context) *PublishersListCall {
  2731. c.ctx_ = ctx
  2732. return c
  2733. }
  2734. func (c *PublishersListCall) doRequest(alt string) (*http.Response, error) {
  2735. var body io.Reader = nil
  2736. c.urlParams_.Set("alt", alt)
  2737. urls := googleapi.ResolveRelative(c.s.BasePath, "{role}/{roleId}/publishers")
  2738. urls += "?" + c.urlParams_.Encode()
  2739. req, _ := http.NewRequest("GET", urls, body)
  2740. googleapi.Expand(req.URL, map[string]string{
  2741. "role": c.role,
  2742. "roleId": c.roleId,
  2743. })
  2744. req.Header.Set("User-Agent", c.s.userAgent())
  2745. if c.ifNoneMatch_ != "" {
  2746. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2747. }
  2748. if c.ctx_ != nil {
  2749. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2750. }
  2751. return c.s.client.Do(req)
  2752. }
  2753. // Do executes the "gan.publishers.list" call.
  2754. // Exactly one of *Publishers or error will be non-nil. Any non-2xx
  2755. // status code is an error. Response headers are in either
  2756. // *Publishers.ServerResponse.Header or (if a response was returned at
  2757. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2758. // to check whether the returned error was because
  2759. // http.StatusNotModified was returned.
  2760. func (c *PublishersListCall) Do(opts ...googleapi.CallOption) (*Publishers, error) {
  2761. gensupport.SetOptions(c.urlParams_, opts...)
  2762. res, err := c.doRequest("json")
  2763. if res != nil && res.StatusCode == http.StatusNotModified {
  2764. if res.Body != nil {
  2765. res.Body.Close()
  2766. }
  2767. return nil, &googleapi.Error{
  2768. Code: res.StatusCode,
  2769. Header: res.Header,
  2770. }
  2771. }
  2772. if err != nil {
  2773. return nil, err
  2774. }
  2775. defer googleapi.CloseBody(res)
  2776. if err := googleapi.CheckResponse(res); err != nil {
  2777. return nil, err
  2778. }
  2779. ret := &Publishers{
  2780. ServerResponse: googleapi.ServerResponse{
  2781. Header: res.Header,
  2782. HTTPStatusCode: res.StatusCode,
  2783. },
  2784. }
  2785. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2786. return nil, err
  2787. }
  2788. return ret, nil
  2789. // {
  2790. // "description": "Retrieves data about all publishers that the requesting advertiser/publisher has access to.",
  2791. // "httpMethod": "GET",
  2792. // "id": "gan.publishers.list",
  2793. // "parameterOrder": [
  2794. // "role",
  2795. // "roleId"
  2796. // ],
  2797. // "parameters": {
  2798. // "maxResults": {
  2799. // "description": "Max number of items to return in this page. Optional. Defaults to 20.",
  2800. // "format": "uint32",
  2801. // "location": "query",
  2802. // "maximum": "100",
  2803. // "minimum": "0",
  2804. // "type": "integer"
  2805. // },
  2806. // "minNinetyDayEpc": {
  2807. // "description": "Filters out all publishers that have a ninety day EPC average lower than the given value (inclusive). Min value: 0.0. Optional.",
  2808. // "format": "double",
  2809. // "location": "query",
  2810. // "type": "number"
  2811. // },
  2812. // "minPayoutRank": {
  2813. // "description": "A value between 1 and 4, where 1 represents the quartile of publishers with the lowest ranks and 4 represents the quartile of publishers with the highest ranks. Filters out all publishers with a lower rank than the given quartile. For example if a 2 was given only publishers with a payout rank of 25 or higher would be included. Optional.",
  2814. // "format": "int32",
  2815. // "location": "query",
  2816. // "maximum": "4",
  2817. // "minimum": "1",
  2818. // "type": "integer"
  2819. // },
  2820. // "minSevenDayEpc": {
  2821. // "description": "Filters out all publishers that have a seven day EPC average lower than the given value (inclusive). Min value 0.0. Optional.",
  2822. // "format": "double",
  2823. // "location": "query",
  2824. // "type": "number"
  2825. // },
  2826. // "pageToken": {
  2827. // "description": "The value of 'nextPageToken' from the previous page. Optional.",
  2828. // "location": "query",
  2829. // "type": "string"
  2830. // },
  2831. // "publisherCategory": {
  2832. // "description": "Caret(^) delimted list of publisher categories. Valid categories: (unclassified|community_and_content|shopping_and_promotion|loyalty_and_rewards|network|search_specialist|comparison_shopping|email). Filters out all publishers not in one of the given advertiser categories. Optional.",
  2833. // "location": "query",
  2834. // "type": "string"
  2835. // },
  2836. // "relationshipStatus": {
  2837. // "description": "Filters out all publishers for which do not have the given relationship status with the requesting publisher.",
  2838. // "enum": [
  2839. // "approved",
  2840. // "available",
  2841. // "deactivated",
  2842. // "declined",
  2843. // "pending"
  2844. // ],
  2845. // "enumDescriptions": [
  2846. // "Publishers you've approved to your program.",
  2847. // "Publishers available for you to recruit.",
  2848. // "A publisher that you terminated from your program. Publishers also have the ability to remove themselves from your program.",
  2849. // "A publisher that you did not approve to your program.",
  2850. // "Publishers that have applied to your program. We recommend reviewing and deciding on pending publishers on a weekly basis."
  2851. // ],
  2852. // "location": "query",
  2853. // "type": "string"
  2854. // },
  2855. // "role": {
  2856. // "description": "The role of the requester. Valid values: 'advertisers' or 'publishers'.",
  2857. // "enum": [
  2858. // "advertisers",
  2859. // "publishers"
  2860. // ],
  2861. // "enumDescriptions": [
  2862. // "The requester is requesting as an advertiser.",
  2863. // "The requester is requesting as a publisher."
  2864. // ],
  2865. // "location": "path",
  2866. // "required": true,
  2867. // "type": "string"
  2868. // },
  2869. // "roleId": {
  2870. // "description": "The ID of the requesting advertiser or publisher.",
  2871. // "location": "path",
  2872. // "required": true,
  2873. // "type": "string"
  2874. // }
  2875. // },
  2876. // "path": "{role}/{roleId}/publishers",
  2877. // "response": {
  2878. // "$ref": "Publishers"
  2879. // }
  2880. // }
  2881. }
  2882. // Pages invokes f for each page of results.
  2883. // A non-nil error returned from f will halt the iteration.
  2884. // The provided context supersedes any context provided to the Context method.
  2885. func (c *PublishersListCall) Pages(ctx context.Context, f func(*Publishers) error) error {
  2886. c.ctx_ = ctx
  2887. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2888. for {
  2889. x, err := c.Do()
  2890. if err != nil {
  2891. return err
  2892. }
  2893. if err := f(x); err != nil {
  2894. return err
  2895. }
  2896. if x.NextPageToken == "" {
  2897. return nil
  2898. }
  2899. c.PageToken(x.NextPageToken)
  2900. }
  2901. }
  2902. // method id "gan.reports.get":
  2903. type ReportsGetCall struct {
  2904. s *Service
  2905. role string
  2906. roleId string
  2907. reportType string
  2908. urlParams_ gensupport.URLParams
  2909. ifNoneMatch_ string
  2910. ctx_ context.Context
  2911. }
  2912. // Get: Retrieves a report of the specified type.
  2913. func (r *ReportsService) Get(role string, roleId string, reportType string) *ReportsGetCall {
  2914. c := &ReportsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2915. c.role = role
  2916. c.roleId = roleId
  2917. c.reportType = reportType
  2918. return c
  2919. }
  2920. // AdvertiserId sets the optional parameter "advertiserId": The IDs of
  2921. // the advertisers to look up, if applicable.
  2922. func (c *ReportsGetCall) AdvertiserId(advertiserId ...string) *ReportsGetCall {
  2923. c.urlParams_.SetMulti("advertiserId", append([]string{}, advertiserId...))
  2924. return c
  2925. }
  2926. // CalculateTotals sets the optional parameter "calculateTotals":
  2927. // Whether or not to calculate totals rows.
  2928. func (c *ReportsGetCall) CalculateTotals(calculateTotals bool) *ReportsGetCall {
  2929. c.urlParams_.Set("calculateTotals", fmt.Sprint(calculateTotals))
  2930. return c
  2931. }
  2932. // EndDate sets the optional parameter "endDate": The end date
  2933. // (exclusive), in RFC 3339 format, for the report data to be returned.
  2934. // Defaults to one day after startDate, if that is given, or today.
  2935. func (c *ReportsGetCall) EndDate(endDate string) *ReportsGetCall {
  2936. c.urlParams_.Set("endDate", endDate)
  2937. return c
  2938. }
  2939. // EventType sets the optional parameter "eventType": Filters out all
  2940. // events that are not of the given type. Valid values: 'action',
  2941. // 'transaction', or 'charge'.
  2942. //
  2943. // Possible values:
  2944. // "action" - Event type is action.
  2945. // "charge" - Event type is charge.
  2946. // "transaction" - Event type is transaction.
  2947. func (c *ReportsGetCall) EventType(eventType string) *ReportsGetCall {
  2948. c.urlParams_.Set("eventType", eventType)
  2949. return c
  2950. }
  2951. // LinkId sets the optional parameter "linkId": Filters to capture one
  2952. // of given link IDs.
  2953. func (c *ReportsGetCall) LinkId(linkId ...string) *ReportsGetCall {
  2954. c.urlParams_.SetMulti("linkId", append([]string{}, linkId...))
  2955. return c
  2956. }
  2957. // MaxResults sets the optional parameter "maxResults": Max number of
  2958. // items to return in this page. Defaults to return all results.
  2959. func (c *ReportsGetCall) MaxResults(maxResults int64) *ReportsGetCall {
  2960. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2961. return c
  2962. }
  2963. // OrderId sets the optional parameter "orderId": Filters to capture one
  2964. // of the given order IDs.
  2965. func (c *ReportsGetCall) OrderId(orderId ...string) *ReportsGetCall {
  2966. c.urlParams_.SetMulti("orderId", append([]string{}, orderId...))
  2967. return c
  2968. }
  2969. // PublisherId sets the optional parameter "publisherId": The IDs of the
  2970. // publishers to look up, if applicable.
  2971. func (c *ReportsGetCall) PublisherId(publisherId ...string) *ReportsGetCall {
  2972. c.urlParams_.SetMulti("publisherId", append([]string{}, publisherId...))
  2973. return c
  2974. }
  2975. // StartDate sets the optional parameter "startDate": The start date
  2976. // (inclusive), in RFC 3339 format, for the report data to be returned.
  2977. // Defaults to one day before endDate, if that is given, or yesterday.
  2978. func (c *ReportsGetCall) StartDate(startDate string) *ReportsGetCall {
  2979. c.urlParams_.Set("startDate", startDate)
  2980. return c
  2981. }
  2982. // StartIndex sets the optional parameter "startIndex": Offset on which
  2983. // to return results when paging.
  2984. func (c *ReportsGetCall) StartIndex(startIndex int64) *ReportsGetCall {
  2985. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  2986. return c
  2987. }
  2988. // Status sets the optional parameter "status": Filters out all events
  2989. // that do not have the given status. Valid values: 'active',
  2990. // 'canceled', or 'invalid'.
  2991. //
  2992. // Possible values:
  2993. // "active" - Event is currently active.
  2994. // "canceled" - Event is currently canceled.
  2995. // "invalid" - Event is currently invalid.
  2996. func (c *ReportsGetCall) Status(status string) *ReportsGetCall {
  2997. c.urlParams_.Set("status", status)
  2998. return c
  2999. }
  3000. // Fields allows partial responses to be retrieved. See
  3001. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3002. // for more information.
  3003. func (c *ReportsGetCall) Fields(s ...googleapi.Field) *ReportsGetCall {
  3004. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3005. return c
  3006. }
  3007. // IfNoneMatch sets the optional parameter which makes the operation
  3008. // fail if the object's ETag matches the given value. This is useful for
  3009. // getting updates only after the object has changed since the last
  3010. // request. Use googleapi.IsNotModified to check whether the response
  3011. // error from Do is the result of In-None-Match.
  3012. func (c *ReportsGetCall) IfNoneMatch(entityTag string) *ReportsGetCall {
  3013. c.ifNoneMatch_ = entityTag
  3014. return c
  3015. }
  3016. // Context sets the context to be used in this call's Do method. Any
  3017. // pending HTTP request will be aborted if the provided context is
  3018. // canceled.
  3019. func (c *ReportsGetCall) Context(ctx context.Context) *ReportsGetCall {
  3020. c.ctx_ = ctx
  3021. return c
  3022. }
  3023. func (c *ReportsGetCall) doRequest(alt string) (*http.Response, error) {
  3024. var body io.Reader = nil
  3025. c.urlParams_.Set("alt", alt)
  3026. urls := googleapi.ResolveRelative(c.s.BasePath, "{role}/{roleId}/report/{reportType}")
  3027. urls += "?" + c.urlParams_.Encode()
  3028. req, _ := http.NewRequest("GET", urls, body)
  3029. googleapi.Expand(req.URL, map[string]string{
  3030. "role": c.role,
  3031. "roleId": c.roleId,
  3032. "reportType": c.reportType,
  3033. })
  3034. req.Header.Set("User-Agent", c.s.userAgent())
  3035. if c.ifNoneMatch_ != "" {
  3036. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3037. }
  3038. if c.ctx_ != nil {
  3039. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3040. }
  3041. return c.s.client.Do(req)
  3042. }
  3043. // Do executes the "gan.reports.get" call.
  3044. // Exactly one of *Report or error will be non-nil. Any non-2xx status
  3045. // code is an error. Response headers are in either
  3046. // *Report.ServerResponse.Header or (if a response was returned at all)
  3047. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3048. // check whether the returned error was because http.StatusNotModified
  3049. // was returned.
  3050. func (c *ReportsGetCall) Do(opts ...googleapi.CallOption) (*Report, error) {
  3051. gensupport.SetOptions(c.urlParams_, opts...)
  3052. res, err := c.doRequest("json")
  3053. if res != nil && res.StatusCode == http.StatusNotModified {
  3054. if res.Body != nil {
  3055. res.Body.Close()
  3056. }
  3057. return nil, &googleapi.Error{
  3058. Code: res.StatusCode,
  3059. Header: res.Header,
  3060. }
  3061. }
  3062. if err != nil {
  3063. return nil, err
  3064. }
  3065. defer googleapi.CloseBody(res)
  3066. if err := googleapi.CheckResponse(res); err != nil {
  3067. return nil, err
  3068. }
  3069. ret := &Report{
  3070. ServerResponse: googleapi.ServerResponse{
  3071. Header: res.Header,
  3072. HTTPStatusCode: res.StatusCode,
  3073. },
  3074. }
  3075. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3076. return nil, err
  3077. }
  3078. return ret, nil
  3079. // {
  3080. // "description": "Retrieves a report of the specified type.",
  3081. // "httpMethod": "GET",
  3082. // "id": "gan.reports.get",
  3083. // "parameterOrder": [
  3084. // "role",
  3085. // "roleId",
  3086. // "reportType"
  3087. // ],
  3088. // "parameters": {
  3089. // "advertiserId": {
  3090. // "description": "The IDs of the advertisers to look up, if applicable.",
  3091. // "location": "query",
  3092. // "repeated": true,
  3093. // "type": "string"
  3094. // },
  3095. // "calculateTotals": {
  3096. // "description": "Whether or not to calculate totals rows. Optional.",
  3097. // "location": "query",
  3098. // "type": "boolean"
  3099. // },
  3100. // "endDate": {
  3101. // "description": "The end date (exclusive), in RFC 3339 format, for the report data to be returned. Defaults to one day after startDate, if that is given, or today. Optional.",
  3102. // "location": "query",
  3103. // "type": "string"
  3104. // },
  3105. // "eventType": {
  3106. // "description": "Filters out all events that are not of the given type. Valid values: 'action', 'transaction', or 'charge'. Optional.",
  3107. // "enum": [
  3108. // "action",
  3109. // "charge",
  3110. // "transaction"
  3111. // ],
  3112. // "enumDescriptions": [
  3113. // "Event type is action.",
  3114. // "Event type is charge.",
  3115. // "Event type is transaction."
  3116. // ],
  3117. // "location": "query",
  3118. // "type": "string"
  3119. // },
  3120. // "linkId": {
  3121. // "description": "Filters to capture one of given link IDs. Optional.",
  3122. // "location": "query",
  3123. // "repeated": true,
  3124. // "type": "string"
  3125. // },
  3126. // "maxResults": {
  3127. // "description": "Max number of items to return in this page. Optional. Defaults to return all results.",
  3128. // "format": "uint32",
  3129. // "location": "query",
  3130. // "minimum": "0",
  3131. // "type": "integer"
  3132. // },
  3133. // "orderId": {
  3134. // "description": "Filters to capture one of the given order IDs. Optional.",
  3135. // "location": "query",
  3136. // "repeated": true,
  3137. // "type": "string"
  3138. // },
  3139. // "publisherId": {
  3140. // "description": "The IDs of the publishers to look up, if applicable.",
  3141. // "location": "query",
  3142. // "repeated": true,
  3143. // "type": "string"
  3144. // },
  3145. // "reportType": {
  3146. // "description": "The type of report being requested. Valid values: 'order_delta'. Required.",
  3147. // "enum": [
  3148. // "order_delta"
  3149. // ],
  3150. // "enumDescriptions": [
  3151. // "The order delta report type."
  3152. // ],
  3153. // "location": "path",
  3154. // "required": true,
  3155. // "type": "string"
  3156. // },
  3157. // "role": {
  3158. // "description": "The role of the requester. Valid values: 'advertisers' or 'publishers'.",
  3159. // "enum": [
  3160. // "advertisers",
  3161. // "publishers"
  3162. // ],
  3163. // "enumDescriptions": [
  3164. // "The requester is requesting as an advertiser.",
  3165. // "The requester is requesting as a publisher."
  3166. // ],
  3167. // "location": "path",
  3168. // "required": true,
  3169. // "type": "string"
  3170. // },
  3171. // "roleId": {
  3172. // "description": "The ID of the requesting advertiser or publisher.",
  3173. // "location": "path",
  3174. // "required": true,
  3175. // "type": "string"
  3176. // },
  3177. // "startDate": {
  3178. // "description": "The start date (inclusive), in RFC 3339 format, for the report data to be returned. Defaults to one day before endDate, if that is given, or yesterday. Optional.",
  3179. // "location": "query",
  3180. // "type": "string"
  3181. // },
  3182. // "startIndex": {
  3183. // "description": "Offset on which to return results when paging. Optional.",
  3184. // "format": "uint32",
  3185. // "location": "query",
  3186. // "minimum": "0",
  3187. // "type": "integer"
  3188. // },
  3189. // "status": {
  3190. // "description": "Filters out all events that do not have the given status. Valid values: 'active', 'canceled', or 'invalid'. Optional.",
  3191. // "enum": [
  3192. // "active",
  3193. // "canceled",
  3194. // "invalid"
  3195. // ],
  3196. // "enumDescriptions": [
  3197. // "Event is currently active.",
  3198. // "Event is currently canceled.",
  3199. // "Event is currently invalid."
  3200. // ],
  3201. // "location": "query",
  3202. // "type": "string"
  3203. // }
  3204. // },
  3205. // "path": "{role}/{roleId}/report/{reportType}",
  3206. // "response": {
  3207. // "$ref": "Report"
  3208. // }
  3209. // }
  3210. }