| OLD | NEW |
| 1 // This is a generated file (see the discoveryapis_generator project). | 1 // This is a generated file (see the discoveryapis_generator project). |
| 2 | 2 |
| 3 library googleapis.script.v1; | 3 library googleapis.script.v1; |
| 4 | 4 |
| 5 import 'dart:core' as core; | 5 import 'dart:core' as core; |
| 6 import 'dart:async' as async; | 6 import 'dart:async' as async; |
| 7 import 'dart:convert' as convert; | 7 import 'dart:convert' as convert; |
| 8 | 8 |
| 9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; | 9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; |
| 10 import 'package:http/http.dart' as http; | 10 import 'package:http/http.dart' as http; |
| 11 | 11 |
| 12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show | 12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' |
| 13 ApiRequestError, DetailedApiRequestError; | 13 show ApiRequestError, DetailedApiRequestError; |
| 14 | 14 |
| 15 const core.String USER_AGENT = 'dart-api-client script/v1'; | 15 const core.String USER_AGENT = 'dart-api-client script/v1'; |
| 16 | 16 |
| 17 /** Executes functions in Google Apps Script projects. */ | 17 /// Executes functions in Google Apps Script projects. |
| 18 class ScriptApi { | 18 class ScriptApi { |
| 19 /** Read, send, delete, and manage your email */ | 19 /// Read, send, delete, and manage your email |
| 20 static const MailGoogleComScope = "https://mail.google.com/"; | 20 static const MailGoogleComScope = "https://mail.google.com/"; |
| 21 | 21 |
| 22 /** Manage your calendars */ | 22 /// Manage your calendars |
| 23 static const WwwGoogleComCalendarFeedsScope = "https://www.google.com/calendar
/feeds"; | 23 static const WwwGoogleComCalendarFeedsScope = |
| 24 "https://www.google.com/calendar/feeds"; |
| 24 | 25 |
| 25 /** Manage your contacts */ | 26 /// Manage your contacts |
| 26 static const WwwGoogleComM8FeedsScope = "https://www.google.com/m8/feeds"; | 27 static const WwwGoogleComM8FeedsScope = "https://www.google.com/m8/feeds"; |
| 27 | 28 |
| 28 /** View and manage the provisioning of groups on your domain */ | 29 /// View and manage the provisioning of groups on your domain |
| 29 static const AdminDirectoryGroupScope = "https://www.googleapis.com/auth/admin
.directory.group"; | 30 static const AdminDirectoryGroupScope = |
| 31 "https://www.googleapis.com/auth/admin.directory.group"; |
| 30 | 32 |
| 31 /** View and manage the provisioning of users on your domain */ | 33 /// View and manage the provisioning of users on your domain |
| 32 static const AdminDirectoryUserScope = "https://www.googleapis.com/auth/admin.
directory.user"; | 34 static const AdminDirectoryUserScope = |
| 35 "https://www.googleapis.com/auth/admin.directory.user"; |
| 33 | 36 |
| 34 /** View and manage the files in your Google Drive */ | 37 /// View and manage the files in your Google Drive |
| 35 static const DriveScope = "https://www.googleapis.com/auth/drive"; | 38 static const DriveScope = "https://www.googleapis.com/auth/drive"; |
| 36 | 39 |
| 37 /** View and manage your forms in Google Drive */ | 40 /// View and manage your forms in Google Drive |
| 38 static const FormsScope = "https://www.googleapis.com/auth/forms"; | 41 static const FormsScope = "https://www.googleapis.com/auth/forms"; |
| 39 | 42 |
| 40 /** View and manage forms that this application has been installed in */ | 43 /// View and manage forms that this application has been installed in |
| 41 static const FormsCurrentonlyScope = "https://www.googleapis.com/auth/forms.cu
rrentonly"; | 44 static const FormsCurrentonlyScope = |
| 45 "https://www.googleapis.com/auth/forms.currentonly"; |
| 42 | 46 |
| 43 /** View and manage your Google Groups */ | 47 /// View and manage your Google Groups |
| 44 static const GroupsScope = "https://www.googleapis.com/auth/groups"; | 48 static const GroupsScope = "https://www.googleapis.com/auth/groups"; |
| 45 | 49 |
| 46 /** View and manage your spreadsheets in Google Drive */ | 50 /// View and manage your spreadsheets in Google Drive |
| 47 static const SpreadsheetsScope = "https://www.googleapis.com/auth/spreadsheets
"; | 51 static const SpreadsheetsScope = |
| 52 "https://www.googleapis.com/auth/spreadsheets"; |
| 48 | 53 |
| 49 /** View your email address */ | 54 /// View your email address |
| 50 static const UserinfoEmailScope = "https://www.googleapis.com/auth/userinfo.em
ail"; | 55 static const UserinfoEmailScope = |
| 51 | 56 "https://www.googleapis.com/auth/userinfo.email"; |
| 52 | 57 |
| 53 final commons.ApiRequester _requester; | 58 final commons.ApiRequester _requester; |
| 54 | 59 |
| 55 ScriptsResourceApi get scripts => new ScriptsResourceApi(_requester); | 60 ScriptsResourceApi get scripts => new ScriptsResourceApi(_requester); |
| 56 | 61 |
| 57 ScriptApi(http.Client client, {core.String rootUrl: "https://script.googleapis
.com/", core.String servicePath: ""}) : | 62 ScriptApi(http.Client client, |
| 58 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); | 63 {core.String rootUrl: "https://script.googleapis.com/", |
| 64 core.String servicePath: ""}) |
| 65 : _requester = |
| 66 new commons.ApiRequester(client, rootUrl, servicePath, USER_AGENT); |
| 59 } | 67 } |
| 60 | 68 |
| 61 | |
| 62 class ScriptsResourceApi { | 69 class ScriptsResourceApi { |
| 63 final commons.ApiRequester _requester; | 70 final commons.ApiRequester _requester; |
| 64 | 71 |
| 65 ScriptsResourceApi(commons.ApiRequester client) : | 72 ScriptsResourceApi(commons.ApiRequester client) : _requester = client; |
| 66 _requester = client; | |
| 67 | 73 |
| 68 /** | 74 /// Runs a function in an Apps Script project. The project must be deployed |
| 69 * Runs a function in an Apps Script project. The project must be deployed | 75 /// for use with the Apps Script Execution API. |
| 70 * for use with the Apps Script Execution API. | 76 /// |
| 71 * | 77 /// This method requires authorization with an OAuth 2.0 token that includes |
| 72 * This method requires authorization with an OAuth 2.0 token that includes at | 78 /// at |
| 73 * least one of the scopes listed in the [Authorization](#authorization) | 79 /// least one of the scopes listed in the [Authorization](#authorization) |
| 74 * section; script projects that do not require authorization cannot be | 80 /// section; script projects that do not require authorization cannot be |
| 75 * executed through this API. To find the correct scopes to include in the | 81 /// executed through this API. To find the correct scopes to include in the |
| 76 * authentication token, open the project in the script editor, then select | 82 /// authentication token, open the project in the script editor, then select |
| 77 * **File > Project properties** and click the **Scopes** tab. | 83 /// **File > Project properties** and click the **Scopes** tab. |
| 78 * | 84 /// |
| 79 * [request] - The metadata request object. | 85 /// [request] - The metadata request object. |
| 80 * | 86 /// |
| 81 * Request parameters: | 87 /// Request parameters: |
| 82 * | 88 /// |
| 83 * [scriptId] - The script ID of the script to be executed. To find the script | 89 /// [scriptId] - The script ID of the script to be executed. To find the |
| 84 * ID, open | 90 /// script ID, open |
| 85 * the project in the script editor and select **File > Project properties**. | 91 /// the project in the script editor and select **File > Project |
| 86 * | 92 /// properties**. |
| 87 * Completes with a [Operation]. | 93 /// |
| 88 * | 94 /// Completes with a [Operation]. |
| 89 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 95 /// |
| 90 * error. | 96 /// Completes with a [commons.ApiRequestError] if the API endpoint returned |
| 91 * | 97 /// an error. |
| 92 * If the used [http.Client] completes with an error when making a REST call, | 98 /// |
| 93 * this method will complete with the same error. | 99 /// If the used [http.Client] completes with an error when making a REST |
| 94 */ | 100 /// call, this method will complete with the same error. |
| 95 async.Future<Operation> run(ExecutionRequest request, core.String scriptId) { | 101 async.Future<Operation> run(ExecutionRequest request, core.String scriptId) { |
| 96 var _url = null; | 102 var _url = null; |
| 97 var _queryParams = new core.Map(); | 103 var _queryParams = new core.Map(); |
| 98 var _uploadMedia = null; | 104 var _uploadMedia = null; |
| 99 var _uploadOptions = null; | 105 var _uploadOptions = null; |
| 100 var _downloadOptions = commons.DownloadOptions.Metadata; | 106 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 101 var _body = null; | 107 var _body = null; |
| 102 | 108 |
| 103 if (request != null) { | 109 if (request != null) { |
| 104 _body = convert.JSON.encode((request).toJson()); | 110 _body = convert.JSON.encode((request).toJson()); |
| 105 } | 111 } |
| 106 if (scriptId == null) { | 112 if (scriptId == null) { |
| 107 throw new core.ArgumentError("Parameter scriptId is required."); | 113 throw new core.ArgumentError("Parameter scriptId is required."); |
| 108 } | 114 } |
| 109 | 115 |
| 110 _url = 'v1/scripts/' + commons.Escaper.ecapeVariable('$scriptId') + ':run'; | 116 _url = 'v1/scripts/' + commons.Escaper.ecapeVariable('$scriptId') + ':run'; |
| 111 | 117 |
| 112 var _response = _requester.request(_url, | 118 var _response = _requester.request(_url, "POST", |
| 113 "POST", | 119 body: _body, |
| 114 body: _body, | 120 queryParams: _queryParams, |
| 115 queryParams: _queryParams, | 121 uploadOptions: _uploadOptions, |
| 116 uploadOptions: _uploadOptions, | 122 uploadMedia: _uploadMedia, |
| 117 uploadMedia: _uploadMedia, | 123 downloadOptions: _downloadOptions); |
| 118 downloadOptions: _downloadOptions); | |
| 119 return _response.then((data) => new Operation.fromJson(data)); | 124 return _response.then((data) => new Operation.fromJson(data)); |
| 120 } | 125 } |
| 121 | |
| 122 } | 126 } |
| 123 | 127 |
| 128 /// An object that provides information about the nature of an error in the |
| 129 /// Apps |
| 130 /// Script Execution API. If an |
| 131 /// `run` call succeeds but the |
| 132 /// script function (or Apps Script itself) throws an exception, the response |
| 133 /// body's `error` field contains a |
| 134 /// `Status` object. The `Status` object's `details` field |
| 135 /// contains an array with a single one of these `ExecutionError` objects. |
| 136 class ExecutionError { |
| 137 /// The error message thrown by Apps Script, usually localized into the |
| 138 /// user's |
| 139 /// language. |
| 140 core.String errorMessage; |
| 124 | 141 |
| 142 /// The error type, for example `TypeError` or `ReferenceError`. If the error |
| 143 /// type is unavailable, this field is not included. |
| 144 core.String errorType; |
| 125 | 145 |
| 126 /** | 146 /// An array of objects that provide a stack trace through the script to show |
| 127 * An object that provides information about the nature of an error in the Apps | 147 /// where the execution failed, with the deepest call first. |
| 128 * Script Execution API. If an | |
| 129 * `run` call succeeds but the | |
| 130 * script function (or Apps Script itself) throws an exception, the response | |
| 131 * body's `error` field contains a | |
| 132 * `Status` object. The `Status` object's `details` field | |
| 133 * contains an array with a single one of these `ExecutionError` objects. | |
| 134 */ | |
| 135 class ExecutionError { | |
| 136 /** | |
| 137 * The error message thrown by Apps Script, usually localized into the user's | |
| 138 * language. | |
| 139 */ | |
| 140 core.String errorMessage; | |
| 141 /** | |
| 142 * The error type, for example `TypeError` or `ReferenceError`. If the error | |
| 143 * type is unavailable, this field is not included. | |
| 144 */ | |
| 145 core.String errorType; | |
| 146 /** | |
| 147 * An array of objects that provide a stack trace through the script to show | |
| 148 * where the execution failed, with the deepest call first. | |
| 149 */ | |
| 150 core.List<ScriptStackTraceElement> scriptStackTraceElements; | 148 core.List<ScriptStackTraceElement> scriptStackTraceElements; |
| 151 | 149 |
| 152 ExecutionError(); | 150 ExecutionError(); |
| 153 | 151 |
| 154 ExecutionError.fromJson(core.Map _json) { | 152 ExecutionError.fromJson(core.Map _json) { |
| 155 if (_json.containsKey("errorMessage")) { | 153 if (_json.containsKey("errorMessage")) { |
| 156 errorMessage = _json["errorMessage"]; | 154 errorMessage = _json["errorMessage"]; |
| 157 } | 155 } |
| 158 if (_json.containsKey("errorType")) { | 156 if (_json.containsKey("errorType")) { |
| 159 errorType = _json["errorType"]; | 157 errorType = _json["errorType"]; |
| 160 } | 158 } |
| 161 if (_json.containsKey("scriptStackTraceElements")) { | 159 if (_json.containsKey("scriptStackTraceElements")) { |
| 162 scriptStackTraceElements = _json["scriptStackTraceElements"].map((value) =
> new ScriptStackTraceElement.fromJson(value)).toList(); | 160 scriptStackTraceElements = _json["scriptStackTraceElements"] |
| 161 .map((value) => new ScriptStackTraceElement.fromJson(value)) |
| 162 .toList(); |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 | 165 |
| 166 core.Map<core.String, core.Object> toJson() { | 166 core.Map<core.String, core.Object> toJson() { |
| 167 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 167 final core.Map<core.String, core.Object> _json = |
| 168 new core.Map<core.String, core.Object>(); |
| 168 if (errorMessage != null) { | 169 if (errorMessage != null) { |
| 169 _json["errorMessage"] = errorMessage; | 170 _json["errorMessage"] = errorMessage; |
| 170 } | 171 } |
| 171 if (errorType != null) { | 172 if (errorType != null) { |
| 172 _json["errorType"] = errorType; | 173 _json["errorType"] = errorType; |
| 173 } | 174 } |
| 174 if (scriptStackTraceElements != null) { | 175 if (scriptStackTraceElements != null) { |
| 175 _json["scriptStackTraceElements"] = scriptStackTraceElements.map((value) =
> (value).toJson()).toList(); | 176 _json["scriptStackTraceElements"] = |
| 177 scriptStackTraceElements.map((value) => (value).toJson()).toList(); |
| 176 } | 178 } |
| 177 return _json; | 179 return _json; |
| 178 } | 180 } |
| 179 } | 181 } |
| 180 | 182 |
| 181 /** | 183 /// A request to run the function in a script. The script is identified by the |
| 182 * A request to run the function in a script. The script is identified by the | 184 /// specified `script_id`. Executing a function on a script returns results |
| 183 * specified `script_id`. Executing a function on a script returns results | 185 /// based on the implementation of the script. |
| 184 * based on the implementation of the script. | |
| 185 */ | |
| 186 class ExecutionRequest { | 186 class ExecutionRequest { |
| 187 /** | 187 /// If `true` and the user is an owner of the script, the script runs at the |
| 188 * If `true` and the user is an owner of the script, the script runs at the | 188 /// most recently saved version rather than the version deployed for use with |
| 189 * most recently saved version rather than the version deployed for use with | 189 /// the Execution API. Optional; default is `false`. |
| 190 * the Execution API. Optional; default is `false`. | |
| 191 */ | |
| 192 core.bool devMode; | 190 core.bool devMode; |
| 193 /** | 191 |
| 194 * The name of the function to execute in the given script. The name does not | 192 /// The name of the function to execute in the given script. The name does |
| 195 * include parentheses or parameters. | 193 /// not |
| 196 */ | 194 /// include parentheses or parameters. |
| 197 core.String function; | 195 core.String function; |
| 198 /** | 196 |
| 199 * The parameters to be passed to the function being executed. The object type | 197 /// The parameters to be passed to the function being executed. The object |
| 200 * for each parameter should match the expected type in Apps Script. | 198 /// type |
| 201 * Parameters cannot be Apps Script-specific object types (such as a | 199 /// for each parameter should match the expected type in Apps Script. |
| 202 * `Document` or a `Calendar`); they can only be primitive types such as | 200 /// Parameters cannot be Apps Script-specific object types (such as a |
| 203 * `string`, `number`, `array`, `object`, or `boolean`. Optional. | 201 /// `Document` or a `Calendar`); they can only be primitive types such as |
| 204 * | 202 /// `string`, `number`, `array`, `object`, or `boolean`. Optional. |
| 205 * The values for Object must be JSON objects. It can consist of `num`, | 203 /// |
| 206 * `String`, `bool` and `null` as well as `Map` and `List` values. | 204 /// The values for Object must be JSON objects. It can consist of `num`, |
| 207 */ | 205 /// `String`, `bool` and `null` as well as `Map` and `List` values. |
| 208 core.List<core.Object> parameters; | 206 core.List<core.Object> parameters; |
| 209 /** | 207 |
| 210 * For Android add-ons only. An ID that represents the user's current session | 208 /// For Android add-ons only. An ID that represents the user's current |
| 211 * in the Android app for Google Docs or Sheets, included as extra data in the | 209 /// session |
| 212 * [`Intent`](https://developer.android.com/guide/components/intents-filters.h
tml) | 210 /// in the Android app for Google Docs or Sheets, included as extra data in |
| 213 * that launches the add-on. When an Android add-on is run with a session | 211 /// the |
| 214 * state, it gains the privileges of a | 212 /// [`Intent`](https://developer.android.com/guide/components/intents-filters.
html) |
| 215 * [bound](https://developers.google.com/apps-script/guides/bound) script | 213 /// that launches the add-on. When an Android add-on is run with a session |
| 216 * — | 214 /// state, it gains the privileges of a |
| 217 * that is, it can access information like the user's current cursor position | 215 /// [bound](https://developers.google.com/apps-script/guides/bound) script |
| 218 * (in Docs) or selected cell (in Sheets). To retrieve the state, call | 216 /// — |
| 219 * `Intent.getStringExtra("com.google.android.apps.docs.addons.SessionState")`
. | 217 /// that is, it can access information like the user's current cursor |
| 220 * Optional. | 218 /// position |
| 221 */ | 219 /// (in Docs) or selected cell (in Sheets). To retrieve the state, call |
| 220 /// `Intent.getStringExtra("com.google.android.apps.docs.addons.SessionState")
`. |
| 221 /// Optional. |
| 222 core.String sessionState; | 222 core.String sessionState; |
| 223 | 223 |
| 224 ExecutionRequest(); | 224 ExecutionRequest(); |
| 225 | 225 |
| 226 ExecutionRequest.fromJson(core.Map _json) { | 226 ExecutionRequest.fromJson(core.Map _json) { |
| 227 if (_json.containsKey("devMode")) { | 227 if (_json.containsKey("devMode")) { |
| 228 devMode = _json["devMode"]; | 228 devMode = _json["devMode"]; |
| 229 } | 229 } |
| 230 if (_json.containsKey("function")) { | 230 if (_json.containsKey("function")) { |
| 231 function = _json["function"]; | 231 function = _json["function"]; |
| 232 } | 232 } |
| 233 if (_json.containsKey("parameters")) { | 233 if (_json.containsKey("parameters")) { |
| 234 parameters = _json["parameters"]; | 234 parameters = _json["parameters"]; |
| 235 } | 235 } |
| 236 if (_json.containsKey("sessionState")) { | 236 if (_json.containsKey("sessionState")) { |
| 237 sessionState = _json["sessionState"]; | 237 sessionState = _json["sessionState"]; |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 | 240 |
| 241 core.Map<core.String, core.Object> toJson() { | 241 core.Map<core.String, core.Object> toJson() { |
| 242 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 242 final core.Map<core.String, core.Object> _json = |
| 243 new core.Map<core.String, core.Object>(); |
| 243 if (devMode != null) { | 244 if (devMode != null) { |
| 244 _json["devMode"] = devMode; | 245 _json["devMode"] = devMode; |
| 245 } | 246 } |
| 246 if (function != null) { | 247 if (function != null) { |
| 247 _json["function"] = function; | 248 _json["function"] = function; |
| 248 } | 249 } |
| 249 if (parameters != null) { | 250 if (parameters != null) { |
| 250 _json["parameters"] = parameters; | 251 _json["parameters"] = parameters; |
| 251 } | 252 } |
| 252 if (sessionState != null) { | 253 if (sessionState != null) { |
| 253 _json["sessionState"] = sessionState; | 254 _json["sessionState"] = sessionState; |
| 254 } | 255 } |
| 255 return _json; | 256 return _json; |
| 256 } | 257 } |
| 257 } | 258 } |
| 258 | 259 |
| 259 /** | 260 /// An object that provides the return value of a function executed through the |
| 260 * An object that provides the return value of a function executed through the | 261 /// Apps Script Execution API. If a |
| 261 * Apps Script Execution API. If a | 262 /// `run` call succeeds and the |
| 262 * `run` call succeeds and the | 263 /// script function returns successfully, the response body's |
| 263 * script function returns successfully, the response body's | 264 /// `response` field contains this |
| 264 * `response` field contains this | 265 /// `ExecutionResponse` object. |
| 265 * `ExecutionResponse` object. | |
| 266 */ | |
| 267 class ExecutionResponse { | 266 class ExecutionResponse { |
| 268 /** | 267 /// The return value of the script function. The type matches the object type |
| 269 * The return value of the script function. The type matches the object type | 268 /// returned in Apps Script. Functions called through the Execution API |
| 270 * returned in Apps Script. Functions called through the Execution API cannot | 269 /// cannot |
| 271 * return Apps Script-specific objects (such as a `Document` or a `Calendar`); | 270 /// return Apps Script-specific objects (such as a `Document` or a |
| 272 * they can only return primitive types such as a `string`, `number`, `array`, | 271 /// `Calendar`); |
| 273 * `object`, or `boolean`. | 272 /// they can only return primitive types such as a `string`, `number`, |
| 274 * | 273 /// `array`, |
| 275 * The values for Object must be JSON objects. It can consist of `num`, | 274 /// `object`, or `boolean`. |
| 276 * `String`, `bool` and `null` as well as `Map` and `List` values. | 275 /// |
| 277 */ | 276 /// The values for Object must be JSON objects. It can consist of `num`, |
| 277 /// `String`, `bool` and `null` as well as `Map` and `List` values. |
| 278 core.Object result; | 278 core.Object result; |
| 279 | 279 |
| 280 ExecutionResponse(); | 280 ExecutionResponse(); |
| 281 | 281 |
| 282 ExecutionResponse.fromJson(core.Map _json) { | 282 ExecutionResponse.fromJson(core.Map _json) { |
| 283 if (_json.containsKey("result")) { | 283 if (_json.containsKey("result")) { |
| 284 result = _json["result"]; | 284 result = _json["result"]; |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 | 287 |
| 288 core.Map<core.String, core.Object> toJson() { | 288 core.Map<core.String, core.Object> toJson() { |
| 289 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 289 final core.Map<core.String, core.Object> _json = |
| 290 new core.Map<core.String, core.Object>(); |
| 290 if (result != null) { | 291 if (result != null) { |
| 291 _json["result"] = result; | 292 _json["result"] = result; |
| 292 } | 293 } |
| 293 return _json; | 294 return _json; |
| 294 } | 295 } |
| 295 } | 296 } |
| 296 | 297 |
| 297 /** | 298 /// The response will not arrive until the function finishes executing. The |
| 298 * The response will not arrive until the function finishes executing. The | 299 /// maximum runtime is listed in the guide to [limitations in Apps |
| 299 * maximum runtime is listed in the guide to [limitations in Apps | 300 /// Script](https://developers.google.com/apps-script/guides/services/quotas#cur
rent_limitations). |
| 300 * Script](https://developers.google.com/apps-script/guides/services/quotas#curr
ent_limitations). | 301 /// <p>If the script function returns successfully, the `response` field will |
| 301 * <p>If the script function returns successfully, the `response` field will | 302 /// contain an `ExecutionResponse` object with the function's return value in |
| 302 * contain an `ExecutionResponse` object with the function's return value in the | 303 /// the object's `result` field.</p> |
| 303 * object's `result` field.</p> | 304 /// <p>If the script function (or Apps Script itself) throws an exception, the |
| 304 * <p>If the script function (or Apps Script itself) throws an exception, the | 305 /// `error` field will contain a `Status` object. The `Status` object's |
| 305 * `error` field will contain a `Status` object. The `Status` object's `details` | 306 /// `details` field will contain an array with a single `ExecutionError` object |
| 306 * field will contain an array with a single `ExecutionError` object that | 307 /// that provides information about the nature of the error.</p> |
| 307 * provides information about the nature of the error.</p> | 308 /// <p>If the `run` call itself fails (for example, because of a malformed |
| 308 * <p>If the `run` call itself fails (for example, because of a malformed | 309 /// request or an authorization error), the method will return an HTTP response |
| 309 * request or an authorization error), the method will return an HTTP response | 310 /// code in the 4XX range with a different format for the response body. Client |
| 310 * code in the 4XX range with a different format for the response body. Client | 311 /// libraries will automatically convert a 4XX response into an exception |
| 311 * libraries will automatically convert a 4XX response into an exception | 312 /// class.</p> |
| 312 * class.</p> | |
| 313 */ | |
| 314 class Operation { | 313 class Operation { |
| 315 /** | 314 /// This field is only used with asynchronous executions and indicates |
| 316 * This field is only used with asynchronous executions and indicates whether | 315 /// whether or not the script execution has completed. A completed execution |
| 317 * or not the script execution has completed. A completed execution has a | 316 /// has a populated response field containing the `ExecutionResponse` from |
| 318 * populated response field containing the `ExecutionResponse` from function | 317 /// function that was executed. |
| 319 * that was executed. | |
| 320 */ | |
| 321 core.bool done; | 318 core.bool done; |
| 322 /** | 319 |
| 323 * If a `run` call succeeds but the script function (or Apps Script itself) | 320 /// If a `run` call succeeds but the script function (or Apps Script itself) |
| 324 * throws an exception, this field will contain a `Status` object. The | 321 /// throws an exception, this field will contain a `Status` object. The |
| 325 * `Status` object's `details` field will contain an array with a single | 322 /// `Status` object's `details` field will contain an array with a single |
| 326 * `ExecutionError` object that provides information about the nature of the | 323 /// `ExecutionError` object that provides information about the nature of the |
| 327 * error. | 324 /// error. |
| 328 */ | |
| 329 Status error; | 325 Status error; |
| 330 /** | 326 |
| 331 * This field is not used. | 327 /// This field is not used. |
| 332 * | 328 /// |
| 333 * The values for Object must be JSON objects. It can consist of `num`, | 329 /// The values for Object must be JSON objects. It can consist of `num`, |
| 334 * `String`, `bool` and `null` as well as `Map` and `List` values. | 330 /// `String`, `bool` and `null` as well as `Map` and `List` values. |
| 335 */ | |
| 336 core.Map<core.String, core.Object> metadata; | 331 core.Map<core.String, core.Object> metadata; |
| 337 /** | 332 |
| 338 * This field is only used with asynchronous executions and contains a unique | 333 /// If the script function returns successfully, this field will contain an |
| 339 * identifier that can be used to subsequently invoke a `get` `cancel` or | 334 /// `ExecutionResponse` object with the function's return value as the |
| 340 * `join` on the asynchronous script execution identified by this name. | 335 /// object's `result` field. |
| 341 */ | 336 /// |
| 342 core.String name; | 337 /// The values for Object must be JSON objects. It can consist of `num`, |
| 343 /** | 338 /// `String`, `bool` and `null` as well as `Map` and `List` values. |
| 344 * If the script function returns successfully, this field will contain an | |
| 345 * `ExecutionResponse` object with the function's return value as the object's | |
| 346 * `result` field. | |
| 347 * | |
| 348 * The values for Object must be JSON objects. It can consist of `num`, | |
| 349 * `String`, `bool` and `null` as well as `Map` and `List` values. | |
| 350 */ | |
| 351 core.Map<core.String, core.Object> response; | 339 core.Map<core.String, core.Object> response; |
| 352 | 340 |
| 353 Operation(); | 341 Operation(); |
| 354 | 342 |
| 355 Operation.fromJson(core.Map _json) { | 343 Operation.fromJson(core.Map _json) { |
| 356 if (_json.containsKey("done")) { | 344 if (_json.containsKey("done")) { |
| 357 done = _json["done"]; | 345 done = _json["done"]; |
| 358 } | 346 } |
| 359 if (_json.containsKey("error")) { | 347 if (_json.containsKey("error")) { |
| 360 error = new Status.fromJson(_json["error"]); | 348 error = new Status.fromJson(_json["error"]); |
| 361 } | 349 } |
| 362 if (_json.containsKey("metadata")) { | 350 if (_json.containsKey("metadata")) { |
| 363 metadata = _json["metadata"]; | 351 metadata = _json["metadata"]; |
| 364 } | 352 } |
| 365 if (_json.containsKey("name")) { | |
| 366 name = _json["name"]; | |
| 367 } | |
| 368 if (_json.containsKey("response")) { | 353 if (_json.containsKey("response")) { |
| 369 response = _json["response"]; | 354 response = _json["response"]; |
| 370 } | 355 } |
| 371 } | 356 } |
| 372 | 357 |
| 373 core.Map<core.String, core.Object> toJson() { | 358 core.Map<core.String, core.Object> toJson() { |
| 374 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 359 final core.Map<core.String, core.Object> _json = |
| 360 new core.Map<core.String, core.Object>(); |
| 375 if (done != null) { | 361 if (done != null) { |
| 376 _json["done"] = done; | 362 _json["done"] = done; |
| 377 } | 363 } |
| 378 if (error != null) { | 364 if (error != null) { |
| 379 _json["error"] = (error).toJson(); | 365 _json["error"] = (error).toJson(); |
| 380 } | 366 } |
| 381 if (metadata != null) { | 367 if (metadata != null) { |
| 382 _json["metadata"] = metadata; | 368 _json["metadata"] = metadata; |
| 383 } | 369 } |
| 384 if (name != null) { | |
| 385 _json["name"] = name; | |
| 386 } | |
| 387 if (response != null) { | 370 if (response != null) { |
| 388 _json["response"] = response; | 371 _json["response"] = response; |
| 389 } | 372 } |
| 390 return _json; | 373 return _json; |
| 391 } | 374 } |
| 392 } | 375 } |
| 393 | 376 |
| 394 /** A stack trace through the script that shows where the execution failed. */ | 377 /// A stack trace through the script that shows where the execution failed. |
| 395 class ScriptStackTraceElement { | 378 class ScriptStackTraceElement { |
| 396 /** The name of the function that failed. */ | 379 /// The name of the function that failed. |
| 397 core.String function; | 380 core.String function; |
| 398 /** The line number where the script failed. */ | 381 |
| 382 /// The line number where the script failed. |
| 399 core.int lineNumber; | 383 core.int lineNumber; |
| 400 | 384 |
| 401 ScriptStackTraceElement(); | 385 ScriptStackTraceElement(); |
| 402 | 386 |
| 403 ScriptStackTraceElement.fromJson(core.Map _json) { | 387 ScriptStackTraceElement.fromJson(core.Map _json) { |
| 404 if (_json.containsKey("function")) { | 388 if (_json.containsKey("function")) { |
| 405 function = _json["function"]; | 389 function = _json["function"]; |
| 406 } | 390 } |
| 407 if (_json.containsKey("lineNumber")) { | 391 if (_json.containsKey("lineNumber")) { |
| 408 lineNumber = _json["lineNumber"]; | 392 lineNumber = _json["lineNumber"]; |
| 409 } | 393 } |
| 410 } | 394 } |
| 411 | 395 |
| 412 core.Map<core.String, core.Object> toJson() { | 396 core.Map<core.String, core.Object> toJson() { |
| 413 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 397 final core.Map<core.String, core.Object> _json = |
| 398 new core.Map<core.String, core.Object>(); |
| 414 if (function != null) { | 399 if (function != null) { |
| 415 _json["function"] = function; | 400 _json["function"] = function; |
| 416 } | 401 } |
| 417 if (lineNumber != null) { | 402 if (lineNumber != null) { |
| 418 _json["lineNumber"] = lineNumber; | 403 _json["lineNumber"] = lineNumber; |
| 419 } | 404 } |
| 420 return _json; | 405 return _json; |
| 421 } | 406 } |
| 422 } | 407 } |
| 423 | 408 |
| 424 /** | 409 /// If a `run` call succeeds but the script function (or Apps Script itself) |
| 425 * If a `run` call succeeds but the script function (or Apps Script itself) | 410 /// throws an exception, the response body's `error` field will contain this |
| 426 * throws an exception, the response body's `error` field will contain this | 411 /// `Status` object. |
| 427 * `Status` object. | |
| 428 */ | |
| 429 class Status { | 412 class Status { |
| 430 /** | 413 /// The status code. For this API, this value will always be 3, corresponding |
| 431 * The status code. For this API, this value will always be 3, corresponding | 414 /// to an <code>INVALID_ARGUMENT</code> error. |
| 432 * to an <code>INVALID_ARGUMENT</code> error. | |
| 433 */ | |
| 434 core.int code; | 415 core.int code; |
| 435 /** | 416 |
| 436 * An array that contains a single `ExecutionError` object that provides | 417 /// An array that contains a single `ExecutionError` object that provides |
| 437 * information about the nature of the error. | 418 /// information about the nature of the error. |
| 438 * | 419 /// |
| 439 * The values for Object must be JSON objects. It can consist of `num`, | 420 /// The values for Object must be JSON objects. It can consist of `num`, |
| 440 * `String`, `bool` and `null` as well as `Map` and `List` values. | 421 /// `String`, `bool` and `null` as well as `Map` and `List` values. |
| 441 */ | |
| 442 core.List<core.Map<core.String, core.Object>> details; | 422 core.List<core.Map<core.String, core.Object>> details; |
| 443 /** | 423 |
| 444 * A developer-facing error message, which is in English. Any user-facing | 424 /// A developer-facing error message, which is in English. Any user-facing |
| 445 * error message is localized and sent in the | 425 /// error message is localized and sent in the |
| 446 * [`google.rpc.Status.details`](google.rpc.Status.details) field, or | 426 /// [`google.rpc.Status.details`](google.rpc.Status.details) field, or |
| 447 * localized by the client. | 427 /// localized by the client. |
| 448 */ | |
| 449 core.String message; | 428 core.String message; |
| 450 | 429 |
| 451 Status(); | 430 Status(); |
| 452 | 431 |
| 453 Status.fromJson(core.Map _json) { | 432 Status.fromJson(core.Map _json) { |
| 454 if (_json.containsKey("code")) { | 433 if (_json.containsKey("code")) { |
| 455 code = _json["code"]; | 434 code = _json["code"]; |
| 456 } | 435 } |
| 457 if (_json.containsKey("details")) { | 436 if (_json.containsKey("details")) { |
| 458 details = _json["details"]; | 437 details = _json["details"]; |
| 459 } | 438 } |
| 460 if (_json.containsKey("message")) { | 439 if (_json.containsKey("message")) { |
| 461 message = _json["message"]; | 440 message = _json["message"]; |
| 462 } | 441 } |
| 463 } | 442 } |
| 464 | 443 |
| 465 core.Map<core.String, core.Object> toJson() { | 444 core.Map<core.String, core.Object> toJson() { |
| 466 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 445 final core.Map<core.String, core.Object> _json = |
| 446 new core.Map<core.String, core.Object>(); |
| 467 if (code != null) { | 447 if (code != null) { |
| 468 _json["code"] = code; | 448 _json["code"] = code; |
| 469 } | 449 } |
| 470 if (details != null) { | 450 if (details != null) { |
| 471 _json["details"] = details; | 451 _json["details"] = details; |
| 472 } | 452 } |
| 473 if (message != null) { | 453 if (message != null) { |
| 474 _json["message"] = message; | 454 _json["message"] = message; |
| 475 } | 455 } |
| 476 return _json; | 456 return _json; |
| 477 } | 457 } |
| 478 } | 458 } |
| OLD | NEW |