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

Side by Side Diff: generated/googleapis/lib/admin/email_migration_v2.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.admin.email_migration_v2;
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 /** Email Migration API lets you migrate emails of users to Google backends. */
17 class AdminApi {
18 /** Manage email messages of users on your domain */
19 static const EmailMigrationScope = "https://www.googleapis.com/auth/email.migr ation";
20
21
22 final common_internal.ApiRequester _requester;
23
24 MailResourceApi get mail => new MailResourceApi(_requester);
25
26 AdminApi(http.Client client) :
27 _requester = new common_internal.ApiRequester(client, "https://www.googlea pis.com/", "/email/v2/users/");
28 }
29
30
31 /** Not documented yet. */
32 class MailResourceApi {
33 final common_internal.ApiRequester _requester;
34
35 MailResourceApi(common_internal.ApiRequester client) :
36 _requester = client;
37
38 /**
39 * Insert Mail into Google's Gmail backends
40 *
41 * [request] - The metadata request object.
42 *
43 * Request parameters:
44 *
45 * [userKey] - The email or immutable id of the user
46 *
47 * [uploadMedia] - The media to upload.
48 *
49 * [uploadOptions] - Options for the media upload. Streaming Media without the
50 * length being known ahead of time is only supported via resumable uploads.
51 *
52 * Completes with a [common.ApiRequestError] if the API endpoint returned an
53 * error.
54 *
55 * If the used [http.Client] completes with an error when making a REST call,
56 * this method will complete with the same error.
57 */
58 async.Future insert(MailItem request, core.String userKey, {common.UploadOptio ns uploadOptions : common.UploadOptions.Default, common.Media uploadMedia}) {
59 var _url = null;
60 var _queryParams = new core.Map();
61 var _uploadMedia = null;
62 var _uploadOptions = null;
63 var _downloadOptions = common.DownloadOptions.Metadata;
64 var _body = null;
65
66 if (request != null) {
67 _body = convert.JSON.encode((request).toJson());
68 }
69 if (userKey == null) {
70 throw new core.ArgumentError("Parameter userKey is required.");
71 }
72
73 _uploadMedia = uploadMedia;
74 _uploadOptions = uploadOptions;
75 _downloadOptions = null;
76
77 if (_uploadMedia == null) {
78 _url = common_internal.Escaper.ecapeVariable('$userKey') + '/mail';
79 } else if (_uploadOptions is common.ResumableUploadOptions) {
80 _url = '/resumable/upload/email/v2/users/' + common_internal.Escaper.ecape Variable('$userKey') + '/mail';
81 } else {
82 _url = '/upload/email/v2/users/' + common_internal.Escaper.ecapeVariable(' $userKey') + '/mail';
83 }
84
85
86 var _response = _requester.request(_url,
87 "POST",
88 body: _body,
89 queryParams: _queryParams,
90 uploadOptions: _uploadOptions,
91 uploadMedia: _uploadMedia,
92 downloadOptions: _downloadOptions);
93 return _response.then((data) => null);
94 }
95
96 }
97
98
99
100 /** JSON template for MailItem object in Email Migration API. */
101 class MailItem {
102 /** Boolean indicating if the mail is deleted (used in Vault) */
103 core.bool isDeleted;
104
105 /** Boolean indicating if the mail is draft */
106 core.bool isDraft;
107
108 /** Boolean indicating if the mail is in inbox */
109 core.bool isInbox;
110
111 /** Boolean indicating if the mail is in 'sent mails' */
112 core.bool isSent;
113
114 /** Boolean indicating if the mail is starred */
115 core.bool isStarred;
116
117 /** Boolean indicating if the mail is in trash */
118 core.bool isTrash;
119
120 /** Boolean indicating if the mail is unread */
121 core.bool isUnread;
122
123 /** Kind of resource this is. */
124 core.String kind;
125
126 /** List of labels (strings) */
127 core.List<core.String> labels;
128
129
130 MailItem();
131
132 MailItem.fromJson(core.Map _json) {
133 if (_json.containsKey("isDeleted")) {
134 isDeleted = _json["isDeleted"];
135 }
136 if (_json.containsKey("isDraft")) {
137 isDraft = _json["isDraft"];
138 }
139 if (_json.containsKey("isInbox")) {
140 isInbox = _json["isInbox"];
141 }
142 if (_json.containsKey("isSent")) {
143 isSent = _json["isSent"];
144 }
145 if (_json.containsKey("isStarred")) {
146 isStarred = _json["isStarred"];
147 }
148 if (_json.containsKey("isTrash")) {
149 isTrash = _json["isTrash"];
150 }
151 if (_json.containsKey("isUnread")) {
152 isUnread = _json["isUnread"];
153 }
154 if (_json.containsKey("kind")) {
155 kind = _json["kind"];
156 }
157 if (_json.containsKey("labels")) {
158 labels = _json["labels"];
159 }
160 }
161
162 core.Map toJson() {
163 var _json = new core.Map();
164 if (isDeleted != null) {
165 _json["isDeleted"] = isDeleted;
166 }
167 if (isDraft != null) {
168 _json["isDraft"] = isDraft;
169 }
170 if (isInbox != null) {
171 _json["isInbox"] = isInbox;
172 }
173 if (isSent != null) {
174 _json["isSent"] = isSent;
175 }
176 if (isStarred != null) {
177 _json["isStarred"] = isStarred;
178 }
179 if (isTrash != null) {
180 _json["isTrash"] = isTrash;
181 }
182 if (isUnread != null) {
183 _json["isUnread"] = isUnread;
184 }
185 if (kind != null) {
186 _json["kind"] = kind;
187 }
188 if (labels != null) {
189 _json["labels"] = labels;
190 }
191 return _json;
192 }
193 }
194
195
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698