1<?php
2/*
3 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 * use this file except in compliance with the License. You may obtain a copy of
5 * the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 * License for the specific language governing permissions and limitations under
13 * the License.
14 */
15
16
17  /**
18   * The "taskqueues" collection of methods.
19   * Typical usage is:
20   *  <code>
21   *   $taskqueueService = new Google_TaskqueueService(...);
22   *   $taskqueues = $taskqueueService->taskqueues;
23   *  </code>
24   */
25  class Google_TaskqueuesServiceResource extends Google_ServiceResource {
26
27    /**
28     * Get detailed information about a TaskQueue. (taskqueues.get)
29     *
30     * @param string $project The project under which the queue lies.
31     * @param string $taskqueue The id of the taskqueue to get the properties of.
32     * @param array $optParams Optional parameters.
33     *
34     * @opt_param bool getStats Whether to get stats. Optional.
35     * @return Google_TaskQueue
36     */
37    public function get($project, $taskqueue, $optParams = array()) {
38      $params = array('project' => $project, 'taskqueue' => $taskqueue);
39      $params = array_merge($params, $optParams);
40      $data = $this->__call('get', array($params));
41      if ($this->useObjects()) {
42        return new Google_TaskQueue($data);
43      } else {
44        return $data;
45      }
46    }
47  }
48
49  /**
50   * The "tasks" collection of methods.
51   * Typical usage is:
52   *  <code>
53   *   $taskqueueService = new Google_TaskqueueService(...);
54   *   $tasks = $taskqueueService->tasks;
55   *  </code>
56   */
57  class Google_TasksServiceResource extends Google_ServiceResource {
58
59    /**
60     * Delete a task from a TaskQueue. (tasks.delete)
61     *
62     * @param string $project The project under which the queue lies.
63     * @param string $taskqueue The taskqueue to delete a task from.
64     * @param string $task The id of the task to delete.
65     * @param array $optParams Optional parameters.
66     */
67    public function delete($project, $taskqueue, $task, $optParams = array()) {
68      $params = array('project' => $project, 'taskqueue' => $taskqueue, 'task' => $task);
69      $params = array_merge($params, $optParams);
70      $data = $this->__call('delete', array($params));
71      return $data;
72    }
73    /**
74     * Get a particular task from a TaskQueue. (tasks.get)
75     *
76     * @param string $project The project under which the queue lies.
77     * @param string $taskqueue The taskqueue in which the task belongs.
78     * @param string $task The task to get properties of.
79     * @param array $optParams Optional parameters.
80     * @return Google_Task
81     */
82    public function get($project, $taskqueue, $task, $optParams = array()) {
83      $params = array('project' => $project, 'taskqueue' => $taskqueue, 'task' => $task);
84      $params = array_merge($params, $optParams);
85      $data = $this->__call('get', array($params));
86      if ($this->useObjects()) {
87        return new Google_Task($data);
88      } else {
89        return $data;
90      }
91    }
92    /**
93     * Insert a new task in a TaskQueue (tasks.insert)
94     *
95     * @param string $project The project under which the queue lies
96     * @param string $taskqueue The taskqueue to insert the task into
97     * @param Google_Task $postBody
98     * @param array $optParams Optional parameters.
99     * @return Google_Task
100     */
101    public function insert($project, $taskqueue, Google_Task $postBody, $optParams = array()) {
102      $params = array('project' => $project, 'taskqueue' => $taskqueue, 'postBody' => $postBody);
103      $params = array_merge($params, $optParams);
104      $data = $this->__call('insert', array($params));
105      if ($this->useObjects()) {
106        return new Google_Task($data);
107      } else {
108        return $data;
109      }
110    }
111    /**
112     * Lease 1 or more tasks from a TaskQueue. (tasks.lease)
113     *
114     * @param string $project The project under which the queue lies.
115     * @param string $taskqueue The taskqueue to lease a task from.
116     * @param int $numTasks The number of tasks to lease.
117     * @param int $leaseSecs The lease in seconds.
118     * @param array $optParams Optional parameters.
119     *
120     * @opt_param bool groupByTag When true, all returned tasks will have the same tag
121     * @opt_param string tag The tag allowed for tasks in the response. Must only be specified if group_by_tag is true. If group_by_tag is true and tag is not specified the tag will be that of the oldest task by eta, i.e. the first available tag
122     * @return Google_Tasks
123     */
124    public function lease($project, $taskqueue, $numTasks, $leaseSecs, $optParams = array()) {
125      $params = array('project' => $project, 'taskqueue' => $taskqueue, 'numTasks' => $numTasks, 'leaseSecs' => $leaseSecs);
126      $params = array_merge($params, $optParams);
127      $data = $this->__call('lease', array($params));
128      if ($this->useObjects()) {
129        return new Google_Tasks($data);
130      } else {
131        return $data;
132      }
133    }
134    /**
135     * List Tasks in a TaskQueue (tasks.list)
136     *
137     * @param string $project The project under which the queue lies.
138     * @param string $taskqueue The id of the taskqueue to list tasks from.
139     * @param array $optParams Optional parameters.
140     * @return Google_Tasks2
141     */
142    public function listTasks($project, $taskqueue, $optParams = array()) {
143      $params = array('project' => $project, 'taskqueue' => $taskqueue);
144      $params = array_merge($params, $optParams);
145      $data = $this->__call('list', array($params));
146      if ($this->useObjects()) {
147        return new Google_Tasks2($data);
148      } else {
149        return $data;
150      }
151    }
152    /**
153     * Update tasks that are leased out of a TaskQueue. This method supports patch semantics.
154     * (tasks.patch)
155     *
156     * @param string $project The project under which the queue lies.
157     * @param string $taskqueue
158     * @param string $task
159     * @param int $newLeaseSeconds The new lease in seconds.
160     * @param Google_Task $postBody
161     * @param array $optParams Optional parameters.
162     * @return Google_Task
163     */
164    public function patch($project, $taskqueue, $task, $newLeaseSeconds, Google_Task $postBody, $optParams = array()) {
165      $params = array('project' => $project, 'taskqueue' => $taskqueue, 'task' => $task, 'newLeaseSeconds' => $newLeaseSeconds, 'postBody' => $postBody);
166      $params = array_merge($params, $optParams);
167      $data = $this->__call('patch', array($params));
168      if ($this->useObjects()) {
169        return new Google_Task($data);
170      } else {
171        return $data;
172      }
173    }
174    /**
175     * Update tasks that are leased out of a TaskQueue. (tasks.update)
176     *
177     * @param string $project The project under which the queue lies.
178     * @param string $taskqueue
179     * @param string $task
180     * @param int $newLeaseSeconds The new lease in seconds.
181     * @param Google_Task $postBody
182     * @param array $optParams Optional parameters.
183     * @return Google_Task
184     */
185    public function update($project, $taskqueue, $task, $newLeaseSeconds, Google_Task $postBody, $optParams = array()) {
186      $params = array('project' => $project, 'taskqueue' => $taskqueue, 'task' => $task, 'newLeaseSeconds' => $newLeaseSeconds, 'postBody' => $postBody);
187      $params = array_merge($params, $optParams);
188      $data = $this->__call('update', array($params));
189      if ($this->useObjects()) {
190        return new Google_Task($data);
191      } else {
192        return $data;
193      }
194    }
195  }
196
197/**
198 * Service definition for Google_Taskqueue (v1beta2).
199 *
200 * <p>
201 * Lets you access a Google App Engine Pull Task Queue over REST.
202 * </p>
203 *
204 * <p>
205 * For more information about this service, see the
206 * <a href="https://developers.google.com/appengine/docs/python/taskqueue/rest" target="_blank">API Documentation</a>
207 * </p>
208 *
209 * @author Google, Inc.
210 */
211class Google_TaskqueueService extends Google_Service {
212  public $taskqueues;
213  public $tasks;
214  /**
215   * Constructs the internal representation of the Taskqueue service.
216   *
217   * @param Google_Client $client
218   */
219  public function __construct(Google_Client $client) {
220    $this->servicePath = 'taskqueue/v1beta2/projects/';
221    $this->version = 'v1beta2';
222    $this->serviceName = 'taskqueue';
223
224    $client->addService($this->serviceName, $this->version);
225    $this->taskqueues = new Google_TaskqueuesServiceResource($this, $this->serviceName, 'taskqueues', json_decode('{"methods": {"get": {"id": "taskqueue.taskqueues.get", "path": "{project}/taskqueues/{taskqueue}", "httpMethod": "GET", "parameters": {"getStats": {"type": "boolean", "location": "query"}, "project": {"type": "string", "required": true, "location": "path"}, "taskqueue": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "TaskQueue"}, "scopes": ["https://www.googleapis.com/auth/taskqueue", "https://www.googleapis.com/auth/taskqueue.consumer"]}}}', true));
226    $this->tasks = new Google_TasksServiceResource($this, $this->serviceName, 'tasks', json_decode('{"methods": {"delete": {"id": "taskqueue.tasks.delete", "path": "{project}/taskqueues/{taskqueue}/tasks/{task}", "httpMethod": "DELETE", "parameters": {"project": {"type": "string", "required": true, "location": "path"}, "task": {"type": "string", "required": true, "location": "path"}, "taskqueue": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/taskqueue", "https://www.googleapis.com/auth/taskqueue.consumer"]}, "get": {"id": "taskqueue.tasks.get", "path": "{project}/taskqueues/{taskqueue}/tasks/{task}", "httpMethod": "GET", "parameters": {"project": {"type": "string", "required": true, "location": "path"}, "task": {"type": "string", "required": true, "location": "path"}, "taskqueue": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Task"}, "scopes": ["https://www.googleapis.com/auth/taskqueue", "https://www.googleapis.com/auth/taskqueue.consumer"]}, "insert": {"id": "taskqueue.tasks.insert", "path": "{project}/taskqueues/{taskqueue}/tasks", "httpMethod": "POST", "parameters": {"project": {"type": "string", "required": true, "location": "path"}, "taskqueue": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Task"}, "response": {"$ref": "Task"}, "scopes": ["https://www.googleapis.com/auth/taskqueue", "https://www.googleapis.com/auth/taskqueue.consumer"]}, "lease": {"id": "taskqueue.tasks.lease", "path": "{project}/taskqueues/{taskqueue}/tasks/lease", "httpMethod": "POST", "parameters": {"groupByTag": {"type": "boolean", "location": "query"}, "leaseSecs": {"type": "integer", "required": true, "format": "int32", "location": "query"}, "numTasks": {"type": "integer", "required": true, "format": "int32", "location": "query"}, "project": {"type": "string", "required": true, "location": "path"}, "tag": {"type": "string", "location": "query"}, "taskqueue": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Tasks"}, "scopes": ["https://www.googleapis.com/auth/taskqueue", "https://www.googleapis.com/auth/taskqueue.consumer"]}, "list": {"id": "taskqueue.tasks.list", "path": "{project}/taskqueues/{taskqueue}/tasks", "httpMethod": "GET", "parameters": {"project": {"type": "string", "required": true, "location": "path"}, "taskqueue": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Tasks2"}, "scopes": ["https://www.googleapis.com/auth/taskqueue", "https://www.googleapis.com/auth/taskqueue.consumer"]}, "patch": {"id": "taskqueue.tasks.patch", "path": "{project}/taskqueues/{taskqueue}/tasks/{task}", "httpMethod": "PATCH", "parameters": {"newLeaseSeconds": {"type": "integer", "required": true, "format": "int32", "location": "query"}, "project": {"type": "string", "required": true, "location": "path"}, "task": {"type": "string", "required": true, "location": "path"}, "taskqueue": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Task"}, "response": {"$ref": "Task"}, "scopes": ["https://www.googleapis.com/auth/taskqueue", "https://www.googleapis.com/auth/taskqueue.consumer"]}, "update": {"id": "taskqueue.tasks.update", "path": "{project}/taskqueues/{taskqueue}/tasks/{task}", "httpMethod": "POST", "parameters": {"newLeaseSeconds": {"type": "integer", "required": true, "format": "int32", "location": "query"}, "project": {"type": "string", "required": true, "location": "path"}, "task": {"type": "string", "required": true, "location": "path"}, "taskqueue": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Task"}, "response": {"$ref": "Task"}, "scopes": ["https://www.googleapis.com/auth/taskqueue", "https://www.googleapis.com/auth/taskqueue.consumer"]}}}', true));
227
228  }
229}
230
231
232
233class Google_Task extends Google_Model {
234  public $enqueueTimestamp;
235  public $id;
236  public $kind;
237  public $leaseTimestamp;
238  public $payloadBase64;
239  public $queueName;
240  public $retry_count;
241  public $tag;
242  public function setEnqueueTimestamp( $enqueueTimestamp) {
243    $this->enqueueTimestamp = $enqueueTimestamp;
244  }
245  public function getEnqueueTimestamp() {
246    return $this->enqueueTimestamp;
247  }
248  public function setId( $id) {
249    $this->id = $id;
250  }
251  public function getId() {
252    return $this->id;
253  }
254  public function setKind( $kind) {
255    $this->kind = $kind;
256  }
257  public function getKind() {
258    return $this->kind;
259  }
260  public function setLeaseTimestamp( $leaseTimestamp) {
261    $this->leaseTimestamp = $leaseTimestamp;
262  }
263  public function getLeaseTimestamp() {
264    return $this->leaseTimestamp;
265  }
266  public function setPayloadBase64( $payloadBase64) {
267    $this->payloadBase64 = $payloadBase64;
268  }
269  public function getPayloadBase64() {
270    return $this->payloadBase64;
271  }
272  public function setQueueName( $queueName) {
273    $this->queueName = $queueName;
274  }
275  public function getQueueName() {
276    return $this->queueName;
277  }
278  public function setRetry_count( $retry_count) {
279    $this->retry_count = $retry_count;
280  }
281  public function getRetry_count() {
282    return $this->retry_count;
283  }
284  public function setTag( $tag) {
285    $this->tag = $tag;
286  }
287  public function getTag() {
288    return $this->tag;
289  }
290}
291
292class Google_TaskQueue extends Google_Model {
293  protected $__aclType = 'Google_TaskQueueAcl';
294  protected $__aclDataType = '';
295  public $acl;
296  public $id;
297  public $kind;
298  public $maxLeases;
299  protected $__statsType = 'Google_TaskQueueStats';
300  protected $__statsDataType = '';
301  public $stats;
302  public function setAcl(Google_TaskQueueAcl $acl) {
303    $this->acl = $acl;
304  }
305  public function getAcl() {
306    return $this->acl;
307  }
308  public function setId( $id) {
309    $this->id = $id;
310  }
311  public function getId() {
312    return $this->id;
313  }
314  public function setKind( $kind) {
315    $this->kind = $kind;
316  }
317  public function getKind() {
318    return $this->kind;
319  }
320  public function setMaxLeases( $maxLeases) {
321    $this->maxLeases = $maxLeases;
322  }
323  public function getMaxLeases() {
324    return $this->maxLeases;
325  }
326  public function setStats(Google_TaskQueueStats $stats) {
327    $this->stats = $stats;
328  }
329  public function getStats() {
330    return $this->stats;
331  }
332}
333
334class Google_TaskQueueAcl extends Google_Model {
335  public $adminEmails;
336  public $consumerEmails;
337  public $producerEmails;
338  public function setAdminEmails(/* array(Google_string) */ $adminEmails) {
339    $this->assertIsArray($adminEmails, 'Google_string', __METHOD__);
340    $this->adminEmails = $adminEmails;
341  }
342  public function getAdminEmails() {
343    return $this->adminEmails;
344  }
345  public function setConsumerEmails(/* array(Google_string) */ $consumerEmails) {
346    $this->assertIsArray($consumerEmails, 'Google_string', __METHOD__);
347    $this->consumerEmails = $consumerEmails;
348  }
349  public function getConsumerEmails() {
350    return $this->consumerEmails;
351  }
352  public function setProducerEmails(/* array(Google_string) */ $producerEmails) {
353    $this->assertIsArray($producerEmails, 'Google_string', __METHOD__);
354    $this->producerEmails = $producerEmails;
355  }
356  public function getProducerEmails() {
357    return $this->producerEmails;
358  }
359}
360
361class Google_TaskQueueStats extends Google_Model {
362  public $leasedLastHour;
363  public $leasedLastMinute;
364  public $oldestTask;
365  public $totalTasks;
366  public function setLeasedLastHour( $leasedLastHour) {
367    $this->leasedLastHour = $leasedLastHour;
368  }
369  public function getLeasedLastHour() {
370    return $this->leasedLastHour;
371  }
372  public function setLeasedLastMinute( $leasedLastMinute) {
373    $this->leasedLastMinute = $leasedLastMinute;
374  }
375  public function getLeasedLastMinute() {
376    return $this->leasedLastMinute;
377  }
378  public function setOldestTask( $oldestTask) {
379    $this->oldestTask = $oldestTask;
380  }
381  public function getOldestTask() {
382    return $this->oldestTask;
383  }
384  public function setTotalTasks( $totalTasks) {
385    $this->totalTasks = $totalTasks;
386  }
387  public function getTotalTasks() {
388    return $this->totalTasks;
389  }
390}
391
392class Google_Tasks extends Google_Model {
393  protected $__itemsType = 'Google_Task';
394  protected $__itemsDataType = 'array';
395  public $items;
396  public $kind;
397  public function setItems(/* array(Google_Task) */ $items) {
398    $this->assertIsArray($items, 'Google_Task', __METHOD__);
399    $this->items = $items;
400  }
401  public function getItems() {
402    return $this->items;
403  }
404  public function setKind( $kind) {
405    $this->kind = $kind;
406  }
407  public function getKind() {
408    return $this->kind;
409  }
410}
411
412class Google_Tasks2 extends Google_Model {
413  protected $__itemsType = 'Google_Task';
414  protected $__itemsDataType = 'array';
415  public $items;
416  public $kind;
417  public function setItems(/* array(Google_Task) */ $items) {
418    $this->assertIsArray($items, 'Google_Task', __METHOD__);
419    $this->items = $items;
420  }
421  public function getItems() {
422    return $this->items;
423  }
424  public function setKind( $kind) {
425    $this->kind = $kind;
426  }
427  public function getKind() {
428    return $this->kind;
429  }
430}
431