PageRenderTime 36ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 1ms

/webui/google-api/contrib/apiTasksService.php

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