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\ListRepricingRulesResponse;
21use Google\Service\ShoppingContent\RepricingRule;
22
23/**
24 * The "repricingrules" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $contentService = new Google\Service\ShoppingContent(...);
28 *   $repricingrules = $contentService->repricingrules;
29 *  </code>
30 */
31class Repricingrules extends \Google\Service\Resource
32{
33  /**
34   * Creates a repricing rule for your Merchant Center account.
35   * (repricingrules.create)
36   *
37   * @param string $merchantId Required. The id of the merchant who owns the
38   * repricing rule.
39   * @param RepricingRule $postBody
40   * @param array $optParams Optional parameters.
41   *
42   * @opt_param string ruleId Required. The id of the rule to create.
43   * @return RepricingRule
44   */
45  public function create($merchantId, RepricingRule $postBody, $optParams = [])
46  {
47    $params = ['merchantId' => $merchantId, 'postBody' => $postBody];
48    $params = array_merge($params, $optParams);
49    return $this->call('create', [$params], RepricingRule::class);
50  }
51  /**
52   * Deletes a repricing rule in your Merchant Center account.
53   * (repricingrules.delete)
54   *
55   * @param string $merchantId Required. The id of the merchant who owns the
56   * repricing rule.
57   * @param string $ruleId Required. The id of the rule to Delete.
58   * @param array $optParams Optional parameters.
59   */
60  public function delete($merchantId, $ruleId, $optParams = [])
61  {
62    $params = ['merchantId' => $merchantId, 'ruleId' => $ruleId];
63    $params = array_merge($params, $optParams);
64    return $this->call('delete', [$params]);
65  }
66  /**
67   * Retrieves a repricing rule from your Merchant Center account.
68   * (repricingrules.get)
69   *
70   * @param string $merchantId Required. The id of the merchant who owns the
71   * repricing rule.
72   * @param string $ruleId Required. The id of the rule to retrieve.
73   * @param array $optParams Optional parameters.
74   * @return RepricingRule
75   */
76  public function get($merchantId, $ruleId, $optParams = [])
77  {
78    $params = ['merchantId' => $merchantId, 'ruleId' => $ruleId];
79    $params = array_merge($params, $optParams);
80    return $this->call('get', [$params], RepricingRule::class);
81  }
82  /**
83   * Lists the repricing rules in your Merchant Center account.
84   * (repricingrules.listRepricingrules)
85   *
86   * @param string $merchantId Required. The id of the merchant who owns the
87   * repricing rule.
88   * @param array $optParams Optional parameters.
89   *
90   * @opt_param string countryCode [CLDR country
91   * code](http://www.unicode.org/repos/cldr/tags/latest/common/main/en.xml) (e.g.
92   * "US"), used as a filter on repricing rules.
93   * @opt_param string languageCode The two-letter ISO 639-1 language code
94   * associated with the repricing rule, used as a filter.
95   * @opt_param int pageSize The maximum number of repricing rules to return. The
96   * service may return fewer than this value. If unspecified, at most 50 rules
97   * will be returned. The maximum value is 1000; values above 1000 will be
98   * coerced to 1000.
99   * @opt_param string pageToken A page token, received from a previous
100   * `ListRepricingRules` call. Provide this to retrieve the subsequent page. When
101   * paginating, all other parameters provided to `ListRepricingRules` must match
102   * the call that provided the page token.
103   * @return ListRepricingRulesResponse
104   */
105  public function listRepricingrules($merchantId, $optParams = [])
106  {
107    $params = ['merchantId' => $merchantId];
108    $params = array_merge($params, $optParams);
109    return $this->call('list', [$params], ListRepricingRulesResponse::class);
110  }
111  /**
112   * Updates a repricing rule in your Merchant Center account. All mutable fields
113   * will be overwritten in each update request. In each update, you must provide
114   * all required mutable fields, or an error will be thrown. If you do not
115   * provide an optional field in the update request, if that field currently
116   * exists, it will be deleted from the rule. (repricingrules.patch)
117   *
118   * @param string $merchantId Required. The id of the merchant who owns the
119   * repricing rule.
120   * @param string $ruleId Required. The id of the rule to update.
121   * @param RepricingRule $postBody
122   * @param array $optParams Optional parameters.
123   * @return RepricingRule
124   */
125  public function patch($merchantId, $ruleId, RepricingRule $postBody, $optParams = [])
126  {
127    $params = ['merchantId' => $merchantId, 'ruleId' => $ruleId, 'postBody' => $postBody];
128    $params = array_merge($params, $optParams);
129    return $this->call('patch', [$params], RepricingRule::class);
130  }
131}
132
133// Adding a class alias for backwards compatibility with the previous class name.
134class_alias(Repricingrules::class, 'Google_Service_ShoppingContent_Resource_Repricingrules');
135