OLD | NEW |
1 // This is a generated file (see the discoveryapis_generator project). | 1 // This is a generated file (see the discoveryapis_generator project). |
2 | 2 |
3 library googleapis.groupsmigration.v1; | 3 library googleapis.groupsmigration.v1; |
4 | 4 |
5 import 'dart:core' as core; | 5 import 'dart:core' as core; |
6 import 'dart:async' as async; | 6 import 'dart:async' as async; |
7 import 'dart:convert' as convert; | 7 import 'dart:convert' as convert; |
8 | 8 |
9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; | 9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; |
10 import 'package:http/http.dart' as http; | 10 import 'package:http/http.dart' as http; |
11 | 11 |
12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show | 12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' |
13 ApiRequestError, DetailedApiRequestError, Media, UploadOptions, | 13 show |
14 ResumableUploadOptions, DownloadOptions, PartialDownloadOptions, | 14 ApiRequestError, |
15 ByteRange; | 15 DetailedApiRequestError, |
| 16 Media, |
| 17 UploadOptions, |
| 18 ResumableUploadOptions, |
| 19 DownloadOptions, |
| 20 PartialDownloadOptions, |
| 21 ByteRange; |
16 | 22 |
17 const core.String USER_AGENT = 'dart-api-client groupsmigration/v1'; | 23 const core.String USER_AGENT = 'dart-api-client groupsmigration/v1'; |
18 | 24 |
19 /** Groups Migration Api. */ | 25 /// Groups Migration Api. |
20 class GroupsmigrationApi { | 26 class GroupsmigrationApi { |
21 /** Manage messages in groups on your domain */ | 27 /// Manage messages in groups on your domain |
22 static const AppsGroupsMigrationScope = "https://www.googleapis.com/auth/apps.
groups.migration"; | 28 static const AppsGroupsMigrationScope = |
23 | 29 "https://www.googleapis.com/auth/apps.groups.migration"; |
24 | 30 |
25 final commons.ApiRequester _requester; | 31 final commons.ApiRequester _requester; |
26 | 32 |
27 ArchiveResourceApi get archive => new ArchiveResourceApi(_requester); | 33 ArchiveResourceApi get archive => new ArchiveResourceApi(_requester); |
28 | 34 |
29 GroupsmigrationApi(http.Client client, {core.String rootUrl: "https://www.goog
leapis.com/", core.String servicePath: "groups/v1/groups/"}) : | 35 GroupsmigrationApi(http.Client client, |
30 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); | 36 {core.String rootUrl: "https://www.googleapis.com/", |
| 37 core.String servicePath: "groups/v1/groups/"}) |
| 38 : _requester = |
| 39 new commons.ApiRequester(client, rootUrl, servicePath, USER_AGENT); |
31 } | 40 } |
32 | 41 |
33 | |
34 class ArchiveResourceApi { | 42 class ArchiveResourceApi { |
35 final commons.ApiRequester _requester; | 43 final commons.ApiRequester _requester; |
36 | 44 |
37 ArchiveResourceApi(commons.ApiRequester client) : | 45 ArchiveResourceApi(commons.ApiRequester client) : _requester = client; |
38 _requester = client; | |
39 | 46 |
40 /** | 47 /// Inserts a new mail into the archive of the Google group. |
41 * Inserts a new mail into the archive of the Google group. | 48 /// |
42 * | 49 /// Request parameters: |
43 * Request parameters: | 50 /// |
44 * | 51 /// [groupId] - The group ID |
45 * [groupId] - The group ID | 52 /// |
46 * | 53 /// [uploadMedia] - The media to upload. |
47 * [uploadMedia] - The media to upload. | 54 /// |
48 * | 55 /// [uploadOptions] - Options for the media upload. Streaming Media without |
49 * [uploadOptions] - Options for the media upload. Streaming Media without the | 56 /// the length being known ahead of time is only supported via resumable |
50 * length being known ahead of time is only supported via resumable uploads. | 57 /// uploads. |
51 * | 58 /// |
52 * Completes with a [Groups]. | 59 /// Completes with a [Groups]. |
53 * | 60 /// |
54 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 61 /// Completes with a [commons.ApiRequestError] if the API endpoint returned |
55 * error. | 62 /// an error. |
56 * | 63 /// |
57 * If the used [http.Client] completes with an error when making a REST call, | 64 /// If the used [http.Client] completes with an error when making a REST |
58 * this method will complete with the same error. | 65 /// call, this method will complete with the same error. |
59 */ | 66 async.Future<Groups> insert(core.String groupId, |
60 async.Future<Groups> insert(core.String groupId, {commons.UploadOptions upload
Options : commons.UploadOptions.Default, commons.Media uploadMedia}) { | 67 {commons.UploadOptions uploadOptions: commons.UploadOptions.Default, |
| 68 commons.Media uploadMedia}) { |
61 var _url = null; | 69 var _url = null; |
62 var _queryParams = new core.Map(); | 70 var _queryParams = new core.Map(); |
63 var _uploadMedia = null; | 71 var _uploadMedia = null; |
64 var _uploadOptions = null; | 72 var _uploadOptions = null; |
65 var _downloadOptions = commons.DownloadOptions.Metadata; | 73 var _downloadOptions = commons.DownloadOptions.Metadata; |
66 var _body = null; | 74 var _body = null; |
67 | 75 |
68 if (groupId == null) { | 76 if (groupId == null) { |
69 throw new core.ArgumentError("Parameter groupId is required."); | 77 throw new core.ArgumentError("Parameter groupId is required."); |
70 } | 78 } |
71 | 79 |
72 _uploadMedia = uploadMedia; | 80 _uploadMedia = uploadMedia; |
73 _uploadOptions = uploadOptions; | 81 _uploadOptions = uploadOptions; |
74 | 82 |
75 if (_uploadMedia == null) { | 83 if (_uploadMedia == null) { |
76 _url = commons.Escaper.ecapeVariable('$groupId') + '/archive'; | 84 _url = commons.Escaper.ecapeVariable('$groupId') + '/archive'; |
77 } else if (_uploadOptions is commons.ResumableUploadOptions) { | 85 } else if (_uploadOptions is commons.ResumableUploadOptions) { |
78 _url = '/resumable/upload/groups/v1/groups/' + commons.Escaper.ecapeVariab
le('$groupId') + '/archive'; | 86 _url = '/resumable/upload/groups/v1/groups/' + |
| 87 commons.Escaper.ecapeVariable('$groupId') + |
| 88 '/archive'; |
79 } else { | 89 } else { |
80 _url = '/upload/groups/v1/groups/' + commons.Escaper.ecapeVariable('$group
Id') + '/archive'; | 90 _url = '/upload/groups/v1/groups/' + |
| 91 commons.Escaper.ecapeVariable('$groupId') + |
| 92 '/archive'; |
81 } | 93 } |
82 | 94 |
83 | 95 var _response = _requester.request(_url, "POST", |
84 var _response = _requester.request(_url, | 96 body: _body, |
85 "POST", | 97 queryParams: _queryParams, |
86 body: _body, | 98 uploadOptions: _uploadOptions, |
87 queryParams: _queryParams, | 99 uploadMedia: _uploadMedia, |
88 uploadOptions: _uploadOptions, | 100 downloadOptions: _downloadOptions); |
89 uploadMedia: _uploadMedia, | |
90 downloadOptions: _downloadOptions); | |
91 return _response.then((data) => new Groups.fromJson(data)); | 101 return _response.then((data) => new Groups.fromJson(data)); |
92 } | 102 } |
93 | |
94 } | 103 } |
95 | 104 |
| 105 /// JSON response template for groups migration API. |
| 106 class Groups { |
| 107 /// The kind of insert resource this is. |
| 108 core.String kind; |
96 | 109 |
97 | 110 /// The status of the insert request. |
98 /** JSON response template for groups migration API. */ | |
99 class Groups { | |
100 /** The kind of insert resource this is. */ | |
101 core.String kind; | |
102 /** The status of the insert request. */ | |
103 core.String responseCode; | 111 core.String responseCode; |
104 | 112 |
105 Groups(); | 113 Groups(); |
106 | 114 |
107 Groups.fromJson(core.Map _json) { | 115 Groups.fromJson(core.Map _json) { |
108 if (_json.containsKey("kind")) { | 116 if (_json.containsKey("kind")) { |
109 kind = _json["kind"]; | 117 kind = _json["kind"]; |
110 } | 118 } |
111 if (_json.containsKey("responseCode")) { | 119 if (_json.containsKey("responseCode")) { |
112 responseCode = _json["responseCode"]; | 120 responseCode = _json["responseCode"]; |
113 } | 121 } |
114 } | 122 } |
115 | 123 |
116 core.Map<core.String, core.Object> toJson() { | 124 core.Map<core.String, core.Object> toJson() { |
117 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 125 final core.Map<core.String, core.Object> _json = |
| 126 new core.Map<core.String, core.Object>(); |
118 if (kind != null) { | 127 if (kind != null) { |
119 _json["kind"] = kind; | 128 _json["kind"] = kind; |
120 } | 129 } |
121 if (responseCode != null) { | 130 if (responseCode != null) { |
122 _json["responseCode"] = responseCode; | 131 _json["responseCode"] = responseCode; |
123 } | 132 } |
124 return _json; | 133 return _json; |
125 } | 134 } |
126 } | 135 } |
OLD | NEW |