google-apis-gmail_v1 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2573 @@
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 GmailV1
23
+ # Gmail API
24
+ #
25
+ # The Gmail API lets you view and manage Gmail mailbox data like threads,
26
+ # messages, and labels.
27
+ #
28
+ # @example
29
+ # require 'google/apis/gmail_v1'
30
+ #
31
+ # Gmail = Google::Apis::GmailV1 # Alias the module
32
+ # service = Gmail::GmailService.new
33
+ #
34
+ # @see https://developers.google.com/gmail/api/
35
+ class GmailService < Google::Apis::Core::BaseService
36
+ # @return [String]
37
+ # API key. Your API key identifies your project and provides you with API access,
38
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
39
+ attr_accessor :key
40
+
41
+ # @return [String]
42
+ # Available to use for quota purposes for server-side applications. Can be any
43
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
44
+ attr_accessor :quota_user
45
+
46
+ def initialize
47
+ super('https://gmail.googleapis.com/', '',
48
+ client_name: 'google-apis-gmail_v1',
49
+ client_version: Google::Apis::GmailV1::GEM_VERSION)
50
+ @batch_path = 'batch'
51
+ end
52
+
53
+ # Gets the current user's Gmail profile.
54
+ # @param [String] user_id
55
+ # The user's email address. The special value `me` can be used to indicate the
56
+ # authenticated user.
57
+ # @param [String] fields
58
+ # Selector specifying which fields to include in a partial response.
59
+ # @param [String] quota_user
60
+ # Available to use for quota purposes for server-side applications. Can be any
61
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
62
+ # @param [Google::Apis::RequestOptions] options
63
+ # Request-specific options
64
+ #
65
+ # @yield [result, err] Result & error if block supplied
66
+ # @yieldparam result [Google::Apis::GmailV1::Profile] parsed result object
67
+ # @yieldparam err [StandardError] error object if request failed
68
+ #
69
+ # @return [Google::Apis::GmailV1::Profile]
70
+ #
71
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
72
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
73
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
74
+ def get_user_profile(user_id, fields: nil, quota_user: nil, options: nil, &block)
75
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/profile', options)
76
+ command.response_representation = Google::Apis::GmailV1::Profile::Representation
77
+ command.response_class = Google::Apis::GmailV1::Profile
78
+ command.params['userId'] = user_id unless user_id.nil?
79
+ command.query['fields'] = fields unless fields.nil?
80
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
81
+ execute_or_queue_command(command, &block)
82
+ end
83
+
84
+ # Stop receiving push notifications for the given user mailbox.
85
+ # @param [String] user_id
86
+ # The user's email address. The special value `me` can be used to indicate the
87
+ # authenticated user.
88
+ # @param [String] fields
89
+ # Selector specifying which fields to include in a partial response.
90
+ # @param [String] quota_user
91
+ # Available to use for quota purposes for server-side applications. Can be any
92
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
93
+ # @param [Google::Apis::RequestOptions] options
94
+ # Request-specific options
95
+ #
96
+ # @yield [result, err] Result & error if block supplied
97
+ # @yieldparam result [NilClass] No result returned for this method
98
+ # @yieldparam err [StandardError] error object if request failed
99
+ #
100
+ # @return [void]
101
+ #
102
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
103
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
104
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
105
+ def stop_user(user_id, fields: nil, quota_user: nil, options: nil, &block)
106
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/stop', options)
107
+ command.params['userId'] = user_id unless user_id.nil?
108
+ command.query['fields'] = fields unless fields.nil?
109
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
110
+ execute_or_queue_command(command, &block)
111
+ end
112
+
113
+ # Set up or update a push notification watch on the given user mailbox.
114
+ # @param [String] user_id
115
+ # The user's email address. The special value `me` can be used to indicate the
116
+ # authenticated user.
117
+ # @param [Google::Apis::GmailV1::WatchRequest] watch_request_object
118
+ # @param [String] fields
119
+ # Selector specifying which fields to include in a partial response.
120
+ # @param [String] quota_user
121
+ # Available to use for quota purposes for server-side applications. Can be any
122
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
123
+ # @param [Google::Apis::RequestOptions] options
124
+ # Request-specific options
125
+ #
126
+ # @yield [result, err] Result & error if block supplied
127
+ # @yieldparam result [Google::Apis::GmailV1::WatchResponse] parsed result object
128
+ # @yieldparam err [StandardError] error object if request failed
129
+ #
130
+ # @return [Google::Apis::GmailV1::WatchResponse]
131
+ #
132
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
133
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
134
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
135
+ def watch_user(user_id, watch_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
136
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/watch', options)
137
+ command.request_representation = Google::Apis::GmailV1::WatchRequest::Representation
138
+ command.request_object = watch_request_object
139
+ command.response_representation = Google::Apis::GmailV1::WatchResponse::Representation
140
+ command.response_class = Google::Apis::GmailV1::WatchResponse
141
+ command.params['userId'] = user_id unless user_id.nil?
142
+ command.query['fields'] = fields unless fields.nil?
143
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
144
+ execute_or_queue_command(command, &block)
145
+ end
146
+
147
+ # Creates a new draft with the `DRAFT` label.
148
+ # @param [String] user_id
149
+ # The user's email address. The special value `me` can be used to indicate the
150
+ # authenticated user.
151
+ # @param [Google::Apis::GmailV1::Draft] draft_object
152
+ # @param [String] fields
153
+ # Selector specifying which fields to include in a partial response.
154
+ # @param [String] quota_user
155
+ # Available to use for quota purposes for server-side applications. Can be any
156
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
157
+ # @param [IO, String] upload_source
158
+ # IO stream or filename containing content to upload
159
+ # @param [String] content_type
160
+ # Content type of the uploaded content.
161
+ # @param [Google::Apis::RequestOptions] options
162
+ # Request-specific options
163
+ #
164
+ # @yield [result, err] Result & error if block supplied
165
+ # @yieldparam result [Google::Apis::GmailV1::Draft] parsed result object
166
+ # @yieldparam err [StandardError] error object if request failed
167
+ #
168
+ # @return [Google::Apis::GmailV1::Draft]
169
+ #
170
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
171
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
172
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
173
+ def create_user_draft(user_id, draft_object = nil, fields: nil, quota_user: nil, upload_source: nil, content_type: nil, options: nil, &block)
174
+ if upload_source.nil?
175
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/drafts', options)
176
+ else
177
+ command = make_upload_command(:post, 'gmail/v1/users/{userId}/drafts', options)
178
+ command.upload_source = upload_source
179
+ command.upload_content_type = content_type
180
+ end
181
+ command.request_representation = Google::Apis::GmailV1::Draft::Representation
182
+ command.request_object = draft_object
183
+ command.response_representation = Google::Apis::GmailV1::Draft::Representation
184
+ command.response_class = Google::Apis::GmailV1::Draft
185
+ command.params['userId'] = user_id unless user_id.nil?
186
+ command.query['fields'] = fields unless fields.nil?
187
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
188
+ execute_or_queue_command(command, &block)
189
+ end
190
+
191
+ # Immediately and permanently deletes the specified draft. Does not simply trash
192
+ # it.
193
+ # @param [String] user_id
194
+ # The user's email address. The special value `me` can be used to indicate the
195
+ # authenticated user.
196
+ # @param [String] id
197
+ # The ID of the draft to delete.
198
+ # @param [String] fields
199
+ # Selector specifying which fields to include in a partial response.
200
+ # @param [String] quota_user
201
+ # Available to use for quota purposes for server-side applications. Can be any
202
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
203
+ # @param [Google::Apis::RequestOptions] options
204
+ # Request-specific options
205
+ #
206
+ # @yield [result, err] Result & error if block supplied
207
+ # @yieldparam result [NilClass] No result returned for this method
208
+ # @yieldparam err [StandardError] error object if request failed
209
+ #
210
+ # @return [void]
211
+ #
212
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
213
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
214
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
215
+ def delete_user_draft(user_id, id, fields: nil, quota_user: nil, options: nil, &block)
216
+ command = make_simple_command(:delete, 'gmail/v1/users/{userId}/drafts/{id}', options)
217
+ command.params['userId'] = user_id unless user_id.nil?
218
+ command.params['id'] = id unless id.nil?
219
+ command.query['fields'] = fields unless fields.nil?
220
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
221
+ execute_or_queue_command(command, &block)
222
+ end
223
+
224
+ # Gets the specified draft.
225
+ # @param [String] user_id
226
+ # The user's email address. The special value `me` can be used to indicate the
227
+ # authenticated user.
228
+ # @param [String] id
229
+ # The ID of the draft to retrieve.
230
+ # @param [String] format
231
+ # The format to return the draft in.
232
+ # @param [String] fields
233
+ # Selector specifying which fields to include in a partial response.
234
+ # @param [String] quota_user
235
+ # Available to use for quota purposes for server-side applications. Can be any
236
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
237
+ # @param [Google::Apis::RequestOptions] options
238
+ # Request-specific options
239
+ #
240
+ # @yield [result, err] Result & error if block supplied
241
+ # @yieldparam result [Google::Apis::GmailV1::Draft] parsed result object
242
+ # @yieldparam err [StandardError] error object if request failed
243
+ #
244
+ # @return [Google::Apis::GmailV1::Draft]
245
+ #
246
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
247
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
248
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
249
+ def get_user_draft(user_id, id, format: nil, fields: nil, quota_user: nil, options: nil, &block)
250
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/drafts/{id}', options)
251
+ command.response_representation = Google::Apis::GmailV1::Draft::Representation
252
+ command.response_class = Google::Apis::GmailV1::Draft
253
+ command.params['userId'] = user_id unless user_id.nil?
254
+ command.params['id'] = id unless id.nil?
255
+ command.query['format'] = format unless format.nil?
256
+ command.query['fields'] = fields unless fields.nil?
257
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
258
+ execute_or_queue_command(command, &block)
259
+ end
260
+
261
+ # Lists the drafts in the user's mailbox.
262
+ # @param [String] user_id
263
+ # The user's email address. The special value `me` can be used to indicate the
264
+ # authenticated user.
265
+ # @param [Boolean] include_spam_trash
266
+ # Include drafts from `SPAM` and `TRASH` in the results.
267
+ # @param [Fixnum] max_results
268
+ # Maximum number of drafts to return.
269
+ # @param [String] page_token
270
+ # Page token to retrieve a specific page of results in the list.
271
+ # @param [String] q
272
+ # Only return draft messages matching the specified query. Supports the same
273
+ # query format as the Gmail search box. For example, `"from:someuser@example.com
274
+ # rfc822msgid: is:unread"`.
275
+ # @param [String] fields
276
+ # Selector specifying which fields to include in a partial response.
277
+ # @param [String] quota_user
278
+ # Available to use for quota purposes for server-side applications. Can be any
279
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
280
+ # @param [Google::Apis::RequestOptions] options
281
+ # Request-specific options
282
+ #
283
+ # @yield [result, err] Result & error if block supplied
284
+ # @yieldparam result [Google::Apis::GmailV1::ListDraftsResponse] parsed result object
285
+ # @yieldparam err [StandardError] error object if request failed
286
+ #
287
+ # @return [Google::Apis::GmailV1::ListDraftsResponse]
288
+ #
289
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
290
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
291
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
292
+ def list_user_drafts(user_id, include_spam_trash: nil, max_results: nil, page_token: nil, q: nil, fields: nil, quota_user: nil, options: nil, &block)
293
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/drafts', options)
294
+ command.response_representation = Google::Apis::GmailV1::ListDraftsResponse::Representation
295
+ command.response_class = Google::Apis::GmailV1::ListDraftsResponse
296
+ command.params['userId'] = user_id unless user_id.nil?
297
+ command.query['includeSpamTrash'] = include_spam_trash unless include_spam_trash.nil?
298
+ command.query['maxResults'] = max_results unless max_results.nil?
299
+ command.query['pageToken'] = page_token unless page_token.nil?
300
+ command.query['q'] = q unless q.nil?
301
+ command.query['fields'] = fields unless fields.nil?
302
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
303
+ execute_or_queue_command(command, &block)
304
+ end
305
+
306
+ # Sends the specified, existing draft to the recipients in the `To`, `Cc`, and `
307
+ # Bcc` headers.
308
+ # @param [String] user_id
309
+ # The user's email address. The special value `me` can be used to indicate the
310
+ # authenticated user.
311
+ # @param [Google::Apis::GmailV1::Draft] draft_object
312
+ # @param [String] fields
313
+ # Selector specifying which fields to include in a partial response.
314
+ # @param [String] quota_user
315
+ # Available to use for quota purposes for server-side applications. Can be any
316
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
317
+ # @param [IO, String] upload_source
318
+ # IO stream or filename containing content to upload
319
+ # @param [String] content_type
320
+ # Content type of the uploaded content.
321
+ # @param [Google::Apis::RequestOptions] options
322
+ # Request-specific options
323
+ #
324
+ # @yield [result, err] Result & error if block supplied
325
+ # @yieldparam result [Google::Apis::GmailV1::Message] parsed result object
326
+ # @yieldparam err [StandardError] error object if request failed
327
+ #
328
+ # @return [Google::Apis::GmailV1::Message]
329
+ #
330
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
331
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
332
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
333
+ def send_user_draft(user_id, draft_object = nil, fields: nil, quota_user: nil, upload_source: nil, content_type: nil, options: nil, &block)
334
+ if upload_source.nil?
335
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/drafts/send', options)
336
+ else
337
+ command = make_upload_command(:post, 'gmail/v1/users/{userId}/drafts/send', options)
338
+ command.upload_source = upload_source
339
+ command.upload_content_type = content_type
340
+ end
341
+ command.request_representation = Google::Apis::GmailV1::Draft::Representation
342
+ command.request_object = draft_object
343
+ command.response_representation = Google::Apis::GmailV1::Message::Representation
344
+ command.response_class = Google::Apis::GmailV1::Message
345
+ command.params['userId'] = user_id unless user_id.nil?
346
+ command.query['fields'] = fields unless fields.nil?
347
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
348
+ execute_or_queue_command(command, &block)
349
+ end
350
+
351
+ # Replaces a draft's content.
352
+ # @param [String] user_id
353
+ # The user's email address. The special value `me` can be used to indicate the
354
+ # authenticated user.
355
+ # @param [String] id
356
+ # The ID of the draft to update.
357
+ # @param [Google::Apis::GmailV1::Draft] draft_object
358
+ # @param [String] fields
359
+ # Selector specifying which fields to include in a partial response.
360
+ # @param [String] quota_user
361
+ # Available to use for quota purposes for server-side applications. Can be any
362
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
363
+ # @param [IO, String] upload_source
364
+ # IO stream or filename containing content to upload
365
+ # @param [String] content_type
366
+ # Content type of the uploaded content.
367
+ # @param [Google::Apis::RequestOptions] options
368
+ # Request-specific options
369
+ #
370
+ # @yield [result, err] Result & error if block supplied
371
+ # @yieldparam result [Google::Apis::GmailV1::Draft] parsed result object
372
+ # @yieldparam err [StandardError] error object if request failed
373
+ #
374
+ # @return [Google::Apis::GmailV1::Draft]
375
+ #
376
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
377
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
378
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
379
+ def update_user_draft(user_id, id, draft_object = nil, fields: nil, quota_user: nil, upload_source: nil, content_type: nil, options: nil, &block)
380
+ if upload_source.nil?
381
+ command = make_simple_command(:put, 'gmail/v1/users/{userId}/drafts/{id}', options)
382
+ else
383
+ command = make_upload_command(:put, 'gmail/v1/users/{userId}/drafts/{id}', options)
384
+ command.upload_source = upload_source
385
+ command.upload_content_type = content_type
386
+ end
387
+ command.request_representation = Google::Apis::GmailV1::Draft::Representation
388
+ command.request_object = draft_object
389
+ command.response_representation = Google::Apis::GmailV1::Draft::Representation
390
+ command.response_class = Google::Apis::GmailV1::Draft
391
+ command.params['userId'] = user_id unless user_id.nil?
392
+ command.params['id'] = id unless id.nil?
393
+ command.query['fields'] = fields unless fields.nil?
394
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
395
+ execute_or_queue_command(command, &block)
396
+ end
397
+
398
+ # Lists the history of all changes to the given mailbox. History results are
399
+ # returned in chronological order (increasing `historyId`).
400
+ # @param [String] user_id
401
+ # The user's email address. The special value `me` can be used to indicate the
402
+ # authenticated user.
403
+ # @param [Array<String>, String] history_types
404
+ # History types to be returned by the function
405
+ # @param [String] label_id
406
+ # Only return messages with a label matching the ID.
407
+ # @param [Fixnum] max_results
408
+ # The maximum number of history records to return.
409
+ # @param [String] page_token
410
+ # Page token to retrieve a specific page of results in the list.
411
+ # @param [Fixnum] start_history_id
412
+ # Required. Returns history records after the specified `startHistoryId`. The
413
+ # supplied `startHistoryId` should be obtained from the `historyId` of a message,
414
+ # thread, or previous `list` response. History IDs increase chronologically but
415
+ # are not contiguous with random gaps in between valid IDs. Supplying an invalid
416
+ # or out of date `startHistoryId` typically returns an `HTTP 404` error code. A `
417
+ # historyId` is typically valid for at least a week, but in some rare
418
+ # circumstances may be valid for only a few hours. If you receive an `HTTP 404`
419
+ # error response, your application should perform a full sync. If you receive no
420
+ # `nextPageToken` in the response, there are no updates to retrieve and you can
421
+ # store the returned `historyId` for a future request.
422
+ # @param [String] fields
423
+ # Selector specifying which fields to include in a partial response.
424
+ # @param [String] quota_user
425
+ # Available to use for quota purposes for server-side applications. Can be any
426
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
427
+ # @param [Google::Apis::RequestOptions] options
428
+ # Request-specific options
429
+ #
430
+ # @yield [result, err] Result & error if block supplied
431
+ # @yieldparam result [Google::Apis::GmailV1::ListHistoryResponse] parsed result object
432
+ # @yieldparam err [StandardError] error object if request failed
433
+ #
434
+ # @return [Google::Apis::GmailV1::ListHistoryResponse]
435
+ #
436
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
437
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
438
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
439
+ def list_user_histories(user_id, history_types: nil, label_id: nil, max_results: nil, page_token: nil, start_history_id: nil, fields: nil, quota_user: nil, options: nil, &block)
440
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/history', options)
441
+ command.response_representation = Google::Apis::GmailV1::ListHistoryResponse::Representation
442
+ command.response_class = Google::Apis::GmailV1::ListHistoryResponse
443
+ command.params['userId'] = user_id unless user_id.nil?
444
+ command.query['historyTypes'] = history_types unless history_types.nil?
445
+ command.query['labelId'] = label_id unless label_id.nil?
446
+ command.query['maxResults'] = max_results unless max_results.nil?
447
+ command.query['pageToken'] = page_token unless page_token.nil?
448
+ command.query['startHistoryId'] = start_history_id unless start_history_id.nil?
449
+ command.query['fields'] = fields unless fields.nil?
450
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
451
+ execute_or_queue_command(command, &block)
452
+ end
453
+
454
+ # Creates a new label.
455
+ # @param [String] user_id
456
+ # The user's email address. The special value `me` can be used to indicate the
457
+ # authenticated user.
458
+ # @param [Google::Apis::GmailV1::Label] label_object
459
+ # @param [String] fields
460
+ # Selector specifying which fields to include in a partial response.
461
+ # @param [String] quota_user
462
+ # Available to use for quota purposes for server-side applications. Can be any
463
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
464
+ # @param [Google::Apis::RequestOptions] options
465
+ # Request-specific options
466
+ #
467
+ # @yield [result, err] Result & error if block supplied
468
+ # @yieldparam result [Google::Apis::GmailV1::Label] parsed result object
469
+ # @yieldparam err [StandardError] error object if request failed
470
+ #
471
+ # @return [Google::Apis::GmailV1::Label]
472
+ #
473
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
474
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
475
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
476
+ def create_user_label(user_id, label_object = nil, fields: nil, quota_user: nil, options: nil, &block)
477
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/labels', options)
478
+ command.request_representation = Google::Apis::GmailV1::Label::Representation
479
+ command.request_object = label_object
480
+ command.response_representation = Google::Apis::GmailV1::Label::Representation
481
+ command.response_class = Google::Apis::GmailV1::Label
482
+ command.params['userId'] = user_id unless user_id.nil?
483
+ command.query['fields'] = fields unless fields.nil?
484
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
485
+ execute_or_queue_command(command, &block)
486
+ end
487
+
488
+ # Immediately and permanently deletes the specified label and removes it from
489
+ # any messages and threads that it is applied to.
490
+ # @param [String] user_id
491
+ # The user's email address. The special value `me` can be used to indicate the
492
+ # authenticated user.
493
+ # @param [String] id
494
+ # The ID of the label to delete.
495
+ # @param [String] fields
496
+ # Selector specifying which fields to include in a partial response.
497
+ # @param [String] quota_user
498
+ # Available to use for quota purposes for server-side applications. Can be any
499
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
500
+ # @param [Google::Apis::RequestOptions] options
501
+ # Request-specific options
502
+ #
503
+ # @yield [result, err] Result & error if block supplied
504
+ # @yieldparam result [NilClass] No result returned for this method
505
+ # @yieldparam err [StandardError] error object if request failed
506
+ #
507
+ # @return [void]
508
+ #
509
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
510
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
511
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
512
+ def delete_user_label(user_id, id, fields: nil, quota_user: nil, options: nil, &block)
513
+ command = make_simple_command(:delete, 'gmail/v1/users/{userId}/labels/{id}', options)
514
+ command.params['userId'] = user_id unless user_id.nil?
515
+ command.params['id'] = id unless id.nil?
516
+ command.query['fields'] = fields unless fields.nil?
517
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
518
+ execute_or_queue_command(command, &block)
519
+ end
520
+
521
+ # Gets the specified label.
522
+ # @param [String] user_id
523
+ # The user's email address. The special value `me` can be used to indicate the
524
+ # authenticated user.
525
+ # @param [String] id
526
+ # The ID of the label to retrieve.
527
+ # @param [String] fields
528
+ # Selector specifying which fields to include in a partial response.
529
+ # @param [String] quota_user
530
+ # Available to use for quota purposes for server-side applications. Can be any
531
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
532
+ # @param [Google::Apis::RequestOptions] options
533
+ # Request-specific options
534
+ #
535
+ # @yield [result, err] Result & error if block supplied
536
+ # @yieldparam result [Google::Apis::GmailV1::Label] parsed result object
537
+ # @yieldparam err [StandardError] error object if request failed
538
+ #
539
+ # @return [Google::Apis::GmailV1::Label]
540
+ #
541
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
542
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
543
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
544
+ def get_user_label(user_id, id, fields: nil, quota_user: nil, options: nil, &block)
545
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/labels/{id}', options)
546
+ command.response_representation = Google::Apis::GmailV1::Label::Representation
547
+ command.response_class = Google::Apis::GmailV1::Label
548
+ command.params['userId'] = user_id unless user_id.nil?
549
+ command.params['id'] = id unless id.nil?
550
+ command.query['fields'] = fields unless fields.nil?
551
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
552
+ execute_or_queue_command(command, &block)
553
+ end
554
+
555
+ # Lists all labels in the user's mailbox.
556
+ # @param [String] user_id
557
+ # The user's email address. The special value `me` can be used to indicate the
558
+ # authenticated user.
559
+ # @param [String] fields
560
+ # Selector specifying which fields to include in a partial response.
561
+ # @param [String] quota_user
562
+ # Available to use for quota purposes for server-side applications. Can be any
563
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
564
+ # @param [Google::Apis::RequestOptions] options
565
+ # Request-specific options
566
+ #
567
+ # @yield [result, err] Result & error if block supplied
568
+ # @yieldparam result [Google::Apis::GmailV1::ListLabelsResponse] parsed result object
569
+ # @yieldparam err [StandardError] error object if request failed
570
+ #
571
+ # @return [Google::Apis::GmailV1::ListLabelsResponse]
572
+ #
573
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
574
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
575
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
576
+ def list_user_labels(user_id, fields: nil, quota_user: nil, options: nil, &block)
577
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/labels', options)
578
+ command.response_representation = Google::Apis::GmailV1::ListLabelsResponse::Representation
579
+ command.response_class = Google::Apis::GmailV1::ListLabelsResponse
580
+ command.params['userId'] = user_id unless user_id.nil?
581
+ command.query['fields'] = fields unless fields.nil?
582
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
583
+ execute_or_queue_command(command, &block)
584
+ end
585
+
586
+ # Patch the specified label.
587
+ # @param [String] user_id
588
+ # The user's email address. The special value `me` can be used to indicate the
589
+ # authenticated user.
590
+ # @param [String] id
591
+ # The ID of the label to update.
592
+ # @param [Google::Apis::GmailV1::Label] label_object
593
+ # @param [String] fields
594
+ # Selector specifying which fields to include in a partial response.
595
+ # @param [String] quota_user
596
+ # Available to use for quota purposes for server-side applications. Can be any
597
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
598
+ # @param [Google::Apis::RequestOptions] options
599
+ # Request-specific options
600
+ #
601
+ # @yield [result, err] Result & error if block supplied
602
+ # @yieldparam result [Google::Apis::GmailV1::Label] parsed result object
603
+ # @yieldparam err [StandardError] error object if request failed
604
+ #
605
+ # @return [Google::Apis::GmailV1::Label]
606
+ #
607
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
608
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
609
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
610
+ def patch_user_label(user_id, id, label_object = nil, fields: nil, quota_user: nil, options: nil, &block)
611
+ command = make_simple_command(:patch, 'gmail/v1/users/{userId}/labels/{id}', options)
612
+ command.request_representation = Google::Apis::GmailV1::Label::Representation
613
+ command.request_object = label_object
614
+ command.response_representation = Google::Apis::GmailV1::Label::Representation
615
+ command.response_class = Google::Apis::GmailV1::Label
616
+ command.params['userId'] = user_id unless user_id.nil?
617
+ command.params['id'] = id unless id.nil?
618
+ command.query['fields'] = fields unless fields.nil?
619
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
620
+ execute_or_queue_command(command, &block)
621
+ end
622
+
623
+ # Updates the specified label.
624
+ # @param [String] user_id
625
+ # The user's email address. The special value `me` can be used to indicate the
626
+ # authenticated user.
627
+ # @param [String] id
628
+ # The ID of the label to update.
629
+ # @param [Google::Apis::GmailV1::Label] label_object
630
+ # @param [String] fields
631
+ # Selector specifying which fields to include in a partial response.
632
+ # @param [String] quota_user
633
+ # Available to use for quota purposes for server-side applications. Can be any
634
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
635
+ # @param [Google::Apis::RequestOptions] options
636
+ # Request-specific options
637
+ #
638
+ # @yield [result, err] Result & error if block supplied
639
+ # @yieldparam result [Google::Apis::GmailV1::Label] parsed result object
640
+ # @yieldparam err [StandardError] error object if request failed
641
+ #
642
+ # @return [Google::Apis::GmailV1::Label]
643
+ #
644
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
645
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
646
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
647
+ def update_user_label(user_id, id, label_object = nil, fields: nil, quota_user: nil, options: nil, &block)
648
+ command = make_simple_command(:put, 'gmail/v1/users/{userId}/labels/{id}', options)
649
+ command.request_representation = Google::Apis::GmailV1::Label::Representation
650
+ command.request_object = label_object
651
+ command.response_representation = Google::Apis::GmailV1::Label::Representation
652
+ command.response_class = Google::Apis::GmailV1::Label
653
+ command.params['userId'] = user_id unless user_id.nil?
654
+ command.params['id'] = id unless id.nil?
655
+ command.query['fields'] = fields unless fields.nil?
656
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
657
+ execute_or_queue_command(command, &block)
658
+ end
659
+
660
+ # Deletes many messages by message ID. Provides no guarantees that messages were
661
+ # not already deleted or even existed at all.
662
+ # @param [String] user_id
663
+ # The user's email address. The special value `me` can be used to indicate the
664
+ # authenticated user.
665
+ # @param [Google::Apis::GmailV1::BatchDeleteMessagesRequest] batch_delete_messages_request_object
666
+ # @param [String] fields
667
+ # Selector specifying which fields to include in a partial response.
668
+ # @param [String] quota_user
669
+ # Available to use for quota purposes for server-side applications. Can be any
670
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
671
+ # @param [Google::Apis::RequestOptions] options
672
+ # Request-specific options
673
+ #
674
+ # @yield [result, err] Result & error if block supplied
675
+ # @yieldparam result [NilClass] No result returned for this method
676
+ # @yieldparam err [StandardError] error object if request failed
677
+ #
678
+ # @return [void]
679
+ #
680
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
681
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
682
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
683
+ def batch_delete_messages(user_id, batch_delete_messages_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
684
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/messages/batchDelete', options)
685
+ command.request_representation = Google::Apis::GmailV1::BatchDeleteMessagesRequest::Representation
686
+ command.request_object = batch_delete_messages_request_object
687
+ command.params['userId'] = user_id unless user_id.nil?
688
+ command.query['fields'] = fields unless fields.nil?
689
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
690
+ execute_or_queue_command(command, &block)
691
+ end
692
+
693
+ # Modifies the labels on the specified messages.
694
+ # @param [String] user_id
695
+ # The user's email address. The special value `me` can be used to indicate the
696
+ # authenticated user.
697
+ # @param [Google::Apis::GmailV1::BatchModifyMessagesRequest] batch_modify_messages_request_object
698
+ # @param [String] fields
699
+ # Selector specifying which fields to include in a partial response.
700
+ # @param [String] quota_user
701
+ # Available to use for quota purposes for server-side applications. Can be any
702
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
703
+ # @param [Google::Apis::RequestOptions] options
704
+ # Request-specific options
705
+ #
706
+ # @yield [result, err] Result & error if block supplied
707
+ # @yieldparam result [NilClass] No result returned for this method
708
+ # @yieldparam err [StandardError] error object if request failed
709
+ #
710
+ # @return [void]
711
+ #
712
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
713
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
714
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
715
+ def batch_modify_messages(user_id, batch_modify_messages_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
716
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/messages/batchModify', options)
717
+ command.request_representation = Google::Apis::GmailV1::BatchModifyMessagesRequest::Representation
718
+ command.request_object = batch_modify_messages_request_object
719
+ command.params['userId'] = user_id unless user_id.nil?
720
+ command.query['fields'] = fields unless fields.nil?
721
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
722
+ execute_or_queue_command(command, &block)
723
+ end
724
+
725
+ # Immediately and permanently deletes the specified message. This operation
726
+ # cannot be undone. Prefer `messages.trash` instead.
727
+ # @param [String] user_id
728
+ # The user's email address. The special value `me` can be used to indicate the
729
+ # authenticated user.
730
+ # @param [String] id
731
+ # The ID of the message to delete.
732
+ # @param [String] fields
733
+ # Selector specifying which fields to include in a partial response.
734
+ # @param [String] quota_user
735
+ # Available to use for quota purposes for server-side applications. Can be any
736
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
737
+ # @param [Google::Apis::RequestOptions] options
738
+ # Request-specific options
739
+ #
740
+ # @yield [result, err] Result & error if block supplied
741
+ # @yieldparam result [NilClass] No result returned for this method
742
+ # @yieldparam err [StandardError] error object if request failed
743
+ #
744
+ # @return [void]
745
+ #
746
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
747
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
748
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
749
+ def delete_user_message(user_id, id, fields: nil, quota_user: nil, options: nil, &block)
750
+ command = make_simple_command(:delete, 'gmail/v1/users/{userId}/messages/{id}', options)
751
+ command.params['userId'] = user_id unless user_id.nil?
752
+ command.params['id'] = id unless id.nil?
753
+ command.query['fields'] = fields unless fields.nil?
754
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
755
+ execute_or_queue_command(command, &block)
756
+ end
757
+
758
+ # Gets the specified message.
759
+ # @param [String] user_id
760
+ # The user's email address. The special value `me` can be used to indicate the
761
+ # authenticated user.
762
+ # @param [String] id
763
+ # The ID of the message to retrieve.
764
+ # @param [String] format
765
+ # The format to return the message in.
766
+ # @param [Array<String>, String] metadata_headers
767
+ # When given and format is `METADATA`, only include headers specified.
768
+ # @param [String] fields
769
+ # Selector specifying which fields to include in a partial response.
770
+ # @param [String] quota_user
771
+ # Available to use for quota purposes for server-side applications. Can be any
772
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
773
+ # @param [Google::Apis::RequestOptions] options
774
+ # Request-specific options
775
+ #
776
+ # @yield [result, err] Result & error if block supplied
777
+ # @yieldparam result [Google::Apis::GmailV1::Message] parsed result object
778
+ # @yieldparam err [StandardError] error object if request failed
779
+ #
780
+ # @return [Google::Apis::GmailV1::Message]
781
+ #
782
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
783
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
784
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
785
+ def get_user_message(user_id, id, format: nil, metadata_headers: nil, fields: nil, quota_user: nil, options: nil, &block)
786
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/messages/{id}', options)
787
+ command.response_representation = Google::Apis::GmailV1::Message::Representation
788
+ command.response_class = Google::Apis::GmailV1::Message
789
+ command.params['userId'] = user_id unless user_id.nil?
790
+ command.params['id'] = id unless id.nil?
791
+ command.query['format'] = format unless format.nil?
792
+ command.query['metadataHeaders'] = metadata_headers unless metadata_headers.nil?
793
+ command.query['fields'] = fields unless fields.nil?
794
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
795
+ execute_or_queue_command(command, &block)
796
+ end
797
+
798
+ # Imports a message into only this user's mailbox, with standard email delivery
799
+ # scanning and classification similar to receiving via SMTP. Does not send a
800
+ # message. Note: This function doesn't trigger forwarding rules or filters set
801
+ # up by the user.
802
+ # @param [String] user_id
803
+ # The user's email address. The special value `me` can be used to indicate the
804
+ # authenticated user.
805
+ # @param [Google::Apis::GmailV1::Message] message_object
806
+ # @param [Boolean] deleted
807
+ # Mark the email as permanently deleted (not TRASH) and only visible in Google
808
+ # Vault to a Vault administrator. Only used for G Suite accounts.
809
+ # @param [String] internal_date_source
810
+ # Source for Gmail's internal date of the message.
811
+ # @param [Boolean] never_mark_spam
812
+ # Ignore the Gmail spam classifier decision and never mark this email as SPAM in
813
+ # the mailbox.
814
+ # @param [Boolean] process_for_calendar
815
+ # Process calendar invites in the email and add any extracted meetings to the
816
+ # Google Calendar for this user.
817
+ # @param [String] fields
818
+ # Selector specifying which fields to include in a partial response.
819
+ # @param [String] quota_user
820
+ # Available to use for quota purposes for server-side applications. Can be any
821
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
822
+ # @param [IO, String] upload_source
823
+ # IO stream or filename containing content to upload
824
+ # @param [String] content_type
825
+ # Content type of the uploaded content.
826
+ # @param [Google::Apis::RequestOptions] options
827
+ # Request-specific options
828
+ #
829
+ # @yield [result, err] Result & error if block supplied
830
+ # @yieldparam result [Google::Apis::GmailV1::Message] parsed result object
831
+ # @yieldparam err [StandardError] error object if request failed
832
+ #
833
+ # @return [Google::Apis::GmailV1::Message]
834
+ #
835
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
836
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
837
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
838
+ def import_user_message(user_id, message_object = nil, deleted: nil, internal_date_source: nil, never_mark_spam: nil, process_for_calendar: nil, fields: nil, quota_user: nil, upload_source: nil, content_type: nil, options: nil, &block)
839
+ if upload_source.nil?
840
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/messages/import', options)
841
+ else
842
+ command = make_upload_command(:post, 'gmail/v1/users/{userId}/messages/import', options)
843
+ command.upload_source = upload_source
844
+ command.upload_content_type = content_type
845
+ end
846
+ command.request_representation = Google::Apis::GmailV1::Message::Representation
847
+ command.request_object = message_object
848
+ command.response_representation = Google::Apis::GmailV1::Message::Representation
849
+ command.response_class = Google::Apis::GmailV1::Message
850
+ command.params['userId'] = user_id unless user_id.nil?
851
+ command.query['deleted'] = deleted unless deleted.nil?
852
+ command.query['internalDateSource'] = internal_date_source unless internal_date_source.nil?
853
+ command.query['neverMarkSpam'] = never_mark_spam unless never_mark_spam.nil?
854
+ command.query['processForCalendar'] = process_for_calendar unless process_for_calendar.nil?
855
+ command.query['fields'] = fields unless fields.nil?
856
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
857
+ execute_or_queue_command(command, &block)
858
+ end
859
+
860
+ # Directly inserts a message into only this user's mailbox similar to `IMAP
861
+ # APPEND`, bypassing most scanning and classification. Does not send a message.
862
+ # @param [String] user_id
863
+ # The user's email address. The special value `me` can be used to indicate the
864
+ # authenticated user.
865
+ # @param [Google::Apis::GmailV1::Message] message_object
866
+ # @param [Boolean] deleted
867
+ # Mark the email as permanently deleted (not TRASH) and only visible in Google
868
+ # Vault to a Vault administrator. Only used for G Suite accounts.
869
+ # @param [String] internal_date_source
870
+ # Source for Gmail's internal date of the message.
871
+ # @param [String] fields
872
+ # Selector specifying which fields to include in a partial response.
873
+ # @param [String] quota_user
874
+ # Available to use for quota purposes for server-side applications. Can be any
875
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
876
+ # @param [IO, String] upload_source
877
+ # IO stream or filename containing content to upload
878
+ # @param [String] content_type
879
+ # Content type of the uploaded content.
880
+ # @param [Google::Apis::RequestOptions] options
881
+ # Request-specific options
882
+ #
883
+ # @yield [result, err] Result & error if block supplied
884
+ # @yieldparam result [Google::Apis::GmailV1::Message] parsed result object
885
+ # @yieldparam err [StandardError] error object if request failed
886
+ #
887
+ # @return [Google::Apis::GmailV1::Message]
888
+ #
889
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
890
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
891
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
892
+ def insert_user_message(user_id, message_object = nil, deleted: nil, internal_date_source: nil, fields: nil, quota_user: nil, upload_source: nil, content_type: nil, options: nil, &block)
893
+ if upload_source.nil?
894
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/messages', options)
895
+ else
896
+ command = make_upload_command(:post, 'gmail/v1/users/{userId}/messages', options)
897
+ command.upload_source = upload_source
898
+ command.upload_content_type = content_type
899
+ end
900
+ command.request_representation = Google::Apis::GmailV1::Message::Representation
901
+ command.request_object = message_object
902
+ command.response_representation = Google::Apis::GmailV1::Message::Representation
903
+ command.response_class = Google::Apis::GmailV1::Message
904
+ command.params['userId'] = user_id unless user_id.nil?
905
+ command.query['deleted'] = deleted unless deleted.nil?
906
+ command.query['internalDateSource'] = internal_date_source unless internal_date_source.nil?
907
+ command.query['fields'] = fields unless fields.nil?
908
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
909
+ execute_or_queue_command(command, &block)
910
+ end
911
+
912
+ # Lists the messages in the user's mailbox.
913
+ # @param [String] user_id
914
+ # The user's email address. The special value `me` can be used to indicate the
915
+ # authenticated user.
916
+ # @param [Boolean] include_spam_trash
917
+ # Include messages from `SPAM` and `TRASH` in the results.
918
+ # @param [Array<String>, String] label_ids
919
+ # Only return messages with labels that match all of the specified label IDs.
920
+ # @param [Fixnum] max_results
921
+ # Maximum number of messages to return.
922
+ # @param [String] page_token
923
+ # Page token to retrieve a specific page of results in the list.
924
+ # @param [String] q
925
+ # Only return messages matching the specified query. Supports the same query
926
+ # format as the Gmail search box. For example, `"from:someuser@example.com
927
+ # rfc822msgid: is:unread"`. Parameter cannot be used when accessing the api
928
+ # using the gmail.metadata scope.
929
+ # @param [String] fields
930
+ # Selector specifying which fields to include in a partial response.
931
+ # @param [String] quota_user
932
+ # Available to use for quota purposes for server-side applications. Can be any
933
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
934
+ # @param [Google::Apis::RequestOptions] options
935
+ # Request-specific options
936
+ #
937
+ # @yield [result, err] Result & error if block supplied
938
+ # @yieldparam result [Google::Apis::GmailV1::ListMessagesResponse] parsed result object
939
+ # @yieldparam err [StandardError] error object if request failed
940
+ #
941
+ # @return [Google::Apis::GmailV1::ListMessagesResponse]
942
+ #
943
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
944
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
945
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
946
+ def list_user_messages(user_id, include_spam_trash: nil, label_ids: nil, max_results: nil, page_token: nil, q: nil, fields: nil, quota_user: nil, options: nil, &block)
947
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/messages', options)
948
+ command.response_representation = Google::Apis::GmailV1::ListMessagesResponse::Representation
949
+ command.response_class = Google::Apis::GmailV1::ListMessagesResponse
950
+ command.params['userId'] = user_id unless user_id.nil?
951
+ command.query['includeSpamTrash'] = include_spam_trash unless include_spam_trash.nil?
952
+ command.query['labelIds'] = label_ids unless label_ids.nil?
953
+ command.query['maxResults'] = max_results unless max_results.nil?
954
+ command.query['pageToken'] = page_token unless page_token.nil?
955
+ command.query['q'] = q unless q.nil?
956
+ command.query['fields'] = fields unless fields.nil?
957
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
958
+ execute_or_queue_command(command, &block)
959
+ end
960
+
961
+ # Modifies the labels on the specified message.
962
+ # @param [String] user_id
963
+ # The user's email address. The special value `me` can be used to indicate the
964
+ # authenticated user.
965
+ # @param [String] id
966
+ # The ID of the message to modify.
967
+ # @param [Google::Apis::GmailV1::ModifyMessageRequest] modify_message_request_object
968
+ # @param [String] fields
969
+ # Selector specifying which fields to include in a partial response.
970
+ # @param [String] quota_user
971
+ # Available to use for quota purposes for server-side applications. Can be any
972
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
973
+ # @param [Google::Apis::RequestOptions] options
974
+ # Request-specific options
975
+ #
976
+ # @yield [result, err] Result & error if block supplied
977
+ # @yieldparam result [Google::Apis::GmailV1::Message] parsed result object
978
+ # @yieldparam err [StandardError] error object if request failed
979
+ #
980
+ # @return [Google::Apis::GmailV1::Message]
981
+ #
982
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
983
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
984
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
985
+ def modify_message(user_id, id, modify_message_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
986
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/messages/{id}/modify', options)
987
+ command.request_representation = Google::Apis::GmailV1::ModifyMessageRequest::Representation
988
+ command.request_object = modify_message_request_object
989
+ command.response_representation = Google::Apis::GmailV1::Message::Representation
990
+ command.response_class = Google::Apis::GmailV1::Message
991
+ command.params['userId'] = user_id unless user_id.nil?
992
+ command.params['id'] = id unless id.nil?
993
+ command.query['fields'] = fields unless fields.nil?
994
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
995
+ execute_or_queue_command(command, &block)
996
+ end
997
+
998
+ # Sends the specified message to the recipients in the `To`, `Cc`, and `Bcc`
999
+ # headers.
1000
+ # @param [String] user_id
1001
+ # The user's email address. The special value `me` can be used to indicate the
1002
+ # authenticated user.
1003
+ # @param [Google::Apis::GmailV1::Message] message_object
1004
+ # @param [String] fields
1005
+ # Selector specifying which fields to include in a partial response.
1006
+ # @param [String] quota_user
1007
+ # Available to use for quota purposes for server-side applications. Can be any
1008
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1009
+ # @param [IO, String] upload_source
1010
+ # IO stream or filename containing content to upload
1011
+ # @param [String] content_type
1012
+ # Content type of the uploaded content.
1013
+ # @param [Google::Apis::RequestOptions] options
1014
+ # Request-specific options
1015
+ #
1016
+ # @yield [result, err] Result & error if block supplied
1017
+ # @yieldparam result [Google::Apis::GmailV1::Message] parsed result object
1018
+ # @yieldparam err [StandardError] error object if request failed
1019
+ #
1020
+ # @return [Google::Apis::GmailV1::Message]
1021
+ #
1022
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1023
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1024
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1025
+ def send_user_message(user_id, message_object = nil, fields: nil, quota_user: nil, upload_source: nil, content_type: nil, options: nil, &block)
1026
+ if upload_source.nil?
1027
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/messages/send', options)
1028
+ else
1029
+ command = make_upload_command(:post, 'gmail/v1/users/{userId}/messages/send', options)
1030
+ command.upload_source = upload_source
1031
+ command.upload_content_type = content_type
1032
+ end
1033
+ command.request_representation = Google::Apis::GmailV1::Message::Representation
1034
+ command.request_object = message_object
1035
+ command.response_representation = Google::Apis::GmailV1::Message::Representation
1036
+ command.response_class = Google::Apis::GmailV1::Message
1037
+ command.params['userId'] = user_id unless user_id.nil?
1038
+ command.query['fields'] = fields unless fields.nil?
1039
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1040
+ execute_or_queue_command(command, &block)
1041
+ end
1042
+
1043
+ # Moves the specified message to the trash.
1044
+ # @param [String] user_id
1045
+ # The user's email address. The special value `me` can be used to indicate the
1046
+ # authenticated user.
1047
+ # @param [String] id
1048
+ # The ID of the message to Trash.
1049
+ # @param [String] fields
1050
+ # Selector specifying which fields to include in a partial response.
1051
+ # @param [String] quota_user
1052
+ # Available to use for quota purposes for server-side applications. Can be any
1053
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1054
+ # @param [Google::Apis::RequestOptions] options
1055
+ # Request-specific options
1056
+ #
1057
+ # @yield [result, err] Result & error if block supplied
1058
+ # @yieldparam result [Google::Apis::GmailV1::Message] parsed result object
1059
+ # @yieldparam err [StandardError] error object if request failed
1060
+ #
1061
+ # @return [Google::Apis::GmailV1::Message]
1062
+ #
1063
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1064
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1065
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1066
+ def trash_user_message(user_id, id, fields: nil, quota_user: nil, options: nil, &block)
1067
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/messages/{id}/trash', options)
1068
+ command.response_representation = Google::Apis::GmailV1::Message::Representation
1069
+ command.response_class = Google::Apis::GmailV1::Message
1070
+ command.params['userId'] = user_id unless user_id.nil?
1071
+ command.params['id'] = id unless id.nil?
1072
+ command.query['fields'] = fields unless fields.nil?
1073
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1074
+ execute_or_queue_command(command, &block)
1075
+ end
1076
+
1077
+ # Removes the specified message from the trash.
1078
+ # @param [String] user_id
1079
+ # The user's email address. The special value `me` can be used to indicate the
1080
+ # authenticated user.
1081
+ # @param [String] id
1082
+ # The ID of the message to remove from Trash.
1083
+ # @param [String] fields
1084
+ # Selector specifying which fields to include in a partial response.
1085
+ # @param [String] quota_user
1086
+ # Available to use for quota purposes for server-side applications. Can be any
1087
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1088
+ # @param [Google::Apis::RequestOptions] options
1089
+ # Request-specific options
1090
+ #
1091
+ # @yield [result, err] Result & error if block supplied
1092
+ # @yieldparam result [Google::Apis::GmailV1::Message] parsed result object
1093
+ # @yieldparam err [StandardError] error object if request failed
1094
+ #
1095
+ # @return [Google::Apis::GmailV1::Message]
1096
+ #
1097
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1098
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1099
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1100
+ def untrash_user_message(user_id, id, fields: nil, quota_user: nil, options: nil, &block)
1101
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/messages/{id}/untrash', options)
1102
+ command.response_representation = Google::Apis::GmailV1::Message::Representation
1103
+ command.response_class = Google::Apis::GmailV1::Message
1104
+ command.params['userId'] = user_id unless user_id.nil?
1105
+ command.params['id'] = id unless id.nil?
1106
+ command.query['fields'] = fields unless fields.nil?
1107
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1108
+ execute_or_queue_command(command, &block)
1109
+ end
1110
+
1111
+ # Gets the specified message attachment.
1112
+ # @param [String] user_id
1113
+ # The user's email address. The special value `me` can be used to indicate the
1114
+ # authenticated user.
1115
+ # @param [String] message_id
1116
+ # The ID of the message containing the attachment.
1117
+ # @param [String] id
1118
+ # The ID of the attachment.
1119
+ # @param [String] fields
1120
+ # Selector specifying which fields to include in a partial response.
1121
+ # @param [String] quota_user
1122
+ # Available to use for quota purposes for server-side applications. Can be any
1123
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1124
+ # @param [Google::Apis::RequestOptions] options
1125
+ # Request-specific options
1126
+ #
1127
+ # @yield [result, err] Result & error if block supplied
1128
+ # @yieldparam result [Google::Apis::GmailV1::MessagePartBody] parsed result object
1129
+ # @yieldparam err [StandardError] error object if request failed
1130
+ #
1131
+ # @return [Google::Apis::GmailV1::MessagePartBody]
1132
+ #
1133
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1134
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1135
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1136
+ def get_user_message_attachment(user_id, message_id, id, fields: nil, quota_user: nil, options: nil, &block)
1137
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/messages/{messageId}/attachments/{id}', options)
1138
+ command.response_representation = Google::Apis::GmailV1::MessagePartBody::Representation
1139
+ command.response_class = Google::Apis::GmailV1::MessagePartBody
1140
+ command.params['userId'] = user_id unless user_id.nil?
1141
+ command.params['messageId'] = message_id unless message_id.nil?
1142
+ command.params['id'] = id unless id.nil?
1143
+ command.query['fields'] = fields unless fields.nil?
1144
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1145
+ execute_or_queue_command(command, &block)
1146
+ end
1147
+
1148
+ # Gets the auto-forwarding setting for the specified account.
1149
+ # @param [String] user_id
1150
+ # User's email address. The special value "me" can be used to indicate the
1151
+ # authenticated user.
1152
+ # @param [String] fields
1153
+ # Selector specifying which fields to include in a partial response.
1154
+ # @param [String] quota_user
1155
+ # Available to use for quota purposes for server-side applications. Can be any
1156
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1157
+ # @param [Google::Apis::RequestOptions] options
1158
+ # Request-specific options
1159
+ #
1160
+ # @yield [result, err] Result & error if block supplied
1161
+ # @yieldparam result [Google::Apis::GmailV1::AutoForwarding] parsed result object
1162
+ # @yieldparam err [StandardError] error object if request failed
1163
+ #
1164
+ # @return [Google::Apis::GmailV1::AutoForwarding]
1165
+ #
1166
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1167
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1168
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1169
+ def get_user_setting_auto_forwarding(user_id, fields: nil, quota_user: nil, options: nil, &block)
1170
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/settings/autoForwarding', options)
1171
+ command.response_representation = Google::Apis::GmailV1::AutoForwarding::Representation
1172
+ command.response_class = Google::Apis::GmailV1::AutoForwarding
1173
+ command.params['userId'] = user_id unless user_id.nil?
1174
+ command.query['fields'] = fields unless fields.nil?
1175
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1176
+ execute_or_queue_command(command, &block)
1177
+ end
1178
+
1179
+ # Gets IMAP settings.
1180
+ # @param [String] user_id
1181
+ # User's email address. The special value "me" can be used to indicate the
1182
+ # authenticated user.
1183
+ # @param [String] fields
1184
+ # Selector specifying which fields to include in a partial response.
1185
+ # @param [String] quota_user
1186
+ # Available to use for quota purposes for server-side applications. Can be any
1187
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1188
+ # @param [Google::Apis::RequestOptions] options
1189
+ # Request-specific options
1190
+ #
1191
+ # @yield [result, err] Result & error if block supplied
1192
+ # @yieldparam result [Google::Apis::GmailV1::ImapSettings] parsed result object
1193
+ # @yieldparam err [StandardError] error object if request failed
1194
+ #
1195
+ # @return [Google::Apis::GmailV1::ImapSettings]
1196
+ #
1197
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1198
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1199
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1200
+ def get_user_setting_imap(user_id, fields: nil, quota_user: nil, options: nil, &block)
1201
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/settings/imap', options)
1202
+ command.response_representation = Google::Apis::GmailV1::ImapSettings::Representation
1203
+ command.response_class = Google::Apis::GmailV1::ImapSettings
1204
+ command.params['userId'] = user_id unless user_id.nil?
1205
+ command.query['fields'] = fields unless fields.nil?
1206
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1207
+ execute_or_queue_command(command, &block)
1208
+ end
1209
+
1210
+ # Gets language settings.
1211
+ # @param [String] user_id
1212
+ # User's email address. The special value "me" can be used to indicate the
1213
+ # authenticated user.
1214
+ # @param [String] fields
1215
+ # Selector specifying which fields to include in a partial response.
1216
+ # @param [String] quota_user
1217
+ # Available to use for quota purposes for server-side applications. Can be any
1218
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1219
+ # @param [Google::Apis::RequestOptions] options
1220
+ # Request-specific options
1221
+ #
1222
+ # @yield [result, err] Result & error if block supplied
1223
+ # @yieldparam result [Google::Apis::GmailV1::LanguageSettings] parsed result object
1224
+ # @yieldparam err [StandardError] error object if request failed
1225
+ #
1226
+ # @return [Google::Apis::GmailV1::LanguageSettings]
1227
+ #
1228
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1229
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1230
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1231
+ def get_user_setting_language(user_id, fields: nil, quota_user: nil, options: nil, &block)
1232
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/settings/language', options)
1233
+ command.response_representation = Google::Apis::GmailV1::LanguageSettings::Representation
1234
+ command.response_class = Google::Apis::GmailV1::LanguageSettings
1235
+ command.params['userId'] = user_id unless user_id.nil?
1236
+ command.query['fields'] = fields unless fields.nil?
1237
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1238
+ execute_or_queue_command(command, &block)
1239
+ end
1240
+
1241
+ # Gets POP settings.
1242
+ # @param [String] user_id
1243
+ # User's email address. The special value "me" can be used to indicate the
1244
+ # authenticated user.
1245
+ # @param [String] fields
1246
+ # Selector specifying which fields to include in a partial response.
1247
+ # @param [String] quota_user
1248
+ # Available to use for quota purposes for server-side applications. Can be any
1249
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1250
+ # @param [Google::Apis::RequestOptions] options
1251
+ # Request-specific options
1252
+ #
1253
+ # @yield [result, err] Result & error if block supplied
1254
+ # @yieldparam result [Google::Apis::GmailV1::PopSettings] parsed result object
1255
+ # @yieldparam err [StandardError] error object if request failed
1256
+ #
1257
+ # @return [Google::Apis::GmailV1::PopSettings]
1258
+ #
1259
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1260
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1261
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1262
+ def get_user_setting_pop(user_id, fields: nil, quota_user: nil, options: nil, &block)
1263
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/settings/pop', options)
1264
+ command.response_representation = Google::Apis::GmailV1::PopSettings::Representation
1265
+ command.response_class = Google::Apis::GmailV1::PopSettings
1266
+ command.params['userId'] = user_id unless user_id.nil?
1267
+ command.query['fields'] = fields unless fields.nil?
1268
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1269
+ execute_or_queue_command(command, &block)
1270
+ end
1271
+
1272
+ # Gets vacation responder settings.
1273
+ # @param [String] user_id
1274
+ # User's email address. The special value "me" can be used to indicate the
1275
+ # authenticated user.
1276
+ # @param [String] fields
1277
+ # Selector specifying which fields to include in a partial response.
1278
+ # @param [String] quota_user
1279
+ # Available to use for quota purposes for server-side applications. Can be any
1280
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1281
+ # @param [Google::Apis::RequestOptions] options
1282
+ # Request-specific options
1283
+ #
1284
+ # @yield [result, err] Result & error if block supplied
1285
+ # @yieldparam result [Google::Apis::GmailV1::VacationSettings] parsed result object
1286
+ # @yieldparam err [StandardError] error object if request failed
1287
+ #
1288
+ # @return [Google::Apis::GmailV1::VacationSettings]
1289
+ #
1290
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1291
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1292
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1293
+ def get_user_setting_vacation(user_id, fields: nil, quota_user: nil, options: nil, &block)
1294
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/settings/vacation', options)
1295
+ command.response_representation = Google::Apis::GmailV1::VacationSettings::Representation
1296
+ command.response_class = Google::Apis::GmailV1::VacationSettings
1297
+ command.params['userId'] = user_id unless user_id.nil?
1298
+ command.query['fields'] = fields unless fields.nil?
1299
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1300
+ execute_or_queue_command(command, &block)
1301
+ end
1302
+
1303
+ # Updates the auto-forwarding setting for the specified account. A verified
1304
+ # forwarding address must be specified when auto-forwarding is enabled. This
1305
+ # method is only available to service account clients that have been delegated
1306
+ # domain-wide authority.
1307
+ # @param [String] user_id
1308
+ # User's email address. The special value "me" can be used to indicate the
1309
+ # authenticated user.
1310
+ # @param [Google::Apis::GmailV1::AutoForwarding] auto_forwarding_object
1311
+ # @param [String] fields
1312
+ # Selector specifying which fields to include in a partial response.
1313
+ # @param [String] quota_user
1314
+ # Available to use for quota purposes for server-side applications. Can be any
1315
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1316
+ # @param [Google::Apis::RequestOptions] options
1317
+ # Request-specific options
1318
+ #
1319
+ # @yield [result, err] Result & error if block supplied
1320
+ # @yieldparam result [Google::Apis::GmailV1::AutoForwarding] parsed result object
1321
+ # @yieldparam err [StandardError] error object if request failed
1322
+ #
1323
+ # @return [Google::Apis::GmailV1::AutoForwarding]
1324
+ #
1325
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1326
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1327
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1328
+ def update_user_setting_auto_forwarding(user_id, auto_forwarding_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1329
+ command = make_simple_command(:put, 'gmail/v1/users/{userId}/settings/autoForwarding', options)
1330
+ command.request_representation = Google::Apis::GmailV1::AutoForwarding::Representation
1331
+ command.request_object = auto_forwarding_object
1332
+ command.response_representation = Google::Apis::GmailV1::AutoForwarding::Representation
1333
+ command.response_class = Google::Apis::GmailV1::AutoForwarding
1334
+ command.params['userId'] = user_id unless user_id.nil?
1335
+ command.query['fields'] = fields unless fields.nil?
1336
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1337
+ execute_or_queue_command(command, &block)
1338
+ end
1339
+
1340
+ # Updates IMAP settings.
1341
+ # @param [String] user_id
1342
+ # User's email address. The special value "me" can be used to indicate the
1343
+ # authenticated user.
1344
+ # @param [Google::Apis::GmailV1::ImapSettings] imap_settings_object
1345
+ # @param [String] fields
1346
+ # Selector specifying which fields to include in a partial response.
1347
+ # @param [String] quota_user
1348
+ # Available to use for quota purposes for server-side applications. Can be any
1349
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1350
+ # @param [Google::Apis::RequestOptions] options
1351
+ # Request-specific options
1352
+ #
1353
+ # @yield [result, err] Result & error if block supplied
1354
+ # @yieldparam result [Google::Apis::GmailV1::ImapSettings] parsed result object
1355
+ # @yieldparam err [StandardError] error object if request failed
1356
+ #
1357
+ # @return [Google::Apis::GmailV1::ImapSettings]
1358
+ #
1359
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1360
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1361
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1362
+ def update_user_setting_imap(user_id, imap_settings_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1363
+ command = make_simple_command(:put, 'gmail/v1/users/{userId}/settings/imap', options)
1364
+ command.request_representation = Google::Apis::GmailV1::ImapSettings::Representation
1365
+ command.request_object = imap_settings_object
1366
+ command.response_representation = Google::Apis::GmailV1::ImapSettings::Representation
1367
+ command.response_class = Google::Apis::GmailV1::ImapSettings
1368
+ command.params['userId'] = user_id unless user_id.nil?
1369
+ command.query['fields'] = fields unless fields.nil?
1370
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1371
+ execute_or_queue_command(command, &block)
1372
+ end
1373
+
1374
+ # Updates language settings. If successful, the return object contains the `
1375
+ # displayLanguage` that was saved for the user, which may differ from the value
1376
+ # passed into the request. This is because the requested `displayLanguage` may
1377
+ # not be directly supported by Gmail but have a close variant that is, and so
1378
+ # the variant may be chosen and saved instead.
1379
+ # @param [String] user_id
1380
+ # User's email address. The special value "me" can be used to indicate the
1381
+ # authenticated user.
1382
+ # @param [Google::Apis::GmailV1::LanguageSettings] language_settings_object
1383
+ # @param [String] fields
1384
+ # Selector specifying which fields to include in a partial response.
1385
+ # @param [String] quota_user
1386
+ # Available to use for quota purposes for server-side applications. Can be any
1387
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1388
+ # @param [Google::Apis::RequestOptions] options
1389
+ # Request-specific options
1390
+ #
1391
+ # @yield [result, err] Result & error if block supplied
1392
+ # @yieldparam result [Google::Apis::GmailV1::LanguageSettings] parsed result object
1393
+ # @yieldparam err [StandardError] error object if request failed
1394
+ #
1395
+ # @return [Google::Apis::GmailV1::LanguageSettings]
1396
+ #
1397
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1398
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1399
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1400
+ def update_user_setting_language(user_id, language_settings_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1401
+ command = make_simple_command(:put, 'gmail/v1/users/{userId}/settings/language', options)
1402
+ command.request_representation = Google::Apis::GmailV1::LanguageSettings::Representation
1403
+ command.request_object = language_settings_object
1404
+ command.response_representation = Google::Apis::GmailV1::LanguageSettings::Representation
1405
+ command.response_class = Google::Apis::GmailV1::LanguageSettings
1406
+ command.params['userId'] = user_id unless user_id.nil?
1407
+ command.query['fields'] = fields unless fields.nil?
1408
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1409
+ execute_or_queue_command(command, &block)
1410
+ end
1411
+
1412
+ # Updates POP settings.
1413
+ # @param [String] user_id
1414
+ # User's email address. The special value "me" can be used to indicate the
1415
+ # authenticated user.
1416
+ # @param [Google::Apis::GmailV1::PopSettings] pop_settings_object
1417
+ # @param [String] fields
1418
+ # Selector specifying which fields to include in a partial response.
1419
+ # @param [String] quota_user
1420
+ # Available to use for quota purposes for server-side applications. Can be any
1421
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1422
+ # @param [Google::Apis::RequestOptions] options
1423
+ # Request-specific options
1424
+ #
1425
+ # @yield [result, err] Result & error if block supplied
1426
+ # @yieldparam result [Google::Apis::GmailV1::PopSettings] parsed result object
1427
+ # @yieldparam err [StandardError] error object if request failed
1428
+ #
1429
+ # @return [Google::Apis::GmailV1::PopSettings]
1430
+ #
1431
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1432
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1433
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1434
+ def update_user_setting_pop(user_id, pop_settings_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1435
+ command = make_simple_command(:put, 'gmail/v1/users/{userId}/settings/pop', options)
1436
+ command.request_representation = Google::Apis::GmailV1::PopSettings::Representation
1437
+ command.request_object = pop_settings_object
1438
+ command.response_representation = Google::Apis::GmailV1::PopSettings::Representation
1439
+ command.response_class = Google::Apis::GmailV1::PopSettings
1440
+ command.params['userId'] = user_id unless user_id.nil?
1441
+ command.query['fields'] = fields unless fields.nil?
1442
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1443
+ execute_or_queue_command(command, &block)
1444
+ end
1445
+
1446
+ # Updates vacation responder settings.
1447
+ # @param [String] user_id
1448
+ # User's email address. The special value "me" can be used to indicate the
1449
+ # authenticated user.
1450
+ # @param [Google::Apis::GmailV1::VacationSettings] vacation_settings_object
1451
+ # @param [String] fields
1452
+ # Selector specifying which fields to include in a partial response.
1453
+ # @param [String] quota_user
1454
+ # Available to use for quota purposes for server-side applications. Can be any
1455
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1456
+ # @param [Google::Apis::RequestOptions] options
1457
+ # Request-specific options
1458
+ #
1459
+ # @yield [result, err] Result & error if block supplied
1460
+ # @yieldparam result [Google::Apis::GmailV1::VacationSettings] parsed result object
1461
+ # @yieldparam err [StandardError] error object if request failed
1462
+ #
1463
+ # @return [Google::Apis::GmailV1::VacationSettings]
1464
+ #
1465
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1466
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1467
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1468
+ def update_user_setting_vacation(user_id, vacation_settings_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1469
+ command = make_simple_command(:put, 'gmail/v1/users/{userId}/settings/vacation', options)
1470
+ command.request_representation = Google::Apis::GmailV1::VacationSettings::Representation
1471
+ command.request_object = vacation_settings_object
1472
+ command.response_representation = Google::Apis::GmailV1::VacationSettings::Representation
1473
+ command.response_class = Google::Apis::GmailV1::VacationSettings
1474
+ command.params['userId'] = user_id unless user_id.nil?
1475
+ command.query['fields'] = fields unless fields.nil?
1476
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1477
+ execute_or_queue_command(command, &block)
1478
+ end
1479
+
1480
+ # Adds a delegate with its verification status set directly to `accepted`,
1481
+ # without sending any verification email. The delegate user must be a member of
1482
+ # the same G Suite organization as the delegator user. Gmail imposes limitations
1483
+ # on the number of delegates and delegators each user in a G Suite organization
1484
+ # can have. These limits depend on your organization, but in general each user
1485
+ # can have up to 25 delegates and up to 10 delegators. Note that a delegate user
1486
+ # must be referred to by their primary email address, and not an email alias.
1487
+ # Also note that when a new delegate is created, there may be up to a one minute
1488
+ # delay before the new delegate is available for use. This method is only
1489
+ # available to service account clients that have been delegated domain-wide
1490
+ # authority.
1491
+ # @param [String] user_id
1492
+ # User's email address. The special value "me" can be used to indicate the
1493
+ # authenticated user.
1494
+ # @param [Google::Apis::GmailV1::Delegate] delegate_object
1495
+ # @param [String] fields
1496
+ # Selector specifying which fields to include in a partial response.
1497
+ # @param [String] quota_user
1498
+ # Available to use for quota purposes for server-side applications. Can be any
1499
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1500
+ # @param [Google::Apis::RequestOptions] options
1501
+ # Request-specific options
1502
+ #
1503
+ # @yield [result, err] Result & error if block supplied
1504
+ # @yieldparam result [Google::Apis::GmailV1::Delegate] parsed result object
1505
+ # @yieldparam err [StandardError] error object if request failed
1506
+ #
1507
+ # @return [Google::Apis::GmailV1::Delegate]
1508
+ #
1509
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1510
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1511
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1512
+ def create_user_setting_delegate(user_id, delegate_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1513
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/settings/delegates', options)
1514
+ command.request_representation = Google::Apis::GmailV1::Delegate::Representation
1515
+ command.request_object = delegate_object
1516
+ command.response_representation = Google::Apis::GmailV1::Delegate::Representation
1517
+ command.response_class = Google::Apis::GmailV1::Delegate
1518
+ command.params['userId'] = user_id unless user_id.nil?
1519
+ command.query['fields'] = fields unless fields.nil?
1520
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1521
+ execute_or_queue_command(command, &block)
1522
+ end
1523
+
1524
+ # Removes the specified delegate (which can be of any verification status), and
1525
+ # revokes any verification that may have been required for using it. Note that a
1526
+ # delegate user must be referred to by their primary email address, and not an
1527
+ # email alias. This method is only available to service account clients that
1528
+ # have been delegated domain-wide authority.
1529
+ # @param [String] user_id
1530
+ # User's email address. The special value "me" can be used to indicate the
1531
+ # authenticated user.
1532
+ # @param [String] delegate_email
1533
+ # The email address of the user to be removed as a delegate.
1534
+ # @param [String] fields
1535
+ # Selector specifying which fields to include in a partial response.
1536
+ # @param [String] quota_user
1537
+ # Available to use for quota purposes for server-side applications. Can be any
1538
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1539
+ # @param [Google::Apis::RequestOptions] options
1540
+ # Request-specific options
1541
+ #
1542
+ # @yield [result, err] Result & error if block supplied
1543
+ # @yieldparam result [NilClass] No result returned for this method
1544
+ # @yieldparam err [StandardError] error object if request failed
1545
+ #
1546
+ # @return [void]
1547
+ #
1548
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1549
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1550
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1551
+ def delete_user_setting_delegate(user_id, delegate_email, fields: nil, quota_user: nil, options: nil, &block)
1552
+ command = make_simple_command(:delete, 'gmail/v1/users/{userId}/settings/delegates/{delegateEmail}', options)
1553
+ command.params['userId'] = user_id unless user_id.nil?
1554
+ command.params['delegateEmail'] = delegate_email unless delegate_email.nil?
1555
+ command.query['fields'] = fields unless fields.nil?
1556
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1557
+ execute_or_queue_command(command, &block)
1558
+ end
1559
+
1560
+ # Gets the specified delegate. Note that a delegate user must be referred to by
1561
+ # their primary email address, and not an email alias. This method is only
1562
+ # available to service account clients that have been delegated domain-wide
1563
+ # authority.
1564
+ # @param [String] user_id
1565
+ # User's email address. The special value "me" can be used to indicate the
1566
+ # authenticated user.
1567
+ # @param [String] delegate_email
1568
+ # The email address of the user whose delegate relationship is to be retrieved.
1569
+ # @param [String] fields
1570
+ # Selector specifying which fields to include in a partial response.
1571
+ # @param [String] quota_user
1572
+ # Available to use for quota purposes for server-side applications. Can be any
1573
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1574
+ # @param [Google::Apis::RequestOptions] options
1575
+ # Request-specific options
1576
+ #
1577
+ # @yield [result, err] Result & error if block supplied
1578
+ # @yieldparam result [Google::Apis::GmailV1::Delegate] parsed result object
1579
+ # @yieldparam err [StandardError] error object if request failed
1580
+ #
1581
+ # @return [Google::Apis::GmailV1::Delegate]
1582
+ #
1583
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1584
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1585
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1586
+ def get_user_setting_delegate(user_id, delegate_email, fields: nil, quota_user: nil, options: nil, &block)
1587
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/settings/delegates/{delegateEmail}', options)
1588
+ command.response_representation = Google::Apis::GmailV1::Delegate::Representation
1589
+ command.response_class = Google::Apis::GmailV1::Delegate
1590
+ command.params['userId'] = user_id unless user_id.nil?
1591
+ command.params['delegateEmail'] = delegate_email unless delegate_email.nil?
1592
+ command.query['fields'] = fields unless fields.nil?
1593
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1594
+ execute_or_queue_command(command, &block)
1595
+ end
1596
+
1597
+ # Lists the delegates for the specified account. This method is only available
1598
+ # to service account clients that have been delegated domain-wide authority.
1599
+ # @param [String] user_id
1600
+ # User's email address. The special value "me" can be used to indicate the
1601
+ # authenticated user.
1602
+ # @param [String] fields
1603
+ # Selector specifying which fields to include in a partial response.
1604
+ # @param [String] quota_user
1605
+ # Available to use for quota purposes for server-side applications. Can be any
1606
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1607
+ # @param [Google::Apis::RequestOptions] options
1608
+ # Request-specific options
1609
+ #
1610
+ # @yield [result, err] Result & error if block supplied
1611
+ # @yieldparam result [Google::Apis::GmailV1::ListDelegatesResponse] parsed result object
1612
+ # @yieldparam err [StandardError] error object if request failed
1613
+ #
1614
+ # @return [Google::Apis::GmailV1::ListDelegatesResponse]
1615
+ #
1616
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1617
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1618
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1619
+ def list_user_setting_delegates(user_id, fields: nil, quota_user: nil, options: nil, &block)
1620
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/settings/delegates', options)
1621
+ command.response_representation = Google::Apis::GmailV1::ListDelegatesResponse::Representation
1622
+ command.response_class = Google::Apis::GmailV1::ListDelegatesResponse
1623
+ command.params['userId'] = user_id unless user_id.nil?
1624
+ command.query['fields'] = fields unless fields.nil?
1625
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1626
+ execute_or_queue_command(command, &block)
1627
+ end
1628
+
1629
+ # Creates a filter. Note: you can only create a maximum of 1,000 filters.
1630
+ # @param [String] user_id
1631
+ # User's email address. The special value "me" can be used to indicate the
1632
+ # authenticated user.
1633
+ # @param [Google::Apis::GmailV1::Filter] filter_object
1634
+ # @param [String] fields
1635
+ # Selector specifying which fields to include in a partial response.
1636
+ # @param [String] quota_user
1637
+ # Available to use for quota purposes for server-side applications. Can be any
1638
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1639
+ # @param [Google::Apis::RequestOptions] options
1640
+ # Request-specific options
1641
+ #
1642
+ # @yield [result, err] Result & error if block supplied
1643
+ # @yieldparam result [Google::Apis::GmailV1::Filter] parsed result object
1644
+ # @yieldparam err [StandardError] error object if request failed
1645
+ #
1646
+ # @return [Google::Apis::GmailV1::Filter]
1647
+ #
1648
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1649
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1650
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1651
+ def create_user_setting_filter(user_id, filter_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1652
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/settings/filters', options)
1653
+ command.request_representation = Google::Apis::GmailV1::Filter::Representation
1654
+ command.request_object = filter_object
1655
+ command.response_representation = Google::Apis::GmailV1::Filter::Representation
1656
+ command.response_class = Google::Apis::GmailV1::Filter
1657
+ command.params['userId'] = user_id unless user_id.nil?
1658
+ command.query['fields'] = fields unless fields.nil?
1659
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1660
+ execute_or_queue_command(command, &block)
1661
+ end
1662
+
1663
+ # Deletes a filter.
1664
+ # @param [String] user_id
1665
+ # User's email address. The special value "me" can be used to indicate the
1666
+ # authenticated user.
1667
+ # @param [String] id
1668
+ # The ID of the filter to be deleted.
1669
+ # @param [String] fields
1670
+ # Selector specifying which fields to include in a partial response.
1671
+ # @param [String] quota_user
1672
+ # Available to use for quota purposes for server-side applications. Can be any
1673
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1674
+ # @param [Google::Apis::RequestOptions] options
1675
+ # Request-specific options
1676
+ #
1677
+ # @yield [result, err] Result & error if block supplied
1678
+ # @yieldparam result [NilClass] No result returned for this method
1679
+ # @yieldparam err [StandardError] error object if request failed
1680
+ #
1681
+ # @return [void]
1682
+ #
1683
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1684
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1685
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1686
+ def delete_user_setting_filter(user_id, id, fields: nil, quota_user: nil, options: nil, &block)
1687
+ command = make_simple_command(:delete, 'gmail/v1/users/{userId}/settings/filters/{id}', options)
1688
+ command.params['userId'] = user_id unless user_id.nil?
1689
+ command.params['id'] = id unless id.nil?
1690
+ command.query['fields'] = fields unless fields.nil?
1691
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1692
+ execute_or_queue_command(command, &block)
1693
+ end
1694
+
1695
+ # Gets a filter.
1696
+ # @param [String] user_id
1697
+ # User's email address. The special value "me" can be used to indicate the
1698
+ # authenticated user.
1699
+ # @param [String] id
1700
+ # The ID of the filter to be fetched.
1701
+ # @param [String] fields
1702
+ # Selector specifying which fields to include in a partial response.
1703
+ # @param [String] quota_user
1704
+ # Available to use for quota purposes for server-side applications. Can be any
1705
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1706
+ # @param [Google::Apis::RequestOptions] options
1707
+ # Request-specific options
1708
+ #
1709
+ # @yield [result, err] Result & error if block supplied
1710
+ # @yieldparam result [Google::Apis::GmailV1::Filter] parsed result object
1711
+ # @yieldparam err [StandardError] error object if request failed
1712
+ #
1713
+ # @return [Google::Apis::GmailV1::Filter]
1714
+ #
1715
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1716
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1717
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1718
+ def get_user_setting_filter(user_id, id, fields: nil, quota_user: nil, options: nil, &block)
1719
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/settings/filters/{id}', options)
1720
+ command.response_representation = Google::Apis::GmailV1::Filter::Representation
1721
+ command.response_class = Google::Apis::GmailV1::Filter
1722
+ command.params['userId'] = user_id unless user_id.nil?
1723
+ command.params['id'] = id unless id.nil?
1724
+ command.query['fields'] = fields unless fields.nil?
1725
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1726
+ execute_or_queue_command(command, &block)
1727
+ end
1728
+
1729
+ # Lists the message filters of a Gmail user.
1730
+ # @param [String] user_id
1731
+ # User's email address. The special value "me" can be used to indicate the
1732
+ # authenticated user.
1733
+ # @param [String] fields
1734
+ # Selector specifying which fields to include in a partial response.
1735
+ # @param [String] quota_user
1736
+ # Available to use for quota purposes for server-side applications. Can be any
1737
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1738
+ # @param [Google::Apis::RequestOptions] options
1739
+ # Request-specific options
1740
+ #
1741
+ # @yield [result, err] Result & error if block supplied
1742
+ # @yieldparam result [Google::Apis::GmailV1::ListFiltersResponse] parsed result object
1743
+ # @yieldparam err [StandardError] error object if request failed
1744
+ #
1745
+ # @return [Google::Apis::GmailV1::ListFiltersResponse]
1746
+ #
1747
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1748
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1749
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1750
+ def list_user_setting_filters(user_id, fields: nil, quota_user: nil, options: nil, &block)
1751
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/settings/filters', options)
1752
+ command.response_representation = Google::Apis::GmailV1::ListFiltersResponse::Representation
1753
+ command.response_class = Google::Apis::GmailV1::ListFiltersResponse
1754
+ command.params['userId'] = user_id unless user_id.nil?
1755
+ command.query['fields'] = fields unless fields.nil?
1756
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1757
+ execute_or_queue_command(command, &block)
1758
+ end
1759
+
1760
+ # Creates a forwarding address. If ownership verification is required, a message
1761
+ # will be sent to the recipient and the resource's verification status will be
1762
+ # set to `pending`; otherwise, the resource will be created with verification
1763
+ # status set to `accepted`. This method is only available to service account
1764
+ # clients that have been delegated domain-wide authority.
1765
+ # @param [String] user_id
1766
+ # User's email address. The special value "me" can be used to indicate the
1767
+ # authenticated user.
1768
+ # @param [Google::Apis::GmailV1::ForwardingAddress] forwarding_address_object
1769
+ # @param [String] fields
1770
+ # Selector specifying which fields to include in a partial response.
1771
+ # @param [String] quota_user
1772
+ # Available to use for quota purposes for server-side applications. Can be any
1773
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1774
+ # @param [Google::Apis::RequestOptions] options
1775
+ # Request-specific options
1776
+ #
1777
+ # @yield [result, err] Result & error if block supplied
1778
+ # @yieldparam result [Google::Apis::GmailV1::ForwardingAddress] parsed result object
1779
+ # @yieldparam err [StandardError] error object if request failed
1780
+ #
1781
+ # @return [Google::Apis::GmailV1::ForwardingAddress]
1782
+ #
1783
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1784
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1785
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1786
+ def create_user_setting_forwarding_address(user_id, forwarding_address_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1787
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/settings/forwardingAddresses', options)
1788
+ command.request_representation = Google::Apis::GmailV1::ForwardingAddress::Representation
1789
+ command.request_object = forwarding_address_object
1790
+ command.response_representation = Google::Apis::GmailV1::ForwardingAddress::Representation
1791
+ command.response_class = Google::Apis::GmailV1::ForwardingAddress
1792
+ command.params['userId'] = user_id unless user_id.nil?
1793
+ command.query['fields'] = fields unless fields.nil?
1794
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1795
+ execute_or_queue_command(command, &block)
1796
+ end
1797
+
1798
+ # Deletes the specified forwarding address and revokes any verification that may
1799
+ # have been required. This method is only available to service account clients
1800
+ # that have been delegated domain-wide authority.
1801
+ # @param [String] user_id
1802
+ # User's email address. The special value "me" can be used to indicate the
1803
+ # authenticated user.
1804
+ # @param [String] forwarding_email
1805
+ # The forwarding address to be deleted.
1806
+ # @param [String] fields
1807
+ # Selector specifying which fields to include in a partial response.
1808
+ # @param [String] quota_user
1809
+ # Available to use for quota purposes for server-side applications. Can be any
1810
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1811
+ # @param [Google::Apis::RequestOptions] options
1812
+ # Request-specific options
1813
+ #
1814
+ # @yield [result, err] Result & error if block supplied
1815
+ # @yieldparam result [NilClass] No result returned for this method
1816
+ # @yieldparam err [StandardError] error object if request failed
1817
+ #
1818
+ # @return [void]
1819
+ #
1820
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1821
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1822
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1823
+ def delete_user_setting_forwarding_address(user_id, forwarding_email, fields: nil, quota_user: nil, options: nil, &block)
1824
+ command = make_simple_command(:delete, 'gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}', options)
1825
+ command.params['userId'] = user_id unless user_id.nil?
1826
+ command.params['forwardingEmail'] = forwarding_email unless forwarding_email.nil?
1827
+ command.query['fields'] = fields unless fields.nil?
1828
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1829
+ execute_or_queue_command(command, &block)
1830
+ end
1831
+
1832
+ # Gets the specified forwarding address.
1833
+ # @param [String] user_id
1834
+ # User's email address. The special value "me" can be used to indicate the
1835
+ # authenticated user.
1836
+ # @param [String] forwarding_email
1837
+ # The forwarding address to be retrieved.
1838
+ # @param [String] fields
1839
+ # Selector specifying which fields to include in a partial response.
1840
+ # @param [String] quota_user
1841
+ # Available to use for quota purposes for server-side applications. Can be any
1842
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1843
+ # @param [Google::Apis::RequestOptions] options
1844
+ # Request-specific options
1845
+ #
1846
+ # @yield [result, err] Result & error if block supplied
1847
+ # @yieldparam result [Google::Apis::GmailV1::ForwardingAddress] parsed result object
1848
+ # @yieldparam err [StandardError] error object if request failed
1849
+ #
1850
+ # @return [Google::Apis::GmailV1::ForwardingAddress]
1851
+ #
1852
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1853
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1854
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1855
+ def get_user_setting_forwarding_address(user_id, forwarding_email, fields: nil, quota_user: nil, options: nil, &block)
1856
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}', options)
1857
+ command.response_representation = Google::Apis::GmailV1::ForwardingAddress::Representation
1858
+ command.response_class = Google::Apis::GmailV1::ForwardingAddress
1859
+ command.params['userId'] = user_id unless user_id.nil?
1860
+ command.params['forwardingEmail'] = forwarding_email unless forwarding_email.nil?
1861
+ command.query['fields'] = fields unless fields.nil?
1862
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1863
+ execute_or_queue_command(command, &block)
1864
+ end
1865
+
1866
+ # Lists the forwarding addresses for the specified account.
1867
+ # @param [String] user_id
1868
+ # User's email address. The special value "me" can be used to indicate the
1869
+ # authenticated user.
1870
+ # @param [String] fields
1871
+ # Selector specifying which fields to include in a partial response.
1872
+ # @param [String] quota_user
1873
+ # Available to use for quota purposes for server-side applications. Can be any
1874
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1875
+ # @param [Google::Apis::RequestOptions] options
1876
+ # Request-specific options
1877
+ #
1878
+ # @yield [result, err] Result & error if block supplied
1879
+ # @yieldparam result [Google::Apis::GmailV1::ListForwardingAddressesResponse] parsed result object
1880
+ # @yieldparam err [StandardError] error object if request failed
1881
+ #
1882
+ # @return [Google::Apis::GmailV1::ListForwardingAddressesResponse]
1883
+ #
1884
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1885
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1886
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1887
+ def list_user_setting_forwarding_addresses(user_id, fields: nil, quota_user: nil, options: nil, &block)
1888
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/settings/forwardingAddresses', options)
1889
+ command.response_representation = Google::Apis::GmailV1::ListForwardingAddressesResponse::Representation
1890
+ command.response_class = Google::Apis::GmailV1::ListForwardingAddressesResponse
1891
+ command.params['userId'] = user_id unless user_id.nil?
1892
+ command.query['fields'] = fields unless fields.nil?
1893
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1894
+ execute_or_queue_command(command, &block)
1895
+ end
1896
+
1897
+ # Creates a custom "from" send-as alias. If an SMTP MSA is specified, Gmail will
1898
+ # attempt to connect to the SMTP service to validate the configuration before
1899
+ # creating the alias. If ownership verification is required for the alias, a
1900
+ # message will be sent to the email address and the resource's verification
1901
+ # status will be set to `pending`; otherwise, the resource will be created with
1902
+ # verification status set to `accepted`. If a signature is provided, Gmail will
1903
+ # sanitize the HTML before saving it with the alias. This method is only
1904
+ # available to service account clients that have been delegated domain-wide
1905
+ # authority.
1906
+ # @param [String] user_id
1907
+ # User's email address. The special value "me" can be used to indicate the
1908
+ # authenticated user.
1909
+ # @param [Google::Apis::GmailV1::SendAs] send_as_object
1910
+ # @param [String] fields
1911
+ # Selector specifying which fields to include in a partial response.
1912
+ # @param [String] quota_user
1913
+ # Available to use for quota purposes for server-side applications. Can be any
1914
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1915
+ # @param [Google::Apis::RequestOptions] options
1916
+ # Request-specific options
1917
+ #
1918
+ # @yield [result, err] Result & error if block supplied
1919
+ # @yieldparam result [Google::Apis::GmailV1::SendAs] parsed result object
1920
+ # @yieldparam err [StandardError] error object if request failed
1921
+ #
1922
+ # @return [Google::Apis::GmailV1::SendAs]
1923
+ #
1924
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1925
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1926
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1927
+ def create_user_setting_send_as(user_id, send_as_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1928
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/settings/sendAs', options)
1929
+ command.request_representation = Google::Apis::GmailV1::SendAs::Representation
1930
+ command.request_object = send_as_object
1931
+ command.response_representation = Google::Apis::GmailV1::SendAs::Representation
1932
+ command.response_class = Google::Apis::GmailV1::SendAs
1933
+ command.params['userId'] = user_id unless user_id.nil?
1934
+ command.query['fields'] = fields unless fields.nil?
1935
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1936
+ execute_or_queue_command(command, &block)
1937
+ end
1938
+
1939
+ # Deletes the specified send-as alias. Revokes any verification that may have
1940
+ # been required for using it. This method is only available to service account
1941
+ # clients that have been delegated domain-wide authority.
1942
+ # @param [String] user_id
1943
+ # User's email address. The special value "me" can be used to indicate the
1944
+ # authenticated user.
1945
+ # @param [String] send_as_email
1946
+ # The send-as alias to be deleted.
1947
+ # @param [String] fields
1948
+ # Selector specifying which fields to include in a partial response.
1949
+ # @param [String] quota_user
1950
+ # Available to use for quota purposes for server-side applications. Can be any
1951
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1952
+ # @param [Google::Apis::RequestOptions] options
1953
+ # Request-specific options
1954
+ #
1955
+ # @yield [result, err] Result & error if block supplied
1956
+ # @yieldparam result [NilClass] No result returned for this method
1957
+ # @yieldparam err [StandardError] error object if request failed
1958
+ #
1959
+ # @return [void]
1960
+ #
1961
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1962
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1963
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1964
+ def delete_user_setting_send_as(user_id, send_as_email, fields: nil, quota_user: nil, options: nil, &block)
1965
+ command = make_simple_command(:delete, 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}', options)
1966
+ command.params['userId'] = user_id unless user_id.nil?
1967
+ command.params['sendAsEmail'] = send_as_email unless send_as_email.nil?
1968
+ command.query['fields'] = fields unless fields.nil?
1969
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1970
+ execute_or_queue_command(command, &block)
1971
+ end
1972
+
1973
+ # Gets the specified send-as alias. Fails with an HTTP 404 error if the
1974
+ # specified address is not a member of the collection.
1975
+ # @param [String] user_id
1976
+ # User's email address. The special value "me" can be used to indicate the
1977
+ # authenticated user.
1978
+ # @param [String] send_as_email
1979
+ # The send-as alias to be retrieved.
1980
+ # @param [String] fields
1981
+ # Selector specifying which fields to include in a partial response.
1982
+ # @param [String] quota_user
1983
+ # Available to use for quota purposes for server-side applications. Can be any
1984
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1985
+ # @param [Google::Apis::RequestOptions] options
1986
+ # Request-specific options
1987
+ #
1988
+ # @yield [result, err] Result & error if block supplied
1989
+ # @yieldparam result [Google::Apis::GmailV1::SendAs] parsed result object
1990
+ # @yieldparam err [StandardError] error object if request failed
1991
+ #
1992
+ # @return [Google::Apis::GmailV1::SendAs]
1993
+ #
1994
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1995
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1996
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1997
+ def get_user_setting_send_as(user_id, send_as_email, fields: nil, quota_user: nil, options: nil, &block)
1998
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}', options)
1999
+ command.response_representation = Google::Apis::GmailV1::SendAs::Representation
2000
+ command.response_class = Google::Apis::GmailV1::SendAs
2001
+ command.params['userId'] = user_id unless user_id.nil?
2002
+ command.params['sendAsEmail'] = send_as_email unless send_as_email.nil?
2003
+ command.query['fields'] = fields unless fields.nil?
2004
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2005
+ execute_or_queue_command(command, &block)
2006
+ end
2007
+
2008
+ # Lists the send-as aliases for the specified account. The result includes the
2009
+ # primary send-as address associated with the account as well as any custom "
2010
+ # from" aliases.
2011
+ # @param [String] user_id
2012
+ # User's email address. The special value "me" can be used to indicate the
2013
+ # authenticated user.
2014
+ # @param [String] fields
2015
+ # Selector specifying which fields to include in a partial response.
2016
+ # @param [String] quota_user
2017
+ # Available to use for quota purposes for server-side applications. Can be any
2018
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2019
+ # @param [Google::Apis::RequestOptions] options
2020
+ # Request-specific options
2021
+ #
2022
+ # @yield [result, err] Result & error if block supplied
2023
+ # @yieldparam result [Google::Apis::GmailV1::ListSendAsResponse] parsed result object
2024
+ # @yieldparam err [StandardError] error object if request failed
2025
+ #
2026
+ # @return [Google::Apis::GmailV1::ListSendAsResponse]
2027
+ #
2028
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2029
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2030
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2031
+ def list_user_setting_send_as(user_id, fields: nil, quota_user: nil, options: nil, &block)
2032
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/settings/sendAs', options)
2033
+ command.response_representation = Google::Apis::GmailV1::ListSendAsResponse::Representation
2034
+ command.response_class = Google::Apis::GmailV1::ListSendAsResponse
2035
+ command.params['userId'] = user_id unless user_id.nil?
2036
+ command.query['fields'] = fields unless fields.nil?
2037
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2038
+ execute_or_queue_command(command, &block)
2039
+ end
2040
+
2041
+ # Patch the specified send-as alias.
2042
+ # @param [String] user_id
2043
+ # User's email address. The special value "me" can be used to indicate the
2044
+ # authenticated user.
2045
+ # @param [String] send_as_email
2046
+ # The send-as alias to be updated.
2047
+ # @param [Google::Apis::GmailV1::SendAs] send_as_object
2048
+ # @param [String] fields
2049
+ # Selector specifying which fields to include in a partial response.
2050
+ # @param [String] quota_user
2051
+ # Available to use for quota purposes for server-side applications. Can be any
2052
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2053
+ # @param [Google::Apis::RequestOptions] options
2054
+ # Request-specific options
2055
+ #
2056
+ # @yield [result, err] Result & error if block supplied
2057
+ # @yieldparam result [Google::Apis::GmailV1::SendAs] parsed result object
2058
+ # @yieldparam err [StandardError] error object if request failed
2059
+ #
2060
+ # @return [Google::Apis::GmailV1::SendAs]
2061
+ #
2062
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2063
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2064
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2065
+ def patch_user_setting_send_as(user_id, send_as_email, send_as_object = nil, fields: nil, quota_user: nil, options: nil, &block)
2066
+ command = make_simple_command(:patch, 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}', options)
2067
+ command.request_representation = Google::Apis::GmailV1::SendAs::Representation
2068
+ command.request_object = send_as_object
2069
+ command.response_representation = Google::Apis::GmailV1::SendAs::Representation
2070
+ command.response_class = Google::Apis::GmailV1::SendAs
2071
+ command.params['userId'] = user_id unless user_id.nil?
2072
+ command.params['sendAsEmail'] = send_as_email unless send_as_email.nil?
2073
+ command.query['fields'] = fields unless fields.nil?
2074
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2075
+ execute_or_queue_command(command, &block)
2076
+ end
2077
+
2078
+ # Updates a send-as alias. If a signature is provided, Gmail will sanitize the
2079
+ # HTML before saving it with the alias. Addresses other than the primary address
2080
+ # for the account can only be updated by service account clients that have been
2081
+ # delegated domain-wide authority.
2082
+ # @param [String] user_id
2083
+ # User's email address. The special value "me" can be used to indicate the
2084
+ # authenticated user.
2085
+ # @param [String] send_as_email
2086
+ # The send-as alias to be updated.
2087
+ # @param [Google::Apis::GmailV1::SendAs] send_as_object
2088
+ # @param [String] fields
2089
+ # Selector specifying which fields to include in a partial response.
2090
+ # @param [String] quota_user
2091
+ # Available to use for quota purposes for server-side applications. Can be any
2092
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2093
+ # @param [Google::Apis::RequestOptions] options
2094
+ # Request-specific options
2095
+ #
2096
+ # @yield [result, err] Result & error if block supplied
2097
+ # @yieldparam result [Google::Apis::GmailV1::SendAs] parsed result object
2098
+ # @yieldparam err [StandardError] error object if request failed
2099
+ #
2100
+ # @return [Google::Apis::GmailV1::SendAs]
2101
+ #
2102
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2103
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2104
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2105
+ def update_user_setting_send_as(user_id, send_as_email, send_as_object = nil, fields: nil, quota_user: nil, options: nil, &block)
2106
+ command = make_simple_command(:put, 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}', options)
2107
+ command.request_representation = Google::Apis::GmailV1::SendAs::Representation
2108
+ command.request_object = send_as_object
2109
+ command.response_representation = Google::Apis::GmailV1::SendAs::Representation
2110
+ command.response_class = Google::Apis::GmailV1::SendAs
2111
+ command.params['userId'] = user_id unless user_id.nil?
2112
+ command.params['sendAsEmail'] = send_as_email unless send_as_email.nil?
2113
+ command.query['fields'] = fields unless fields.nil?
2114
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2115
+ execute_or_queue_command(command, &block)
2116
+ end
2117
+
2118
+ # Sends a verification email to the specified send-as alias address. The
2119
+ # verification status must be `pending`. This method is only available to
2120
+ # service account clients that have been delegated domain-wide authority.
2121
+ # @param [String] user_id
2122
+ # User's email address. The special value "me" can be used to indicate the
2123
+ # authenticated user.
2124
+ # @param [String] send_as_email
2125
+ # The send-as alias to be verified.
2126
+ # @param [String] fields
2127
+ # Selector specifying which fields to include in a partial response.
2128
+ # @param [String] quota_user
2129
+ # Available to use for quota purposes for server-side applications. Can be any
2130
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2131
+ # @param [Google::Apis::RequestOptions] options
2132
+ # Request-specific options
2133
+ #
2134
+ # @yield [result, err] Result & error if block supplied
2135
+ # @yieldparam result [NilClass] No result returned for this method
2136
+ # @yieldparam err [StandardError] error object if request failed
2137
+ #
2138
+ # @return [void]
2139
+ #
2140
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2141
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2142
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2143
+ def verify_user_setting_send_as(user_id, send_as_email, fields: nil, quota_user: nil, options: nil, &block)
2144
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/verify', options)
2145
+ command.params['userId'] = user_id unless user_id.nil?
2146
+ command.params['sendAsEmail'] = send_as_email unless send_as_email.nil?
2147
+ command.query['fields'] = fields unless fields.nil?
2148
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2149
+ execute_or_queue_command(command, &block)
2150
+ end
2151
+
2152
+ # Deletes the specified S/MIME config for the specified send-as alias.
2153
+ # @param [String] user_id
2154
+ # The user's email address. The special value `me` can be used to indicate the
2155
+ # authenticated user.
2156
+ # @param [String] send_as_email
2157
+ # The email address that appears in the "From:" header for mail sent using this
2158
+ # alias.
2159
+ # @param [String] id
2160
+ # The immutable ID for the SmimeInfo.
2161
+ # @param [String] fields
2162
+ # Selector specifying which fields to include in a partial response.
2163
+ # @param [String] quota_user
2164
+ # Available to use for quota purposes for server-side applications. Can be any
2165
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2166
+ # @param [Google::Apis::RequestOptions] options
2167
+ # Request-specific options
2168
+ #
2169
+ # @yield [result, err] Result & error if block supplied
2170
+ # @yieldparam result [NilClass] No result returned for this method
2171
+ # @yieldparam err [StandardError] error object if request failed
2172
+ #
2173
+ # @return [void]
2174
+ #
2175
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2176
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2177
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2178
+ def delete_user_setting_send_a_smime_info(user_id, send_as_email, id, fields: nil, quota_user: nil, options: nil, &block)
2179
+ command = make_simple_command(:delete, 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}', options)
2180
+ command.params['userId'] = user_id unless user_id.nil?
2181
+ command.params['sendAsEmail'] = send_as_email unless send_as_email.nil?
2182
+ command.params['id'] = id unless id.nil?
2183
+ command.query['fields'] = fields unless fields.nil?
2184
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2185
+ execute_or_queue_command(command, &block)
2186
+ end
2187
+
2188
+ # Gets the specified S/MIME config for the specified send-as alias.
2189
+ # @param [String] user_id
2190
+ # The user's email address. The special value `me` can be used to indicate the
2191
+ # authenticated user.
2192
+ # @param [String] send_as_email
2193
+ # The email address that appears in the "From:" header for mail sent using this
2194
+ # alias.
2195
+ # @param [String] id
2196
+ # The immutable ID for the SmimeInfo.
2197
+ # @param [String] fields
2198
+ # Selector specifying which fields to include in a partial response.
2199
+ # @param [String] quota_user
2200
+ # Available to use for quota purposes for server-side applications. Can be any
2201
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2202
+ # @param [Google::Apis::RequestOptions] options
2203
+ # Request-specific options
2204
+ #
2205
+ # @yield [result, err] Result & error if block supplied
2206
+ # @yieldparam result [Google::Apis::GmailV1::SmimeInfo] parsed result object
2207
+ # @yieldparam err [StandardError] error object if request failed
2208
+ #
2209
+ # @return [Google::Apis::GmailV1::SmimeInfo]
2210
+ #
2211
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2212
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2213
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2214
+ def get_user_setting_send_a_smime_info(user_id, send_as_email, id, fields: nil, quota_user: nil, options: nil, &block)
2215
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}', options)
2216
+ command.response_representation = Google::Apis::GmailV1::SmimeInfo::Representation
2217
+ command.response_class = Google::Apis::GmailV1::SmimeInfo
2218
+ command.params['userId'] = user_id unless user_id.nil?
2219
+ command.params['sendAsEmail'] = send_as_email unless send_as_email.nil?
2220
+ command.params['id'] = id unless id.nil?
2221
+ command.query['fields'] = fields unless fields.nil?
2222
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2223
+ execute_or_queue_command(command, &block)
2224
+ end
2225
+
2226
+ # Insert (upload) the given S/MIME config for the specified send-as alias. Note
2227
+ # that pkcs12 format is required for the key.
2228
+ # @param [String] user_id
2229
+ # The user's email address. The special value `me` can be used to indicate the
2230
+ # authenticated user.
2231
+ # @param [String] send_as_email
2232
+ # The email address that appears in the "From:" header for mail sent using this
2233
+ # alias.
2234
+ # @param [Google::Apis::GmailV1::SmimeInfo] smime_info_object
2235
+ # @param [String] fields
2236
+ # Selector specifying which fields to include in a partial response.
2237
+ # @param [String] quota_user
2238
+ # Available to use for quota purposes for server-side applications. Can be any
2239
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2240
+ # @param [Google::Apis::RequestOptions] options
2241
+ # Request-specific options
2242
+ #
2243
+ # @yield [result, err] Result & error if block supplied
2244
+ # @yieldparam result [Google::Apis::GmailV1::SmimeInfo] parsed result object
2245
+ # @yieldparam err [StandardError] error object if request failed
2246
+ #
2247
+ # @return [Google::Apis::GmailV1::SmimeInfo]
2248
+ #
2249
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2250
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2251
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2252
+ def insert_user_setting_send_a_smime_info(user_id, send_as_email, smime_info_object = nil, fields: nil, quota_user: nil, options: nil, &block)
2253
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo', options)
2254
+ command.request_representation = Google::Apis::GmailV1::SmimeInfo::Representation
2255
+ command.request_object = smime_info_object
2256
+ command.response_representation = Google::Apis::GmailV1::SmimeInfo::Representation
2257
+ command.response_class = Google::Apis::GmailV1::SmimeInfo
2258
+ command.params['userId'] = user_id unless user_id.nil?
2259
+ command.params['sendAsEmail'] = send_as_email unless send_as_email.nil?
2260
+ command.query['fields'] = fields unless fields.nil?
2261
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2262
+ execute_or_queue_command(command, &block)
2263
+ end
2264
+
2265
+ # Lists S/MIME configs for the specified send-as alias.
2266
+ # @param [String] user_id
2267
+ # The user's email address. The special value `me` can be used to indicate the
2268
+ # authenticated user.
2269
+ # @param [String] send_as_email
2270
+ # The email address that appears in the "From:" header for mail sent using this
2271
+ # alias.
2272
+ # @param [String] fields
2273
+ # Selector specifying which fields to include in a partial response.
2274
+ # @param [String] quota_user
2275
+ # Available to use for quota purposes for server-side applications. Can be any
2276
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2277
+ # @param [Google::Apis::RequestOptions] options
2278
+ # Request-specific options
2279
+ #
2280
+ # @yield [result, err] Result & error if block supplied
2281
+ # @yieldparam result [Google::Apis::GmailV1::ListSmimeInfoResponse] parsed result object
2282
+ # @yieldparam err [StandardError] error object if request failed
2283
+ #
2284
+ # @return [Google::Apis::GmailV1::ListSmimeInfoResponse]
2285
+ #
2286
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2287
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2288
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2289
+ def list_user_setting_send_a_smime_infos(user_id, send_as_email, fields: nil, quota_user: nil, options: nil, &block)
2290
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo', options)
2291
+ command.response_representation = Google::Apis::GmailV1::ListSmimeInfoResponse::Representation
2292
+ command.response_class = Google::Apis::GmailV1::ListSmimeInfoResponse
2293
+ command.params['userId'] = user_id unless user_id.nil?
2294
+ command.params['sendAsEmail'] = send_as_email unless send_as_email.nil?
2295
+ command.query['fields'] = fields unless fields.nil?
2296
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2297
+ execute_or_queue_command(command, &block)
2298
+ end
2299
+
2300
+ # Sets the default S/MIME config for the specified send-as alias.
2301
+ # @param [String] user_id
2302
+ # The user's email address. The special value `me` can be used to indicate the
2303
+ # authenticated user.
2304
+ # @param [String] send_as_email
2305
+ # The email address that appears in the "From:" header for mail sent using this
2306
+ # alias.
2307
+ # @param [String] id
2308
+ # The immutable ID for the SmimeInfo.
2309
+ # @param [String] fields
2310
+ # Selector specifying which fields to include in a partial response.
2311
+ # @param [String] quota_user
2312
+ # Available to use for quota purposes for server-side applications. Can be any
2313
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2314
+ # @param [Google::Apis::RequestOptions] options
2315
+ # Request-specific options
2316
+ #
2317
+ # @yield [result, err] Result & error if block supplied
2318
+ # @yieldparam result [NilClass] No result returned for this method
2319
+ # @yieldparam err [StandardError] error object if request failed
2320
+ #
2321
+ # @return [void]
2322
+ #
2323
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2324
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2325
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2326
+ def set_user_setting_send_a_smime_info_default(user_id, send_as_email, id, fields: nil, quota_user: nil, options: nil, &block)
2327
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault', options)
2328
+ command.params['userId'] = user_id unless user_id.nil?
2329
+ command.params['sendAsEmail'] = send_as_email unless send_as_email.nil?
2330
+ command.params['id'] = id unless id.nil?
2331
+ command.query['fields'] = fields unless fields.nil?
2332
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2333
+ execute_or_queue_command(command, &block)
2334
+ end
2335
+
2336
+ # Immediately and permanently deletes the specified thread. This operation
2337
+ # cannot be undone. Prefer `threads.trash` instead.
2338
+ # @param [String] user_id
2339
+ # The user's email address. The special value `me` can be used to indicate the
2340
+ # authenticated user.
2341
+ # @param [String] id
2342
+ # ID of the Thread to delete.
2343
+ # @param [String] fields
2344
+ # Selector specifying which fields to include in a partial response.
2345
+ # @param [String] quota_user
2346
+ # Available to use for quota purposes for server-side applications. Can be any
2347
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2348
+ # @param [Google::Apis::RequestOptions] options
2349
+ # Request-specific options
2350
+ #
2351
+ # @yield [result, err] Result & error if block supplied
2352
+ # @yieldparam result [NilClass] No result returned for this method
2353
+ # @yieldparam err [StandardError] error object if request failed
2354
+ #
2355
+ # @return [void]
2356
+ #
2357
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2358
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2359
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2360
+ def delete_user_thread(user_id, id, fields: nil, quota_user: nil, options: nil, &block)
2361
+ command = make_simple_command(:delete, 'gmail/v1/users/{userId}/threads/{id}', options)
2362
+ command.params['userId'] = user_id unless user_id.nil?
2363
+ command.params['id'] = id unless id.nil?
2364
+ command.query['fields'] = fields unless fields.nil?
2365
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2366
+ execute_or_queue_command(command, &block)
2367
+ end
2368
+
2369
+ # Gets the specified thread.
2370
+ # @param [String] user_id
2371
+ # The user's email address. The special value `me` can be used to indicate the
2372
+ # authenticated user.
2373
+ # @param [String] id
2374
+ # The ID of the thread to retrieve.
2375
+ # @param [String] format
2376
+ # The format to return the messages in.
2377
+ # @param [Array<String>, String] metadata_headers
2378
+ # When given and format is METADATA, only include headers specified.
2379
+ # @param [String] fields
2380
+ # Selector specifying which fields to include in a partial response.
2381
+ # @param [String] quota_user
2382
+ # Available to use for quota purposes for server-side applications. Can be any
2383
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2384
+ # @param [Google::Apis::RequestOptions] options
2385
+ # Request-specific options
2386
+ #
2387
+ # @yield [result, err] Result & error if block supplied
2388
+ # @yieldparam result [Google::Apis::GmailV1::Thread] parsed result object
2389
+ # @yieldparam err [StandardError] error object if request failed
2390
+ #
2391
+ # @return [Google::Apis::GmailV1::Thread]
2392
+ #
2393
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2394
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2395
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2396
+ def get_user_thread(user_id, id, format: nil, metadata_headers: nil, fields: nil, quota_user: nil, options: nil, &block)
2397
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/threads/{id}', options)
2398
+ command.response_representation = Google::Apis::GmailV1::Thread::Representation
2399
+ command.response_class = Google::Apis::GmailV1::Thread
2400
+ command.params['userId'] = user_id unless user_id.nil?
2401
+ command.params['id'] = id unless id.nil?
2402
+ command.query['format'] = format unless format.nil?
2403
+ command.query['metadataHeaders'] = metadata_headers unless metadata_headers.nil?
2404
+ command.query['fields'] = fields unless fields.nil?
2405
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2406
+ execute_or_queue_command(command, &block)
2407
+ end
2408
+
2409
+ # Lists the threads in the user's mailbox.
2410
+ # @param [String] user_id
2411
+ # The user's email address. The special value `me` can be used to indicate the
2412
+ # authenticated user.
2413
+ # @param [Boolean] include_spam_trash
2414
+ # Include threads from `SPAM` and `TRASH` in the results.
2415
+ # @param [Array<String>, String] label_ids
2416
+ # Only return threads with labels that match all of the specified label IDs.
2417
+ # @param [Fixnum] max_results
2418
+ # Maximum number of threads to return.
2419
+ # @param [String] page_token
2420
+ # Page token to retrieve a specific page of results in the list.
2421
+ # @param [String] q
2422
+ # Only return threads matching the specified query. Supports the same query
2423
+ # format as the Gmail search box. For example, `"from:someuser@example.com
2424
+ # rfc822msgid: is:unread"`. Parameter cannot be used when accessing the api
2425
+ # using the gmail.metadata scope.
2426
+ # @param [String] fields
2427
+ # Selector specifying which fields to include in a partial response.
2428
+ # @param [String] quota_user
2429
+ # Available to use for quota purposes for server-side applications. Can be any
2430
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2431
+ # @param [Google::Apis::RequestOptions] options
2432
+ # Request-specific options
2433
+ #
2434
+ # @yield [result, err] Result & error if block supplied
2435
+ # @yieldparam result [Google::Apis::GmailV1::ListThreadsResponse] parsed result object
2436
+ # @yieldparam err [StandardError] error object if request failed
2437
+ #
2438
+ # @return [Google::Apis::GmailV1::ListThreadsResponse]
2439
+ #
2440
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2441
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2442
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2443
+ def list_user_threads(user_id, include_spam_trash: nil, label_ids: nil, max_results: nil, page_token: nil, q: nil, fields: nil, quota_user: nil, options: nil, &block)
2444
+ command = make_simple_command(:get, 'gmail/v1/users/{userId}/threads', options)
2445
+ command.response_representation = Google::Apis::GmailV1::ListThreadsResponse::Representation
2446
+ command.response_class = Google::Apis::GmailV1::ListThreadsResponse
2447
+ command.params['userId'] = user_id unless user_id.nil?
2448
+ command.query['includeSpamTrash'] = include_spam_trash unless include_spam_trash.nil?
2449
+ command.query['labelIds'] = label_ids unless label_ids.nil?
2450
+ command.query['maxResults'] = max_results unless max_results.nil?
2451
+ command.query['pageToken'] = page_token unless page_token.nil?
2452
+ command.query['q'] = q unless q.nil?
2453
+ command.query['fields'] = fields unless fields.nil?
2454
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2455
+ execute_or_queue_command(command, &block)
2456
+ end
2457
+
2458
+ # Modifies the labels applied to the thread. This applies to all messages in the
2459
+ # thread.
2460
+ # @param [String] user_id
2461
+ # The user's email address. The special value `me` can be used to indicate the
2462
+ # authenticated user.
2463
+ # @param [String] id
2464
+ # The ID of the thread to modify.
2465
+ # @param [Google::Apis::GmailV1::ModifyThreadRequest] modify_thread_request_object
2466
+ # @param [String] fields
2467
+ # Selector specifying which fields to include in a partial response.
2468
+ # @param [String] quota_user
2469
+ # Available to use for quota purposes for server-side applications. Can be any
2470
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2471
+ # @param [Google::Apis::RequestOptions] options
2472
+ # Request-specific options
2473
+ #
2474
+ # @yield [result, err] Result & error if block supplied
2475
+ # @yieldparam result [Google::Apis::GmailV1::Thread] parsed result object
2476
+ # @yieldparam err [StandardError] error object if request failed
2477
+ #
2478
+ # @return [Google::Apis::GmailV1::Thread]
2479
+ #
2480
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2481
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2482
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2483
+ def modify_thread(user_id, id, modify_thread_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
2484
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/threads/{id}/modify', options)
2485
+ command.request_representation = Google::Apis::GmailV1::ModifyThreadRequest::Representation
2486
+ command.request_object = modify_thread_request_object
2487
+ command.response_representation = Google::Apis::GmailV1::Thread::Representation
2488
+ command.response_class = Google::Apis::GmailV1::Thread
2489
+ command.params['userId'] = user_id unless user_id.nil?
2490
+ command.params['id'] = id unless id.nil?
2491
+ command.query['fields'] = fields unless fields.nil?
2492
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2493
+ execute_or_queue_command(command, &block)
2494
+ end
2495
+
2496
+ # Moves the specified thread to the trash.
2497
+ # @param [String] user_id
2498
+ # The user's email address. The special value `me` can be used to indicate the
2499
+ # authenticated user.
2500
+ # @param [String] id
2501
+ # The ID of the thread to Trash.
2502
+ # @param [String] fields
2503
+ # Selector specifying which fields to include in a partial response.
2504
+ # @param [String] quota_user
2505
+ # Available to use for quota purposes for server-side applications. Can be any
2506
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2507
+ # @param [Google::Apis::RequestOptions] options
2508
+ # Request-specific options
2509
+ #
2510
+ # @yield [result, err] Result & error if block supplied
2511
+ # @yieldparam result [Google::Apis::GmailV1::Thread] parsed result object
2512
+ # @yieldparam err [StandardError] error object if request failed
2513
+ #
2514
+ # @return [Google::Apis::GmailV1::Thread]
2515
+ #
2516
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2517
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2518
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2519
+ def trash_user_thread(user_id, id, fields: nil, quota_user: nil, options: nil, &block)
2520
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/threads/{id}/trash', options)
2521
+ command.response_representation = Google::Apis::GmailV1::Thread::Representation
2522
+ command.response_class = Google::Apis::GmailV1::Thread
2523
+ command.params['userId'] = user_id unless user_id.nil?
2524
+ command.params['id'] = id unless id.nil?
2525
+ command.query['fields'] = fields unless fields.nil?
2526
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2527
+ execute_or_queue_command(command, &block)
2528
+ end
2529
+
2530
+ # Removes the specified thread from the trash.
2531
+ # @param [String] user_id
2532
+ # The user's email address. The special value `me` can be used to indicate the
2533
+ # authenticated user.
2534
+ # @param [String] id
2535
+ # The ID of the thread to remove from Trash.
2536
+ # @param [String] fields
2537
+ # Selector specifying which fields to include in a partial response.
2538
+ # @param [String] quota_user
2539
+ # Available to use for quota purposes for server-side applications. Can be any
2540
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2541
+ # @param [Google::Apis::RequestOptions] options
2542
+ # Request-specific options
2543
+ #
2544
+ # @yield [result, err] Result & error if block supplied
2545
+ # @yieldparam result [Google::Apis::GmailV1::Thread] parsed result object
2546
+ # @yieldparam err [StandardError] error object if request failed
2547
+ #
2548
+ # @return [Google::Apis::GmailV1::Thread]
2549
+ #
2550
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2551
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2552
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2553
+ def untrash_user_thread(user_id, id, fields: nil, quota_user: nil, options: nil, &block)
2554
+ command = make_simple_command(:post, 'gmail/v1/users/{userId}/threads/{id}/untrash', options)
2555
+ command.response_representation = Google::Apis::GmailV1::Thread::Representation
2556
+ command.response_class = Google::Apis::GmailV1::Thread
2557
+ command.params['userId'] = user_id unless user_id.nil?
2558
+ command.params['id'] = id unless id.nil?
2559
+ command.query['fields'] = fields unless fields.nil?
2560
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2561
+ execute_or_queue_command(command, &block)
2562
+ end
2563
+
2564
+ protected
2565
+
2566
+ def apply_command_defaults(command)
2567
+ command.query['key'] = key unless key.nil?
2568
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2569
+ end
2570
+ end
2571
+ end
2572
+ end
2573
+ end