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