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