1// Copyright 2020 Google LLC. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Code generated file. DO NOT EDIT. 6 7// Package adexchangebuyer provides access to the Ad Exchange Buyer API. 8// 9// For product documentation, see: https://developers.google.com/ad-exchange/buyer-rest 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/adexchangebuyer/v1.2" 16// ... 17// ctx := context.Background() 18// adexchangebuyerService, err := adexchangebuyer.NewService(ctx) 19// 20// In this example, Google Application Default Credentials are used for authentication. 21// 22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 23// 24// Other authentication options 25// 26// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 27// 28// adexchangebuyerService, err := adexchangebuyer.NewService(ctx, option.WithAPIKey("AIza...")) 29// 30// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 31// 32// config := &oauth2.Config{...} 33// // ... 34// token, err := config.Exchange(ctx, ...) 35// adexchangebuyerService, err := adexchangebuyer.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 36// 37// See https://godoc.org/google.golang.org/api/option/ for details on options. 38package adexchangebuyer // import "google.golang.org/api/adexchangebuyer/v1.2" 39 40import ( 41 "bytes" 42 "context" 43 "encoding/json" 44 "errors" 45 "fmt" 46 "io" 47 "net/http" 48 "net/url" 49 "strconv" 50 "strings" 51 52 googleapi "google.golang.org/api/googleapi" 53 gensupport "google.golang.org/api/internal/gensupport" 54 option "google.golang.org/api/option" 55 internaloption "google.golang.org/api/option/internaloption" 56 htransport "google.golang.org/api/transport/http" 57) 58 59// Always reference these packages, just in case the auto-generated code 60// below doesn't. 61var _ = bytes.NewBuffer 62var _ = strconv.Itoa 63var _ = fmt.Sprintf 64var _ = json.NewDecoder 65var _ = io.Copy 66var _ = url.Parse 67var _ = gensupport.MarshalJSON 68var _ = googleapi.Version 69var _ = errors.New 70var _ = strings.Replace 71var _ = context.Canceled 72var _ = internaloption.WithDefaultEndpoint 73 74const apiId = "adexchangebuyer:v1.2" 75const apiName = "adexchangebuyer" 76const apiVersion = "v1.2" 77const basePath = "https://www.googleapis.com/adexchangebuyer/v1.2/" 78 79// OAuth2 scopes used by this API. 80const ( 81 // Manage your Ad Exchange buyer account configuration 82 AdexchangeBuyerScope = "https://www.googleapis.com/auth/adexchange.buyer" 83) 84 85// NewService creates a new Service. 86func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 87 scopesOption := option.WithScopes( 88 "https://www.googleapis.com/auth/adexchange.buyer", 89 ) 90 // NOTE: prepend, so we don't override user-specified scopes. 91 opts = append([]option.ClientOption{scopesOption}, opts...) 92 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 93 client, endpoint, err := htransport.NewClient(ctx, opts...) 94 if err != nil { 95 return nil, err 96 } 97 s, err := New(client) 98 if err != nil { 99 return nil, err 100 } 101 if endpoint != "" { 102 s.BasePath = endpoint 103 } 104 return s, nil 105} 106 107// New creates a new Service. It uses the provided http.Client for requests. 108// 109// Deprecated: please use NewService instead. 110// To provide a custom HTTP client, use option.WithHTTPClient. 111// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 112func New(client *http.Client) (*Service, error) { 113 if client == nil { 114 return nil, errors.New("client is nil") 115 } 116 s := &Service{client: client, BasePath: basePath} 117 s.Accounts = NewAccountsService(s) 118 s.Creatives = NewCreativesService(s) 119 return s, nil 120} 121 122type Service struct { 123 client *http.Client 124 BasePath string // API endpoint base URL 125 UserAgent string // optional additional User-Agent fragment 126 127 Accounts *AccountsService 128 129 Creatives *CreativesService 130} 131 132func (s *Service) userAgent() string { 133 if s.UserAgent == "" { 134 return googleapi.UserAgent 135 } 136 return googleapi.UserAgent + " " + s.UserAgent 137} 138 139func NewAccountsService(s *Service) *AccountsService { 140 rs := &AccountsService{s: s} 141 return rs 142} 143 144type AccountsService struct { 145 s *Service 146} 147 148func NewCreativesService(s *Service) *CreativesService { 149 rs := &CreativesService{s: s} 150 return rs 151} 152 153type CreativesService struct { 154 s *Service 155} 156 157// Account: Configuration data for an Ad Exchange buyer account. 158type Account struct { 159 // BidderLocation: Your bidder locations that have distinct URLs. 160 BidderLocation []*AccountBidderLocation `json:"bidderLocation,omitempty"` 161 162 // CookieMatchingNid: The nid parameter value used in cookie match 163 // requests. Please contact your technical account manager if you need 164 // to change this. 165 CookieMatchingNid string `json:"cookieMatchingNid,omitempty"` 166 167 // CookieMatchingUrl: The base URL used in cookie match requests. 168 CookieMatchingUrl string `json:"cookieMatchingUrl,omitempty"` 169 170 // Id: Account id. 171 Id int64 `json:"id,omitempty"` 172 173 // Kind: Resource type. 174 Kind string `json:"kind,omitempty"` 175 176 // MaximumActiveCreatives: The maximum number of active creatives that 177 // an account can have, where a creative is active if it was inserted or 178 // bid with in the last 30 days. Please contact your technical account 179 // manager if you need to change this. 180 MaximumActiveCreatives int64 `json:"maximumActiveCreatives,omitempty"` 181 182 // MaximumTotalQps: The sum of all bidderLocation.maximumQps values 183 // cannot exceed this. Please contact your technical account manager if 184 // you need to change this. 185 MaximumTotalQps int64 `json:"maximumTotalQps,omitempty"` 186 187 // NumberActiveCreatives: The number of creatives that this account 188 // inserted or bid with in the last 30 days. 189 NumberActiveCreatives int64 `json:"numberActiveCreatives,omitempty"` 190 191 // ServerResponse contains the HTTP response code and headers from the 192 // server. 193 googleapi.ServerResponse `json:"-"` 194 195 // ForceSendFields is a list of field names (e.g. "BidderLocation") to 196 // unconditionally include in API requests. By default, fields with 197 // empty values are omitted from API requests. However, any non-pointer, 198 // non-interface field appearing in ForceSendFields will be sent to the 199 // server regardless of whether the field is empty or not. This may be 200 // used to include empty fields in Patch requests. 201 ForceSendFields []string `json:"-"` 202 203 // NullFields is a list of field names (e.g. "BidderLocation") to 204 // include in API requests with the JSON null value. By default, fields 205 // with empty values are omitted from API requests. However, any field 206 // with an empty value appearing in NullFields will be sent to the 207 // server as null. It is an error if a field in this list has a 208 // non-empty value. This may be used to include null fields in Patch 209 // requests. 210 NullFields []string `json:"-"` 211} 212 213func (s *Account) MarshalJSON() ([]byte, error) { 214 type NoMethod Account 215 raw := NoMethod(*s) 216 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 217} 218 219type AccountBidderLocation struct { 220 // MaximumQps: The maximum queries per second the Ad Exchange will send. 221 MaximumQps int64 `json:"maximumQps,omitempty"` 222 223 // Region: The geographical region the Ad Exchange should send requests 224 // from. Only used by some quota systems, but always setting the value 225 // is recommended. Allowed values: 226 // - ASIA 227 // - EUROPE 228 // - US_EAST 229 // - US_WEST 230 Region string `json:"region,omitempty"` 231 232 // Url: The URL to which the Ad Exchange will send bid requests. 233 Url string `json:"url,omitempty"` 234 235 // ForceSendFields is a list of field names (e.g. "MaximumQps") to 236 // unconditionally include in API requests. By default, fields with 237 // empty values are omitted from API requests. However, any non-pointer, 238 // non-interface field appearing in ForceSendFields will be sent to the 239 // server regardless of whether the field is empty or not. This may be 240 // used to include empty fields in Patch requests. 241 ForceSendFields []string `json:"-"` 242 243 // NullFields is a list of field names (e.g. "MaximumQps") to include in 244 // API requests with the JSON null value. By default, fields with empty 245 // values are omitted from API requests. However, any field with an 246 // empty value appearing in NullFields will be sent to the server as 247 // null. It is an error if a field in this list has a non-empty value. 248 // This may be used to include null fields in Patch requests. 249 NullFields []string `json:"-"` 250} 251 252func (s *AccountBidderLocation) MarshalJSON() ([]byte, error) { 253 type NoMethod AccountBidderLocation 254 raw := NoMethod(*s) 255 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 256} 257 258// AccountsList: An account feed lists Ad Exchange buyer accounts that 259// the user has access to. Each entry in the feed corresponds to a 260// single buyer account. 261type AccountsList struct { 262 // Items: A list of accounts. 263 Items []*Account `json:"items,omitempty"` 264 265 // Kind: Resource type. 266 Kind string `json:"kind,omitempty"` 267 268 // ServerResponse contains the HTTP response code and headers from the 269 // server. 270 googleapi.ServerResponse `json:"-"` 271 272 // ForceSendFields is a list of field names (e.g. "Items") to 273 // unconditionally include in API requests. By default, fields with 274 // empty values are omitted from API requests. However, any non-pointer, 275 // non-interface field appearing in ForceSendFields will be sent to the 276 // server regardless of whether the field is empty or not. This may be 277 // used to include empty fields in Patch requests. 278 ForceSendFields []string `json:"-"` 279 280 // NullFields is a list of field names (e.g. "Items") to include in API 281 // requests with the JSON null value. By default, fields with empty 282 // values are omitted from API requests. However, any field with an 283 // empty value appearing in NullFields will be sent to the server as 284 // null. It is an error if a field in this list has a non-empty value. 285 // This may be used to include null fields in Patch requests. 286 NullFields []string `json:"-"` 287} 288 289func (s *AccountsList) MarshalJSON() ([]byte, error) { 290 type NoMethod AccountsList 291 raw := NoMethod(*s) 292 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 293} 294 295// Creative: A creative and its classification data. 296type Creative struct { 297 // HTMLSnippet: The HTML snippet that displays the ad when inserted in 298 // the web page. If set, videoURL should not be set. 299 HTMLSnippet string `json:"HTMLSnippet,omitempty"` 300 301 // AccountId: Account id. 302 AccountId int64 `json:"accountId,omitempty"` 303 304 // AdvertiserId: Detected advertiser id, if any. Read-only. This field 305 // should not be set in requests. 306 AdvertiserId googleapi.Int64s `json:"advertiserId,omitempty"` 307 308 // AdvertiserName: The name of the company being advertised in the 309 // creative. 310 AdvertiserName string `json:"advertiserName,omitempty"` 311 312 // AgencyId: The agency id for this creative. 313 AgencyId int64 `json:"agencyId,omitempty,string"` 314 315 // ApiUploadTimestamp: The last upload timestamp of this creative if it 316 // was uploaded via API. Read-only. The value of this field is 317 // generated, and will be ignored for uploads. (formatted RFC 3339 318 // timestamp). 319 ApiUploadTimestamp string `json:"apiUploadTimestamp,omitempty"` 320 321 // Attribute: All attributes for the ads that may be shown from this 322 // snippet. 323 Attribute []int64 `json:"attribute,omitempty"` 324 325 // BuyerCreativeId: A buyer-specific id identifying the creative in this 326 // ad. 327 BuyerCreativeId string `json:"buyerCreativeId,omitempty"` 328 329 // ClickThroughUrl: The set of destination urls for the snippet. 330 ClickThroughUrl []string `json:"clickThroughUrl,omitempty"` 331 332 // Corrections: Shows any corrections that were applied to this 333 // creative. Read-only. This field should not be set in requests. 334 Corrections []*CreativeCorrections `json:"corrections,omitempty"` 335 336 // DisapprovalReasons: The reasons for disapproval, if any. Note that 337 // not all disapproval reasons may be categorized, so it is possible for 338 // the creative to have a status of DISAPPROVED with an empty list for 339 // disapproval_reasons. In this case, please reach out to your TAM to 340 // help debug the issue. Read-only. This field should not be set in 341 // requests. 342 DisapprovalReasons []*CreativeDisapprovalReasons `json:"disapprovalReasons,omitempty"` 343 344 // FilteringReasons: The filtering reasons for the creative. Read-only. 345 // This field should not be set in requests. 346 FilteringReasons *CreativeFilteringReasons `json:"filteringReasons,omitempty"` 347 348 // Height: Ad height. 349 Height int64 `json:"height,omitempty"` 350 351 // ImpressionTrackingUrl: The set of urls to be called to record an 352 // impression. 353 ImpressionTrackingUrl []string `json:"impressionTrackingUrl,omitempty"` 354 355 // Kind: Resource type. 356 Kind string `json:"kind,omitempty"` 357 358 // ProductCategories: Detected product categories, if any. Read-only. 359 // This field should not be set in requests. 360 ProductCategories []int64 `json:"productCategories,omitempty"` 361 362 // RestrictedCategories: All restricted categories for the ads that may 363 // be shown from this snippet. 364 RestrictedCategories []int64 `json:"restrictedCategories,omitempty"` 365 366 // SensitiveCategories: Detected sensitive categories, if any. 367 // Read-only. This field should not be set in requests. 368 SensitiveCategories []int64 `json:"sensitiveCategories,omitempty"` 369 370 // Status: Creative serving status. Read-only. This field should not be 371 // set in requests. 372 Status string `json:"status,omitempty"` 373 374 // VendorType: All vendor types for the ads that may be shown from this 375 // snippet. 376 VendorType []int64 `json:"vendorType,omitempty"` 377 378 // Version: The version for this creative. Read-only. This field should 379 // not be set in requests. 380 Version int64 `json:"version,omitempty"` 381 382 // VideoURL: The url to fetch a video ad. If set, HTMLSnippet should not 383 // be set. 384 VideoURL string `json:"videoURL,omitempty"` 385 386 // Width: Ad width. 387 Width int64 `json:"width,omitempty"` 388 389 // ServerResponse contains the HTTP response code and headers from the 390 // server. 391 googleapi.ServerResponse `json:"-"` 392 393 // ForceSendFields is a list of field names (e.g. "HTMLSnippet") to 394 // unconditionally include in API requests. By default, fields with 395 // empty values are omitted from API requests. However, any non-pointer, 396 // non-interface field appearing in ForceSendFields will be sent to the 397 // server regardless of whether the field is empty or not. This may be 398 // used to include empty fields in Patch requests. 399 ForceSendFields []string `json:"-"` 400 401 // NullFields is a list of field names (e.g. "HTMLSnippet") to include 402 // in API requests with the JSON null value. By default, fields with 403 // empty values are omitted from API requests. However, any field with 404 // an empty value appearing in NullFields will be sent to the server as 405 // null. It is an error if a field in this list has a non-empty value. 406 // This may be used to include null fields in Patch requests. 407 NullFields []string `json:"-"` 408} 409 410func (s *Creative) MarshalJSON() ([]byte, error) { 411 type NoMethod Creative 412 raw := NoMethod(*s) 413 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 414} 415 416type CreativeCorrections struct { 417 // Details: Additional details about the correction. 418 Details []string `json:"details,omitempty"` 419 420 // Reason: The type of correction that was applied to the creative. 421 Reason string `json:"reason,omitempty"` 422 423 // ForceSendFields is a list of field names (e.g. "Details") to 424 // unconditionally include in API requests. By default, fields with 425 // empty values are omitted from API requests. However, any non-pointer, 426 // non-interface field appearing in ForceSendFields will be sent to the 427 // server regardless of whether the field is empty or not. This may be 428 // used to include empty fields in Patch requests. 429 ForceSendFields []string `json:"-"` 430 431 // NullFields is a list of field names (e.g. "Details") to include in 432 // API requests with the JSON null value. By default, fields with empty 433 // values are omitted from API requests. However, any field with an 434 // empty value appearing in NullFields will be sent to the server as 435 // null. It is an error if a field in this list has a non-empty value. 436 // This may be used to include null fields in Patch requests. 437 NullFields []string `json:"-"` 438} 439 440func (s *CreativeCorrections) MarshalJSON() ([]byte, error) { 441 type NoMethod CreativeCorrections 442 raw := NoMethod(*s) 443 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 444} 445 446type CreativeDisapprovalReasons struct { 447 // Details: Additional details about the reason for disapproval. 448 Details []string `json:"details,omitempty"` 449 450 // Reason: The categorized reason for disapproval. 451 Reason string `json:"reason,omitempty"` 452 453 // ForceSendFields is a list of field names (e.g. "Details") to 454 // unconditionally include in API requests. By default, fields with 455 // empty values are omitted from API requests. However, any non-pointer, 456 // non-interface field appearing in ForceSendFields will be sent to the 457 // server regardless of whether the field is empty or not. This may be 458 // used to include empty fields in Patch requests. 459 ForceSendFields []string `json:"-"` 460 461 // NullFields is a list of field names (e.g. "Details") to include in 462 // API requests with the JSON null value. By default, fields with empty 463 // values are omitted from API requests. However, any field with an 464 // empty value appearing in NullFields will be sent to the server as 465 // null. It is an error if a field in this list has a non-empty value. 466 // This may be used to include null fields in Patch requests. 467 NullFields []string `json:"-"` 468} 469 470func (s *CreativeDisapprovalReasons) MarshalJSON() ([]byte, error) { 471 type NoMethod CreativeDisapprovalReasons 472 raw := NoMethod(*s) 473 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 474} 475 476// CreativeFilteringReasons: The filtering reasons for the creative. 477// Read-only. This field should not be set in requests. 478type CreativeFilteringReasons struct { 479 // Date: The date in ISO 8601 format for the data. The data is collected 480 // from 00:00:00 to 23:59:59 in PST. 481 Date string `json:"date,omitempty"` 482 483 // Reasons: The filtering reasons. 484 Reasons []*CreativeFilteringReasonsReasons `json:"reasons,omitempty"` 485 486 // ForceSendFields is a list of field names (e.g. "Date") to 487 // unconditionally include in API requests. By default, fields with 488 // empty values are omitted from API requests. However, any non-pointer, 489 // non-interface field appearing in ForceSendFields will be sent to the 490 // server regardless of whether the field is empty or not. This may be 491 // used to include empty fields in Patch requests. 492 ForceSendFields []string `json:"-"` 493 494 // NullFields is a list of field names (e.g. "Date") to include in API 495 // requests with the JSON null value. By default, fields with empty 496 // values are omitted from API requests. However, any field with an 497 // empty value appearing in NullFields will be sent to the server as 498 // null. It is an error if a field in this list has a non-empty value. 499 // This may be used to include null fields in Patch requests. 500 NullFields []string `json:"-"` 501} 502 503func (s *CreativeFilteringReasons) MarshalJSON() ([]byte, error) { 504 type NoMethod CreativeFilteringReasons 505 raw := NoMethod(*s) 506 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 507} 508 509type CreativeFilteringReasonsReasons struct { 510 // FilteringCount: The number of times the creative was filtered for the 511 // status. The count is aggregated across all publishers on the 512 // exchange. 513 FilteringCount int64 `json:"filteringCount,omitempty,string"` 514 515 // FilteringStatus: The filtering status code. Please refer to the 516 // creative-status-codes.txt file for different statuses. 517 FilteringStatus int64 `json:"filteringStatus,omitempty"` 518 519 // ForceSendFields is a list of field names (e.g. "FilteringCount") to 520 // unconditionally include in API requests. By default, fields with 521 // empty values are omitted from API requests. However, any non-pointer, 522 // non-interface field appearing in ForceSendFields will be sent to the 523 // server regardless of whether the field is empty or not. This may be 524 // used to include empty fields in Patch requests. 525 ForceSendFields []string `json:"-"` 526 527 // NullFields is a list of field names (e.g. "FilteringCount") to 528 // include in API requests with the JSON null value. By default, fields 529 // with empty values are omitted from API requests. However, any field 530 // with an empty value appearing in NullFields will be sent to the 531 // server as null. It is an error if a field in this list has a 532 // non-empty value. This may be used to include null fields in Patch 533 // requests. 534 NullFields []string `json:"-"` 535} 536 537func (s *CreativeFilteringReasonsReasons) MarshalJSON() ([]byte, error) { 538 type NoMethod CreativeFilteringReasonsReasons 539 raw := NoMethod(*s) 540 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 541} 542 543// CreativesList: The creatives feed lists the active creatives for the 544// Ad Exchange buyer accounts that the user has access to. Each entry in 545// the feed corresponds to a single creative. 546type CreativesList struct { 547 // Items: A list of creatives. 548 Items []*Creative `json:"items,omitempty"` 549 550 // Kind: Resource type. 551 Kind string `json:"kind,omitempty"` 552 553 // NextPageToken: Continuation token used to page through creatives. To 554 // retrieve the next page of results, set the next request's "pageToken" 555 // value to this. 556 NextPageToken string `json:"nextPageToken,omitempty"` 557 558 // ServerResponse contains the HTTP response code and headers from the 559 // server. 560 googleapi.ServerResponse `json:"-"` 561 562 // ForceSendFields is a list of field names (e.g. "Items") to 563 // unconditionally include in API requests. By default, fields with 564 // empty values are omitted from API requests. However, any non-pointer, 565 // non-interface field appearing in ForceSendFields will be sent to the 566 // server regardless of whether the field is empty or not. This may be 567 // used to include empty fields in Patch requests. 568 ForceSendFields []string `json:"-"` 569 570 // NullFields is a list of field names (e.g. "Items") to include in API 571 // requests with the JSON null value. By default, fields with empty 572 // values are omitted from API requests. However, any field with an 573 // empty value appearing in NullFields will be sent to the server as 574 // null. It is an error if a field in this list has a non-empty value. 575 // This may be used to include null fields in Patch requests. 576 NullFields []string `json:"-"` 577} 578 579func (s *CreativesList) MarshalJSON() ([]byte, error) { 580 type NoMethod CreativesList 581 raw := NoMethod(*s) 582 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 583} 584 585// method id "adexchangebuyer.accounts.get": 586 587type AccountsGetCall struct { 588 s *Service 589 id int64 590 urlParams_ gensupport.URLParams 591 ifNoneMatch_ string 592 ctx_ context.Context 593 header_ http.Header 594} 595 596// Get: Gets one account by ID. 597func (r *AccountsService) Get(id int64) *AccountsGetCall { 598 c := &AccountsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 599 c.id = id 600 return c 601} 602 603// Fields allows partial responses to be retrieved. See 604// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 605// for more information. 606func (c *AccountsGetCall) Fields(s ...googleapi.Field) *AccountsGetCall { 607 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 608 return c 609} 610 611// IfNoneMatch sets the optional parameter which makes the operation 612// fail if the object's ETag matches the given value. This is useful for 613// getting updates only after the object has changed since the last 614// request. Use googleapi.IsNotModified to check whether the response 615// error from Do is the result of In-None-Match. 616func (c *AccountsGetCall) IfNoneMatch(entityTag string) *AccountsGetCall { 617 c.ifNoneMatch_ = entityTag 618 return c 619} 620 621// Context sets the context to be used in this call's Do method. Any 622// pending HTTP request will be aborted if the provided context is 623// canceled. 624func (c *AccountsGetCall) Context(ctx context.Context) *AccountsGetCall { 625 c.ctx_ = ctx 626 return c 627} 628 629// Header returns an http.Header that can be modified by the caller to 630// add HTTP headers to the request. 631func (c *AccountsGetCall) Header() http.Header { 632 if c.header_ == nil { 633 c.header_ = make(http.Header) 634 } 635 return c.header_ 636} 637 638func (c *AccountsGetCall) doRequest(alt string) (*http.Response, error) { 639 reqHeaders := make(http.Header) 640 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 641 for k, v := range c.header_ { 642 reqHeaders[k] = v 643 } 644 reqHeaders.Set("User-Agent", c.s.userAgent()) 645 if c.ifNoneMatch_ != "" { 646 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 647 } 648 var body io.Reader = nil 649 c.urlParams_.Set("alt", alt) 650 c.urlParams_.Set("prettyPrint", "false") 651 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{id}") 652 urls += "?" + c.urlParams_.Encode() 653 req, err := http.NewRequest("GET", urls, body) 654 if err != nil { 655 return nil, err 656 } 657 req.Header = reqHeaders 658 googleapi.Expand(req.URL, map[string]string{ 659 "id": strconv.FormatInt(c.id, 10), 660 }) 661 return gensupport.SendRequest(c.ctx_, c.s.client, req) 662} 663 664// Do executes the "adexchangebuyer.accounts.get" call. 665// Exactly one of *Account or error will be non-nil. Any non-2xx status 666// code is an error. Response headers are in either 667// *Account.ServerResponse.Header or (if a response was returned at all) 668// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 669// check whether the returned error was because http.StatusNotModified 670// was returned. 671func (c *AccountsGetCall) Do(opts ...googleapi.CallOption) (*Account, error) { 672 gensupport.SetOptions(c.urlParams_, opts...) 673 res, err := c.doRequest("json") 674 if res != nil && res.StatusCode == http.StatusNotModified { 675 if res.Body != nil { 676 res.Body.Close() 677 } 678 return nil, &googleapi.Error{ 679 Code: res.StatusCode, 680 Header: res.Header, 681 } 682 } 683 if err != nil { 684 return nil, err 685 } 686 defer googleapi.CloseBody(res) 687 if err := googleapi.CheckResponse(res); err != nil { 688 return nil, err 689 } 690 ret := &Account{ 691 ServerResponse: googleapi.ServerResponse{ 692 Header: res.Header, 693 HTTPStatusCode: res.StatusCode, 694 }, 695 } 696 target := &ret 697 if err := gensupport.DecodeResponse(target, res); err != nil { 698 return nil, err 699 } 700 return ret, nil 701 // { 702 // "description": "Gets one account by ID.", 703 // "httpMethod": "GET", 704 // "id": "adexchangebuyer.accounts.get", 705 // "parameterOrder": [ 706 // "id" 707 // ], 708 // "parameters": { 709 // "id": { 710 // "description": "The account id", 711 // "format": "int32", 712 // "location": "path", 713 // "required": true, 714 // "type": "integer" 715 // } 716 // }, 717 // "path": "accounts/{id}", 718 // "response": { 719 // "$ref": "Account" 720 // }, 721 // "scopes": [ 722 // "https://www.googleapis.com/auth/adexchange.buyer" 723 // ] 724 // } 725 726} 727 728// method id "adexchangebuyer.accounts.list": 729 730type AccountsListCall struct { 731 s *Service 732 urlParams_ gensupport.URLParams 733 ifNoneMatch_ string 734 ctx_ context.Context 735 header_ http.Header 736} 737 738// List: Retrieves the authenticated user's list of accounts. 739func (r *AccountsService) List() *AccountsListCall { 740 c := &AccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 741 return c 742} 743 744// Fields allows partial responses to be retrieved. See 745// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 746// for more information. 747func (c *AccountsListCall) Fields(s ...googleapi.Field) *AccountsListCall { 748 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 749 return c 750} 751 752// IfNoneMatch sets the optional parameter which makes the operation 753// fail if the object's ETag matches the given value. This is useful for 754// getting updates only after the object has changed since the last 755// request. Use googleapi.IsNotModified to check whether the response 756// error from Do is the result of In-None-Match. 757func (c *AccountsListCall) IfNoneMatch(entityTag string) *AccountsListCall { 758 c.ifNoneMatch_ = entityTag 759 return c 760} 761 762// Context sets the context to be used in this call's Do method. Any 763// pending HTTP request will be aborted if the provided context is 764// canceled. 765func (c *AccountsListCall) Context(ctx context.Context) *AccountsListCall { 766 c.ctx_ = ctx 767 return c 768} 769 770// Header returns an http.Header that can be modified by the caller to 771// add HTTP headers to the request. 772func (c *AccountsListCall) Header() http.Header { 773 if c.header_ == nil { 774 c.header_ = make(http.Header) 775 } 776 return c.header_ 777} 778 779func (c *AccountsListCall) doRequest(alt string) (*http.Response, error) { 780 reqHeaders := make(http.Header) 781 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 782 for k, v := range c.header_ { 783 reqHeaders[k] = v 784 } 785 reqHeaders.Set("User-Agent", c.s.userAgent()) 786 if c.ifNoneMatch_ != "" { 787 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 788 } 789 var body io.Reader = nil 790 c.urlParams_.Set("alt", alt) 791 c.urlParams_.Set("prettyPrint", "false") 792 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts") 793 urls += "?" + c.urlParams_.Encode() 794 req, err := http.NewRequest("GET", urls, body) 795 if err != nil { 796 return nil, err 797 } 798 req.Header = reqHeaders 799 return gensupport.SendRequest(c.ctx_, c.s.client, req) 800} 801 802// Do executes the "adexchangebuyer.accounts.list" call. 803// Exactly one of *AccountsList or error will be non-nil. Any non-2xx 804// status code is an error. Response headers are in either 805// *AccountsList.ServerResponse.Header or (if a response was returned at 806// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 807// to check whether the returned error was because 808// http.StatusNotModified was returned. 809func (c *AccountsListCall) Do(opts ...googleapi.CallOption) (*AccountsList, error) { 810 gensupport.SetOptions(c.urlParams_, opts...) 811 res, err := c.doRequest("json") 812 if res != nil && res.StatusCode == http.StatusNotModified { 813 if res.Body != nil { 814 res.Body.Close() 815 } 816 return nil, &googleapi.Error{ 817 Code: res.StatusCode, 818 Header: res.Header, 819 } 820 } 821 if err != nil { 822 return nil, err 823 } 824 defer googleapi.CloseBody(res) 825 if err := googleapi.CheckResponse(res); err != nil { 826 return nil, err 827 } 828 ret := &AccountsList{ 829 ServerResponse: googleapi.ServerResponse{ 830 Header: res.Header, 831 HTTPStatusCode: res.StatusCode, 832 }, 833 } 834 target := &ret 835 if err := gensupport.DecodeResponse(target, res); err != nil { 836 return nil, err 837 } 838 return ret, nil 839 // { 840 // "description": "Retrieves the authenticated user's list of accounts.", 841 // "httpMethod": "GET", 842 // "id": "adexchangebuyer.accounts.list", 843 // "path": "accounts", 844 // "response": { 845 // "$ref": "AccountsList" 846 // }, 847 // "scopes": [ 848 // "https://www.googleapis.com/auth/adexchange.buyer" 849 // ] 850 // } 851 852} 853 854// method id "adexchangebuyer.accounts.patch": 855 856type AccountsPatchCall struct { 857 s *Service 858 id int64 859 account *Account 860 urlParams_ gensupport.URLParams 861 ctx_ context.Context 862 header_ http.Header 863} 864 865// Patch: Updates an existing account. This method supports patch 866// semantics. 867func (r *AccountsService) Patch(id int64, account *Account) *AccountsPatchCall { 868 c := &AccountsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 869 c.id = id 870 c.account = account 871 return c 872} 873 874// Fields allows partial responses to be retrieved. See 875// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 876// for more information. 877func (c *AccountsPatchCall) Fields(s ...googleapi.Field) *AccountsPatchCall { 878 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 879 return c 880} 881 882// Context sets the context to be used in this call's Do method. Any 883// pending HTTP request will be aborted if the provided context is 884// canceled. 885func (c *AccountsPatchCall) Context(ctx context.Context) *AccountsPatchCall { 886 c.ctx_ = ctx 887 return c 888} 889 890// Header returns an http.Header that can be modified by the caller to 891// add HTTP headers to the request. 892func (c *AccountsPatchCall) Header() http.Header { 893 if c.header_ == nil { 894 c.header_ = make(http.Header) 895 } 896 return c.header_ 897} 898 899func (c *AccountsPatchCall) doRequest(alt string) (*http.Response, error) { 900 reqHeaders := make(http.Header) 901 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 902 for k, v := range c.header_ { 903 reqHeaders[k] = v 904 } 905 reqHeaders.Set("User-Agent", c.s.userAgent()) 906 var body io.Reader = nil 907 body, err := googleapi.WithoutDataWrapper.JSONReader(c.account) 908 if err != nil { 909 return nil, err 910 } 911 reqHeaders.Set("Content-Type", "application/json") 912 c.urlParams_.Set("alt", alt) 913 c.urlParams_.Set("prettyPrint", "false") 914 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{id}") 915 urls += "?" + c.urlParams_.Encode() 916 req, err := http.NewRequest("PATCH", urls, body) 917 if err != nil { 918 return nil, err 919 } 920 req.Header = reqHeaders 921 googleapi.Expand(req.URL, map[string]string{ 922 "id": strconv.FormatInt(c.id, 10), 923 }) 924 return gensupport.SendRequest(c.ctx_, c.s.client, req) 925} 926 927// Do executes the "adexchangebuyer.accounts.patch" call. 928// Exactly one of *Account or error will be non-nil. Any non-2xx status 929// code is an error. Response headers are in either 930// *Account.ServerResponse.Header or (if a response was returned at all) 931// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 932// check whether the returned error was because http.StatusNotModified 933// was returned. 934func (c *AccountsPatchCall) Do(opts ...googleapi.CallOption) (*Account, error) { 935 gensupport.SetOptions(c.urlParams_, opts...) 936 res, err := c.doRequest("json") 937 if res != nil && res.StatusCode == http.StatusNotModified { 938 if res.Body != nil { 939 res.Body.Close() 940 } 941 return nil, &googleapi.Error{ 942 Code: res.StatusCode, 943 Header: res.Header, 944 } 945 } 946 if err != nil { 947 return nil, err 948 } 949 defer googleapi.CloseBody(res) 950 if err := googleapi.CheckResponse(res); err != nil { 951 return nil, err 952 } 953 ret := &Account{ 954 ServerResponse: googleapi.ServerResponse{ 955 Header: res.Header, 956 HTTPStatusCode: res.StatusCode, 957 }, 958 } 959 target := &ret 960 if err := gensupport.DecodeResponse(target, res); err != nil { 961 return nil, err 962 } 963 return ret, nil 964 // { 965 // "description": "Updates an existing account. This method supports patch semantics.", 966 // "httpMethod": "PATCH", 967 // "id": "adexchangebuyer.accounts.patch", 968 // "parameterOrder": [ 969 // "id" 970 // ], 971 // "parameters": { 972 // "id": { 973 // "description": "The account id", 974 // "format": "int32", 975 // "location": "path", 976 // "required": true, 977 // "type": "integer" 978 // } 979 // }, 980 // "path": "accounts/{id}", 981 // "request": { 982 // "$ref": "Account" 983 // }, 984 // "response": { 985 // "$ref": "Account" 986 // }, 987 // "scopes": [ 988 // "https://www.googleapis.com/auth/adexchange.buyer" 989 // ] 990 // } 991 992} 993 994// method id "adexchangebuyer.accounts.update": 995 996type AccountsUpdateCall struct { 997 s *Service 998 id int64 999 account *Account 1000 urlParams_ gensupport.URLParams 1001 ctx_ context.Context 1002 header_ http.Header 1003} 1004 1005// Update: Updates an existing account. 1006func (r *AccountsService) Update(id int64, account *Account) *AccountsUpdateCall { 1007 c := &AccountsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1008 c.id = id 1009 c.account = account 1010 return c 1011} 1012 1013// Fields allows partial responses to be retrieved. See 1014// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1015// for more information. 1016func (c *AccountsUpdateCall) Fields(s ...googleapi.Field) *AccountsUpdateCall { 1017 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1018 return c 1019} 1020 1021// Context sets the context to be used in this call's Do method. Any 1022// pending HTTP request will be aborted if the provided context is 1023// canceled. 1024func (c *AccountsUpdateCall) Context(ctx context.Context) *AccountsUpdateCall { 1025 c.ctx_ = ctx 1026 return c 1027} 1028 1029// Header returns an http.Header that can be modified by the caller to 1030// add HTTP headers to the request. 1031func (c *AccountsUpdateCall) Header() http.Header { 1032 if c.header_ == nil { 1033 c.header_ = make(http.Header) 1034 } 1035 return c.header_ 1036} 1037 1038func (c *AccountsUpdateCall) doRequest(alt string) (*http.Response, error) { 1039 reqHeaders := make(http.Header) 1040 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 1041 for k, v := range c.header_ { 1042 reqHeaders[k] = v 1043 } 1044 reqHeaders.Set("User-Agent", c.s.userAgent()) 1045 var body io.Reader = nil 1046 body, err := googleapi.WithoutDataWrapper.JSONReader(c.account) 1047 if err != nil { 1048 return nil, err 1049 } 1050 reqHeaders.Set("Content-Type", "application/json") 1051 c.urlParams_.Set("alt", alt) 1052 c.urlParams_.Set("prettyPrint", "false") 1053 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{id}") 1054 urls += "?" + c.urlParams_.Encode() 1055 req, err := http.NewRequest("PUT", urls, body) 1056 if err != nil { 1057 return nil, err 1058 } 1059 req.Header = reqHeaders 1060 googleapi.Expand(req.URL, map[string]string{ 1061 "id": strconv.FormatInt(c.id, 10), 1062 }) 1063 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1064} 1065 1066// Do executes the "adexchangebuyer.accounts.update" call. 1067// Exactly one of *Account or error will be non-nil. Any non-2xx status 1068// code is an error. Response headers are in either 1069// *Account.ServerResponse.Header or (if a response was returned at all) 1070// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1071// check whether the returned error was because http.StatusNotModified 1072// was returned. 1073func (c *AccountsUpdateCall) Do(opts ...googleapi.CallOption) (*Account, error) { 1074 gensupport.SetOptions(c.urlParams_, opts...) 1075 res, err := c.doRequest("json") 1076 if res != nil && res.StatusCode == http.StatusNotModified { 1077 if res.Body != nil { 1078 res.Body.Close() 1079 } 1080 return nil, &googleapi.Error{ 1081 Code: res.StatusCode, 1082 Header: res.Header, 1083 } 1084 } 1085 if err != nil { 1086 return nil, err 1087 } 1088 defer googleapi.CloseBody(res) 1089 if err := googleapi.CheckResponse(res); err != nil { 1090 return nil, err 1091 } 1092 ret := &Account{ 1093 ServerResponse: googleapi.ServerResponse{ 1094 Header: res.Header, 1095 HTTPStatusCode: res.StatusCode, 1096 }, 1097 } 1098 target := &ret 1099 if err := gensupport.DecodeResponse(target, res); err != nil { 1100 return nil, err 1101 } 1102 return ret, nil 1103 // { 1104 // "description": "Updates an existing account.", 1105 // "httpMethod": "PUT", 1106 // "id": "adexchangebuyer.accounts.update", 1107 // "parameterOrder": [ 1108 // "id" 1109 // ], 1110 // "parameters": { 1111 // "id": { 1112 // "description": "The account id", 1113 // "format": "int32", 1114 // "location": "path", 1115 // "required": true, 1116 // "type": "integer" 1117 // } 1118 // }, 1119 // "path": "accounts/{id}", 1120 // "request": { 1121 // "$ref": "Account" 1122 // }, 1123 // "response": { 1124 // "$ref": "Account" 1125 // }, 1126 // "scopes": [ 1127 // "https://www.googleapis.com/auth/adexchange.buyer" 1128 // ] 1129 // } 1130 1131} 1132 1133// method id "adexchangebuyer.creatives.get": 1134 1135type CreativesGetCall struct { 1136 s *Service 1137 accountId int64 1138 buyerCreativeId string 1139 urlParams_ gensupport.URLParams 1140 ifNoneMatch_ string 1141 ctx_ context.Context 1142 header_ http.Header 1143} 1144 1145// Get: Gets the status for a single creative. A creative will be 1146// available 30-40 minutes after submission. 1147func (r *CreativesService) Get(accountId int64, buyerCreativeId string) *CreativesGetCall { 1148 c := &CreativesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1149 c.accountId = accountId 1150 c.buyerCreativeId = buyerCreativeId 1151 return c 1152} 1153 1154// Fields allows partial responses to be retrieved. See 1155// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1156// for more information. 1157func (c *CreativesGetCall) Fields(s ...googleapi.Field) *CreativesGetCall { 1158 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1159 return c 1160} 1161 1162// IfNoneMatch sets the optional parameter which makes the operation 1163// fail if the object's ETag matches the given value. This is useful for 1164// getting updates only after the object has changed since the last 1165// request. Use googleapi.IsNotModified to check whether the response 1166// error from Do is the result of In-None-Match. 1167func (c *CreativesGetCall) IfNoneMatch(entityTag string) *CreativesGetCall { 1168 c.ifNoneMatch_ = entityTag 1169 return c 1170} 1171 1172// Context sets the context to be used in this call's Do method. Any 1173// pending HTTP request will be aborted if the provided context is 1174// canceled. 1175func (c *CreativesGetCall) Context(ctx context.Context) *CreativesGetCall { 1176 c.ctx_ = ctx 1177 return c 1178} 1179 1180// Header returns an http.Header that can be modified by the caller to 1181// add HTTP headers to the request. 1182func (c *CreativesGetCall) Header() http.Header { 1183 if c.header_ == nil { 1184 c.header_ = make(http.Header) 1185 } 1186 return c.header_ 1187} 1188 1189func (c *CreativesGetCall) doRequest(alt string) (*http.Response, error) { 1190 reqHeaders := make(http.Header) 1191 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 1192 for k, v := range c.header_ { 1193 reqHeaders[k] = v 1194 } 1195 reqHeaders.Set("User-Agent", c.s.userAgent()) 1196 if c.ifNoneMatch_ != "" { 1197 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1198 } 1199 var body io.Reader = nil 1200 c.urlParams_.Set("alt", alt) 1201 c.urlParams_.Set("prettyPrint", "false") 1202 urls := googleapi.ResolveRelative(c.s.BasePath, "creatives/{accountId}/{buyerCreativeId}") 1203 urls += "?" + c.urlParams_.Encode() 1204 req, err := http.NewRequest("GET", urls, body) 1205 if err != nil { 1206 return nil, err 1207 } 1208 req.Header = reqHeaders 1209 googleapi.Expand(req.URL, map[string]string{ 1210 "accountId": strconv.FormatInt(c.accountId, 10), 1211 "buyerCreativeId": c.buyerCreativeId, 1212 }) 1213 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1214} 1215 1216// Do executes the "adexchangebuyer.creatives.get" call. 1217// Exactly one of *Creative or error will be non-nil. Any non-2xx status 1218// code is an error. Response headers are in either 1219// *Creative.ServerResponse.Header or (if a response was returned at 1220// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1221// to check whether the returned error was because 1222// http.StatusNotModified was returned. 1223func (c *CreativesGetCall) Do(opts ...googleapi.CallOption) (*Creative, error) { 1224 gensupport.SetOptions(c.urlParams_, opts...) 1225 res, err := c.doRequest("json") 1226 if res != nil && res.StatusCode == http.StatusNotModified { 1227 if res.Body != nil { 1228 res.Body.Close() 1229 } 1230 return nil, &googleapi.Error{ 1231 Code: res.StatusCode, 1232 Header: res.Header, 1233 } 1234 } 1235 if err != nil { 1236 return nil, err 1237 } 1238 defer googleapi.CloseBody(res) 1239 if err := googleapi.CheckResponse(res); err != nil { 1240 return nil, err 1241 } 1242 ret := &Creative{ 1243 ServerResponse: googleapi.ServerResponse{ 1244 Header: res.Header, 1245 HTTPStatusCode: res.StatusCode, 1246 }, 1247 } 1248 target := &ret 1249 if err := gensupport.DecodeResponse(target, res); err != nil { 1250 return nil, err 1251 } 1252 return ret, nil 1253 // { 1254 // "description": "Gets the status for a single creative. A creative will be available 30-40 minutes after submission.", 1255 // "httpMethod": "GET", 1256 // "id": "adexchangebuyer.creatives.get", 1257 // "parameterOrder": [ 1258 // "accountId", 1259 // "buyerCreativeId" 1260 // ], 1261 // "parameters": { 1262 // "accountId": { 1263 // "description": "The id for the account that will serve this creative.", 1264 // "format": "int32", 1265 // "location": "path", 1266 // "required": true, 1267 // "type": "integer" 1268 // }, 1269 // "buyerCreativeId": { 1270 // "description": "The buyer-specific id for this creative.", 1271 // "location": "path", 1272 // "required": true, 1273 // "type": "string" 1274 // } 1275 // }, 1276 // "path": "creatives/{accountId}/{buyerCreativeId}", 1277 // "response": { 1278 // "$ref": "Creative" 1279 // }, 1280 // "scopes": [ 1281 // "https://www.googleapis.com/auth/adexchange.buyer" 1282 // ] 1283 // } 1284 1285} 1286 1287// method id "adexchangebuyer.creatives.insert": 1288 1289type CreativesInsertCall struct { 1290 s *Service 1291 creative *Creative 1292 urlParams_ gensupport.URLParams 1293 ctx_ context.Context 1294 header_ http.Header 1295} 1296 1297// Insert: Submit a new creative. 1298func (r *CreativesService) Insert(creative *Creative) *CreativesInsertCall { 1299 c := &CreativesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1300 c.creative = creative 1301 return c 1302} 1303 1304// Fields allows partial responses to be retrieved. See 1305// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1306// for more information. 1307func (c *CreativesInsertCall) Fields(s ...googleapi.Field) *CreativesInsertCall { 1308 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1309 return c 1310} 1311 1312// Context sets the context to be used in this call's Do method. Any 1313// pending HTTP request will be aborted if the provided context is 1314// canceled. 1315func (c *CreativesInsertCall) Context(ctx context.Context) *CreativesInsertCall { 1316 c.ctx_ = ctx 1317 return c 1318} 1319 1320// Header returns an http.Header that can be modified by the caller to 1321// add HTTP headers to the request. 1322func (c *CreativesInsertCall) Header() http.Header { 1323 if c.header_ == nil { 1324 c.header_ = make(http.Header) 1325 } 1326 return c.header_ 1327} 1328 1329func (c *CreativesInsertCall) doRequest(alt string) (*http.Response, error) { 1330 reqHeaders := make(http.Header) 1331 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 1332 for k, v := range c.header_ { 1333 reqHeaders[k] = v 1334 } 1335 reqHeaders.Set("User-Agent", c.s.userAgent()) 1336 var body io.Reader = nil 1337 body, err := googleapi.WithoutDataWrapper.JSONReader(c.creative) 1338 if err != nil { 1339 return nil, err 1340 } 1341 reqHeaders.Set("Content-Type", "application/json") 1342 c.urlParams_.Set("alt", alt) 1343 c.urlParams_.Set("prettyPrint", "false") 1344 urls := googleapi.ResolveRelative(c.s.BasePath, "creatives") 1345 urls += "?" + c.urlParams_.Encode() 1346 req, err := http.NewRequest("POST", urls, body) 1347 if err != nil { 1348 return nil, err 1349 } 1350 req.Header = reqHeaders 1351 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1352} 1353 1354// Do executes the "adexchangebuyer.creatives.insert" call. 1355// Exactly one of *Creative or error will be non-nil. Any non-2xx status 1356// code is an error. Response headers are in either 1357// *Creative.ServerResponse.Header or (if a response was returned at 1358// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1359// to check whether the returned error was because 1360// http.StatusNotModified was returned. 1361func (c *CreativesInsertCall) Do(opts ...googleapi.CallOption) (*Creative, error) { 1362 gensupport.SetOptions(c.urlParams_, opts...) 1363 res, err := c.doRequest("json") 1364 if res != nil && res.StatusCode == http.StatusNotModified { 1365 if res.Body != nil { 1366 res.Body.Close() 1367 } 1368 return nil, &googleapi.Error{ 1369 Code: res.StatusCode, 1370 Header: res.Header, 1371 } 1372 } 1373 if err != nil { 1374 return nil, err 1375 } 1376 defer googleapi.CloseBody(res) 1377 if err := googleapi.CheckResponse(res); err != nil { 1378 return nil, err 1379 } 1380 ret := &Creative{ 1381 ServerResponse: googleapi.ServerResponse{ 1382 Header: res.Header, 1383 HTTPStatusCode: res.StatusCode, 1384 }, 1385 } 1386 target := &ret 1387 if err := gensupport.DecodeResponse(target, res); err != nil { 1388 return nil, err 1389 } 1390 return ret, nil 1391 // { 1392 // "description": "Submit a new creative.", 1393 // "httpMethod": "POST", 1394 // "id": "adexchangebuyer.creatives.insert", 1395 // "path": "creatives", 1396 // "request": { 1397 // "$ref": "Creative" 1398 // }, 1399 // "response": { 1400 // "$ref": "Creative" 1401 // }, 1402 // "scopes": [ 1403 // "https://www.googleapis.com/auth/adexchange.buyer" 1404 // ] 1405 // } 1406 1407} 1408 1409// method id "adexchangebuyer.creatives.list": 1410 1411type CreativesListCall struct { 1412 s *Service 1413 urlParams_ gensupport.URLParams 1414 ifNoneMatch_ string 1415 ctx_ context.Context 1416 header_ http.Header 1417} 1418 1419// List: Retrieves a list of the authenticated user's active creatives. 1420// A creative will be available 30-40 minutes after submission. 1421func (r *CreativesService) List() *CreativesListCall { 1422 c := &CreativesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1423 return c 1424} 1425 1426// MaxResults sets the optional parameter "maxResults": Maximum number 1427// of entries returned on one result page. If not set, the default is 1428// 100. 1429func (c *CreativesListCall) MaxResults(maxResults int64) *CreativesListCall { 1430 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 1431 return c 1432} 1433 1434// PageToken sets the optional parameter "pageToken": A continuation 1435// token, used to page through ad clients. To retrieve the next page, 1436// set this parameter to the value of "nextPageToken" from the previous 1437// response. 1438func (c *CreativesListCall) PageToken(pageToken string) *CreativesListCall { 1439 c.urlParams_.Set("pageToken", pageToken) 1440 return c 1441} 1442 1443// StatusFilter sets the optional parameter "statusFilter": When 1444// specified, only creatives having the given status are returned. 1445// 1446// Possible values: 1447// "approved" - Creatives which have been approved. 1448// "disapproved" - Creatives which have been disapproved. 1449// "not_checked" - Creatives whose status is not yet checked. 1450func (c *CreativesListCall) StatusFilter(statusFilter string) *CreativesListCall { 1451 c.urlParams_.Set("statusFilter", statusFilter) 1452 return c 1453} 1454 1455// Fields allows partial responses to be retrieved. See 1456// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1457// for more information. 1458func (c *CreativesListCall) Fields(s ...googleapi.Field) *CreativesListCall { 1459 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1460 return c 1461} 1462 1463// IfNoneMatch sets the optional parameter which makes the operation 1464// fail if the object's ETag matches the given value. This is useful for 1465// getting updates only after the object has changed since the last 1466// request. Use googleapi.IsNotModified to check whether the response 1467// error from Do is the result of In-None-Match. 1468func (c *CreativesListCall) IfNoneMatch(entityTag string) *CreativesListCall { 1469 c.ifNoneMatch_ = entityTag 1470 return c 1471} 1472 1473// Context sets the context to be used in this call's Do method. Any 1474// pending HTTP request will be aborted if the provided context is 1475// canceled. 1476func (c *CreativesListCall) Context(ctx context.Context) *CreativesListCall { 1477 c.ctx_ = ctx 1478 return c 1479} 1480 1481// Header returns an http.Header that can be modified by the caller to 1482// add HTTP headers to the request. 1483func (c *CreativesListCall) Header() http.Header { 1484 if c.header_ == nil { 1485 c.header_ = make(http.Header) 1486 } 1487 return c.header_ 1488} 1489 1490func (c *CreativesListCall) doRequest(alt string) (*http.Response, error) { 1491 reqHeaders := make(http.Header) 1492 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 1493 for k, v := range c.header_ { 1494 reqHeaders[k] = v 1495 } 1496 reqHeaders.Set("User-Agent", c.s.userAgent()) 1497 if c.ifNoneMatch_ != "" { 1498 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1499 } 1500 var body io.Reader = nil 1501 c.urlParams_.Set("alt", alt) 1502 c.urlParams_.Set("prettyPrint", "false") 1503 urls := googleapi.ResolveRelative(c.s.BasePath, "creatives") 1504 urls += "?" + c.urlParams_.Encode() 1505 req, err := http.NewRequest("GET", urls, body) 1506 if err != nil { 1507 return nil, err 1508 } 1509 req.Header = reqHeaders 1510 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1511} 1512 1513// Do executes the "adexchangebuyer.creatives.list" call. 1514// Exactly one of *CreativesList or error will be non-nil. Any non-2xx 1515// status code is an error. Response headers are in either 1516// *CreativesList.ServerResponse.Header or (if a response was returned 1517// at all) in error.(*googleapi.Error).Header. Use 1518// googleapi.IsNotModified to check whether the returned error was 1519// because http.StatusNotModified was returned. 1520func (c *CreativesListCall) Do(opts ...googleapi.CallOption) (*CreativesList, error) { 1521 gensupport.SetOptions(c.urlParams_, opts...) 1522 res, err := c.doRequest("json") 1523 if res != nil && res.StatusCode == http.StatusNotModified { 1524 if res.Body != nil { 1525 res.Body.Close() 1526 } 1527 return nil, &googleapi.Error{ 1528 Code: res.StatusCode, 1529 Header: res.Header, 1530 } 1531 } 1532 if err != nil { 1533 return nil, err 1534 } 1535 defer googleapi.CloseBody(res) 1536 if err := googleapi.CheckResponse(res); err != nil { 1537 return nil, err 1538 } 1539 ret := &CreativesList{ 1540 ServerResponse: googleapi.ServerResponse{ 1541 Header: res.Header, 1542 HTTPStatusCode: res.StatusCode, 1543 }, 1544 } 1545 target := &ret 1546 if err := gensupport.DecodeResponse(target, res); err != nil { 1547 return nil, err 1548 } 1549 return ret, nil 1550 // { 1551 // "description": "Retrieves a list of the authenticated user's active creatives. A creative will be available 30-40 minutes after submission.", 1552 // "httpMethod": "GET", 1553 // "id": "adexchangebuyer.creatives.list", 1554 // "parameters": { 1555 // "maxResults": { 1556 // "description": "Maximum number of entries returned on one result page. If not set, the default is 100. Optional.", 1557 // "format": "uint32", 1558 // "location": "query", 1559 // "maximum": "1000", 1560 // "minimum": "1", 1561 // "type": "integer" 1562 // }, 1563 // "pageToken": { 1564 // "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.", 1565 // "location": "query", 1566 // "type": "string" 1567 // }, 1568 // "statusFilter": { 1569 // "description": "When specified, only creatives having the given status are returned.", 1570 // "enum": [ 1571 // "approved", 1572 // "disapproved", 1573 // "not_checked" 1574 // ], 1575 // "enumDescriptions": [ 1576 // "Creatives which have been approved.", 1577 // "Creatives which have been disapproved.", 1578 // "Creatives whose status is not yet checked." 1579 // ], 1580 // "location": "query", 1581 // "type": "string" 1582 // } 1583 // }, 1584 // "path": "creatives", 1585 // "response": { 1586 // "$ref": "CreativesList" 1587 // }, 1588 // "scopes": [ 1589 // "https://www.googleapis.com/auth/adexchange.buyer" 1590 // ] 1591 // } 1592 1593} 1594 1595// Pages invokes f for each page of results. 1596// A non-nil error returned from f will halt the iteration. 1597// The provided context supersedes any context provided to the Context method. 1598func (c *CreativesListCall) Pages(ctx context.Context, f func(*CreativesList) error) error { 1599 c.ctx_ = ctx 1600 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1601 for { 1602 x, err := c.Do() 1603 if err != nil { 1604 return err 1605 } 1606 if err := f(x); err != nil { 1607 return err 1608 } 1609 if x.NextPageToken == "" { 1610 return nil 1611 } 1612 c.PageToken(x.NextPageToken) 1613 } 1614} 1615