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\Tasks\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Tasks\Task;
|
---|
21 | use Google\Service\Tasks\Tasks as TasksModel;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The "tasks" collection of methods.
|
---|
25 | * Typical usage is:
|
---|
26 | * <code>
|
---|
27 | * $tasksService = new Google\Service\Tasks(...);
|
---|
28 | * $tasks = $tasksService->tasks;
|
---|
29 | * </code>
|
---|
30 | */
|
---|
31 | class Tasks extends \Google\Service\Resource
|
---|
32 | {
|
---|
33 | /**
|
---|
34 | * Clears all completed tasks from the specified task list. The affected tasks
|
---|
35 | * will be marked as 'hidden' and no longer be returned by default when
|
---|
36 | * retrieving all tasks for a task list. (tasks.clear)
|
---|
37 | *
|
---|
38 | * @param string $tasklist Task list identifier.
|
---|
39 | * @param array $optParams Optional parameters.
|
---|
40 | * @throws \Google\Service\Exception
|
---|
41 | */
|
---|
42 | public function clear($tasklist, $optParams = [])
|
---|
43 | {
|
---|
44 | $params = ['tasklist' => $tasklist];
|
---|
45 | $params = array_merge($params, $optParams);
|
---|
46 | return $this->call('clear', [$params]);
|
---|
47 | }
|
---|
48 | /**
|
---|
49 | * Deletes the specified task from the task list. If the task is assigned, both
|
---|
50 | * the assigned task and the original task (in Docs, Chat Spaces) are deleted.
|
---|
51 | * To delete the assigned task only, navigate to the assignment surface and
|
---|
52 | * unassign the task from there. (tasks.delete)
|
---|
53 | *
|
---|
54 | * @param string $tasklist Task list identifier.
|
---|
55 | * @param string $task Task identifier.
|
---|
56 | * @param array $optParams Optional parameters.
|
---|
57 | * @throws \Google\Service\Exception
|
---|
58 | */
|
---|
59 | public function delete($tasklist, $task, $optParams = [])
|
---|
60 | {
|
---|
61 | $params = ['tasklist' => $tasklist, 'task' => $task];
|
---|
62 | $params = array_merge($params, $optParams);
|
---|
63 | return $this->call('delete', [$params]);
|
---|
64 | }
|
---|
65 | /**
|
---|
66 | * Returns the specified task. (tasks.get)
|
---|
67 | *
|
---|
68 | * @param string $tasklist Task list identifier.
|
---|
69 | * @param string $task Task identifier.
|
---|
70 | * @param array $optParams Optional parameters.
|
---|
71 | * @return Task
|
---|
72 | * @throws \Google\Service\Exception
|
---|
73 | */
|
---|
74 | public function get($tasklist, $task, $optParams = [])
|
---|
75 | {
|
---|
76 | $params = ['tasklist' => $tasklist, 'task' => $task];
|
---|
77 | $params = array_merge($params, $optParams);
|
---|
78 | return $this->call('get', [$params], Task::class);
|
---|
79 | }
|
---|
80 | /**
|
---|
81 | * Creates a new task on the specified task list. Tasks assigned from Docs or
|
---|
82 | * Chat Spaces cannot be inserted from Tasks Public API; they can only be
|
---|
83 | * created by assigning them from Docs or Chat Spaces. A user can have up to
|
---|
84 | * 20,000 non-hidden tasks per list and up to 100,000 tasks in total at a time.
|
---|
85 | * (tasks.insert)
|
---|
86 | *
|
---|
87 | * @param string $tasklist Task list identifier.
|
---|
88 | * @param Task $postBody
|
---|
89 | * @param array $optParams Optional parameters.
|
---|
90 | *
|
---|
91 | * @opt_param string parent Parent task identifier. If the task is created at
|
---|
92 | * the top level, this parameter is omitted. An assigned task cannot be a parent
|
---|
93 | * task, nor can it have a parent. Setting the parent to an assigned task
|
---|
94 | * results in failure of the request. Optional.
|
---|
95 | * @opt_param string previous Previous sibling task identifier. If the task is
|
---|
96 | * created at the first position among its siblings, this parameter is omitted.
|
---|
97 | * Optional.
|
---|
98 | * @return Task
|
---|
99 | * @throws \Google\Service\Exception
|
---|
100 | */
|
---|
101 | public function insert($tasklist, Task $postBody, $optParams = [])
|
---|
102 | {
|
---|
103 | $params = ['tasklist' => $tasklist, 'postBody' => $postBody];
|
---|
104 | $params = array_merge($params, $optParams);
|
---|
105 | return $this->call('insert', [$params], Task::class);
|
---|
106 | }
|
---|
107 | /**
|
---|
108 | * Returns all tasks in the specified task list. Does not return assigned tasks
|
---|
109 | * be default (from Docs, Chat Spaces). A user can have up to 20,000 non-hidden
|
---|
110 | * tasks per list and up to 100,000 tasks in total at a time. (tasks.listTasks)
|
---|
111 | *
|
---|
112 | * @param string $tasklist Task list identifier.
|
---|
113 | * @param array $optParams Optional parameters.
|
---|
114 | *
|
---|
115 | * @opt_param string completedMax Upper bound for a task's completion date (as a
|
---|
116 | * RFC 3339 timestamp) to filter by. Optional. The default is not to filter by
|
---|
117 | * completion date.
|
---|
118 | * @opt_param string completedMin Lower bound for a task's completion date (as a
|
---|
119 | * RFC 3339 timestamp) to filter by. Optional. The default is not to filter by
|
---|
120 | * completion date.
|
---|
121 | * @opt_param string dueMax Upper bound for a task's due date (as a RFC 3339
|
---|
122 | * timestamp) to filter by. Optional. The default is not to filter by due date.
|
---|
123 | * @opt_param string dueMin Lower bound for a task's due date (as a RFC 3339
|
---|
124 | * timestamp) to filter by. Optional. The default is not to filter by due date.
|
---|
125 | * @opt_param int maxResults Maximum number of tasks returned on one page.
|
---|
126 | * Optional. The default is 20 (max allowed: 100).
|
---|
127 | * @opt_param string pageToken Token specifying the result page to return.
|
---|
128 | * Optional.
|
---|
129 | * @opt_param bool showAssigned Optional. Flag indicating whether tasks assigned
|
---|
130 | * to the current user are returned in the result. Optional. The default is
|
---|
131 | * False.
|
---|
132 | * @opt_param bool showCompleted Flag indicating whether completed tasks are
|
---|
133 | * returned in the result. Note that showHidden must also be True to show tasks
|
---|
134 | * completed in first party clients, such as the web UI and Google's mobile
|
---|
135 | * apps. Optional. The default is True.
|
---|
136 | * @opt_param bool showDeleted Flag indicating whether deleted tasks are
|
---|
137 | * returned in the result. Optional. The default is False.
|
---|
138 | * @opt_param bool showHidden Flag indicating whether hidden tasks are returned
|
---|
139 | * in the result. Optional. The default is False.
|
---|
140 | * @opt_param string updatedMin Lower bound for a task's last modification time
|
---|
141 | * (as a RFC 3339 timestamp) to filter by. Optional. The default is not to
|
---|
142 | * filter by last modification time.
|
---|
143 | * @return TasksModel
|
---|
144 | * @throws \Google\Service\Exception
|
---|
145 | */
|
---|
146 | public function listTasks($tasklist, $optParams = [])
|
---|
147 | {
|
---|
148 | $params = ['tasklist' => $tasklist];
|
---|
149 | $params = array_merge($params, $optParams);
|
---|
150 | return $this->call('list', [$params], TasksModel::class);
|
---|
151 | }
|
---|
152 | /**
|
---|
153 | * Moves the specified task to another position in the destination task list. If
|
---|
154 | * the destination list is not specified, the task is moved within its current
|
---|
155 | * list. This can include putting it as a child task under a new parent and/or
|
---|
156 | * move it to a different position among its sibling tasks. A user can have up
|
---|
157 | * to 2,000 subtasks per task. (tasks.move)
|
---|
158 | *
|
---|
159 | * @param string $tasklist Task list identifier.
|
---|
160 | * @param string $task Task identifier.
|
---|
161 | * @param array $optParams Optional parameters.
|
---|
162 | *
|
---|
163 | * @opt_param string destinationTasklist Optional. Destination task list
|
---|
164 | * identifier. If set, the task is moved from tasklist to the
|
---|
165 | * destinationTasklist list. Otherwise the task is moved within its current
|
---|
166 | * list. Recurrent tasks cannot currently be moved between lists. Optional.
|
---|
167 | * @opt_param string parent New parent task identifier. If the task is moved to
|
---|
168 | * the top level, this parameter is omitted. Assigned tasks can not be set as
|
---|
169 | * parent task (have subtasks) or be moved under a parent task (become
|
---|
170 | * subtasks). Optional.
|
---|
171 | * @opt_param string previous New previous sibling task identifier. If the task
|
---|
172 | * is moved to the first position among its siblings, this parameter is omitted.
|
---|
173 | * Optional.
|
---|
174 | * @return Task
|
---|
175 | * @throws \Google\Service\Exception
|
---|
176 | */
|
---|
177 | public function move($tasklist, $task, $optParams = [])
|
---|
178 | {
|
---|
179 | $params = ['tasklist' => $tasklist, 'task' => $task];
|
---|
180 | $params = array_merge($params, $optParams);
|
---|
181 | return $this->call('move', [$params], Task::class);
|
---|
182 | }
|
---|
183 | /**
|
---|
184 | * Updates the specified task. This method supports patch semantics.
|
---|
185 | * (tasks.patch)
|
---|
186 | *
|
---|
187 | * @param string $tasklist Task list identifier.
|
---|
188 | * @param string $task Task identifier.
|
---|
189 | * @param Task $postBody
|
---|
190 | * @param array $optParams Optional parameters.
|
---|
191 | * @return Task
|
---|
192 | * @throws \Google\Service\Exception
|
---|
193 | */
|
---|
194 | public function patch($tasklist, $task, Task $postBody, $optParams = [])
|
---|
195 | {
|
---|
196 | $params = ['tasklist' => $tasklist, 'task' => $task, 'postBody' => $postBody];
|
---|
197 | $params = array_merge($params, $optParams);
|
---|
198 | return $this->call('patch', [$params], Task::class);
|
---|
199 | }
|
---|
200 | /**
|
---|
201 | * Updates the specified task. (tasks.update)
|
---|
202 | *
|
---|
203 | * @param string $tasklist Task list identifier.
|
---|
204 | * @param string $task Task identifier.
|
---|
205 | * @param Task $postBody
|
---|
206 | * @param array $optParams Optional parameters.
|
---|
207 | * @return Task
|
---|
208 | * @throws \Google\Service\Exception
|
---|
209 | */
|
---|
210 | public function update($tasklist, $task, Task $postBody, $optParams = [])
|
---|
211 | {
|
---|
212 | $params = ['tasklist' => $tasklist, 'task' => $task, 'postBody' => $postBody];
|
---|
213 | $params = array_merge($params, $optParams);
|
---|
214 | return $this->call('update', [$params], Task::class);
|
---|
215 | }
|
---|
216 | }
|
---|
217 |
|
---|
218 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
219 | class_alias(Tasks::class, 'Google_Service_Tasks_Resource_Tasks');
|
---|