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\AccountLabel;
21use Google\Service\ShoppingContent\ListAccountLabelsResponse;
22
23/**
24 * The "labels" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $contentService = new Google\Service\ShoppingContent(...);
28 *   $labels = $contentService->labels;
29 *  </code>
30 */
31class AccountsLabels extends \Google\Service\Resource
32{
33  /**
34   * Creates a new label, not assigned to any account. (labels.create)
35   *
36   * @param string $accountId Required. The id of the account this label belongs
37   * to.
38   * @param AccountLabel $postBody
39   * @param array $optParams Optional parameters.
40   * @return AccountLabel
41   */
42  public function create($accountId, AccountLabel $postBody, $optParams = [])
43  {
44    $params = ['accountId' => $accountId, 'postBody' => $postBody];
45    $params = array_merge($params, $optParams);
46    return $this->call('create', [$params], AccountLabel::class);
47  }
48  /**
49   * Deletes a label and removes it from all accounts to which it was assigned.
50   * (labels.delete)
51   *
52   * @param string $accountId Required. The id of the account that owns the label.
53   * @param string $labelId Required. The id of the label to delete.
54   * @param array $optParams Optional parameters.
55   */
56  public function delete($accountId, $labelId, $optParams = [])
57  {
58    $params = ['accountId' => $accountId, 'labelId' => $labelId];
59    $params = array_merge($params, $optParams);
60    return $this->call('delete', [$params]);
61  }
62  /**
63   * Lists the labels assigned to an account. (labels.listAccountsLabels)
64   *
65   * @param string $accountId Required. The account id for whose labels are to be
66   * listed.
67   * @param array $optParams Optional parameters.
68   *
69   * @opt_param int pageSize The maximum number of labels to return. The service
70   * may return fewer than this value. If unspecified, at most 50 labels will be
71   * returned. The maximum value is 1000; values above 1000 will be coerced to
72   * 1000.
73   * @opt_param string pageToken A page token, received from a previous
74   * `ListAccountLabels` call. Provide this to retrieve the subsequent page. When
75   * paginating, all other parameters provided to `ListAccountLabels` must match
76   * the call that provided the page token.
77   * @return ListAccountLabelsResponse
78   */
79  public function listAccountsLabels($accountId, $optParams = [])
80  {
81    $params = ['accountId' => $accountId];
82    $params = array_merge($params, $optParams);
83    return $this->call('list', [$params], ListAccountLabelsResponse::class);
84  }
85  /**
86   * Updates a label. (labels.patch)
87   *
88   * @param string $accountId Required. The id of the account this label belongs
89   * to.
90   * @param string $labelId Required. The id of the label to update.
91   * @param AccountLabel $postBody
92   * @param array $optParams Optional parameters.
93   * @return AccountLabel
94   */
95  public function patch($accountId, $labelId, AccountLabel $postBody, $optParams = [])
96  {
97    $params = ['accountId' => $accountId, 'labelId' => $labelId, 'postBody' => $postBody];
98    $params = array_merge($params, $optParams);
99    return $this->call('patch', [$params], AccountLabel::class);
100  }
101}
102
103// Adding a class alias for backwards compatibility with the previous class name.
104class_alias(AccountsLabels::class, 'Google_Service_ShoppingContent_Resource_AccountsLabels');
105