1
// Package adexchangebuyer provides access to the Ad Exchange Buyer API.
3
// See https://developers.google.com/ad-exchange/buyer-rest
7
// import "google.golang.org/api/adexchangebuyer/v1.1"
9
// adexchangebuyerService, err := adexchangebuyer.New(oauthHttpClient)
10
package adexchangebuyer
17
"google.golang.org/api/googleapi"
25
// Always reference these packages, just in case the auto-generated code
27
var _ = bytes.NewBuffer
30
var _ = json.NewDecoder
33
var _ = googleapi.Version
35
var _ = strings.Replace
37
const apiId = "adexchangebuyer:v1.1"
38
const apiName = "adexchangebuyer"
39
const apiVersion = "v1.1"
40
const basePath = "https://www.googleapis.com/adexchangebuyer/v1.1/"
42
// OAuth2 scopes used by this API.
44
// Manage your Ad Exchange buyer account configuration
45
AdexchangeBuyerScope = "https://www.googleapis.com/auth/adexchange.buyer"
48
func New(client *http.Client) (*Service, error) {
50
return nil, errors.New("client is nil")
52
s := &Service{client: client, BasePath: basePath}
53
s.Accounts = NewAccountsService(s)
54
s.Creatives = NewCreativesService(s)
60
BasePath string // API endpoint base URL
62
Accounts *AccountsService
64
Creatives *CreativesService
67
func NewAccountsService(s *Service) *AccountsService {
68
rs := &AccountsService{s: s}
72
type AccountsService struct {
76
func NewCreativesService(s *Service) *CreativesService {
77
rs := &CreativesService{s: s}
81
type CreativesService struct {
86
// BidderLocation: Your bidder locations that have distinct URLs.
87
BidderLocation []*AccountBidderLocation `json:"bidderLocation,omitempty"`
89
// CookieMatchingNid: The nid parameter value used in cookie match
90
// requests. Please contact your technical account manager if you need
92
CookieMatchingNid string `json:"cookieMatchingNid,omitempty"`
94
// CookieMatchingUrl: The base URL used in cookie match requests.
95
CookieMatchingUrl string `json:"cookieMatchingUrl,omitempty"`
98
Id int64 `json:"id,omitempty"`
100
// Kind: Resource type.
101
Kind string `json:"kind,omitempty"`
103
// MaximumActiveCreatives: The maximum number of active creatives that
104
// an account can have, where a creative is active if it was inserted or
105
// bid with in the last 30 days. Please contact your technical account
106
// manager if you need to change this.
107
MaximumActiveCreatives int64 `json:"maximumActiveCreatives,omitempty"`
109
// MaximumTotalQps: The sum of all bidderLocation.maximumQps values
110
// cannot exceed this. Please contact your technical account manager if
111
// you need to change this.
112
MaximumTotalQps int64 `json:"maximumTotalQps,omitempty"`
114
// NumberActiveCreatives: The number of creatives that this account
115
// inserted or bid with in the last 30 days.
116
NumberActiveCreatives int64 `json:"numberActiveCreatives,omitempty"`
119
type AccountBidderLocation struct {
120
// MaximumQps: The maximum queries per second the Ad Exchange will send.
121
MaximumQps int64 `json:"maximumQps,omitempty"`
123
// Region: The geographical region the Ad Exchange should send requests
124
// from. Only used by some quota systems, but always setting the value
125
// is recommended. Allowed values:
131
Region string `json:"region,omitempty"`
133
// Url: The URL to which the Ad Exchange will send bid requests.
134
Url string `json:"url,omitempty"`
137
type AccountsList struct {
138
// Items: A list of accounts.
139
Items []*Account `json:"items,omitempty"`
141
// Kind: Resource type.
142
Kind string `json:"kind,omitempty"`
145
type Creative struct {
146
// HTMLSnippet: The HTML snippet that displays the ad when inserted in
147
// the web page. If set, videoURL should not be set.
148
HTMLSnippet string `json:"HTMLSnippet,omitempty"`
150
// AccountId: Account id.
151
AccountId int64 `json:"accountId,omitempty"`
153
// AdvertiserId: Detected advertiser id, if any. Read-only. This field
154
// should not be set in requests.
155
AdvertiserId googleapi.Int64s `json:"advertiserId,omitempty"`
157
// AdvertiserName: The name of the company being advertised in the
159
AdvertiserName string `json:"advertiserName,omitempty"`
161
// Attribute: All attributes for the ads that may be shown from this
163
Attribute []int64 `json:"attribute,omitempty"`
165
// BuyerCreativeId: A buyer-specific id identifying the creative in this
167
BuyerCreativeId string `json:"buyerCreativeId,omitempty"`
169
// ClickThroughUrl: The set of destination urls for the snippet.
170
ClickThroughUrl []string `json:"clickThroughUrl,omitempty"`
172
// DisapprovalReasons: The reason for disapproval, if any. Note that not
173
// all disapproval reasons may be categorized, so it is possible for the
174
// creative to have a status of DISAPPROVED with an empty list for
175
// disapproval_reasons. In this case, please reach out to your TAM to
176
// help debug the issue. Read-only. This field should not be set in
178
DisapprovalReasons []string `json:"disapprovalReasons,omitempty"`
180
// Height: Ad height.
181
Height int64 `json:"height,omitempty"`
183
// Kind: Resource type.
184
Kind string `json:"kind,omitempty"`
186
// ProductCategories: Detected product categories, if any. Read-only.
187
// This field should not be set in requests.
188
ProductCategories []int64 `json:"productCategories,omitempty"`
190
// RestrictedCategories: All restricted categories for the ads that may
191
// be shown from this snippet.
192
RestrictedCategories []int64 `json:"restrictedCategories,omitempty"`
194
// SensitiveCategories: Detected sensitive categories, if any.
195
// Read-only. This field should not be set in requests.
196
SensitiveCategories []int64 `json:"sensitiveCategories,omitempty"`
198
// Status: Creative serving status. Read-only. This field should not be
200
Status string `json:"status,omitempty"`
202
// VendorType: All vendor types for the ads that may be shown from this
204
VendorType []int64 `json:"vendorType,omitempty"`
206
// VideoURL: The url to fetch a video ad. If set, HTMLSnippet should not
208
VideoURL string `json:"videoURL,omitempty"`
211
Width int64 `json:"width,omitempty"`
214
type CreativesList struct {
215
// Items: A list of creatives.
216
Items []*Creative `json:"items,omitempty"`
218
// Kind: Resource type.
219
Kind string `json:"kind,omitempty"`
221
// NextPageToken: Continuation token used to page through creatives. To
222
// retrieve the next page of results, set the next request's "pageToken"
224
NextPageToken string `json:"nextPageToken,omitempty"`
227
// method id "adexchangebuyer.accounts.get":
229
type AccountsGetCall struct {
232
opt_ map[string]interface{}
235
// Get: Gets one account by ID.
236
func (r *AccountsService) Get(id int64) *AccountsGetCall {
237
c := &AccountsGetCall{s: r.s, opt_: make(map[string]interface{})}
242
// Fields allows partial responses to be retrieved.
243
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
244
// for more information.
245
func (c *AccountsGetCall) Fields(s ...googleapi.Field) *AccountsGetCall {
246
c.opt_["fields"] = googleapi.CombineFields(s)
250
func (c *AccountsGetCall) Do() (*Account, error) {
251
var body io.Reader = nil
252
params := make(url.Values)
253
params.Set("alt", "json")
254
if v, ok := c.opt_["fields"]; ok {
255
params.Set("fields", fmt.Sprintf("%v", v))
257
urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{id}")
258
urls += "?" + params.Encode()
259
req, _ := http.NewRequest("GET", urls, body)
260
googleapi.Expand(req.URL, map[string]string{
261
"id": strconv.FormatInt(c.id, 10),
263
req.Header.Set("User-Agent", "google-api-go-client/0.5")
264
res, err := c.s.client.Do(req)
268
defer googleapi.CloseBody(res)
269
if err := googleapi.CheckResponse(res); err != nil {
273
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
278
// "description": "Gets one account by ID.",
279
// "httpMethod": "GET",
280
// "id": "adexchangebuyer.accounts.get",
281
// "parameterOrder": [
286
// "description": "The account id",
287
// "format": "int32",
288
// "location": "path",
293
// "path": "accounts/{id}",
298
// "https://www.googleapis.com/auth/adexchange.buyer"
304
// method id "adexchangebuyer.accounts.list":
306
type AccountsListCall struct {
308
opt_ map[string]interface{}
311
// List: Retrieves the authenticated user's list of accounts.
312
func (r *AccountsService) List() *AccountsListCall {
313
c := &AccountsListCall{s: r.s, opt_: make(map[string]interface{})}
317
// Fields allows partial responses to be retrieved.
318
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
319
// for more information.
320
func (c *AccountsListCall) Fields(s ...googleapi.Field) *AccountsListCall {
321
c.opt_["fields"] = googleapi.CombineFields(s)
325
func (c *AccountsListCall) Do() (*AccountsList, error) {
326
var body io.Reader = nil
327
params := make(url.Values)
328
params.Set("alt", "json")
329
if v, ok := c.opt_["fields"]; ok {
330
params.Set("fields", fmt.Sprintf("%v", v))
332
urls := googleapi.ResolveRelative(c.s.BasePath, "accounts")
333
urls += "?" + params.Encode()
334
req, _ := http.NewRequest("GET", urls, body)
335
googleapi.SetOpaque(req.URL)
336
req.Header.Set("User-Agent", "google-api-go-client/0.5")
337
res, err := c.s.client.Do(req)
341
defer googleapi.CloseBody(res)
342
if err := googleapi.CheckResponse(res); err != nil {
345
var ret *AccountsList
346
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
351
// "description": "Retrieves the authenticated user's list of accounts.",
352
// "httpMethod": "GET",
353
// "id": "adexchangebuyer.accounts.list",
354
// "path": "accounts",
356
// "$ref": "AccountsList"
359
// "https://www.googleapis.com/auth/adexchange.buyer"
365
// method id "adexchangebuyer.accounts.patch":
367
type AccountsPatchCall struct {
371
opt_ map[string]interface{}
374
// Patch: Updates an existing account. This method supports patch
376
func (r *AccountsService) Patch(id int64, account *Account) *AccountsPatchCall {
377
c := &AccountsPatchCall{s: r.s, opt_: make(map[string]interface{})}
383
// Fields allows partial responses to be retrieved.
384
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
385
// for more information.
386
func (c *AccountsPatchCall) Fields(s ...googleapi.Field) *AccountsPatchCall {
387
c.opt_["fields"] = googleapi.CombineFields(s)
391
func (c *AccountsPatchCall) Do() (*Account, error) {
392
var body io.Reader = nil
393
body, err := googleapi.WithoutDataWrapper.JSONReader(c.account)
397
ctype := "application/json"
398
params := make(url.Values)
399
params.Set("alt", "json")
400
if v, ok := c.opt_["fields"]; ok {
401
params.Set("fields", fmt.Sprintf("%v", v))
403
urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{id}")
404
urls += "?" + params.Encode()
405
req, _ := http.NewRequest("PATCH", urls, body)
406
googleapi.Expand(req.URL, map[string]string{
407
"id": strconv.FormatInt(c.id, 10),
409
req.Header.Set("Content-Type", ctype)
410
req.Header.Set("User-Agent", "google-api-go-client/0.5")
411
res, err := c.s.client.Do(req)
415
defer googleapi.CloseBody(res)
416
if err := googleapi.CheckResponse(res); err != nil {
420
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
425
// "description": "Updates an existing account. This method supports patch semantics.",
426
// "httpMethod": "PATCH",
427
// "id": "adexchangebuyer.accounts.patch",
428
// "parameterOrder": [
433
// "description": "The account id",
434
// "format": "int32",
435
// "location": "path",
440
// "path": "accounts/{id}",
448
// "https://www.googleapis.com/auth/adexchange.buyer"
454
// method id "adexchangebuyer.accounts.update":
456
type AccountsUpdateCall struct {
460
opt_ map[string]interface{}
463
// Update: Updates an existing account.
464
func (r *AccountsService) Update(id int64, account *Account) *AccountsUpdateCall {
465
c := &AccountsUpdateCall{s: r.s, opt_: make(map[string]interface{})}
471
// Fields allows partial responses to be retrieved.
472
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
473
// for more information.
474
func (c *AccountsUpdateCall) Fields(s ...googleapi.Field) *AccountsUpdateCall {
475
c.opt_["fields"] = googleapi.CombineFields(s)
479
func (c *AccountsUpdateCall) Do() (*Account, error) {
480
var body io.Reader = nil
481
body, err := googleapi.WithoutDataWrapper.JSONReader(c.account)
485
ctype := "application/json"
486
params := make(url.Values)
487
params.Set("alt", "json")
488
if v, ok := c.opt_["fields"]; ok {
489
params.Set("fields", fmt.Sprintf("%v", v))
491
urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{id}")
492
urls += "?" + params.Encode()
493
req, _ := http.NewRequest("PUT", urls, body)
494
googleapi.Expand(req.URL, map[string]string{
495
"id": strconv.FormatInt(c.id, 10),
497
req.Header.Set("Content-Type", ctype)
498
req.Header.Set("User-Agent", "google-api-go-client/0.5")
499
res, err := c.s.client.Do(req)
503
defer googleapi.CloseBody(res)
504
if err := googleapi.CheckResponse(res); err != nil {
508
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
513
// "description": "Updates an existing account.",
514
// "httpMethod": "PUT",
515
// "id": "adexchangebuyer.accounts.update",
516
// "parameterOrder": [
521
// "description": "The account id",
522
// "format": "int32",
523
// "location": "path",
528
// "path": "accounts/{id}",
536
// "https://www.googleapis.com/auth/adexchange.buyer"
542
// method id "adexchangebuyer.creatives.get":
544
type CreativesGetCall struct {
547
buyerCreativeId string
548
opt_ map[string]interface{}
551
// Get: Gets the status for a single creative. A creative will be
552
// available 30-40 minutes after submission.
553
func (r *CreativesService) Get(accountId int64, buyerCreativeId string) *CreativesGetCall {
554
c := &CreativesGetCall{s: r.s, opt_: make(map[string]interface{})}
555
c.accountId = accountId
556
c.buyerCreativeId = buyerCreativeId
560
// Fields allows partial responses to be retrieved.
561
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
562
// for more information.
563
func (c *CreativesGetCall) Fields(s ...googleapi.Field) *CreativesGetCall {
564
c.opt_["fields"] = googleapi.CombineFields(s)
568
func (c *CreativesGetCall) Do() (*Creative, error) {
569
var body io.Reader = nil
570
params := make(url.Values)
571
params.Set("alt", "json")
572
if v, ok := c.opt_["fields"]; ok {
573
params.Set("fields", fmt.Sprintf("%v", v))
575
urls := googleapi.ResolveRelative(c.s.BasePath, "creatives/{accountId}/{buyerCreativeId}")
576
urls += "?" + params.Encode()
577
req, _ := http.NewRequest("GET", urls, body)
578
googleapi.Expand(req.URL, map[string]string{
579
"accountId": strconv.FormatInt(c.accountId, 10),
580
"buyerCreativeId": c.buyerCreativeId,
582
req.Header.Set("User-Agent", "google-api-go-client/0.5")
583
res, err := c.s.client.Do(req)
587
defer googleapi.CloseBody(res)
588
if err := googleapi.CheckResponse(res); err != nil {
592
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
597
// "description": "Gets the status for a single creative. A creative will be available 30-40 minutes after submission.",
598
// "httpMethod": "GET",
599
// "id": "adexchangebuyer.creatives.get",
600
// "parameterOrder": [
606
// "description": "The id for the account that will serve this creative.",
607
// "format": "int32",
608
// "location": "path",
612
// "buyerCreativeId": {
613
// "description": "The buyer-specific id for this creative.",
614
// "location": "path",
619
// "path": "creatives/{accountId}/{buyerCreativeId}",
621
// "$ref": "Creative"
624
// "https://www.googleapis.com/auth/adexchange.buyer"
630
// method id "adexchangebuyer.creatives.insert":
632
type CreativesInsertCall struct {
635
opt_ map[string]interface{}
638
// Insert: Submit a new creative.
639
func (r *CreativesService) Insert(creative *Creative) *CreativesInsertCall {
640
c := &CreativesInsertCall{s: r.s, opt_: make(map[string]interface{})}
641
c.creative = creative
645
// Fields allows partial responses to be retrieved.
646
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
647
// for more information.
648
func (c *CreativesInsertCall) Fields(s ...googleapi.Field) *CreativesInsertCall {
649
c.opt_["fields"] = googleapi.CombineFields(s)
653
func (c *CreativesInsertCall) Do() (*Creative, error) {
654
var body io.Reader = nil
655
body, err := googleapi.WithoutDataWrapper.JSONReader(c.creative)
659
ctype := "application/json"
660
params := make(url.Values)
661
params.Set("alt", "json")
662
if v, ok := c.opt_["fields"]; ok {
663
params.Set("fields", fmt.Sprintf("%v", v))
665
urls := googleapi.ResolveRelative(c.s.BasePath, "creatives")
666
urls += "?" + params.Encode()
667
req, _ := http.NewRequest("POST", urls, body)
668
googleapi.SetOpaque(req.URL)
669
req.Header.Set("Content-Type", ctype)
670
req.Header.Set("User-Agent", "google-api-go-client/0.5")
671
res, err := c.s.client.Do(req)
675
defer googleapi.CloseBody(res)
676
if err := googleapi.CheckResponse(res); err != nil {
680
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
685
// "description": "Submit a new creative.",
686
// "httpMethod": "POST",
687
// "id": "adexchangebuyer.creatives.insert",
688
// "path": "creatives",
690
// "$ref": "Creative"
693
// "$ref": "Creative"
696
// "https://www.googleapis.com/auth/adexchange.buyer"
702
// method id "adexchangebuyer.creatives.list":
704
type CreativesListCall struct {
706
opt_ map[string]interface{}
709
// List: Retrieves a list of the authenticated user's active creatives.
710
// A creative will be available 30-40 minutes after submission.
711
func (r *CreativesService) List() *CreativesListCall {
712
c := &CreativesListCall{s: r.s, opt_: make(map[string]interface{})}
716
// MaxResults sets the optional parameter "maxResults": Maximum number
717
// of entries returned on one result page. If not set, the default is
719
func (c *CreativesListCall) MaxResults(maxResults int64) *CreativesListCall {
720
c.opt_["maxResults"] = maxResults
724
// PageToken sets the optional parameter "pageToken": A continuation
725
// token, used to page through ad clients. To retrieve the next page,
726
// set this parameter to the value of "nextPageToken" from the previous
728
func (c *CreativesListCall) PageToken(pageToken string) *CreativesListCall {
729
c.opt_["pageToken"] = pageToken
733
// StatusFilter sets the optional parameter "statusFilter": When
734
// specified, only creatives having the given status are returned.
735
func (c *CreativesListCall) StatusFilter(statusFilter string) *CreativesListCall {
736
c.opt_["statusFilter"] = statusFilter
740
// Fields allows partial responses to be retrieved.
741
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
742
// for more information.
743
func (c *CreativesListCall) Fields(s ...googleapi.Field) *CreativesListCall {
744
c.opt_["fields"] = googleapi.CombineFields(s)
748
func (c *CreativesListCall) Do() (*CreativesList, error) {
749
var body io.Reader = nil
750
params := make(url.Values)
751
params.Set("alt", "json")
752
if v, ok := c.opt_["maxResults"]; ok {
753
params.Set("maxResults", fmt.Sprintf("%v", v))
755
if v, ok := c.opt_["pageToken"]; ok {
756
params.Set("pageToken", fmt.Sprintf("%v", v))
758
if v, ok := c.opt_["statusFilter"]; ok {
759
params.Set("statusFilter", fmt.Sprintf("%v", v))
761
if v, ok := c.opt_["fields"]; ok {
762
params.Set("fields", fmt.Sprintf("%v", v))
764
urls := googleapi.ResolveRelative(c.s.BasePath, "creatives")
765
urls += "?" + params.Encode()
766
req, _ := http.NewRequest("GET", urls, body)
767
googleapi.SetOpaque(req.URL)
768
req.Header.Set("User-Agent", "google-api-go-client/0.5")
769
res, err := c.s.client.Do(req)
773
defer googleapi.CloseBody(res)
774
if err := googleapi.CheckResponse(res); err != nil {
777
var ret *CreativesList
778
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
783
// "description": "Retrieves a list of the authenticated user's active creatives. A creative will be available 30-40 minutes after submission.",
784
// "httpMethod": "GET",
785
// "id": "adexchangebuyer.creatives.list",
788
// "description": "Maximum number of entries returned on one result page. If not set, the default is 100. Optional.",
789
// "format": "uint32",
790
// "location": "query",
791
// "maximum": "1000",
796
// "description": "A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response. Optional.",
797
// "location": "query",
801
// "description": "When specified, only creatives having the given status are returned.",
807
// "enumDescriptions": [
808
// "Creatives which have been approved.",
809
// "Creatives which have been disapproved.",
810
// "Creatives whose status is not yet checked."
812
// "location": "query",
816
// "path": "creatives",
818
// "$ref": "CreativesList"
821
// "https://www.googleapis.com/auth/adexchange.buyer"