You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1582 lines
56 KiB

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