| OLD | NEW |
| 1 // This is a generated file (see the discoveryapis_generator project). |
| 2 |
| 1 library googleapis.admin.email_migration_v2; | 3 library googleapis.admin.email_migration_v2; |
| 2 | 4 |
| 3 import "dart:core" as core; | 5 import 'dart:core' as core; |
| 4 import "dart:collection" as collection; | 6 import 'dart:collection' as collection; |
| 5 import "dart:async" as async; | 7 import 'dart:async' as async; |
| 6 import "dart:convert" as convert; | 8 import 'dart:convert' as convert; |
| 7 | 9 |
| 8 import "package:crypto/crypto.dart" as crypto; | 10 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; |
| 11 import 'package:crypto/crypto.dart' as crypto; |
| 9 import 'package:http/http.dart' as http; | 12 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 |
| 13 export '../common/common.dart' show ApiRequestError; | 14 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show |
| 14 export '../common/common.dart' show DetailedApiRequestError; | 15 ApiRequestError, DetailedApiRequestError, Media, UploadOptions, |
| 16 ResumableUploadOptions, DownloadOptions, PartialDownloadOptions, |
| 17 ByteRange; |
| 18 |
| 19 const core.String USER_AGENT = 'dart-api-client admin/email_migration_v2'; |
| 15 | 20 |
| 16 /** Email Migration API lets you migrate emails of users to Google backends. */ | 21 /** Email Migration API lets you migrate emails of users to Google backends. */ |
| 17 class AdminApi { | 22 class AdminApi { |
| 18 /** Manage email messages of users on your domain */ | 23 /** Manage email messages of users on your domain */ |
| 19 static const EmailMigrationScope = "https://www.googleapis.com/auth/email.migr
ation"; | 24 static const EmailMigrationScope = "https://www.googleapis.com/auth/email.migr
ation"; |
| 20 | 25 |
| 21 | 26 |
| 22 final common_internal.ApiRequester _requester; | 27 final commons.ApiRequester _requester; |
| 23 | 28 |
| 24 MailResourceApi get mail => new MailResourceApi(_requester); | 29 MailResourceApi get mail => new MailResourceApi(_requester); |
| 25 | 30 |
| 26 AdminApi(http.Client client, {core.String rootUrl: "https://www.googleapis.com
/", core.String servicePath: "email/v2/users/"}) : | 31 AdminApi(http.Client client, {core.String rootUrl: "https://www.googleapis.com
/", core.String servicePath: "email/v2/users/"}) : |
| 27 _requester = new common_internal.ApiRequester(client, rootUrl, servicePath
); | 32 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); |
| 28 } | 33 } |
| 29 | 34 |
| 30 | 35 |
| 31 /** Not documented yet. */ | |
| 32 class MailResourceApi { | 36 class MailResourceApi { |
| 33 final common_internal.ApiRequester _requester; | 37 final commons.ApiRequester _requester; |
| 34 | 38 |
| 35 MailResourceApi(common_internal.ApiRequester client) : | 39 MailResourceApi(commons.ApiRequester client) : |
| 36 _requester = client; | 40 _requester = client; |
| 37 | 41 |
| 38 /** | 42 /** |
| 39 * Insert Mail into Google's Gmail backends | 43 * Insert Mail into Google's Gmail backends |
| 40 * | 44 * |
| 41 * [request] - The metadata request object. | 45 * [request] - The metadata request object. |
| 42 * | 46 * |
| 43 * Request parameters: | 47 * Request parameters: |
| 44 * | 48 * |
| 45 * [userKey] - The email or immutable id of the user | 49 * [userKey] - The email or immutable id of the user |
| 46 * | 50 * |
| 47 * [uploadMedia] - The media to upload. | 51 * [uploadMedia] - The media to upload. |
| 48 * | 52 * |
| 49 * [uploadOptions] - Options for the media upload. Streaming Media without the | 53 * [uploadOptions] - Options for the media upload. Streaming Media without the |
| 50 * length being known ahead of time is only supported via resumable uploads. | 54 * length being known ahead of time is only supported via resumable uploads. |
| 51 * | 55 * |
| 52 * Completes with a [common.ApiRequestError] if the API endpoint returned an | 56 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 53 * error. | 57 * error. |
| 54 * | 58 * |
| 55 * If the used [http.Client] completes with an error when making a REST call, | 59 * If the used [http.Client] completes with an error when making a REST call, |
| 56 * this method will complete with the same error. | 60 * this method will complete with the same error. |
| 57 */ | 61 */ |
| 58 async.Future insert(MailItem request, core.String userKey, {common.UploadOptio
ns uploadOptions : common.UploadOptions.Default, common.Media uploadMedia}) { | 62 async.Future insert(MailItem request, core.String userKey, {commons.UploadOpti
ons uploadOptions : commons.UploadOptions.Default, commons.Media uploadMedia}) { |
| 59 var _url = null; | 63 var _url = null; |
| 60 var _queryParams = new core.Map(); | 64 var _queryParams = new core.Map(); |
| 61 var _uploadMedia = null; | 65 var _uploadMedia = null; |
| 62 var _uploadOptions = null; | 66 var _uploadOptions = null; |
| 63 var _downloadOptions = common.DownloadOptions.Metadata; | 67 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 64 var _body = null; | 68 var _body = null; |
| 65 | 69 |
| 66 if (request != null) { | 70 if (request != null) { |
| 67 _body = convert.JSON.encode((request).toJson()); | 71 _body = convert.JSON.encode((request).toJson()); |
| 68 } | 72 } |
| 69 if (userKey == null) { | 73 if (userKey == null) { |
| 70 throw new core.ArgumentError("Parameter userKey is required."); | 74 throw new core.ArgumentError("Parameter userKey is required."); |
| 71 } | 75 } |
| 72 | 76 |
| 73 _uploadMedia = uploadMedia; | 77 _uploadMedia = uploadMedia; |
| 74 _uploadOptions = uploadOptions; | 78 _uploadOptions = uploadOptions; |
| 75 _downloadOptions = null; | 79 _downloadOptions = null; |
| 76 | 80 |
| 77 if (_uploadMedia == null) { | 81 if (_uploadMedia == null) { |
| 78 _url = common_internal.Escaper.ecapeVariable('$userKey') + '/mail'; | 82 _url = commons.Escaper.ecapeVariable('$userKey') + '/mail'; |
| 79 } else if (_uploadOptions is common.ResumableUploadOptions) { | 83 } else if (_uploadOptions is commons.ResumableUploadOptions) { |
| 80 _url = '/resumable/upload/email/v2/users/' + common_internal.Escaper.ecape
Variable('$userKey') + '/mail'; | 84 _url = '/resumable/upload/email/v2/users/' + commons.Escaper.ecapeVariable
('$userKey') + '/mail'; |
| 81 } else { | 85 } else { |
| 82 _url = '/upload/email/v2/users/' + common_internal.Escaper.ecapeVariable('
$userKey') + '/mail'; | 86 _url = '/upload/email/v2/users/' + commons.Escaper.ecapeVariable('$userKey
') + '/mail'; |
| 83 } | 87 } |
| 84 | 88 |
| 85 | 89 |
| 86 var _response = _requester.request(_url, | 90 var _response = _requester.request(_url, |
| 87 "POST", | 91 "POST", |
| 88 body: _body, | 92 body: _body, |
| 89 queryParams: _queryParams, | 93 queryParams: _queryParams, |
| 90 uploadOptions: _uploadOptions, | 94 uploadOptions: _uploadOptions, |
| 91 uploadMedia: _uploadMedia, | 95 uploadMedia: _uploadMedia, |
| 92 downloadOptions: _downloadOptions); | 96 downloadOptions: _downloadOptions); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } | 188 } |
| 185 if (kind != null) { | 189 if (kind != null) { |
| 186 _json["kind"] = kind; | 190 _json["kind"] = kind; |
| 187 } | 191 } |
| 188 if (labels != null) { | 192 if (labels != null) { |
| 189 _json["labels"] = labels; | 193 _json["labels"] = labels; |
| 190 } | 194 } |
| 191 return _json; | 195 return _json; |
| 192 } | 196 } |
| 193 } | 197 } |
| 194 | |
| 195 | |
| OLD | NEW |