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