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