Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

   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 Script (v1).
  20   *
  21   * <p>
  22   * An API for executing Google Apps Script projects.</p>
  23   *
  24   * <p>
  25   * For more information about this service, see the API
  26   * <a href="https://developers.google.com/apps-script/execution/rest/v1/run" target="_blank">Documentation</a>
  27   * </p>
  28   *
  29   * @author Google, Inc.
  30   */
  31  #[AllowDynamicProperties]
  32  class Google_Service_Script extends Google_Service
  33  {
  34    /** View and manage your mail. */
  35    const MAIL_GOOGLE_COM =
  36        "https://mail.google.com/";
  37    /** Manage your calendars. */
  38    const WWW_GOOGLE_COM_CALENDAR_FEEDS =
  39        "https://www.google.com/calendar/feeds";
  40    /** Manage your contacts. */
  41    const WWW_GOOGLE_COM_M8_FEEDS =
  42        "https://www.google.com/m8/feeds";
  43    /** View and manage the provisioning of groups on your domain. */
  44    const ADMIN_DIRECTORY_GROUP =
  45        "https://www.googleapis.com/auth/admin.directory.group";
  46    /** View and manage the provisioning of users on your domain. */
  47    const ADMIN_DIRECTORY_USER =
  48        "https://www.googleapis.com/auth/admin.directory.user";
  49    /** View and manage the files in your Google Drive. */
  50    const DRIVE =
  51        "https://www.googleapis.com/auth/drive";
  52    /** View and manage your forms in Google Drive. */
  53    const FORMS =
  54        "https://www.googleapis.com/auth/forms";
  55    /** View and manage forms that this application has been installed in. */
  56    const FORMS_CURRENTONLY =
  57        "https://www.googleapis.com/auth/forms.currentonly";
  58    /** View and manage your Google Groups. */
  59    const GROUPS =
  60        "https://www.googleapis.com/auth/groups";
  61    /** View your email address. */
  62    const USERINFO_EMAIL =
  63        "https://www.googleapis.com/auth/userinfo.email";
  64  
  65    public $scripts;
  66    
  67  
  68    /**
  69     * Constructs the internal representation of the Script service.
  70     *
  71     * @param Google_Client $client
  72     */
  73    public function __construct(Google_Client $client)
  74    {
  75      parent::__construct($client);
  76      $this->rootUrl = 'https://script.googleapis.com/';
  77      $this->servicePath = '';
  78      $this->version = 'v1';
  79      $this->serviceName = 'script';
  80  
  81      $this->scripts = new Google_Service_Script_Scripts_Resource(
  82          $this,
  83          $this->serviceName,
  84          'scripts',
  85          array(
  86            'methods' => array(
  87              'run' => array(
  88                'path' => 'v1/scripts/{scriptId}:run',
  89                'httpMethod' => 'POST',
  90                'parameters' => array(
  91                  'scriptId' => array(
  92                    'location' => 'path',
  93                    'type' => 'string',
  94                    'required' => true,
  95                  ),
  96                ),
  97              ),
  98            )
  99          )
 100      );
 101    }
 102  }
 103  
 104  
 105  /**
 106   * The "scripts" collection of methods.
 107   * Typical usage is:
 108   *  <code>
 109   *   $scriptService = new Google_Service_Script(...);
 110   *   $scripts = $scriptService->scripts;
 111   *  </code>
 112   */
 113  #[AllowDynamicProperties]
 114  class Google_Service_Script_Scripts_Resource extends Google_Service_Resource
 115  {
 116  
 117    /**
 118     * Runs a function in an Apps Script project that has been deployed for use with
 119     * the Apps Script Execution API. This method requires authorization with an
 120     * OAuth 2.0 token that includes at least one of the scopes listed in the
 121     * [Authentication](#authentication) section; script projects that do not
 122     * require authorization cannot be executed through this API. To find the
 123     * correct scopes to include in the authentication token, open the project in
 124     * the script editor, then select **File > Project properties** and click the
 125     * **Scopes** tab. (scripts.run)
 126     *
 127     * @param string $scriptId The project key of the script to be executed. To find
 128     * the project key, open the project in the script editor, then select **File >
 129     * Project properties**.
 130     * @param Google_ExecutionRequest $postBody
 131     * @param array $optParams Optional parameters.
 132     * @return Google_Service_Script_Operation
 133     */
 134    public function run($scriptId, Google_Service_Script_ExecutionRequest $postBody, $optParams = array())
 135    {
 136      $params = array('scriptId' => $scriptId, 'postBody' => $postBody);
 137      $params = array_merge($params, $optParams);
 138      return $this->call('run', array($params), "Google_Service_Script_Operation");
 139    }
 140  }
 141  
 142  
 143  
 144  
 145  #[AllowDynamicProperties]
 146  class Google_Service_Script_ExecutionError extends Google_Collection
 147  {
 148    protected $collection_key = 'scriptStackTraceElements';
 149    protected $internal_gapi_mappings = array(
 150    );
 151    public $errorMessage;
 152    public $errorType;
 153    protected $scriptStackTraceElementsType = 'Google_Service_Script_ScriptStackTraceElement';
 154    protected $scriptStackTraceElementsDataType = 'array';
 155  
 156  
 157    public function setErrorMessage($errorMessage)
 158    {
 159      $this->errorMessage = $errorMessage;
 160    }
 161    public function getErrorMessage()
 162    {
 163      return $this->errorMessage;
 164    }
 165    public function setErrorType($errorType)
 166    {
 167      $this->errorType = $errorType;
 168    }
 169    public function getErrorType()
 170    {
 171      return $this->errorType;
 172    }
 173    public function setScriptStackTraceElements($scriptStackTraceElements)
 174    {
 175      $this->scriptStackTraceElements = $scriptStackTraceElements;
 176    }
 177    public function getScriptStackTraceElements()
 178    {
 179      return $this->scriptStackTraceElements;
 180    }
 181  }
 182  
 183  #[AllowDynamicProperties]
 184  class Google_Service_Script_ExecutionRequest extends Google_Collection
 185  {
 186    protected $collection_key = 'parameters';
 187    protected $internal_gapi_mappings = array(
 188    );
 189    public $devMode;
 190    public $function;
 191    public $parameters;
 192    public $sessionState;
 193  
 194  
 195    public function setDevMode($devMode)
 196    {
 197      $this->devMode = $devMode;
 198    }
 199    public function getDevMode()
 200    {
 201      return $this->devMode;
 202    }
 203    public function setFunction($function)
 204    {
 205      $this->function = $function;
 206    }
 207    public function getFunction()
 208    {
 209      return $this->function;
 210    }
 211    public function setParameters($parameters)
 212    {
 213      $this->parameters = $parameters;
 214    }
 215    public function getParameters()
 216    {
 217      return $this->parameters;
 218    }
 219    public function setSessionState($sessionState)
 220    {
 221      $this->sessionState = $sessionState;
 222    }
 223    public function getSessionState()
 224    {
 225      return $this->sessionState;
 226    }
 227  }
 228  
 229  #[AllowDynamicProperties]
 230  class Google_Service_Script_ExecutionResponse extends Google_Model
 231  {
 232    protected $internal_gapi_mappings = array(
 233    );
 234    public $result;
 235  
 236  
 237    public function setResult($result)
 238    {
 239      $this->result = $result;
 240    }
 241    public function getResult()
 242    {
 243      return $this->result;
 244    }
 245  }
 246  
 247  #[AllowDynamicProperties]
 248  class Google_Service_Script_Operation extends Google_Model
 249  {
 250    protected $internal_gapi_mappings = array(
 251    );
 252    public $done;
 253    protected $errorType = 'Google_Service_Script_Status';
 254    protected $errorDataType = '';
 255    public $metadata;
 256    public $name;
 257    public $response;
 258  
 259  
 260    public function setDone($done)
 261    {
 262      $this->done = $done;
 263    }
 264    public function getDone()
 265    {
 266      return $this->done;
 267    }
 268    public function setError(Google_Service_Script_Status $error)
 269    {
 270      $this->error = $error;
 271    }
 272    public function getError()
 273    {
 274      return $this->error;
 275    }
 276    public function setMetadata($metadata)
 277    {
 278      $this->metadata = $metadata;
 279    }
 280    public function getMetadata()
 281    {
 282      return $this->metadata;
 283    }
 284    public function setName($name)
 285    {
 286      $this->name = $name;
 287    }
 288    public function getName()
 289    {
 290      return $this->name;
 291    }
 292    public function setResponse($response)
 293    {
 294      $this->response = $response;
 295    }
 296    public function getResponse()
 297    {
 298      return $this->response;
 299    }
 300  }
 301  
 302  #[AllowDynamicProperties]
 303  class Google_Service_Script_OperationMetadata extends Google_Model
 304  {
 305  }
 306  
 307  #[AllowDynamicProperties]
 308  class Google_Service_Script_OperationResponse extends Google_Model
 309  {
 310  }
 311  
 312  #[AllowDynamicProperties]
 313  class Google_Service_Script_ScriptStackTraceElement extends Google_Model
 314  {
 315    protected $internal_gapi_mappings = array(
 316    );
 317    public $function;
 318    public $lineNumber;
 319  
 320  
 321    public function setFunction($function)
 322    {
 323      $this->function = $function;
 324    }
 325    public function getFunction()
 326    {
 327      return $this->function;
 328    }
 329    public function setLineNumber($lineNumber)
 330    {
 331      $this->lineNumber = $lineNumber;
 332    }
 333    public function getLineNumber()
 334    {
 335      return $this->lineNumber;
 336    }
 337  }
 338  
 339  #[AllowDynamicProperties]
 340  class Google_Service_Script_Status extends Google_Collection
 341  {
 342    protected $collection_key = 'details';
 343    protected $internal_gapi_mappings = array(
 344    );
 345    public $code;
 346    public $details;
 347    public $message;
 348  
 349  
 350    public function setCode($code)
 351    {
 352      $this->code = $code;
 353    }
 354    public function getCode()
 355    {
 356      return $this->code;
 357    }
 358    public function setDetails($details)
 359    {
 360      $this->details = $details;
 361    }
 362    public function getDetails()
 363    {
 364      return $this->details;
 365    }
 366    public function setMessage($message)
 367    {
 368      $this->message = $message;
 369    }
 370    public function getMessage()
 371    {
 372      return $this->message;
 373    }
 374  }
 375  
 376  #[AllowDynamicProperties]
 377  class Google_Service_Script_StatusDetails extends Google_Model
 378  {
 379  }