OLD | NEW |
(Empty) | |
| 1 library googleapis.groupsmigration.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 /** Groups Migration Api. */ |
| 17 class GroupsmigrationApi { |
| 18 |
| 19 final common_internal.ApiRequester _requester; |
| 20 |
| 21 ArchiveResourceApi get archive => new ArchiveResourceApi(_requester); |
| 22 |
| 23 GroupsmigrationApi(http.Client client) : |
| 24 _requester = new common_internal.ApiRequester(client, "https://www.googlea
pis.com/", "/groups/v1/groups/"); |
| 25 } |
| 26 |
| 27 |
| 28 /** Not documented yet. */ |
| 29 class ArchiveResourceApi { |
| 30 final common_internal.ApiRequester _requester; |
| 31 |
| 32 ArchiveResourceApi(common_internal.ApiRequester client) : |
| 33 _requester = client; |
| 34 |
| 35 /** |
| 36 * Inserts a new mail into the archive of the Google group. |
| 37 * |
| 38 * Request parameters: |
| 39 * |
| 40 * [groupId] - The group ID |
| 41 * |
| 42 * [uploadMedia] - The media to upload. |
| 43 * |
| 44 * [uploadOptions] - Options for the media upload. Streaming Media without the |
| 45 * length being known ahead of time is only supported via resumable uploads. |
| 46 * |
| 47 * Completes with a [Groups]. |
| 48 * |
| 49 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 50 * error. |
| 51 * |
| 52 * If the used [http.Client] completes with an error when making a REST call, |
| 53 * this method will complete with the same error. |
| 54 */ |
| 55 async.Future<Groups> insert(core.String groupId, {common.UploadOptions uploadO
ptions : common.UploadOptions.Default, common.Media uploadMedia}) { |
| 56 var _url = null; |
| 57 var _queryParams = new core.Map(); |
| 58 var _uploadMedia = null; |
| 59 var _uploadOptions = null; |
| 60 var _downloadOptions = common.DownloadOptions.Metadata; |
| 61 var _body = null; |
| 62 |
| 63 if (groupId == null) { |
| 64 throw new core.ArgumentError("Parameter groupId is required."); |
| 65 } |
| 66 |
| 67 _uploadMedia = uploadMedia; |
| 68 _uploadOptions = uploadOptions; |
| 69 |
| 70 if (_uploadMedia == null) { |
| 71 _url = common_internal.Escaper.ecapeVariable('$groupId') + '/archive'; |
| 72 } else if (_uploadOptions is common.ResumableUploadOptions) { |
| 73 _url = '/resumable/upload/groups/v1/groups/' + common_internal.Escaper.eca
peVariable('$groupId') + '/archive'; |
| 74 } else { |
| 75 _url = '/upload/groups/v1/groups/' + common_internal.Escaper.ecapeVariable
('$groupId') + '/archive'; |
| 76 } |
| 77 |
| 78 |
| 79 var _response = _requester.request(_url, |
| 80 "POST", |
| 81 body: _body, |
| 82 queryParams: _queryParams, |
| 83 uploadOptions: _uploadOptions, |
| 84 uploadMedia: _uploadMedia, |
| 85 downloadOptions: _downloadOptions); |
| 86 return _response.then((data) => new Groups.fromJson(data)); |
| 87 } |
| 88 |
| 89 } |
| 90 |
| 91 |
| 92 |
| 93 /** JSON response template for groups migration API. */ |
| 94 class Groups { |
| 95 /** The kind of insert resource this is. */ |
| 96 core.String kind; |
| 97 |
| 98 /** The status of the insert request. */ |
| 99 core.String responseCode; |
| 100 |
| 101 |
| 102 Groups(); |
| 103 |
| 104 Groups.fromJson(core.Map _json) { |
| 105 if (_json.containsKey("kind")) { |
| 106 kind = _json["kind"]; |
| 107 } |
| 108 if (_json.containsKey("responseCode")) { |
| 109 responseCode = _json["responseCode"]; |
| 110 } |
| 111 } |
| 112 |
| 113 core.Map toJson() { |
| 114 var _json = new core.Map(); |
| 115 if (kind != null) { |
| 116 _json["kind"] = kind; |
| 117 } |
| 118 if (responseCode != null) { |
| 119 _json["responseCode"] = responseCode; |
| 120 } |
| 121 return _json; |
| 122 } |
| 123 } |
| 124 |
| 125 |
OLD | NEW |