google-apis-script_v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,686 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of 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,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module ScriptV1
23
+ # Apps Script API
24
+ #
25
+ # Manages and executes Google Apps Script projects.
26
+ #
27
+ # @example
28
+ # require 'google/apis/script_v1'
29
+ #
30
+ # Script = Google::Apis::ScriptV1 # Alias the module
31
+ # service = Script::ScriptService.new
32
+ #
33
+ # @see https://developers.google.com/apps-script/api/
34
+ class ScriptService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://script.googleapis.com/', '',
47
+ client_name: 'google-apis-script_v1',
48
+ client_version: Google::Apis::ScriptV1::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # List information about processes made by or on behalf of a user, such as
53
+ # process type and current status.
54
+ # @param [Fixnum] page_size
55
+ # The maximum number of returned processes per page of results. Defaults to 50.
56
+ # @param [String] page_token
57
+ # The token for continuing a previous list request on the next page. This should
58
+ # be set to the value of `nextPageToken` from a previous response.
59
+ # @param [String] user_process_filter_deployment_id
60
+ # Optional field used to limit returned processes to those originating from
61
+ # projects with a specific deployment ID.
62
+ # @param [String] user_process_filter_end_time
63
+ # Optional field used to limit returned processes to those that completed on or
64
+ # before the given timestamp.
65
+ # @param [String] user_process_filter_function_name
66
+ # Optional field used to limit returned processes to those originating from a
67
+ # script function with the given function name.
68
+ # @param [String] user_process_filter_project_name
69
+ # Optional field used to limit returned processes to those originating from
70
+ # projects with project names containing a specific string.
71
+ # @param [String] user_process_filter_script_id
72
+ # Optional field used to limit returned processes to those originating from
73
+ # projects with a specific script ID.
74
+ # @param [String] user_process_filter_start_time
75
+ # Optional field used to limit returned processes to those that were started on
76
+ # or after the given timestamp.
77
+ # @param [Array<String>, String] user_process_filter_statuses
78
+ # Optional field used to limit returned processes to those having one of the
79
+ # specified process statuses.
80
+ # @param [Array<String>, String] user_process_filter_types
81
+ # Optional field used to limit returned processes to those having one of the
82
+ # specified process types.
83
+ # @param [Array<String>, String] user_process_filter_user_access_levels
84
+ # Optional field used to limit returned processes to those having one of the
85
+ # specified user access levels.
86
+ # @param [String] fields
87
+ # Selector specifying which fields to include in a partial response.
88
+ # @param [String] quota_user
89
+ # Available to use for quota purposes for server-side applications. Can be any
90
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
91
+ # @param [Google::Apis::RequestOptions] options
92
+ # Request-specific options
93
+ #
94
+ # @yield [result, err] Result & error if block supplied
95
+ # @yieldparam result [Google::Apis::ScriptV1::ListUserProcessesResponse] parsed result object
96
+ # @yieldparam err [StandardError] error object if request failed
97
+ #
98
+ # @return [Google::Apis::ScriptV1::ListUserProcessesResponse]
99
+ #
100
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
101
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
102
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
103
+ def list_processes(page_size: nil, page_token: nil, user_process_filter_deployment_id: nil, user_process_filter_end_time: nil, user_process_filter_function_name: nil, user_process_filter_project_name: nil, user_process_filter_script_id: nil, user_process_filter_start_time: nil, user_process_filter_statuses: nil, user_process_filter_types: nil, user_process_filter_user_access_levels: nil, fields: nil, quota_user: nil, options: nil, &block)
104
+ command = make_simple_command(:get, 'v1/processes', options)
105
+ command.response_representation = Google::Apis::ScriptV1::ListUserProcessesResponse::Representation
106
+ command.response_class = Google::Apis::ScriptV1::ListUserProcessesResponse
107
+ command.query['pageSize'] = page_size unless page_size.nil?
108
+ command.query['pageToken'] = page_token unless page_token.nil?
109
+ command.query['userProcessFilter.deploymentId'] = user_process_filter_deployment_id unless user_process_filter_deployment_id.nil?
110
+ command.query['userProcessFilter.endTime'] = user_process_filter_end_time unless user_process_filter_end_time.nil?
111
+ command.query['userProcessFilter.functionName'] = user_process_filter_function_name unless user_process_filter_function_name.nil?
112
+ command.query['userProcessFilter.projectName'] = user_process_filter_project_name unless user_process_filter_project_name.nil?
113
+ command.query['userProcessFilter.scriptId'] = user_process_filter_script_id unless user_process_filter_script_id.nil?
114
+ command.query['userProcessFilter.startTime'] = user_process_filter_start_time unless user_process_filter_start_time.nil?
115
+ command.query['userProcessFilter.statuses'] = user_process_filter_statuses unless user_process_filter_statuses.nil?
116
+ command.query['userProcessFilter.types'] = user_process_filter_types unless user_process_filter_types.nil?
117
+ command.query['userProcessFilter.userAccessLevels'] = user_process_filter_user_access_levels unless user_process_filter_user_access_levels.nil?
118
+ command.query['fields'] = fields unless fields.nil?
119
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
120
+ execute_or_queue_command(command, &block)
121
+ end
122
+
123
+ # List information about a script's executed processes, such as process type and
124
+ # current status.
125
+ # @param [Fixnum] page_size
126
+ # The maximum number of returned processes per page of results. Defaults to 50.
127
+ # @param [String] page_token
128
+ # The token for continuing a previous list request on the next page. This should
129
+ # be set to the value of `nextPageToken` from a previous response.
130
+ # @param [String] script_id
131
+ # The script ID of the project whose processes are listed.
132
+ # @param [String] script_process_filter_deployment_id
133
+ # Optional field used to limit returned processes to those originating from
134
+ # projects with a specific deployment ID.
135
+ # @param [String] script_process_filter_end_time
136
+ # Optional field used to limit returned processes to those that completed on or
137
+ # before the given timestamp.
138
+ # @param [String] script_process_filter_function_name
139
+ # Optional field used to limit returned processes to those originating from a
140
+ # script function with the given function name.
141
+ # @param [String] script_process_filter_start_time
142
+ # Optional field used to limit returned processes to those that were started on
143
+ # or after the given timestamp.
144
+ # @param [Array<String>, String] script_process_filter_statuses
145
+ # Optional field used to limit returned processes to those having one of the
146
+ # specified process statuses.
147
+ # @param [Array<String>, String] script_process_filter_types
148
+ # Optional field used to limit returned processes to those having one of the
149
+ # specified process types.
150
+ # @param [Array<String>, String] script_process_filter_user_access_levels
151
+ # Optional field used to limit returned processes to those having one of the
152
+ # specified user access levels.
153
+ # @param [String] fields
154
+ # Selector specifying which fields to include in a partial response.
155
+ # @param [String] quota_user
156
+ # Available to use for quota purposes for server-side applications. Can be any
157
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
158
+ # @param [Google::Apis::RequestOptions] options
159
+ # Request-specific options
160
+ #
161
+ # @yield [result, err] Result & error if block supplied
162
+ # @yieldparam result [Google::Apis::ScriptV1::ListScriptProcessesResponse] parsed result object
163
+ # @yieldparam err [StandardError] error object if request failed
164
+ #
165
+ # @return [Google::Apis::ScriptV1::ListScriptProcessesResponse]
166
+ #
167
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
168
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
169
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
170
+ def list_process_script_processes(page_size: nil, page_token: nil, script_id: nil, script_process_filter_deployment_id: nil, script_process_filter_end_time: nil, script_process_filter_function_name: nil, script_process_filter_start_time: nil, script_process_filter_statuses: nil, script_process_filter_types: nil, script_process_filter_user_access_levels: nil, fields: nil, quota_user: nil, options: nil, &block)
171
+ command = make_simple_command(:get, 'v1/processes:listScriptProcesses', options)
172
+ command.response_representation = Google::Apis::ScriptV1::ListScriptProcessesResponse::Representation
173
+ command.response_class = Google::Apis::ScriptV1::ListScriptProcessesResponse
174
+ command.query['pageSize'] = page_size unless page_size.nil?
175
+ command.query['pageToken'] = page_token unless page_token.nil?
176
+ command.query['scriptId'] = script_id unless script_id.nil?
177
+ command.query['scriptProcessFilter.deploymentId'] = script_process_filter_deployment_id unless script_process_filter_deployment_id.nil?
178
+ command.query['scriptProcessFilter.endTime'] = script_process_filter_end_time unless script_process_filter_end_time.nil?
179
+ command.query['scriptProcessFilter.functionName'] = script_process_filter_function_name unless script_process_filter_function_name.nil?
180
+ command.query['scriptProcessFilter.startTime'] = script_process_filter_start_time unless script_process_filter_start_time.nil?
181
+ command.query['scriptProcessFilter.statuses'] = script_process_filter_statuses unless script_process_filter_statuses.nil?
182
+ command.query['scriptProcessFilter.types'] = script_process_filter_types unless script_process_filter_types.nil?
183
+ command.query['scriptProcessFilter.userAccessLevels'] = script_process_filter_user_access_levels unless script_process_filter_user_access_levels.nil?
184
+ command.query['fields'] = fields unless fields.nil?
185
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
186
+ execute_or_queue_command(command, &block)
187
+ end
188
+
189
+ # Creates a new, empty script project with no script files and a base manifest
190
+ # file.
191
+ # @param [Google::Apis::ScriptV1::CreateProjectRequest] create_project_request_object
192
+ # @param [String] fields
193
+ # Selector specifying which fields to include in a partial response.
194
+ # @param [String] quota_user
195
+ # Available to use for quota purposes for server-side applications. Can be any
196
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
197
+ # @param [Google::Apis::RequestOptions] options
198
+ # Request-specific options
199
+ #
200
+ # @yield [result, err] Result & error if block supplied
201
+ # @yieldparam result [Google::Apis::ScriptV1::Project] parsed result object
202
+ # @yieldparam err [StandardError] error object if request failed
203
+ #
204
+ # @return [Google::Apis::ScriptV1::Project]
205
+ #
206
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
207
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
208
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
209
+ def create_project(create_project_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
210
+ command = make_simple_command(:post, 'v1/projects', options)
211
+ command.request_representation = Google::Apis::ScriptV1::CreateProjectRequest::Representation
212
+ command.request_object = create_project_request_object
213
+ command.response_representation = Google::Apis::ScriptV1::Project::Representation
214
+ command.response_class = Google::Apis::ScriptV1::Project
215
+ command.query['fields'] = fields unless fields.nil?
216
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
217
+ execute_or_queue_command(command, &block)
218
+ end
219
+
220
+ # Gets a script project's metadata.
221
+ # @param [String] script_id
222
+ # The script project's Drive ID.
223
+ # @param [String] fields
224
+ # Selector specifying which fields to include in a partial response.
225
+ # @param [String] quota_user
226
+ # Available to use for quota purposes for server-side applications. Can be any
227
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
228
+ # @param [Google::Apis::RequestOptions] options
229
+ # Request-specific options
230
+ #
231
+ # @yield [result, err] Result & error if block supplied
232
+ # @yieldparam result [Google::Apis::ScriptV1::Project] parsed result object
233
+ # @yieldparam err [StandardError] error object if request failed
234
+ #
235
+ # @return [Google::Apis::ScriptV1::Project]
236
+ #
237
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
238
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
239
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
240
+ def get_project(script_id, fields: nil, quota_user: nil, options: nil, &block)
241
+ command = make_simple_command(:get, 'v1/projects/{scriptId}', options)
242
+ command.response_representation = Google::Apis::ScriptV1::Project::Representation
243
+ command.response_class = Google::Apis::ScriptV1::Project
244
+ command.params['scriptId'] = script_id unless script_id.nil?
245
+ command.query['fields'] = fields unless fields.nil?
246
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
247
+ execute_or_queue_command(command, &block)
248
+ end
249
+
250
+ # Gets the content of the script project, including the code source and metadata
251
+ # for each script file.
252
+ # @param [String] script_id
253
+ # The script project's Drive ID.
254
+ # @param [Fixnum] version_number
255
+ # The version number of the project to retrieve. If not provided, the project's
256
+ # HEAD version is returned.
257
+ # @param [String] fields
258
+ # Selector specifying which fields to include in a partial response.
259
+ # @param [String] quota_user
260
+ # Available to use for quota purposes for server-side applications. Can be any
261
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
262
+ # @param [Google::Apis::RequestOptions] options
263
+ # Request-specific options
264
+ #
265
+ # @yield [result, err] Result & error if block supplied
266
+ # @yieldparam result [Google::Apis::ScriptV1::Content] parsed result object
267
+ # @yieldparam err [StandardError] error object if request failed
268
+ #
269
+ # @return [Google::Apis::ScriptV1::Content]
270
+ #
271
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
272
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
273
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
274
+ def get_project_content(script_id, version_number: nil, fields: nil, quota_user: nil, options: nil, &block)
275
+ command = make_simple_command(:get, 'v1/projects/{scriptId}/content', options)
276
+ command.response_representation = Google::Apis::ScriptV1::Content::Representation
277
+ command.response_class = Google::Apis::ScriptV1::Content
278
+ command.params['scriptId'] = script_id unless script_id.nil?
279
+ command.query['versionNumber'] = version_number unless version_number.nil?
280
+ command.query['fields'] = fields unless fields.nil?
281
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
282
+ execute_or_queue_command(command, &block)
283
+ end
284
+
285
+ # Get metrics data for scripts, such as number of executions and active users.
286
+ # @param [String] script_id
287
+ # Required field indicating the script to get metrics for.
288
+ # @param [String] metrics_filter_deployment_id
289
+ # Optional field indicating a specific deployment to retrieve metrics from.
290
+ # @param [String] metrics_granularity
291
+ # Required field indicating what granularity of metrics are returned.
292
+ # @param [String] fields
293
+ # Selector specifying which fields to include in a partial response.
294
+ # @param [String] quota_user
295
+ # Available to use for quota purposes for server-side applications. Can be any
296
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
297
+ # @param [Google::Apis::RequestOptions] options
298
+ # Request-specific options
299
+ #
300
+ # @yield [result, err] Result & error if block supplied
301
+ # @yieldparam result [Google::Apis::ScriptV1::Metrics] parsed result object
302
+ # @yieldparam err [StandardError] error object if request failed
303
+ #
304
+ # @return [Google::Apis::ScriptV1::Metrics]
305
+ #
306
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
307
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
308
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
309
+ def get_project_metrics(script_id, metrics_filter_deployment_id: nil, metrics_granularity: nil, fields: nil, quota_user: nil, options: nil, &block)
310
+ command = make_simple_command(:get, 'v1/projects/{scriptId}/metrics', options)
311
+ command.response_representation = Google::Apis::ScriptV1::Metrics::Representation
312
+ command.response_class = Google::Apis::ScriptV1::Metrics
313
+ command.params['scriptId'] = script_id unless script_id.nil?
314
+ command.query['metricsFilter.deploymentId'] = metrics_filter_deployment_id unless metrics_filter_deployment_id.nil?
315
+ command.query['metricsGranularity'] = metrics_granularity unless metrics_granularity.nil?
316
+ command.query['fields'] = fields unless fields.nil?
317
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
318
+ execute_or_queue_command(command, &block)
319
+ end
320
+
321
+ # Updates the content of the specified script project. This content is stored as
322
+ # the HEAD version, and is used when the script is executed as a trigger, in the
323
+ # script editor, in add-on preview mode, or as a web app or Apps Script API in
324
+ # development mode. This clears all the existing files in the project.
325
+ # @param [String] script_id
326
+ # The script project's Drive ID.
327
+ # @param [Google::Apis::ScriptV1::Content] content_object
328
+ # @param [String] fields
329
+ # Selector specifying which fields to include in a partial response.
330
+ # @param [String] quota_user
331
+ # Available to use for quota purposes for server-side applications. Can be any
332
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
333
+ # @param [Google::Apis::RequestOptions] options
334
+ # Request-specific options
335
+ #
336
+ # @yield [result, err] Result & error if block supplied
337
+ # @yieldparam result [Google::Apis::ScriptV1::Content] parsed result object
338
+ # @yieldparam err [StandardError] error object if request failed
339
+ #
340
+ # @return [Google::Apis::ScriptV1::Content]
341
+ #
342
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
343
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
344
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
345
+ def update_project_content(script_id, content_object = nil, fields: nil, quota_user: nil, options: nil, &block)
346
+ command = make_simple_command(:put, 'v1/projects/{scriptId}/content', options)
347
+ command.request_representation = Google::Apis::ScriptV1::Content::Representation
348
+ command.request_object = content_object
349
+ command.response_representation = Google::Apis::ScriptV1::Content::Representation
350
+ command.response_class = Google::Apis::ScriptV1::Content
351
+ command.params['scriptId'] = script_id unless script_id.nil?
352
+ command.query['fields'] = fields unless fields.nil?
353
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
354
+ execute_or_queue_command(command, &block)
355
+ end
356
+
357
+ # Creates a deployment of an Apps Script project.
358
+ # @param [String] script_id
359
+ # The script project's Drive ID.
360
+ # @param [Google::Apis::ScriptV1::DeploymentConfig] deployment_config_object
361
+ # @param [String] fields
362
+ # Selector specifying which fields to include in a partial response.
363
+ # @param [String] quota_user
364
+ # Available to use for quota purposes for server-side applications. Can be any
365
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
366
+ # @param [Google::Apis::RequestOptions] options
367
+ # Request-specific options
368
+ #
369
+ # @yield [result, err] Result & error if block supplied
370
+ # @yieldparam result [Google::Apis::ScriptV1::Deployment] parsed result object
371
+ # @yieldparam err [StandardError] error object if request failed
372
+ #
373
+ # @return [Google::Apis::ScriptV1::Deployment]
374
+ #
375
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
376
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
377
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
378
+ def create_project_deployment(script_id, deployment_config_object = nil, fields: nil, quota_user: nil, options: nil, &block)
379
+ command = make_simple_command(:post, 'v1/projects/{scriptId}/deployments', options)
380
+ command.request_representation = Google::Apis::ScriptV1::DeploymentConfig::Representation
381
+ command.request_object = deployment_config_object
382
+ command.response_representation = Google::Apis::ScriptV1::Deployment::Representation
383
+ command.response_class = Google::Apis::ScriptV1::Deployment
384
+ command.params['scriptId'] = script_id unless script_id.nil?
385
+ command.query['fields'] = fields unless fields.nil?
386
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
387
+ execute_or_queue_command(command, &block)
388
+ end
389
+
390
+ # Deletes a deployment of an Apps Script project.
391
+ # @param [String] script_id
392
+ # The script project's Drive ID.
393
+ # @param [String] deployment_id
394
+ # The deployment ID to be undeployed.
395
+ # @param [String] fields
396
+ # Selector specifying which fields to include in a partial response.
397
+ # @param [String] quota_user
398
+ # Available to use for quota purposes for server-side applications. Can be any
399
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
400
+ # @param [Google::Apis::RequestOptions] options
401
+ # Request-specific options
402
+ #
403
+ # @yield [result, err] Result & error if block supplied
404
+ # @yieldparam result [Google::Apis::ScriptV1::Empty] parsed result object
405
+ # @yieldparam err [StandardError] error object if request failed
406
+ #
407
+ # @return [Google::Apis::ScriptV1::Empty]
408
+ #
409
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
410
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
411
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
412
+ def delete_project_deployment(script_id, deployment_id, fields: nil, quota_user: nil, options: nil, &block)
413
+ command = make_simple_command(:delete, 'v1/projects/{scriptId}/deployments/{deploymentId}', options)
414
+ command.response_representation = Google::Apis::ScriptV1::Empty::Representation
415
+ command.response_class = Google::Apis::ScriptV1::Empty
416
+ command.params['scriptId'] = script_id unless script_id.nil?
417
+ command.params['deploymentId'] = deployment_id unless deployment_id.nil?
418
+ command.query['fields'] = fields unless fields.nil?
419
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
420
+ execute_or_queue_command(command, &block)
421
+ end
422
+
423
+ # Gets a deployment of an Apps Script project.
424
+ # @param [String] script_id
425
+ # The script project's Drive ID.
426
+ # @param [String] deployment_id
427
+ # The deployment ID.
428
+ # @param [String] fields
429
+ # Selector specifying which fields to include in a partial response.
430
+ # @param [String] quota_user
431
+ # Available to use for quota purposes for server-side applications. Can be any
432
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
433
+ # @param [Google::Apis::RequestOptions] options
434
+ # Request-specific options
435
+ #
436
+ # @yield [result, err] Result & error if block supplied
437
+ # @yieldparam result [Google::Apis::ScriptV1::Deployment] parsed result object
438
+ # @yieldparam err [StandardError] error object if request failed
439
+ #
440
+ # @return [Google::Apis::ScriptV1::Deployment]
441
+ #
442
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
443
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
444
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
445
+ def get_project_deployment(script_id, deployment_id, fields: nil, quota_user: nil, options: nil, &block)
446
+ command = make_simple_command(:get, 'v1/projects/{scriptId}/deployments/{deploymentId}', options)
447
+ command.response_representation = Google::Apis::ScriptV1::Deployment::Representation
448
+ command.response_class = Google::Apis::ScriptV1::Deployment
449
+ command.params['scriptId'] = script_id unless script_id.nil?
450
+ command.params['deploymentId'] = deployment_id unless deployment_id.nil?
451
+ command.query['fields'] = fields unless fields.nil?
452
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
453
+ execute_or_queue_command(command, &block)
454
+ end
455
+
456
+ # Lists the deployments of an Apps Script project.
457
+ # @param [String] script_id
458
+ # The script project's Drive ID.
459
+ # @param [Fixnum] page_size
460
+ # The maximum number of deployments on each returned page. Defaults to 50.
461
+ # @param [String] page_token
462
+ # The token for continuing a previous list request on the next page. This should
463
+ # be set to the value of `nextPageToken` from a previous response.
464
+ # @param [String] fields
465
+ # Selector specifying which fields to include in a partial response.
466
+ # @param [String] quota_user
467
+ # Available to use for quota purposes for server-side applications. Can be any
468
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
469
+ # @param [Google::Apis::RequestOptions] options
470
+ # Request-specific options
471
+ #
472
+ # @yield [result, err] Result & error if block supplied
473
+ # @yieldparam result [Google::Apis::ScriptV1::ListDeploymentsResponse] parsed result object
474
+ # @yieldparam err [StandardError] error object if request failed
475
+ #
476
+ # @return [Google::Apis::ScriptV1::ListDeploymentsResponse]
477
+ #
478
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
479
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
480
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
481
+ def list_project_deployments(script_id, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
482
+ command = make_simple_command(:get, 'v1/projects/{scriptId}/deployments', options)
483
+ command.response_representation = Google::Apis::ScriptV1::ListDeploymentsResponse::Representation
484
+ command.response_class = Google::Apis::ScriptV1::ListDeploymentsResponse
485
+ command.params['scriptId'] = script_id unless script_id.nil?
486
+ command.query['pageSize'] = page_size unless page_size.nil?
487
+ command.query['pageToken'] = page_token unless page_token.nil?
488
+ command.query['fields'] = fields unless fields.nil?
489
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
490
+ execute_or_queue_command(command, &block)
491
+ end
492
+
493
+ # Updates a deployment of an Apps Script project.
494
+ # @param [String] script_id
495
+ # The script project's Drive ID.
496
+ # @param [String] deployment_id
497
+ # The deployment ID for this deployment.
498
+ # @param [Google::Apis::ScriptV1::UpdateDeploymentRequest] update_deployment_request_object
499
+ # @param [String] fields
500
+ # Selector specifying which fields to include in a partial response.
501
+ # @param [String] quota_user
502
+ # Available to use for quota purposes for server-side applications. Can be any
503
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
504
+ # @param [Google::Apis::RequestOptions] options
505
+ # Request-specific options
506
+ #
507
+ # @yield [result, err] Result & error if block supplied
508
+ # @yieldparam result [Google::Apis::ScriptV1::Deployment] parsed result object
509
+ # @yieldparam err [StandardError] error object if request failed
510
+ #
511
+ # @return [Google::Apis::ScriptV1::Deployment]
512
+ #
513
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
514
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
515
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
516
+ def update_deployment(script_id, deployment_id, update_deployment_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
517
+ command = make_simple_command(:put, 'v1/projects/{scriptId}/deployments/{deploymentId}', options)
518
+ command.request_representation = Google::Apis::ScriptV1::UpdateDeploymentRequest::Representation
519
+ command.request_object = update_deployment_request_object
520
+ command.response_representation = Google::Apis::ScriptV1::Deployment::Representation
521
+ command.response_class = Google::Apis::ScriptV1::Deployment
522
+ command.params['scriptId'] = script_id unless script_id.nil?
523
+ command.params['deploymentId'] = deployment_id unless deployment_id.nil?
524
+ command.query['fields'] = fields unless fields.nil?
525
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
526
+ execute_or_queue_command(command, &block)
527
+ end
528
+
529
+ # Creates a new immutable version using the current code, with a unique version
530
+ # number.
531
+ # @param [String] script_id
532
+ # The script project's Drive ID.
533
+ # @param [Google::Apis::ScriptV1::Version] version_object
534
+ # @param [String] fields
535
+ # Selector specifying which fields to include in a partial response.
536
+ # @param [String] quota_user
537
+ # Available to use for quota purposes for server-side applications. Can be any
538
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
539
+ # @param [Google::Apis::RequestOptions] options
540
+ # Request-specific options
541
+ #
542
+ # @yield [result, err] Result & error if block supplied
543
+ # @yieldparam result [Google::Apis::ScriptV1::Version] parsed result object
544
+ # @yieldparam err [StandardError] error object if request failed
545
+ #
546
+ # @return [Google::Apis::ScriptV1::Version]
547
+ #
548
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
549
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
550
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
551
+ def create_project_version(script_id, version_object = nil, fields: nil, quota_user: nil, options: nil, &block)
552
+ command = make_simple_command(:post, 'v1/projects/{scriptId}/versions', options)
553
+ command.request_representation = Google::Apis::ScriptV1::Version::Representation
554
+ command.request_object = version_object
555
+ command.response_representation = Google::Apis::ScriptV1::Version::Representation
556
+ command.response_class = Google::Apis::ScriptV1::Version
557
+ command.params['scriptId'] = script_id unless script_id.nil?
558
+ command.query['fields'] = fields unless fields.nil?
559
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
560
+ execute_or_queue_command(command, &block)
561
+ end
562
+
563
+ # Gets a version of a script project.
564
+ # @param [String] script_id
565
+ # The script project's Drive ID.
566
+ # @param [Fixnum] version_number
567
+ # The version number.
568
+ # @param [String] fields
569
+ # Selector specifying which fields to include in a partial response.
570
+ # @param [String] quota_user
571
+ # Available to use for quota purposes for server-side applications. Can be any
572
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
573
+ # @param [Google::Apis::RequestOptions] options
574
+ # Request-specific options
575
+ #
576
+ # @yield [result, err] Result & error if block supplied
577
+ # @yieldparam result [Google::Apis::ScriptV1::Version] parsed result object
578
+ # @yieldparam err [StandardError] error object if request failed
579
+ #
580
+ # @return [Google::Apis::ScriptV1::Version]
581
+ #
582
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
583
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
584
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
585
+ def get_project_version(script_id, version_number, fields: nil, quota_user: nil, options: nil, &block)
586
+ command = make_simple_command(:get, 'v1/projects/{scriptId}/versions/{versionNumber}', options)
587
+ command.response_representation = Google::Apis::ScriptV1::Version::Representation
588
+ command.response_class = Google::Apis::ScriptV1::Version
589
+ command.params['scriptId'] = script_id unless script_id.nil?
590
+ command.params['versionNumber'] = version_number unless version_number.nil?
591
+ command.query['fields'] = fields unless fields.nil?
592
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
593
+ execute_or_queue_command(command, &block)
594
+ end
595
+
596
+ # List the versions of a script project.
597
+ # @param [String] script_id
598
+ # The script project's Drive ID.
599
+ # @param [Fixnum] page_size
600
+ # The maximum number of versions on each returned page. Defaults to 50.
601
+ # @param [String] page_token
602
+ # The token for continuing a previous list request on the next page. This should
603
+ # be set to the value of `nextPageToken` from a previous response.
604
+ # @param [String] fields
605
+ # Selector specifying which fields to include in a partial response.
606
+ # @param [String] quota_user
607
+ # Available to use for quota purposes for server-side applications. Can be any
608
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
609
+ # @param [Google::Apis::RequestOptions] options
610
+ # Request-specific options
611
+ #
612
+ # @yield [result, err] Result & error if block supplied
613
+ # @yieldparam result [Google::Apis::ScriptV1::ListVersionsResponse] parsed result object
614
+ # @yieldparam err [StandardError] error object if request failed
615
+ #
616
+ # @return [Google::Apis::ScriptV1::ListVersionsResponse]
617
+ #
618
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
619
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
620
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
621
+ def list_project_versions(script_id, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
622
+ command = make_simple_command(:get, 'v1/projects/{scriptId}/versions', options)
623
+ command.response_representation = Google::Apis::ScriptV1::ListVersionsResponse::Representation
624
+ command.response_class = Google::Apis::ScriptV1::ListVersionsResponse
625
+ command.params['scriptId'] = script_id unless script_id.nil?
626
+ command.query['pageSize'] = page_size unless page_size.nil?
627
+ command.query['pageToken'] = page_token unless page_token.nil?
628
+ command.query['fields'] = fields unless fields.nil?
629
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
630
+ execute_or_queue_command(command, &block)
631
+ end
632
+
633
+ # Runs a function in an Apps Script project. The script project must be deployed
634
+ # for use with the Apps Script API and the calling application must share the
635
+ # same Cloud Platform project. This method requires authorization with an OAuth
636
+ # 2.0 token that includes at least one of the scopes listed in the [
637
+ # Authorization](#authorization-scopes) section; script projects that do not
638
+ # require authorization cannot be executed through this API. To find the correct
639
+ # scopes to include in the authentication token, open the project in the script
640
+ # editor, then select **File > Project properties** and click the **Scopes** tab.
641
+ # The error `403, PERMISSION_DENIED: The caller does not have permission`
642
+ # indicates that the Cloud Platform project used to authorize the request is not
643
+ # the same as the one used by the script.
644
+ # @param [String] script_id
645
+ # The script ID of the script to be executed. To find the script ID, open the
646
+ # project in the script editor and select **File > Project properties**.
647
+ # @param [Google::Apis::ScriptV1::ExecutionRequest] execution_request_object
648
+ # @param [String] fields
649
+ # Selector specifying which fields to include in a partial response.
650
+ # @param [String] quota_user
651
+ # Available to use for quota purposes for server-side applications. Can be any
652
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
653
+ # @param [Google::Apis::RequestOptions] options
654
+ # Request-specific options
655
+ #
656
+ # @yield [result, err] Result & error if block supplied
657
+ # @yieldparam result [Google::Apis::ScriptV1::Operation] parsed result object
658
+ # @yieldparam err [StandardError] error object if request failed
659
+ #
660
+ # @return [Google::Apis::ScriptV1::Operation]
661
+ #
662
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
663
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
664
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
665
+ def run_script(script_id, execution_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
666
+ command = make_simple_command(:post, 'v1/scripts/{scriptId}:run', options)
667
+ command.request_representation = Google::Apis::ScriptV1::ExecutionRequest::Representation
668
+ command.request_object = execution_request_object
669
+ command.response_representation = Google::Apis::ScriptV1::Operation::Representation
670
+ command.response_class = Google::Apis::ScriptV1::Operation
671
+ command.params['scriptId'] = script_id unless script_id.nil?
672
+ command.query['fields'] = fields unless fields.nil?
673
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
674
+ execute_or_queue_command(command, &block)
675
+ end
676
+
677
+ protected
678
+
679
+ def apply_command_defaults(command)
680
+ command.query['key'] = key unless key.nil?
681
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
682
+ end
683
+ end
684
+ end
685
+ end
686
+ end