[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\ListThreadsResponse;
|
---|
| 21 | use Google\Service\Gmail\ModifyThreadRequest;
|
---|
| 22 | use Google\Service\Gmail\Thread;
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * The "threads" collection of methods.
|
---|
| 26 | * Typical usage is:
|
---|
| 27 | * <code>
|
---|
| 28 | * $gmailService = new Google\Service\Gmail(...);
|
---|
| 29 | * $threads = $gmailService->users_threads;
|
---|
| 30 | * </code>
|
---|
| 31 | */
|
---|
| 32 | class UsersThreads extends \Google\Service\Resource
|
---|
| 33 | {
|
---|
| 34 | /**
|
---|
| 35 | * Immediately and permanently deletes the specified thread. Any messages that
|
---|
| 36 | * belong to the thread are also deleted. This operation cannot be undone.
|
---|
| 37 | * Prefer `threads.trash` instead. (threads.delete)
|
---|
| 38 | *
|
---|
| 39 | * @param string $userId The user's email address. The special value `me` can be
|
---|
| 40 | * used to indicate the authenticated user.
|
---|
| 41 | * @param string $id ID of the Thread to delete.
|
---|
| 42 | * @param array $optParams Optional parameters.
|
---|
| 43 | * @throws \Google\Service\Exception
|
---|
| 44 | */
|
---|
| 45 | public function delete($userId, $id, $optParams = [])
|
---|
| 46 | {
|
---|
| 47 | $params = ['userId' => $userId, 'id' => $id];
|
---|
| 48 | $params = array_merge($params, $optParams);
|
---|
| 49 | return $this->call('delete', [$params]);
|
---|
| 50 | }
|
---|
| 51 | /**
|
---|
| 52 | * Gets the specified thread. (threads.get)
|
---|
| 53 | *
|
---|
| 54 | * @param string $userId The user's email address. The special value `me` can be
|
---|
| 55 | * used to indicate the authenticated user.
|
---|
| 56 | * @param string $id The ID of the thread to retrieve.
|
---|
| 57 | * @param array $optParams Optional parameters.
|
---|
| 58 | *
|
---|
| 59 | * @opt_param string format The format to return the messages in.
|
---|
| 60 | * @opt_param string metadataHeaders When given and format is METADATA, only
|
---|
| 61 | * include headers specified.
|
---|
| 62 | * @return Thread
|
---|
| 63 | * @throws \Google\Service\Exception
|
---|
| 64 | */
|
---|
| 65 | public function get($userId, $id, $optParams = [])
|
---|
| 66 | {
|
---|
| 67 | $params = ['userId' => $userId, 'id' => $id];
|
---|
| 68 | $params = array_merge($params, $optParams);
|
---|
| 69 | return $this->call('get', [$params], Thread::class);
|
---|
| 70 | }
|
---|
| 71 | /**
|
---|
| 72 | * Lists the threads in the user's mailbox. (threads.listUsersThreads)
|
---|
| 73 | *
|
---|
| 74 | * @param string $userId The user's email address. The special value `me` can be
|
---|
| 75 | * used to indicate the authenticated user.
|
---|
| 76 | * @param array $optParams Optional parameters.
|
---|
| 77 | *
|
---|
| 78 | * @opt_param bool includeSpamTrash Include threads from `SPAM` and `TRASH` in
|
---|
| 79 | * the results.
|
---|
| 80 | * @opt_param string labelIds Only return threads with labels that match all of
|
---|
| 81 | * the specified label IDs.
|
---|
| 82 | * @opt_param string maxResults Maximum number of threads to return. This field
|
---|
| 83 | * defaults to 100. The maximum allowed value for this field is 500.
|
---|
| 84 | * @opt_param string pageToken Page token to retrieve a specific page of results
|
---|
| 85 | * in the list.
|
---|
| 86 | * @opt_param string q Only return threads matching the specified query.
|
---|
| 87 | * Supports the same query format as the Gmail search box. For example,
|
---|
| 88 | * `"from:someuser@example.com rfc822msgid: is:unread"`. Parameter cannot be
|
---|
| 89 | * used when accessing the api using the gmail.metadata scope.
|
---|
| 90 | * @return ListThreadsResponse
|
---|
| 91 | * @throws \Google\Service\Exception
|
---|
| 92 | */
|
---|
| 93 | public function listUsersThreads($userId, $optParams = [])
|
---|
| 94 | {
|
---|
| 95 | $params = ['userId' => $userId];
|
---|
| 96 | $params = array_merge($params, $optParams);
|
---|
| 97 | return $this->call('list', [$params], ListThreadsResponse::class);
|
---|
| 98 | }
|
---|
| 99 | /**
|
---|
| 100 | * Modifies the labels applied to the thread. This applies to all messages in
|
---|
| 101 | * the thread. (threads.modify)
|
---|
| 102 | *
|
---|
| 103 | * @param string $userId The user's email address. The special value `me` can be
|
---|
| 104 | * used to indicate the authenticated user.
|
---|
| 105 | * @param string $id The ID of the thread to modify.
|
---|
| 106 | * @param ModifyThreadRequest $postBody
|
---|
| 107 | * @param array $optParams Optional parameters.
|
---|
| 108 | * @return Thread
|
---|
| 109 | * @throws \Google\Service\Exception
|
---|
| 110 | */
|
---|
| 111 | public function modify($userId, $id, ModifyThreadRequest $postBody, $optParams = [])
|
---|
| 112 | {
|
---|
| 113 | $params = ['userId' => $userId, 'id' => $id, 'postBody' => $postBody];
|
---|
| 114 | $params = array_merge($params, $optParams);
|
---|
| 115 | return $this->call('modify', [$params], Thread::class);
|
---|
| 116 | }
|
---|
| 117 | /**
|
---|
| 118 | * Moves the specified thread to the trash. Any messages that belong to the
|
---|
| 119 | * thread are also moved to the trash. (threads.trash)
|
---|
| 120 | *
|
---|
| 121 | * @param string $userId The user's email address. The special value `me` can be
|
---|
| 122 | * used to indicate the authenticated user.
|
---|
| 123 | * @param string $id The ID of the thread to Trash.
|
---|
| 124 | * @param array $optParams Optional parameters.
|
---|
| 125 | * @return Thread
|
---|
| 126 | * @throws \Google\Service\Exception
|
---|
| 127 | */
|
---|
| 128 | public function trash($userId, $id, $optParams = [])
|
---|
| 129 | {
|
---|
| 130 | $params = ['userId' => $userId, 'id' => $id];
|
---|
| 131 | $params = array_merge($params, $optParams);
|
---|
| 132 | return $this->call('trash', [$params], Thread::class);
|
---|
| 133 | }
|
---|
| 134 | /**
|
---|
| 135 | * Removes the specified thread from the trash. Any messages that belong to the
|
---|
| 136 | * thread are also removed from the trash. (threads.untrash)
|
---|
| 137 | *
|
---|
| 138 | * @param string $userId The user's email address. The special value `me` can be
|
---|
| 139 | * used to indicate the authenticated user.
|
---|
| 140 | * @param string $id The ID of the thread to remove from Trash.
|
---|
| 141 | * @param array $optParams Optional parameters.
|
---|
| 142 | * @return Thread
|
---|
| 143 | * @throws \Google\Service\Exception
|
---|
| 144 | */
|
---|
| 145 | public function untrash($userId, $id, $optParams = [])
|
---|
| 146 | {
|
---|
| 147 | $params = ['userId' => $userId, 'id' => $id];
|
---|
| 148 | $params = array_merge($params, $optParams);
|
---|
| 149 | return $this->call('untrash', [$params], Thread::class);
|
---|
| 150 | }
|
---|
| 151 | }
|
---|
| 152 |
|
---|
| 153 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 154 | class_alias(UsersThreads::class, 'Google_Service_Gmail_Resource_UsersThreads');
|
---|