apiTasksService.php
21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
<?php
/*
* Copyright (c) 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
require_once 'service/apiModel.php';
require_once 'service/apiService.php';
require_once 'service/apiServiceRequest.php';
/**
* The "tasks" collection of methods.
* Typical usage is:
* <code>
* $tasksService = new apiTasksService(...);
* $tasks = $tasksService->tasks;
* </code>
*/
class TasksServiceResource extends apiServiceResource {
/**
* Creates a new task on the specified task list. (tasks.insert)
*
* @param string $tasklist Task list identifier.
* @param $postBody the {@link Task}
* @param array $optParams Optional parameters. Valid optional parameters are listed below.
*
* @opt_param string parent Parent task identifier. If the task is created at the top level, this parameter is omitted. Optional.
* @opt_param string previous Previous sibling task identifier. If the task is created at the first position among its siblings, this parameter is omitted. Optional.
* @return Task
*/
public function insert($tasklist, Task $postBody, $optParams = array()) {
$params = array('tasklist' => $tasklist, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
$data = $this->__call('insert', array($params));
if ($this->useObjects()) {
return new Task($data);
} else {
return $data;
}
}
/**
* Returns the specified task. (tasks.get)
*
* @param string $tasklist Task list identifier.
* @param string $task Task identifier.
* @return Task
*/
public function get($tasklist, $task) {
$params = array('tasklist' => $tasklist, 'task' => $task);
$data = $this->__call('get', array($params));
if ($this->useObjects()) {
return new Task($data);
} else {
return $data;
}
}
/**
* Clears all completed tasks from the specified task list. The affected tasks will be marked as
* 'hidden' and no longer be returned by default when retrieving all tasks for a task list.
* (tasks.clear)
*
* @param string $tasklist Task list identifier.
*/
public function clear($tasklist) {
$params = array('tasklist' => $tasklist);
$data = $this->__call('clear', array($params));
return $data;
}
/**
* Moves the specified task to another position in the task list. This can include putting it as a
* child task under a new parent and/or move it to a different position among its sibling tasks.
* (tasks.move)
*
* @param string $tasklist Task list identifier.
* @param string $task Task identifier.
* @param array $optParams Optional parameters. Valid optional parameters are listed below.
*
* @opt_param string parent New parent task identifier. If the task is moved to the top level, this parameter is omitted. Optional.
* @opt_param string previous New previous sibling task identifier. If the task is moved to the first position among its siblings, this parameter is omitted. Optional.
* @return Task
*/
public function move($tasklist, $task, $optParams = array()) {
$params = array('tasklist' => $tasklist, 'task' => $task);
$params = array_merge($params, $optParams);
$data = $this->__call('move', array($params));
if ($this->useObjects()) {
return new Task($data);
} else {
return $data;
}
}
/**
* Returns all tasks in the specified task list. (tasks.list)
*
* @param string $tasklist Task list identifier.
* @param array $optParams Optional parameters. Valid optional parameters are listed below.
*
* @opt_param string dueMax Upper bound for a task's due date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by due date.
* @opt_param bool showDeleted Flag indicating whether deleted tasks are returned in the result. Optional. The default is False.
* @opt_param string updatedMin Lower bound for a task's last modification time (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by last modification time.
* @opt_param string completedMin Lower bound for a task's completion date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by completion date.
* @opt_param string maxResults Maximum number of task lists returned on one page. Optional. The default is 100.
* @opt_param bool showCompleted Flag indicating whether completed tasks are returned in the result. Optional. The default is True.
* @opt_param string pageToken Token specifying the result page to return. Optional.
* @opt_param string completedMax Upper bound for a task's completion date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by completion date.
* @opt_param bool showHidden Flag indicating whether hidden tasks are returned in the result. Optional. The default is False.
* @opt_param string dueMin Lower bound for a task's due date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by due date.
* @return Tasks
*/
public function listTasks($tasklist, $optParams = array()) {
$params = array('tasklist' => $tasklist);
$params = array_merge($params, $optParams);
$data = $this->__call('list', array($params));
if ($this->useObjects()) {
return new Tasks($data);
} else {
return $data;
}
}
/**
* Updates the specified task. (tasks.update)
*
* @param string $tasklist Task list identifier.
* @param string $task Task identifier.
* @param $postBody the {@link Task}
* @return Task
*/
public function update($tasklist, $task, Task $postBody) {
$params = array('tasklist' => $tasklist, 'task' => $task, 'postBody' => $postBody);
$data = $this->__call('update', array($params));
if ($this->useObjects()) {
return new Task($data);
} else {
return $data;
}
}
/**
* Updates the specified task. This method supports patch semantics. (tasks.patch)
*
* @param string $tasklist Task list identifier.
* @param string $task Task identifier.
* @param $postBody the {@link Task}
* @return Task
*/
public function patch($tasklist, $task, Task $postBody) {
$params = array('tasklist' => $tasklist, 'task' => $task, 'postBody' => $postBody);
$data = $this->__call('patch', array($params));
if ($this->useObjects()) {
return new Task($data);
} else {
return $data;
}
}
/**
* Deletes the specified task from the task list. (tasks.delete)
*
* @param string $tasklist Task list identifier.
* @param string $task Task identifier.
*/
public function delete($tasklist, $task) {
$params = array('tasklist' => $tasklist, 'task' => $task);
$data = $this->__call('delete', array($params));
return $data;
}
}
/**
* The "tasklists" collection of methods.
* Typical usage is:
* <code>
* $tasksService = new apiTasksService(...);
* $tasklists = $tasksService->tasklists;
* </code>
*/
class TasklistsServiceResource extends apiServiceResource {
/**
* Creates a new task list and adds it to the authenticated user's task lists. (tasklists.insert)
*
* @param $postBody the {@link TaskList}
* @return TaskList
*/
public function insert(TaskList $postBody) {
$params = array('postBody' => $postBody);
$data = $this->__call('insert', array($params));
if ($this->useObjects()) {
return new TaskList($data);
} else {
return $data;
}
}
/**
* Returns the authenticated user's specified task list. (tasklists.get)
*
* @param string $tasklist Task list identifier.
* @return TaskList
*/
public function get($tasklist) {
$params = array('tasklist' => $tasklist);
$data = $this->__call('get', array($params));
if ($this->useObjects()) {
return new TaskList($data);
} else {
return $data;
}
}
/**
* Returns all the authenticated user's task lists. (tasklists.list)
*
* @param array $optParams Optional parameters. Valid optional parameters are listed below.
*
* @opt_param string pageToken Token specifying the result page to return. Optional.
* @opt_param string maxResults Maximum number of task lists returned on one page. Optional. The default is 100.
* @return TaskLists
*/
public function listTasklists($optParams = array()) {
$params = array();
$params = array_merge($params, $optParams);
$data = $this->__call('list', array($params));
if ($this->useObjects()) {
return new TaskLists($data);
} else {
return $data;
}
}
/**
* Updates the authenticated user's specified task list. (tasklists.update)
*
* @param string $tasklist Task list identifier.
* @param $postBody the {@link TaskList}
* @return TaskList
*/
public function update($tasklist, TaskList $postBody) {
$params = array('tasklist' => $tasklist, 'postBody' => $postBody);
$data = $this->__call('update', array($params));
if ($this->useObjects()) {
return new TaskList($data);
} else {
return $data;
}
}
/**
* Updates the authenticated user's specified task list. This method supports patch semantics.
* (tasklists.patch)
*
* @param string $tasklist Task list identifier.
* @param $postBody the {@link TaskList}
* @return TaskList
*/
public function patch($tasklist, TaskList $postBody) {
$params = array('tasklist' => $tasklist, 'postBody' => $postBody);
$data = $this->__call('patch', array($params));
if ($this->useObjects()) {
return new TaskList($data);
} else {
return $data;
}
}
/**
* Deletes the authenticated user's specified task list. (tasklists.delete)
*
* @param string $tasklist Task list identifier.
*/
public function delete($tasklist) {
$params = array('tasklist' => $tasklist);
$data = $this->__call('delete', array($params));
return $data;
}
}
/**
* Service definition for Tasks (v1).
*
* <p>
* Lets you manage your tasks and task lists.
* </p>
*
* <p>
* For more information about this service, see the
* <a href="http://code.google.com/apis/tasks/v1/using.html" target="_blank">API Documentation</a>
* </p>
*
* @author Google, Inc.
*/
class apiTasksService extends apiService {
public $tasks;
public $tasklists;
/**
* Constructs the internal representation of the Tasks service.
*
* @param apiClient apiClient
*/
public function __construct(apiClient $apiClient) {
$this->rpcPath = '/rpc';
$this->restBasePath = '/tasks/v1/';
$this->version = 'v1';
$this->serviceName = 'tasks';
$this->io = $apiClient->getIo();
$apiClient->addService($this->serviceName, $this->version);
$this->tasks = new TasksServiceResource($this, $this->serviceName, 'tasks', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}, "parent": {"type": "string", "location": "query"}, "previous": {"type": "string", "location": "query"}}, "request": {"$ref": "Task"}, "id": "tasks.tasks.insert", "httpMethod": "POST", "path": "lists/{tasklist}/tasks", "response": {"$ref": "Task"}}, "get": {"scopes": ["https://www.googleapis.com/auth/tasks", "https://www.googleapis.com/auth/tasks.readonly"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}, "task": {"required": true, "type": "string", "location": "path"}}, "id": "tasks.tasks.get", "httpMethod": "GET", "path": "lists/{tasklist}/tasks/{task}", "response": {"$ref": "Task"}}, "clear": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "POST", "path": "lists/{tasklist}/clear", "id": "tasks.tasks.clear"}, "move": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"previous": {"type": "string", "location": "query"}, "tasklist": {"required": true, "type": "string", "location": "path"}, "parent": {"type": "string", "location": "query"}, "task": {"required": true, "type": "string", "location": "path"}}, "id": "tasks.tasks.move", "httpMethod": "POST", "path": "lists/{tasklist}/tasks/{task}/move", "response": {"$ref": "Task"}}, "list": {"scopes": ["https://www.googleapis.com/auth/tasks", "https://www.googleapis.com/auth/tasks.readonly"], "parameters": {"dueMax": {"type": "string", "location": "query"}, "tasklist": {"required": true, "type": "string", "location": "path"}, "pageToken": {"type": "string", "location": "query"}, "updatedMin": {"type": "string", "location": "query"}, "completedMin": {"type": "string", "location": "query"}, "maxResults": {"format": "int64", "type": "string", "location": "query"}, "showCompleted": {"type": "boolean", "location": "query"}, "showDeleted": {"type": "boolean", "location": "query"}, "completedMax": {"type": "string", "location": "query"}, "showHidden": {"type": "boolean", "location": "query"}, "dueMin": {"type": "string", "location": "query"}}, "id": "tasks.tasks.list", "httpMethod": "GET", "path": "lists/{tasklist}/tasks", "response": {"$ref": "Tasks"}}, "update": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}, "task": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Task"}, "id": "tasks.tasks.update", "httpMethod": "PUT", "path": "lists/{tasklist}/tasks/{task}", "response": {"$ref": "Task"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}, "task": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Task"}, "id": "tasks.tasks.patch", "httpMethod": "PATCH", "path": "lists/{tasklist}/tasks/{task}", "response": {"$ref": "Task"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}, "task": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "lists/{tasklist}/tasks/{task}", "id": "tasks.tasks.delete"}}}', true));
$this->tasklists = new TasklistsServiceResource($this, $this->serviceName, 'tasklists', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/tasks"], "request": {"$ref": "TaskList"}, "response": {"$ref": "TaskList"}, "httpMethod": "POST", "path": "users/@me/lists", "id": "tasks.tasklists.insert"}, "get": {"scopes": ["https://www.googleapis.com/auth/tasks", "https://www.googleapis.com/auth/tasks.readonly"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}}, "id": "tasks.tasklists.get", "httpMethod": "GET", "path": "users/@me/lists/{tasklist}", "response": {"$ref": "TaskList"}}, "list": {"scopes": ["https://www.googleapis.com/auth/tasks", "https://www.googleapis.com/auth/tasks.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"format": "int64", "type": "string", "location": "query"}}, "response": {"$ref": "TaskLists"}, "httpMethod": "GET", "path": "users/@me/lists", "id": "tasks.tasklists.list"}, "update": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "TaskList"}, "id": "tasks.tasklists.update", "httpMethod": "PUT", "path": "users/@me/lists/{tasklist}", "response": {"$ref": "TaskList"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "TaskList"}, "id": "tasks.tasklists.patch", "httpMethod": "PATCH", "path": "users/@me/lists/{tasklist}", "response": {"$ref": "TaskList"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "users/@me/lists/{tasklist}", "id": "tasks.tasklists.delete"}}}', true));
}
}
class Task extends apiModel {
public $status;
public $kind;
public $updated;
public $parent;
public $title;
public $deleted;
public $completed;
public $due;
public $etag;
public $notes;
public $position;
public $hidden;
public $id;
public $selfLink;
public function setStatus($status) {
$this->status = $status;
}
public function getStatus() {
return $this->status;
}
public function setKind($kind) {
$this->kind = $kind;
}
public function getKind() {
return $this->kind;
}
public function setUpdated($updated) {
$this->updated = $updated;
}
public function getUpdated() {
return $this->updated;
}
public function setParent($parent) {
$this->parent = $parent;
}
public function getParent() {
return $this->parent;
}
public function setTitle($title) {
$this->title = $title;
}
public function getTitle() {
return $this->title;
}
public function setDeleted($deleted) {
$this->deleted = $deleted;
}
public function getDeleted() {
return $this->deleted;
}
public function setCompleted($completed) {
$this->completed = $completed;
}
public function getCompleted() {
return $this->completed;
}
public function setDue($due) {
$this->due = $due;
}
public function getDue() {
return $this->due;
}
public function setEtag($etag) {
$this->etag = $etag;
}
public function getEtag() {
return $this->etag;
}
public function setNotes($notes) {
$this->notes = $notes;
}
public function getNotes() {
return $this->notes;
}
public function setPosition($position) {
$this->position = $position;
}
public function getPosition() {
return $this->position;
}
public function setHidden($hidden) {
$this->hidden = $hidden;
}
public function getHidden() {
return $this->hidden;
}
public function setId($id) {
$this->id = $id;
}
public function getId() {
return $this->id;
}
public function setSelfLink($selfLink) {
$this->selfLink = $selfLink;
}
public function getSelfLink() {
return $this->selfLink;
}
}
class TaskList extends apiModel {
public $kind;
public $etag;
public $id;
public $selfLink;
public $title;
public function setKind($kind) {
$this->kind = $kind;
}
public function getKind() {
return $this->kind;
}
public function setEtag($etag) {
$this->etag = $etag;
}
public function getEtag() {
return $this->etag;
}
public function setId($id) {
$this->id = $id;
}
public function getId() {
return $this->id;
}
public function setSelfLink($selfLink) {
$this->selfLink = $selfLink;
}
public function getSelfLink() {
return $this->selfLink;
}
public function setTitle($title) {
$this->title = $title;
}
public function getTitle() {
return $this->title;
}
}
class TaskLists extends apiModel {
public $nextPageToken;
public $items;
public $kind;
public $etag;
public function setNextPageToken($nextPageToken) {
$this->nextPageToken = $nextPageToken;
}
public function getNextPageToken() {
return $this->nextPageToken;
}
public function setItems(TaskList $items) {
$this->items = $items;
}
public function getItems() {
return $this->items;
}
public function setKind($kind) {
$this->kind = $kind;
}
public function getKind() {
return $this->kind;
}
public function setEtag($etag) {
$this->etag = $etag;
}
public function getEtag() {
return $this->etag;
}
}
class Tasks extends apiModel {
public $nextPageToken;
public $items;
public $kind;
public $etag;
public function setNextPageToken($nextPageToken) {
$this->nextPageToken = $nextPageToken;
}
public function getNextPageToken() {
return $this->nextPageToken;
}
public function setItems(Task $items) {
$this->items = $items;
}
public function getItems() {
return $this->items;
}
public function setKind($kind) {
$this->kind = $kind;
}
public function getKind() {
return $this->kind;
}
public function setEtag($etag) {
$this->etag = $etag;
}
public function getEtag() {
return $this->etag;
}
}