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\Account;
21use Google\Service\ShoppingContent\AccountsAuthInfoResponse;
22use Google\Service\ShoppingContent\AccountsClaimWebsiteResponse;
23use Google\Service\ShoppingContent\AccountsCustomBatchRequest;
24use Google\Service\ShoppingContent\AccountsCustomBatchResponse;
25use Google\Service\ShoppingContent\AccountsLinkRequest;
26use Google\Service\ShoppingContent\AccountsLinkResponse;
27use Google\Service\ShoppingContent\AccountsListLinksResponse;
28use Google\Service\ShoppingContent\AccountsListResponse;
29use Google\Service\ShoppingContent\AccountsUpdateLabelsRequest;
30use Google\Service\ShoppingContent\AccountsUpdateLabelsResponse;
31use Google\Service\ShoppingContent\RequestPhoneVerificationRequest;
32use Google\Service\ShoppingContent\RequestPhoneVerificationResponse;
33use Google\Service\ShoppingContent\VerifyPhoneNumberRequest;
34use Google\Service\ShoppingContent\VerifyPhoneNumberResponse;
35
36/**
37 * The "accounts" collection of methods.
38 * Typical usage is:
39 *  <code>
40 *   $contentService = new Google\Service\ShoppingContent(...);
41 *   $accounts = $contentService->accounts;
42 *  </code>
43 */
44class Accounts extends \Google\Service\Resource
45{
46  /**
47   * Returns information about the authenticated user. (accounts.authinfo)
48   *
49   * @param array $optParams Optional parameters.
50   * @return AccountsAuthInfoResponse
51   */
52  public function authinfo($optParams = [])
53  {
54    $params = [];
55    $params = array_merge($params, $optParams);
56    return $this->call('authinfo', [$params], AccountsAuthInfoResponse::class);
57  }
58  /**
59   * Claims the website of a Merchant Center sub-account. (accounts.claimwebsite)
60   *
61   * @param string $merchantId The ID of the managing account. If this parameter
62   * is not the same as accountId, then this account must be a multi-client
63   * account and `accountId` must be the ID of a sub-account of this account.
64   * @param string $accountId The ID of the account whose website is claimed.
65   * @param array $optParams Optional parameters.
66   *
67   * @opt_param bool overwrite Only available to selected merchants, for example
68   * multi-client accounts (MCAs) and their sub-accounts. When set to `True`, this
69   * option removes any existing claim on the requested website and replaces it
70   * with a claim from the account that makes the request.
71   * @return AccountsClaimWebsiteResponse
72   */
73  public function claimwebsite($merchantId, $accountId, $optParams = [])
74  {
75    $params = ['merchantId' => $merchantId, 'accountId' => $accountId];
76    $params = array_merge($params, $optParams);
77    return $this->call('claimwebsite', [$params], AccountsClaimWebsiteResponse::class);
78  }
79  /**
80   * Retrieves, inserts, updates, and deletes multiple Merchant Center
81   * (sub-)accounts in a single request. (accounts.custombatch)
82   *
83   * @param AccountsCustomBatchRequest $postBody
84   * @param array $optParams Optional parameters.
85   * @return AccountsCustomBatchResponse
86   */
87  public function custombatch(AccountsCustomBatchRequest $postBody, $optParams = [])
88  {
89    $params = ['postBody' => $postBody];
90    $params = array_merge($params, $optParams);
91    return $this->call('custombatch', [$params], AccountsCustomBatchResponse::class);
92  }
93  /**
94   * Deletes a Merchant Center sub-account. (accounts.delete)
95   *
96   * @param string $merchantId The ID of the managing account. This must be a
97   * multi-client account, and accountId must be the ID of a sub-account of this
98   * account.
99   * @param string $accountId The ID of the account.
100   * @param array $optParams Optional parameters.
101   *
102   * @opt_param bool force Option to delete sub-accounts with products. The
103   * default value is false.
104   */
105  public function delete($merchantId, $accountId, $optParams = [])
106  {
107    $params = ['merchantId' => $merchantId, 'accountId' => $accountId];
108    $params = array_merge($params, $optParams);
109    return $this->call('delete', [$params]);
110  }
111  /**
112   * Retrieves a Merchant Center account. (accounts.get)
113   *
114   * @param string $merchantId The ID of the managing account. If this parameter
115   * is not the same as accountId, then this account must be a multi-client
116   * account and `accountId` must be the ID of a sub-account of this account.
117   * @param string $accountId The ID of the account.
118   * @param array $optParams Optional parameters.
119   *
120   * @opt_param string view Controls which fields will be populated. Acceptable
121   * values are: "merchant" and "css". The default value is "merchant".
122   * @return Account
123   */
124  public function get($merchantId, $accountId, $optParams = [])
125  {
126    $params = ['merchantId' => $merchantId, 'accountId' => $accountId];
127    $params = array_merge($params, $optParams);
128    return $this->call('get', [$params], Account::class);
129  }
130  /**
131   * Creates a Merchant Center sub-account. (accounts.insert)
132   *
133   * @param string $merchantId The ID of the managing account. This must be a
134   * multi-client account.
135   * @param Account $postBody
136   * @param array $optParams Optional parameters.
137   * @return Account
138   */
139  public function insert($merchantId, Account $postBody, $optParams = [])
140  {
141    $params = ['merchantId' => $merchantId, 'postBody' => $postBody];
142    $params = array_merge($params, $optParams);
143    return $this->call('insert', [$params], Account::class);
144  }
145  /**
146   * Performs an action on a link between two Merchant Center accounts, namely
147   * accountId and linkedAccountId. (accounts.link)
148   *
149   * @param string $merchantId The ID of the managing account. If this parameter
150   * is not the same as accountId, then this account must be a multi-client
151   * account and `accountId` must be the ID of a sub-account of this account.
152   * @param string $accountId The ID of the account that should be linked.
153   * @param AccountsLinkRequest $postBody
154   * @param array $optParams Optional parameters.
155   * @return AccountsLinkResponse
156   */
157  public function link($merchantId, $accountId, AccountsLinkRequest $postBody, $optParams = [])
158  {
159    $params = ['merchantId' => $merchantId, 'accountId' => $accountId, 'postBody' => $postBody];
160    $params = array_merge($params, $optParams);
161    return $this->call('link', [$params], AccountsLinkResponse::class);
162  }
163  /**
164   * Lists the sub-accounts in your Merchant Center account.
165   * (accounts.listAccounts)
166   *
167   * @param string $merchantId The ID of the managing account. This must be a
168   * multi-client account.
169   * @param array $optParams Optional parameters.
170   *
171   * @opt_param string label If view is set to "css", only return accounts that
172   * are assigned label with given ID.
173   * @opt_param string maxResults The maximum number of accounts to return in the
174   * response, used for paging.
175   * @opt_param string name If set, only the accounts with the given name (case
176   * sensitive) will be returned.
177   * @opt_param string pageToken The token returned by the previous request.
178   * @opt_param string view Controls which fields will be populated. Acceptable
179   * values are: "merchant" and "css". The default value is "merchant".
180   * @return AccountsListResponse
181   */
182  public function listAccounts($merchantId, $optParams = [])
183  {
184    $params = ['merchantId' => $merchantId];
185    $params = array_merge($params, $optParams);
186    return $this->call('list', [$params], AccountsListResponse::class);
187  }
188  /**
189   * Returns the list of accounts linked to your Merchant Center account.
190   * (accounts.listlinks)
191   *
192   * @param string $merchantId The ID of the managing account. If this parameter
193   * is not the same as accountId, then this account must be a multi-client
194   * account and `accountId` must be the ID of a sub-account of this account.
195   * @param string $accountId The ID of the account for which to list links.
196   * @param array $optParams Optional parameters.
197   *
198   * @opt_param string maxResults The maximum number of links to return in the
199   * response, used for pagination. The minimum allowed value is 5 results per
200   * page. If provided value is lower than 5, it will be automatically increased
201   * to 5.
202   * @opt_param string pageToken The token returned by the previous request.
203   * @return AccountsListLinksResponse
204   */
205  public function listlinks($merchantId, $accountId, $optParams = [])
206  {
207    $params = ['merchantId' => $merchantId, 'accountId' => $accountId];
208    $params = array_merge($params, $optParams);
209    return $this->call('listlinks', [$params], AccountsListLinksResponse::class);
210  }
211  /**
212   * Request verification code to start phone verification.
213   * (accounts.requestphoneverification)
214   *
215   * @param string $merchantId Required. The ID of the managing account. If this
216   * parameter is not the same as accountId, then this account must be a multi-
217   * client account and accountId must be the ID of a sub-account of this account.
218   * @param string $accountId Required. The ID of the account.
219   * @param RequestPhoneVerificationRequest $postBody
220   * @param array $optParams Optional parameters.
221   * @return RequestPhoneVerificationResponse
222   */
223  public function requestphoneverification($merchantId, $accountId, RequestPhoneVerificationRequest $postBody, $optParams = [])
224  {
225    $params = ['merchantId' => $merchantId, 'accountId' => $accountId, 'postBody' => $postBody];
226    $params = array_merge($params, $optParams);
227    return $this->call('requestphoneverification', [$params], RequestPhoneVerificationResponse::class);
228  }
229  /**
230   * Updates a Merchant Center account. Any fields that are not provided are
231   * deleted from the resource. (accounts.update)
232   *
233   * @param string $merchantId The ID of the managing account. If this parameter
234   * is not the same as accountId, then this account must be a multi-client
235   * account and `accountId` must be the ID of a sub-account of this account.
236   * @param string $accountId The ID of the account.
237   * @param Account $postBody
238   * @param array $optParams Optional parameters.
239   * @return Account
240   */
241  public function update($merchantId, $accountId, Account $postBody, $optParams = [])
242  {
243    $params = ['merchantId' => $merchantId, 'accountId' => $accountId, 'postBody' => $postBody];
244    $params = array_merge($params, $optParams);
245    return $this->call('update', [$params], Account::class);
246  }
247  /**
248   * Updates labels that are assigned to the Merchant Center account by CSS user.
249   * (accounts.updatelabels)
250   *
251   * @param string $merchantId The ID of the managing account.
252   * @param string $accountId The ID of the account whose labels are updated.
253   * @param AccountsUpdateLabelsRequest $postBody
254   * @param array $optParams Optional parameters.
255   * @return AccountsUpdateLabelsResponse
256   */
257  public function updatelabels($merchantId, $accountId, AccountsUpdateLabelsRequest $postBody, $optParams = [])
258  {
259    $params = ['merchantId' => $merchantId, 'accountId' => $accountId, 'postBody' => $postBody];
260    $params = array_merge($params, $optParams);
261    return $this->call('updatelabels', [$params], AccountsUpdateLabelsResponse::class);
262  }
263  /**
264   * Validates verification code to verify phone number for the account. If
265   * successful this will overwrite the value of
266   * `accounts.businessinformation.phoneNumber`. Only verified phone number will
267   * replace an existing verified phone number. (accounts.verifyphonenumber)
268   *
269   * @param string $merchantId Required. The ID of the managing account. If this
270   * parameter is not the same as accountId, then this account must be a multi-
271   * client account and accountId must be the ID of a sub-account of this account.
272   * @param string $accountId Required. The ID of the account.
273   * @param VerifyPhoneNumberRequest $postBody
274   * @param array $optParams Optional parameters.
275   * @return VerifyPhoneNumberResponse
276   */
277  public function verifyphonenumber($merchantId, $accountId, VerifyPhoneNumberRequest $postBody, $optParams = [])
278  {
279    $params = ['merchantId' => $merchantId, 'accountId' => $accountId, 'postBody' => $postBody];
280    $params = array_merge($params, $optParams);
281    return $this->call('verifyphonenumber', [$params], VerifyPhoneNumberResponse::class);
282  }
283}
284
285// Adding a class alias for backwards compatibility with the previous class name.
286class_alias(Accounts::class, 'Google_Service_ShoppingContent_Resource_Accounts');
287