OLD | NEW |
1 library googleapis.gmail.v1; | 1 library googleapis.gmail.v1; |
2 | 2 |
3 import "dart:core" as core; | 3 import "dart:core" as core; |
4 import "dart:collection" as collection; | 4 import "dart:collection" as collection; |
5 import "dart:async" as async; | 5 import "dart:async" as async; |
6 import "dart:convert" as convert; | 6 import "dart:convert" as convert; |
7 | 7 |
8 import "package:crypto/crypto.dart" as crypto; | 8 import "package:crypto/crypto.dart" as crypto; |
9 import 'package:http/http.dart' as http; | 9 import 'package:http/http.dart' as http; |
10 import '../src/common_internal.dart' as common_internal; | 10 import '../src/common_internal.dart' as common_internal; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 final common_internal.ApiRequester _requester; | 42 final common_internal.ApiRequester _requester; |
43 | 43 |
44 UsersDraftsResourceApi get drafts => new UsersDraftsResourceApi(_requester); | 44 UsersDraftsResourceApi get drafts => new UsersDraftsResourceApi(_requester); |
45 UsersHistoryResourceApi get history => new UsersHistoryResourceApi(_requester)
; | 45 UsersHistoryResourceApi get history => new UsersHistoryResourceApi(_requester)
; |
46 UsersLabelsResourceApi get labels => new UsersLabelsResourceApi(_requester); | 46 UsersLabelsResourceApi get labels => new UsersLabelsResourceApi(_requester); |
47 UsersMessagesResourceApi get messages => new UsersMessagesResourceApi(_request
er); | 47 UsersMessagesResourceApi get messages => new UsersMessagesResourceApi(_request
er); |
48 UsersThreadsResourceApi get threads => new UsersThreadsResourceApi(_requester)
; | 48 UsersThreadsResourceApi get threads => new UsersThreadsResourceApi(_requester)
; |
49 | 49 |
50 UsersResourceApi(common_internal.ApiRequester client) : | 50 UsersResourceApi(common_internal.ApiRequester client) : |
51 _requester = client; | 51 _requester = client; |
| 52 |
| 53 /** |
| 54 * Gets the current user's Gmail profile. |
| 55 * |
| 56 * Request parameters: |
| 57 * |
| 58 * [userId] - The user's email address. The special value me can be used to |
| 59 * indicate the authenticated user. |
| 60 * |
| 61 * Completes with a [Profile]. |
| 62 * |
| 63 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 64 * error. |
| 65 * |
| 66 * If the used [http.Client] completes with an error when making a REST call, |
| 67 * this method will complete with the same error. |
| 68 */ |
| 69 async.Future<Profile> getProfile(core.String userId) { |
| 70 var _url = null; |
| 71 var _queryParams = new core.Map(); |
| 72 var _uploadMedia = null; |
| 73 var _uploadOptions = null; |
| 74 var _downloadOptions = common.DownloadOptions.Metadata; |
| 75 var _body = null; |
| 76 |
| 77 if (userId == null) { |
| 78 throw new core.ArgumentError("Parameter userId is required."); |
| 79 } |
| 80 |
| 81 |
| 82 _url = common_internal.Escaper.ecapeVariable('$userId') + '/profile'; |
| 83 |
| 84 var _response = _requester.request(_url, |
| 85 "GET", |
| 86 body: _body, |
| 87 queryParams: _queryParams, |
| 88 uploadOptions: _uploadOptions, |
| 89 uploadMedia: _uploadMedia, |
| 90 downloadOptions: _downloadOptions); |
| 91 return _response.then((data) => new Profile.fromJson(data)); |
| 92 } |
| 93 |
52 } | 94 } |
53 | 95 |
54 | 96 |
55 /** Not documented yet. */ | 97 /** Not documented yet. */ |
56 class UsersDraftsResourceApi { | 98 class UsersDraftsResourceApi { |
57 final common_internal.ApiRequester _requester; | 99 final common_internal.ApiRequester _requester; |
58 | 100 |
59 UsersDraftsResourceApi(common_internal.ApiRequester client) : | 101 UsersDraftsResourceApi(common_internal.ApiRequester client) : |
60 _requester = client; | 102 _requester = client; |
61 | 103 |
(...skipping 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2414 _json["addLabelIds"] = addLabelIds; | 2456 _json["addLabelIds"] = addLabelIds; |
2415 } | 2457 } |
2416 if (removeLabelIds != null) { | 2458 if (removeLabelIds != null) { |
2417 _json["removeLabelIds"] = removeLabelIds; | 2459 _json["removeLabelIds"] = removeLabelIds; |
2418 } | 2460 } |
2419 return _json; | 2461 return _json; |
2420 } | 2462 } |
2421 } | 2463 } |
2422 | 2464 |
2423 | 2465 |
| 2466 /** Profile for a Gmail user. */ |
| 2467 class Profile { |
| 2468 /** The user's email address. */ |
| 2469 core.String emailAddress; |
| 2470 |
| 2471 /** The ID of the mailbox's current history record. */ |
| 2472 core.String historyId; |
| 2473 |
| 2474 /** The total number of messages in the mailbox. */ |
| 2475 core.int messagesTotal; |
| 2476 |
| 2477 /** The total number of threads in the mailbox. */ |
| 2478 core.int threadsTotal; |
| 2479 |
| 2480 |
| 2481 Profile(); |
| 2482 |
| 2483 Profile.fromJson(core.Map _json) { |
| 2484 if (_json.containsKey("emailAddress")) { |
| 2485 emailAddress = _json["emailAddress"]; |
| 2486 } |
| 2487 if (_json.containsKey("historyId")) { |
| 2488 historyId = _json["historyId"]; |
| 2489 } |
| 2490 if (_json.containsKey("messagesTotal")) { |
| 2491 messagesTotal = _json["messagesTotal"]; |
| 2492 } |
| 2493 if (_json.containsKey("threadsTotal")) { |
| 2494 threadsTotal = _json["threadsTotal"]; |
| 2495 } |
| 2496 } |
| 2497 |
| 2498 core.Map toJson() { |
| 2499 var _json = new core.Map(); |
| 2500 if (emailAddress != null) { |
| 2501 _json["emailAddress"] = emailAddress; |
| 2502 } |
| 2503 if (historyId != null) { |
| 2504 _json["historyId"] = historyId; |
| 2505 } |
| 2506 if (messagesTotal != null) { |
| 2507 _json["messagesTotal"] = messagesTotal; |
| 2508 } |
| 2509 if (threadsTotal != null) { |
| 2510 _json["threadsTotal"] = threadsTotal; |
| 2511 } |
| 2512 return _json; |
| 2513 } |
| 2514 } |
| 2515 |
| 2516 |
2424 /** A collection of messages representing a conversation. */ | 2517 /** A collection of messages representing a conversation. */ |
2425 class Thread { | 2518 class Thread { |
2426 /** The ID of the last history record that modified this thread. */ | 2519 /** The ID of the last history record that modified this thread. */ |
2427 core.String historyId; | 2520 core.String historyId; |
2428 | 2521 |
2429 /** The unique ID of the thread. */ | 2522 /** The unique ID of the thread. */ |
2430 core.String id; | 2523 core.String id; |
2431 | 2524 |
2432 /** The list of messages in the thread. */ | 2525 /** The list of messages in the thread. */ |
2433 core.List<Message> messages; | 2526 core.List<Message> messages; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2465 _json["messages"] = messages.map((value) => (value).toJson()).toList(); | 2558 _json["messages"] = messages.map((value) => (value).toJson()).toList(); |
2466 } | 2559 } |
2467 if (snippet != null) { | 2560 if (snippet != null) { |
2468 _json["snippet"] = snippet; | 2561 _json["snippet"] = snippet; |
2469 } | 2562 } |
2470 return _json; | 2563 return _json; |
2471 } | 2564 } |
2472 } | 2565 } |
2473 | 2566 |
2474 | 2567 |
OLD | NEW |