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\Tasks\Resource;
19
20use Google\Service\Tasks\Task;
21use 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 */
31class 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   */
41  public function clear($tasklist, $optParams = [])
42  {
43    $params = ['tasklist' => $tasklist];
44    $params = array_merge($params, $optParams);
45    return $this->call('clear', [$params]);
46  }
47  /**
48   * Deletes the specified task from the task list. (tasks.delete)
49   *
50   * @param string $tasklist Task list identifier.
51   * @param string $task Task identifier.
52   * @param array $optParams Optional parameters.
53   */
54  public function delete($tasklist, $task, $optParams = [])
55  {
56    $params = ['tasklist' => $tasklist, 'task' => $task];
57    $params = array_merge($params, $optParams);
58    return $this->call('delete', [$params]);
59  }
60  /**
61   * Returns the specified task. (tasks.get)
62   *
63   * @param string $tasklist Task list identifier.
64   * @param string $task Task identifier.
65   * @param array $optParams Optional parameters.
66   * @return Task
67   */
68  public function get($tasklist, $task, $optParams = [])
69  {
70    $params = ['tasklist' => $tasklist, 'task' => $task];
71    $params = array_merge($params, $optParams);
72    return $this->call('get', [$params], Task::class);
73  }
74  /**
75   * Creates a new task on the specified task list. (tasks.insert)
76   *
77   * @param string $tasklist Task list identifier.
78   * @param Task $postBody
79   * @param array $optParams Optional parameters.
80   *
81   * @opt_param string parent Parent task identifier. If the task is created at
82   * the top level, this parameter is omitted. Optional.
83   * @opt_param string previous Previous sibling task identifier. If the task is
84   * created at the first position among its siblings, this parameter is omitted.
85   * Optional.
86   * @return Task
87   */
88  public function insert($tasklist, Task $postBody, $optParams = [])
89  {
90    $params = ['tasklist' => $tasklist, 'postBody' => $postBody];
91    $params = array_merge($params, $optParams);
92    return $this->call('insert', [$params], Task::class);
93  }
94  /**
95   * Returns all tasks in the specified task list. (tasks.listTasks)
96   *
97   * @param string $tasklist Task list identifier.
98   * @param array $optParams Optional parameters.
99   *
100   * @opt_param string completedMax Upper bound for a task's completion date (as a
101   * RFC 3339 timestamp) to filter by. Optional. The default is not to filter by
102   * completion date.
103   * @opt_param string completedMin Lower bound for a task's completion date (as a
104   * RFC 3339 timestamp) to filter by. Optional. The default is not to filter by
105   * completion date.
106   * @opt_param string dueMax Upper bound for a task's due date (as a RFC 3339
107   * timestamp) to filter by. Optional. The default is not to filter by due date.
108   * @opt_param string dueMin Lower bound for a task's due date (as a RFC 3339
109   * timestamp) to filter by. Optional. The default is not to filter by due date.
110   * @opt_param int maxResults Maximum number of task lists returned on one page.
111   * Optional. The default is 20 (max allowed: 100).
112   * @opt_param string pageToken Token specifying the result page to return.
113   * Optional.
114   * @opt_param bool showCompleted Flag indicating whether completed tasks are
115   * returned in the result. Optional. The default is True. Note that showHidden
116   * must also be True to show tasks completed in first party clients, such as the
117   * web UI and Google's mobile apps.
118   * @opt_param bool showDeleted Flag indicating whether deleted tasks are
119   * returned in the result. Optional. The default is False.
120   * @opt_param bool showHidden Flag indicating whether hidden tasks are returned
121   * in the result. Optional. The default is False.
122   * @opt_param string updatedMin Lower bound for a task's last modification time
123   * (as a RFC 3339 timestamp) to filter by. Optional. The default is not to
124   * filter by last modification time.
125   * @return TasksModel
126   */
127  public function listTasks($tasklist, $optParams = [])
128  {
129    $params = ['tasklist' => $tasklist];
130    $params = array_merge($params, $optParams);
131    return $this->call('list', [$params], TasksModel::class);
132  }
133  /**
134   * Moves the specified task to another position in the task list. This can
135   * include putting it as a child task under a new parent and/or move it to a
136   * different position among its sibling tasks. (tasks.move)
137   *
138   * @param string $tasklist Task list identifier.
139   * @param string $task Task identifier.
140   * @param array $optParams Optional parameters.
141   *
142   * @opt_param string parent New parent task identifier. If the task is moved to
143   * the top level, this parameter is omitted. Optional.
144   * @opt_param string previous New previous sibling task identifier. If the task
145   * is moved to the first position among its siblings, this parameter is omitted.
146   * Optional.
147   * @return Task
148   */
149  public function move($tasklist, $task, $optParams = [])
150  {
151    $params = ['tasklist' => $tasklist, 'task' => $task];
152    $params = array_merge($params, $optParams);
153    return $this->call('move', [$params], Task::class);
154  }
155  /**
156   * Updates the specified task. This method supports patch semantics.
157   * (tasks.patch)
158   *
159   * @param string $tasklist Task list identifier.
160   * @param string $task Task identifier.
161   * @param Task $postBody
162   * @param array $optParams Optional parameters.
163   * @return Task
164   */
165  public function patch($tasklist, $task, Task $postBody, $optParams = [])
166  {
167    $params = ['tasklist' => $tasklist, 'task' => $task, 'postBody' => $postBody];
168    $params = array_merge($params, $optParams);
169    return $this->call('patch', [$params], Task::class);
170  }
171  /**
172   * Updates the specified task. (tasks.update)
173   *
174   * @param string $tasklist Task list identifier.
175   * @param string $task Task identifier.
176   * @param Task $postBody
177   * @param array $optParams Optional parameters.
178   * @return Task
179   */
180  public function update($tasklist, $task, Task $postBody, $optParams = [])
181  {
182    $params = ['tasklist' => $tasklist, 'task' => $task, 'postBody' => $postBody];
183    $params = array_merge($params, $optParams);
184    return $this->call('update', [$params], Task::class);
185  }
186}
187
188// Adding a class alias for backwards compatibility with the previous class name.
189class_alias(Tasks::class, 'Google_Service_Tasks_Resource_Tasks');
190