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\Gmail\Resource;
19
20use Google\Service\Gmail\Label;
21use Google\Service\Gmail\ListLabelsResponse;
22
23/**
24 * The "labels" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $gmailService = new Google\Service\Gmail(...);
28 *   $labels = $gmailService->labels;
29 *  </code>
30 */
31class UsersLabels extends \Google\Service\Resource
32{
33  /**
34   * Creates a new label. (labels.create)
35   *
36   * @param string $userId The user's email address. The special value `me` can be
37   * used to indicate the authenticated user.
38   * @param Label $postBody
39   * @param array $optParams Optional parameters.
40   * @return Label
41   */
42  public function create($userId, Label $postBody, $optParams = [])
43  {
44    $params = ['userId' => $userId, 'postBody' => $postBody];
45    $params = array_merge($params, $optParams);
46    return $this->call('create', [$params], Label::class);
47  }
48  /**
49   * Immediately and permanently deletes the specified label and removes it from
50   * any messages and threads that it is applied to. (labels.delete)
51   *
52   * @param string $userId The user's email address. The special value `me` can be
53   * used to indicate the authenticated user.
54   * @param string $id The ID of the label to delete.
55   * @param array $optParams Optional parameters.
56   */
57  public function delete($userId, $id, $optParams = [])
58  {
59    $params = ['userId' => $userId, 'id' => $id];
60    $params = array_merge($params, $optParams);
61    return $this->call('delete', [$params]);
62  }
63  /**
64   * Gets the specified label. (labels.get)
65   *
66   * @param string $userId The user's email address. The special value `me` can be
67   * used to indicate the authenticated user.
68   * @param string $id The ID of the label to retrieve.
69   * @param array $optParams Optional parameters.
70   * @return Label
71   */
72  public function get($userId, $id, $optParams = [])
73  {
74    $params = ['userId' => $userId, 'id' => $id];
75    $params = array_merge($params, $optParams);
76    return $this->call('get', [$params], Label::class);
77  }
78  /**
79   * Lists all labels in the user's mailbox. (labels.listUsersLabels)
80   *
81   * @param string $userId The user's email address. The special value `me` can be
82   * used to indicate the authenticated user.
83   * @param array $optParams Optional parameters.
84   * @return ListLabelsResponse
85   */
86  public function listUsersLabels($userId, $optParams = [])
87  {
88    $params = ['userId' => $userId];
89    $params = array_merge($params, $optParams);
90    return $this->call('list', [$params], ListLabelsResponse::class);
91  }
92  /**
93   * Patch the specified label. (labels.patch)
94   *
95   * @param string $userId The user's email address. The special value `me` can be
96   * used to indicate the authenticated user.
97   * @param string $id The ID of the label to update.
98   * @param Label $postBody
99   * @param array $optParams Optional parameters.
100   * @return Label
101   */
102  public function patch($userId, $id, Label $postBody, $optParams = [])
103  {
104    $params = ['userId' => $userId, 'id' => $id, 'postBody' => $postBody];
105    $params = array_merge($params, $optParams);
106    return $this->call('patch', [$params], Label::class);
107  }
108  /**
109   * Updates the specified label. (labels.update)
110   *
111   * @param string $userId The user's email address. The special value `me` can be
112   * used to indicate the authenticated user.
113   * @param string $id The ID of the label to update.
114   * @param Label $postBody
115   * @param array $optParams Optional parameters.
116   * @return Label
117   */
118  public function update($userId, $id, Label $postBody, $optParams = [])
119  {
120    $params = ['userId' => $userId, 'id' => $id, 'postBody' => $postBody];
121    $params = array_merge($params, $optParams);
122    return $this->call('update', [$params], Label::class);
123  }
124}
125
126// Adding a class alias for backwards compatibility with the previous class name.
127class_alias(UsersLabels::class, 'Google_Service_Gmail_Resource_UsersLabels');
128