Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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