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\ShoppingContent\Resource;
19
20use Google\Service\ShoppingContent\ListRegionsResponse;
21use Google\Service\ShoppingContent\Region;
22
23/**
24 * The "regions" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $contentService = new Google\Service\ShoppingContent(...);
28 *   $regions = $contentService->regions;
29 *  </code>
30 */
31class Regions extends \Google\Service\Resource
32{
33  /**
34   * Creates a region definition in your Merchant Center account. (regions.create)
35   *
36   * @param string $merchantId Required. The id of the merchant for which to
37   * create region definition.
38   * @param Region $postBody
39   * @param array $optParams Optional parameters.
40   *
41   * @opt_param string regionId Required. The id of the region to create.
42   * @return Region
43   */
44  public function create($merchantId, Region $postBody, $optParams = [])
45  {
46    $params = ['merchantId' => $merchantId, 'postBody' => $postBody];
47    $params = array_merge($params, $optParams);
48    return $this->call('create', [$params], Region::class);
49  }
50  /**
51   * Deletes a region definition from your Merchant Center account.
52   * (regions.delete)
53   *
54   * @param string $merchantId Required. The id of the merchant for which to
55   * delete region definition.
56   * @param string $regionId Required. The id of the region to delete.
57   * @param array $optParams Optional parameters.
58   */
59  public function delete($merchantId, $regionId, $optParams = [])
60  {
61    $params = ['merchantId' => $merchantId, 'regionId' => $regionId];
62    $params = array_merge($params, $optParams);
63    return $this->call('delete', [$params]);
64  }
65  /**
66   * Retrieves a region defined in your Merchant Center account. (regions.get)
67   *
68   * @param string $merchantId Required. The id of the merchant for which to
69   * retrieve region definition.
70   * @param string $regionId Required. The id of the region to retrieve.
71   * @param array $optParams Optional parameters.
72   * @return Region
73   */
74  public function get($merchantId, $regionId, $optParams = [])
75  {
76    $params = ['merchantId' => $merchantId, 'regionId' => $regionId];
77    $params = array_merge($params, $optParams);
78    return $this->call('get', [$params], Region::class);
79  }
80  /**
81   * Lists the regions in your Merchant Center account. (regions.listRegions)
82   *
83   * @param string $merchantId Required. The id of the merchant for which to list
84   * region definitions.
85   * @param array $optParams Optional parameters.
86   *
87   * @opt_param int pageSize The maximum number of regions to return. The service
88   * may return fewer than this value. If unspecified, at most 50 rules will be
89   * returned. The maximum value is 1000; values above 1000 will be coerced to
90   * 1000.
91   * @opt_param string pageToken A page token, received from a previous
92   * `ListRegions` call. Provide this to retrieve the subsequent page. When
93   * paginating, all other parameters provided to `ListRegions` must match the
94   * call that provided the page token.
95   * @return ListRegionsResponse
96   */
97  public function listRegions($merchantId, $optParams = [])
98  {
99    $params = ['merchantId' => $merchantId];
100    $params = array_merge($params, $optParams);
101    return $this->call('list', [$params], ListRegionsResponse::class);
102  }
103  /**
104   * Updates a region definition in your Merchant Center account. (regions.patch)
105   *
106   * @param string $merchantId Required. The id of the merchant for which to
107   * update region definition.
108   * @param string $regionId Required. The id of the region to update.
109   * @param Region $postBody
110   * @param array $optParams Optional parameters.
111   *
112   * @opt_param string updateMask Optional. The comma-separated field mask
113   * indicating the fields to update. Example:
114   * `"displayName,postalCodeArea.regionCode"`.
115   * @return Region
116   */
117  public function patch($merchantId, $regionId, Region $postBody, $optParams = [])
118  {
119    $params = ['merchantId' => $merchantId, 'regionId' => $regionId, 'postBody' => $postBody];
120    $params = array_merge($params, $optParams);
121    return $this->call('patch', [$params], Region::class);
122  }
123}
124
125// Adding a class alias for backwards compatibility with the previous class name.
126class_alias(Regions::class, 'Google_Service_ShoppingContent_Resource_Regions');
127