| 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.translate.v2; | 3 library googleapis.translate.v2; |
| 4 | 4 |
| 5 import 'dart:core' as core; | 5 import 'dart:core' as core; |
| 6 import 'dart:collection' as collection; | 6 import 'dart:collection' as collection; |
| 7 import 'dart:async' as async; | 7 import 'dart:async' as async; |
| 8 import 'dart:convert' as convert; | 8 import 'dart:convert' as convert; |
| 9 | 9 |
| 10 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; | 10 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; |
| 11 import 'package:http/http.dart' as http; | 11 import 'package:http/http.dart' as http; |
| 12 | 12 |
| 13 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show | 13 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' |
| 14 ApiRequestError, DetailedApiRequestError; | 14 show ApiRequestError, DetailedApiRequestError; |
| 15 | 15 |
| 16 const core.String USER_AGENT = 'dart-api-client translate/v2'; | 16 const core.String USER_AGENT = 'dart-api-client translate/v2'; |
| 17 | 17 |
| 18 /** | 18 /// The Google Cloud Translation API lets websites and programs integrate with |
| 19 * The Google Cloud Translation API lets websites and programs integrate with | 19 /// Google Translate programmatically. |
| 20 * Google Translate programmatically. | |
| 21 */ | |
| 22 class TranslateApi { | 20 class TranslateApi { |
| 23 /** View and manage your data across Google Cloud Platform services */ | 21 /// View and manage your data across Google Cloud Platform services |
| 24 static const CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platf
orm"; | 22 static const CloudPlatformScope = |
| 23 "https://www.googleapis.com/auth/cloud-platform"; |
| 25 | 24 |
| 26 /** Translate text from one language to another using Google Translate */ | 25 /// Translate text from one language to another using Google Translate |
| 27 static const CloudTranslationScope = "https://www.googleapis.com/auth/cloud-tr
anslation"; | 26 static const CloudTranslationScope = |
| 28 | 27 "https://www.googleapis.com/auth/cloud-translation"; |
| 29 | 28 |
| 30 final commons.ApiRequester _requester; | 29 final commons.ApiRequester _requester; |
| 31 | 30 |
| 32 DetectionsResourceApi get detections => new DetectionsResourceApi(_requester); | 31 DetectionsResourceApi get detections => new DetectionsResourceApi(_requester); |
| 33 LanguagesResourceApi get languages => new LanguagesResourceApi(_requester); | 32 LanguagesResourceApi get languages => new LanguagesResourceApi(_requester); |
| 34 TranslationsResourceApi get translations => new TranslationsResourceApi(_reque
ster); | 33 TranslationsResourceApi get translations => |
| 34 new TranslationsResourceApi(_requester); |
| 35 | 35 |
| 36 TranslateApi(http.Client client, {core.String rootUrl: "https://translation.go
ogleapis.com/", core.String servicePath: "language/translate/"}) : | 36 TranslateApi(http.Client client, |
| 37 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); | 37 {core.String rootUrl: "https://translation.googleapis.com/", |
| 38 core.String servicePath: "language/translate/"}) |
| 39 : _requester = |
| 40 new commons.ApiRequester(client, rootUrl, servicePath, USER_AGENT); |
| 38 } | 41 } |
| 39 | 42 |
| 40 | |
| 41 class DetectionsResourceApi { | 43 class DetectionsResourceApi { |
| 42 final commons.ApiRequester _requester; | 44 final commons.ApiRequester _requester; |
| 43 | 45 |
| 44 DetectionsResourceApi(commons.ApiRequester client) : | 46 DetectionsResourceApi(commons.ApiRequester client) : _requester = client; |
| 45 _requester = client; | |
| 46 | 47 |
| 47 /** | 48 /// Detects the language of text within a request. |
| 48 * Detects the language of text within a request. | 49 /// |
| 49 * | 50 /// [request] - The metadata request object. |
| 50 * [request] - The metadata request object. | 51 /// |
| 51 * | 52 /// Request parameters: |
| 52 * Request parameters: | 53 /// |
| 53 * | 54 /// Completes with a [DetectionsListResponse]. |
| 54 * Completes with a [DetectionsListResponse]. | 55 /// |
| 55 * | 56 /// Completes with a [commons.ApiRequestError] if the API endpoint returned |
| 56 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 57 /// an error. |
| 57 * error. | 58 /// |
| 58 * | 59 /// If the used [http.Client] completes with an error when making a REST |
| 59 * If the used [http.Client] completes with an error when making a REST call, | 60 /// call, this method will complete with the same error. |
| 60 * this method will complete with the same error. | |
| 61 */ | |
| 62 async.Future<DetectionsListResponse> detect(DetectLanguageRequest request) { | 61 async.Future<DetectionsListResponse> detect(DetectLanguageRequest request) { |
| 63 var _url = null; | 62 var _url = null; |
| 64 var _queryParams = new core.Map(); | 63 var _queryParams = new core.Map(); |
| 65 var _uploadMedia = null; | 64 var _uploadMedia = null; |
| 66 var _uploadOptions = null; | 65 var _uploadOptions = null; |
| 67 var _downloadOptions = commons.DownloadOptions.Metadata; | 66 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 68 var _body = null; | 67 var _body = null; |
| 69 | 68 |
| 70 if (request != null) { | 69 if (request != null) { |
| 71 _body = convert.JSON.encode((request).toJson()); | 70 _body = convert.JSON.encode((request).toJson()); |
| 72 } | 71 } |
| 73 | 72 |
| 74 _url = 'v2/detect'; | 73 _url = 'v2/detect'; |
| 75 | 74 |
| 76 var _response = _requester.request(_url, | 75 var _response = _requester.request(_url, "POST", |
| 77 "POST", | 76 body: _body, |
| 78 body: _body, | 77 queryParams: _queryParams, |
| 79 queryParams: _queryParams, | 78 uploadOptions: _uploadOptions, |
| 80 uploadOptions: _uploadOptions, | 79 uploadMedia: _uploadMedia, |
| 81 uploadMedia: _uploadMedia, | 80 downloadOptions: _downloadOptions); |
| 82 downloadOptions: _downloadOptions); | |
| 83 return _response.then((data) => new DetectionsListResponse.fromJson(data)); | 81 return _response.then((data) => new DetectionsListResponse.fromJson(data)); |
| 84 } | 82 } |
| 85 | 83 |
| 86 /** | 84 /// Detects the language of text within a request. |
| 87 * Detects the language of text within a request. | 85 /// |
| 88 * | 86 /// Request parameters: |
| 89 * Request parameters: | 87 /// |
| 90 * | 88 /// [q] - The input text upon which to perform language detection. Repeat |
| 91 * [q] - The input text upon which to perform language detection. Repeat this | 89 /// this |
| 92 * parameter to perform language detection on multiple text inputs. | 90 /// parameter to perform language detection on multiple text inputs. |
| 93 * | 91 /// |
| 94 * Completes with a [DetectionsListResponse]. | 92 /// Completes with a [DetectionsListResponse]. |
| 95 * | 93 /// |
| 96 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 94 /// Completes with a [commons.ApiRequestError] if the API endpoint returned |
| 97 * error. | 95 /// an error. |
| 98 * | 96 /// |
| 99 * If the used [http.Client] completes with an error when making a REST call, | 97 /// If the used [http.Client] completes with an error when making a REST |
| 100 * this method will complete with the same error. | 98 /// call, this method will complete with the same error. |
| 101 */ | |
| 102 async.Future<DetectionsListResponse> list(core.List<core.String> q) { | 99 async.Future<DetectionsListResponse> list(core.List<core.String> q) { |
| 103 var _url = null; | 100 var _url = null; |
| 104 var _queryParams = new core.Map(); | 101 var _queryParams = new core.Map(); |
| 105 var _uploadMedia = null; | 102 var _uploadMedia = null; |
| 106 var _uploadOptions = null; | 103 var _uploadOptions = null; |
| 107 var _downloadOptions = commons.DownloadOptions.Metadata; | 104 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 108 var _body = null; | 105 var _body = null; |
| 109 | 106 |
| 110 if (q == null || q.isEmpty) { | 107 if (q == null || q.isEmpty) { |
| 111 throw new core.ArgumentError("Parameter q is required."); | 108 throw new core.ArgumentError("Parameter q is required."); |
| 112 } | 109 } |
| 113 _queryParams["q"] = q; | 110 _queryParams["q"] = q; |
| 114 | 111 |
| 115 _url = 'v2/detect'; | 112 _url = 'v2/detect'; |
| 116 | 113 |
| 117 var _response = _requester.request(_url, | 114 var _response = _requester.request(_url, "GET", |
| 118 "GET", | 115 body: _body, |
| 119 body: _body, | 116 queryParams: _queryParams, |
| 120 queryParams: _queryParams, | 117 uploadOptions: _uploadOptions, |
| 121 uploadOptions: _uploadOptions, | 118 uploadMedia: _uploadMedia, |
| 122 uploadMedia: _uploadMedia, | 119 downloadOptions: _downloadOptions); |
| 123 downloadOptions: _downloadOptions); | |
| 124 return _response.then((data) => new DetectionsListResponse.fromJson(data)); | 120 return _response.then((data) => new DetectionsListResponse.fromJson(data)); |
| 125 } | 121 } |
| 126 | |
| 127 } | 122 } |
| 128 | 123 |
| 129 | |
| 130 class LanguagesResourceApi { | 124 class LanguagesResourceApi { |
| 131 final commons.ApiRequester _requester; | 125 final commons.ApiRequester _requester; |
| 132 | 126 |
| 133 LanguagesResourceApi(commons.ApiRequester client) : | 127 LanguagesResourceApi(commons.ApiRequester client) : _requester = client; |
| 134 _requester = client; | |
| 135 | 128 |
| 136 /** | 129 /// Returns a list of supported languages for translation. |
| 137 * Returns a list of supported languages for translation. | 130 /// |
| 138 * | 131 /// Request parameters: |
| 139 * Request parameters: | 132 /// |
| 140 * | 133 /// [target] - The language to use to return localized, human readable names |
| 141 * [target] - The language to use to return localized, human readable names of | 134 /// of supported |
| 142 * supported | 135 /// languages. |
| 143 * languages. | 136 /// |
| 144 * | 137 /// [model] - The model type for which supported languages should be |
| 145 * [model] - The model type for which supported languages should be returned. | 138 /// returned. |
| 146 * | 139 /// |
| 147 * Completes with a [LanguagesListResponse]. | 140 /// Completes with a [LanguagesListResponse]. |
| 148 * | 141 /// |
| 149 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 142 /// Completes with a [commons.ApiRequestError] if the API endpoint returned |
| 150 * error. | 143 /// an error. |
| 151 * | 144 /// |
| 152 * If the used [http.Client] completes with an error when making a REST call, | 145 /// If the used [http.Client] completes with an error when making a REST |
| 153 * this method will complete with the same error. | 146 /// call, this method will complete with the same error. |
| 154 */ | 147 async.Future<LanguagesListResponse> list( |
| 155 async.Future<LanguagesListResponse> list({core.String target, core.String mode
l}) { | 148 {core.String target, core.String model}) { |
| 156 var _url = null; | 149 var _url = null; |
| 157 var _queryParams = new core.Map(); | 150 var _queryParams = new core.Map(); |
| 158 var _uploadMedia = null; | 151 var _uploadMedia = null; |
| 159 var _uploadOptions = null; | 152 var _uploadOptions = null; |
| 160 var _downloadOptions = commons.DownloadOptions.Metadata; | 153 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 161 var _body = null; | 154 var _body = null; |
| 162 | 155 |
| 163 if (target != null) { | 156 if (target != null) { |
| 164 _queryParams["target"] = [target]; | 157 _queryParams["target"] = [target]; |
| 165 } | 158 } |
| 166 if (model != null) { | 159 if (model != null) { |
| 167 _queryParams["model"] = [model]; | 160 _queryParams["model"] = [model]; |
| 168 } | 161 } |
| 169 | 162 |
| 170 _url = 'v2/languages'; | 163 _url = 'v2/languages'; |
| 171 | 164 |
| 172 var _response = _requester.request(_url, | 165 var _response = _requester.request(_url, "GET", |
| 173 "GET", | 166 body: _body, |
| 174 body: _body, | 167 queryParams: _queryParams, |
| 175 queryParams: _queryParams, | 168 uploadOptions: _uploadOptions, |
| 176 uploadOptions: _uploadOptions, | 169 uploadMedia: _uploadMedia, |
| 177 uploadMedia: _uploadMedia, | 170 downloadOptions: _downloadOptions); |
| 178 downloadOptions: _downloadOptions); | |
| 179 return _response.then((data) => new LanguagesListResponse.fromJson(data)); | 171 return _response.then((data) => new LanguagesListResponse.fromJson(data)); |
| 180 } | 172 } |
| 181 | |
| 182 } | 173 } |
| 183 | 174 |
| 184 | |
| 185 class TranslationsResourceApi { | 175 class TranslationsResourceApi { |
| 186 final commons.ApiRequester _requester; | 176 final commons.ApiRequester _requester; |
| 187 | 177 |
| 188 TranslationsResourceApi(commons.ApiRequester client) : | 178 TranslationsResourceApi(commons.ApiRequester client) : _requester = client; |
| 189 _requester = client; | |
| 190 | 179 |
| 191 /** | 180 /// Translates input text, returning translated text. |
| 192 * Translates input text, returning translated text. | 181 /// |
| 193 * | 182 /// Request parameters: |
| 194 * Request parameters: | 183 /// |
| 195 * | 184 /// [q] - The input text to translate. Repeat this parameter to perform |
| 196 * [q] - The input text to translate. Repeat this parameter to perform | 185 /// translation |
| 197 * translation | 186 /// operations on multiple text inputs. |
| 198 * operations on multiple text inputs. | 187 /// |
| 199 * | 188 /// [target] - The language to use for translation of the input text, set to |
| 200 * [target] - The language to use for translation of the input text, set to | 189 /// one of the |
| 201 * one of the | 190 /// language codes listed in Language Support. |
| 202 * language codes listed in Language Support. | 191 /// |
| 203 * | 192 /// [cid] - The customization id for translate |
| 204 * [source] - The language of the source text, set to one of the language | 193 /// |
| 205 * codes listed in | 194 /// [format] - The format of the source text, in either HTML (default) or |
| 206 * Language Support. If the source language is not specified, the API will | 195 /// plain-text. A |
| 207 * attempt to identify the source language automatically and return it within | 196 /// value of "html" indicates HTML and a value of "text" indicates |
| 208 * the response. | 197 /// plain-text. |
| 209 * | 198 /// Possible string values are: |
| 210 * [cid] - The customization id for translate | 199 /// - "html" : Specifies the input is in HTML |
| 211 * | 200 /// - "text" : Specifies the input is in plain textual format |
| 212 * [format] - The format of the source text, in either HTML (default) or | 201 /// |
| 213 * plain-text. A | 202 /// [model] - The `model` type requested for this translation. Valid values |
| 214 * value of "html" indicates HTML and a value of "text" indicates plain-text. | 203 /// are |
| 215 * Possible string values are: | 204 /// listed in public documentation. |
| 216 * - "html" : Specifies the input is in HTML | 205 /// |
| 217 * - "text" : Specifies the input is in plain textual format | 206 /// [source] - The language of the source text, set to one of the language |
| 218 * | 207 /// codes listed in |
| 219 * [model] - The `model` type requested for this translation. Valid values are | 208 /// Language Support. If the source language is not specified, the API will |
| 220 * listed in public documentation. | 209 /// attempt to identify the source language automatically and return it |
| 221 * | 210 /// within |
| 222 * Completes with a [TranslationsListResponse]. | 211 /// the response. |
| 223 * | 212 /// |
| 224 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 213 /// Completes with a [TranslationsListResponse]. |
| 225 * error. | 214 /// |
| 226 * | 215 /// Completes with a [commons.ApiRequestError] if the API endpoint returned |
| 227 * If the used [http.Client] completes with an error when making a REST call, | 216 /// an error. |
| 228 * this method will complete with the same error. | 217 /// |
| 229 */ | 218 /// If the used [http.Client] completes with an error when making a REST |
| 230 async.Future<TranslationsListResponse> list(core.List<core.String> q, core.Str
ing target, {core.String source, core.List<core.String> cid, core.String format,
core.String model}) { | 219 /// call, this method will complete with the same error. |
| 220 async.Future<TranslationsListResponse> list( |
| 221 core.List<core.String> q, core.String target, |
| 222 {core.List<core.String> cid, |
| 223 core.String format, |
| 224 core.String model, |
| 225 core.String source}) { |
| 231 var _url = null; | 226 var _url = null; |
| 232 var _queryParams = new core.Map(); | 227 var _queryParams = new core.Map(); |
| 233 var _uploadMedia = null; | 228 var _uploadMedia = null; |
| 234 var _uploadOptions = null; | 229 var _uploadOptions = null; |
| 235 var _downloadOptions = commons.DownloadOptions.Metadata; | 230 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 236 var _body = null; | 231 var _body = null; |
| 237 | 232 |
| 238 if (q == null || q.isEmpty) { | 233 if (q == null || q.isEmpty) { |
| 239 throw new core.ArgumentError("Parameter q is required."); | 234 throw new core.ArgumentError("Parameter q is required."); |
| 240 } | 235 } |
| 241 _queryParams["q"] = q; | 236 _queryParams["q"] = q; |
| 242 if (target == null) { | 237 if (target == null) { |
| 243 throw new core.ArgumentError("Parameter target is required."); | 238 throw new core.ArgumentError("Parameter target is required."); |
| 244 } | 239 } |
| 245 _queryParams["target"] = [target]; | 240 _queryParams["target"] = [target]; |
| 246 if (source != null) { | |
| 247 _queryParams["source"] = [source]; | |
| 248 } | |
| 249 if (cid != null) { | 241 if (cid != null) { |
| 250 _queryParams["cid"] = cid; | 242 _queryParams["cid"] = cid; |
| 251 } | 243 } |
| 252 if (format != null) { | 244 if (format != null) { |
| 253 _queryParams["format"] = [format]; | 245 _queryParams["format"] = [format]; |
| 254 } | 246 } |
| 255 if (model != null) { | 247 if (model != null) { |
| 256 _queryParams["model"] = [model]; | 248 _queryParams["model"] = [model]; |
| 257 } | 249 } |
| 250 if (source != null) { |
| 251 _queryParams["source"] = [source]; |
| 252 } |
| 258 | 253 |
| 259 _url = 'v2'; | 254 _url = 'v2'; |
| 260 | 255 |
| 261 var _response = _requester.request(_url, | 256 var _response = _requester.request(_url, "GET", |
| 262 "GET", | 257 body: _body, |
| 263 body: _body, | 258 queryParams: _queryParams, |
| 264 queryParams: _queryParams, | 259 uploadOptions: _uploadOptions, |
| 265 uploadOptions: _uploadOptions, | 260 uploadMedia: _uploadMedia, |
| 266 uploadMedia: _uploadMedia, | 261 downloadOptions: _downloadOptions); |
| 267 downloadOptions: _downloadOptions); | 262 return _response |
| 268 return _response.then((data) => new TranslationsListResponse.fromJson(data))
; | 263 .then((data) => new TranslationsListResponse.fromJson(data)); |
| 269 } | 264 } |
| 270 | 265 |
| 271 /** | 266 /// Translates input text, returning translated text. |
| 272 * Translates input text, returning translated text. | 267 /// |
| 273 * | 268 /// [request] - The metadata request object. |
| 274 * [request] - The metadata request object. | 269 /// |
| 275 * | 270 /// Request parameters: |
| 276 * Request parameters: | 271 /// |
| 277 * | 272 /// Completes with a [TranslationsListResponse]. |
| 278 * Completes with a [TranslationsListResponse]. | 273 /// |
| 279 * | 274 /// Completes with a [commons.ApiRequestError] if the API endpoint returned |
| 280 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 275 /// an error. |
| 281 * error. | 276 /// |
| 282 * | 277 /// If the used [http.Client] completes with an error when making a REST |
| 283 * If the used [http.Client] completes with an error when making a REST call, | 278 /// call, this method will complete with the same error. |
| 284 * this method will complete with the same error. | 279 async.Future<TranslationsListResponse> translate( |
| 285 */ | 280 TranslateTextRequest request) { |
| 286 async.Future<TranslationsListResponse> translate(TranslateTextRequest request)
{ | |
| 287 var _url = null; | 281 var _url = null; |
| 288 var _queryParams = new core.Map(); | 282 var _queryParams = new core.Map(); |
| 289 var _uploadMedia = null; | 283 var _uploadMedia = null; |
| 290 var _uploadOptions = null; | 284 var _uploadOptions = null; |
| 291 var _downloadOptions = commons.DownloadOptions.Metadata; | 285 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 292 var _body = null; | 286 var _body = null; |
| 293 | 287 |
| 294 if (request != null) { | 288 if (request != null) { |
| 295 _body = convert.JSON.encode((request).toJson()); | 289 _body = convert.JSON.encode((request).toJson()); |
| 296 } | 290 } |
| 297 | 291 |
| 298 _url = 'v2'; | 292 _url = 'v2'; |
| 299 | 293 |
| 300 var _response = _requester.request(_url, | 294 var _response = _requester.request(_url, "POST", |
| 301 "POST", | 295 body: _body, |
| 302 body: _body, | 296 queryParams: _queryParams, |
| 303 queryParams: _queryParams, | 297 uploadOptions: _uploadOptions, |
| 304 uploadOptions: _uploadOptions, | 298 uploadMedia: _uploadMedia, |
| 305 uploadMedia: _uploadMedia, | 299 downloadOptions: _downloadOptions); |
| 306 downloadOptions: _downloadOptions); | 300 return _response |
| 307 return _response.then((data) => new TranslationsListResponse.fromJson(data))
; | 301 .then((data) => new TranslationsListResponse.fromJson(data)); |
| 308 } | 302 } |
| 309 | |
| 310 } | 303 } |
| 311 | 304 |
| 312 | 305 /// The request message for language detection. |
| 313 | |
| 314 /** The request message for language detection. */ | |
| 315 class DetectLanguageRequest { | 306 class DetectLanguageRequest { |
| 316 /** | 307 /// The input text upon which to perform language detection. Repeat this |
| 317 * The input text upon which to perform language detection. Repeat this | 308 /// parameter to perform language detection on multiple text inputs. |
| 318 * parameter to perform language detection on multiple text inputs. | |
| 319 */ | |
| 320 core.List<core.String> q; | 309 core.List<core.String> q; |
| 321 | 310 |
| 322 DetectLanguageRequest(); | 311 DetectLanguageRequest(); |
| 323 | 312 |
| 324 DetectLanguageRequest.fromJson(core.Map _json) { | 313 DetectLanguageRequest.fromJson(core.Map _json) { |
| 325 if (_json.containsKey("q")) { | 314 if (_json.containsKey("q")) { |
| 326 q = _json["q"]; | 315 q = _json["q"]; |
| 327 } | 316 } |
| 328 } | 317 } |
| 329 | 318 |
| 330 core.Map<core.String, core.Object> toJson() { | 319 core.Map<core.String, core.Object> toJson() { |
| 331 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 320 final core.Map<core.String, core.Object> _json = |
| 321 new core.Map<core.String, core.Object>(); |
| 332 if (q != null) { | 322 if (q != null) { |
| 333 _json["q"] = q; | 323 _json["q"] = q; |
| 334 } | 324 } |
| 335 return _json; | 325 return _json; |
| 336 } | 326 } |
| 337 } | 327 } |
| 338 | 328 |
| 339 class DetectionsListResponse { | 329 class DetectionsListResponse { |
| 340 /** A detections contains detection results of several text */ | 330 /// A detections contains detection results of several text |
| 341 core.List<DetectionsResource> detections; | 331 core.List<DetectionsResource> detections; |
| 342 | 332 |
| 343 DetectionsListResponse(); | 333 DetectionsListResponse(); |
| 344 | 334 |
| 345 DetectionsListResponse.fromJson(core.Map _json) { | 335 DetectionsListResponse.fromJson(core.Map _json) { |
| 346 if (_json.containsKey("detections")) { | 336 if (_json.containsKey("detections")) { |
| 347 detections = _json["detections"].map((value) => new DetectionsResource.fro
mJson(value)).toList(); | 337 detections = _json["detections"] |
| 338 .map((value) => new DetectionsResource.fromJson(value)) |
| 339 .toList(); |
| 348 } | 340 } |
| 349 } | 341 } |
| 350 | 342 |
| 351 core.Map<core.String, core.Object> toJson() { | 343 core.Map<core.String, core.Object> toJson() { |
| 352 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 344 final core.Map<core.String, core.Object> _json = |
| 345 new core.Map<core.String, core.Object>(); |
| 353 if (detections != null) { | 346 if (detections != null) { |
| 354 _json["detections"] = detections.map((value) => (value).toJson()).toList()
; | 347 _json["detections"] = |
| 348 detections.map((value) => (value).toJson()).toList(); |
| 355 } | 349 } |
| 356 return _json; | 350 return _json; |
| 357 } | 351 } |
| 358 } | 352 } |
| 359 | 353 |
| 360 class DetectionsResourceElement { | 354 class DetectionsResourceElement { |
| 361 /** The confidence of the detection result of this language. */ | 355 /// The confidence of the detection result of this language. |
| 362 core.double confidence; | 356 core.double confidence; |
| 363 /** A boolean to indicate is the language detection result reliable. */ | 357 |
| 358 /// A boolean to indicate is the language detection result reliable. |
| 364 core.bool isReliable; | 359 core.bool isReliable; |
| 365 /** The language we detected. */ | 360 |
| 361 /// The language we detected. |
| 366 core.String language; | 362 core.String language; |
| 367 | 363 |
| 368 DetectionsResourceElement(); | 364 DetectionsResourceElement(); |
| 369 | 365 |
| 370 DetectionsResourceElement.fromJson(core.Map _json) { | 366 DetectionsResourceElement.fromJson(core.Map _json) { |
| 371 if (_json.containsKey("confidence")) { | 367 if (_json.containsKey("confidence")) { |
| 372 confidence = _json["confidence"]; | 368 confidence = _json["confidence"]; |
| 373 } | 369 } |
| 374 if (_json.containsKey("isReliable")) { | 370 if (_json.containsKey("isReliable")) { |
| 375 isReliable = _json["isReliable"]; | 371 isReliable = _json["isReliable"]; |
| 376 } | 372 } |
| 377 if (_json.containsKey("language")) { | 373 if (_json.containsKey("language")) { |
| 378 language = _json["language"]; | 374 language = _json["language"]; |
| 379 } | 375 } |
| 380 } | 376 } |
| 381 | 377 |
| 382 core.Map<core.String, core.Object> toJson() { | 378 core.Map<core.String, core.Object> toJson() { |
| 383 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 379 final core.Map<core.String, core.Object> _json = |
| 380 new core.Map<core.String, core.Object>(); |
| 384 if (confidence != null) { | 381 if (confidence != null) { |
| 385 _json["confidence"] = confidence; | 382 _json["confidence"] = confidence; |
| 386 } | 383 } |
| 387 if (isReliable != null) { | 384 if (isReliable != null) { |
| 388 _json["isReliable"] = isReliable; | 385 _json["isReliable"] = isReliable; |
| 389 } | 386 } |
| 390 if (language != null) { | 387 if (language != null) { |
| 391 _json["language"] = language; | 388 _json["language"] = language; |
| 392 } | 389 } |
| 393 return _json; | 390 return _json; |
| 394 } | 391 } |
| 395 } | 392 } |
| 396 | 393 |
| 397 /** | 394 /// An array of languages which we detect for the given text The most likely |
| 398 * An array of languages which we detect for the given text The most likely | 395 /// language list first. |
| 399 * language list first. | |
| 400 */ | |
| 401 class DetectionsResource | 396 class DetectionsResource |
| 402 extends collection.ListBase<DetectionsResourceElement> { | 397 extends collection.ListBase<DetectionsResourceElement> { |
| 403 final core.List<DetectionsResourceElement> _inner; | 398 final core.List<DetectionsResourceElement> _inner; |
| 404 | 399 |
| 405 DetectionsResource() : _inner = []; | 400 DetectionsResource() : _inner = []; |
| 406 | 401 |
| 407 DetectionsResource.fromJson(core.List json) | 402 DetectionsResource.fromJson(core.List json) |
| 408 : _inner = json.map((value) => new DetectionsResourceElement.fromJson(valu
e)).toList(); | 403 : _inner = json |
| 404 .map((value) => new DetectionsResourceElement.fromJson(value)) |
| 405 .toList(); |
| 409 | 406 |
| 410 core.List<core.Map<core.String, core.Object>> toJson() { | 407 core.List<core.Map<core.String, core.Object>> toJson() { |
| 411 return _inner.map((value) => (value).toJson()).toList(); | 408 return _inner.map((value) => (value).toJson()).toList(); |
| 412 } | 409 } |
| 413 | 410 |
| 414 DetectionsResourceElement operator [](core.int key) => _inner[key]; | 411 DetectionsResourceElement operator [](core.int key) => _inner[key]; |
| 415 | 412 |
| 416 void operator []=(core.int key, DetectionsResourceElement value) { | 413 void operator []=(core.int key, DetectionsResourceElement value) { |
| 417 _inner[key] = value; | 414 _inner[key] = value; |
| 418 } | 415 } |
| 419 | 416 |
| 420 core.int get length => _inner.length; | 417 core.int get length => _inner.length; |
| 421 | 418 |
| 422 void set length(core.int newLength) { | 419 void set length(core.int newLength) { |
| 423 _inner.length = newLength; | 420 _inner.length = newLength; |
| 424 } | 421 } |
| 425 } | 422 } |
| 426 | 423 |
| 427 /** The request message for discovering supported languages. */ | 424 /// The request message for discovering supported languages. |
| 428 class GetSupportedLanguagesRequest { | 425 class GetSupportedLanguagesRequest { |
| 429 /** | 426 /// The language to use to return localized, human readable names of |
| 430 * The language to use to return localized, human readable names of supported | 427 /// supported |
| 431 * languages. | 428 /// languages. |
| 432 */ | |
| 433 core.String target; | 429 core.String target; |
| 434 | 430 |
| 435 GetSupportedLanguagesRequest(); | 431 GetSupportedLanguagesRequest(); |
| 436 | 432 |
| 437 GetSupportedLanguagesRequest.fromJson(core.Map _json) { | 433 GetSupportedLanguagesRequest.fromJson(core.Map _json) { |
| 438 if (_json.containsKey("target")) { | 434 if (_json.containsKey("target")) { |
| 439 target = _json["target"]; | 435 target = _json["target"]; |
| 440 } | 436 } |
| 441 } | 437 } |
| 442 | 438 |
| 443 core.Map<core.String, core.Object> toJson() { | 439 core.Map<core.String, core.Object> toJson() { |
| 444 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 440 final core.Map<core.String, core.Object> _json = |
| 441 new core.Map<core.String, core.Object>(); |
| 445 if (target != null) { | 442 if (target != null) { |
| 446 _json["target"] = target; | 443 _json["target"] = target; |
| 447 } | 444 } |
| 448 return _json; | 445 return _json; |
| 449 } | 446 } |
| 450 } | 447 } |
| 451 | 448 |
| 452 class LanguagesListResponse { | 449 class LanguagesListResponse { |
| 453 /** | 450 /// List of source/target languages supported by the translation API. If |
| 454 * List of source/target languages supported by the translation API. If target | 451 /// target parameter is unspecified, the list is sorted by the ASCII code |
| 455 * parameter is unspecified, the list is sorted by the ASCII code point order | 452 /// point order of the language code. If target parameter is specified, the |
| 456 * of the language code. If target parameter is specified, the list is sorted | 453 /// list is sorted by the collation order of the language name in the target |
| 457 * by the collation order of the language name in the target language. | 454 /// language. |
| 458 */ | |
| 459 core.List<LanguagesResource> languages; | 455 core.List<LanguagesResource> languages; |
| 460 | 456 |
| 461 LanguagesListResponse(); | 457 LanguagesListResponse(); |
| 462 | 458 |
| 463 LanguagesListResponse.fromJson(core.Map _json) { | 459 LanguagesListResponse.fromJson(core.Map _json) { |
| 464 if (_json.containsKey("languages")) { | 460 if (_json.containsKey("languages")) { |
| 465 languages = _json["languages"].map((value) => new LanguagesResource.fromJs
on(value)).toList(); | 461 languages = _json["languages"] |
| 462 .map((value) => new LanguagesResource.fromJson(value)) |
| 463 .toList(); |
| 466 } | 464 } |
| 467 } | 465 } |
| 468 | 466 |
| 469 core.Map<core.String, core.Object> toJson() { | 467 core.Map<core.String, core.Object> toJson() { |
| 470 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 468 final core.Map<core.String, core.Object> _json = |
| 469 new core.Map<core.String, core.Object>(); |
| 471 if (languages != null) { | 470 if (languages != null) { |
| 472 _json["languages"] = languages.map((value) => (value).toJson()).toList(); | 471 _json["languages"] = languages.map((value) => (value).toJson()).toList(); |
| 473 } | 472 } |
| 474 return _json; | 473 return _json; |
| 475 } | 474 } |
| 476 } | 475 } |
| 477 | 476 |
| 478 class LanguagesResource { | 477 class LanguagesResource { |
| 479 /** | 478 /// Supported language code, generally consisting of its ISO 639-1 |
| 480 * Supported language code, generally consisting of its ISO 639-1 | 479 /// identifier. (E.g. 'en', 'ja'). In certain cases, BCP-47 codes including |
| 481 * identifier. (E.g. 'en', 'ja'). In certain cases, BCP-47 codes including | 480 /// language + region identifiers are returned (e.g. 'zh-TW' and 'zh-CH') |
| 482 * language + region identifiers are returned (e.g. 'zh-TW' and 'zh-CH') | |
| 483 */ | |
| 484 core.String language; | 481 core.String language; |
| 485 /** Human readable name of the language localized to the target language. */ | 482 |
| 483 /// Human readable name of the language localized to the target language. |
| 486 core.String name; | 484 core.String name; |
| 487 | 485 |
| 488 LanguagesResource(); | 486 LanguagesResource(); |
| 489 | 487 |
| 490 LanguagesResource.fromJson(core.Map _json) { | 488 LanguagesResource.fromJson(core.Map _json) { |
| 491 if (_json.containsKey("language")) { | 489 if (_json.containsKey("language")) { |
| 492 language = _json["language"]; | 490 language = _json["language"]; |
| 493 } | 491 } |
| 494 if (_json.containsKey("name")) { | 492 if (_json.containsKey("name")) { |
| 495 name = _json["name"]; | 493 name = _json["name"]; |
| 496 } | 494 } |
| 497 } | 495 } |
| 498 | 496 |
| 499 core.Map<core.String, core.Object> toJson() { | 497 core.Map<core.String, core.Object> toJson() { |
| 500 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 498 final core.Map<core.String, core.Object> _json = |
| 499 new core.Map<core.String, core.Object>(); |
| 501 if (language != null) { | 500 if (language != null) { |
| 502 _json["language"] = language; | 501 _json["language"] = language; |
| 503 } | 502 } |
| 504 if (name != null) { | 503 if (name != null) { |
| 505 _json["name"] = name; | 504 _json["name"] = name; |
| 506 } | 505 } |
| 507 return _json; | 506 return _json; |
| 508 } | 507 } |
| 509 } | 508 } |
| 510 | 509 |
| 511 /** The main translation request message for the Cloud Translation API. */ | 510 /// The main translation request message for the Cloud Translation API. |
| 512 class TranslateTextRequest { | 511 class TranslateTextRequest { |
| 513 /** | 512 /// The format of the source text, in either HTML (default) or plain-text. A |
| 514 * The format of the source text, in either HTML (default) or plain-text. A | 513 /// value of "html" indicates HTML and a value of "text" indicates |
| 515 * value of "html" indicates HTML and a value of "text" indicates plain-text. | 514 /// plain-text. |
| 516 */ | |
| 517 core.String format; | 515 core.String format; |
| 518 /** | 516 |
| 519 * The `model` type requested for this translation. Valid values are | 517 /// The `model` type requested for this translation. Valid values are |
| 520 * listed in public documentation. | 518 /// listed in public documentation. |
| 521 */ | |
| 522 core.String model; | 519 core.String model; |
| 523 /** | 520 |
| 524 * The input text to translate. Repeat this parameter to perform translation | 521 /// The input text to translate. Repeat this parameter to perform translation |
| 525 * operations on multiple text inputs. | 522 /// operations on multiple text inputs. |
| 526 */ | |
| 527 core.List<core.String> q; | 523 core.List<core.String> q; |
| 528 /** | 524 |
| 529 * The language of the source text, set to one of the language codes listed in | 525 /// The language of the source text, set to one of the language codes listed |
| 530 * Language Support. If the source language is not specified, the API will | 526 /// in |
| 531 * attempt to identify the source language automatically and return it within | 527 /// Language Support. If the source language is not specified, the API will |
| 532 * the response. | 528 /// attempt to identify the source language automatically and return it |
| 533 */ | 529 /// within |
| 530 /// the response. |
| 534 core.String source; | 531 core.String source; |
| 535 /** | 532 |
| 536 * The language to use for translation of the input text, set to one of the | 533 /// The language to use for translation of the input text, set to one of the |
| 537 * language codes listed in Language Support. | 534 /// language codes listed in Language Support. |
| 538 */ | |
| 539 core.String target; | 535 core.String target; |
| 540 | 536 |
| 541 TranslateTextRequest(); | 537 TranslateTextRequest(); |
| 542 | 538 |
| 543 TranslateTextRequest.fromJson(core.Map _json) { | 539 TranslateTextRequest.fromJson(core.Map _json) { |
| 544 if (_json.containsKey("format")) { | 540 if (_json.containsKey("format")) { |
| 545 format = _json["format"]; | 541 format = _json["format"]; |
| 546 } | 542 } |
| 547 if (_json.containsKey("model")) { | 543 if (_json.containsKey("model")) { |
| 548 model = _json["model"]; | 544 model = _json["model"]; |
| 549 } | 545 } |
| 550 if (_json.containsKey("q")) { | 546 if (_json.containsKey("q")) { |
| 551 q = _json["q"]; | 547 q = _json["q"]; |
| 552 } | 548 } |
| 553 if (_json.containsKey("source")) { | 549 if (_json.containsKey("source")) { |
| 554 source = _json["source"]; | 550 source = _json["source"]; |
| 555 } | 551 } |
| 556 if (_json.containsKey("target")) { | 552 if (_json.containsKey("target")) { |
| 557 target = _json["target"]; | 553 target = _json["target"]; |
| 558 } | 554 } |
| 559 } | 555 } |
| 560 | 556 |
| 561 core.Map<core.String, core.Object> toJson() { | 557 core.Map<core.String, core.Object> toJson() { |
| 562 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 558 final core.Map<core.String, core.Object> _json = |
| 559 new core.Map<core.String, core.Object>(); |
| 563 if (format != null) { | 560 if (format != null) { |
| 564 _json["format"] = format; | 561 _json["format"] = format; |
| 565 } | 562 } |
| 566 if (model != null) { | 563 if (model != null) { |
| 567 _json["model"] = model; | 564 _json["model"] = model; |
| 568 } | 565 } |
| 569 if (q != null) { | 566 if (q != null) { |
| 570 _json["q"] = q; | 567 _json["q"] = q; |
| 571 } | 568 } |
| 572 if (source != null) { | 569 if (source != null) { |
| 573 _json["source"] = source; | 570 _json["source"] = source; |
| 574 } | 571 } |
| 575 if (target != null) { | 572 if (target != null) { |
| 576 _json["target"] = target; | 573 _json["target"] = target; |
| 577 } | 574 } |
| 578 return _json; | 575 return _json; |
| 579 } | 576 } |
| 580 } | 577 } |
| 581 | 578 |
| 582 /** The main language translation response message. */ | 579 /// The main language translation response message. |
| 583 class TranslationsListResponse { | 580 class TranslationsListResponse { |
| 584 /** Translations contains list of translation results of given text */ | 581 /// Translations contains list of translation results of given text |
| 585 core.List<TranslationsResource> translations; | 582 core.List<TranslationsResource> translations; |
| 586 | 583 |
| 587 TranslationsListResponse(); | 584 TranslationsListResponse(); |
| 588 | 585 |
| 589 TranslationsListResponse.fromJson(core.Map _json) { | 586 TranslationsListResponse.fromJson(core.Map _json) { |
| 590 if (_json.containsKey("translations")) { | 587 if (_json.containsKey("translations")) { |
| 591 translations = _json["translations"].map((value) => new TranslationsResour
ce.fromJson(value)).toList(); | 588 translations = _json["translations"] |
| 589 .map((value) => new TranslationsResource.fromJson(value)) |
| 590 .toList(); |
| 592 } | 591 } |
| 593 } | 592 } |
| 594 | 593 |
| 595 core.Map<core.String, core.Object> toJson() { | 594 core.Map<core.String, core.Object> toJson() { |
| 596 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 595 final core.Map<core.String, core.Object> _json = |
| 596 new core.Map<core.String, core.Object>(); |
| 597 if (translations != null) { | 597 if (translations != null) { |
| 598 _json["translations"] = translations.map((value) => (value).toJson()).toLi
st(); | 598 _json["translations"] = |
| 599 translations.map((value) => (value).toJson()).toList(); |
| 599 } | 600 } |
| 600 return _json; | 601 return _json; |
| 601 } | 602 } |
| 602 } | 603 } |
| 603 | 604 |
| 604 class TranslationsResource { | 605 class TranslationsResource { |
| 605 /** | 606 /// The source language of the initial request, detected automatically, if |
| 606 * The source language of the initial request, detected automatically, if | 607 /// no source language was passed within the initial request. If the |
| 607 * no source language was passed within the initial request. If the | 608 /// source language was passed, auto-detection of the language will not |
| 608 * source language was passed, auto-detection of the language will not | 609 /// occur and this field will be empty. |
| 609 * occur and this field will be empty. | |
| 610 */ | |
| 611 core.String detectedSourceLanguage; | 610 core.String detectedSourceLanguage; |
| 612 /** | 611 |
| 613 * The `model` type used for this translation. Valid values are | 612 /// The `model` type used for this translation. Valid values are |
| 614 * listed in public documentation. Can be different from requested `model`. | 613 /// listed in public documentation. Can be different from requested `model`. |
| 615 * Present only if specific model type was explicitly requested. | 614 /// Present only if specific model type was explicitly requested. |
| 616 */ | |
| 617 core.String model; | 615 core.String model; |
| 618 /** Text translated into the target language. */ | 616 |
| 617 /// Text translated into the target language. |
| 619 core.String translatedText; | 618 core.String translatedText; |
| 620 | 619 |
| 621 TranslationsResource(); | 620 TranslationsResource(); |
| 622 | 621 |
| 623 TranslationsResource.fromJson(core.Map _json) { | 622 TranslationsResource.fromJson(core.Map _json) { |
| 624 if (_json.containsKey("detectedSourceLanguage")) { | 623 if (_json.containsKey("detectedSourceLanguage")) { |
| 625 detectedSourceLanguage = _json["detectedSourceLanguage"]; | 624 detectedSourceLanguage = _json["detectedSourceLanguage"]; |
| 626 } | 625 } |
| 627 if (_json.containsKey("model")) { | 626 if (_json.containsKey("model")) { |
| 628 model = _json["model"]; | 627 model = _json["model"]; |
| 629 } | 628 } |
| 630 if (_json.containsKey("translatedText")) { | 629 if (_json.containsKey("translatedText")) { |
| 631 translatedText = _json["translatedText"]; | 630 translatedText = _json["translatedText"]; |
| 632 } | 631 } |
| 633 } | 632 } |
| 634 | 633 |
| 635 core.Map<core.String, core.Object> toJson() { | 634 core.Map<core.String, core.Object> toJson() { |
| 636 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 635 final core.Map<core.String, core.Object> _json = |
| 636 new core.Map<core.String, core.Object>(); |
| 637 if (detectedSourceLanguage != null) { | 637 if (detectedSourceLanguage != null) { |
| 638 _json["detectedSourceLanguage"] = detectedSourceLanguage; | 638 _json["detectedSourceLanguage"] = detectedSourceLanguage; |
| 639 } | 639 } |
| 640 if (model != null) { | 640 if (model != null) { |
| 641 _json["model"] = model; | 641 _json["model"] = model; |
| 642 } | 642 } |
| 643 if (translatedText != null) { | 643 if (translatedText != null) { |
| 644 _json["translatedText"] = translatedText; | 644 _json["translatedText"] = translatedText; |
| 645 } | 645 } |
| 646 return _json; | 646 return _json; |
| 647 } | 647 } |
| 648 } | 648 } |
| OLD | NEW |