Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 401 and 402] [Versions 401 and 403]

   1  <?php
   2  /*
   3   * Copyright 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  
  18  /**
  19   * Service definition for Taskqueue (v1beta2).
  20   *
  21   * <p>
  22   * Lets you access a Google App Engine Pull Task Queue over REST.</p>
  23   *
  24   * <p>
  25   * For more information about this service, see the API
  26   * <a href="https://developers.google.com/appengine/docs/python/taskqueue/rest" target="_blank">Documentation</a>
  27   * </p>
  28   *
  29   * @author Google, Inc.
  30   */
  31  class Google_Service_Taskqueue extends Google_Service
  32  {
  33    /** Manage your Tasks and Taskqueues. */
  34    const TASKQUEUE =
  35        "https://www.googleapis.com/auth/taskqueue";
  36    /** Consume Tasks from your Taskqueues. */
  37    const TASKQUEUE_CONSUMER =
  38        "https://www.googleapis.com/auth/taskqueue.consumer";
  39  
  40    public $taskqueues;
  41    public $tasks;
  42    
  43  
  44    /**
  45     * Constructs the internal representation of the Taskqueue service.
  46     *
  47     * @param Google_Client $client
  48     */
  49    public function __construct(Google_Client $client)
  50    {
  51      parent::__construct($client);
  52      $this->rootUrl = 'https://www.googleapis.com/';
  53      $this->servicePath = 'taskqueue/v1beta2/projects/';
  54      $this->version = 'v1beta2';
  55      $this->serviceName = 'taskqueue';
  56  
  57      $this->taskqueues = new Google_Service_Taskqueue_Taskqueues_Resource(
  58          $this,
  59          $this->serviceName,
  60          'taskqueues',
  61          array(
  62            'methods' => array(
  63              'get' => array(
  64                'path' => '{project}/taskqueues/{taskqueue}',
  65                'httpMethod' => 'GET',
  66                'parameters' => array(
  67                  'project' => array(
  68                    'location' => 'path',
  69                    'type' => 'string',
  70                    'required' => true,
  71                  ),
  72                  'taskqueue' => array(
  73                    'location' => 'path',
  74                    'type' => 'string',
  75                    'required' => true,
  76                  ),
  77                  'getStats' => array(
  78                    'location' => 'query',
  79                    'type' => 'boolean',
  80                  ),
  81                ),
  82              ),
  83            )
  84          )
  85      );
  86      $this->tasks = new Google_Service_Taskqueue_Tasks_Resource(
  87          $this,
  88          $this->serviceName,
  89          'tasks',
  90          array(
  91            'methods' => array(
  92              'delete' => array(
  93                'path' => '{project}/taskqueues/{taskqueue}/tasks/{task}',
  94                'httpMethod' => 'DELETE',
  95                'parameters' => array(
  96                  'project' => array(
  97                    'location' => 'path',
  98                    'type' => 'string',
  99                    'required' => true,
 100                  ),
 101                  'taskqueue' => array(
 102                    'location' => 'path',
 103                    'type' => 'string',
 104                    'required' => true,
 105                  ),
 106                  'task' => array(
 107                    'location' => 'path',
 108                    'type' => 'string',
 109                    'required' => true,
 110                  ),
 111                ),
 112              ),'get' => array(
 113                'path' => '{project}/taskqueues/{taskqueue}/tasks/{task}',
 114                'httpMethod' => 'GET',
 115                'parameters' => array(
 116                  'project' => array(
 117                    'location' => 'path',
 118                    'type' => 'string',
 119                    'required' => true,
 120                  ),
 121                  'taskqueue' => array(
 122                    'location' => 'path',
 123                    'type' => 'string',
 124                    'required' => true,
 125                  ),
 126                  'task' => array(
 127                    'location' => 'path',
 128                    'type' => 'string',
 129                    'required' => true,
 130                  ),
 131                ),
 132              ),'insert' => array(
 133                'path' => '{project}/taskqueues/{taskqueue}/tasks',
 134                'httpMethod' => 'POST',
 135                'parameters' => array(
 136                  'project' => array(
 137                    'location' => 'path',
 138                    'type' => 'string',
 139                    'required' => true,
 140                  ),
 141                  'taskqueue' => array(
 142                    'location' => 'path',
 143                    'type' => 'string',
 144                    'required' => true,
 145                  ),
 146                ),
 147              ),'lease' => array(
 148                'path' => '{project}/taskqueues/{taskqueue}/tasks/lease',
 149                'httpMethod' => 'POST',
 150                'parameters' => array(
 151                  'project' => array(
 152                    'location' => 'path',
 153                    'type' => 'string',
 154                    'required' => true,
 155                  ),
 156                  'taskqueue' => array(
 157                    'location' => 'path',
 158                    'type' => 'string',
 159                    'required' => true,
 160                  ),
 161                  'numTasks' => array(
 162                    'location' => 'query',
 163                    'type' => 'integer',
 164                    'required' => true,
 165                  ),
 166                  'leaseSecs' => array(
 167                    'location' => 'query',
 168                    'type' => 'integer',
 169                    'required' => true,
 170                  ),
 171                  'groupByTag' => array(
 172                    'location' => 'query',
 173                    'type' => 'boolean',
 174                  ),
 175                  'tag' => array(
 176                    'location' => 'query',
 177                    'type' => 'string',
 178                  ),
 179                ),
 180              ),'list' => array(
 181                'path' => '{project}/taskqueues/{taskqueue}/tasks',
 182                'httpMethod' => 'GET',
 183                'parameters' => array(
 184                  'project' => array(
 185                    'location' => 'path',
 186                    'type' => 'string',
 187                    'required' => true,
 188                  ),
 189                  'taskqueue' => array(
 190                    'location' => 'path',
 191                    'type' => 'string',
 192                    'required' => true,
 193                  ),
 194                ),
 195              ),'patch' => array(
 196                'path' => '{project}/taskqueues/{taskqueue}/tasks/{task}',
 197                'httpMethod' => 'PATCH',
 198                'parameters' => array(
 199                  'project' => array(
 200                    'location' => 'path',
 201                    'type' => 'string',
 202                    'required' => true,
 203                  ),
 204                  'taskqueue' => array(
 205                    'location' => 'path',
 206                    'type' => 'string',
 207                    'required' => true,
 208                  ),
 209                  'task' => array(
 210                    'location' => 'path',
 211                    'type' => 'string',
 212                    'required' => true,
 213                  ),
 214                  'newLeaseSeconds' => array(
 215                    'location' => 'query',
 216                    'type' => 'integer',
 217                    'required' => true,
 218                  ),
 219                ),
 220              ),'update' => array(
 221                'path' => '{project}/taskqueues/{taskqueue}/tasks/{task}',
 222                'httpMethod' => 'POST',
 223                'parameters' => array(
 224                  'project' => array(
 225                    'location' => 'path',
 226                    'type' => 'string',
 227                    'required' => true,
 228                  ),
 229                  'taskqueue' => array(
 230                    'location' => 'path',
 231                    'type' => 'string',
 232                    'required' => true,
 233                  ),
 234                  'task' => array(
 235                    'location' => 'path',
 236                    'type' => 'string',
 237                    'required' => true,
 238                  ),
 239                  'newLeaseSeconds' => array(
 240                    'location' => 'query',
 241                    'type' => 'integer',
 242                    'required' => true,
 243                  ),
 244                ),
 245              ),
 246            )
 247          )
 248      );
 249    }
 250  }
 251  
 252  
 253  /**
 254   * The "taskqueues" collection of methods.
 255   * Typical usage is:
 256   *  <code>
 257   *   $taskqueueService = new Google_Service_Taskqueue(...);
 258   *   $taskqueues = $taskqueueService->taskqueues;
 259   *  </code>
 260   */
 261  class Google_Service_Taskqueue_Taskqueues_Resource extends Google_Service_Resource
 262  {
 263  
 264    /**
 265     * Get detailed information about a TaskQueue. (taskqueues.get)
 266     *
 267     * @param string $project The project under which the queue lies.
 268     * @param string $taskqueue The id of the taskqueue to get the properties of.
 269     * @param array $optParams Optional parameters.
 270     *
 271     * @opt_param bool getStats Whether to get stats. Optional.
 272     * @return Google_Service_Taskqueue_TaskQueue
 273     */
 274    public function get($project, $taskqueue, $optParams = array())
 275    {
 276      $params = array('project' => $project, 'taskqueue' => $taskqueue);
 277      $params = array_merge($params, $optParams);
 278      return $this->call('get', array($params), "Google_Service_Taskqueue_TaskQueue");
 279    }
 280  }
 281  
 282  /**
 283   * The "tasks" collection of methods.
 284   * Typical usage is:
 285   *  <code>
 286   *   $taskqueueService = new Google_Service_Taskqueue(...);
 287   *   $tasks = $taskqueueService->tasks;
 288   *  </code>
 289   */
 290  class Google_Service_Taskqueue_Tasks_Resource extends Google_Service_Resource
 291  {
 292  
 293    /**
 294     * Delete a task from a TaskQueue. (tasks.delete)
 295     *
 296     * @param string $project The project under which the queue lies.
 297     * @param string $taskqueue The taskqueue to delete a task from.
 298     * @param string $task The id of the task to delete.
 299     * @param array $optParams Optional parameters.
 300     */
 301    public function delete($project, $taskqueue, $task, $optParams = array())
 302    {
 303      $params = array('project' => $project, 'taskqueue' => $taskqueue, 'task' => $task);
 304      $params = array_merge($params, $optParams);
 305      return $this->call('delete', array($params));
 306    }
 307  
 308    /**
 309     * Get a particular task from a TaskQueue. (tasks.get)
 310     *
 311     * @param string $project The project under which the queue lies.
 312     * @param string $taskqueue The taskqueue in which the task belongs.
 313     * @param string $task The task to get properties of.
 314     * @param array $optParams Optional parameters.
 315     * @return Google_Service_Taskqueue_Task
 316     */
 317    public function get($project, $taskqueue, $task, $optParams = array())
 318    {
 319      $params = array('project' => $project, 'taskqueue' => $taskqueue, 'task' => $task);
 320      $params = array_merge($params, $optParams);
 321      return $this->call('get', array($params), "Google_Service_Taskqueue_Task");
 322    }
 323  
 324    /**
 325     * Insert a new task in a TaskQueue (tasks.insert)
 326     *
 327     * @param string $project The project under which the queue lies
 328     * @param string $taskqueue The taskqueue to insert the task into
 329     * @param Google_Task $postBody
 330     * @param array $optParams Optional parameters.
 331     * @return Google_Service_Taskqueue_Task
 332     */
 333    public function insert($project, $taskqueue, Google_Service_Taskqueue_Task $postBody, $optParams = array())
 334    {
 335      $params = array('project' => $project, 'taskqueue' => $taskqueue, 'postBody' => $postBody);
 336      $params = array_merge($params, $optParams);
 337      return $this->call('insert', array($params), "Google_Service_Taskqueue_Task");
 338    }
 339  
 340    /**
 341     * Lease 1 or more tasks from a TaskQueue. (tasks.lease)
 342     *
 343     * @param string $project The project under which the queue lies.
 344     * @param string $taskqueue The taskqueue to lease a task from.
 345     * @param int $numTasks The number of tasks to lease.
 346     * @param int $leaseSecs The lease in seconds.
 347     * @param array $optParams Optional parameters.
 348     *
 349     * @opt_param bool groupByTag When true, all returned tasks will have the same
 350     * tag
 351     * @opt_param string tag The tag allowed for tasks in the response. Must only be
 352     * specified if group_by_tag is true. If group_by_tag is true and tag is not
 353     * specified the tag will be that of the oldest task by eta, i.e. the first
 354     * available tag
 355     * @return Google_Service_Taskqueue_Tasks
 356     */
 357    public function lease($project, $taskqueue, $numTasks, $leaseSecs, $optParams = array())
 358    {
 359      $params = array('project' => $project, 'taskqueue' => $taskqueue, 'numTasks' => $numTasks, 'leaseSecs' => $leaseSecs);
 360      $params = array_merge($params, $optParams);
 361      return $this->call('lease', array($params), "Google_Service_Taskqueue_Tasks");
 362    }
 363  
 364    /**
 365     * List Tasks in a TaskQueue (tasks.listTasks)
 366     *
 367     * @param string $project The project under which the queue lies.
 368     * @param string $taskqueue The id of the taskqueue to list tasks from.
 369     * @param array $optParams Optional parameters.
 370     * @return Google_Service_Taskqueue_Tasks2
 371     */
 372    public function listTasks($project, $taskqueue, $optParams = array())
 373    {
 374      $params = array('project' => $project, 'taskqueue' => $taskqueue);
 375      $params = array_merge($params, $optParams);
 376      return $this->call('list', array($params), "Google_Service_Taskqueue_Tasks2");
 377    }
 378  
 379    /**
 380     * Update tasks that are leased out of a TaskQueue. This method supports patch
 381     * semantics. (tasks.patch)
 382     *
 383     * @param string $project The project under which the queue lies.
 384     * @param string $taskqueue
 385     * @param string $task
 386     * @param int $newLeaseSeconds The new lease in seconds.
 387     * @param Google_Task $postBody
 388     * @param array $optParams Optional parameters.
 389     * @return Google_Service_Taskqueue_Task
 390     */
 391    public function patch($project, $taskqueue, $task, $newLeaseSeconds, Google_Service_Taskqueue_Task $postBody, $optParams = array())
 392    {
 393      $params = array('project' => $project, 'taskqueue' => $taskqueue, 'task' => $task, 'newLeaseSeconds' => $newLeaseSeconds, 'postBody' => $postBody);
 394      $params = array_merge($params, $optParams);
 395      return $this->call('patch', array($params), "Google_Service_Taskqueue_Task");
 396    }
 397  
 398    /**
 399     * Update tasks that are leased out of a TaskQueue. (tasks.update)
 400     *
 401     * @param string $project The project under which the queue lies.
 402     * @param string $taskqueue
 403     * @param string $task
 404     * @param int $newLeaseSeconds The new lease in seconds.
 405     * @param Google_Task $postBody
 406     * @param array $optParams Optional parameters.
 407     * @return Google_Service_Taskqueue_Task
 408     */
 409    public function update($project, $taskqueue, $task, $newLeaseSeconds, Google_Service_Taskqueue_Task $postBody, $optParams = array())
 410    {
 411      $params = array('project' => $project, 'taskqueue' => $taskqueue, 'task' => $task, 'newLeaseSeconds' => $newLeaseSeconds, 'postBody' => $postBody);
 412      $params = array_merge($params, $optParams);
 413      return $this->call('update', array($params), "Google_Service_Taskqueue_Task");
 414    }
 415  }
 416  
 417  
 418  
 419  
 420  class Google_Service_Taskqueue_Task extends Google_Model
 421  {
 422    protected $internal_gapi_mappings = array(
 423          "retryCount" => "retry_count",
 424    );
 425    public $enqueueTimestamp;
 426    public $id;
 427    public $kind;
 428    public $leaseTimestamp;
 429    public $payloadBase64;
 430    public $queueName;
 431    public $retryCount;
 432    public $tag;
 433  
 434  
 435    public function setEnqueueTimestamp($enqueueTimestamp)
 436    {
 437      $this->enqueueTimestamp = $enqueueTimestamp;
 438    }
 439    public function getEnqueueTimestamp()
 440    {
 441      return $this->enqueueTimestamp;
 442    }
 443    public function setId($id)
 444    {
 445      $this->id = $id;
 446    }
 447    public function getId()
 448    {
 449      return $this->id;
 450    }
 451    public function setKind($kind)
 452    {
 453      $this->kind = $kind;
 454    }
 455    public function getKind()
 456    {
 457      return $this->kind;
 458    }
 459    public function setLeaseTimestamp($leaseTimestamp)
 460    {
 461      $this->leaseTimestamp = $leaseTimestamp;
 462    }
 463    public function getLeaseTimestamp()
 464    {
 465      return $this->leaseTimestamp;
 466    }
 467    public function setPayloadBase64($payloadBase64)
 468    {
 469      $this->payloadBase64 = $payloadBase64;
 470    }
 471    public function getPayloadBase64()
 472    {
 473      return $this->payloadBase64;
 474    }
 475    public function setQueueName($queueName)
 476    {
 477      $this->queueName = $queueName;
 478    }
 479    public function getQueueName()
 480    {
 481      return $this->queueName;
 482    }
 483    public function setRetryCount($retryCount)
 484    {
 485      $this->retryCount = $retryCount;
 486    }
 487    public function getRetryCount()
 488    {
 489      return $this->retryCount;
 490    }
 491    public function setTag($tag)
 492    {
 493      $this->tag = $tag;
 494    }
 495    public function getTag()
 496    {
 497      return $this->tag;
 498    }
 499  }
 500  
 501  class Google_Service_Taskqueue_TaskQueue extends Google_Model
 502  {
 503    protected $internal_gapi_mappings = array(
 504    );
 505    protected $aclType = 'Google_Service_Taskqueue_TaskQueueAcl';
 506    protected $aclDataType = '';
 507    public $id;
 508    public $kind;
 509    public $maxLeases;
 510    protected $statsType = 'Google_Service_Taskqueue_TaskQueueStats';
 511    protected $statsDataType = '';
 512  
 513  
 514    public function setAcl(Google_Service_Taskqueue_TaskQueueAcl $acl)
 515    {
 516      $this->acl = $acl;
 517    }
 518    public function getAcl()
 519    {
 520      return $this->acl;
 521    }
 522    public function setId($id)
 523    {
 524      $this->id = $id;
 525    }
 526    public function getId()
 527    {
 528      return $this->id;
 529    }
 530    public function setKind($kind)
 531    {
 532      $this->kind = $kind;
 533    }
 534    public function getKind()
 535    {
 536      return $this->kind;
 537    }
 538    public function setMaxLeases($maxLeases)
 539    {
 540      $this->maxLeases = $maxLeases;
 541    }
 542    public function getMaxLeases()
 543    {
 544      return $this->maxLeases;
 545    }
 546    public function setStats(Google_Service_Taskqueue_TaskQueueStats $stats)
 547    {
 548      $this->stats = $stats;
 549    }
 550    public function getStats()
 551    {
 552      return $this->stats;
 553    }
 554  }
 555  
 556  class Google_Service_Taskqueue_TaskQueueAcl extends Google_Collection
 557  {
 558    protected $collection_key = 'producerEmails';
 559    protected $internal_gapi_mappings = array(
 560    );
 561    public $adminEmails;
 562    public $consumerEmails;
 563    public $producerEmails;
 564  
 565  
 566    public function setAdminEmails($adminEmails)
 567    {
 568      $this->adminEmails = $adminEmails;
 569    }
 570    public function getAdminEmails()
 571    {
 572      return $this->adminEmails;
 573    }
 574    public function setConsumerEmails($consumerEmails)
 575    {
 576      $this->consumerEmails = $consumerEmails;
 577    }
 578    public function getConsumerEmails()
 579    {
 580      return $this->consumerEmails;
 581    }
 582    public function setProducerEmails($producerEmails)
 583    {
 584      $this->producerEmails = $producerEmails;
 585    }
 586    public function getProducerEmails()
 587    {
 588      return $this->producerEmails;
 589    }
 590  }
 591  
 592  class Google_Service_Taskqueue_TaskQueueStats extends Google_Model
 593  {
 594    protected $internal_gapi_mappings = array(
 595    );
 596    public $leasedLastHour;
 597    public $leasedLastMinute;
 598    public $oldestTask;
 599    public $totalTasks;
 600  
 601  
 602    public function setLeasedLastHour($leasedLastHour)
 603    {
 604      $this->leasedLastHour = $leasedLastHour;
 605    }
 606    public function getLeasedLastHour()
 607    {
 608      return $this->leasedLastHour;
 609    }
 610    public function setLeasedLastMinute($leasedLastMinute)
 611    {
 612      $this->leasedLastMinute = $leasedLastMinute;
 613    }
 614    public function getLeasedLastMinute()
 615    {
 616      return $this->leasedLastMinute;
 617    }
 618    public function setOldestTask($oldestTask)
 619    {
 620      $this->oldestTask = $oldestTask;
 621    }
 622    public function getOldestTask()
 623    {
 624      return $this->oldestTask;
 625    }
 626    public function setTotalTasks($totalTasks)
 627    {
 628      $this->totalTasks = $totalTasks;
 629    }
 630    public function getTotalTasks()
 631    {
 632      return $this->totalTasks;
 633    }
 634  }
 635  
 636  class Google_Service_Taskqueue_Tasks extends Google_Collection
 637  {
 638    protected $collection_key = 'items';
 639    protected $internal_gapi_mappings = array(
 640    );
 641    protected $itemsType = 'Google_Service_Taskqueue_Task';
 642    protected $itemsDataType = 'array';
 643    public $kind;
 644  
 645  
 646    public function setItems($items)
 647    {
 648      $this->items = $items;
 649    }
 650    public function getItems()
 651    {
 652      return $this->items;
 653    }
 654    public function setKind($kind)
 655    {
 656      $this->kind = $kind;
 657    }
 658    public function getKind()
 659    {
 660      return $this->kind;
 661    }
 662  }
 663  
 664  class Google_Service_Taskqueue_Tasks2 extends Google_Collection
 665  {
 666    protected $collection_key = 'items';
 667    protected $internal_gapi_mappings = array(
 668    );
 669    protected $itemsType = 'Google_Service_Taskqueue_Task';
 670    protected $itemsDataType = 'array';
 671    public $kind;
 672  
 673  
 674    public function setItems($items)
 675    {
 676      $this->items = $items;
 677    }
 678    public function getItems()
 679    {
 680      return $this->items;
 681    }
 682    public function setKind($kind)
 683    {
 684      $this->kind = $kind;
 685    }
 686    public function getKind()
 687    {
 688      return $this->kind;
 689    }
 690  }