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 manufacturers provides access to the Manufacturer Center API. 8// 9// For product documentation, see: https://developers.google.com/manufacturers/ 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/manufacturers/v1" 16// ... 17// ctx := context.Background() 18// manufacturersService, err := manufacturers.NewService(ctx) 19// 20// In this example, Google Application Default Credentials are used for authentication. 21// 22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 23// 24// Other authentication options 25// 26// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 27// 28// manufacturersService, err := manufacturers.NewService(ctx, option.WithAPIKey("AIza...")) 29// 30// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 31// 32// config := &oauth2.Config{...} 33// // ... 34// token, err := config.Exchange(ctx, ...) 35// manufacturersService, err := manufacturers.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 36// 37// See https://godoc.org/google.golang.org/api/option/ for details on options. 38package manufacturers // import "google.golang.org/api/manufacturers/v1" 39 40import ( 41 "bytes" 42 "context" 43 "encoding/json" 44 "errors" 45 "fmt" 46 "io" 47 "net/http" 48 "net/url" 49 "strconv" 50 "strings" 51 52 googleapi "google.golang.org/api/googleapi" 53 gensupport "google.golang.org/api/internal/gensupport" 54 option "google.golang.org/api/option" 55 htransport "google.golang.org/api/transport/http" 56) 57 58// Always reference these packages, just in case the auto-generated code 59// below doesn't. 60var _ = bytes.NewBuffer 61var _ = strconv.Itoa 62var _ = fmt.Sprintf 63var _ = json.NewDecoder 64var _ = io.Copy 65var _ = url.Parse 66var _ = gensupport.MarshalJSON 67var _ = googleapi.Version 68var _ = errors.New 69var _ = strings.Replace 70var _ = context.Canceled 71 72const apiId = "manufacturers:v1" 73const apiName = "manufacturers" 74const apiVersion = "v1" 75const basePath = "https://manufacturers.googleapis.com/" 76 77// OAuth2 scopes used by this API. 78const ( 79 // Manage your product listings for Google Manufacturer Center 80 ManufacturercenterScope = "https://www.googleapis.com/auth/manufacturercenter" 81) 82 83// NewService creates a new Service. 84func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 85 scopesOption := option.WithScopes( 86 "https://www.googleapis.com/auth/manufacturercenter", 87 ) 88 // NOTE: prepend, so we don't override user-specified scopes. 89 opts = append([]option.ClientOption{scopesOption}, opts...) 90 client, endpoint, err := htransport.NewClient(ctx, opts...) 91 if err != nil { 92 return nil, err 93 } 94 s, err := New(client) 95 if err != nil { 96 return nil, err 97 } 98 if endpoint != "" { 99 s.BasePath = endpoint 100 } 101 return s, nil 102} 103 104// New creates a new Service. It uses the provided http.Client for requests. 105// 106// Deprecated: please use NewService instead. 107// To provide a custom HTTP client, use option.WithHTTPClient. 108// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 109func New(client *http.Client) (*Service, error) { 110 if client == nil { 111 return nil, errors.New("client is nil") 112 } 113 s := &Service{client: client, BasePath: basePath} 114 s.Accounts = NewAccountsService(s) 115 return s, nil 116} 117 118type Service struct { 119 client *http.Client 120 BasePath string // API endpoint base URL 121 UserAgent string // optional additional User-Agent fragment 122 123 Accounts *AccountsService 124} 125 126func (s *Service) userAgent() string { 127 if s.UserAgent == "" { 128 return googleapi.UserAgent 129 } 130 return googleapi.UserAgent + " " + s.UserAgent 131} 132 133func NewAccountsService(s *Service) *AccountsService { 134 rs := &AccountsService{s: s} 135 rs.Products = NewAccountsProductsService(s) 136 return rs 137} 138 139type AccountsService struct { 140 s *Service 141 142 Products *AccountsProductsService 143} 144 145func NewAccountsProductsService(s *Service) *AccountsProductsService { 146 rs := &AccountsProductsService{s: s} 147 return rs 148} 149 150type AccountsProductsService struct { 151 s *Service 152} 153 154// Attributes: Attributes of the product. For more information, 155// see 156// https://support.google.com/manufacturers/answer/6124116. 157type Attributes struct { 158 // AdditionalImageLink: The additional images of the product. For more 159 // information, 160 // see 161 // https://support.google.com/manufacturers/answer/6124116#addlimage. 162 AdditionalImageLink []*Image `json:"additionalImageLink,omitempty"` 163 164 // AgeGroup: The target age group of the product. For more information, 165 // see 166 // https://support.google.com/manufacturers/answer/6124116#agegroup. 167 AgeGroup string `json:"ageGroup,omitempty"` 168 169 // Brand: The brand name of the product. For more information, 170 // see 171 // https://support.google.com/manufacturers/answer/6124116#brand. 172 Brand string `json:"brand,omitempty"` 173 174 // Capacity: The capacity of the product. For more information, 175 // see 176 // https://support.google.com/manufacturers/answer/6124116#capacity. 177 Capacity *Capacity `json:"capacity,omitempty"` 178 179 // Color: The color of the product. For more information, 180 // see 181 // https://support.google.com/manufacturers/answer/6124116#color. 182 Color string `json:"color,omitempty"` 183 184 // Count: The count of the product. For more information, 185 // see 186 // https://support.google.com/manufacturers/answer/6124116#count. 187 Count *Count `json:"count,omitempty"` 188 189 // Description: The description of the product. For more information, 190 // see 191 // https://support.google.com/manufacturers/answer/6124116#descriptio 192 // n. 193 Description string `json:"description,omitempty"` 194 195 // DisclosureDate: The disclosure date of the product. For more 196 // information, 197 // see 198 // https://support.google.com/manufacturers/answer/6124116#disclosure 199 // . 200 DisclosureDate string `json:"disclosureDate,omitempty"` 201 202 // ExcludedDestination: A list of excluded destinations. 203 ExcludedDestination []string `json:"excludedDestination,omitempty"` 204 205 // FeatureDescription: The rich format description of the product. For 206 // more information, 207 // see 208 // https://support.google.com/manufacturers/answer/6124116#featuredes 209 // c. 210 FeatureDescription []*FeatureDescription `json:"featureDescription,omitempty"` 211 212 // Flavor: The flavor of the product. For more information, 213 // see 214 // https://support.google.com/manufacturers/answer/6124116#flavor. 215 Flavor string `json:"flavor,omitempty"` 216 217 // Format: The format of the product. For more information, 218 // see 219 // https://support.google.com/manufacturers/answer/6124116#format. 220 Format string `json:"format,omitempty"` 221 222 // Gender: The target gender of the product. For more information, 223 // see 224 // https://support.google.com/manufacturers/answer/6124116#gender. 225 Gender string `json:"gender,omitempty"` 226 227 // Gtin: The Global Trade Item Number (GTIN) of the product. For more 228 // information, 229 // see https://support.google.com/manufacturers/answer/6124116#gtin. 230 Gtin []string `json:"gtin,omitempty"` 231 232 // ImageLink: The image of the product. For more information, 233 // see 234 // https://support.google.com/manufacturers/answer/6124116#image. 235 ImageLink *Image `json:"imageLink,omitempty"` 236 237 // IncludedDestination: A list of included destinations. 238 IncludedDestination []string `json:"includedDestination,omitempty"` 239 240 // ItemGroupId: The item group id of the product. For more information, 241 // see 242 // https://support.google.com/manufacturers/answer/6124116#itemgroupi 243 // d. 244 ItemGroupId string `json:"itemGroupId,omitempty"` 245 246 // Material: The material of the product. For more information, 247 // see 248 // https://support.google.com/manufacturers/answer/6124116#material. 249 Material string `json:"material,omitempty"` 250 251 // Mpn: The Manufacturer Part Number (MPN) of the product. For more 252 // information, 253 // see https://support.google.com/manufacturers/answer/6124116#mpn. 254 Mpn string `json:"mpn,omitempty"` 255 256 // Pattern: The pattern of the product. For more information, 257 // see 258 // https://support.google.com/manufacturers/answer/6124116#pattern. 259 Pattern string `json:"pattern,omitempty"` 260 261 // ProductDetail: The details of the product. For more information, 262 // see 263 // https://support.google.com/manufacturers/answer/6124116#productdet 264 // ail. 265 ProductDetail []*ProductDetail `json:"productDetail,omitempty"` 266 267 // ProductLine: The name of the group of products related to the 268 // product. For more 269 // information, 270 // see 271 // https://support.google.com/manufacturers/answer/6124116#productlin 272 // e. 273 ProductLine string `json:"productLine,omitempty"` 274 275 // ProductName: The canonical name of the product. For more information, 276 // see 277 // https://support.google.com/manufacturers/answer/6124116#productnam 278 // e. 279 ProductName string `json:"productName,omitempty"` 280 281 // ProductPageUrl: The URL of the detail page of the product. For more 282 // information, 283 // see 284 // https://support.google.com/manufacturers/answer/6124116#productpag 285 // e. 286 ProductPageUrl string `json:"productPageUrl,omitempty"` 287 288 // ProductType: The type or category of the product. For more 289 // information, 290 // see 291 // https://support.google.com/manufacturers/answer/6124116#producttyp 292 // e. 293 ProductType []string `json:"productType,omitempty"` 294 295 // ReleaseDate: The release date of the product. For more information, 296 // see 297 // https://support.google.com/manufacturers/answer/6124116#release. 298 ReleaseDate string `json:"releaseDate,omitempty"` 299 300 // Scent: The scent of the product. For more information, see 301 // https://support.google.com/manufacturers/answer/6124116#scent. 302 Scent string `json:"scent,omitempty"` 303 304 // Size: The size of the product. For more information, 305 // see 306 // https://support.google.com/manufacturers/answer/6124116#size. 307 Size string `json:"size,omitempty"` 308 309 // SizeSystem: The size system of the product. For more information, 310 // see 311 // https://support.google.com/manufacturers/answer/6124116#sizesystem 312 // . 313 SizeSystem string `json:"sizeSystem,omitempty"` 314 315 // SizeType: The size type of the product. For more information, 316 // see 317 // https://support.google.com/manufacturers/answer/6124116#sizetype. 318 SizeType string `json:"sizeType,omitempty"` 319 320 // SuggestedRetailPrice: The suggested retail price (MSRP) of the 321 // product. For more information, 322 // see https://support.google.com/manufacturers/answer/6124116#price. 323 SuggestedRetailPrice *Price `json:"suggestedRetailPrice,omitempty"` 324 325 // TargetClientId: The target client id. Should only be used in the 326 // accounts of the data 327 // partners. 328 TargetClientId string `json:"targetClientId,omitempty"` 329 330 // Theme: The theme of the product. For more information, 331 // see 332 // https://support.google.com/manufacturers/answer/6124116#theme. 333 Theme string `json:"theme,omitempty"` 334 335 // Title: The title of the product. For more information, 336 // see 337 // https://support.google.com/manufacturers/answer/6124116#title. 338 Title string `json:"title,omitempty"` 339 340 // VideoLink: The videos of the product. For more information, 341 // see 342 // https://support.google.com/manufacturers/answer/6124116#video. 343 VideoLink []string `json:"videoLink,omitempty"` 344 345 // ForceSendFields is a list of field names (e.g. "AdditionalImageLink") 346 // to unconditionally include in API requests. By default, fields with 347 // empty values are omitted from API requests. However, any non-pointer, 348 // non-interface field appearing in ForceSendFields will be sent to the 349 // server regardless of whether the field is empty or not. This may be 350 // used to include empty fields in Patch requests. 351 ForceSendFields []string `json:"-"` 352 353 // NullFields is a list of field names (e.g. "AdditionalImageLink") to 354 // include in API requests with the JSON null value. By default, fields 355 // with empty values are omitted from API requests. However, any field 356 // with an empty value appearing in NullFields will be sent to the 357 // server as null. It is an error if a field in this list has a 358 // non-empty value. This may be used to include null fields in Patch 359 // requests. 360 NullFields []string `json:"-"` 361} 362 363func (s *Attributes) MarshalJSON() ([]byte, error) { 364 type NoMethod Attributes 365 raw := NoMethod(*s) 366 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 367} 368 369// Capacity: The capacity of a product. For more information, 370// see 371// https://support.google.com/manufacturers/answer/6124116#capacity. 372type Capacity struct { 373 // Unit: The unit of the capacity, i.e., MB, GB, or TB. 374 Unit string `json:"unit,omitempty"` 375 376 // Value: The numeric value of the capacity. 377 Value int64 `json:"value,omitempty,string"` 378 379 // ForceSendFields is a list of field names (e.g. "Unit") to 380 // unconditionally include in API requests. By default, fields with 381 // empty values are omitted from API requests. However, any non-pointer, 382 // non-interface field appearing in ForceSendFields will be sent to the 383 // server regardless of whether the field is empty or not. This may be 384 // used to include empty fields in Patch requests. 385 ForceSendFields []string `json:"-"` 386 387 // NullFields is a list of field names (e.g. "Unit") to include in API 388 // requests with the JSON null value. By default, fields with empty 389 // values are omitted from API requests. However, any field with an 390 // empty value appearing in NullFields will be sent to the server as 391 // null. It is an error if a field in this list has a non-empty value. 392 // This may be used to include null fields in Patch requests. 393 NullFields []string `json:"-"` 394} 395 396func (s *Capacity) MarshalJSON() ([]byte, error) { 397 type NoMethod Capacity 398 raw := NoMethod(*s) 399 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 400} 401 402// Count: The number of products in a single package. For more 403// information, 404// see 405// https://support.google.com/manufacturers/answer/6124116#count. 406type Count struct { 407 // Unit: The unit in which these products are counted. 408 Unit string `json:"unit,omitempty"` 409 410 // Value: The numeric value of the number of products in a package. 411 Value int64 `json:"value,omitempty,string"` 412 413 // ForceSendFields is a list of field names (e.g. "Unit") to 414 // unconditionally include in API requests. By default, fields with 415 // empty values are omitted from API requests. However, any non-pointer, 416 // non-interface field appearing in ForceSendFields will be sent to the 417 // server regardless of whether the field is empty or not. This may be 418 // used to include empty fields in Patch requests. 419 ForceSendFields []string `json:"-"` 420 421 // NullFields is a list of field names (e.g. "Unit") to include in API 422 // requests with the JSON null value. By default, fields with empty 423 // values are omitted from API requests. However, any field with an 424 // empty value appearing in NullFields will be sent to the server as 425 // null. It is an error if a field in this list has a non-empty value. 426 // This may be used to include null fields in Patch requests. 427 NullFields []string `json:"-"` 428} 429 430func (s *Count) MarshalJSON() ([]byte, error) { 431 type NoMethod Count 432 raw := NoMethod(*s) 433 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 434} 435 436// DestinationStatus: The destination status. 437type DestinationStatus struct { 438 // Destination: The name of the destination. 439 Destination string `json:"destination,omitempty"` 440 441 // Status: The status of the destination. 442 // 443 // Possible values: 444 // "UNKNOWN" - Unspecified status, never used. 445 // "ACTIVE" - The product is used for this destination. 446 // "PENDING" - The decision is still pending. 447 // "DISAPPROVED" - The product is disapproved. Please look at the 448 // issues. 449 Status string `json:"status,omitempty"` 450 451 // ForceSendFields is a list of field names (e.g. "Destination") to 452 // unconditionally include in API requests. By default, fields with 453 // empty values are omitted from API requests. However, any non-pointer, 454 // non-interface field appearing in ForceSendFields will be sent to the 455 // server regardless of whether the field is empty or not. This may be 456 // used to include empty fields in Patch requests. 457 ForceSendFields []string `json:"-"` 458 459 // NullFields is a list of field names (e.g. "Destination") to include 460 // in API requests with the JSON null value. By default, fields with 461 // empty values are omitted from API requests. However, any field with 462 // an empty value appearing in NullFields will be sent to the server as 463 // null. It is an error if a field in this list has a non-empty value. 464 // This may be used to include null fields in Patch requests. 465 NullFields []string `json:"-"` 466} 467 468func (s *DestinationStatus) MarshalJSON() ([]byte, error) { 469 type NoMethod DestinationStatus 470 raw := NoMethod(*s) 471 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 472} 473 474// Empty: A generic empty message that you can re-use to avoid defining 475// duplicated 476// empty messages in your APIs. A typical example is to use it as the 477// request 478// or the response type of an API method. For instance: 479// 480// service Foo { 481// rpc Bar(google.protobuf.Empty) returns 482// (google.protobuf.Empty); 483// } 484// 485// The JSON representation for `Empty` is empty JSON object `{}`. 486type Empty struct { 487 // ServerResponse contains the HTTP response code and headers from the 488 // server. 489 googleapi.ServerResponse `json:"-"` 490} 491 492// FeatureDescription: A feature description of the product. For more 493// information, 494// see 495// https://support.google.com/manufacturers/answer/6124116#featuredes 496// c. 497type FeatureDescription struct { 498 // Headline: A short description of the feature. 499 Headline string `json:"headline,omitempty"` 500 501 // Image: An optional image describing the feature. 502 Image *Image `json:"image,omitempty"` 503 504 // Text: A detailed description of the feature. 505 Text string `json:"text,omitempty"` 506 507 // ForceSendFields is a list of field names (e.g. "Headline") to 508 // unconditionally include in API requests. By default, fields with 509 // empty values are omitted from API requests. However, any non-pointer, 510 // non-interface field appearing in ForceSendFields will be sent to the 511 // server regardless of whether the field is empty or not. This may be 512 // used to include empty fields in Patch requests. 513 ForceSendFields []string `json:"-"` 514 515 // NullFields is a list of field names (e.g. "Headline") to include in 516 // API requests with the JSON null value. By default, fields with empty 517 // values are omitted from API requests. However, any field with an 518 // empty value appearing in NullFields will be sent to the server as 519 // null. It is an error if a field in this list has a non-empty value. 520 // This may be used to include null fields in Patch requests. 521 NullFields []string `json:"-"` 522} 523 524func (s *FeatureDescription) MarshalJSON() ([]byte, error) { 525 type NoMethod FeatureDescription 526 raw := NoMethod(*s) 527 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 528} 529 530// Image: An image. 531type Image struct { 532 // ImageUrl: The URL of the image. For crawled images, this is the 533 // provided URL. For 534 // uploaded images, this is a serving URL from Google if the image has 535 // been 536 // processed successfully. 537 ImageUrl string `json:"imageUrl,omitempty"` 538 539 // Status: The status of the image. 540 // @OutputOnly 541 // 542 // Possible values: 543 // "STATUS_UNSPECIFIED" - The image status is unspecified. Should not 544 // be used. 545 // "PENDING_PROCESSING" - The image was uploaded and is being 546 // processed. 547 // "PENDING_CRAWL" - The image crawl is still pending. 548 // "OK" - The image was processed and it meets the requirements. 549 // "ROBOTED" - The image URL is protected by robots.txt file and 550 // cannot be crawled. 551 // "XROBOTED" - The image URL is protected by X-Robots-Tag and cannot 552 // be crawled. 553 // "CRAWL_ERROR" - There was an error while crawling the image. 554 // "PROCESSING_ERROR" - The image cannot be processed. 555 // "DECODING_ERROR" - The image cannot be decoded. 556 // "TOO_BIG" - The image is too big. 557 // "CRAWL_SKIPPED" - The image was manually overridden and will not be 558 // crawled. 559 // "HOSTLOADED" - The image crawl was postponed to avoid overloading 560 // the host. 561 // "HTTP_404" - The image URL returned a "404 Not Found" error. 562 Status string `json:"status,omitempty"` 563 564 // Type: The type of the image, i.e., crawled or uploaded. 565 // @OutputOnly 566 // 567 // Possible values: 568 // "TYPE_UNSPECIFIED" - Type is unspecified. Should not be used. 569 // "CRAWLED" - The image was crawled from a provided URL. 570 // "UPLOADED" - The image was uploaded. 571 Type string `json:"type,omitempty"` 572 573 // ForceSendFields is a list of field names (e.g. "ImageUrl") to 574 // unconditionally include in API requests. By default, fields with 575 // empty values are omitted from API requests. However, any non-pointer, 576 // non-interface field appearing in ForceSendFields will be sent to the 577 // server regardless of whether the field is empty or not. This may be 578 // used to include empty fields in Patch requests. 579 ForceSendFields []string `json:"-"` 580 581 // NullFields is a list of field names (e.g. "ImageUrl") to include in 582 // API requests with the JSON null value. By default, fields with empty 583 // values are omitted from API requests. However, any field with an 584 // empty value appearing in NullFields will be sent to the server as 585 // null. It is an error if a field in this list has a non-empty value. 586 // This may be used to include null fields in Patch requests. 587 NullFields []string `json:"-"` 588} 589 590func (s *Image) MarshalJSON() ([]byte, error) { 591 type NoMethod Image 592 raw := NoMethod(*s) 593 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 594} 595 596// Issue: Product issue. 597type Issue struct { 598 // Attribute: If present, the attribute that triggered the issue. For 599 // more information 600 // about attributes, 601 // see 602 // https://support.google.com/manufacturers/answer/6124116. 603 Attribute string `json:"attribute,omitempty"` 604 605 // Description: Longer description of the issue focused on how to 606 // resolve it. 607 Description string `json:"description,omitempty"` 608 609 // Destination: The destination this issue applies to. 610 Destination string `json:"destination,omitempty"` 611 612 // Resolution: What needs to happen to resolve the issue. 613 // 614 // Possible values: 615 // "RESOLUTION_UNSPECIFIED" - Unspecified resolution, never used. 616 // "USER_ACTION" - The user who provided the data must act in order to 617 // resolve the issue 618 // (for example by correcting some data). 619 // "PENDING_PROCESSING" - The issue will be resolved automatically 620 // (for example image crawl or 621 // Google review). No action is required now. Resolution might lead 622 // to 623 // another issue (for example if crawl fails). 624 Resolution string `json:"resolution,omitempty"` 625 626 // Severity: The severity of the issue. 627 // 628 // Possible values: 629 // "SEVERITY_UNSPECIFIED" - Unspecified severity, never used. 630 // "ERROR" - Error severity. The issue prevents the usage of the whole 631 // item. 632 // "WARNING" - Warning severity. The issue is either one that prevents 633 // the usage of the 634 // attribute that triggered it or one that will soon prevent the usage 635 // of 636 // the whole item. 637 // "INFO" - Info severity. The issue is one that doesn't require 638 // immediate attention. 639 // It is, for example, used to communicate which attributes are 640 // still 641 // pending review. 642 Severity string `json:"severity,omitempty"` 643 644 // Timestamp: The timestamp when this issue appeared. 645 Timestamp string `json:"timestamp,omitempty"` 646 647 // Title: Short title describing the nature of the issue. 648 Title string `json:"title,omitempty"` 649 650 // Type: The server-generated type of the issue, for 651 // example, 652 // “INCORRECT_TEXT_FORMATTING”, “IMAGE_NOT_SERVEABLE”, etc. 653 Type string `json:"type,omitempty"` 654 655 // ForceSendFields is a list of field names (e.g. "Attribute") to 656 // unconditionally include in API requests. By default, fields with 657 // empty values are omitted from API requests. However, any non-pointer, 658 // non-interface field appearing in ForceSendFields will be sent to the 659 // server regardless of whether the field is empty or not. This may be 660 // used to include empty fields in Patch requests. 661 ForceSendFields []string `json:"-"` 662 663 // NullFields is a list of field names (e.g. "Attribute") to include in 664 // API requests with the JSON null value. By default, fields with empty 665 // values are omitted from API requests. However, any field with an 666 // empty value appearing in NullFields will be sent to the server as 667 // null. It is an error if a field in this list has a non-empty value. 668 // This may be used to include null fields in Patch requests. 669 NullFields []string `json:"-"` 670} 671 672func (s *Issue) MarshalJSON() ([]byte, error) { 673 type NoMethod Issue 674 raw := NoMethod(*s) 675 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 676} 677 678type ListProductsResponse struct { 679 // NextPageToken: The token for the retrieval of the next page of 680 // product statuses. 681 NextPageToken string `json:"nextPageToken,omitempty"` 682 683 // Products: List of the products. 684 Products []*Product `json:"products,omitempty"` 685 686 // ServerResponse contains the HTTP response code and headers from the 687 // server. 688 googleapi.ServerResponse `json:"-"` 689 690 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 691 // unconditionally include in API requests. By default, fields with 692 // empty values are omitted from API requests. However, any non-pointer, 693 // non-interface field appearing in ForceSendFields will be sent to the 694 // server regardless of whether the field is empty or not. This may be 695 // used to include empty fields in Patch requests. 696 ForceSendFields []string `json:"-"` 697 698 // NullFields is a list of field names (e.g. "NextPageToken") to include 699 // in API requests with the JSON null value. By default, fields with 700 // empty values are omitted from API requests. However, any field with 701 // an empty value appearing in NullFields will be sent to the server as 702 // null. It is an error if a field in this list has a non-empty value. 703 // This may be used to include null fields in Patch requests. 704 NullFields []string `json:"-"` 705} 706 707func (s *ListProductsResponse) MarshalJSON() ([]byte, error) { 708 type NoMethod ListProductsResponse 709 raw := NoMethod(*s) 710 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 711} 712 713// Price: A price. 714type Price struct { 715 // Amount: The numeric value of the price. 716 Amount string `json:"amount,omitempty"` 717 718 // Currency: The currency in which the price is denoted. 719 Currency string `json:"currency,omitempty"` 720 721 // ForceSendFields is a list of field names (e.g. "Amount") to 722 // unconditionally include in API requests. By default, fields with 723 // empty values are omitted from API requests. However, any non-pointer, 724 // non-interface field appearing in ForceSendFields will be sent to the 725 // server regardless of whether the field is empty or not. This may be 726 // used to include empty fields in Patch requests. 727 ForceSendFields []string `json:"-"` 728 729 // NullFields is a list of field names (e.g. "Amount") to include in API 730 // requests with the JSON null value. By default, fields with empty 731 // values are omitted from API requests. However, any field with an 732 // empty value appearing in NullFields will be sent to the server as 733 // null. It is an error if a field in this list has a non-empty value. 734 // This may be used to include null fields in Patch requests. 735 NullFields []string `json:"-"` 736} 737 738func (s *Price) MarshalJSON() ([]byte, error) { 739 type NoMethod Price 740 raw := NoMethod(*s) 741 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 742} 743 744// Product: Product data. 745type Product struct { 746 // Attributes: Attributes of the product uploaded to the Manufacturer 747 // Center. Manually 748 // edited attributes are taken into account. 749 Attributes *Attributes `json:"attributes,omitempty"` 750 751 // ContentLanguage: The content language of the product as a two-letter 752 // ISO 639-1 language code 753 // (for example, en). 754 ContentLanguage string `json:"contentLanguage,omitempty"` 755 756 // DestinationStatuses: The status of the destinations. 757 DestinationStatuses []*DestinationStatus `json:"destinationStatuses,omitempty"` 758 759 // Issues: A server-generated list of issues associated with the 760 // product. 761 Issues []*Issue `json:"issues,omitempty"` 762 763 // Name: Name in the format 764 // `{target_country}:{content_language}:{product_id}`. 765 // 766 // `target_country` - The target country of the product as a CLDR 767 // territory 768 // code (for example, US). 769 // 770 // `content_language` - The content language of the product as a 771 // two-letter 772 // ISO 639-1 language code (for example, 773 // en). 774 // 775 // `product_id` - The ID of the product. For more information, 776 // see 777 // 778 // https://support.google.com/manufacturers/answer/6124116#id. 779 Name string `json:"name,omitempty"` 780 781 // Parent: Parent ID in the format 782 // `accounts/{account_id}`. 783 // 784 // `account_id` - The ID of the Manufacturer Center account. 785 Parent string `json:"parent,omitempty"` 786 787 // ProductId: The ID of the product. For more information, 788 // see 789 // https://support.google.com/manufacturers/answer/6124116#id. 790 ProductId string `json:"productId,omitempty"` 791 792 // TargetCountry: The target country of the product as a CLDR territory 793 // code (for example, 794 // US). 795 TargetCountry string `json:"targetCountry,omitempty"` 796 797 // ServerResponse contains the HTTP response code and headers from the 798 // server. 799 googleapi.ServerResponse `json:"-"` 800 801 // ForceSendFields is a list of field names (e.g. "Attributes") to 802 // unconditionally include in API requests. By default, fields with 803 // empty values are omitted from API requests. However, any non-pointer, 804 // non-interface field appearing in ForceSendFields will be sent to the 805 // server regardless of whether the field is empty or not. This may be 806 // used to include empty fields in Patch requests. 807 ForceSendFields []string `json:"-"` 808 809 // NullFields is a list of field names (e.g. "Attributes") to include in 810 // API requests with the JSON null value. By default, fields with empty 811 // values are omitted from API requests. However, any field with an 812 // empty value appearing in NullFields will be sent to the server as 813 // null. It is an error if a field in this list has a non-empty value. 814 // This may be used to include null fields in Patch requests. 815 NullFields []string `json:"-"` 816} 817 818func (s *Product) MarshalJSON() ([]byte, error) { 819 type NoMethod Product 820 raw := NoMethod(*s) 821 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 822} 823 824// ProductDetail: A product detail of the product. For more information, 825// see 826// https://support.google.com/manufacturers/answer/6124116#productdet 827// ail. 828type ProductDetail struct { 829 // AttributeName: The name of the attribute. 830 AttributeName string `json:"attributeName,omitempty"` 831 832 // AttributeValue: The value of the attribute. 833 AttributeValue string `json:"attributeValue,omitempty"` 834 835 // SectionName: A short section name that can be reused between multiple 836 // product details. 837 SectionName string `json:"sectionName,omitempty"` 838 839 // ForceSendFields is a list of field names (e.g. "AttributeName") to 840 // unconditionally include in API requests. By default, fields with 841 // empty values are omitted from API requests. However, any non-pointer, 842 // non-interface field appearing in ForceSendFields will be sent to the 843 // server regardless of whether the field is empty or not. This may be 844 // used to include empty fields in Patch requests. 845 ForceSendFields []string `json:"-"` 846 847 // NullFields is a list of field names (e.g. "AttributeName") to include 848 // in API requests with the JSON null value. By default, fields with 849 // empty values are omitted from API requests. However, any field with 850 // an empty value appearing in NullFields will be sent to the server as 851 // null. It is an error if a field in this list has a non-empty value. 852 // This may be used to include null fields in Patch requests. 853 NullFields []string `json:"-"` 854} 855 856func (s *ProductDetail) MarshalJSON() ([]byte, error) { 857 type NoMethod ProductDetail 858 raw := NoMethod(*s) 859 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 860} 861 862// method id "manufacturers.accounts.products.delete": 863 864type AccountsProductsDeleteCall struct { 865 s *Service 866 parent string 867 name string 868 urlParams_ gensupport.URLParams 869 ctx_ context.Context 870 header_ http.Header 871} 872 873// Delete: Deletes the product from a Manufacturer Center account. 874func (r *AccountsProductsService) Delete(parent string, name string) *AccountsProductsDeleteCall { 875 c := &AccountsProductsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 876 c.parent = parent 877 c.name = name 878 return c 879} 880 881// Fields allows partial responses to be retrieved. See 882// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 883// for more information. 884func (c *AccountsProductsDeleteCall) Fields(s ...googleapi.Field) *AccountsProductsDeleteCall { 885 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 886 return c 887} 888 889// Context sets the context to be used in this call's Do method. Any 890// pending HTTP request will be aborted if the provided context is 891// canceled. 892func (c *AccountsProductsDeleteCall) Context(ctx context.Context) *AccountsProductsDeleteCall { 893 c.ctx_ = ctx 894 return c 895} 896 897// Header returns an http.Header that can be modified by the caller to 898// add HTTP headers to the request. 899func (c *AccountsProductsDeleteCall) Header() http.Header { 900 if c.header_ == nil { 901 c.header_ = make(http.Header) 902 } 903 return c.header_ 904} 905 906func (c *AccountsProductsDeleteCall) doRequest(alt string) (*http.Response, error) { 907 reqHeaders := make(http.Header) 908 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216") 909 for k, v := range c.header_ { 910 reqHeaders[k] = v 911 } 912 reqHeaders.Set("User-Agent", c.s.userAgent()) 913 var body io.Reader = nil 914 c.urlParams_.Set("alt", alt) 915 c.urlParams_.Set("prettyPrint", "false") 916 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/products/{+name}") 917 urls += "?" + c.urlParams_.Encode() 918 req, err := http.NewRequest("DELETE", urls, body) 919 if err != nil { 920 return nil, err 921 } 922 req.Header = reqHeaders 923 googleapi.Expand(req.URL, map[string]string{ 924 "parent": c.parent, 925 "name": c.name, 926 }) 927 return gensupport.SendRequest(c.ctx_, c.s.client, req) 928} 929 930// Do executes the "manufacturers.accounts.products.delete" call. 931// Exactly one of *Empty or error will be non-nil. Any non-2xx status 932// code is an error. Response headers are in either 933// *Empty.ServerResponse.Header or (if a response was returned at all) 934// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 935// check whether the returned error was because http.StatusNotModified 936// was returned. 937func (c *AccountsProductsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 938 gensupport.SetOptions(c.urlParams_, opts...) 939 res, err := c.doRequest("json") 940 if res != nil && res.StatusCode == http.StatusNotModified { 941 if res.Body != nil { 942 res.Body.Close() 943 } 944 return nil, &googleapi.Error{ 945 Code: res.StatusCode, 946 Header: res.Header, 947 } 948 } 949 if err != nil { 950 return nil, err 951 } 952 defer googleapi.CloseBody(res) 953 if err := googleapi.CheckResponse(res); err != nil { 954 return nil, err 955 } 956 ret := &Empty{ 957 ServerResponse: googleapi.ServerResponse{ 958 Header: res.Header, 959 HTTPStatusCode: res.StatusCode, 960 }, 961 } 962 target := &ret 963 if err := gensupport.DecodeResponse(target, res); err != nil { 964 return nil, err 965 } 966 return ret, nil 967 // { 968 // "description": "Deletes the product from a Manufacturer Center account.", 969 // "flatPath": "v1/accounts/{accountsId}/products/{productsId}", 970 // "httpMethod": "DELETE", 971 // "id": "manufacturers.accounts.products.delete", 972 // "parameterOrder": [ 973 // "parent", 974 // "name" 975 // ], 976 // "parameters": { 977 // "name": { 978 // "description": "Name in the format `{target_country}:{content_language}:{product_id}`.\n\n`target_country` - The target country of the product as a CLDR territory\n code (for example, US).\n\n`content_language` - The content language of the product as a two-letter\n ISO 639-1 language code (for example, en).\n\n`product_id` - The ID of the product. For more information, see\n https://support.google.com/manufacturers/answer/6124116#id.", 979 // "location": "path", 980 // "pattern": "^[^/]+$", 981 // "required": true, 982 // "type": "string" 983 // }, 984 // "parent": { 985 // "description": "Parent ID in the format `accounts/{account_id}`.\n\n`account_id` - The ID of the Manufacturer Center account.", 986 // "location": "path", 987 // "pattern": "^accounts/[^/]+$", 988 // "required": true, 989 // "type": "string" 990 // } 991 // }, 992 // "path": "v1/{+parent}/products/{+name}", 993 // "response": { 994 // "$ref": "Empty" 995 // }, 996 // "scopes": [ 997 // "https://www.googleapis.com/auth/manufacturercenter" 998 // ] 999 // } 1000 1001} 1002 1003// method id "manufacturers.accounts.products.get": 1004 1005type AccountsProductsGetCall struct { 1006 s *Service 1007 parent string 1008 name string 1009 urlParams_ gensupport.URLParams 1010 ifNoneMatch_ string 1011 ctx_ context.Context 1012 header_ http.Header 1013} 1014 1015// Get: Gets the product from a Manufacturer Center account, including 1016// product 1017// issues. 1018// 1019// A recently updated product takes around 15 minutes to process. 1020// Changes are 1021// only visible after it has been processed. While some issues may 1022// be 1023// available once the product has been processed, other issues may take 1024// days 1025// to appear. 1026func (r *AccountsProductsService) Get(parent string, name string) *AccountsProductsGetCall { 1027 c := &AccountsProductsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1028 c.parent = parent 1029 c.name = name 1030 return c 1031} 1032 1033// Include sets the optional parameter "include": The information to be 1034// included in the response. Only sections listed here 1035// will be returned. 1036// 1037// Possible values: 1038// "UNKNOWN" 1039// "ATTRIBUTES" 1040// "ISSUES" 1041// "DESTINATION_STATUSES" 1042func (c *AccountsProductsGetCall) Include(include ...string) *AccountsProductsGetCall { 1043 c.urlParams_.SetMulti("include", append([]string{}, include...)) 1044 return c 1045} 1046 1047// Fields allows partial responses to be retrieved. See 1048// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1049// for more information. 1050func (c *AccountsProductsGetCall) Fields(s ...googleapi.Field) *AccountsProductsGetCall { 1051 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1052 return c 1053} 1054 1055// IfNoneMatch sets the optional parameter which makes the operation 1056// fail if the object's ETag matches the given value. This is useful for 1057// getting updates only after the object has changed since the last 1058// request. Use googleapi.IsNotModified to check whether the response 1059// error from Do is the result of In-None-Match. 1060func (c *AccountsProductsGetCall) IfNoneMatch(entityTag string) *AccountsProductsGetCall { 1061 c.ifNoneMatch_ = entityTag 1062 return c 1063} 1064 1065// Context sets the context to be used in this call's Do method. Any 1066// pending HTTP request will be aborted if the provided context is 1067// canceled. 1068func (c *AccountsProductsGetCall) Context(ctx context.Context) *AccountsProductsGetCall { 1069 c.ctx_ = ctx 1070 return c 1071} 1072 1073// Header returns an http.Header that can be modified by the caller to 1074// add HTTP headers to the request. 1075func (c *AccountsProductsGetCall) Header() http.Header { 1076 if c.header_ == nil { 1077 c.header_ = make(http.Header) 1078 } 1079 return c.header_ 1080} 1081 1082func (c *AccountsProductsGetCall) doRequest(alt string) (*http.Response, error) { 1083 reqHeaders := make(http.Header) 1084 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216") 1085 for k, v := range c.header_ { 1086 reqHeaders[k] = v 1087 } 1088 reqHeaders.Set("User-Agent", c.s.userAgent()) 1089 if c.ifNoneMatch_ != "" { 1090 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1091 } 1092 var body io.Reader = nil 1093 c.urlParams_.Set("alt", alt) 1094 c.urlParams_.Set("prettyPrint", "false") 1095 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/products/{+name}") 1096 urls += "?" + c.urlParams_.Encode() 1097 req, err := http.NewRequest("GET", urls, body) 1098 if err != nil { 1099 return nil, err 1100 } 1101 req.Header = reqHeaders 1102 googleapi.Expand(req.URL, map[string]string{ 1103 "parent": c.parent, 1104 "name": c.name, 1105 }) 1106 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1107} 1108 1109// Do executes the "manufacturers.accounts.products.get" call. 1110// Exactly one of *Product or error will be non-nil. Any non-2xx status 1111// code is an error. Response headers are in either 1112// *Product.ServerResponse.Header or (if a response was returned at all) 1113// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1114// check whether the returned error was because http.StatusNotModified 1115// was returned. 1116func (c *AccountsProductsGetCall) Do(opts ...googleapi.CallOption) (*Product, error) { 1117 gensupport.SetOptions(c.urlParams_, opts...) 1118 res, err := c.doRequest("json") 1119 if res != nil && res.StatusCode == http.StatusNotModified { 1120 if res.Body != nil { 1121 res.Body.Close() 1122 } 1123 return nil, &googleapi.Error{ 1124 Code: res.StatusCode, 1125 Header: res.Header, 1126 } 1127 } 1128 if err != nil { 1129 return nil, err 1130 } 1131 defer googleapi.CloseBody(res) 1132 if err := googleapi.CheckResponse(res); err != nil { 1133 return nil, err 1134 } 1135 ret := &Product{ 1136 ServerResponse: googleapi.ServerResponse{ 1137 Header: res.Header, 1138 HTTPStatusCode: res.StatusCode, 1139 }, 1140 } 1141 target := &ret 1142 if err := gensupport.DecodeResponse(target, res); err != nil { 1143 return nil, err 1144 } 1145 return ret, nil 1146 // { 1147 // "description": "Gets the product from a Manufacturer Center account, including product\nissues.\n\nA recently updated product takes around 15 minutes to process. Changes are\nonly visible after it has been processed. While some issues may be\navailable once the product has been processed, other issues may take days\nto appear.", 1148 // "flatPath": "v1/accounts/{accountsId}/products/{productsId}", 1149 // "httpMethod": "GET", 1150 // "id": "manufacturers.accounts.products.get", 1151 // "parameterOrder": [ 1152 // "parent", 1153 // "name" 1154 // ], 1155 // "parameters": { 1156 // "include": { 1157 // "description": "The information to be included in the response. Only sections listed here\nwill be returned.", 1158 // "enum": [ 1159 // "UNKNOWN", 1160 // "ATTRIBUTES", 1161 // "ISSUES", 1162 // "DESTINATION_STATUSES" 1163 // ], 1164 // "location": "query", 1165 // "repeated": true, 1166 // "type": "string" 1167 // }, 1168 // "name": { 1169 // "description": "Name in the format `{target_country}:{content_language}:{product_id}`.\n\n`target_country` - The target country of the product as a CLDR territory\n code (for example, US).\n\n`content_language` - The content language of the product as a two-letter\n ISO 639-1 language code (for example, en).\n\n`product_id` - The ID of the product. For more information, see\n https://support.google.com/manufacturers/answer/6124116#id.", 1170 // "location": "path", 1171 // "pattern": "^[^/]+$", 1172 // "required": true, 1173 // "type": "string" 1174 // }, 1175 // "parent": { 1176 // "description": "Parent ID in the format `accounts/{account_id}`.\n\n`account_id` - The ID of the Manufacturer Center account.", 1177 // "location": "path", 1178 // "pattern": "^accounts/[^/]+$", 1179 // "required": true, 1180 // "type": "string" 1181 // } 1182 // }, 1183 // "path": "v1/{+parent}/products/{+name}", 1184 // "response": { 1185 // "$ref": "Product" 1186 // }, 1187 // "scopes": [ 1188 // "https://www.googleapis.com/auth/manufacturercenter" 1189 // ] 1190 // } 1191 1192} 1193 1194// method id "manufacturers.accounts.products.list": 1195 1196type AccountsProductsListCall struct { 1197 s *Service 1198 parent string 1199 urlParams_ gensupport.URLParams 1200 ifNoneMatch_ string 1201 ctx_ context.Context 1202 header_ http.Header 1203} 1204 1205// List: Lists all the products in a Manufacturer Center account. 1206func (r *AccountsProductsService) List(parent string) *AccountsProductsListCall { 1207 c := &AccountsProductsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1208 c.parent = parent 1209 return c 1210} 1211 1212// Include sets the optional parameter "include": The information to be 1213// included in the response. Only sections listed here 1214// will be returned. 1215// 1216// Possible values: 1217// "UNKNOWN" 1218// "ATTRIBUTES" 1219// "ISSUES" 1220// "DESTINATION_STATUSES" 1221func (c *AccountsProductsListCall) Include(include ...string) *AccountsProductsListCall { 1222 c.urlParams_.SetMulti("include", append([]string{}, include...)) 1223 return c 1224} 1225 1226// PageSize sets the optional parameter "pageSize": Maximum number of 1227// product statuses to return in the response, used for 1228// paging. 1229func (c *AccountsProductsListCall) PageSize(pageSize int64) *AccountsProductsListCall { 1230 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1231 return c 1232} 1233 1234// PageToken sets the optional parameter "pageToken": The token returned 1235// by the previous request. 1236func (c *AccountsProductsListCall) PageToken(pageToken string) *AccountsProductsListCall { 1237 c.urlParams_.Set("pageToken", pageToken) 1238 return c 1239} 1240 1241// Fields allows partial responses to be retrieved. See 1242// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1243// for more information. 1244func (c *AccountsProductsListCall) Fields(s ...googleapi.Field) *AccountsProductsListCall { 1245 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1246 return c 1247} 1248 1249// IfNoneMatch sets the optional parameter which makes the operation 1250// fail if the object's ETag matches the given value. This is useful for 1251// getting updates only after the object has changed since the last 1252// request. Use googleapi.IsNotModified to check whether the response 1253// error from Do is the result of In-None-Match. 1254func (c *AccountsProductsListCall) IfNoneMatch(entityTag string) *AccountsProductsListCall { 1255 c.ifNoneMatch_ = entityTag 1256 return c 1257} 1258 1259// Context sets the context to be used in this call's Do method. Any 1260// pending HTTP request will be aborted if the provided context is 1261// canceled. 1262func (c *AccountsProductsListCall) Context(ctx context.Context) *AccountsProductsListCall { 1263 c.ctx_ = ctx 1264 return c 1265} 1266 1267// Header returns an http.Header that can be modified by the caller to 1268// add HTTP headers to the request. 1269func (c *AccountsProductsListCall) Header() http.Header { 1270 if c.header_ == nil { 1271 c.header_ = make(http.Header) 1272 } 1273 return c.header_ 1274} 1275 1276func (c *AccountsProductsListCall) doRequest(alt string) (*http.Response, error) { 1277 reqHeaders := make(http.Header) 1278 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216") 1279 for k, v := range c.header_ { 1280 reqHeaders[k] = v 1281 } 1282 reqHeaders.Set("User-Agent", c.s.userAgent()) 1283 if c.ifNoneMatch_ != "" { 1284 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1285 } 1286 var body io.Reader = nil 1287 c.urlParams_.Set("alt", alt) 1288 c.urlParams_.Set("prettyPrint", "false") 1289 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/products") 1290 urls += "?" + c.urlParams_.Encode() 1291 req, err := http.NewRequest("GET", urls, body) 1292 if err != nil { 1293 return nil, err 1294 } 1295 req.Header = reqHeaders 1296 googleapi.Expand(req.URL, map[string]string{ 1297 "parent": c.parent, 1298 }) 1299 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1300} 1301 1302// Do executes the "manufacturers.accounts.products.list" call. 1303// Exactly one of *ListProductsResponse or error will be non-nil. Any 1304// non-2xx status code is an error. Response headers are in either 1305// *ListProductsResponse.ServerResponse.Header or (if a response was 1306// returned at all) in error.(*googleapi.Error).Header. Use 1307// googleapi.IsNotModified to check whether the returned error was 1308// because http.StatusNotModified was returned. 1309func (c *AccountsProductsListCall) Do(opts ...googleapi.CallOption) (*ListProductsResponse, error) { 1310 gensupport.SetOptions(c.urlParams_, opts...) 1311 res, err := c.doRequest("json") 1312 if res != nil && res.StatusCode == http.StatusNotModified { 1313 if res.Body != nil { 1314 res.Body.Close() 1315 } 1316 return nil, &googleapi.Error{ 1317 Code: res.StatusCode, 1318 Header: res.Header, 1319 } 1320 } 1321 if err != nil { 1322 return nil, err 1323 } 1324 defer googleapi.CloseBody(res) 1325 if err := googleapi.CheckResponse(res); err != nil { 1326 return nil, err 1327 } 1328 ret := &ListProductsResponse{ 1329 ServerResponse: googleapi.ServerResponse{ 1330 Header: res.Header, 1331 HTTPStatusCode: res.StatusCode, 1332 }, 1333 } 1334 target := &ret 1335 if err := gensupport.DecodeResponse(target, res); err != nil { 1336 return nil, err 1337 } 1338 return ret, nil 1339 // { 1340 // "description": "Lists all the products in a Manufacturer Center account.", 1341 // "flatPath": "v1/accounts/{accountsId}/products", 1342 // "httpMethod": "GET", 1343 // "id": "manufacturers.accounts.products.list", 1344 // "parameterOrder": [ 1345 // "parent" 1346 // ], 1347 // "parameters": { 1348 // "include": { 1349 // "description": "The information to be included in the response. Only sections listed here\nwill be returned.", 1350 // "enum": [ 1351 // "UNKNOWN", 1352 // "ATTRIBUTES", 1353 // "ISSUES", 1354 // "DESTINATION_STATUSES" 1355 // ], 1356 // "location": "query", 1357 // "repeated": true, 1358 // "type": "string" 1359 // }, 1360 // "pageSize": { 1361 // "description": "Maximum number of product statuses to return in the response, used for\npaging.", 1362 // "format": "int32", 1363 // "location": "query", 1364 // "type": "integer" 1365 // }, 1366 // "pageToken": { 1367 // "description": "The token returned by the previous request.", 1368 // "location": "query", 1369 // "type": "string" 1370 // }, 1371 // "parent": { 1372 // "description": "Parent ID in the format `accounts/{account_id}`.\n\n`account_id` - The ID of the Manufacturer Center account.", 1373 // "location": "path", 1374 // "pattern": "^accounts/[^/]+$", 1375 // "required": true, 1376 // "type": "string" 1377 // } 1378 // }, 1379 // "path": "v1/{+parent}/products", 1380 // "response": { 1381 // "$ref": "ListProductsResponse" 1382 // }, 1383 // "scopes": [ 1384 // "https://www.googleapis.com/auth/manufacturercenter" 1385 // ] 1386 // } 1387 1388} 1389 1390// Pages invokes f for each page of results. 1391// A non-nil error returned from f will halt the iteration. 1392// The provided context supersedes any context provided to the Context method. 1393func (c *AccountsProductsListCall) Pages(ctx context.Context, f func(*ListProductsResponse) error) error { 1394 c.ctx_ = ctx 1395 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1396 for { 1397 x, err := c.Do() 1398 if err != nil { 1399 return err 1400 } 1401 if err := f(x); err != nil { 1402 return err 1403 } 1404 if x.NextPageToken == "" { 1405 return nil 1406 } 1407 c.PageToken(x.NextPageToken) 1408 } 1409} 1410 1411// method id "manufacturers.accounts.products.update": 1412 1413type AccountsProductsUpdateCall struct { 1414 s *Service 1415 parent string 1416 name string 1417 attributes *Attributes 1418 urlParams_ gensupport.URLParams 1419 ctx_ context.Context 1420 header_ http.Header 1421} 1422 1423// Update: Inserts or updates the attributes of the product in a 1424// Manufacturer Center 1425// account. 1426// 1427// Creates a product with the provided attributes. If the product 1428// already 1429// exists, then all attributes are replaced with the new ones. The 1430// checks at 1431// upload time are minimal. All required attributes need to be present 1432// for a 1433// product to be valid. Issues may show up later after the API has 1434// accepted a 1435// new upload for a product and it is possible to overwrite an existing 1436// valid 1437// product with an invalid product. To detect this, you should retrieve 1438// the 1439// product and check it for issues once the new version is 1440// available. 1441// 1442// Uploaded attributes first need to be processed before they can 1443// be 1444// retrieved. Until then, new products will be unavailable, and 1445// retrieval 1446// of previously uploaded products will return the original state of 1447// the 1448// product. 1449func (r *AccountsProductsService) Update(parent string, name string, attributes *Attributes) *AccountsProductsUpdateCall { 1450 c := &AccountsProductsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1451 c.parent = parent 1452 c.name = name 1453 c.attributes = attributes 1454 return c 1455} 1456 1457// Fields allows partial responses to be retrieved. See 1458// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1459// for more information. 1460func (c *AccountsProductsUpdateCall) Fields(s ...googleapi.Field) *AccountsProductsUpdateCall { 1461 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1462 return c 1463} 1464 1465// Context sets the context to be used in this call's Do method. Any 1466// pending HTTP request will be aborted if the provided context is 1467// canceled. 1468func (c *AccountsProductsUpdateCall) Context(ctx context.Context) *AccountsProductsUpdateCall { 1469 c.ctx_ = ctx 1470 return c 1471} 1472 1473// Header returns an http.Header that can be modified by the caller to 1474// add HTTP headers to the request. 1475func (c *AccountsProductsUpdateCall) Header() http.Header { 1476 if c.header_ == nil { 1477 c.header_ = make(http.Header) 1478 } 1479 return c.header_ 1480} 1481 1482func (c *AccountsProductsUpdateCall) doRequest(alt string) (*http.Response, error) { 1483 reqHeaders := make(http.Header) 1484 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216") 1485 for k, v := range c.header_ { 1486 reqHeaders[k] = v 1487 } 1488 reqHeaders.Set("User-Agent", c.s.userAgent()) 1489 var body io.Reader = nil 1490 body, err := googleapi.WithoutDataWrapper.JSONReader(c.attributes) 1491 if err != nil { 1492 return nil, err 1493 } 1494 reqHeaders.Set("Content-Type", "application/json") 1495 c.urlParams_.Set("alt", alt) 1496 c.urlParams_.Set("prettyPrint", "false") 1497 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/products/{+name}") 1498 urls += "?" + c.urlParams_.Encode() 1499 req, err := http.NewRequest("PUT", urls, body) 1500 if err != nil { 1501 return nil, err 1502 } 1503 req.Header = reqHeaders 1504 googleapi.Expand(req.URL, map[string]string{ 1505 "parent": c.parent, 1506 "name": c.name, 1507 }) 1508 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1509} 1510 1511// Do executes the "manufacturers.accounts.products.update" call. 1512// Exactly one of *Empty or error will be non-nil. Any non-2xx status 1513// code is an error. Response headers are in either 1514// *Empty.ServerResponse.Header or (if a response was returned at all) 1515// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1516// check whether the returned error was because http.StatusNotModified 1517// was returned. 1518func (c *AccountsProductsUpdateCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 1519 gensupport.SetOptions(c.urlParams_, opts...) 1520 res, err := c.doRequest("json") 1521 if res != nil && res.StatusCode == http.StatusNotModified { 1522 if res.Body != nil { 1523 res.Body.Close() 1524 } 1525 return nil, &googleapi.Error{ 1526 Code: res.StatusCode, 1527 Header: res.Header, 1528 } 1529 } 1530 if err != nil { 1531 return nil, err 1532 } 1533 defer googleapi.CloseBody(res) 1534 if err := googleapi.CheckResponse(res); err != nil { 1535 return nil, err 1536 } 1537 ret := &Empty{ 1538 ServerResponse: googleapi.ServerResponse{ 1539 Header: res.Header, 1540 HTTPStatusCode: res.StatusCode, 1541 }, 1542 } 1543 target := &ret 1544 if err := gensupport.DecodeResponse(target, res); err != nil { 1545 return nil, err 1546 } 1547 return ret, nil 1548 // { 1549 // "description": "Inserts or updates the attributes of the product in a Manufacturer Center\naccount.\n\nCreates a product with the provided attributes. If the product already\nexists, then all attributes are replaced with the new ones. The checks at\nupload time are minimal. All required attributes need to be present for a\nproduct to be valid. Issues may show up later after the API has accepted a\nnew upload for a product and it is possible to overwrite an existing valid\nproduct with an invalid product. To detect this, you should retrieve the\nproduct and check it for issues once the new version is available.\n\nUploaded attributes first need to be processed before they can be\nretrieved. Until then, new products will be unavailable, and retrieval\nof previously uploaded products will return the original state of the\nproduct.", 1550 // "flatPath": "v1/accounts/{accountsId}/products/{productsId}", 1551 // "httpMethod": "PUT", 1552 // "id": "manufacturers.accounts.products.update", 1553 // "parameterOrder": [ 1554 // "parent", 1555 // "name" 1556 // ], 1557 // "parameters": { 1558 // "name": { 1559 // "description": "Name in the format `{target_country}:{content_language}:{product_id}`.\n\n`target_country` - The target country of the product as a CLDR territory\n code (for example, US).\n\n`content_language` - The content language of the product as a two-letter\n ISO 639-1 language code (for example, en).\n\n`product_id` - The ID of the product. For more information, see\n https://support.google.com/manufacturers/answer/6124116#id.", 1560 // "location": "path", 1561 // "pattern": "^[^/]+$", 1562 // "required": true, 1563 // "type": "string" 1564 // }, 1565 // "parent": { 1566 // "description": "Parent ID in the format `accounts/{account_id}`.\n\n`account_id` - The ID of the Manufacturer Center account.", 1567 // "location": "path", 1568 // "pattern": "^accounts/[^/]+$", 1569 // "required": true, 1570 // "type": "string" 1571 // } 1572 // }, 1573 // "path": "v1/{+parent}/products/{+name}", 1574 // "request": { 1575 // "$ref": "Attributes" 1576 // }, 1577 // "response": { 1578 // "$ref": "Empty" 1579 // }, 1580 // "scopes": [ 1581 // "https://www.googleapis.com/auth/manufacturercenter" 1582 // ] 1583 // } 1584 1585} 1586