Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: generated/googleapis/lib/gmail/v1.dart

Issue 559053002: Generate 0.1.0 version of googleapis/googleapis_beta (Closed) Base URL: git@github.com:dart-lang/googleapis.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 library googleapis.gmail.v1;
2
3 import "dart:core" as core;
4 import "dart:collection" as collection;
5 import "dart:async" as async;
6 import "dart:convert" as convert;
7
8 import "package:crypto/crypto.dart" as crypto;
9 import 'package:http/http.dart' as http;
10 import '../src/common_internal.dart' as common_internal;
11 import '../common/common.dart' as common;
12
13 export '../common/common.dart' show ApiRequestError;
14 export '../common/common.dart' show DetailedApiRequestError;
15
16 /** The Gmail REST API. */
17 class GmailApi {
18 /** View and manage your mail */
19 static const MailGoogleComScope = "https://mail.google.com/";
20
21 /** Manage drafts and send emails */
22 static const GmailComposeScope = "https://www.googleapis.com/auth/gmail.compos e";
23
24 /** View and modify but not delete your email */
25 static const GmailModifyScope = "https://www.googleapis.com/auth/gmail.modify" ;
26
27 /** View your emails messages and settings */
28 static const GmailReadonlyScope = "https://www.googleapis.com/auth/gmail.reado nly";
29
30
31 final common_internal.ApiRequester _requester;
32
33 UsersResourceApi get users => new UsersResourceApi(_requester);
34
35 GmailApi(http.Client client) :
36 _requester = new common_internal.ApiRequester(client, "https://www.googlea pis.com/", "/gmail/v1/users/");
37 }
38
39
40 /** Not documented yet. */
41 class UsersResourceApi {
42 final common_internal.ApiRequester _requester;
43
44 UsersDraftsResourceApi get drafts => new UsersDraftsResourceApi(_requester);
45 UsersHistoryResourceApi get history => new UsersHistoryResourceApi(_requester) ;
46 UsersLabelsResourceApi get labels => new UsersLabelsResourceApi(_requester);
47 UsersMessagesResourceApi get messages => new UsersMessagesResourceApi(_request er);
48 UsersThreadsResourceApi get threads => new UsersThreadsResourceApi(_requester) ;
49
50 UsersResourceApi(common_internal.ApiRequester client) :
51 _requester = client;
52 }
53
54
55 /** Not documented yet. */
56 class UsersDraftsResourceApi {
57 final common_internal.ApiRequester _requester;
58
59 UsersDraftsResourceApi(common_internal.ApiRequester client) :
60 _requester = client;
61
62 /**
63 * Creates a new draft with the DRAFT label.
64 *
65 * [request] - The metadata request object.
66 *
67 * Request parameters:
68 *
69 * [userId] - The user's email address. The special value me can be used to
70 * indicate the authenticated user.
71 *
72 * [uploadMedia] - The media to upload.
73 *
74 * [uploadOptions] - Options for the media upload. Streaming Media without the
75 * length being known ahead of time is only supported via resumable uploads.
76 *
77 * Completes with a [Draft].
78 *
79 * Completes with a [common.ApiRequestError] if the API endpoint returned an
80 * error.
81 *
82 * If the used [http.Client] completes with an error when making a REST call,
83 * this method will complete with the same error.
84 */
85 async.Future<Draft> create(Draft request, core.String userId, {common.UploadOp tions uploadOptions : common.UploadOptions.Default, common.Media uploadMedia}) {
86 var _url = null;
87 var _queryParams = new core.Map();
88 var _uploadMedia = null;
89 var _uploadOptions = null;
90 var _downloadOptions = common.DownloadOptions.Metadata;
91 var _body = null;
92
93 if (request != null) {
94 _body = convert.JSON.encode((request).toJson());
95 }
96 if (userId == null) {
97 throw new core.ArgumentError("Parameter userId is required.");
98 }
99
100 _uploadMedia = uploadMedia;
101 _uploadOptions = uploadOptions;
102
103 if (_uploadMedia == null) {
104 _url = common_internal.Escaper.ecapeVariable('$userId') + '/drafts';
105 } else if (_uploadOptions is common.ResumableUploadOptions) {
106 _url = '/resumable/upload/gmail/v1/users/' + common_internal.Escaper.ecape Variable('$userId') + '/drafts';
107 } else {
108 _url = '/upload/gmail/v1/users/' + common_internal.Escaper.ecapeVariable(' $userId') + '/drafts';
109 }
110
111
112 var _response = _requester.request(_url,
113 "POST",
114 body: _body,
115 queryParams: _queryParams,
116 uploadOptions: _uploadOptions,
117 uploadMedia: _uploadMedia,
118 downloadOptions: _downloadOptions);
119 return _response.then((data) => new Draft.fromJson(data));
120 }
121
122 /**
123 * Immediately and permanently deletes the specified draft. Does not simply
124 * trash it.
125 *
126 * Request parameters:
127 *
128 * [userId] - The user's email address. The special value me can be used to
129 * indicate the authenticated user.
130 *
131 * [id] - The ID of the draft to delete.
132 *
133 * Completes with a [common.ApiRequestError] if the API endpoint returned an
134 * error.
135 *
136 * If the used [http.Client] completes with an error when making a REST call,
137 * this method will complete with the same error.
138 */
139 async.Future delete(core.String userId, core.String id) {
140 var _url = null;
141 var _queryParams = new core.Map();
142 var _uploadMedia = null;
143 var _uploadOptions = null;
144 var _downloadOptions = common.DownloadOptions.Metadata;
145 var _body = null;
146
147 if (userId == null) {
148 throw new core.ArgumentError("Parameter userId is required.");
149 }
150 if (id == null) {
151 throw new core.ArgumentError("Parameter id is required.");
152 }
153
154 _downloadOptions = null;
155
156 _url = common_internal.Escaper.ecapeVariable('$userId') + '/drafts/' + commo n_internal.Escaper.ecapeVariable('$id');
157
158 var _response = _requester.request(_url,
159 "DELETE",
160 body: _body,
161 queryParams: _queryParams,
162 uploadOptions: _uploadOptions,
163 uploadMedia: _uploadMedia,
164 downloadOptions: _downloadOptions);
165 return _response.then((data) => null);
166 }
167
168 /**
169 * Gets the specified draft.
170 *
171 * Request parameters:
172 *
173 * [userId] - The user's email address. The special value me can be used to
174 * indicate the authenticated user.
175 *
176 * [id] - The ID of the draft to retrieve.
177 *
178 * [format] - The format to return the draft in.
179 * Possible string values are:
180 * - "full"
181 * - "metadata"
182 * - "minimal"
183 * - "raw"
184 *
185 * Completes with a [Draft].
186 *
187 * Completes with a [common.ApiRequestError] if the API endpoint returned an
188 * error.
189 *
190 * If the used [http.Client] completes with an error when making a REST call,
191 * this method will complete with the same error.
192 */
193 async.Future<Draft> get(core.String userId, core.String id, {core.String forma t}) {
194 var _url = null;
195 var _queryParams = new core.Map();
196 var _uploadMedia = null;
197 var _uploadOptions = null;
198 var _downloadOptions = common.DownloadOptions.Metadata;
199 var _body = null;
200
201 if (userId == null) {
202 throw new core.ArgumentError("Parameter userId is required.");
203 }
204 if (id == null) {
205 throw new core.ArgumentError("Parameter id is required.");
206 }
207 if (format != null) {
208 _queryParams["format"] = [format];
209 }
210
211
212 _url = common_internal.Escaper.ecapeVariable('$userId') + '/drafts/' + commo n_internal.Escaper.ecapeVariable('$id');
213
214 var _response = _requester.request(_url,
215 "GET",
216 body: _body,
217 queryParams: _queryParams,
218 uploadOptions: _uploadOptions,
219 uploadMedia: _uploadMedia,
220 downloadOptions: _downloadOptions);
221 return _response.then((data) => new Draft.fromJson(data));
222 }
223
224 /**
225 * Lists the drafts in the user's mailbox.
226 *
227 * Request parameters:
228 *
229 * [userId] - The user's email address. The special value me can be used to
230 * indicate the authenticated user.
231 *
232 * [maxResults] - Maximum number of drafts to return.
233 *
234 * [pageToken] - Page token to retrieve a specific page of results in the
235 * list.
236 *
237 * Completes with a [ListDraftsResponse].
238 *
239 * Completes with a [common.ApiRequestError] if the API endpoint returned an
240 * error.
241 *
242 * If the used [http.Client] completes with an error when making a REST call,
243 * this method will complete with the same error.
244 */
245 async.Future<ListDraftsResponse> list(core.String userId, {core.int maxResults , core.String pageToken}) {
246 var _url = null;
247 var _queryParams = new core.Map();
248 var _uploadMedia = null;
249 var _uploadOptions = null;
250 var _downloadOptions = common.DownloadOptions.Metadata;
251 var _body = null;
252
253 if (userId == null) {
254 throw new core.ArgumentError("Parameter userId is required.");
255 }
256 if (maxResults != null) {
257 _queryParams["maxResults"] = ["${maxResults}"];
258 }
259 if (pageToken != null) {
260 _queryParams["pageToken"] = [pageToken];
261 }
262
263
264 _url = common_internal.Escaper.ecapeVariable('$userId') + '/drafts';
265
266 var _response = _requester.request(_url,
267 "GET",
268 body: _body,
269 queryParams: _queryParams,
270 uploadOptions: _uploadOptions,
271 uploadMedia: _uploadMedia,
272 downloadOptions: _downloadOptions);
273 return _response.then((data) => new ListDraftsResponse.fromJson(data));
274 }
275
276 /**
277 * Sends the specified, existing draft to the recipients in the To, Cc, and
278 * Bcc headers.
279 *
280 * [request] - The metadata request object.
281 *
282 * Request parameters:
283 *
284 * [userId] - The user's email address. The special value me can be used to
285 * indicate the authenticated user.
286 *
287 * [uploadMedia] - The media to upload.
288 *
289 * [uploadOptions] - Options for the media upload. Streaming Media without the
290 * length being known ahead of time is only supported via resumable uploads.
291 *
292 * Completes with a [Message].
293 *
294 * Completes with a [common.ApiRequestError] if the API endpoint returned an
295 * error.
296 *
297 * If the used [http.Client] completes with an error when making a REST call,
298 * this method will complete with the same error.
299 */
300 async.Future<Message> send(Draft request, core.String userId, {common.UploadOp tions uploadOptions : common.UploadOptions.Default, common.Media uploadMedia}) {
301 var _url = null;
302 var _queryParams = new core.Map();
303 var _uploadMedia = null;
304 var _uploadOptions = null;
305 var _downloadOptions = common.DownloadOptions.Metadata;
306 var _body = null;
307
308 if (request != null) {
309 _body = convert.JSON.encode((request).toJson());
310 }
311 if (userId == null) {
312 throw new core.ArgumentError("Parameter userId is required.");
313 }
314
315 _uploadMedia = uploadMedia;
316 _uploadOptions = uploadOptions;
317
318 if (_uploadMedia == null) {
319 _url = common_internal.Escaper.ecapeVariable('$userId') + '/drafts/send';
320 } else if (_uploadOptions is common.ResumableUploadOptions) {
321 _url = '/resumable/upload/gmail/v1/users/' + common_internal.Escaper.ecape Variable('$userId') + '/drafts/send';
322 } else {
323 _url = '/upload/gmail/v1/users/' + common_internal.Escaper.ecapeVariable(' $userId') + '/drafts/send';
324 }
325
326
327 var _response = _requester.request(_url,
328 "POST",
329 body: _body,
330 queryParams: _queryParams,
331 uploadOptions: _uploadOptions,
332 uploadMedia: _uploadMedia,
333 downloadOptions: _downloadOptions);
334 return _response.then((data) => new Message.fromJson(data));
335 }
336
337 /**
338 * Replaces a draft's content.
339 *
340 * [request] - The metadata request object.
341 *
342 * Request parameters:
343 *
344 * [userId] - The user's email address. The special value me can be used to
345 * indicate the authenticated user.
346 *
347 * [id] - The ID of the draft to update.
348 *
349 * [uploadMedia] - The media to upload.
350 *
351 * [uploadOptions] - Options for the media upload. Streaming Media without the
352 * length being known ahead of time is only supported via resumable uploads.
353 *
354 * Completes with a [Draft].
355 *
356 * Completes with a [common.ApiRequestError] if the API endpoint returned an
357 * error.
358 *
359 * If the used [http.Client] completes with an error when making a REST call,
360 * this method will complete with the same error.
361 */
362 async.Future<Draft> update(Draft request, core.String userId, core.String id, {common.UploadOptions uploadOptions : common.UploadOptions.Default, common.Media uploadMedia}) {
363 var _url = null;
364 var _queryParams = new core.Map();
365 var _uploadMedia = null;
366 var _uploadOptions = null;
367 var _downloadOptions = common.DownloadOptions.Metadata;
368 var _body = null;
369
370 if (request != null) {
371 _body = convert.JSON.encode((request).toJson());
372 }
373 if (userId == null) {
374 throw new core.ArgumentError("Parameter userId is required.");
375 }
376 if (id == null) {
377 throw new core.ArgumentError("Parameter id is required.");
378 }
379
380 _uploadMedia = uploadMedia;
381 _uploadOptions = uploadOptions;
382
383 if (_uploadMedia == null) {
384 _url = common_internal.Escaper.ecapeVariable('$userId') + '/drafts/' + com mon_internal.Escaper.ecapeVariable('$id');
385 } else if (_uploadOptions is common.ResumableUploadOptions) {
386 _url = '/resumable/upload/gmail/v1/users/' + common_internal.Escaper.ecape Variable('$userId') + '/drafts/' + common_internal.Escaper.ecapeVariable('$id');
387 } else {
388 _url = '/upload/gmail/v1/users/' + common_internal.Escaper.ecapeVariable(' $userId') + '/drafts/' + common_internal.Escaper.ecapeVariable('$id');
389 }
390
391
392 var _response = _requester.request(_url,
393 "PUT",
394 body: _body,
395 queryParams: _queryParams,
396 uploadOptions: _uploadOptions,
397 uploadMedia: _uploadMedia,
398 downloadOptions: _downloadOptions);
399 return _response.then((data) => new Draft.fromJson(data));
400 }
401
402 }
403
404
405 /** Not documented yet. */
406 class UsersHistoryResourceApi {
407 final common_internal.ApiRequester _requester;
408
409 UsersHistoryResourceApi(common_internal.ApiRequester client) :
410 _requester = client;
411
412 /**
413 * Lists the history of all changes to the given mailbox. History results are
414 * returned in chronological order (increasing historyId).
415 *
416 * Request parameters:
417 *
418 * [userId] - The user's email address. The special value me can be used to
419 * indicate the authenticated user.
420 *
421 * [labelId] - Only return messages with a label matching the ID.
422 *
423 * [maxResults] - The maximum number of history records to return.
424 *
425 * [pageToken] - Page token to retrieve a specific page of results in the
426 * list.
427 *
428 * [startHistoryId] - Required. Returns history records after the specified
429 * startHistoryId. The supplied startHistoryId should be obtained from the
430 * historyId of a message, thread, or previous list response. History IDs
431 * increase chronologically but are not contiguous with random gaps in between
432 * valid IDs. Supplying an invalid or out of date startHistoryId typically
433 * returns an HTTP 404 error code. A historyId is typically valid for at least
434 * a week, but in some circumstances may be valid for only a few hours. If you
435 * receive an HTTP 404 error response, your application should perform a full
436 * sync. If you receive no nextPageToken in the response, there are no updates
437 * to retrieve and you can store the returned historyId for a future request.
438 *
439 * Completes with a [ListHistoryResponse].
440 *
441 * Completes with a [common.ApiRequestError] if the API endpoint returned an
442 * error.
443 *
444 * If the used [http.Client] completes with an error when making a REST call,
445 * this method will complete with the same error.
446 */
447 async.Future<ListHistoryResponse> list(core.String userId, {core.String labelI d, core.int maxResults, core.String pageToken, core.String startHistoryId}) {
448 var _url = null;
449 var _queryParams = new core.Map();
450 var _uploadMedia = null;
451 var _uploadOptions = null;
452 var _downloadOptions = common.DownloadOptions.Metadata;
453 var _body = null;
454
455 if (userId == null) {
456 throw new core.ArgumentError("Parameter userId is required.");
457 }
458 if (labelId != null) {
459 _queryParams["labelId"] = [labelId];
460 }
461 if (maxResults != null) {
462 _queryParams["maxResults"] = ["${maxResults}"];
463 }
464 if (pageToken != null) {
465 _queryParams["pageToken"] = [pageToken];
466 }
467 if (startHistoryId != null) {
468 _queryParams["startHistoryId"] = [startHistoryId];
469 }
470
471
472 _url = common_internal.Escaper.ecapeVariable('$userId') + '/history';
473
474 var _response = _requester.request(_url,
475 "GET",
476 body: _body,
477 queryParams: _queryParams,
478 uploadOptions: _uploadOptions,
479 uploadMedia: _uploadMedia,
480 downloadOptions: _downloadOptions);
481 return _response.then((data) => new ListHistoryResponse.fromJson(data));
482 }
483
484 }
485
486
487 /** Not documented yet. */
488 class UsersLabelsResourceApi {
489 final common_internal.ApiRequester _requester;
490
491 UsersLabelsResourceApi(common_internal.ApiRequester client) :
492 _requester = client;
493
494 /**
495 * Creates a new label.
496 *
497 * [request] - The metadata request object.
498 *
499 * Request parameters:
500 *
501 * [userId] - The user's email address. The special value me can be used to
502 * indicate the authenticated user.
503 *
504 * Completes with a [Label].
505 *
506 * Completes with a [common.ApiRequestError] if the API endpoint returned an
507 * error.
508 *
509 * If the used [http.Client] completes with an error when making a REST call,
510 * this method will complete with the same error.
511 */
512 async.Future<Label> create(Label request, core.String userId) {
513 var _url = null;
514 var _queryParams = new core.Map();
515 var _uploadMedia = null;
516 var _uploadOptions = null;
517 var _downloadOptions = common.DownloadOptions.Metadata;
518 var _body = null;
519
520 if (request != null) {
521 _body = convert.JSON.encode((request).toJson());
522 }
523 if (userId == null) {
524 throw new core.ArgumentError("Parameter userId is required.");
525 }
526
527
528 _url = common_internal.Escaper.ecapeVariable('$userId') + '/labels';
529
530 var _response = _requester.request(_url,
531 "POST",
532 body: _body,
533 queryParams: _queryParams,
534 uploadOptions: _uploadOptions,
535 uploadMedia: _uploadMedia,
536 downloadOptions: _downloadOptions);
537 return _response.then((data) => new Label.fromJson(data));
538 }
539
540 /**
541 * Immediately and permanently deletes the specified label and removes it from
542 * any messages and threads that it is applied to.
543 *
544 * Request parameters:
545 *
546 * [userId] - The user's email address. The special value me can be used to
547 * indicate the authenticated user.
548 *
549 * [id] - The ID of the label to delete.
550 *
551 * Completes with a [common.ApiRequestError] if the API endpoint returned an
552 * error.
553 *
554 * If the used [http.Client] completes with an error when making a REST call,
555 * this method will complete with the same error.
556 */
557 async.Future delete(core.String userId, core.String id) {
558 var _url = null;
559 var _queryParams = new core.Map();
560 var _uploadMedia = null;
561 var _uploadOptions = null;
562 var _downloadOptions = common.DownloadOptions.Metadata;
563 var _body = null;
564
565 if (userId == null) {
566 throw new core.ArgumentError("Parameter userId is required.");
567 }
568 if (id == null) {
569 throw new core.ArgumentError("Parameter id is required.");
570 }
571
572 _downloadOptions = null;
573
574 _url = common_internal.Escaper.ecapeVariable('$userId') + '/labels/' + commo n_internal.Escaper.ecapeVariable('$id');
575
576 var _response = _requester.request(_url,
577 "DELETE",
578 body: _body,
579 queryParams: _queryParams,
580 uploadOptions: _uploadOptions,
581 uploadMedia: _uploadMedia,
582 downloadOptions: _downloadOptions);
583 return _response.then((data) => null);
584 }
585
586 /**
587 * Gets the specified label.
588 *
589 * Request parameters:
590 *
591 * [userId] - The user's email address. The special value me can be used to
592 * indicate the authenticated user.
593 *
594 * [id] - The ID of the label to retrieve.
595 *
596 * Completes with a [Label].
597 *
598 * Completes with a [common.ApiRequestError] if the API endpoint returned an
599 * error.
600 *
601 * If the used [http.Client] completes with an error when making a REST call,
602 * this method will complete with the same error.
603 */
604 async.Future<Label> get(core.String userId, core.String id) {
605 var _url = null;
606 var _queryParams = new core.Map();
607 var _uploadMedia = null;
608 var _uploadOptions = null;
609 var _downloadOptions = common.DownloadOptions.Metadata;
610 var _body = null;
611
612 if (userId == null) {
613 throw new core.ArgumentError("Parameter userId is required.");
614 }
615 if (id == null) {
616 throw new core.ArgumentError("Parameter id is required.");
617 }
618
619
620 _url = common_internal.Escaper.ecapeVariable('$userId') + '/labels/' + commo n_internal.Escaper.ecapeVariable('$id');
621
622 var _response = _requester.request(_url,
623 "GET",
624 body: _body,
625 queryParams: _queryParams,
626 uploadOptions: _uploadOptions,
627 uploadMedia: _uploadMedia,
628 downloadOptions: _downloadOptions);
629 return _response.then((data) => new Label.fromJson(data));
630 }
631
632 /**
633 * Lists all labels in the user's mailbox.
634 *
635 * Request parameters:
636 *
637 * [userId] - The user's email address. The special value me can be used to
638 * indicate the authenticated user.
639 *
640 * Completes with a [ListLabelsResponse].
641 *
642 * Completes with a [common.ApiRequestError] if the API endpoint returned an
643 * error.
644 *
645 * If the used [http.Client] completes with an error when making a REST call,
646 * this method will complete with the same error.
647 */
648 async.Future<ListLabelsResponse> list(core.String userId) {
649 var _url = null;
650 var _queryParams = new core.Map();
651 var _uploadMedia = null;
652 var _uploadOptions = null;
653 var _downloadOptions = common.DownloadOptions.Metadata;
654 var _body = null;
655
656 if (userId == null) {
657 throw new core.ArgumentError("Parameter userId is required.");
658 }
659
660
661 _url = common_internal.Escaper.ecapeVariable('$userId') + '/labels';
662
663 var _response = _requester.request(_url,
664 "GET",
665 body: _body,
666 queryParams: _queryParams,
667 uploadOptions: _uploadOptions,
668 uploadMedia: _uploadMedia,
669 downloadOptions: _downloadOptions);
670 return _response.then((data) => new ListLabelsResponse.fromJson(data));
671 }
672
673 /**
674 * Updates the specified label. This method supports patch semantics.
675 *
676 * [request] - The metadata request object.
677 *
678 * Request parameters:
679 *
680 * [userId] - The user's email address. The special value me can be used to
681 * indicate the authenticated user.
682 *
683 * [id] - The ID of the label to update.
684 *
685 * Completes with a [Label].
686 *
687 * Completes with a [common.ApiRequestError] if the API endpoint returned an
688 * error.
689 *
690 * If the used [http.Client] completes with an error when making a REST call,
691 * this method will complete with the same error.
692 */
693 async.Future<Label> patch(Label request, core.String userId, core.String id) {
694 var _url = null;
695 var _queryParams = new core.Map();
696 var _uploadMedia = null;
697 var _uploadOptions = null;
698 var _downloadOptions = common.DownloadOptions.Metadata;
699 var _body = null;
700
701 if (request != null) {
702 _body = convert.JSON.encode((request).toJson());
703 }
704 if (userId == null) {
705 throw new core.ArgumentError("Parameter userId is required.");
706 }
707 if (id == null) {
708 throw new core.ArgumentError("Parameter id is required.");
709 }
710
711
712 _url = common_internal.Escaper.ecapeVariable('$userId') + '/labels/' + commo n_internal.Escaper.ecapeVariable('$id');
713
714 var _response = _requester.request(_url,
715 "PATCH",
716 body: _body,
717 queryParams: _queryParams,
718 uploadOptions: _uploadOptions,
719 uploadMedia: _uploadMedia,
720 downloadOptions: _downloadOptions);
721 return _response.then((data) => new Label.fromJson(data));
722 }
723
724 /**
725 * Updates the specified label.
726 *
727 * [request] - The metadata request object.
728 *
729 * Request parameters:
730 *
731 * [userId] - The user's email address. The special value me can be used to
732 * indicate the authenticated user.
733 *
734 * [id] - The ID of the label to update.
735 *
736 * Completes with a [Label].
737 *
738 * Completes with a [common.ApiRequestError] if the API endpoint returned an
739 * error.
740 *
741 * If the used [http.Client] completes with an error when making a REST call,
742 * this method will complete with the same error.
743 */
744 async.Future<Label> update(Label request, core.String userId, core.String id) {
745 var _url = null;
746 var _queryParams = new core.Map();
747 var _uploadMedia = null;
748 var _uploadOptions = null;
749 var _downloadOptions = common.DownloadOptions.Metadata;
750 var _body = null;
751
752 if (request != null) {
753 _body = convert.JSON.encode((request).toJson());
754 }
755 if (userId == null) {
756 throw new core.ArgumentError("Parameter userId is required.");
757 }
758 if (id == null) {
759 throw new core.ArgumentError("Parameter id is required.");
760 }
761
762
763 _url = common_internal.Escaper.ecapeVariable('$userId') + '/labels/' + commo n_internal.Escaper.ecapeVariable('$id');
764
765 var _response = _requester.request(_url,
766 "PUT",
767 body: _body,
768 queryParams: _queryParams,
769 uploadOptions: _uploadOptions,
770 uploadMedia: _uploadMedia,
771 downloadOptions: _downloadOptions);
772 return _response.then((data) => new Label.fromJson(data));
773 }
774
775 }
776
777
778 /** Not documented yet. */
779 class UsersMessagesResourceApi {
780 final common_internal.ApiRequester _requester;
781
782 UsersMessagesAttachmentsResourceApi get attachments => new UsersMessagesAttach mentsResourceApi(_requester);
783
784 UsersMessagesResourceApi(common_internal.ApiRequester client) :
785 _requester = client;
786
787 /**
788 * Immediately and permanently deletes the specified message. This operation
789 * cannot be undone. Prefer messages.trash instead.
790 *
791 * Request parameters:
792 *
793 * [userId] - The user's email address. The special value me can be used to
794 * indicate the authenticated user.
795 *
796 * [id] - The ID of the message to delete.
797 *
798 * Completes with a [common.ApiRequestError] if the API endpoint returned an
799 * error.
800 *
801 * If the used [http.Client] completes with an error when making a REST call,
802 * this method will complete with the same error.
803 */
804 async.Future delete(core.String userId, core.String id) {
805 var _url = null;
806 var _queryParams = new core.Map();
807 var _uploadMedia = null;
808 var _uploadOptions = null;
809 var _downloadOptions = common.DownloadOptions.Metadata;
810 var _body = null;
811
812 if (userId == null) {
813 throw new core.ArgumentError("Parameter userId is required.");
814 }
815 if (id == null) {
816 throw new core.ArgumentError("Parameter id is required.");
817 }
818
819 _downloadOptions = null;
820
821 _url = common_internal.Escaper.ecapeVariable('$userId') + '/messages/' + com mon_internal.Escaper.ecapeVariable('$id');
822
823 var _response = _requester.request(_url,
824 "DELETE",
825 body: _body,
826 queryParams: _queryParams,
827 uploadOptions: _uploadOptions,
828 uploadMedia: _uploadMedia,
829 downloadOptions: _downloadOptions);
830 return _response.then((data) => null);
831 }
832
833 /**
834 * Gets the specified message.
835 *
836 * Request parameters:
837 *
838 * [userId] - The user's email address. The special value me can be used to
839 * indicate the authenticated user.
840 *
841 * [id] - The ID of the message to retrieve.
842 *
843 * [format] - The format to return the message in.
844 * Possible string values are:
845 * - "full"
846 * - "metadata"
847 * - "minimal"
848 * - "raw"
849 *
850 * [metadataHeaders] - When given and format is METADATA, only include headers
851 * specified.
852 *
853 * Completes with a [Message].
854 *
855 * Completes with a [common.ApiRequestError] if the API endpoint returned an
856 * error.
857 *
858 * If the used [http.Client] completes with an error when making a REST call,
859 * this method will complete with the same error.
860 */
861 async.Future<Message> get(core.String userId, core.String id, {core.String for mat, core.List<core.String> metadataHeaders}) {
862 var _url = null;
863 var _queryParams = new core.Map();
864 var _uploadMedia = null;
865 var _uploadOptions = null;
866 var _downloadOptions = common.DownloadOptions.Metadata;
867 var _body = null;
868
869 if (userId == null) {
870 throw new core.ArgumentError("Parameter userId is required.");
871 }
872 if (id == null) {
873 throw new core.ArgumentError("Parameter id is required.");
874 }
875 if (format != null) {
876 _queryParams["format"] = [format];
877 }
878 if (metadataHeaders != null) {
879 _queryParams["metadataHeaders"] = metadataHeaders;
880 }
881
882
883 _url = common_internal.Escaper.ecapeVariable('$userId') + '/messages/' + com mon_internal.Escaper.ecapeVariable('$id');
884
885 var _response = _requester.request(_url,
886 "GET",
887 body: _body,
888 queryParams: _queryParams,
889 uploadOptions: _uploadOptions,
890 uploadMedia: _uploadMedia,
891 downloadOptions: _downloadOptions);
892 return _response.then((data) => new Message.fromJson(data));
893 }
894
895 /**
896 * Imports a message into only this user's mailbox, with standard email
897 * delivery scanning and classification similar to receiving via SMTP. Does
898 * not send a message.
899 *
900 * [request] - The metadata request object.
901 *
902 * Request parameters:
903 *
904 * [userId] - The user's email address. The special value me can be used to
905 * indicate the authenticated user.
906 *
907 * [internalDateSource] - Source for Gmail's internal date of the message.
908 * Possible string values are:
909 * - "dateHeader"
910 * - "receivedTime"
911 *
912 * [uploadMedia] - The media to upload.
913 *
914 * [uploadOptions] - Options for the media upload. Streaming Media without the
915 * length being known ahead of time is only supported via resumable uploads.
916 *
917 * Completes with a [Message].
918 *
919 * Completes with a [common.ApiRequestError] if the API endpoint returned an
920 * error.
921 *
922 * If the used [http.Client] completes with an error when making a REST call,
923 * this method will complete with the same error.
924 */
925 async.Future<Message> import(Message request, core.String userId, {core.String internalDateSource, common.UploadOptions uploadOptions : common.UploadOptions.D efault, common.Media uploadMedia}) {
926 var _url = null;
927 var _queryParams = new core.Map();
928 var _uploadMedia = null;
929 var _uploadOptions = null;
930 var _downloadOptions = common.DownloadOptions.Metadata;
931 var _body = null;
932
933 if (request != null) {
934 _body = convert.JSON.encode((request).toJson());
935 }
936 if (userId == null) {
937 throw new core.ArgumentError("Parameter userId is required.");
938 }
939 if (internalDateSource != null) {
940 _queryParams["internalDateSource"] = [internalDateSource];
941 }
942
943 _uploadMedia = uploadMedia;
944 _uploadOptions = uploadOptions;
945
946 if (_uploadMedia == null) {
947 _url = common_internal.Escaper.ecapeVariable('$userId') + '/messages/impor t';
948 } else if (_uploadOptions is common.ResumableUploadOptions) {
949 _url = '/resumable/upload/gmail/v1/users/' + common_internal.Escaper.ecape Variable('$userId') + '/messages/import';
950 } else {
951 _url = '/upload/gmail/v1/users/' + common_internal.Escaper.ecapeVariable(' $userId') + '/messages/import';
952 }
953
954
955 var _response = _requester.request(_url,
956 "POST",
957 body: _body,
958 queryParams: _queryParams,
959 uploadOptions: _uploadOptions,
960 uploadMedia: _uploadMedia,
961 downloadOptions: _downloadOptions);
962 return _response.then((data) => new Message.fromJson(data));
963 }
964
965 /**
966 * Directly inserts a message into only this user's mailbox similar to IMAP
967 * APPEND, bypassing most scanning and classification. Does not send a
968 * message.
969 *
970 * [request] - The metadata request object.
971 *
972 * Request parameters:
973 *
974 * [userId] - The user's email address. The special value me can be used to
975 * indicate the authenticated user.
976 *
977 * [internalDateSource] - Source for Gmail's internal date of the message.
978 * Possible string values are:
979 * - "dateHeader"
980 * - "receivedTime"
981 *
982 * [uploadMedia] - The media to upload.
983 *
984 * [uploadOptions] - Options for the media upload. Streaming Media without the
985 * length being known ahead of time is only supported via resumable uploads.
986 *
987 * Completes with a [Message].
988 *
989 * Completes with a [common.ApiRequestError] if the API endpoint returned an
990 * error.
991 *
992 * If the used [http.Client] completes with an error when making a REST call,
993 * this method will complete with the same error.
994 */
995 async.Future<Message> insert(Message request, core.String userId, {core.String internalDateSource, common.UploadOptions uploadOptions : common.UploadOptions.D efault, common.Media uploadMedia}) {
996 var _url = null;
997 var _queryParams = new core.Map();
998 var _uploadMedia = null;
999 var _uploadOptions = null;
1000 var _downloadOptions = common.DownloadOptions.Metadata;
1001 var _body = null;
1002
1003 if (request != null) {
1004 _body = convert.JSON.encode((request).toJson());
1005 }
1006 if (userId == null) {
1007 throw new core.ArgumentError("Parameter userId is required.");
1008 }
1009 if (internalDateSource != null) {
1010 _queryParams["internalDateSource"] = [internalDateSource];
1011 }
1012
1013 _uploadMedia = uploadMedia;
1014 _uploadOptions = uploadOptions;
1015
1016 if (_uploadMedia == null) {
1017 _url = common_internal.Escaper.ecapeVariable('$userId') + '/messages';
1018 } else if (_uploadOptions is common.ResumableUploadOptions) {
1019 _url = '/resumable/upload/gmail/v1/users/' + common_internal.Escaper.ecape Variable('$userId') + '/messages';
1020 } else {
1021 _url = '/upload/gmail/v1/users/' + common_internal.Escaper.ecapeVariable(' $userId') + '/messages';
1022 }
1023
1024
1025 var _response = _requester.request(_url,
1026 "POST",
1027 body: _body,
1028 queryParams: _queryParams,
1029 uploadOptions: _uploadOptions,
1030 uploadMedia: _uploadMedia,
1031 downloadOptions: _downloadOptions);
1032 return _response.then((data) => new Message.fromJson(data));
1033 }
1034
1035 /**
1036 * Lists the messages in the user's mailbox.
1037 *
1038 * Request parameters:
1039 *
1040 * [userId] - The user's email address. The special value me can be used to
1041 * indicate the authenticated user.
1042 *
1043 * [includeSpamTrash] - Include messages from SPAM and TRASH in the results.
1044 *
1045 * [labelIds] - Only return messages with labels that match all of the
1046 * specified label IDs.
1047 *
1048 * [maxResults] - Maximum number of messages to return.
1049 *
1050 * [pageToken] - Page token to retrieve a specific page of results in the
1051 * list.
1052 *
1053 * [q] - Only return messages matching the specified query. Supports the same
1054 * query format as the Gmail search box. For example,
1055 * "from:someuser@example.com rfc822msgid: is:unread".
1056 *
1057 * Completes with a [ListMessagesResponse].
1058 *
1059 * Completes with a [common.ApiRequestError] if the API endpoint returned an
1060 * error.
1061 *
1062 * If the used [http.Client] completes with an error when making a REST call,
1063 * this method will complete with the same error.
1064 */
1065 async.Future<ListMessagesResponse> list(core.String userId, {core.bool include SpamTrash, core.List<core.String> labelIds, core.int maxResults, core.String pag eToken, core.String q}) {
1066 var _url = null;
1067 var _queryParams = new core.Map();
1068 var _uploadMedia = null;
1069 var _uploadOptions = null;
1070 var _downloadOptions = common.DownloadOptions.Metadata;
1071 var _body = null;
1072
1073 if (userId == null) {
1074 throw new core.ArgumentError("Parameter userId is required.");
1075 }
1076 if (includeSpamTrash != null) {
1077 _queryParams["includeSpamTrash"] = ["${includeSpamTrash}"];
1078 }
1079 if (labelIds != null) {
1080 _queryParams["labelIds"] = labelIds;
1081 }
1082 if (maxResults != null) {
1083 _queryParams["maxResults"] = ["${maxResults}"];
1084 }
1085 if (pageToken != null) {
1086 _queryParams["pageToken"] = [pageToken];
1087 }
1088 if (q != null) {
1089 _queryParams["q"] = [q];
1090 }
1091
1092
1093 _url = common_internal.Escaper.ecapeVariable('$userId') + '/messages';
1094
1095 var _response = _requester.request(_url,
1096 "GET",
1097 body: _body,
1098 queryParams: _queryParams,
1099 uploadOptions: _uploadOptions,
1100 uploadMedia: _uploadMedia,
1101 downloadOptions: _downloadOptions);
1102 return _response.then((data) => new ListMessagesResponse.fromJson(data));
1103 }
1104
1105 /**
1106 * Modifies the labels on the specified message.
1107 *
1108 * [request] - The metadata request object.
1109 *
1110 * Request parameters:
1111 *
1112 * [userId] - The user's email address. The special value me can be used to
1113 * indicate the authenticated user.
1114 *
1115 * [id] - The ID of the message to modify.
1116 *
1117 * Completes with a [Message].
1118 *
1119 * Completes with a [common.ApiRequestError] if the API endpoint returned an
1120 * error.
1121 *
1122 * If the used [http.Client] completes with an error when making a REST call,
1123 * this method will complete with the same error.
1124 */
1125 async.Future<Message> modify(ModifyMessageRequest request, core.String userId, core.String id) {
1126 var _url = null;
1127 var _queryParams = new core.Map();
1128 var _uploadMedia = null;
1129 var _uploadOptions = null;
1130 var _downloadOptions = common.DownloadOptions.Metadata;
1131 var _body = null;
1132
1133 if (request != null) {
1134 _body = convert.JSON.encode((request).toJson());
1135 }
1136 if (userId == null) {
1137 throw new core.ArgumentError("Parameter userId is required.");
1138 }
1139 if (id == null) {
1140 throw new core.ArgumentError("Parameter id is required.");
1141 }
1142
1143
1144 _url = common_internal.Escaper.ecapeVariable('$userId') + '/messages/' + com mon_internal.Escaper.ecapeVariable('$id') + '/modify';
1145
1146 var _response = _requester.request(_url,
1147 "POST",
1148 body: _body,
1149 queryParams: _queryParams,
1150 uploadOptions: _uploadOptions,
1151 uploadMedia: _uploadMedia,
1152 downloadOptions: _downloadOptions);
1153 return _response.then((data) => new Message.fromJson(data));
1154 }
1155
1156 /**
1157 * Sends the specified message to the recipients in the To, Cc, and Bcc
1158 * headers.
1159 *
1160 * [request] - The metadata request object.
1161 *
1162 * Request parameters:
1163 *
1164 * [userId] - The user's email address. The special value me can be used to
1165 * indicate the authenticated user.
1166 *
1167 * [uploadMedia] - The media to upload.
1168 *
1169 * [uploadOptions] - Options for the media upload. Streaming Media without the
1170 * length being known ahead of time is only supported via resumable uploads.
1171 *
1172 * Completes with a [Message].
1173 *
1174 * Completes with a [common.ApiRequestError] if the API endpoint returned an
1175 * error.
1176 *
1177 * If the used [http.Client] completes with an error when making a REST call,
1178 * this method will complete with the same error.
1179 */
1180 async.Future<Message> send(Message request, core.String userId, {common.Upload Options uploadOptions : common.UploadOptions.Default, common.Media uploadMedia}) {
1181 var _url = null;
1182 var _queryParams = new core.Map();
1183 var _uploadMedia = null;
1184 var _uploadOptions = null;
1185 var _downloadOptions = common.DownloadOptions.Metadata;
1186 var _body = null;
1187
1188 if (request != null) {
1189 _body = convert.JSON.encode((request).toJson());
1190 }
1191 if (userId == null) {
1192 throw new core.ArgumentError("Parameter userId is required.");
1193 }
1194
1195 _uploadMedia = uploadMedia;
1196 _uploadOptions = uploadOptions;
1197
1198 if (_uploadMedia == null) {
1199 _url = common_internal.Escaper.ecapeVariable('$userId') + '/messages/send' ;
1200 } else if (_uploadOptions is common.ResumableUploadOptions) {
1201 _url = '/resumable/upload/gmail/v1/users/' + common_internal.Escaper.ecape Variable('$userId') + '/messages/send';
1202 } else {
1203 _url = '/upload/gmail/v1/users/' + common_internal.Escaper.ecapeVariable(' $userId') + '/messages/send';
1204 }
1205
1206
1207 var _response = _requester.request(_url,
1208 "POST",
1209 body: _body,
1210 queryParams: _queryParams,
1211 uploadOptions: _uploadOptions,
1212 uploadMedia: _uploadMedia,
1213 downloadOptions: _downloadOptions);
1214 return _response.then((data) => new Message.fromJson(data));
1215 }
1216
1217 /**
1218 * Moves the specified message to the trash.
1219 *
1220 * Request parameters:
1221 *
1222 * [userId] - The user's email address. The special value me can be used to
1223 * indicate the authenticated user.
1224 *
1225 * [id] - The ID of the message to Trash.
1226 *
1227 * Completes with a [Message].
1228 *
1229 * Completes with a [common.ApiRequestError] if the API endpoint returned an
1230 * error.
1231 *
1232 * If the used [http.Client] completes with an error when making a REST call,
1233 * this method will complete with the same error.
1234 */
1235 async.Future<Message> trash(core.String userId, core.String id) {
1236 var _url = null;
1237 var _queryParams = new core.Map();
1238 var _uploadMedia = null;
1239 var _uploadOptions = null;
1240 var _downloadOptions = common.DownloadOptions.Metadata;
1241 var _body = null;
1242
1243 if (userId == null) {
1244 throw new core.ArgumentError("Parameter userId is required.");
1245 }
1246 if (id == null) {
1247 throw new core.ArgumentError("Parameter id is required.");
1248 }
1249
1250
1251 _url = common_internal.Escaper.ecapeVariable('$userId') + '/messages/' + com mon_internal.Escaper.ecapeVariable('$id') + '/trash';
1252
1253 var _response = _requester.request(_url,
1254 "POST",
1255 body: _body,
1256 queryParams: _queryParams,
1257 uploadOptions: _uploadOptions,
1258 uploadMedia: _uploadMedia,
1259 downloadOptions: _downloadOptions);
1260 return _response.then((data) => new Message.fromJson(data));
1261 }
1262
1263 /**
1264 * Removes the specified message from the trash.
1265 *
1266 * Request parameters:
1267 *
1268 * [userId] - The user's email address. The special value me can be used to
1269 * indicate the authenticated user.
1270 *
1271 * [id] - The ID of the message to remove from Trash.
1272 *
1273 * Completes with a [Message].
1274 *
1275 * Completes with a [common.ApiRequestError] if the API endpoint returned an
1276 * error.
1277 *
1278 * If the used [http.Client] completes with an error when making a REST call,
1279 * this method will complete with the same error.
1280 */
1281 async.Future<Message> untrash(core.String userId, core.String id) {
1282 var _url = null;
1283 var _queryParams = new core.Map();
1284 var _uploadMedia = null;
1285 var _uploadOptions = null;
1286 var _downloadOptions = common.DownloadOptions.Metadata;
1287 var _body = null;
1288
1289 if (userId == null) {
1290 throw new core.ArgumentError("Parameter userId is required.");
1291 }
1292 if (id == null) {
1293 throw new core.ArgumentError("Parameter id is required.");
1294 }
1295
1296
1297 _url = common_internal.Escaper.ecapeVariable('$userId') + '/messages/' + com mon_internal.Escaper.ecapeVariable('$id') + '/untrash';
1298
1299 var _response = _requester.request(_url,
1300 "POST",
1301 body: _body,
1302 queryParams: _queryParams,
1303 uploadOptions: _uploadOptions,
1304 uploadMedia: _uploadMedia,
1305 downloadOptions: _downloadOptions);
1306 return _response.then((data) => new Message.fromJson(data));
1307 }
1308
1309 }
1310
1311
1312 /** Not documented yet. */
1313 class UsersMessagesAttachmentsResourceApi {
1314 final common_internal.ApiRequester _requester;
1315
1316 UsersMessagesAttachmentsResourceApi(common_internal.ApiRequester client) :
1317 _requester = client;
1318
1319 /**
1320 * Gets the specified message attachment.
1321 *
1322 * Request parameters:
1323 *
1324 * [userId] - The user's email address. The special value me can be used to
1325 * indicate the authenticated user.
1326 *
1327 * [messageId] - The ID of the message containing the attachment.
1328 *
1329 * [id] - The ID of the attachment.
1330 *
1331 * Completes with a [MessagePartBody].
1332 *
1333 * Completes with a [common.ApiRequestError] if the API endpoint returned an
1334 * error.
1335 *
1336 * If the used [http.Client] completes with an error when making a REST call,
1337 * this method will complete with the same error.
1338 */
1339 async.Future<MessagePartBody> get(core.String userId, core.String messageId, c ore.String id) {
1340 var _url = null;
1341 var _queryParams = new core.Map();
1342 var _uploadMedia = null;
1343 var _uploadOptions = null;
1344 var _downloadOptions = common.DownloadOptions.Metadata;
1345 var _body = null;
1346
1347 if (userId == null) {
1348 throw new core.ArgumentError("Parameter userId is required.");
1349 }
1350 if (messageId == null) {
1351 throw new core.ArgumentError("Parameter messageId is required.");
1352 }
1353 if (id == null) {
1354 throw new core.ArgumentError("Parameter id is required.");
1355 }
1356
1357
1358 _url = common_internal.Escaper.ecapeVariable('$userId') + '/messages/' + com mon_internal.Escaper.ecapeVariable('$messageId') + '/attachments/' + common_inte rnal.Escaper.ecapeVariable('$id');
1359
1360 var _response = _requester.request(_url,
1361 "GET",
1362 body: _body,
1363 queryParams: _queryParams,
1364 uploadOptions: _uploadOptions,
1365 uploadMedia: _uploadMedia,
1366 downloadOptions: _downloadOptions);
1367 return _response.then((data) => new MessagePartBody.fromJson(data));
1368 }
1369
1370 }
1371
1372
1373 /** Not documented yet. */
1374 class UsersThreadsResourceApi {
1375 final common_internal.ApiRequester _requester;
1376
1377 UsersThreadsResourceApi(common_internal.ApiRequester client) :
1378 _requester = client;
1379
1380 /**
1381 * Immediately and permanently deletes the specified thread. This operation
1382 * cannot be undone. Prefer threads.trash instead.
1383 *
1384 * Request parameters:
1385 *
1386 * [userId] - The user's email address. The special value me can be used to
1387 * indicate the authenticated user.
1388 *
1389 * [id] - ID of the Thread to delete.
1390 *
1391 * Completes with a [common.ApiRequestError] if the API endpoint returned an
1392 * error.
1393 *
1394 * If the used [http.Client] completes with an error when making a REST call,
1395 * this method will complete with the same error.
1396 */
1397 async.Future delete(core.String userId, core.String id) {
1398 var _url = null;
1399 var _queryParams = new core.Map();
1400 var _uploadMedia = null;
1401 var _uploadOptions = null;
1402 var _downloadOptions = common.DownloadOptions.Metadata;
1403 var _body = null;
1404
1405 if (userId == null) {
1406 throw new core.ArgumentError("Parameter userId is required.");
1407 }
1408 if (id == null) {
1409 throw new core.ArgumentError("Parameter id is required.");
1410 }
1411
1412 _downloadOptions = null;
1413
1414 _url = common_internal.Escaper.ecapeVariable('$userId') + '/threads/' + comm on_internal.Escaper.ecapeVariable('$id');
1415
1416 var _response = _requester.request(_url,
1417 "DELETE",
1418 body: _body,
1419 queryParams: _queryParams,
1420 uploadOptions: _uploadOptions,
1421 uploadMedia: _uploadMedia,
1422 downloadOptions: _downloadOptions);
1423 return _response.then((data) => null);
1424 }
1425
1426 /**
1427 * Gets the specified thread.
1428 *
1429 * Request parameters:
1430 *
1431 * [userId] - The user's email address. The special value me can be used to
1432 * indicate the authenticated user.
1433 *
1434 * [id] - The ID of the thread to retrieve.
1435 *
1436 * Completes with a [Thread].
1437 *
1438 * Completes with a [common.ApiRequestError] if the API endpoint returned an
1439 * error.
1440 *
1441 * If the used [http.Client] completes with an error when making a REST call,
1442 * this method will complete with the same error.
1443 */
1444 async.Future<Thread> get(core.String userId, core.String id) {
1445 var _url = null;
1446 var _queryParams = new core.Map();
1447 var _uploadMedia = null;
1448 var _uploadOptions = null;
1449 var _downloadOptions = common.DownloadOptions.Metadata;
1450 var _body = null;
1451
1452 if (userId == null) {
1453 throw new core.ArgumentError("Parameter userId is required.");
1454 }
1455 if (id == null) {
1456 throw new core.ArgumentError("Parameter id is required.");
1457 }
1458
1459
1460 _url = common_internal.Escaper.ecapeVariable('$userId') + '/threads/' + comm on_internal.Escaper.ecapeVariable('$id');
1461
1462 var _response = _requester.request(_url,
1463 "GET",
1464 body: _body,
1465 queryParams: _queryParams,
1466 uploadOptions: _uploadOptions,
1467 uploadMedia: _uploadMedia,
1468 downloadOptions: _downloadOptions);
1469 return _response.then((data) => new Thread.fromJson(data));
1470 }
1471
1472 /**
1473 * Lists the threads in the user's mailbox.
1474 *
1475 * Request parameters:
1476 *
1477 * [userId] - The user's email address. The special value me can be used to
1478 * indicate the authenticated user.
1479 *
1480 * [includeSpamTrash] - Include threads from SPAM and TRASH in the results.
1481 *
1482 * [labelIds] - Only return threads with labels that match all of the
1483 * specified label IDs.
1484 *
1485 * [maxResults] - Maximum number of threads to return.
1486 *
1487 * [pageToken] - Page token to retrieve a specific page of results in the
1488 * list.
1489 *
1490 * [q] - Only return threads matching the specified query. Supports the same
1491 * query format as the Gmail search box. For example,
1492 * "from:someuser@example.com rfc822msgid: is:unread".
1493 *
1494 * Completes with a [ListThreadsResponse].
1495 *
1496 * Completes with a [common.ApiRequestError] if the API endpoint returned an
1497 * error.
1498 *
1499 * If the used [http.Client] completes with an error when making a REST call,
1500 * this method will complete with the same error.
1501 */
1502 async.Future<ListThreadsResponse> list(core.String userId, {core.bool includeS pamTrash, core.List<core.String> labelIds, core.int maxResults, core.String page Token, core.String q}) {
1503 var _url = null;
1504 var _queryParams = new core.Map();
1505 var _uploadMedia = null;
1506 var _uploadOptions = null;
1507 var _downloadOptions = common.DownloadOptions.Metadata;
1508 var _body = null;
1509
1510 if (userId == null) {
1511 throw new core.ArgumentError("Parameter userId is required.");
1512 }
1513 if (includeSpamTrash != null) {
1514 _queryParams["includeSpamTrash"] = ["${includeSpamTrash}"];
1515 }
1516 if (labelIds != null) {
1517 _queryParams["labelIds"] = labelIds;
1518 }
1519 if (maxResults != null) {
1520 _queryParams["maxResults"] = ["${maxResults}"];
1521 }
1522 if (pageToken != null) {
1523 _queryParams["pageToken"] = [pageToken];
1524 }
1525 if (q != null) {
1526 _queryParams["q"] = [q];
1527 }
1528
1529
1530 _url = common_internal.Escaper.ecapeVariable('$userId') + '/threads';
1531
1532 var _response = _requester.request(_url,
1533 "GET",
1534 body: _body,
1535 queryParams: _queryParams,
1536 uploadOptions: _uploadOptions,
1537 uploadMedia: _uploadMedia,
1538 downloadOptions: _downloadOptions);
1539 return _response.then((data) => new ListThreadsResponse.fromJson(data));
1540 }
1541
1542 /**
1543 * Modifies the labels applied to the thread. This applies to all messages in
1544 * the thread.
1545 *
1546 * [request] - The metadata request object.
1547 *
1548 * Request parameters:
1549 *
1550 * [userId] - The user's email address. The special value me can be used to
1551 * indicate the authenticated user.
1552 *
1553 * [id] - The ID of the thread to modify.
1554 *
1555 * Completes with a [Thread].
1556 *
1557 * Completes with a [common.ApiRequestError] if the API endpoint returned an
1558 * error.
1559 *
1560 * If the used [http.Client] completes with an error when making a REST call,
1561 * this method will complete with the same error.
1562 */
1563 async.Future<Thread> modify(ModifyThreadRequest request, core.String userId, c ore.String id) {
1564 var _url = null;
1565 var _queryParams = new core.Map();
1566 var _uploadMedia = null;
1567 var _uploadOptions = null;
1568 var _downloadOptions = common.DownloadOptions.Metadata;
1569 var _body = null;
1570
1571 if (request != null) {
1572 _body = convert.JSON.encode((request).toJson());
1573 }
1574 if (userId == null) {
1575 throw new core.ArgumentError("Parameter userId is required.");
1576 }
1577 if (id == null) {
1578 throw new core.ArgumentError("Parameter id is required.");
1579 }
1580
1581
1582 _url = common_internal.Escaper.ecapeVariable('$userId') + '/threads/' + comm on_internal.Escaper.ecapeVariable('$id') + '/modify';
1583
1584 var _response = _requester.request(_url,
1585 "POST",
1586 body: _body,
1587 queryParams: _queryParams,
1588 uploadOptions: _uploadOptions,
1589 uploadMedia: _uploadMedia,
1590 downloadOptions: _downloadOptions);
1591 return _response.then((data) => new Thread.fromJson(data));
1592 }
1593
1594 /**
1595 * Moves the specified thread to the trash.
1596 *
1597 * Request parameters:
1598 *
1599 * [userId] - The user's email address. The special value me can be used to
1600 * indicate the authenticated user.
1601 *
1602 * [id] - The ID of the thread to Trash.
1603 *
1604 * Completes with a [Thread].
1605 *
1606 * Completes with a [common.ApiRequestError] if the API endpoint returned an
1607 * error.
1608 *
1609 * If the used [http.Client] completes with an error when making a REST call,
1610 * this method will complete with the same error.
1611 */
1612 async.Future<Thread> trash(core.String userId, core.String id) {
1613 var _url = null;
1614 var _queryParams = new core.Map();
1615 var _uploadMedia = null;
1616 var _uploadOptions = null;
1617 var _downloadOptions = common.DownloadOptions.Metadata;
1618 var _body = null;
1619
1620 if (userId == null) {
1621 throw new core.ArgumentError("Parameter userId is required.");
1622 }
1623 if (id == null) {
1624 throw new core.ArgumentError("Parameter id is required.");
1625 }
1626
1627
1628 _url = common_internal.Escaper.ecapeVariable('$userId') + '/threads/' + comm on_internal.Escaper.ecapeVariable('$id') + '/trash';
1629
1630 var _response = _requester.request(_url,
1631 "POST",
1632 body: _body,
1633 queryParams: _queryParams,
1634 uploadOptions: _uploadOptions,
1635 uploadMedia: _uploadMedia,
1636 downloadOptions: _downloadOptions);
1637 return _response.then((data) => new Thread.fromJson(data));
1638 }
1639
1640 /**
1641 * Removes the specified thread from the trash.
1642 *
1643 * Request parameters:
1644 *
1645 * [userId] - The user's email address. The special value me can be used to
1646 * indicate the authenticated user.
1647 *
1648 * [id] - The ID of the thread to remove from Trash.
1649 *
1650 * Completes with a [Thread].
1651 *
1652 * Completes with a [common.ApiRequestError] if the API endpoint returned an
1653 * error.
1654 *
1655 * If the used [http.Client] completes with an error when making a REST call,
1656 * this method will complete with the same error.
1657 */
1658 async.Future<Thread> untrash(core.String userId, core.String id) {
1659 var _url = null;
1660 var _queryParams = new core.Map();
1661 var _uploadMedia = null;
1662 var _uploadOptions = null;
1663 var _downloadOptions = common.DownloadOptions.Metadata;
1664 var _body = null;
1665
1666 if (userId == null) {
1667 throw new core.ArgumentError("Parameter userId is required.");
1668 }
1669 if (id == null) {
1670 throw new core.ArgumentError("Parameter id is required.");
1671 }
1672
1673
1674 _url = common_internal.Escaper.ecapeVariable('$userId') + '/threads/' + comm on_internal.Escaper.ecapeVariable('$id') + '/untrash';
1675
1676 var _response = _requester.request(_url,
1677 "POST",
1678 body: _body,
1679 queryParams: _queryParams,
1680 uploadOptions: _uploadOptions,
1681 uploadMedia: _uploadMedia,
1682 downloadOptions: _downloadOptions);
1683 return _response.then((data) => new Thread.fromJson(data));
1684 }
1685
1686 }
1687
1688
1689
1690 /** A draft email in the user's mailbox. */
1691 class Draft {
1692 /** The immutable ID of the draft. */
1693 core.String id;
1694
1695 /** The message content of the draft. */
1696 Message message;
1697
1698
1699 Draft();
1700
1701 Draft.fromJson(core.Map _json) {
1702 if (_json.containsKey("id")) {
1703 id = _json["id"];
1704 }
1705 if (_json.containsKey("message")) {
1706 message = new Message.fromJson(_json["message"]);
1707 }
1708 }
1709
1710 core.Map toJson() {
1711 var _json = new core.Map();
1712 if (id != null) {
1713 _json["id"] = id;
1714 }
1715 if (message != null) {
1716 _json["message"] = (message).toJson();
1717 }
1718 return _json;
1719 }
1720 }
1721
1722
1723 /**
1724 * A record of a change to the user's mailbox. Each history contains a list of
1725 * the messages that were affected by this change.
1726 */
1727 class History {
1728 /** The mailbox sequence ID. */
1729 core.String id;
1730
1731 /** The messages that changed in this history record. */
1732 core.List<Message> messages;
1733
1734
1735 History();
1736
1737 History.fromJson(core.Map _json) {
1738 if (_json.containsKey("id")) {
1739 id = _json["id"];
1740 }
1741 if (_json.containsKey("messages")) {
1742 messages = _json["messages"].map((value) => new Message.fromJson(value)).t oList();
1743 }
1744 }
1745
1746 core.Map toJson() {
1747 var _json = new core.Map();
1748 if (id != null) {
1749 _json["id"] = id;
1750 }
1751 if (messages != null) {
1752 _json["messages"] = messages.map((value) => (value).toJson()).toList();
1753 }
1754 return _json;
1755 }
1756 }
1757
1758
1759 /**
1760 * Labels are used to categorize messages and threads within the user's mailbox.
1761 */
1762 class Label {
1763 /** The immutable ID of the label. */
1764 core.String id;
1765
1766 /**
1767 * The visibility of the label in the label list in the Gmail web interface.
1768 * Possible string values are:
1769 * - "labelHide"
1770 * - "labelShow"
1771 * - "labelShowIfUnread"
1772 */
1773 core.String labelListVisibility;
1774
1775 /**
1776 * The visibility of the label in the message list in the Gmail web interface.
1777 * Possible string values are:
1778 * - "hide"
1779 * - "show"
1780 */
1781 core.String messageListVisibility;
1782
1783 /** The display name of the label. */
1784 core.String name;
1785
1786 /**
1787 * The owner type for the label. User labels are created by the user and can
1788 * be modified and deleted by the user and can be applied to any message or
1789 * thread. System labels are internally created and cannot be added, modified,
1790 * or deleted. System labels may be able to be applied to or removed from
1791 * messages and threads under some circumstances but this is not guaranteed.
1792 * For example, users can apply and remove the INBOX and UNREAD labels from
1793 * messages and threads, but cannot apply or remove the DRAFTS or SENT labels
1794 * from messages or threads.
1795 * Possible string values are:
1796 * - "system"
1797 * - "user"
1798 */
1799 core.String type;
1800
1801
1802 Label();
1803
1804 Label.fromJson(core.Map _json) {
1805 if (_json.containsKey("id")) {
1806 id = _json["id"];
1807 }
1808 if (_json.containsKey("labelListVisibility")) {
1809 labelListVisibility = _json["labelListVisibility"];
1810 }
1811 if (_json.containsKey("messageListVisibility")) {
1812 messageListVisibility = _json["messageListVisibility"];
1813 }
1814 if (_json.containsKey("name")) {
1815 name = _json["name"];
1816 }
1817 if (_json.containsKey("type")) {
1818 type = _json["type"];
1819 }
1820 }
1821
1822 core.Map toJson() {
1823 var _json = new core.Map();
1824 if (id != null) {
1825 _json["id"] = id;
1826 }
1827 if (labelListVisibility != null) {
1828 _json["labelListVisibility"] = labelListVisibility;
1829 }
1830 if (messageListVisibility != null) {
1831 _json["messageListVisibility"] = messageListVisibility;
1832 }
1833 if (name != null) {
1834 _json["name"] = name;
1835 }
1836 if (type != null) {
1837 _json["type"] = type;
1838 }
1839 return _json;
1840 }
1841 }
1842
1843
1844 /** Not documented yet. */
1845 class ListDraftsResponse {
1846 /** List of drafts. */
1847 core.List<Draft> drafts;
1848
1849 /** Token to retrieve the next page of results in the list. */
1850 core.String nextPageToken;
1851
1852 /** Estimated total number of results. */
1853 core.int resultSizeEstimate;
1854
1855
1856 ListDraftsResponse();
1857
1858 ListDraftsResponse.fromJson(core.Map _json) {
1859 if (_json.containsKey("drafts")) {
1860 drafts = _json["drafts"].map((value) => new Draft.fromJson(value)).toList( );
1861 }
1862 if (_json.containsKey("nextPageToken")) {
1863 nextPageToken = _json["nextPageToken"];
1864 }
1865 if (_json.containsKey("resultSizeEstimate")) {
1866 resultSizeEstimate = _json["resultSizeEstimate"];
1867 }
1868 }
1869
1870 core.Map toJson() {
1871 var _json = new core.Map();
1872 if (drafts != null) {
1873 _json["drafts"] = drafts.map((value) => (value).toJson()).toList();
1874 }
1875 if (nextPageToken != null) {
1876 _json["nextPageToken"] = nextPageToken;
1877 }
1878 if (resultSizeEstimate != null) {
1879 _json["resultSizeEstimate"] = resultSizeEstimate;
1880 }
1881 return _json;
1882 }
1883 }
1884
1885
1886 /** Not documented yet. */
1887 class ListHistoryResponse {
1888 /** List of history records. */
1889 core.List<History> history;
1890
1891 /** The ID of the mailbox's current history record. */
1892 core.String historyId;
1893
1894 /** Page token to retrieve the next page of results in the list. */
1895 core.String nextPageToken;
1896
1897
1898 ListHistoryResponse();
1899
1900 ListHistoryResponse.fromJson(core.Map _json) {
1901 if (_json.containsKey("history")) {
1902 history = _json["history"].map((value) => new History.fromJson(value)).toL ist();
1903 }
1904 if (_json.containsKey("historyId")) {
1905 historyId = _json["historyId"];
1906 }
1907 if (_json.containsKey("nextPageToken")) {
1908 nextPageToken = _json["nextPageToken"];
1909 }
1910 }
1911
1912 core.Map toJson() {
1913 var _json = new core.Map();
1914 if (history != null) {
1915 _json["history"] = history.map((value) => (value).toJson()).toList();
1916 }
1917 if (historyId != null) {
1918 _json["historyId"] = historyId;
1919 }
1920 if (nextPageToken != null) {
1921 _json["nextPageToken"] = nextPageToken;
1922 }
1923 return _json;
1924 }
1925 }
1926
1927
1928 /** Not documented yet. */
1929 class ListLabelsResponse {
1930 /** List of labels. */
1931 core.List<Label> labels;
1932
1933
1934 ListLabelsResponse();
1935
1936 ListLabelsResponse.fromJson(core.Map _json) {
1937 if (_json.containsKey("labels")) {
1938 labels = _json["labels"].map((value) => new Label.fromJson(value)).toList( );
1939 }
1940 }
1941
1942 core.Map toJson() {
1943 var _json = new core.Map();
1944 if (labels != null) {
1945 _json["labels"] = labels.map((value) => (value).toJson()).toList();
1946 }
1947 return _json;
1948 }
1949 }
1950
1951
1952 /** Not documented yet. */
1953 class ListMessagesResponse {
1954 /** List of messages. */
1955 core.List<Message> messages;
1956
1957 /** Token to retrieve the next page of results in the list. */
1958 core.String nextPageToken;
1959
1960 /** Estimated total number of results. */
1961 core.int resultSizeEstimate;
1962
1963
1964 ListMessagesResponse();
1965
1966 ListMessagesResponse.fromJson(core.Map _json) {
1967 if (_json.containsKey("messages")) {
1968 messages = _json["messages"].map((value) => new Message.fromJson(value)).t oList();
1969 }
1970 if (_json.containsKey("nextPageToken")) {
1971 nextPageToken = _json["nextPageToken"];
1972 }
1973 if (_json.containsKey("resultSizeEstimate")) {
1974 resultSizeEstimate = _json["resultSizeEstimate"];
1975 }
1976 }
1977
1978 core.Map toJson() {
1979 var _json = new core.Map();
1980 if (messages != null) {
1981 _json["messages"] = messages.map((value) => (value).toJson()).toList();
1982 }
1983 if (nextPageToken != null) {
1984 _json["nextPageToken"] = nextPageToken;
1985 }
1986 if (resultSizeEstimate != null) {
1987 _json["resultSizeEstimate"] = resultSizeEstimate;
1988 }
1989 return _json;
1990 }
1991 }
1992
1993
1994 /** Not documented yet. */
1995 class ListThreadsResponse {
1996 /** Page token to retrieve the next page of results in the list. */
1997 core.String nextPageToken;
1998
1999 /** Estimated total number of results. */
2000 core.int resultSizeEstimate;
2001
2002 /** List of threads. */
2003 core.List<Thread> threads;
2004
2005
2006 ListThreadsResponse();
2007
2008 ListThreadsResponse.fromJson(core.Map _json) {
2009 if (_json.containsKey("nextPageToken")) {
2010 nextPageToken = _json["nextPageToken"];
2011 }
2012 if (_json.containsKey("resultSizeEstimate")) {
2013 resultSizeEstimate = _json["resultSizeEstimate"];
2014 }
2015 if (_json.containsKey("threads")) {
2016 threads = _json["threads"].map((value) => new Thread.fromJson(value)).toLi st();
2017 }
2018 }
2019
2020 core.Map toJson() {
2021 var _json = new core.Map();
2022 if (nextPageToken != null) {
2023 _json["nextPageToken"] = nextPageToken;
2024 }
2025 if (resultSizeEstimate != null) {
2026 _json["resultSizeEstimate"] = resultSizeEstimate;
2027 }
2028 if (threads != null) {
2029 _json["threads"] = threads.map((value) => (value).toJson()).toList();
2030 }
2031 return _json;
2032 }
2033 }
2034
2035
2036 /** An email message. */
2037 class Message {
2038 /** The ID of the last history record that modified this message. */
2039 core.String historyId;
2040
2041 /** The immutable ID of the message. */
2042 core.String id;
2043
2044 /** List of IDs of labels applied to this message. */
2045 core.List<core.String> labelIds;
2046
2047 /** The parsed email structure in the message parts. */
2048 MessagePart payload;
2049
2050 /**
2051 * The entire email message in an RFC 2822 formatted and URL-safe base64
2052 * encoded string. Returned in messages.get and drafts.get responses when the
2053 * format=RAW parameter is supplied.
2054 */
2055 core.String raw;
2056
2057 core.List<core.int> get rawAsBytes {
2058 return crypto.CryptoUtils.base64StringToBytes(raw);
2059 }
2060
2061 void set rawAsBytes(core.List<core.int> _bytes) {
2062 raw = crypto.CryptoUtils.bytesToBase64(_bytes, urlSafe: true);
2063 }
2064
2065 /** Estimated size in bytes of the message. */
2066 core.int sizeEstimate;
2067
2068 /** A short part of the message text. */
2069 core.String snippet;
2070
2071 /**
2072 * The ID of the thread the message belongs to. To add a message or draft to a
2073 * thread, the following criteria must be met:
2074 * - The requested threadId must be specified on the Message or Draft.Message
2075 * you supply with your request.
2076 * - The References and In-Reply-To headers must be set in compliance with the
2077 * <a href="https://tools.ietf.org/html/rfc2822"RFC 2822 standard.
2078 * - The Subject headers must match.
2079 */
2080 core.String threadId;
2081
2082
2083 Message();
2084
2085 Message.fromJson(core.Map _json) {
2086 if (_json.containsKey("historyId")) {
2087 historyId = _json["historyId"];
2088 }
2089 if (_json.containsKey("id")) {
2090 id = _json["id"];
2091 }
2092 if (_json.containsKey("labelIds")) {
2093 labelIds = _json["labelIds"];
2094 }
2095 if (_json.containsKey("payload")) {
2096 payload = new MessagePart.fromJson(_json["payload"]);
2097 }
2098 if (_json.containsKey("raw")) {
2099 raw = _json["raw"];
2100 }
2101 if (_json.containsKey("sizeEstimate")) {
2102 sizeEstimate = _json["sizeEstimate"];
2103 }
2104 if (_json.containsKey("snippet")) {
2105 snippet = _json["snippet"];
2106 }
2107 if (_json.containsKey("threadId")) {
2108 threadId = _json["threadId"];
2109 }
2110 }
2111
2112 core.Map toJson() {
2113 var _json = new core.Map();
2114 if (historyId != null) {
2115 _json["historyId"] = historyId;
2116 }
2117 if (id != null) {
2118 _json["id"] = id;
2119 }
2120 if (labelIds != null) {
2121 _json["labelIds"] = labelIds;
2122 }
2123 if (payload != null) {
2124 _json["payload"] = (payload).toJson();
2125 }
2126 if (raw != null) {
2127 _json["raw"] = raw;
2128 }
2129 if (sizeEstimate != null) {
2130 _json["sizeEstimate"] = sizeEstimate;
2131 }
2132 if (snippet != null) {
2133 _json["snippet"] = snippet;
2134 }
2135 if (threadId != null) {
2136 _json["threadId"] = threadId;
2137 }
2138 return _json;
2139 }
2140 }
2141
2142
2143 /** A single MIME message part. */
2144 class MessagePart {
2145 /**
2146 * The message part body for this part, which may be empty for container MIME
2147 * message parts.
2148 */
2149 MessagePartBody body;
2150
2151 /**
2152 * The filename of the attachment. Only present if this message part
2153 * represents an attachment.
2154 */
2155 core.String filename;
2156
2157 /**
2158 * List of headers on this message part. For the top-level message part,
2159 * representing the entire message payload, it will contain the standard RFC
2160 * 2822 email headers such as To, From, and Subject.
2161 */
2162 core.List<MessagePartHeader> headers;
2163
2164 /** The MIME type of the message part. */
2165 core.String mimeType;
2166
2167 /** The immutable ID of the message part. */
2168 core.String partId;
2169
2170 /**
2171 * The child MIME message parts of this part. This only applies to container
2172 * MIME message parts, for example multipart / * . For non- container MIME
2173 * message part types, such as text/plain, this field is empty. For more
2174 * information, see RFC 1521.
2175 */
2176 core.List<MessagePart> parts;
2177
2178
2179 MessagePart();
2180
2181 MessagePart.fromJson(core.Map _json) {
2182 if (_json.containsKey("body")) {
2183 body = new MessagePartBody.fromJson(_json["body"]);
2184 }
2185 if (_json.containsKey("filename")) {
2186 filename = _json["filename"];
2187 }
2188 if (_json.containsKey("headers")) {
2189 headers = _json["headers"].map((value) => new MessagePartHeader.fromJson(v alue)).toList();
2190 }
2191 if (_json.containsKey("mimeType")) {
2192 mimeType = _json["mimeType"];
2193 }
2194 if (_json.containsKey("partId")) {
2195 partId = _json["partId"];
2196 }
2197 if (_json.containsKey("parts")) {
2198 parts = _json["parts"].map((value) => new MessagePart.fromJson(value)).toL ist();
2199 }
2200 }
2201
2202 core.Map toJson() {
2203 var _json = new core.Map();
2204 if (body != null) {
2205 _json["body"] = (body).toJson();
2206 }
2207 if (filename != null) {
2208 _json["filename"] = filename;
2209 }
2210 if (headers != null) {
2211 _json["headers"] = headers.map((value) => (value).toJson()).toList();
2212 }
2213 if (mimeType != null) {
2214 _json["mimeType"] = mimeType;
2215 }
2216 if (partId != null) {
2217 _json["partId"] = partId;
2218 }
2219 if (parts != null) {
2220 _json["parts"] = parts.map((value) => (value).toJson()).toList();
2221 }
2222 return _json;
2223 }
2224 }
2225
2226
2227 /** The body of a single MIME message part. */
2228 class MessagePartBody {
2229 /**
2230 * When present, contains the ID of an external attachment that can be
2231 * retrieved in a separate messages.attachments.get request. When not present,
2232 * the entire content of the message part body is contained in the data field.
2233 */
2234 core.String attachmentId;
2235
2236 /**
2237 * The body data of a MIME message part. May be empty for MIME container types
2238 * that have no message body or when the body data is sent as a separate
2239 * attachment. An attachment ID is present if the body data is contained in a
2240 * separate attachment.
2241 */
2242 core.String data;
2243
2244 core.List<core.int> get dataAsBytes {
2245 return crypto.CryptoUtils.base64StringToBytes(data);
2246 }
2247
2248 void set dataAsBytes(core.List<core.int> _bytes) {
2249 data = crypto.CryptoUtils.bytesToBase64(_bytes, urlSafe: true);
2250 }
2251
2252 /** Total number of bytes in the body of the message part. */
2253 core.int size;
2254
2255
2256 MessagePartBody();
2257
2258 MessagePartBody.fromJson(core.Map _json) {
2259 if (_json.containsKey("attachmentId")) {
2260 attachmentId = _json["attachmentId"];
2261 }
2262 if (_json.containsKey("data")) {
2263 data = _json["data"];
2264 }
2265 if (_json.containsKey("size")) {
2266 size = _json["size"];
2267 }
2268 }
2269
2270 core.Map toJson() {
2271 var _json = new core.Map();
2272 if (attachmentId != null) {
2273 _json["attachmentId"] = attachmentId;
2274 }
2275 if (data != null) {
2276 _json["data"] = data;
2277 }
2278 if (size != null) {
2279 _json["size"] = size;
2280 }
2281 return _json;
2282 }
2283 }
2284
2285
2286 /** Not documented yet. */
2287 class MessagePartHeader {
2288 /** The name of the header before the : separator. For example, To. */
2289 core.String name;
2290
2291 /**
2292 * The value of the header after the : separator. For example,
2293 * someuser@example.com.
2294 */
2295 core.String value;
2296
2297
2298 MessagePartHeader();
2299
2300 MessagePartHeader.fromJson(core.Map _json) {
2301 if (_json.containsKey("name")) {
2302 name = _json["name"];
2303 }
2304 if (_json.containsKey("value")) {
2305 value = _json["value"];
2306 }
2307 }
2308
2309 core.Map toJson() {
2310 var _json = new core.Map();
2311 if (name != null) {
2312 _json["name"] = name;
2313 }
2314 if (value != null) {
2315 _json["value"] = value;
2316 }
2317 return _json;
2318 }
2319 }
2320
2321
2322 /** Not documented yet. */
2323 class ModifyMessageRequest {
2324 /** A list of IDs of labels to add to this message. */
2325 core.List<core.String> addLabelIds;
2326
2327 /** A list IDs of labels to remove from this message. */
2328 core.List<core.String> removeLabelIds;
2329
2330
2331 ModifyMessageRequest();
2332
2333 ModifyMessageRequest.fromJson(core.Map _json) {
2334 if (_json.containsKey("addLabelIds")) {
2335 addLabelIds = _json["addLabelIds"];
2336 }
2337 if (_json.containsKey("removeLabelIds")) {
2338 removeLabelIds = _json["removeLabelIds"];
2339 }
2340 }
2341
2342 core.Map toJson() {
2343 var _json = new core.Map();
2344 if (addLabelIds != null) {
2345 _json["addLabelIds"] = addLabelIds;
2346 }
2347 if (removeLabelIds != null) {
2348 _json["removeLabelIds"] = removeLabelIds;
2349 }
2350 return _json;
2351 }
2352 }
2353
2354
2355 /** Not documented yet. */
2356 class ModifyThreadRequest {
2357 /** A list of IDs of labels to add to this thread. */
2358 core.List<core.String> addLabelIds;
2359
2360 /** A list of IDs of labels to remove from this thread. */
2361 core.List<core.String> removeLabelIds;
2362
2363
2364 ModifyThreadRequest();
2365
2366 ModifyThreadRequest.fromJson(core.Map _json) {
2367 if (_json.containsKey("addLabelIds")) {
2368 addLabelIds = _json["addLabelIds"];
2369 }
2370 if (_json.containsKey("removeLabelIds")) {
2371 removeLabelIds = _json["removeLabelIds"];
2372 }
2373 }
2374
2375 core.Map toJson() {
2376 var _json = new core.Map();
2377 if (addLabelIds != null) {
2378 _json["addLabelIds"] = addLabelIds;
2379 }
2380 if (removeLabelIds != null) {
2381 _json["removeLabelIds"] = removeLabelIds;
2382 }
2383 return _json;
2384 }
2385 }
2386
2387
2388 /** A collection of messages representing a conversation. */
2389 class Thread {
2390 /** The ID of the last history record that modified this thread. */
2391 core.String historyId;
2392
2393 /** The unique ID of the thread. */
2394 core.String id;
2395
2396 /** The list of messages in the thread. */
2397 core.List<Message> messages;
2398
2399 /** A short part of the message text. */
2400 core.String snippet;
2401
2402
2403 Thread();
2404
2405 Thread.fromJson(core.Map _json) {
2406 if (_json.containsKey("historyId")) {
2407 historyId = _json["historyId"];
2408 }
2409 if (_json.containsKey("id")) {
2410 id = _json["id"];
2411 }
2412 if (_json.containsKey("messages")) {
2413 messages = _json["messages"].map((value) => new Message.fromJson(value)).t oList();
2414 }
2415 if (_json.containsKey("snippet")) {
2416 snippet = _json["snippet"];
2417 }
2418 }
2419
2420 core.Map toJson() {
2421 var _json = new core.Map();
2422 if (historyId != null) {
2423 _json["historyId"] = historyId;
2424 }
2425 if (id != null) {
2426 _json["id"] = id;
2427 }
2428 if (messages != null) {
2429 _json["messages"] = messages.map((value) => (value).toJson()).toList();
2430 }
2431 if (snippet != null) {
2432 _json["snippet"] = snippet;
2433 }
2434 return _json;
2435 }
2436 }
2437
2438
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698