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