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