1// Copyright 2019 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 adexchangeseller provides access to the Ad Exchange Seller API. 8// 9// For product documentation, see: https://developers.google.com/ad-exchange/seller-rest/ 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/adexchangeseller/v1" 16// ... 17// ctx := context.Background() 18// adexchangesellerService, err := adexchangeseller.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// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes: 27// 28// adexchangesellerService, err := adexchangeseller.NewService(ctx, option.WithScopes(adexchangeseller.AdexchangeSellerReadonlyScope)) 29// 30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 31// 32// adexchangesellerService, err := adexchangeseller.NewService(ctx, option.WithAPIKey("AIza...")) 33// 34// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 35// 36// config := &oauth2.Config{...} 37// // ... 38// token, err := config.Exchange(ctx, ...) 39// adexchangesellerService, err := adexchangeseller.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 40// 41// See https://godoc.org/google.golang.org/api/option/ for details on options. 42package adexchangeseller // import "google.golang.org/api/adexchangeseller/v1" 43 44import ( 45 "bytes" 46 "context" 47 "encoding/json" 48 "errors" 49 "fmt" 50 "io" 51 "net/http" 52 "net/url" 53 "strconv" 54 "strings" 55 56 googleapi "google.golang.org/api/googleapi" 57 gensupport "google.golang.org/api/internal/gensupport" 58 option "google.golang.org/api/option" 59 htransport "google.golang.org/api/transport/http" 60) 61 62// Always reference these packages, just in case the auto-generated code 63// below doesn't. 64var _ = bytes.NewBuffer 65var _ = strconv.Itoa 66var _ = fmt.Sprintf 67var _ = json.NewDecoder 68var _ = io.Copy 69var _ = url.Parse 70var _ = gensupport.MarshalJSON 71var _ = googleapi.Version 72var _ = errors.New 73var _ = strings.Replace 74var _ = context.Canceled 75 76const apiId = "adexchangeseller:v1" 77const apiName = "adexchangeseller" 78const apiVersion = "v1" 79const basePath = "https://www.googleapis.com/adexchangeseller/v1/" 80 81// OAuth2 scopes used by this API. 82const ( 83 // View and manage your Ad Exchange data 84 AdexchangeSellerScope = "https://www.googleapis.com/auth/adexchange.seller" 85 86 // View your Ad Exchange data 87 AdexchangeSellerReadonlyScope = "https://www.googleapis.com/auth/adexchange.seller.readonly" 88) 89 90// NewService creates a new Service. 91func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 92 scopesOption := option.WithScopes( 93 "https://www.googleapis.com/auth/adexchange.seller", 94 "https://www.googleapis.com/auth/adexchange.seller.readonly", 95 ) 96 // NOTE: prepend, so we don't override user-specified scopes. 97 opts = append([]option.ClientOption{scopesOption}, opts...) 98 client, endpoint, err := htransport.NewClient(ctx, opts...) 99 if err != nil { 100 return nil, err 101 } 102 s, err := New(client) 103 if err != nil { 104 return nil, err 105 } 106 if endpoint != "" { 107 s.BasePath = endpoint 108 } 109 return s, nil 110} 111 112// New creates a new Service. It uses the provided http.Client for requests. 113// 114// Deprecated: please use NewService instead. 115// To provide a custom HTTP client, use option.WithHTTPClient. 116// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 117func New(client *http.Client) (*Service, error) { 118 if client == nil { 119 return nil, errors.New("client is nil") 120 } 121 s := &Service{client: client, BasePath: basePath} 122 s.Adclients = NewAdclientsService(s) 123 s.Adunits = NewAdunitsService(s) 124 s.Customchannels = NewCustomchannelsService(s) 125 s.Reports = NewReportsService(s) 126 s.Urlchannels = NewUrlchannelsService(s) 127 return s, nil 128} 129 130type Service struct { 131 client *http.Client 132 BasePath string // API endpoint base URL 133 UserAgent string // optional additional User-Agent fragment 134 135 Adclients *AdclientsService 136 137 Adunits *AdunitsService 138 139 Customchannels *CustomchannelsService 140 141 Reports *ReportsService 142 143 Urlchannels *UrlchannelsService 144} 145 146func (s *Service) userAgent() string { 147 if s.UserAgent == "" { 148 return googleapi.UserAgent 149 } 150 return googleapi.UserAgent + " " + s.UserAgent 151} 152 153func NewAdclientsService(s *Service) *AdclientsService { 154 rs := &AdclientsService{s: s} 155 return rs 156} 157 158type AdclientsService struct { 159 s *Service 160} 161 162func NewAdunitsService(s *Service) *AdunitsService { 163 rs := &AdunitsService{s: s} 164 rs.Customchannels = NewAdunitsCustomchannelsService(s) 165 return rs 166} 167 168type AdunitsService struct { 169 s *Service 170 171 Customchannels *AdunitsCustomchannelsService 172} 173 174func NewAdunitsCustomchannelsService(s *Service) *AdunitsCustomchannelsService { 175 rs := &AdunitsCustomchannelsService{s: s} 176 return rs 177} 178 179type AdunitsCustomchannelsService struct { 180 s *Service 181} 182 183func NewCustomchannelsService(s *Service) *CustomchannelsService { 184 rs := &CustomchannelsService{s: s} 185 rs.Adunits = NewCustomchannelsAdunitsService(s) 186 return rs 187} 188 189type CustomchannelsService struct { 190 s *Service 191 192 Adunits *CustomchannelsAdunitsService 193} 194 195func NewCustomchannelsAdunitsService(s *Service) *CustomchannelsAdunitsService { 196 rs := &CustomchannelsAdunitsService{s: s} 197 return rs 198} 199 200type CustomchannelsAdunitsService struct { 201 s *Service 202} 203 204func NewReportsService(s *Service) *ReportsService { 205 rs := &ReportsService{s: s} 206 rs.Saved = NewReportsSavedService(s) 207 return rs 208} 209 210type ReportsService struct { 211 s *Service 212 213 Saved *ReportsSavedService 214} 215 216func NewReportsSavedService(s *Service) *ReportsSavedService { 217 rs := &ReportsSavedService{s: s} 218 return rs 219} 220 221type ReportsSavedService struct { 222 s *Service 223} 224 225func NewUrlchannelsService(s *Service) *UrlchannelsService { 226 rs := &UrlchannelsService{s: s} 227 return rs 228} 229 230type UrlchannelsService struct { 231 s *Service 232} 233 234type AdClient struct { 235 // ArcOptIn: Whether this ad client is opted in to ARC. 236 ArcOptIn bool `json:"arcOptIn,omitempty"` 237 238 // Id: Unique identifier of this ad client. 239 Id string `json:"id,omitempty"` 240 241 // Kind: Kind of resource this is, in this case 242 // adexchangeseller#adClient. 243 Kind string `json:"kind,omitempty"` 244 245 // ProductCode: This ad client's product code, which corresponds to the 246 // PRODUCT_CODE report dimension. 247 ProductCode string `json:"productCode,omitempty"` 248 249 // SupportsReporting: Whether this ad client supports being reported on. 250 SupportsReporting bool `json:"supportsReporting,omitempty"` 251 252 // ForceSendFields is a list of field names (e.g. "ArcOptIn") to 253 // unconditionally include in API requests. By default, fields with 254 // empty values are omitted from API requests. However, any non-pointer, 255 // non-interface field appearing in ForceSendFields will be sent to the 256 // server regardless of whether the field is empty or not. This may be 257 // used to include empty fields in Patch requests. 258 ForceSendFields []string `json:"-"` 259 260 // NullFields is a list of field names (e.g. "ArcOptIn") to include in 261 // API requests with the JSON null value. By default, fields with empty 262 // values are omitted from API requests. However, any field with an 263 // empty value appearing in NullFields will be sent to the server as 264 // null. It is an error if a field in this list has a non-empty value. 265 // This may be used to include null fields in Patch requests. 266 NullFields []string `json:"-"` 267} 268 269func (s *AdClient) MarshalJSON() ([]byte, error) { 270 type NoMethod AdClient 271 raw := NoMethod(*s) 272 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 273} 274 275type AdClients struct { 276 // Etag: ETag of this response for caching purposes. 277 Etag string `json:"etag,omitempty"` 278 279 // Items: The ad clients returned in this list response. 280 Items []*AdClient `json:"items,omitempty"` 281 282 // Kind: Kind of list this is, in this case adexchangeseller#adClients. 283 Kind string `json:"kind,omitempty"` 284 285 // NextPageToken: Continuation token used to page through ad clients. To 286 // retrieve the next page of results, set the next request's "pageToken" 287 // value to this. 288 NextPageToken string `json:"nextPageToken,omitempty"` 289 290 // ServerResponse contains the HTTP response code and headers from the 291 // server. 292 googleapi.ServerResponse `json:"-"` 293 294 // ForceSendFields is a list of field names (e.g. "Etag") to 295 // unconditionally include in API requests. By default, fields with 296 // empty values are omitted from API requests. However, any non-pointer, 297 // non-interface field appearing in ForceSendFields will be sent to the 298 // server regardless of whether the field is empty or not. This may be 299 // used to include empty fields in Patch requests. 300 ForceSendFields []string `json:"-"` 301 302 // NullFields is a list of field names (e.g. "Etag") to include in API 303 // requests with the JSON null value. By default, fields with empty 304 // values are omitted from API requests. However, any field with an 305 // empty value appearing in NullFields will be sent to the server as 306 // null. It is an error if a field in this list has a non-empty value. 307 // This may be used to include null fields in Patch requests. 308 NullFields []string `json:"-"` 309} 310 311func (s *AdClients) MarshalJSON() ([]byte, error) { 312 type NoMethod AdClients 313 raw := NoMethod(*s) 314 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 315} 316 317type AdUnit struct { 318 // Code: Identity code of this ad unit, not necessarily unique across ad 319 // clients. 320 Code string `json:"code,omitempty"` 321 322 // Id: Unique identifier of this ad unit. This should be considered an 323 // opaque identifier; it is not safe to rely on it being in any 324 // particular format. 325 Id string `json:"id,omitempty"` 326 327 // Kind: Kind of resource this is, in this case adexchangeseller#adUnit. 328 Kind string `json:"kind,omitempty"` 329 330 // Name: Name of this ad unit. 331 Name string `json:"name,omitempty"` 332 333 // Status: Status of this ad unit. Possible values are: 334 // NEW: Indicates that the ad unit was created within the last seven 335 // days and does not yet have any activity associated with it. 336 // 337 // ACTIVE: Indicates that there has been activity on this ad unit in the 338 // last seven days. 339 // 340 // INACTIVE: Indicates that there has been no activity on this ad unit 341 // in the last seven days. 342 Status string `json:"status,omitempty"` 343 344 // ServerResponse contains the HTTP response code and headers from the 345 // server. 346 googleapi.ServerResponse `json:"-"` 347 348 // ForceSendFields is a list of field names (e.g. "Code") to 349 // unconditionally include in API requests. By default, fields with 350 // empty values are omitted from API requests. However, any non-pointer, 351 // non-interface field appearing in ForceSendFields will be sent to the 352 // server regardless of whether the field is empty or not. This may be 353 // used to include empty fields in Patch requests. 354 ForceSendFields []string `json:"-"` 355 356 // NullFields is a list of field names (e.g. "Code") to include in API 357 // requests with the JSON null value. By default, fields with empty 358 // values are omitted from API requests. However, any field with an 359 // empty value appearing in NullFields will be sent to the server as 360 // null. It is an error if a field in this list has a non-empty value. 361 // This may be used to include null fields in Patch requests. 362 NullFields []string `json:"-"` 363} 364 365func (s *AdUnit) MarshalJSON() ([]byte, error) { 366 type NoMethod AdUnit 367 raw := NoMethod(*s) 368 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 369} 370 371type AdUnits struct { 372 // Etag: ETag of this response for caching purposes. 373 Etag string `json:"etag,omitempty"` 374 375 // Items: The ad units returned in this list response. 376 Items []*AdUnit `json:"items,omitempty"` 377 378 // Kind: Kind of list this is, in this case adexchangeseller#adUnits. 379 Kind string `json:"kind,omitempty"` 380 381 // NextPageToken: Continuation token used to page through ad units. To 382 // retrieve the next page of results, set the next request's "pageToken" 383 // value to this. 384 NextPageToken string `json:"nextPageToken,omitempty"` 385 386 // ServerResponse contains the HTTP response code and headers from the 387 // server. 388 googleapi.ServerResponse `json:"-"` 389 390 // ForceSendFields is a list of field names (e.g. "Etag") to 391 // unconditionally include in API requests. By default, fields with 392 // empty values are omitted from API requests. However, any non-pointer, 393 // non-interface field appearing in ForceSendFields will be sent to the 394 // server regardless of whether the field is empty or not. This may be 395 // used to include empty fields in Patch requests. 396 ForceSendFields []string `json:"-"` 397 398 // NullFields is a list of field names (e.g. "Etag") to include in API 399 // requests with the JSON null value. By default, fields with empty 400 // values are omitted from API requests. However, any field with an 401 // empty value appearing in NullFields will be sent to the server as 402 // null. It is an error if a field in this list has a non-empty value. 403 // This may be used to include null fields in Patch requests. 404 NullFields []string `json:"-"` 405} 406 407func (s *AdUnits) MarshalJSON() ([]byte, error) { 408 type NoMethod AdUnits 409 raw := NoMethod(*s) 410 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 411} 412 413type CustomChannel struct { 414 // Code: Code of this custom channel, not necessarily unique across ad 415 // clients. 416 Code string `json:"code,omitempty"` 417 418 // Id: Unique identifier of this custom channel. This should be 419 // considered an opaque identifier; it is not safe to rely on it being 420 // in any particular format. 421 Id string `json:"id,omitempty"` 422 423 // Kind: Kind of resource this is, in this case 424 // adexchangeseller#customChannel. 425 Kind string `json:"kind,omitempty"` 426 427 // Name: Name of this custom channel. 428 Name string `json:"name,omitempty"` 429 430 // TargetingInfo: The targeting information of this custom channel, if 431 // activated. 432 TargetingInfo *CustomChannelTargetingInfo `json:"targetingInfo,omitempty"` 433 434 // ServerResponse contains the HTTP response code and headers from the 435 // server. 436 googleapi.ServerResponse `json:"-"` 437 438 // ForceSendFields is a list of field names (e.g. "Code") to 439 // unconditionally include in API requests. By default, fields with 440 // empty values are omitted from API requests. However, any non-pointer, 441 // non-interface field appearing in ForceSendFields will be sent to the 442 // server regardless of whether the field is empty or not. This may be 443 // used to include empty fields in Patch requests. 444 ForceSendFields []string `json:"-"` 445 446 // NullFields is a list of field names (e.g. "Code") to include in API 447 // requests with the JSON null value. By default, fields with empty 448 // values are omitted from API requests. However, any field with an 449 // empty value appearing in NullFields will be sent to the server as 450 // null. It is an error if a field in this list has a non-empty value. 451 // This may be used to include null fields in Patch requests. 452 NullFields []string `json:"-"` 453} 454 455func (s *CustomChannel) MarshalJSON() ([]byte, error) { 456 type NoMethod CustomChannel 457 raw := NoMethod(*s) 458 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 459} 460 461// CustomChannelTargetingInfo: The targeting information of this custom 462// channel, if activated. 463type CustomChannelTargetingInfo struct { 464 // AdsAppearOn: The name used to describe this channel externally. 465 AdsAppearOn string `json:"adsAppearOn,omitempty"` 466 467 // Description: The external description of the channel. 468 Description string `json:"description,omitempty"` 469 470 // Location: The locations in which ads appear. (Only valid for content 471 // and mobile content ads). Acceptable values for content ads are: 472 // TOP_LEFT, TOP_CENTER, TOP_RIGHT, MIDDLE_LEFT, MIDDLE_CENTER, 473 // MIDDLE_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT, 474 // MULTIPLE_LOCATIONS. Acceptable values for mobile content ads are: 475 // TOP, MIDDLE, BOTTOM, MULTIPLE_LOCATIONS. 476 Location string `json:"location,omitempty"` 477 478 // SiteLanguage: The language of the sites ads will be displayed on. 479 SiteLanguage string `json:"siteLanguage,omitempty"` 480 481 // ForceSendFields is a list of field names (e.g. "AdsAppearOn") to 482 // unconditionally include in API requests. By default, fields with 483 // empty values are omitted from API requests. However, any non-pointer, 484 // non-interface field appearing in ForceSendFields will be sent to the 485 // server regardless of whether the field is empty or not. This may be 486 // used to include empty fields in Patch requests. 487 ForceSendFields []string `json:"-"` 488 489 // NullFields is a list of field names (e.g. "AdsAppearOn") to include 490 // in API requests with the JSON null value. By default, fields with 491 // empty values are omitted from API requests. However, any field with 492 // an empty value appearing in NullFields will be sent to the server as 493 // null. It is an error if a field in this list has a non-empty value. 494 // This may be used to include null fields in Patch requests. 495 NullFields []string `json:"-"` 496} 497 498func (s *CustomChannelTargetingInfo) MarshalJSON() ([]byte, error) { 499 type NoMethod CustomChannelTargetingInfo 500 raw := NoMethod(*s) 501 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 502} 503 504type CustomChannels struct { 505 // Etag: ETag of this response for caching purposes. 506 Etag string `json:"etag,omitempty"` 507 508 // Items: The custom channels returned in this list response. 509 Items []*CustomChannel `json:"items,omitempty"` 510 511 // Kind: Kind of list this is, in this case 512 // adexchangeseller#customChannels. 513 Kind string `json:"kind,omitempty"` 514 515 // NextPageToken: Continuation token used to page through custom 516 // channels. To retrieve the next page of results, set the next 517 // request's "pageToken" value to this. 518 NextPageToken string `json:"nextPageToken,omitempty"` 519 520 // ServerResponse contains the HTTP response code and headers from the 521 // server. 522 googleapi.ServerResponse `json:"-"` 523 524 // ForceSendFields is a list of field names (e.g. "Etag") to 525 // unconditionally include in API requests. By default, fields with 526 // empty values are omitted from API requests. However, any non-pointer, 527 // non-interface field appearing in ForceSendFields will be sent to the 528 // server regardless of whether the field is empty or not. This may be 529 // used to include empty fields in Patch requests. 530 ForceSendFields []string `json:"-"` 531 532 // NullFields is a list of field names (e.g. "Etag") to include in API 533 // requests with the JSON null value. By default, fields with empty 534 // values are omitted from API requests. However, any field with an 535 // empty value appearing in NullFields will be sent to the server as 536 // null. It is an error if a field in this list has a non-empty value. 537 // This may be used to include null fields in Patch requests. 538 NullFields []string `json:"-"` 539} 540 541func (s *CustomChannels) MarshalJSON() ([]byte, error) { 542 type NoMethod CustomChannels 543 raw := NoMethod(*s) 544 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 545} 546 547type Report struct { 548 // Averages: The averages of the report. This is the same length as any 549 // other row in the report; cells corresponding to dimension columns are 550 // empty. 551 Averages []string `json:"averages,omitempty"` 552 553 // Headers: The header information of the columns requested in the 554 // report. This is a list of headers; one for each dimension in the 555 // request, followed by one for each metric in the request. 556 Headers []*ReportHeaders `json:"headers,omitempty"` 557 558 // Kind: Kind this is, in this case adexchangeseller#report. 559 Kind string `json:"kind,omitempty"` 560 561 // Rows: The output rows of the report. Each row is a list of cells; one 562 // for each dimension in the request, followed by one for each metric in 563 // the request. The dimension cells contain strings, and the metric 564 // cells contain numbers. 565 Rows [][]string `json:"rows,omitempty"` 566 567 // TotalMatchedRows: The total number of rows matched by the report 568 // request. Fewer rows may be returned in the response due to being 569 // limited by the row count requested or the report row limit. 570 TotalMatchedRows int64 `json:"totalMatchedRows,omitempty,string"` 571 572 // Totals: The totals of the report. This is the same length as any 573 // other row in the report; cells corresponding to dimension columns are 574 // empty. 575 Totals []string `json:"totals,omitempty"` 576 577 // Warnings: Any warnings associated with generation of the report. 578 Warnings []string `json:"warnings,omitempty"` 579 580 // ServerResponse contains the HTTP response code and headers from the 581 // server. 582 googleapi.ServerResponse `json:"-"` 583 584 // ForceSendFields is a list of field names (e.g. "Averages") to 585 // unconditionally include in API requests. By default, fields with 586 // empty values are omitted from API requests. However, any non-pointer, 587 // non-interface field appearing in ForceSendFields will be sent to the 588 // server regardless of whether the field is empty or not. This may be 589 // used to include empty fields in Patch requests. 590 ForceSendFields []string `json:"-"` 591 592 // NullFields is a list of field names (e.g. "Averages") to include in 593 // API requests with the JSON null value. By default, fields with empty 594 // values are omitted from API requests. However, any field with an 595 // empty value appearing in NullFields will be sent to the server as 596 // null. It is an error if a field in this list has a non-empty value. 597 // This may be used to include null fields in Patch requests. 598 NullFields []string `json:"-"` 599} 600 601func (s *Report) MarshalJSON() ([]byte, error) { 602 type NoMethod Report 603 raw := NoMethod(*s) 604 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 605} 606 607type ReportHeaders struct { 608 // Currency: The currency of this column. Only present if the header 609 // type is METRIC_CURRENCY. 610 Currency string `json:"currency,omitempty"` 611 612 // Name: The name of the header. 613 Name string `json:"name,omitempty"` 614 615 // Type: The type of the header; one of DIMENSION, METRIC_TALLY, 616 // METRIC_RATIO, or METRIC_CURRENCY. 617 Type string `json:"type,omitempty"` 618 619 // ForceSendFields is a list of field names (e.g. "Currency") to 620 // unconditionally include in API requests. By default, fields with 621 // empty values are omitted from API requests. However, any non-pointer, 622 // non-interface field appearing in ForceSendFields will be sent to the 623 // server regardless of whether the field is empty or not. This may be 624 // used to include empty fields in Patch requests. 625 ForceSendFields []string `json:"-"` 626 627 // NullFields is a list of field names (e.g. "Currency") to include in 628 // API requests with the JSON null value. By default, fields with empty 629 // values are omitted from API requests. However, any field with an 630 // empty value appearing in NullFields will be sent to the server as 631 // null. It is an error if a field in this list has a non-empty value. 632 // This may be used to include null fields in Patch requests. 633 NullFields []string `json:"-"` 634} 635 636func (s *ReportHeaders) MarshalJSON() ([]byte, error) { 637 type NoMethod ReportHeaders 638 raw := NoMethod(*s) 639 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 640} 641 642type SavedReport struct { 643 // Id: Unique identifier of this saved report. 644 Id string `json:"id,omitempty"` 645 646 // Kind: Kind of resource this is, in this case 647 // adexchangeseller#savedReport. 648 Kind string `json:"kind,omitempty"` 649 650 // Name: This saved report's name. 651 Name string `json:"name,omitempty"` 652 653 // ForceSendFields is a list of field names (e.g. "Id") to 654 // unconditionally include in API requests. By default, fields with 655 // empty values are omitted from API requests. However, any non-pointer, 656 // non-interface field appearing in ForceSendFields will be sent to the 657 // server regardless of whether the field is empty or not. This may be 658 // used to include empty fields in Patch requests. 659 ForceSendFields []string `json:"-"` 660 661 // NullFields is a list of field names (e.g. "Id") to include in API 662 // requests with the JSON null value. By default, fields with empty 663 // values are omitted from API requests. However, any field with an 664 // empty value appearing in NullFields will be sent to the server as 665 // null. It is an error if a field in this list has a non-empty value. 666 // This may be used to include null fields in Patch requests. 667 NullFields []string `json:"-"` 668} 669 670func (s *SavedReport) MarshalJSON() ([]byte, error) { 671 type NoMethod SavedReport 672 raw := NoMethod(*s) 673 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 674} 675 676type SavedReports struct { 677 // Etag: ETag of this response for caching purposes. 678 Etag string `json:"etag,omitempty"` 679 680 // Items: The saved reports returned in this list response. 681 Items []*SavedReport `json:"items,omitempty"` 682 683 // Kind: Kind of list this is, in this case 684 // adexchangeseller#savedReports. 685 Kind string `json:"kind,omitempty"` 686 687 // NextPageToken: Continuation token used to page through saved reports. 688 // To retrieve the next page of results, set the next request's 689 // "pageToken" value to this. 690 NextPageToken string `json:"nextPageToken,omitempty"` 691 692 // ServerResponse contains the HTTP response code and headers from the 693 // server. 694 googleapi.ServerResponse `json:"-"` 695 696 // ForceSendFields is a list of field names (e.g. "Etag") to 697 // unconditionally include in API requests. By default, fields with 698 // empty values are omitted from API requests. However, any non-pointer, 699 // non-interface field appearing in ForceSendFields will be sent to the 700 // server regardless of whether the field is empty or not. This may be 701 // used to include empty fields in Patch requests. 702 ForceSendFields []string `json:"-"` 703 704 // NullFields is a list of field names (e.g. "Etag") to include in API 705 // requests with the JSON null value. By default, fields with empty 706 // values are omitted from API requests. However, any field with an 707 // empty value appearing in NullFields will be sent to the server as 708 // null. It is an error if a field in this list has a non-empty value. 709 // This may be used to include null fields in Patch requests. 710 NullFields []string `json:"-"` 711} 712 713func (s *SavedReports) MarshalJSON() ([]byte, error) { 714 type NoMethod SavedReports 715 raw := NoMethod(*s) 716 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 717} 718 719type UrlChannel struct { 720 // Id: Unique identifier of this URL channel. This should be considered 721 // an opaque identifier; it is not safe to rely on it being in any 722 // particular format. 723 Id string `json:"id,omitempty"` 724 725 // Kind: Kind of resource this is, in this case 726 // adexchangeseller#urlChannel. 727 Kind string `json:"kind,omitempty"` 728 729 // UrlPattern: URL Pattern of this URL channel. Does not include 730 // "http://" or "https://". Example: www.example.com/home 731 UrlPattern string `json:"urlPattern,omitempty"` 732 733 // ForceSendFields is a list of field names (e.g. "Id") to 734 // unconditionally include in API requests. By default, fields with 735 // empty values are omitted from API requests. However, any non-pointer, 736 // non-interface field appearing in ForceSendFields will be sent to the 737 // server regardless of whether the field is empty or not. This may be 738 // used to include empty fields in Patch requests. 739 ForceSendFields []string `json:"-"` 740 741 // NullFields is a list of field names (e.g. "Id") to include in API 742 // requests with the JSON null value. By default, fields with empty 743 // values are omitted from API requests. However, any field with an 744 // empty value appearing in NullFields will be sent to the server as 745 // null. It is an error if a field in this list has a non-empty value. 746 // This may be used to include null fields in Patch requests. 747 NullFields []string `json:"-"` 748} 749 750func (s *UrlChannel) MarshalJSON() ([]byte, error) { 751 type NoMethod UrlChannel 752 raw := NoMethod(*s) 753 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 754} 755 756type UrlChannels struct { 757 // Etag: ETag of this response for caching purposes. 758 Etag string `json:"etag,omitempty"` 759 760 // Items: The URL channels returned in this list response. 761 Items []*UrlChannel `json:"items,omitempty"` 762 763 // Kind: Kind of list this is, in this case 764 // adexchangeseller#urlChannels. 765 Kind string `json:"kind,omitempty"` 766 767 // NextPageToken: Continuation token used to page through URL channels. 768 // To retrieve the next page of results, set the next request's 769 // "pageToken" value to this. 770 NextPageToken string `json:"nextPageToken,omitempty"` 771 772 // ServerResponse contains the HTTP response code and headers from the 773 // server. 774 googleapi.ServerResponse `json:"-"` 775 776 // ForceSendFields is a list of field names (e.g. "Etag") to 777 // unconditionally include in API requests. By default, fields with 778 // empty values are omitted from API requests. However, any non-pointer, 779 // non-interface field appearing in ForceSendFields will be sent to the 780 // server regardless of whether the field is empty or not. This may be 781 // used to include empty fields in Patch requests. 782 ForceSendFields []string `json:"-"` 783 784 // NullFields is a list of field names (e.g. "Etag") to include in API 785 // requests with the JSON null value. By default, fields with empty 786 // values are omitted from API requests. However, any field with an 787 // empty value appearing in NullFields will be sent to the server as 788 // null. It is an error if a field in this list has a non-empty value. 789 // This may be used to include null fields in Patch requests. 790 NullFields []string `json:"-"` 791} 792 793func (s *UrlChannels) MarshalJSON() ([]byte, error) { 794 type NoMethod UrlChannels 795 raw := NoMethod(*s) 796 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 797} 798 799// method id "adexchangeseller.adclients.list": 800 801type AdclientsListCall struct { 802 s *Service 803 urlParams_ gensupport.URLParams 804 ifNoneMatch_ string 805 ctx_ context.Context 806 header_ http.Header 807} 808 809// List: List all ad clients in this Ad Exchange account. 810func (r *AdclientsService) List() *AdclientsListCall { 811 c := &AdclientsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 812 return c 813} 814 815// MaxResults sets the optional parameter "maxResults": The maximum 816// number of ad clients to include in the response, used for paging. 817func (c *AdclientsListCall) MaxResults(maxResults int64) *AdclientsListCall { 818 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 819 return c 820} 821 822// PageToken sets the optional parameter "pageToken": A continuation 823// token, used to page through ad clients. To retrieve the next page, 824// set this parameter to the value of "nextPageToken" from the previous 825// response. 826func (c *AdclientsListCall) PageToken(pageToken string) *AdclientsListCall { 827 c.urlParams_.Set("pageToken", pageToken) 828 return c 829} 830 831// Fields allows partial responses to be retrieved. See 832// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 833// for more information. 834func (c *AdclientsListCall) Fields(s ...googleapi.Field) *AdclientsListCall { 835 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 836 return c 837} 838 839// IfNoneMatch sets the optional parameter which makes the operation 840// fail if the object's ETag matches the given value. This is useful for 841// getting updates only after the object has changed since the last 842// request. Use googleapi.IsNotModified to check whether the response 843// error from Do is the result of In-None-Match. 844func (c *AdclientsListCall) IfNoneMatch(entityTag string) *AdclientsListCall { 845 c.ifNoneMatch_ = entityTag 846 return c 847} 848 849// Context sets the context to be used in this call's Do method. Any 850// pending HTTP request will be aborted if the provided context is 851// canceled. 852func (c *AdclientsListCall) Context(ctx context.Context) *AdclientsListCall { 853 c.ctx_ = ctx 854 return c 855} 856 857// Header returns an http.Header that can be modified by the caller to 858// add HTTP headers to the request. 859func (c *AdclientsListCall) Header() http.Header { 860 if c.header_ == nil { 861 c.header_ = make(http.Header) 862 } 863 return c.header_ 864} 865 866func (c *AdclientsListCall) doRequest(alt string) (*http.Response, error) { 867 reqHeaders := make(http.Header) 868 for k, v := range c.header_ { 869 reqHeaders[k] = v 870 } 871 reqHeaders.Set("User-Agent", c.s.userAgent()) 872 if c.ifNoneMatch_ != "" { 873 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 874 } 875 var body io.Reader = nil 876 c.urlParams_.Set("alt", alt) 877 c.urlParams_.Set("prettyPrint", "false") 878 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients") 879 urls += "?" + c.urlParams_.Encode() 880 req, err := http.NewRequest("GET", urls, body) 881 if err != nil { 882 return nil, err 883 } 884 req.Header = reqHeaders 885 return gensupport.SendRequest(c.ctx_, c.s.client, req) 886} 887 888// Do executes the "adexchangeseller.adclients.list" call. 889// Exactly one of *AdClients or error will be non-nil. Any non-2xx 890// status code is an error. Response headers are in either 891// *AdClients.ServerResponse.Header or (if a response was returned at 892// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 893// to check whether the returned error was because 894// http.StatusNotModified was returned. 895func (c *AdclientsListCall) Do(opts ...googleapi.CallOption) (*AdClients, error) { 896 gensupport.SetOptions(c.urlParams_, opts...) 897 res, err := c.doRequest("json") 898 if res != nil && res.StatusCode == http.StatusNotModified { 899 if res.Body != nil { 900 res.Body.Close() 901 } 902 return nil, &googleapi.Error{ 903 Code: res.StatusCode, 904 Header: res.Header, 905 } 906 } 907 if err != nil { 908 return nil, err 909 } 910 defer googleapi.CloseBody(res) 911 if err := googleapi.CheckResponse(res); err != nil { 912 return nil, err 913 } 914 ret := &AdClients{ 915 ServerResponse: googleapi.ServerResponse{ 916 Header: res.Header, 917 HTTPStatusCode: res.StatusCode, 918 }, 919 } 920 target := &ret 921 if err := gensupport.DecodeResponse(target, res); err != nil { 922 return nil, err 923 } 924 return ret, nil 925 // { 926 // "description": "List all ad clients in this Ad Exchange account.", 927 // "httpMethod": "GET", 928 // "id": "adexchangeseller.adclients.list", 929 // "parameters": { 930 // "maxResults": { 931 // "description": "The maximum number of ad clients to include in the response, used for paging.", 932 // "format": "uint32", 933 // "location": "query", 934 // "maximum": "10000", 935 // "minimum": "0", 936 // "type": "integer" 937 // }, 938 // "pageToken": { 939 // "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.", 940 // "location": "query", 941 // "type": "string" 942 // } 943 // }, 944 // "path": "adclients", 945 // "response": { 946 // "$ref": "AdClients" 947 // }, 948 // "scopes": [ 949 // "https://www.googleapis.com/auth/adexchange.seller", 950 // "https://www.googleapis.com/auth/adexchange.seller.readonly" 951 // ] 952 // } 953 954} 955 956// Pages invokes f for each page of results. 957// A non-nil error returned from f will halt the iteration. 958// The provided context supersedes any context provided to the Context method. 959func (c *AdclientsListCall) Pages(ctx context.Context, f func(*AdClients) error) error { 960 c.ctx_ = ctx 961 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 962 for { 963 x, err := c.Do() 964 if err != nil { 965 return err 966 } 967 if err := f(x); err != nil { 968 return err 969 } 970 if x.NextPageToken == "" { 971 return nil 972 } 973 c.PageToken(x.NextPageToken) 974 } 975} 976 977// method id "adexchangeseller.adunits.get": 978 979type AdunitsGetCall struct { 980 s *Service 981 adClientId string 982 adUnitId string 983 urlParams_ gensupport.URLParams 984 ifNoneMatch_ string 985 ctx_ context.Context 986 header_ http.Header 987} 988 989// Get: Gets the specified ad unit in the specified ad client. 990func (r *AdunitsService) Get(adClientId string, adUnitId string) *AdunitsGetCall { 991 c := &AdunitsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 992 c.adClientId = adClientId 993 c.adUnitId = adUnitId 994 return c 995} 996 997// Fields allows partial responses to be retrieved. See 998// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 999// for more information. 1000func (c *AdunitsGetCall) Fields(s ...googleapi.Field) *AdunitsGetCall { 1001 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1002 return c 1003} 1004 1005// IfNoneMatch sets the optional parameter which makes the operation 1006// fail if the object's ETag matches the given value. This is useful for 1007// getting updates only after the object has changed since the last 1008// request. Use googleapi.IsNotModified to check whether the response 1009// error from Do is the result of In-None-Match. 1010func (c *AdunitsGetCall) IfNoneMatch(entityTag string) *AdunitsGetCall { 1011 c.ifNoneMatch_ = entityTag 1012 return c 1013} 1014 1015// Context sets the context to be used in this call's Do method. Any 1016// pending HTTP request will be aborted if the provided context is 1017// canceled. 1018func (c *AdunitsGetCall) Context(ctx context.Context) *AdunitsGetCall { 1019 c.ctx_ = ctx 1020 return c 1021} 1022 1023// Header returns an http.Header that can be modified by the caller to 1024// add HTTP headers to the request. 1025func (c *AdunitsGetCall) Header() http.Header { 1026 if c.header_ == nil { 1027 c.header_ = make(http.Header) 1028 } 1029 return c.header_ 1030} 1031 1032func (c *AdunitsGetCall) doRequest(alt string) (*http.Response, error) { 1033 reqHeaders := make(http.Header) 1034 for k, v := range c.header_ { 1035 reqHeaders[k] = v 1036 } 1037 reqHeaders.Set("User-Agent", c.s.userAgent()) 1038 if c.ifNoneMatch_ != "" { 1039 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1040 } 1041 var body io.Reader = nil 1042 c.urlParams_.Set("alt", alt) 1043 c.urlParams_.Set("prettyPrint", "false") 1044 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/adunits/{adUnitId}") 1045 urls += "?" + c.urlParams_.Encode() 1046 req, err := http.NewRequest("GET", urls, body) 1047 if err != nil { 1048 return nil, err 1049 } 1050 req.Header = reqHeaders 1051 googleapi.Expand(req.URL, map[string]string{ 1052 "adClientId": c.adClientId, 1053 "adUnitId": c.adUnitId, 1054 }) 1055 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1056} 1057 1058// Do executes the "adexchangeseller.adunits.get" call. 1059// Exactly one of *AdUnit or error will be non-nil. Any non-2xx status 1060// code is an error. Response headers are in either 1061// *AdUnit.ServerResponse.Header or (if a response was returned at all) 1062// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1063// check whether the returned error was because http.StatusNotModified 1064// was returned. 1065func (c *AdunitsGetCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) { 1066 gensupport.SetOptions(c.urlParams_, opts...) 1067 res, err := c.doRequest("json") 1068 if res != nil && res.StatusCode == http.StatusNotModified { 1069 if res.Body != nil { 1070 res.Body.Close() 1071 } 1072 return nil, &googleapi.Error{ 1073 Code: res.StatusCode, 1074 Header: res.Header, 1075 } 1076 } 1077 if err != nil { 1078 return nil, err 1079 } 1080 defer googleapi.CloseBody(res) 1081 if err := googleapi.CheckResponse(res); err != nil { 1082 return nil, err 1083 } 1084 ret := &AdUnit{ 1085 ServerResponse: googleapi.ServerResponse{ 1086 Header: res.Header, 1087 HTTPStatusCode: res.StatusCode, 1088 }, 1089 } 1090 target := &ret 1091 if err := gensupport.DecodeResponse(target, res); err != nil { 1092 return nil, err 1093 } 1094 return ret, nil 1095 // { 1096 // "description": "Gets the specified ad unit in the specified ad client.", 1097 // "httpMethod": "GET", 1098 // "id": "adexchangeseller.adunits.get", 1099 // "parameterOrder": [ 1100 // "adClientId", 1101 // "adUnitId" 1102 // ], 1103 // "parameters": { 1104 // "adClientId": { 1105 // "description": "Ad client for which to get the ad unit.", 1106 // "location": "path", 1107 // "required": true, 1108 // "type": "string" 1109 // }, 1110 // "adUnitId": { 1111 // "description": "Ad unit to retrieve.", 1112 // "location": "path", 1113 // "required": true, 1114 // "type": "string" 1115 // } 1116 // }, 1117 // "path": "adclients/{adClientId}/adunits/{adUnitId}", 1118 // "response": { 1119 // "$ref": "AdUnit" 1120 // }, 1121 // "scopes": [ 1122 // "https://www.googleapis.com/auth/adexchange.seller", 1123 // "https://www.googleapis.com/auth/adexchange.seller.readonly" 1124 // ] 1125 // } 1126 1127} 1128 1129// method id "adexchangeseller.adunits.list": 1130 1131type AdunitsListCall struct { 1132 s *Service 1133 adClientId string 1134 urlParams_ gensupport.URLParams 1135 ifNoneMatch_ string 1136 ctx_ context.Context 1137 header_ http.Header 1138} 1139 1140// List: List all ad units in the specified ad client for this Ad 1141// Exchange account. 1142func (r *AdunitsService) List(adClientId string) *AdunitsListCall { 1143 c := &AdunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1144 c.adClientId = adClientId 1145 return c 1146} 1147 1148// IncludeInactive sets the optional parameter "includeInactive": 1149// Whether to include inactive ad units. Default: true. 1150func (c *AdunitsListCall) IncludeInactive(includeInactive bool) *AdunitsListCall { 1151 c.urlParams_.Set("includeInactive", fmt.Sprint(includeInactive)) 1152 return c 1153} 1154 1155// MaxResults sets the optional parameter "maxResults": The maximum 1156// number of ad units to include in the response, used for paging. 1157func (c *AdunitsListCall) MaxResults(maxResults int64) *AdunitsListCall { 1158 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 1159 return c 1160} 1161 1162// PageToken sets the optional parameter "pageToken": A continuation 1163// token, used to page through ad units. To retrieve the next page, set 1164// this parameter to the value of "nextPageToken" from the previous 1165// response. 1166func (c *AdunitsListCall) PageToken(pageToken string) *AdunitsListCall { 1167 c.urlParams_.Set("pageToken", pageToken) 1168 return c 1169} 1170 1171// Fields allows partial responses to be retrieved. See 1172// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1173// for more information. 1174func (c *AdunitsListCall) Fields(s ...googleapi.Field) *AdunitsListCall { 1175 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1176 return c 1177} 1178 1179// IfNoneMatch sets the optional parameter which makes the operation 1180// fail if the object's ETag matches the given value. This is useful for 1181// getting updates only after the object has changed since the last 1182// request. Use googleapi.IsNotModified to check whether the response 1183// error from Do is the result of In-None-Match. 1184func (c *AdunitsListCall) IfNoneMatch(entityTag string) *AdunitsListCall { 1185 c.ifNoneMatch_ = entityTag 1186 return c 1187} 1188 1189// Context sets the context to be used in this call's Do method. Any 1190// pending HTTP request will be aborted if the provided context is 1191// canceled. 1192func (c *AdunitsListCall) Context(ctx context.Context) *AdunitsListCall { 1193 c.ctx_ = ctx 1194 return c 1195} 1196 1197// Header returns an http.Header that can be modified by the caller to 1198// add HTTP headers to the request. 1199func (c *AdunitsListCall) Header() http.Header { 1200 if c.header_ == nil { 1201 c.header_ = make(http.Header) 1202 } 1203 return c.header_ 1204} 1205 1206func (c *AdunitsListCall) doRequest(alt string) (*http.Response, error) { 1207 reqHeaders := make(http.Header) 1208 for k, v := range c.header_ { 1209 reqHeaders[k] = v 1210 } 1211 reqHeaders.Set("User-Agent", c.s.userAgent()) 1212 if c.ifNoneMatch_ != "" { 1213 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1214 } 1215 var body io.Reader = nil 1216 c.urlParams_.Set("alt", alt) 1217 c.urlParams_.Set("prettyPrint", "false") 1218 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/adunits") 1219 urls += "?" + c.urlParams_.Encode() 1220 req, err := http.NewRequest("GET", urls, body) 1221 if err != nil { 1222 return nil, err 1223 } 1224 req.Header = reqHeaders 1225 googleapi.Expand(req.URL, map[string]string{ 1226 "adClientId": c.adClientId, 1227 }) 1228 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1229} 1230 1231// Do executes the "adexchangeseller.adunits.list" call. 1232// Exactly one of *AdUnits or error will be non-nil. Any non-2xx status 1233// code is an error. Response headers are in either 1234// *AdUnits.ServerResponse.Header or (if a response was returned at all) 1235// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1236// check whether the returned error was because http.StatusNotModified 1237// was returned. 1238func (c *AdunitsListCall) Do(opts ...googleapi.CallOption) (*AdUnits, error) { 1239 gensupport.SetOptions(c.urlParams_, opts...) 1240 res, err := c.doRequest("json") 1241 if res != nil && res.StatusCode == http.StatusNotModified { 1242 if res.Body != nil { 1243 res.Body.Close() 1244 } 1245 return nil, &googleapi.Error{ 1246 Code: res.StatusCode, 1247 Header: res.Header, 1248 } 1249 } 1250 if err != nil { 1251 return nil, err 1252 } 1253 defer googleapi.CloseBody(res) 1254 if err := googleapi.CheckResponse(res); err != nil { 1255 return nil, err 1256 } 1257 ret := &AdUnits{ 1258 ServerResponse: googleapi.ServerResponse{ 1259 Header: res.Header, 1260 HTTPStatusCode: res.StatusCode, 1261 }, 1262 } 1263 target := &ret 1264 if err := gensupport.DecodeResponse(target, res); err != nil { 1265 return nil, err 1266 } 1267 return ret, nil 1268 // { 1269 // "description": "List all ad units in the specified ad client for this Ad Exchange account.", 1270 // "httpMethod": "GET", 1271 // "id": "adexchangeseller.adunits.list", 1272 // "parameterOrder": [ 1273 // "adClientId" 1274 // ], 1275 // "parameters": { 1276 // "adClientId": { 1277 // "description": "Ad client for which to list ad units.", 1278 // "location": "path", 1279 // "required": true, 1280 // "type": "string" 1281 // }, 1282 // "includeInactive": { 1283 // "description": "Whether to include inactive ad units. Default: true.", 1284 // "location": "query", 1285 // "type": "boolean" 1286 // }, 1287 // "maxResults": { 1288 // "description": "The maximum number of ad units to include in the response, used for paging.", 1289 // "format": "uint32", 1290 // "location": "query", 1291 // "maximum": "10000", 1292 // "minimum": "0", 1293 // "type": "integer" 1294 // }, 1295 // "pageToken": { 1296 // "description": "A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.", 1297 // "location": "query", 1298 // "type": "string" 1299 // } 1300 // }, 1301 // "path": "adclients/{adClientId}/adunits", 1302 // "response": { 1303 // "$ref": "AdUnits" 1304 // }, 1305 // "scopes": [ 1306 // "https://www.googleapis.com/auth/adexchange.seller", 1307 // "https://www.googleapis.com/auth/adexchange.seller.readonly" 1308 // ] 1309 // } 1310 1311} 1312 1313// Pages invokes f for each page of results. 1314// A non-nil error returned from f will halt the iteration. 1315// The provided context supersedes any context provided to the Context method. 1316func (c *AdunitsListCall) Pages(ctx context.Context, f func(*AdUnits) error) error { 1317 c.ctx_ = ctx 1318 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1319 for { 1320 x, err := c.Do() 1321 if err != nil { 1322 return err 1323 } 1324 if err := f(x); err != nil { 1325 return err 1326 } 1327 if x.NextPageToken == "" { 1328 return nil 1329 } 1330 c.PageToken(x.NextPageToken) 1331 } 1332} 1333 1334// method id "adexchangeseller.adunits.customchannels.list": 1335 1336type AdunitsCustomchannelsListCall struct { 1337 s *Service 1338 adClientId string 1339 adUnitId string 1340 urlParams_ gensupport.URLParams 1341 ifNoneMatch_ string 1342 ctx_ context.Context 1343 header_ http.Header 1344} 1345 1346// List: List all custom channels which the specified ad unit belongs 1347// to. 1348func (r *AdunitsCustomchannelsService) List(adClientId string, adUnitId string) *AdunitsCustomchannelsListCall { 1349 c := &AdunitsCustomchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1350 c.adClientId = adClientId 1351 c.adUnitId = adUnitId 1352 return c 1353} 1354 1355// MaxResults sets the optional parameter "maxResults": The maximum 1356// number of custom channels to include in the response, used for 1357// paging. 1358func (c *AdunitsCustomchannelsListCall) MaxResults(maxResults int64) *AdunitsCustomchannelsListCall { 1359 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 1360 return c 1361} 1362 1363// PageToken sets the optional parameter "pageToken": A continuation 1364// token, used to page through custom channels. To retrieve the next 1365// page, set this parameter to the value of "nextPageToken" from the 1366// previous response. 1367func (c *AdunitsCustomchannelsListCall) PageToken(pageToken string) *AdunitsCustomchannelsListCall { 1368 c.urlParams_.Set("pageToken", pageToken) 1369 return c 1370} 1371 1372// Fields allows partial responses to be retrieved. See 1373// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1374// for more information. 1375func (c *AdunitsCustomchannelsListCall) Fields(s ...googleapi.Field) *AdunitsCustomchannelsListCall { 1376 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1377 return c 1378} 1379 1380// IfNoneMatch sets the optional parameter which makes the operation 1381// fail if the object's ETag matches the given value. This is useful for 1382// getting updates only after the object has changed since the last 1383// request. Use googleapi.IsNotModified to check whether the response 1384// error from Do is the result of In-None-Match. 1385func (c *AdunitsCustomchannelsListCall) IfNoneMatch(entityTag string) *AdunitsCustomchannelsListCall { 1386 c.ifNoneMatch_ = entityTag 1387 return c 1388} 1389 1390// Context sets the context to be used in this call's Do method. Any 1391// pending HTTP request will be aborted if the provided context is 1392// canceled. 1393func (c *AdunitsCustomchannelsListCall) Context(ctx context.Context) *AdunitsCustomchannelsListCall { 1394 c.ctx_ = ctx 1395 return c 1396} 1397 1398// Header returns an http.Header that can be modified by the caller to 1399// add HTTP headers to the request. 1400func (c *AdunitsCustomchannelsListCall) Header() http.Header { 1401 if c.header_ == nil { 1402 c.header_ = make(http.Header) 1403 } 1404 return c.header_ 1405} 1406 1407func (c *AdunitsCustomchannelsListCall) doRequest(alt string) (*http.Response, error) { 1408 reqHeaders := make(http.Header) 1409 for k, v := range c.header_ { 1410 reqHeaders[k] = v 1411 } 1412 reqHeaders.Set("User-Agent", c.s.userAgent()) 1413 if c.ifNoneMatch_ != "" { 1414 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1415 } 1416 var body io.Reader = nil 1417 c.urlParams_.Set("alt", alt) 1418 c.urlParams_.Set("prettyPrint", "false") 1419 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/adunits/{adUnitId}/customchannels") 1420 urls += "?" + c.urlParams_.Encode() 1421 req, err := http.NewRequest("GET", urls, body) 1422 if err != nil { 1423 return nil, err 1424 } 1425 req.Header = reqHeaders 1426 googleapi.Expand(req.URL, map[string]string{ 1427 "adClientId": c.adClientId, 1428 "adUnitId": c.adUnitId, 1429 }) 1430 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1431} 1432 1433// Do executes the "adexchangeseller.adunits.customchannels.list" call. 1434// Exactly one of *CustomChannels or error will be non-nil. Any non-2xx 1435// status code is an error. Response headers are in either 1436// *CustomChannels.ServerResponse.Header or (if a response was returned 1437// at all) in error.(*googleapi.Error).Header. Use 1438// googleapi.IsNotModified to check whether the returned error was 1439// because http.StatusNotModified was returned. 1440func (c *AdunitsCustomchannelsListCall) Do(opts ...googleapi.CallOption) (*CustomChannels, error) { 1441 gensupport.SetOptions(c.urlParams_, opts...) 1442 res, err := c.doRequest("json") 1443 if res != nil && res.StatusCode == http.StatusNotModified { 1444 if res.Body != nil { 1445 res.Body.Close() 1446 } 1447 return nil, &googleapi.Error{ 1448 Code: res.StatusCode, 1449 Header: res.Header, 1450 } 1451 } 1452 if err != nil { 1453 return nil, err 1454 } 1455 defer googleapi.CloseBody(res) 1456 if err := googleapi.CheckResponse(res); err != nil { 1457 return nil, err 1458 } 1459 ret := &CustomChannels{ 1460 ServerResponse: googleapi.ServerResponse{ 1461 Header: res.Header, 1462 HTTPStatusCode: res.StatusCode, 1463 }, 1464 } 1465 target := &ret 1466 if err := gensupport.DecodeResponse(target, res); err != nil { 1467 return nil, err 1468 } 1469 return ret, nil 1470 // { 1471 // "description": "List all custom channels which the specified ad unit belongs to.", 1472 // "httpMethod": "GET", 1473 // "id": "adexchangeseller.adunits.customchannels.list", 1474 // "parameterOrder": [ 1475 // "adClientId", 1476 // "adUnitId" 1477 // ], 1478 // "parameters": { 1479 // "adClientId": { 1480 // "description": "Ad client which contains the ad unit.", 1481 // "location": "path", 1482 // "required": true, 1483 // "type": "string" 1484 // }, 1485 // "adUnitId": { 1486 // "description": "Ad unit for which to list custom channels.", 1487 // "location": "path", 1488 // "required": true, 1489 // "type": "string" 1490 // }, 1491 // "maxResults": { 1492 // "description": "The maximum number of custom channels to include in the response, used for paging.", 1493 // "format": "uint32", 1494 // "location": "query", 1495 // "maximum": "10000", 1496 // "minimum": "0", 1497 // "type": "integer" 1498 // }, 1499 // "pageToken": { 1500 // "description": "A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.", 1501 // "location": "query", 1502 // "type": "string" 1503 // } 1504 // }, 1505 // "path": "adclients/{adClientId}/adunits/{adUnitId}/customchannels", 1506 // "response": { 1507 // "$ref": "CustomChannels" 1508 // }, 1509 // "scopes": [ 1510 // "https://www.googleapis.com/auth/adexchange.seller", 1511 // "https://www.googleapis.com/auth/adexchange.seller.readonly" 1512 // ] 1513 // } 1514 1515} 1516 1517// Pages invokes f for each page of results. 1518// A non-nil error returned from f will halt the iteration. 1519// The provided context supersedes any context provided to the Context method. 1520func (c *AdunitsCustomchannelsListCall) Pages(ctx context.Context, f func(*CustomChannels) error) error { 1521 c.ctx_ = ctx 1522 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1523 for { 1524 x, err := c.Do() 1525 if err != nil { 1526 return err 1527 } 1528 if err := f(x); err != nil { 1529 return err 1530 } 1531 if x.NextPageToken == "" { 1532 return nil 1533 } 1534 c.PageToken(x.NextPageToken) 1535 } 1536} 1537 1538// method id "adexchangeseller.customchannels.get": 1539 1540type CustomchannelsGetCall struct { 1541 s *Service 1542 adClientId string 1543 customChannelId string 1544 urlParams_ gensupport.URLParams 1545 ifNoneMatch_ string 1546 ctx_ context.Context 1547 header_ http.Header 1548} 1549 1550// Get: Get the specified custom channel from the specified ad client. 1551func (r *CustomchannelsService) Get(adClientId string, customChannelId string) *CustomchannelsGetCall { 1552 c := &CustomchannelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1553 c.adClientId = adClientId 1554 c.customChannelId = customChannelId 1555 return c 1556} 1557 1558// Fields allows partial responses to be retrieved. See 1559// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1560// for more information. 1561func (c *CustomchannelsGetCall) Fields(s ...googleapi.Field) *CustomchannelsGetCall { 1562 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1563 return c 1564} 1565 1566// IfNoneMatch sets the optional parameter which makes the operation 1567// fail if the object's ETag matches the given value. This is useful for 1568// getting updates only after the object has changed since the last 1569// request. Use googleapi.IsNotModified to check whether the response 1570// error from Do is the result of In-None-Match. 1571func (c *CustomchannelsGetCall) IfNoneMatch(entityTag string) *CustomchannelsGetCall { 1572 c.ifNoneMatch_ = entityTag 1573 return c 1574} 1575 1576// Context sets the context to be used in this call's Do method. Any 1577// pending HTTP request will be aborted if the provided context is 1578// canceled. 1579func (c *CustomchannelsGetCall) Context(ctx context.Context) *CustomchannelsGetCall { 1580 c.ctx_ = ctx 1581 return c 1582} 1583 1584// Header returns an http.Header that can be modified by the caller to 1585// add HTTP headers to the request. 1586func (c *CustomchannelsGetCall) Header() http.Header { 1587 if c.header_ == nil { 1588 c.header_ = make(http.Header) 1589 } 1590 return c.header_ 1591} 1592 1593func (c *CustomchannelsGetCall) doRequest(alt string) (*http.Response, error) { 1594 reqHeaders := make(http.Header) 1595 for k, v := range c.header_ { 1596 reqHeaders[k] = v 1597 } 1598 reqHeaders.Set("User-Agent", c.s.userAgent()) 1599 if c.ifNoneMatch_ != "" { 1600 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1601 } 1602 var body io.Reader = nil 1603 c.urlParams_.Set("alt", alt) 1604 c.urlParams_.Set("prettyPrint", "false") 1605 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels/{customChannelId}") 1606 urls += "?" + c.urlParams_.Encode() 1607 req, err := http.NewRequest("GET", urls, body) 1608 if err != nil { 1609 return nil, err 1610 } 1611 req.Header = reqHeaders 1612 googleapi.Expand(req.URL, map[string]string{ 1613 "adClientId": c.adClientId, 1614 "customChannelId": c.customChannelId, 1615 }) 1616 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1617} 1618 1619// Do executes the "adexchangeseller.customchannels.get" call. 1620// Exactly one of *CustomChannel or error will be non-nil. Any non-2xx 1621// status code is an error. Response headers are in either 1622// *CustomChannel.ServerResponse.Header or (if a response was returned 1623// at all) in error.(*googleapi.Error).Header. Use 1624// googleapi.IsNotModified to check whether the returned error was 1625// because http.StatusNotModified was returned. 1626func (c *CustomchannelsGetCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) { 1627 gensupport.SetOptions(c.urlParams_, opts...) 1628 res, err := c.doRequest("json") 1629 if res != nil && res.StatusCode == http.StatusNotModified { 1630 if res.Body != nil { 1631 res.Body.Close() 1632 } 1633 return nil, &googleapi.Error{ 1634 Code: res.StatusCode, 1635 Header: res.Header, 1636 } 1637 } 1638 if err != nil { 1639 return nil, err 1640 } 1641 defer googleapi.CloseBody(res) 1642 if err := googleapi.CheckResponse(res); err != nil { 1643 return nil, err 1644 } 1645 ret := &CustomChannel{ 1646 ServerResponse: googleapi.ServerResponse{ 1647 Header: res.Header, 1648 HTTPStatusCode: res.StatusCode, 1649 }, 1650 } 1651 target := &ret 1652 if err := gensupport.DecodeResponse(target, res); err != nil { 1653 return nil, err 1654 } 1655 return ret, nil 1656 // { 1657 // "description": "Get the specified custom channel from the specified ad client.", 1658 // "httpMethod": "GET", 1659 // "id": "adexchangeseller.customchannels.get", 1660 // "parameterOrder": [ 1661 // "adClientId", 1662 // "customChannelId" 1663 // ], 1664 // "parameters": { 1665 // "adClientId": { 1666 // "description": "Ad client which contains the custom channel.", 1667 // "location": "path", 1668 // "required": true, 1669 // "type": "string" 1670 // }, 1671 // "customChannelId": { 1672 // "description": "Custom channel to retrieve.", 1673 // "location": "path", 1674 // "required": true, 1675 // "type": "string" 1676 // } 1677 // }, 1678 // "path": "adclients/{adClientId}/customchannels/{customChannelId}", 1679 // "response": { 1680 // "$ref": "CustomChannel" 1681 // }, 1682 // "scopes": [ 1683 // "https://www.googleapis.com/auth/adexchange.seller", 1684 // "https://www.googleapis.com/auth/adexchange.seller.readonly" 1685 // ] 1686 // } 1687 1688} 1689 1690// method id "adexchangeseller.customchannels.list": 1691 1692type CustomchannelsListCall struct { 1693 s *Service 1694 adClientId string 1695 urlParams_ gensupport.URLParams 1696 ifNoneMatch_ string 1697 ctx_ context.Context 1698 header_ http.Header 1699} 1700 1701// List: List all custom channels in the specified ad client for this Ad 1702// Exchange account. 1703func (r *CustomchannelsService) List(adClientId string) *CustomchannelsListCall { 1704 c := &CustomchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1705 c.adClientId = adClientId 1706 return c 1707} 1708 1709// MaxResults sets the optional parameter "maxResults": The maximum 1710// number of custom channels to include in the response, used for 1711// paging. 1712func (c *CustomchannelsListCall) MaxResults(maxResults int64) *CustomchannelsListCall { 1713 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 1714 return c 1715} 1716 1717// PageToken sets the optional parameter "pageToken": A continuation 1718// token, used to page through custom channels. To retrieve the next 1719// page, set this parameter to the value of "nextPageToken" from the 1720// previous response. 1721func (c *CustomchannelsListCall) PageToken(pageToken string) *CustomchannelsListCall { 1722 c.urlParams_.Set("pageToken", pageToken) 1723 return c 1724} 1725 1726// Fields allows partial responses to be retrieved. See 1727// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1728// for more information. 1729func (c *CustomchannelsListCall) Fields(s ...googleapi.Field) *CustomchannelsListCall { 1730 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1731 return c 1732} 1733 1734// IfNoneMatch sets the optional parameter which makes the operation 1735// fail if the object's ETag matches the given value. This is useful for 1736// getting updates only after the object has changed since the last 1737// request. Use googleapi.IsNotModified to check whether the response 1738// error from Do is the result of In-None-Match. 1739func (c *CustomchannelsListCall) IfNoneMatch(entityTag string) *CustomchannelsListCall { 1740 c.ifNoneMatch_ = entityTag 1741 return c 1742} 1743 1744// Context sets the context to be used in this call's Do method. Any 1745// pending HTTP request will be aborted if the provided context is 1746// canceled. 1747func (c *CustomchannelsListCall) Context(ctx context.Context) *CustomchannelsListCall { 1748 c.ctx_ = ctx 1749 return c 1750} 1751 1752// Header returns an http.Header that can be modified by the caller to 1753// add HTTP headers to the request. 1754func (c *CustomchannelsListCall) Header() http.Header { 1755 if c.header_ == nil { 1756 c.header_ = make(http.Header) 1757 } 1758 return c.header_ 1759} 1760 1761func (c *CustomchannelsListCall) doRequest(alt string) (*http.Response, error) { 1762 reqHeaders := make(http.Header) 1763 for k, v := range c.header_ { 1764 reqHeaders[k] = v 1765 } 1766 reqHeaders.Set("User-Agent", c.s.userAgent()) 1767 if c.ifNoneMatch_ != "" { 1768 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1769 } 1770 var body io.Reader = nil 1771 c.urlParams_.Set("alt", alt) 1772 c.urlParams_.Set("prettyPrint", "false") 1773 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels") 1774 urls += "?" + c.urlParams_.Encode() 1775 req, err := http.NewRequest("GET", urls, body) 1776 if err != nil { 1777 return nil, err 1778 } 1779 req.Header = reqHeaders 1780 googleapi.Expand(req.URL, map[string]string{ 1781 "adClientId": c.adClientId, 1782 }) 1783 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1784} 1785 1786// Do executes the "adexchangeseller.customchannels.list" call. 1787// Exactly one of *CustomChannels or error will be non-nil. Any non-2xx 1788// status code is an error. Response headers are in either 1789// *CustomChannels.ServerResponse.Header or (if a response was returned 1790// at all) in error.(*googleapi.Error).Header. Use 1791// googleapi.IsNotModified to check whether the returned error was 1792// because http.StatusNotModified was returned. 1793func (c *CustomchannelsListCall) Do(opts ...googleapi.CallOption) (*CustomChannels, error) { 1794 gensupport.SetOptions(c.urlParams_, opts...) 1795 res, err := c.doRequest("json") 1796 if res != nil && res.StatusCode == http.StatusNotModified { 1797 if res.Body != nil { 1798 res.Body.Close() 1799 } 1800 return nil, &googleapi.Error{ 1801 Code: res.StatusCode, 1802 Header: res.Header, 1803 } 1804 } 1805 if err != nil { 1806 return nil, err 1807 } 1808 defer googleapi.CloseBody(res) 1809 if err := googleapi.CheckResponse(res); err != nil { 1810 return nil, err 1811 } 1812 ret := &CustomChannels{ 1813 ServerResponse: googleapi.ServerResponse{ 1814 Header: res.Header, 1815 HTTPStatusCode: res.StatusCode, 1816 }, 1817 } 1818 target := &ret 1819 if err := gensupport.DecodeResponse(target, res); err != nil { 1820 return nil, err 1821 } 1822 return ret, nil 1823 // { 1824 // "description": "List all custom channels in the specified ad client for this Ad Exchange account.", 1825 // "httpMethod": "GET", 1826 // "id": "adexchangeseller.customchannels.list", 1827 // "parameterOrder": [ 1828 // "adClientId" 1829 // ], 1830 // "parameters": { 1831 // "adClientId": { 1832 // "description": "Ad client for which to list custom channels.", 1833 // "location": "path", 1834 // "required": true, 1835 // "type": "string" 1836 // }, 1837 // "maxResults": { 1838 // "description": "The maximum number of custom channels to include in the response, used for paging.", 1839 // "format": "uint32", 1840 // "location": "query", 1841 // "maximum": "10000", 1842 // "minimum": "0", 1843 // "type": "integer" 1844 // }, 1845 // "pageToken": { 1846 // "description": "A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.", 1847 // "location": "query", 1848 // "type": "string" 1849 // } 1850 // }, 1851 // "path": "adclients/{adClientId}/customchannels", 1852 // "response": { 1853 // "$ref": "CustomChannels" 1854 // }, 1855 // "scopes": [ 1856 // "https://www.googleapis.com/auth/adexchange.seller", 1857 // "https://www.googleapis.com/auth/adexchange.seller.readonly" 1858 // ] 1859 // } 1860 1861} 1862 1863// Pages invokes f for each page of results. 1864// A non-nil error returned from f will halt the iteration. 1865// The provided context supersedes any context provided to the Context method. 1866func (c *CustomchannelsListCall) Pages(ctx context.Context, f func(*CustomChannels) error) error { 1867 c.ctx_ = ctx 1868 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1869 for { 1870 x, err := c.Do() 1871 if err != nil { 1872 return err 1873 } 1874 if err := f(x); err != nil { 1875 return err 1876 } 1877 if x.NextPageToken == "" { 1878 return nil 1879 } 1880 c.PageToken(x.NextPageToken) 1881 } 1882} 1883 1884// method id "adexchangeseller.customchannels.adunits.list": 1885 1886type CustomchannelsAdunitsListCall struct { 1887 s *Service 1888 adClientId string 1889 customChannelId string 1890 urlParams_ gensupport.URLParams 1891 ifNoneMatch_ string 1892 ctx_ context.Context 1893 header_ http.Header 1894} 1895 1896// List: List all ad units in the specified custom channel. 1897func (r *CustomchannelsAdunitsService) List(adClientId string, customChannelId string) *CustomchannelsAdunitsListCall { 1898 c := &CustomchannelsAdunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1899 c.adClientId = adClientId 1900 c.customChannelId = customChannelId 1901 return c 1902} 1903 1904// IncludeInactive sets the optional parameter "includeInactive": 1905// Whether to include inactive ad units. Default: true. 1906func (c *CustomchannelsAdunitsListCall) IncludeInactive(includeInactive bool) *CustomchannelsAdunitsListCall { 1907 c.urlParams_.Set("includeInactive", fmt.Sprint(includeInactive)) 1908 return c 1909} 1910 1911// MaxResults sets the optional parameter "maxResults": The maximum 1912// number of ad units to include in the response, used for paging. 1913func (c *CustomchannelsAdunitsListCall) MaxResults(maxResults int64) *CustomchannelsAdunitsListCall { 1914 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 1915 return c 1916} 1917 1918// PageToken sets the optional parameter "pageToken": A continuation 1919// token, used to page through ad units. To retrieve the next page, set 1920// this parameter to the value of "nextPageToken" from the previous 1921// response. 1922func (c *CustomchannelsAdunitsListCall) PageToken(pageToken string) *CustomchannelsAdunitsListCall { 1923 c.urlParams_.Set("pageToken", pageToken) 1924 return c 1925} 1926 1927// Fields allows partial responses to be retrieved. See 1928// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1929// for more information. 1930func (c *CustomchannelsAdunitsListCall) Fields(s ...googleapi.Field) *CustomchannelsAdunitsListCall { 1931 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1932 return c 1933} 1934 1935// IfNoneMatch sets the optional parameter which makes the operation 1936// fail if the object's ETag matches the given value. This is useful for 1937// getting updates only after the object has changed since the last 1938// request. Use googleapi.IsNotModified to check whether the response 1939// error from Do is the result of In-None-Match. 1940func (c *CustomchannelsAdunitsListCall) IfNoneMatch(entityTag string) *CustomchannelsAdunitsListCall { 1941 c.ifNoneMatch_ = entityTag 1942 return c 1943} 1944 1945// Context sets the context to be used in this call's Do method. Any 1946// pending HTTP request will be aborted if the provided context is 1947// canceled. 1948func (c *CustomchannelsAdunitsListCall) Context(ctx context.Context) *CustomchannelsAdunitsListCall { 1949 c.ctx_ = ctx 1950 return c 1951} 1952 1953// Header returns an http.Header that can be modified by the caller to 1954// add HTTP headers to the request. 1955func (c *CustomchannelsAdunitsListCall) Header() http.Header { 1956 if c.header_ == nil { 1957 c.header_ = make(http.Header) 1958 } 1959 return c.header_ 1960} 1961 1962func (c *CustomchannelsAdunitsListCall) doRequest(alt string) (*http.Response, error) { 1963 reqHeaders := make(http.Header) 1964 for k, v := range c.header_ { 1965 reqHeaders[k] = v 1966 } 1967 reqHeaders.Set("User-Agent", c.s.userAgent()) 1968 if c.ifNoneMatch_ != "" { 1969 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1970 } 1971 var body io.Reader = nil 1972 c.urlParams_.Set("alt", alt) 1973 c.urlParams_.Set("prettyPrint", "false") 1974 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels/{customChannelId}/adunits") 1975 urls += "?" + c.urlParams_.Encode() 1976 req, err := http.NewRequest("GET", urls, body) 1977 if err != nil { 1978 return nil, err 1979 } 1980 req.Header = reqHeaders 1981 googleapi.Expand(req.URL, map[string]string{ 1982 "adClientId": c.adClientId, 1983 "customChannelId": c.customChannelId, 1984 }) 1985 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1986} 1987 1988// Do executes the "adexchangeseller.customchannels.adunits.list" call. 1989// Exactly one of *AdUnits or error will be non-nil. Any non-2xx status 1990// code is an error. Response headers are in either 1991// *AdUnits.ServerResponse.Header or (if a response was returned at all) 1992// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1993// check whether the returned error was because http.StatusNotModified 1994// was returned. 1995func (c *CustomchannelsAdunitsListCall) Do(opts ...googleapi.CallOption) (*AdUnits, error) { 1996 gensupport.SetOptions(c.urlParams_, opts...) 1997 res, err := c.doRequest("json") 1998 if res != nil && res.StatusCode == http.StatusNotModified { 1999 if res.Body != nil { 2000 res.Body.Close() 2001 } 2002 return nil, &googleapi.Error{ 2003 Code: res.StatusCode, 2004 Header: res.Header, 2005 } 2006 } 2007 if err != nil { 2008 return nil, err 2009 } 2010 defer googleapi.CloseBody(res) 2011 if err := googleapi.CheckResponse(res); err != nil { 2012 return nil, err 2013 } 2014 ret := &AdUnits{ 2015 ServerResponse: googleapi.ServerResponse{ 2016 Header: res.Header, 2017 HTTPStatusCode: res.StatusCode, 2018 }, 2019 } 2020 target := &ret 2021 if err := gensupport.DecodeResponse(target, res); err != nil { 2022 return nil, err 2023 } 2024 return ret, nil 2025 // { 2026 // "description": "List all ad units in the specified custom channel.", 2027 // "httpMethod": "GET", 2028 // "id": "adexchangeseller.customchannels.adunits.list", 2029 // "parameterOrder": [ 2030 // "adClientId", 2031 // "customChannelId" 2032 // ], 2033 // "parameters": { 2034 // "adClientId": { 2035 // "description": "Ad client which contains the custom channel.", 2036 // "location": "path", 2037 // "required": true, 2038 // "type": "string" 2039 // }, 2040 // "customChannelId": { 2041 // "description": "Custom channel for which to list ad units.", 2042 // "location": "path", 2043 // "required": true, 2044 // "type": "string" 2045 // }, 2046 // "includeInactive": { 2047 // "description": "Whether to include inactive ad units. Default: true.", 2048 // "location": "query", 2049 // "type": "boolean" 2050 // }, 2051 // "maxResults": { 2052 // "description": "The maximum number of ad units to include in the response, used for paging.", 2053 // "format": "uint32", 2054 // "location": "query", 2055 // "maximum": "10000", 2056 // "minimum": "0", 2057 // "type": "integer" 2058 // }, 2059 // "pageToken": { 2060 // "description": "A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.", 2061 // "location": "query", 2062 // "type": "string" 2063 // } 2064 // }, 2065 // "path": "adclients/{adClientId}/customchannels/{customChannelId}/adunits", 2066 // "response": { 2067 // "$ref": "AdUnits" 2068 // }, 2069 // "scopes": [ 2070 // "https://www.googleapis.com/auth/adexchange.seller", 2071 // "https://www.googleapis.com/auth/adexchange.seller.readonly" 2072 // ] 2073 // } 2074 2075} 2076 2077// Pages invokes f for each page of results. 2078// A non-nil error returned from f will halt the iteration. 2079// The provided context supersedes any context provided to the Context method. 2080func (c *CustomchannelsAdunitsListCall) Pages(ctx context.Context, f func(*AdUnits) error) error { 2081 c.ctx_ = ctx 2082 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2083 for { 2084 x, err := c.Do() 2085 if err != nil { 2086 return err 2087 } 2088 if err := f(x); err != nil { 2089 return err 2090 } 2091 if x.NextPageToken == "" { 2092 return nil 2093 } 2094 c.PageToken(x.NextPageToken) 2095 } 2096} 2097 2098// method id "adexchangeseller.reports.generate": 2099 2100type ReportsGenerateCall struct { 2101 s *Service 2102 urlParams_ gensupport.URLParams 2103 ifNoneMatch_ string 2104 ctx_ context.Context 2105 header_ http.Header 2106} 2107 2108// Generate: Generate an Ad Exchange report based on the report request 2109// sent in the query parameters. Returns the result as JSON; to retrieve 2110// output in CSV format specify "alt=csv" as a query parameter. 2111func (r *ReportsService) Generate(startDate string, endDate string) *ReportsGenerateCall { 2112 c := &ReportsGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2113 c.urlParams_.Set("startDate", startDate) 2114 c.urlParams_.Set("endDate", endDate) 2115 return c 2116} 2117 2118// Dimension sets the optional parameter "dimension": Dimensions to base 2119// the report on. 2120func (c *ReportsGenerateCall) Dimension(dimension ...string) *ReportsGenerateCall { 2121 c.urlParams_.SetMulti("dimension", append([]string{}, dimension...)) 2122 return c 2123} 2124 2125// Filter sets the optional parameter "filter": Filters to be run on the 2126// report. 2127func (c *ReportsGenerateCall) Filter(filter ...string) *ReportsGenerateCall { 2128 c.urlParams_.SetMulti("filter", append([]string{}, filter...)) 2129 return c 2130} 2131 2132// Locale sets the optional parameter "locale": Optional locale to use 2133// for translating report output to a local language. Defaults to 2134// "en_US" if not specified. 2135func (c *ReportsGenerateCall) Locale(locale string) *ReportsGenerateCall { 2136 c.urlParams_.Set("locale", locale) 2137 return c 2138} 2139 2140// MaxResults sets the optional parameter "maxResults": The maximum 2141// number of rows of report data to return. 2142func (c *ReportsGenerateCall) MaxResults(maxResults int64) *ReportsGenerateCall { 2143 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 2144 return c 2145} 2146 2147// Metric sets the optional parameter "metric": Numeric columns to 2148// include in the report. 2149func (c *ReportsGenerateCall) Metric(metric ...string) *ReportsGenerateCall { 2150 c.urlParams_.SetMulti("metric", append([]string{}, metric...)) 2151 return c 2152} 2153 2154// Sort sets the optional parameter "sort": The name of a dimension or 2155// metric to sort the resulting report on, optionally prefixed with "+" 2156// to sort ascending or "-" to sort descending. If no prefix is 2157// specified, the column is sorted ascending. 2158func (c *ReportsGenerateCall) Sort(sort ...string) *ReportsGenerateCall { 2159 c.urlParams_.SetMulti("sort", append([]string{}, sort...)) 2160 return c 2161} 2162 2163// StartIndex sets the optional parameter "startIndex": Index of the 2164// first row of report data to return. 2165func (c *ReportsGenerateCall) StartIndex(startIndex int64) *ReportsGenerateCall { 2166 c.urlParams_.Set("startIndex", fmt.Sprint(startIndex)) 2167 return c 2168} 2169 2170// Fields allows partial responses to be retrieved. See 2171// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2172// for more information. 2173func (c *ReportsGenerateCall) Fields(s ...googleapi.Field) *ReportsGenerateCall { 2174 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2175 return c 2176} 2177 2178// IfNoneMatch sets the optional parameter which makes the operation 2179// fail if the object's ETag matches the given value. This is useful for 2180// getting updates only after the object has changed since the last 2181// request. Use googleapi.IsNotModified to check whether the response 2182// error from Do is the result of In-None-Match. 2183func (c *ReportsGenerateCall) IfNoneMatch(entityTag string) *ReportsGenerateCall { 2184 c.ifNoneMatch_ = entityTag 2185 return c 2186} 2187 2188// Context sets the context to be used in this call's Do and Download 2189// methods. Any pending HTTP request will be aborted if the provided 2190// context is canceled. 2191func (c *ReportsGenerateCall) Context(ctx context.Context) *ReportsGenerateCall { 2192 c.ctx_ = ctx 2193 return c 2194} 2195 2196// Header returns an http.Header that can be modified by the caller to 2197// add HTTP headers to the request. 2198func (c *ReportsGenerateCall) Header() http.Header { 2199 if c.header_ == nil { 2200 c.header_ = make(http.Header) 2201 } 2202 return c.header_ 2203} 2204 2205func (c *ReportsGenerateCall) doRequest(alt string) (*http.Response, error) { 2206 reqHeaders := make(http.Header) 2207 for k, v := range c.header_ { 2208 reqHeaders[k] = v 2209 } 2210 reqHeaders.Set("User-Agent", c.s.userAgent()) 2211 if c.ifNoneMatch_ != "" { 2212 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2213 } 2214 var body io.Reader = nil 2215 c.urlParams_.Set("alt", alt) 2216 c.urlParams_.Set("prettyPrint", "false") 2217 urls := googleapi.ResolveRelative(c.s.BasePath, "reports") 2218 urls += "?" + c.urlParams_.Encode() 2219 req, err := http.NewRequest("GET", urls, body) 2220 if err != nil { 2221 return nil, err 2222 } 2223 req.Header = reqHeaders 2224 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2225} 2226 2227// Download fetches the API endpoint's "media" value, instead of the normal 2228// API response value. If the returned error is nil, the Response is guaranteed to 2229// have a 2xx status code. Callers must close the Response.Body as usual. 2230func (c *ReportsGenerateCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 2231 gensupport.SetOptions(c.urlParams_, opts...) 2232 res, err := c.doRequest("media") 2233 if err != nil { 2234 return nil, err 2235 } 2236 if err := googleapi.CheckMediaResponse(res); err != nil { 2237 res.Body.Close() 2238 return nil, err 2239 } 2240 return res, nil 2241} 2242 2243// Do executes the "adexchangeseller.reports.generate" call. 2244// Exactly one of *Report or error will be non-nil. Any non-2xx status 2245// code is an error. Response headers are in either 2246// *Report.ServerResponse.Header or (if a response was returned at all) 2247// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2248// check whether the returned error was because http.StatusNotModified 2249// was returned. 2250func (c *ReportsGenerateCall) Do(opts ...googleapi.CallOption) (*Report, error) { 2251 gensupport.SetOptions(c.urlParams_, opts...) 2252 res, err := c.doRequest("json") 2253 if res != nil && res.StatusCode == http.StatusNotModified { 2254 if res.Body != nil { 2255 res.Body.Close() 2256 } 2257 return nil, &googleapi.Error{ 2258 Code: res.StatusCode, 2259 Header: res.Header, 2260 } 2261 } 2262 if err != nil { 2263 return nil, err 2264 } 2265 defer googleapi.CloseBody(res) 2266 if err := googleapi.CheckResponse(res); err != nil { 2267 return nil, err 2268 } 2269 ret := &Report{ 2270 ServerResponse: googleapi.ServerResponse{ 2271 Header: res.Header, 2272 HTTPStatusCode: res.StatusCode, 2273 }, 2274 } 2275 target := &ret 2276 if err := gensupport.DecodeResponse(target, res); err != nil { 2277 return nil, err 2278 } 2279 return ret, nil 2280 // { 2281 // "description": "Generate an Ad Exchange report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify \"alt=csv\" as a query parameter.", 2282 // "httpMethod": "GET", 2283 // "id": "adexchangeseller.reports.generate", 2284 // "parameterOrder": [ 2285 // "startDate", 2286 // "endDate" 2287 // ], 2288 // "parameters": { 2289 // "dimension": { 2290 // "description": "Dimensions to base the report on.", 2291 // "location": "query", 2292 // "pattern": "[a-zA-Z_]+", 2293 // "repeated": true, 2294 // "type": "string" 2295 // }, 2296 // "endDate": { 2297 // "description": "End of the date range to report on in \"YYYY-MM-DD\" format, inclusive.", 2298 // "location": "query", 2299 // "pattern": "\\d{4}-\\d{2}-\\d{2}|(today|startOfMonth|startOfYear)(([\\-\\+]\\d+[dwmy]){0,3}?)", 2300 // "required": true, 2301 // "type": "string" 2302 // }, 2303 // "filter": { 2304 // "description": "Filters to be run on the report.", 2305 // "location": "query", 2306 // "pattern": "[a-zA-Z_]+(==|=@).+", 2307 // "repeated": true, 2308 // "type": "string" 2309 // }, 2310 // "locale": { 2311 // "description": "Optional locale to use for translating report output to a local language. Defaults to \"en_US\" if not specified.", 2312 // "location": "query", 2313 // "pattern": "[a-zA-Z_]+", 2314 // "type": "string" 2315 // }, 2316 // "maxResults": { 2317 // "description": "The maximum number of rows of report data to return.", 2318 // "format": "uint32", 2319 // "location": "query", 2320 // "maximum": "50000", 2321 // "minimum": "0", 2322 // "type": "integer" 2323 // }, 2324 // "metric": { 2325 // "description": "Numeric columns to include in the report.", 2326 // "location": "query", 2327 // "pattern": "[a-zA-Z_]+", 2328 // "repeated": true, 2329 // "type": "string" 2330 // }, 2331 // "sort": { 2332 // "description": "The name of a dimension or metric to sort the resulting report on, optionally prefixed with \"+\" to sort ascending or \"-\" to sort descending. If no prefix is specified, the column is sorted ascending.", 2333 // "location": "query", 2334 // "pattern": "(\\+|-)?[a-zA-Z_]+", 2335 // "repeated": true, 2336 // "type": "string" 2337 // }, 2338 // "startDate": { 2339 // "description": "Start of the date range to report on in \"YYYY-MM-DD\" format, inclusive.", 2340 // "location": "query", 2341 // "pattern": "\\d{4}-\\d{2}-\\d{2}|(today|startOfMonth|startOfYear)(([\\-\\+]\\d+[dwmy]){0,3}?)", 2342 // "required": true, 2343 // "type": "string" 2344 // }, 2345 // "startIndex": { 2346 // "description": "Index of the first row of report data to return.", 2347 // "format": "uint32", 2348 // "location": "query", 2349 // "maximum": "5000", 2350 // "minimum": "0", 2351 // "type": "integer" 2352 // } 2353 // }, 2354 // "path": "reports", 2355 // "response": { 2356 // "$ref": "Report" 2357 // }, 2358 // "scopes": [ 2359 // "https://www.googleapis.com/auth/adexchange.seller", 2360 // "https://www.googleapis.com/auth/adexchange.seller.readonly" 2361 // ], 2362 // "supportsMediaDownload": true 2363 // } 2364 2365} 2366 2367// method id "adexchangeseller.reports.saved.generate": 2368 2369type ReportsSavedGenerateCall struct { 2370 s *Service 2371 savedReportId string 2372 urlParams_ gensupport.URLParams 2373 ifNoneMatch_ string 2374 ctx_ context.Context 2375 header_ http.Header 2376} 2377 2378// Generate: Generate an Ad Exchange report based on the saved report ID 2379// sent in the query parameters. 2380func (r *ReportsSavedService) Generate(savedReportId string) *ReportsSavedGenerateCall { 2381 c := &ReportsSavedGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2382 c.savedReportId = savedReportId 2383 return c 2384} 2385 2386// Locale sets the optional parameter "locale": Optional locale to use 2387// for translating report output to a local language. Defaults to 2388// "en_US" if not specified. 2389func (c *ReportsSavedGenerateCall) Locale(locale string) *ReportsSavedGenerateCall { 2390 c.urlParams_.Set("locale", locale) 2391 return c 2392} 2393 2394// MaxResults sets the optional parameter "maxResults": The maximum 2395// number of rows of report data to return. 2396func (c *ReportsSavedGenerateCall) MaxResults(maxResults int64) *ReportsSavedGenerateCall { 2397 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 2398 return c 2399} 2400 2401// StartIndex sets the optional parameter "startIndex": Index of the 2402// first row of report data to return. 2403func (c *ReportsSavedGenerateCall) StartIndex(startIndex int64) *ReportsSavedGenerateCall { 2404 c.urlParams_.Set("startIndex", fmt.Sprint(startIndex)) 2405 return c 2406} 2407 2408// Fields allows partial responses to be retrieved. See 2409// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2410// for more information. 2411func (c *ReportsSavedGenerateCall) Fields(s ...googleapi.Field) *ReportsSavedGenerateCall { 2412 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2413 return c 2414} 2415 2416// IfNoneMatch sets the optional parameter which makes the operation 2417// fail if the object's ETag matches the given value. This is useful for 2418// getting updates only after the object has changed since the last 2419// request. Use googleapi.IsNotModified to check whether the response 2420// error from Do is the result of In-None-Match. 2421func (c *ReportsSavedGenerateCall) IfNoneMatch(entityTag string) *ReportsSavedGenerateCall { 2422 c.ifNoneMatch_ = entityTag 2423 return c 2424} 2425 2426// Context sets the context to be used in this call's Do method. Any 2427// pending HTTP request will be aborted if the provided context is 2428// canceled. 2429func (c *ReportsSavedGenerateCall) Context(ctx context.Context) *ReportsSavedGenerateCall { 2430 c.ctx_ = ctx 2431 return c 2432} 2433 2434// Header returns an http.Header that can be modified by the caller to 2435// add HTTP headers to the request. 2436func (c *ReportsSavedGenerateCall) Header() http.Header { 2437 if c.header_ == nil { 2438 c.header_ = make(http.Header) 2439 } 2440 return c.header_ 2441} 2442 2443func (c *ReportsSavedGenerateCall) doRequest(alt string) (*http.Response, error) { 2444 reqHeaders := make(http.Header) 2445 for k, v := range c.header_ { 2446 reqHeaders[k] = v 2447 } 2448 reqHeaders.Set("User-Agent", c.s.userAgent()) 2449 if c.ifNoneMatch_ != "" { 2450 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2451 } 2452 var body io.Reader = nil 2453 c.urlParams_.Set("alt", alt) 2454 c.urlParams_.Set("prettyPrint", "false") 2455 urls := googleapi.ResolveRelative(c.s.BasePath, "reports/{savedReportId}") 2456 urls += "?" + c.urlParams_.Encode() 2457 req, err := http.NewRequest("GET", urls, body) 2458 if err != nil { 2459 return nil, err 2460 } 2461 req.Header = reqHeaders 2462 googleapi.Expand(req.URL, map[string]string{ 2463 "savedReportId": c.savedReportId, 2464 }) 2465 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2466} 2467 2468// Do executes the "adexchangeseller.reports.saved.generate" call. 2469// Exactly one of *Report or error will be non-nil. Any non-2xx status 2470// code is an error. Response headers are in either 2471// *Report.ServerResponse.Header or (if a response was returned at all) 2472// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2473// check whether the returned error was because http.StatusNotModified 2474// was returned. 2475func (c *ReportsSavedGenerateCall) Do(opts ...googleapi.CallOption) (*Report, error) { 2476 gensupport.SetOptions(c.urlParams_, opts...) 2477 res, err := c.doRequest("json") 2478 if res != nil && res.StatusCode == http.StatusNotModified { 2479 if res.Body != nil { 2480 res.Body.Close() 2481 } 2482 return nil, &googleapi.Error{ 2483 Code: res.StatusCode, 2484 Header: res.Header, 2485 } 2486 } 2487 if err != nil { 2488 return nil, err 2489 } 2490 defer googleapi.CloseBody(res) 2491 if err := googleapi.CheckResponse(res); err != nil { 2492 return nil, err 2493 } 2494 ret := &Report{ 2495 ServerResponse: googleapi.ServerResponse{ 2496 Header: res.Header, 2497 HTTPStatusCode: res.StatusCode, 2498 }, 2499 } 2500 target := &ret 2501 if err := gensupport.DecodeResponse(target, res); err != nil { 2502 return nil, err 2503 } 2504 return ret, nil 2505 // { 2506 // "description": "Generate an Ad Exchange report based on the saved report ID sent in the query parameters.", 2507 // "httpMethod": "GET", 2508 // "id": "adexchangeseller.reports.saved.generate", 2509 // "parameterOrder": [ 2510 // "savedReportId" 2511 // ], 2512 // "parameters": { 2513 // "locale": { 2514 // "description": "Optional locale to use for translating report output to a local language. Defaults to \"en_US\" if not specified.", 2515 // "location": "query", 2516 // "pattern": "[a-zA-Z_]+", 2517 // "type": "string" 2518 // }, 2519 // "maxResults": { 2520 // "description": "The maximum number of rows of report data to return.", 2521 // "format": "int32", 2522 // "location": "query", 2523 // "maximum": "50000", 2524 // "minimum": "0", 2525 // "type": "integer" 2526 // }, 2527 // "savedReportId": { 2528 // "description": "The saved report to retrieve.", 2529 // "location": "path", 2530 // "required": true, 2531 // "type": "string" 2532 // }, 2533 // "startIndex": { 2534 // "description": "Index of the first row of report data to return.", 2535 // "format": "int32", 2536 // "location": "query", 2537 // "maximum": "5000", 2538 // "minimum": "0", 2539 // "type": "integer" 2540 // } 2541 // }, 2542 // "path": "reports/{savedReportId}", 2543 // "response": { 2544 // "$ref": "Report" 2545 // }, 2546 // "scopes": [ 2547 // "https://www.googleapis.com/auth/adexchange.seller", 2548 // "https://www.googleapis.com/auth/adexchange.seller.readonly" 2549 // ] 2550 // } 2551 2552} 2553 2554// method id "adexchangeseller.reports.saved.list": 2555 2556type ReportsSavedListCall struct { 2557 s *Service 2558 urlParams_ gensupport.URLParams 2559 ifNoneMatch_ string 2560 ctx_ context.Context 2561 header_ http.Header 2562} 2563 2564// List: List all saved reports in this Ad Exchange account. 2565func (r *ReportsSavedService) List() *ReportsSavedListCall { 2566 c := &ReportsSavedListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2567 return c 2568} 2569 2570// MaxResults sets the optional parameter "maxResults": The maximum 2571// number of saved reports to include in the response, used for paging. 2572func (c *ReportsSavedListCall) MaxResults(maxResults int64) *ReportsSavedListCall { 2573 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 2574 return c 2575} 2576 2577// PageToken sets the optional parameter "pageToken": A continuation 2578// token, used to page through saved reports. To retrieve the next page, 2579// set this parameter to the value of "nextPageToken" from the previous 2580// response. 2581func (c *ReportsSavedListCall) PageToken(pageToken string) *ReportsSavedListCall { 2582 c.urlParams_.Set("pageToken", pageToken) 2583 return c 2584} 2585 2586// Fields allows partial responses to be retrieved. See 2587// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2588// for more information. 2589func (c *ReportsSavedListCall) Fields(s ...googleapi.Field) *ReportsSavedListCall { 2590 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2591 return c 2592} 2593 2594// IfNoneMatch sets the optional parameter which makes the operation 2595// fail if the object's ETag matches the given value. This is useful for 2596// getting updates only after the object has changed since the last 2597// request. Use googleapi.IsNotModified to check whether the response 2598// error from Do is the result of In-None-Match. 2599func (c *ReportsSavedListCall) IfNoneMatch(entityTag string) *ReportsSavedListCall { 2600 c.ifNoneMatch_ = entityTag 2601 return c 2602} 2603 2604// Context sets the context to be used in this call's Do method. Any 2605// pending HTTP request will be aborted if the provided context is 2606// canceled. 2607func (c *ReportsSavedListCall) Context(ctx context.Context) *ReportsSavedListCall { 2608 c.ctx_ = ctx 2609 return c 2610} 2611 2612// Header returns an http.Header that can be modified by the caller to 2613// add HTTP headers to the request. 2614func (c *ReportsSavedListCall) Header() http.Header { 2615 if c.header_ == nil { 2616 c.header_ = make(http.Header) 2617 } 2618 return c.header_ 2619} 2620 2621func (c *ReportsSavedListCall) doRequest(alt string) (*http.Response, error) { 2622 reqHeaders := make(http.Header) 2623 for k, v := range c.header_ { 2624 reqHeaders[k] = v 2625 } 2626 reqHeaders.Set("User-Agent", c.s.userAgent()) 2627 if c.ifNoneMatch_ != "" { 2628 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2629 } 2630 var body io.Reader = nil 2631 c.urlParams_.Set("alt", alt) 2632 c.urlParams_.Set("prettyPrint", "false") 2633 urls := googleapi.ResolveRelative(c.s.BasePath, "reports/saved") 2634 urls += "?" + c.urlParams_.Encode() 2635 req, err := http.NewRequest("GET", urls, body) 2636 if err != nil { 2637 return nil, err 2638 } 2639 req.Header = reqHeaders 2640 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2641} 2642 2643// Do executes the "adexchangeseller.reports.saved.list" call. 2644// Exactly one of *SavedReports or error will be non-nil. Any non-2xx 2645// status code is an error. Response headers are in either 2646// *SavedReports.ServerResponse.Header or (if a response was returned at 2647// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2648// to check whether the returned error was because 2649// http.StatusNotModified was returned. 2650func (c *ReportsSavedListCall) Do(opts ...googleapi.CallOption) (*SavedReports, error) { 2651 gensupport.SetOptions(c.urlParams_, opts...) 2652 res, err := c.doRequest("json") 2653 if res != nil && res.StatusCode == http.StatusNotModified { 2654 if res.Body != nil { 2655 res.Body.Close() 2656 } 2657 return nil, &googleapi.Error{ 2658 Code: res.StatusCode, 2659 Header: res.Header, 2660 } 2661 } 2662 if err != nil { 2663 return nil, err 2664 } 2665 defer googleapi.CloseBody(res) 2666 if err := googleapi.CheckResponse(res); err != nil { 2667 return nil, err 2668 } 2669 ret := &SavedReports{ 2670 ServerResponse: googleapi.ServerResponse{ 2671 Header: res.Header, 2672 HTTPStatusCode: res.StatusCode, 2673 }, 2674 } 2675 target := &ret 2676 if err := gensupport.DecodeResponse(target, res); err != nil { 2677 return nil, err 2678 } 2679 return ret, nil 2680 // { 2681 // "description": "List all saved reports in this Ad Exchange account.", 2682 // "httpMethod": "GET", 2683 // "id": "adexchangeseller.reports.saved.list", 2684 // "parameters": { 2685 // "maxResults": { 2686 // "description": "The maximum number of saved reports to include in the response, used for paging.", 2687 // "format": "int32", 2688 // "location": "query", 2689 // "maximum": "100", 2690 // "minimum": "0", 2691 // "type": "integer" 2692 // }, 2693 // "pageToken": { 2694 // "description": "A continuation token, used to page through saved reports. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.", 2695 // "location": "query", 2696 // "type": "string" 2697 // } 2698 // }, 2699 // "path": "reports/saved", 2700 // "response": { 2701 // "$ref": "SavedReports" 2702 // }, 2703 // "scopes": [ 2704 // "https://www.googleapis.com/auth/adexchange.seller", 2705 // "https://www.googleapis.com/auth/adexchange.seller.readonly" 2706 // ] 2707 // } 2708 2709} 2710 2711// Pages invokes f for each page of results. 2712// A non-nil error returned from f will halt the iteration. 2713// The provided context supersedes any context provided to the Context method. 2714func (c *ReportsSavedListCall) Pages(ctx context.Context, f func(*SavedReports) error) error { 2715 c.ctx_ = ctx 2716 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2717 for { 2718 x, err := c.Do() 2719 if err != nil { 2720 return err 2721 } 2722 if err := f(x); err != nil { 2723 return err 2724 } 2725 if x.NextPageToken == "" { 2726 return nil 2727 } 2728 c.PageToken(x.NextPageToken) 2729 } 2730} 2731 2732// method id "adexchangeseller.urlchannels.list": 2733 2734type UrlchannelsListCall struct { 2735 s *Service 2736 adClientId string 2737 urlParams_ gensupport.URLParams 2738 ifNoneMatch_ string 2739 ctx_ context.Context 2740 header_ http.Header 2741} 2742 2743// List: List all URL channels in the specified ad client for this Ad 2744// Exchange account. 2745func (r *UrlchannelsService) List(adClientId string) *UrlchannelsListCall { 2746 c := &UrlchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2747 c.adClientId = adClientId 2748 return c 2749} 2750 2751// MaxResults sets the optional parameter "maxResults": The maximum 2752// number of URL channels to include in the response, used for paging. 2753func (c *UrlchannelsListCall) MaxResults(maxResults int64) *UrlchannelsListCall { 2754 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 2755 return c 2756} 2757 2758// PageToken sets the optional parameter "pageToken": A continuation 2759// token, used to page through URL channels. To retrieve the next page, 2760// set this parameter to the value of "nextPageToken" from the previous 2761// response. 2762func (c *UrlchannelsListCall) PageToken(pageToken string) *UrlchannelsListCall { 2763 c.urlParams_.Set("pageToken", pageToken) 2764 return c 2765} 2766 2767// Fields allows partial responses to be retrieved. See 2768// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2769// for more information. 2770func (c *UrlchannelsListCall) Fields(s ...googleapi.Field) *UrlchannelsListCall { 2771 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2772 return c 2773} 2774 2775// IfNoneMatch sets the optional parameter which makes the operation 2776// fail if the object's ETag matches the given value. This is useful for 2777// getting updates only after the object has changed since the last 2778// request. Use googleapi.IsNotModified to check whether the response 2779// error from Do is the result of In-None-Match. 2780func (c *UrlchannelsListCall) IfNoneMatch(entityTag string) *UrlchannelsListCall { 2781 c.ifNoneMatch_ = entityTag 2782 return c 2783} 2784 2785// Context sets the context to be used in this call's Do method. Any 2786// pending HTTP request will be aborted if the provided context is 2787// canceled. 2788func (c *UrlchannelsListCall) Context(ctx context.Context) *UrlchannelsListCall { 2789 c.ctx_ = ctx 2790 return c 2791} 2792 2793// Header returns an http.Header that can be modified by the caller to 2794// add HTTP headers to the request. 2795func (c *UrlchannelsListCall) Header() http.Header { 2796 if c.header_ == nil { 2797 c.header_ = make(http.Header) 2798 } 2799 return c.header_ 2800} 2801 2802func (c *UrlchannelsListCall) doRequest(alt string) (*http.Response, error) { 2803 reqHeaders := make(http.Header) 2804 for k, v := range c.header_ { 2805 reqHeaders[k] = v 2806 } 2807 reqHeaders.Set("User-Agent", c.s.userAgent()) 2808 if c.ifNoneMatch_ != "" { 2809 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2810 } 2811 var body io.Reader = nil 2812 c.urlParams_.Set("alt", alt) 2813 c.urlParams_.Set("prettyPrint", "false") 2814 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/urlchannels") 2815 urls += "?" + c.urlParams_.Encode() 2816 req, err := http.NewRequest("GET", urls, body) 2817 if err != nil { 2818 return nil, err 2819 } 2820 req.Header = reqHeaders 2821 googleapi.Expand(req.URL, map[string]string{ 2822 "adClientId": c.adClientId, 2823 }) 2824 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2825} 2826 2827// Do executes the "adexchangeseller.urlchannels.list" call. 2828// Exactly one of *UrlChannels or error will be non-nil. Any non-2xx 2829// status code is an error. Response headers are in either 2830// *UrlChannels.ServerResponse.Header or (if a response was returned at 2831// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2832// to check whether the returned error was because 2833// http.StatusNotModified was returned. 2834func (c *UrlchannelsListCall) Do(opts ...googleapi.CallOption) (*UrlChannels, error) { 2835 gensupport.SetOptions(c.urlParams_, opts...) 2836 res, err := c.doRequest("json") 2837 if res != nil && res.StatusCode == http.StatusNotModified { 2838 if res.Body != nil { 2839 res.Body.Close() 2840 } 2841 return nil, &googleapi.Error{ 2842 Code: res.StatusCode, 2843 Header: res.Header, 2844 } 2845 } 2846 if err != nil { 2847 return nil, err 2848 } 2849 defer googleapi.CloseBody(res) 2850 if err := googleapi.CheckResponse(res); err != nil { 2851 return nil, err 2852 } 2853 ret := &UrlChannels{ 2854 ServerResponse: googleapi.ServerResponse{ 2855 Header: res.Header, 2856 HTTPStatusCode: res.StatusCode, 2857 }, 2858 } 2859 target := &ret 2860 if err := gensupport.DecodeResponse(target, res); err != nil { 2861 return nil, err 2862 } 2863 return ret, nil 2864 // { 2865 // "description": "List all URL channels in the specified ad client for this Ad Exchange account.", 2866 // "httpMethod": "GET", 2867 // "id": "adexchangeseller.urlchannels.list", 2868 // "parameterOrder": [ 2869 // "adClientId" 2870 // ], 2871 // "parameters": { 2872 // "adClientId": { 2873 // "description": "Ad client for which to list URL channels.", 2874 // "location": "path", 2875 // "required": true, 2876 // "type": "string" 2877 // }, 2878 // "maxResults": { 2879 // "description": "The maximum number of URL channels to include in the response, used for paging.", 2880 // "format": "uint32", 2881 // "location": "query", 2882 // "maximum": "10000", 2883 // "minimum": "0", 2884 // "type": "integer" 2885 // }, 2886 // "pageToken": { 2887 // "description": "A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.", 2888 // "location": "query", 2889 // "type": "string" 2890 // } 2891 // }, 2892 // "path": "adclients/{adClientId}/urlchannels", 2893 // "response": { 2894 // "$ref": "UrlChannels" 2895 // }, 2896 // "scopes": [ 2897 // "https://www.googleapis.com/auth/adexchange.seller", 2898 // "https://www.googleapis.com/auth/adexchange.seller.readonly" 2899 // ] 2900 // } 2901 2902} 2903 2904// Pages invokes f for each page of results. 2905// A non-nil error returned from f will halt the iteration. 2906// The provided context supersedes any context provided to the Context method. 2907func (c *UrlchannelsListCall) Pages(ctx context.Context, f func(*UrlChannels) error) error { 2908 c.ctx_ = ctx 2909 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2910 for { 2911 x, err := c.Do() 2912 if err != nil { 2913 return err 2914 } 2915 if err := f(x); err != nil { 2916 return err 2917 } 2918 if x.NextPageToken == "" { 2919 return nil 2920 } 2921 c.PageToken(x.NextPageToken) 2922 } 2923} 2924