1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service\ManufacturerCenter\Resource;
19
20use Google\Service\ManufacturerCenter\Attributes;
21use Google\Service\ManufacturerCenter\ListProductsResponse;
22use Google\Service\ManufacturerCenter\ManufacturersEmpty;
23use Google\Service\ManufacturerCenter\Product;
24
25/**
26 * The "products" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $manufacturersService = new Google\Service\ManufacturerCenter(...);
30 *   $products = $manufacturersService->products;
31 *  </code>
32 */
33class AccountsProducts extends \Google\Service\Resource
34{
35  /**
36   * Deletes the product from a Manufacturer Center account. (products.delete)
37   *
38   * @param string $parent Parent ID in the format `accounts/{account_id}`.
39   * `account_id` - The ID of the Manufacturer Center account.
40   * @param string $name Name in the format
41   * `{target_country}:{content_language}:{product_id}`. `target_country` - The
42   * target country of the product as a CLDR territory code (for example, US).
43   * `content_language` - The content language of the product as a two-letter ISO
44   * 639-1 language code (for example, en). `product_id` - The ID of the product.
45   * For more information, see
46   * https://support.google.com/manufacturers/answer/6124116#id.
47   * @param array $optParams Optional parameters.
48   * @return ManufacturersEmpty
49   */
50  public function delete($parent, $name, $optParams = [])
51  {
52    $params = ['parent' => $parent, 'name' => $name];
53    $params = array_merge($params, $optParams);
54    return $this->call('delete', [$params], ManufacturersEmpty::class);
55  }
56  /**
57   * Gets the product from a Manufacturer Center account, including product
58   * issues. A recently updated product takes around 15 minutes to process.
59   * Changes are only visible after it has been processed. While some issues may
60   * be available once the product has been processed, other issues may take days
61   * to appear. (products.get)
62   *
63   * @param string $parent Parent ID in the format `accounts/{account_id}`.
64   * `account_id` - The ID of the Manufacturer Center account.
65   * @param string $name Name in the format
66   * `{target_country}:{content_language}:{product_id}`. `target_country` - The
67   * target country of the product as a CLDR territory code (for example, US).
68   * `content_language` - The content language of the product as a two-letter ISO
69   * 639-1 language code (for example, en). `product_id` - The ID of the product.
70   * For more information, see
71   * https://support.google.com/manufacturers/answer/6124116#id.
72   * @param array $optParams Optional parameters.
73   *
74   * @opt_param string include The information to be included in the response.
75   * Only sections listed here will be returned.
76   * @return Product
77   */
78  public function get($parent, $name, $optParams = [])
79  {
80    $params = ['parent' => $parent, 'name' => $name];
81    $params = array_merge($params, $optParams);
82    return $this->call('get', [$params], Product::class);
83  }
84  /**
85   * Lists all the products in a Manufacturer Center account.
86   * (products.listAccountsProducts)
87   *
88   * @param string $parent Parent ID in the format `accounts/{account_id}`.
89   * `account_id` - The ID of the Manufacturer Center account.
90   * @param array $optParams Optional parameters.
91   *
92   * @opt_param string include The information to be included in the response.
93   * Only sections listed here will be returned.
94   * @opt_param int pageSize Maximum number of product statuses to return in the
95   * response, used for paging.
96   * @opt_param string pageToken The token returned by the previous request.
97   * @return ListProductsResponse
98   */
99  public function listAccountsProducts($parent, $optParams = [])
100  {
101    $params = ['parent' => $parent];
102    $params = array_merge($params, $optParams);
103    return $this->call('list', [$params], ListProductsResponse::class);
104  }
105  /**
106   * Inserts or updates the attributes of the product in a Manufacturer Center
107   * account. Creates a product with the provided attributes. If the product
108   * already exists, then all attributes are replaced with the new ones. The
109   * checks at upload time are minimal. All required attributes need to be present
110   * for a product to be valid. Issues may show up later after the API has
111   * accepted a new upload for a product and it is possible to overwrite an
112   * existing valid product with an invalid product. To detect this, you should
113   * retrieve the product and check it for issues once the new version is
114   * available. Uploaded attributes first need to be processed before they can be
115   * retrieved. Until then, new products will be unavailable, and retrieval of
116   * previously uploaded products will return the original state of the product.
117   * (products.update)
118   *
119   * @param string $parent Parent ID in the format `accounts/{account_id}`.
120   * `account_id` - The ID of the Manufacturer Center account.
121   * @param string $name Name in the format
122   * `{target_country}:{content_language}:{product_id}`. `target_country` - The
123   * target country of the product as a CLDR territory code (for example, US).
124   * `content_language` - The content language of the product as a two-letter ISO
125   * 639-1 language code (for example, en). `product_id` - The ID of the product.
126   * For more information, see
127   * https://support.google.com/manufacturers/answer/6124116#id.
128   * @param Attributes $postBody
129   * @param array $optParams Optional parameters.
130   * @return ManufacturersEmpty
131   */
132  public function update($parent, $name, Attributes $postBody, $optParams = [])
133  {
134    $params = ['parent' => $parent, 'name' => $name, 'postBody' => $postBody];
135    $params = array_merge($params, $optParams);
136    return $this->call('update', [$params], ManufacturersEmpty::class);
137  }
138}
139
140// Adding a class alias for backwards compatibility with the previous class name.
141class_alias(AccountsProducts::class, 'Google_Service_ManufacturerCenter_Resource_AccountsProducts');
142