1// Copyright 2021 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 or default values are omitted from API requests. However, any 198 // non-pointer, non-interface field appearing in ForceSendFields will be 199 // sent to the server regardless of whether the field is empty or not. 200 // This may be 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 or default values are omitted from API requests. However, any 238 // non-pointer, non-interface field appearing in ForceSendFields will be 239 // sent to the server regardless of whether the field is empty or not. 240 // This may be 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 or default values are omitted from API requests. However, any 275 // non-pointer, non-interface field appearing in ForceSendFields will be 276 // sent to the server regardless of whether the field is empty or not. 277 // This may be 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 or default values are omitted from API requests. However, any 396 // non-pointer, non-interface field appearing in ForceSendFields will be 397 // sent to the server regardless of whether the field is empty or not. 398 // This may be 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 or default values are omitted from API requests. However, any 426 // non-pointer, non-interface field appearing in ForceSendFields will be 427 // sent to the server regardless of whether the field is empty or not. 428 // This may be 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 or default values are omitted from API requests. However, any 456 // non-pointer, non-interface field appearing in ForceSendFields will be 457 // sent to the server regardless of whether the field is empty or not. 458 // This may be 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 or default values are omitted from API requests. However, any 489 // non-pointer, non-interface field appearing in ForceSendFields will be 490 // sent to the server regardless of whether the field is empty or not. 491 // This may be 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 or default values are omitted from API requests. However, any 522 // non-pointer, non-interface field appearing in ForceSendFields will be 523 // sent to the server regardless of whether the field is empty or not. 524 // This may be 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 or default values are omitted from API requests. However, any 565 // non-pointer, non-interface field appearing in ForceSendFields will be 566 // sent to the server regardless of whether the field is empty or not. 567 // This may be 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. 597// 598// - id: The account id. 599func (r *AccountsService) Get(id int64) *AccountsGetCall { 600 c := &AccountsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 601 c.id = id 602 return c 603} 604 605// Fields allows partial responses to be retrieved. See 606// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 607// for more information. 608func (c *AccountsGetCall) Fields(s ...googleapi.Field) *AccountsGetCall { 609 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 610 return c 611} 612 613// IfNoneMatch sets the optional parameter which makes the operation 614// fail if the object's ETag matches the given value. This is useful for 615// getting updates only after the object has changed since the last 616// request. Use googleapi.IsNotModified to check whether the response 617// error from Do is the result of In-None-Match. 618func (c *AccountsGetCall) IfNoneMatch(entityTag string) *AccountsGetCall { 619 c.ifNoneMatch_ = entityTag 620 return c 621} 622 623// Context sets the context to be used in this call's Do method. Any 624// pending HTTP request will be aborted if the provided context is 625// canceled. 626func (c *AccountsGetCall) Context(ctx context.Context) *AccountsGetCall { 627 c.ctx_ = ctx 628 return c 629} 630 631// Header returns an http.Header that can be modified by the caller to 632// add HTTP headers to the request. 633func (c *AccountsGetCall) Header() http.Header { 634 if c.header_ == nil { 635 c.header_ = make(http.Header) 636 } 637 return c.header_ 638} 639 640func (c *AccountsGetCall) doRequest(alt string) (*http.Response, error) { 641 reqHeaders := make(http.Header) 642 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210819") 643 for k, v := range c.header_ { 644 reqHeaders[k] = v 645 } 646 reqHeaders.Set("User-Agent", c.s.userAgent()) 647 if c.ifNoneMatch_ != "" { 648 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 649 } 650 var body io.Reader = nil 651 c.urlParams_.Set("alt", alt) 652 c.urlParams_.Set("prettyPrint", "false") 653 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{id}") 654 urls += "?" + c.urlParams_.Encode() 655 req, err := http.NewRequest("GET", urls, body) 656 if err != nil { 657 return nil, err 658 } 659 req.Header = reqHeaders 660 googleapi.Expand(req.URL, map[string]string{ 661 "id": strconv.FormatInt(c.id, 10), 662 }) 663 return gensupport.SendRequest(c.ctx_, c.s.client, req) 664} 665 666// Do executes the "adexchangebuyer.accounts.get" call. 667// Exactly one of *Account or error will be non-nil. Any non-2xx status 668// code is an error. Response headers are in either 669// *Account.ServerResponse.Header or (if a response was returned at all) 670// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 671// check whether the returned error was because http.StatusNotModified 672// was returned. 673func (c *AccountsGetCall) Do(opts ...googleapi.CallOption) (*Account, error) { 674 gensupport.SetOptions(c.urlParams_, opts...) 675 res, err := c.doRequest("json") 676 if res != nil && res.StatusCode == http.StatusNotModified { 677 if res.Body != nil { 678 res.Body.Close() 679 } 680 return nil, &googleapi.Error{ 681 Code: res.StatusCode, 682 Header: res.Header, 683 } 684 } 685 if err != nil { 686 return nil, err 687 } 688 defer googleapi.CloseBody(res) 689 if err := googleapi.CheckResponse(res); err != nil { 690 return nil, err 691 } 692 ret := &Account{ 693 ServerResponse: googleapi.ServerResponse{ 694 Header: res.Header, 695 HTTPStatusCode: res.StatusCode, 696 }, 697 } 698 target := &ret 699 if err := gensupport.DecodeResponse(target, res); err != nil { 700 return nil, err 701 } 702 return ret, nil 703 // { 704 // "description": "Gets one account by ID.", 705 // "httpMethod": "GET", 706 // "id": "adexchangebuyer.accounts.get", 707 // "parameterOrder": [ 708 // "id" 709 // ], 710 // "parameters": { 711 // "id": { 712 // "description": "The account id", 713 // "format": "int32", 714 // "location": "path", 715 // "required": true, 716 // "type": "integer" 717 // } 718 // }, 719 // "path": "accounts/{id}", 720 // "response": { 721 // "$ref": "Account" 722 // }, 723 // "scopes": [ 724 // "https://www.googleapis.com/auth/adexchange.buyer" 725 // ] 726 // } 727 728} 729 730// method id "adexchangebuyer.accounts.list": 731 732type AccountsListCall struct { 733 s *Service 734 urlParams_ gensupport.URLParams 735 ifNoneMatch_ string 736 ctx_ context.Context 737 header_ http.Header 738} 739 740// List: Retrieves the authenticated user's list of accounts. 741func (r *AccountsService) List() *AccountsListCall { 742 c := &AccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 743 return c 744} 745 746// Fields allows partial responses to be retrieved. See 747// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 748// for more information. 749func (c *AccountsListCall) Fields(s ...googleapi.Field) *AccountsListCall { 750 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 751 return c 752} 753 754// IfNoneMatch sets the optional parameter which makes the operation 755// fail if the object's ETag matches the given value. This is useful for 756// getting updates only after the object has changed since the last 757// request. Use googleapi.IsNotModified to check whether the response 758// error from Do is the result of In-None-Match. 759func (c *AccountsListCall) IfNoneMatch(entityTag string) *AccountsListCall { 760 c.ifNoneMatch_ = entityTag 761 return c 762} 763 764// Context sets the context to be used in this call's Do method. Any 765// pending HTTP request will be aborted if the provided context is 766// canceled. 767func (c *AccountsListCall) Context(ctx context.Context) *AccountsListCall { 768 c.ctx_ = ctx 769 return c 770} 771 772// Header returns an http.Header that can be modified by the caller to 773// add HTTP headers to the request. 774func (c *AccountsListCall) Header() http.Header { 775 if c.header_ == nil { 776 c.header_ = make(http.Header) 777 } 778 return c.header_ 779} 780 781func (c *AccountsListCall) doRequest(alt string) (*http.Response, error) { 782 reqHeaders := make(http.Header) 783 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210819") 784 for k, v := range c.header_ { 785 reqHeaders[k] = v 786 } 787 reqHeaders.Set("User-Agent", c.s.userAgent()) 788 if c.ifNoneMatch_ != "" { 789 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 790 } 791 var body io.Reader = nil 792 c.urlParams_.Set("alt", alt) 793 c.urlParams_.Set("prettyPrint", "false") 794 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts") 795 urls += "?" + c.urlParams_.Encode() 796 req, err := http.NewRequest("GET", urls, body) 797 if err != nil { 798 return nil, err 799 } 800 req.Header = reqHeaders 801 return gensupport.SendRequest(c.ctx_, c.s.client, req) 802} 803 804// Do executes the "adexchangebuyer.accounts.list" call. 805// Exactly one of *AccountsList or error will be non-nil. Any non-2xx 806// status code is an error. Response headers are in either 807// *AccountsList.ServerResponse.Header or (if a response was returned at 808// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 809// to check whether the returned error was because 810// http.StatusNotModified was returned. 811func (c *AccountsListCall) Do(opts ...googleapi.CallOption) (*AccountsList, error) { 812 gensupport.SetOptions(c.urlParams_, opts...) 813 res, err := c.doRequest("json") 814 if res != nil && res.StatusCode == http.StatusNotModified { 815 if res.Body != nil { 816 res.Body.Close() 817 } 818 return nil, &googleapi.Error{ 819 Code: res.StatusCode, 820 Header: res.Header, 821 } 822 } 823 if err != nil { 824 return nil, err 825 } 826 defer googleapi.CloseBody(res) 827 if err := googleapi.CheckResponse(res); err != nil { 828 return nil, err 829 } 830 ret := &AccountsList{ 831 ServerResponse: googleapi.ServerResponse{ 832 Header: res.Header, 833 HTTPStatusCode: res.StatusCode, 834 }, 835 } 836 target := &ret 837 if err := gensupport.DecodeResponse(target, res); err != nil { 838 return nil, err 839 } 840 return ret, nil 841 // { 842 // "description": "Retrieves the authenticated user's list of accounts.", 843 // "httpMethod": "GET", 844 // "id": "adexchangebuyer.accounts.list", 845 // "path": "accounts", 846 // "response": { 847 // "$ref": "AccountsList" 848 // }, 849 // "scopes": [ 850 // "https://www.googleapis.com/auth/adexchange.buyer" 851 // ] 852 // } 853 854} 855 856// method id "adexchangebuyer.accounts.patch": 857 858type AccountsPatchCall struct { 859 s *Service 860 id int64 861 account *Account 862 urlParams_ gensupport.URLParams 863 ctx_ context.Context 864 header_ http.Header 865} 866 867// Patch: Updates an existing account. This method supports patch 868// semantics. 869// 870// - id: The account id. 871func (r *AccountsService) Patch(id int64, account *Account) *AccountsPatchCall { 872 c := &AccountsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 873 c.id = id 874 c.account = account 875 return c 876} 877 878// Fields allows partial responses to be retrieved. See 879// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 880// for more information. 881func (c *AccountsPatchCall) Fields(s ...googleapi.Field) *AccountsPatchCall { 882 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 883 return c 884} 885 886// Context sets the context to be used in this call's Do method. Any 887// pending HTTP request will be aborted if the provided context is 888// canceled. 889func (c *AccountsPatchCall) Context(ctx context.Context) *AccountsPatchCall { 890 c.ctx_ = ctx 891 return c 892} 893 894// Header returns an http.Header that can be modified by the caller to 895// add HTTP headers to the request. 896func (c *AccountsPatchCall) Header() http.Header { 897 if c.header_ == nil { 898 c.header_ = make(http.Header) 899 } 900 return c.header_ 901} 902 903func (c *AccountsPatchCall) doRequest(alt string) (*http.Response, error) { 904 reqHeaders := make(http.Header) 905 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210819") 906 for k, v := range c.header_ { 907 reqHeaders[k] = v 908 } 909 reqHeaders.Set("User-Agent", c.s.userAgent()) 910 var body io.Reader = nil 911 body, err := googleapi.WithoutDataWrapper.JSONReader(c.account) 912 if err != nil { 913 return nil, err 914 } 915 reqHeaders.Set("Content-Type", "application/json") 916 c.urlParams_.Set("alt", alt) 917 c.urlParams_.Set("prettyPrint", "false") 918 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{id}") 919 urls += "?" + c.urlParams_.Encode() 920 req, err := http.NewRequest("PATCH", urls, body) 921 if err != nil { 922 return nil, err 923 } 924 req.Header = reqHeaders 925 googleapi.Expand(req.URL, map[string]string{ 926 "id": strconv.FormatInt(c.id, 10), 927 }) 928 return gensupport.SendRequest(c.ctx_, c.s.client, req) 929} 930 931// Do executes the "adexchangebuyer.accounts.patch" call. 932// Exactly one of *Account or error will be non-nil. Any non-2xx status 933// code is an error. Response headers are in either 934// *Account.ServerResponse.Header or (if a response was returned at all) 935// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 936// check whether the returned error was because http.StatusNotModified 937// was returned. 938func (c *AccountsPatchCall) Do(opts ...googleapi.CallOption) (*Account, error) { 939 gensupport.SetOptions(c.urlParams_, opts...) 940 res, err := c.doRequest("json") 941 if res != nil && res.StatusCode == http.StatusNotModified { 942 if res.Body != nil { 943 res.Body.Close() 944 } 945 return nil, &googleapi.Error{ 946 Code: res.StatusCode, 947 Header: res.Header, 948 } 949 } 950 if err != nil { 951 return nil, err 952 } 953 defer googleapi.CloseBody(res) 954 if err := googleapi.CheckResponse(res); err != nil { 955 return nil, err 956 } 957 ret := &Account{ 958 ServerResponse: googleapi.ServerResponse{ 959 Header: res.Header, 960 HTTPStatusCode: res.StatusCode, 961 }, 962 } 963 target := &ret 964 if err := gensupport.DecodeResponse(target, res); err != nil { 965 return nil, err 966 } 967 return ret, nil 968 // { 969 // "description": "Updates an existing account. This method supports patch semantics.", 970 // "httpMethod": "PATCH", 971 // "id": "adexchangebuyer.accounts.patch", 972 // "parameterOrder": [ 973 // "id" 974 // ], 975 // "parameters": { 976 // "id": { 977 // "description": "The account id", 978 // "format": "int32", 979 // "location": "path", 980 // "required": true, 981 // "type": "integer" 982 // } 983 // }, 984 // "path": "accounts/{id}", 985 // "request": { 986 // "$ref": "Account" 987 // }, 988 // "response": { 989 // "$ref": "Account" 990 // }, 991 // "scopes": [ 992 // "https://www.googleapis.com/auth/adexchange.buyer" 993 // ] 994 // } 995 996} 997 998// method id "adexchangebuyer.accounts.update": 999 1000type AccountsUpdateCall struct { 1001 s *Service 1002 id int64 1003 account *Account 1004 urlParams_ gensupport.URLParams 1005 ctx_ context.Context 1006 header_ http.Header 1007} 1008 1009// Update: Updates an existing account. 1010// 1011// - id: The account id. 1012func (r *AccountsService) Update(id int64, account *Account) *AccountsUpdateCall { 1013 c := &AccountsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1014 c.id = id 1015 c.account = account 1016 return c 1017} 1018 1019// Fields allows partial responses to be retrieved. See 1020// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1021// for more information. 1022func (c *AccountsUpdateCall) Fields(s ...googleapi.Field) *AccountsUpdateCall { 1023 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1024 return c 1025} 1026 1027// Context sets the context to be used in this call's Do method. Any 1028// pending HTTP request will be aborted if the provided context is 1029// canceled. 1030func (c *AccountsUpdateCall) Context(ctx context.Context) *AccountsUpdateCall { 1031 c.ctx_ = ctx 1032 return c 1033} 1034 1035// Header returns an http.Header that can be modified by the caller to 1036// add HTTP headers to the request. 1037func (c *AccountsUpdateCall) Header() http.Header { 1038 if c.header_ == nil { 1039 c.header_ = make(http.Header) 1040 } 1041 return c.header_ 1042} 1043 1044func (c *AccountsUpdateCall) doRequest(alt string) (*http.Response, error) { 1045 reqHeaders := make(http.Header) 1046 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210819") 1047 for k, v := range c.header_ { 1048 reqHeaders[k] = v 1049 } 1050 reqHeaders.Set("User-Agent", c.s.userAgent()) 1051 var body io.Reader = nil 1052 body, err := googleapi.WithoutDataWrapper.JSONReader(c.account) 1053 if err != nil { 1054 return nil, err 1055 } 1056 reqHeaders.Set("Content-Type", "application/json") 1057 c.urlParams_.Set("alt", alt) 1058 c.urlParams_.Set("prettyPrint", "false") 1059 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{id}") 1060 urls += "?" + c.urlParams_.Encode() 1061 req, err := http.NewRequest("PUT", urls, body) 1062 if err != nil { 1063 return nil, err 1064 } 1065 req.Header = reqHeaders 1066 googleapi.Expand(req.URL, map[string]string{ 1067 "id": strconv.FormatInt(c.id, 10), 1068 }) 1069 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1070} 1071 1072// Do executes the "adexchangebuyer.accounts.update" call. 1073// Exactly one of *Account or error will be non-nil. Any non-2xx status 1074// code is an error. Response headers are in either 1075// *Account.ServerResponse.Header or (if a response was returned at all) 1076// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1077// check whether the returned error was because http.StatusNotModified 1078// was returned. 1079func (c *AccountsUpdateCall) Do(opts ...googleapi.CallOption) (*Account, error) { 1080 gensupport.SetOptions(c.urlParams_, opts...) 1081 res, err := c.doRequest("json") 1082 if res != nil && res.StatusCode == http.StatusNotModified { 1083 if res.Body != nil { 1084 res.Body.Close() 1085 } 1086 return nil, &googleapi.Error{ 1087 Code: res.StatusCode, 1088 Header: res.Header, 1089 } 1090 } 1091 if err != nil { 1092 return nil, err 1093 } 1094 defer googleapi.CloseBody(res) 1095 if err := googleapi.CheckResponse(res); err != nil { 1096 return nil, err 1097 } 1098 ret := &Account{ 1099 ServerResponse: googleapi.ServerResponse{ 1100 Header: res.Header, 1101 HTTPStatusCode: res.StatusCode, 1102 }, 1103 } 1104 target := &ret 1105 if err := gensupport.DecodeResponse(target, res); err != nil { 1106 return nil, err 1107 } 1108 return ret, nil 1109 // { 1110 // "description": "Updates an existing account.", 1111 // "httpMethod": "PUT", 1112 // "id": "adexchangebuyer.accounts.update", 1113 // "parameterOrder": [ 1114 // "id" 1115 // ], 1116 // "parameters": { 1117 // "id": { 1118 // "description": "The account id", 1119 // "format": "int32", 1120 // "location": "path", 1121 // "required": true, 1122 // "type": "integer" 1123 // } 1124 // }, 1125 // "path": "accounts/{id}", 1126 // "request": { 1127 // "$ref": "Account" 1128 // }, 1129 // "response": { 1130 // "$ref": "Account" 1131 // }, 1132 // "scopes": [ 1133 // "https://www.googleapis.com/auth/adexchange.buyer" 1134 // ] 1135 // } 1136 1137} 1138 1139// method id "adexchangebuyer.creatives.get": 1140 1141type CreativesGetCall struct { 1142 s *Service 1143 accountId int64 1144 buyerCreativeId string 1145 urlParams_ gensupport.URLParams 1146 ifNoneMatch_ string 1147 ctx_ context.Context 1148 header_ http.Header 1149} 1150 1151// Get: Gets the status for a single creative. A creative will be 1152// available 30-40 minutes after submission. 1153// 1154// - accountId: The id for the account that will serve this creative. 1155// - buyerCreativeId: The buyer-specific id for this creative. 1156func (r *CreativesService) Get(accountId int64, buyerCreativeId string) *CreativesGetCall { 1157 c := &CreativesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1158 c.accountId = accountId 1159 c.buyerCreativeId = buyerCreativeId 1160 return c 1161} 1162 1163// Fields allows partial responses to be retrieved. See 1164// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1165// for more information. 1166func (c *CreativesGetCall) Fields(s ...googleapi.Field) *CreativesGetCall { 1167 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1168 return c 1169} 1170 1171// IfNoneMatch sets the optional parameter which makes the operation 1172// fail if the object's ETag matches the given value. This is useful for 1173// getting updates only after the object has changed since the last 1174// request. Use googleapi.IsNotModified to check whether the response 1175// error from Do is the result of In-None-Match. 1176func (c *CreativesGetCall) IfNoneMatch(entityTag string) *CreativesGetCall { 1177 c.ifNoneMatch_ = entityTag 1178 return c 1179} 1180 1181// Context sets the context to be used in this call's Do method. Any 1182// pending HTTP request will be aborted if the provided context is 1183// canceled. 1184func (c *CreativesGetCall) Context(ctx context.Context) *CreativesGetCall { 1185 c.ctx_ = ctx 1186 return c 1187} 1188 1189// Header returns an http.Header that can be modified by the caller to 1190// add HTTP headers to the request. 1191func (c *CreativesGetCall) Header() http.Header { 1192 if c.header_ == nil { 1193 c.header_ = make(http.Header) 1194 } 1195 return c.header_ 1196} 1197 1198func (c *CreativesGetCall) doRequest(alt string) (*http.Response, error) { 1199 reqHeaders := make(http.Header) 1200 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210819") 1201 for k, v := range c.header_ { 1202 reqHeaders[k] = v 1203 } 1204 reqHeaders.Set("User-Agent", c.s.userAgent()) 1205 if c.ifNoneMatch_ != "" { 1206 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1207 } 1208 var body io.Reader = nil 1209 c.urlParams_.Set("alt", alt) 1210 c.urlParams_.Set("prettyPrint", "false") 1211 urls := googleapi.ResolveRelative(c.s.BasePath, "creatives/{accountId}/{buyerCreativeId}") 1212 urls += "?" + c.urlParams_.Encode() 1213 req, err := http.NewRequest("GET", urls, body) 1214 if err != nil { 1215 return nil, err 1216 } 1217 req.Header = reqHeaders 1218 googleapi.Expand(req.URL, map[string]string{ 1219 "accountId": strconv.FormatInt(c.accountId, 10), 1220 "buyerCreativeId": c.buyerCreativeId, 1221 }) 1222 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1223} 1224 1225// Do executes the "adexchangebuyer.creatives.get" call. 1226// Exactly one of *Creative or error will be non-nil. Any non-2xx status 1227// code is an error. Response headers are in either 1228// *Creative.ServerResponse.Header or (if a response was returned at 1229// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1230// to check whether the returned error was because 1231// http.StatusNotModified was returned. 1232func (c *CreativesGetCall) Do(opts ...googleapi.CallOption) (*Creative, error) { 1233 gensupport.SetOptions(c.urlParams_, opts...) 1234 res, err := c.doRequest("json") 1235 if res != nil && res.StatusCode == http.StatusNotModified { 1236 if res.Body != nil { 1237 res.Body.Close() 1238 } 1239 return nil, &googleapi.Error{ 1240 Code: res.StatusCode, 1241 Header: res.Header, 1242 } 1243 } 1244 if err != nil { 1245 return nil, err 1246 } 1247 defer googleapi.CloseBody(res) 1248 if err := googleapi.CheckResponse(res); err != nil { 1249 return nil, err 1250 } 1251 ret := &Creative{ 1252 ServerResponse: googleapi.ServerResponse{ 1253 Header: res.Header, 1254 HTTPStatusCode: res.StatusCode, 1255 }, 1256 } 1257 target := &ret 1258 if err := gensupport.DecodeResponse(target, res); err != nil { 1259 return nil, err 1260 } 1261 return ret, nil 1262 // { 1263 // "description": "Gets the status for a single creative. A creative will be available 30-40 minutes after submission.", 1264 // "httpMethod": "GET", 1265 // "id": "adexchangebuyer.creatives.get", 1266 // "parameterOrder": [ 1267 // "accountId", 1268 // "buyerCreativeId" 1269 // ], 1270 // "parameters": { 1271 // "accountId": { 1272 // "description": "The id for the account that will serve this creative.", 1273 // "format": "int32", 1274 // "location": "path", 1275 // "required": true, 1276 // "type": "integer" 1277 // }, 1278 // "buyerCreativeId": { 1279 // "description": "The buyer-specific id for this creative.", 1280 // "location": "path", 1281 // "required": true, 1282 // "type": "string" 1283 // } 1284 // }, 1285 // "path": "creatives/{accountId}/{buyerCreativeId}", 1286 // "response": { 1287 // "$ref": "Creative" 1288 // }, 1289 // "scopes": [ 1290 // "https://www.googleapis.com/auth/adexchange.buyer" 1291 // ] 1292 // } 1293 1294} 1295 1296// method id "adexchangebuyer.creatives.insert": 1297 1298type CreativesInsertCall struct { 1299 s *Service 1300 creative *Creative 1301 urlParams_ gensupport.URLParams 1302 ctx_ context.Context 1303 header_ http.Header 1304} 1305 1306// Insert: Submit a new creative. 1307func (r *CreativesService) Insert(creative *Creative) *CreativesInsertCall { 1308 c := &CreativesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1309 c.creative = creative 1310 return c 1311} 1312 1313// Fields allows partial responses to be retrieved. See 1314// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1315// for more information. 1316func (c *CreativesInsertCall) Fields(s ...googleapi.Field) *CreativesInsertCall { 1317 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1318 return c 1319} 1320 1321// Context sets the context to be used in this call's Do method. Any 1322// pending HTTP request will be aborted if the provided context is 1323// canceled. 1324func (c *CreativesInsertCall) Context(ctx context.Context) *CreativesInsertCall { 1325 c.ctx_ = ctx 1326 return c 1327} 1328 1329// Header returns an http.Header that can be modified by the caller to 1330// add HTTP headers to the request. 1331func (c *CreativesInsertCall) Header() http.Header { 1332 if c.header_ == nil { 1333 c.header_ = make(http.Header) 1334 } 1335 return c.header_ 1336} 1337 1338func (c *CreativesInsertCall) doRequest(alt string) (*http.Response, error) { 1339 reqHeaders := make(http.Header) 1340 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210819") 1341 for k, v := range c.header_ { 1342 reqHeaders[k] = v 1343 } 1344 reqHeaders.Set("User-Agent", c.s.userAgent()) 1345 var body io.Reader = nil 1346 body, err := googleapi.WithoutDataWrapper.JSONReader(c.creative) 1347 if err != nil { 1348 return nil, err 1349 } 1350 reqHeaders.Set("Content-Type", "application/json") 1351 c.urlParams_.Set("alt", alt) 1352 c.urlParams_.Set("prettyPrint", "false") 1353 urls := googleapi.ResolveRelative(c.s.BasePath, "creatives") 1354 urls += "?" + c.urlParams_.Encode() 1355 req, err := http.NewRequest("POST", urls, body) 1356 if err != nil { 1357 return nil, err 1358 } 1359 req.Header = reqHeaders 1360 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1361} 1362 1363// Do executes the "adexchangebuyer.creatives.insert" call. 1364// Exactly one of *Creative or error will be non-nil. Any non-2xx status 1365// code is an error. Response headers are in either 1366// *Creative.ServerResponse.Header or (if a response was returned at 1367// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1368// to check whether the returned error was because 1369// http.StatusNotModified was returned. 1370func (c *CreativesInsertCall) Do(opts ...googleapi.CallOption) (*Creative, error) { 1371 gensupport.SetOptions(c.urlParams_, opts...) 1372 res, err := c.doRequest("json") 1373 if res != nil && res.StatusCode == http.StatusNotModified { 1374 if res.Body != nil { 1375 res.Body.Close() 1376 } 1377 return nil, &googleapi.Error{ 1378 Code: res.StatusCode, 1379 Header: res.Header, 1380 } 1381 } 1382 if err != nil { 1383 return nil, err 1384 } 1385 defer googleapi.CloseBody(res) 1386 if err := googleapi.CheckResponse(res); err != nil { 1387 return nil, err 1388 } 1389 ret := &Creative{ 1390 ServerResponse: googleapi.ServerResponse{ 1391 Header: res.Header, 1392 HTTPStatusCode: res.StatusCode, 1393 }, 1394 } 1395 target := &ret 1396 if err := gensupport.DecodeResponse(target, res); err != nil { 1397 return nil, err 1398 } 1399 return ret, nil 1400 // { 1401 // "description": "Submit a new creative.", 1402 // "httpMethod": "POST", 1403 // "id": "adexchangebuyer.creatives.insert", 1404 // "path": "creatives", 1405 // "request": { 1406 // "$ref": "Creative" 1407 // }, 1408 // "response": { 1409 // "$ref": "Creative" 1410 // }, 1411 // "scopes": [ 1412 // "https://www.googleapis.com/auth/adexchange.buyer" 1413 // ] 1414 // } 1415 1416} 1417 1418// method id "adexchangebuyer.creatives.list": 1419 1420type CreativesListCall struct { 1421 s *Service 1422 urlParams_ gensupport.URLParams 1423 ifNoneMatch_ string 1424 ctx_ context.Context 1425 header_ http.Header 1426} 1427 1428// List: Retrieves a list of the authenticated user's active creatives. 1429// A creative will be available 30-40 minutes after submission. 1430func (r *CreativesService) List() *CreativesListCall { 1431 c := &CreativesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1432 return c 1433} 1434 1435// MaxResults sets the optional parameter "maxResults": Maximum number 1436// of entries returned on one result page. If not set, the default is 1437// 100. 1438func (c *CreativesListCall) MaxResults(maxResults int64) *CreativesListCall { 1439 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 1440 return c 1441} 1442 1443// PageToken sets the optional parameter "pageToken": A continuation 1444// token, used to page through ad clients. To retrieve the next page, 1445// set this parameter to the value of "nextPageToken" from the previous 1446// response. 1447func (c *CreativesListCall) PageToken(pageToken string) *CreativesListCall { 1448 c.urlParams_.Set("pageToken", pageToken) 1449 return c 1450} 1451 1452// StatusFilter sets the optional parameter "statusFilter": When 1453// specified, only creatives having the given status are returned. 1454// 1455// Possible values: 1456// "approved" - Creatives which have been approved. 1457// "disapproved" - Creatives which have been disapproved. 1458// "not_checked" - Creatives whose status is not yet checked. 1459func (c *CreativesListCall) StatusFilter(statusFilter string) *CreativesListCall { 1460 c.urlParams_.Set("statusFilter", statusFilter) 1461 return c 1462} 1463 1464// Fields allows partial responses to be retrieved. See 1465// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1466// for more information. 1467func (c *CreativesListCall) Fields(s ...googleapi.Field) *CreativesListCall { 1468 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1469 return c 1470} 1471 1472// IfNoneMatch sets the optional parameter which makes the operation 1473// fail if the object's ETag matches the given value. This is useful for 1474// getting updates only after the object has changed since the last 1475// request. Use googleapi.IsNotModified to check whether the response 1476// error from Do is the result of In-None-Match. 1477func (c *CreativesListCall) IfNoneMatch(entityTag string) *CreativesListCall { 1478 c.ifNoneMatch_ = entityTag 1479 return c 1480} 1481 1482// Context sets the context to be used in this call's Do method. Any 1483// pending HTTP request will be aborted if the provided context is 1484// canceled. 1485func (c *CreativesListCall) Context(ctx context.Context) *CreativesListCall { 1486 c.ctx_ = ctx 1487 return c 1488} 1489 1490// Header returns an http.Header that can be modified by the caller to 1491// add HTTP headers to the request. 1492func (c *CreativesListCall) Header() http.Header { 1493 if c.header_ == nil { 1494 c.header_ = make(http.Header) 1495 } 1496 return c.header_ 1497} 1498 1499func (c *CreativesListCall) doRequest(alt string) (*http.Response, error) { 1500 reqHeaders := make(http.Header) 1501 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210819") 1502 for k, v := range c.header_ { 1503 reqHeaders[k] = v 1504 } 1505 reqHeaders.Set("User-Agent", c.s.userAgent()) 1506 if c.ifNoneMatch_ != "" { 1507 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1508 } 1509 var body io.Reader = nil 1510 c.urlParams_.Set("alt", alt) 1511 c.urlParams_.Set("prettyPrint", "false") 1512 urls := googleapi.ResolveRelative(c.s.BasePath, "creatives") 1513 urls += "?" + c.urlParams_.Encode() 1514 req, err := http.NewRequest("GET", urls, body) 1515 if err != nil { 1516 return nil, err 1517 } 1518 req.Header = reqHeaders 1519 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1520} 1521 1522// Do executes the "adexchangebuyer.creatives.list" call. 1523// Exactly one of *CreativesList or error will be non-nil. Any non-2xx 1524// status code is an error. Response headers are in either 1525// *CreativesList.ServerResponse.Header or (if a response was returned 1526// at all) in error.(*googleapi.Error).Header. Use 1527// googleapi.IsNotModified to check whether the returned error was 1528// because http.StatusNotModified was returned. 1529func (c *CreativesListCall) Do(opts ...googleapi.CallOption) (*CreativesList, error) { 1530 gensupport.SetOptions(c.urlParams_, opts...) 1531 res, err := c.doRequest("json") 1532 if res != nil && res.StatusCode == http.StatusNotModified { 1533 if res.Body != nil { 1534 res.Body.Close() 1535 } 1536 return nil, &googleapi.Error{ 1537 Code: res.StatusCode, 1538 Header: res.Header, 1539 } 1540 } 1541 if err != nil { 1542 return nil, err 1543 } 1544 defer googleapi.CloseBody(res) 1545 if err := googleapi.CheckResponse(res); err != nil { 1546 return nil, err 1547 } 1548 ret := &CreativesList{ 1549 ServerResponse: googleapi.ServerResponse{ 1550 Header: res.Header, 1551 HTTPStatusCode: res.StatusCode, 1552 }, 1553 } 1554 target := &ret 1555 if err := gensupport.DecodeResponse(target, res); err != nil { 1556 return nil, err 1557 } 1558 return ret, nil 1559 // { 1560 // "description": "Retrieves a list of the authenticated user's active creatives. A creative will be available 30-40 minutes after submission.", 1561 // "httpMethod": "GET", 1562 // "id": "adexchangebuyer.creatives.list", 1563 // "parameters": { 1564 // "maxResults": { 1565 // "description": "Maximum number of entries returned on one result page. If not set, the default is 100. Optional.", 1566 // "format": "uint32", 1567 // "location": "query", 1568 // "maximum": "1000", 1569 // "minimum": "1", 1570 // "type": "integer" 1571 // }, 1572 // "pageToken": { 1573 // "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.", 1574 // "location": "query", 1575 // "type": "string" 1576 // }, 1577 // "statusFilter": { 1578 // "description": "When specified, only creatives having the given status are returned.", 1579 // "enum": [ 1580 // "approved", 1581 // "disapproved", 1582 // "not_checked" 1583 // ], 1584 // "enumDescriptions": [ 1585 // "Creatives which have been approved.", 1586 // "Creatives which have been disapproved.", 1587 // "Creatives whose status is not yet checked." 1588 // ], 1589 // "location": "query", 1590 // "type": "string" 1591 // } 1592 // }, 1593 // "path": "creatives", 1594 // "response": { 1595 // "$ref": "CreativesList" 1596 // }, 1597 // "scopes": [ 1598 // "https://www.googleapis.com/auth/adexchange.buyer" 1599 // ] 1600 // } 1601 1602} 1603 1604// Pages invokes f for each page of results. 1605// A non-nil error returned from f will halt the iteration. 1606// The provided context supersedes any context provided to the Context method. 1607func (c *CreativesListCall) Pages(ctx context.Context, f func(*CreativesList) error) error { 1608 c.ctx_ = ctx 1609 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1610 for { 1611 x, err := c.Do() 1612 if err != nil { 1613 return err 1614 } 1615 if err := f(x); err != nil { 1616 return err 1617 } 1618 if x.NextPageToken == "" { 1619 return nil 1620 } 1621 c.PageToken(x.NextPageToken) 1622 } 1623} 1624