| 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_beta.speech.v1beta1; | 3 library googleapis_beta.speech.v1beta1; |
| 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; | 13 show ApiRequestError, DetailedApiRequestError; |
| 14 | 14 |
| 15 const core.String USER_AGENT = 'dart-api-client speech/v1beta1'; | 15 const core.String USER_AGENT = 'dart-api-client speech/v1beta1'; |
| 16 | 16 |
| 17 /** Converts audio to text by applying powerful neural network models. */ | 17 /// Converts audio to text by applying powerful neural network models. |
| 18 class SpeechApi { | 18 class SpeechApi { |
| 19 /** View and manage your data across Google Cloud Platform services */ | 19 /// View and manage your data across Google Cloud Platform services |
| 20 static const CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platf
orm"; | 20 static const CloudPlatformScope = |
| 21 | 21 "https://www.googleapis.com/auth/cloud-platform"; |
| 22 | 22 |
| 23 final commons.ApiRequester _requester; | 23 final commons.ApiRequester _requester; |
| 24 | 24 |
| 25 OperationsResourceApi get operations => new OperationsResourceApi(_requester); | 25 OperationsResourceApi get operations => new OperationsResourceApi(_requester); |
| 26 SpeechResourceApi get speech => new SpeechResourceApi(_requester); | 26 SpeechResourceApi get speech => new SpeechResourceApi(_requester); |
| 27 | 27 |
| 28 SpeechApi(http.Client client, {core.String rootUrl: "https://speech.googleapis
.com/", core.String servicePath: ""}) : | 28 SpeechApi(http.Client client, |
| 29 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); | 29 {core.String rootUrl: "https://speech.googleapis.com/", |
| 30 core.String servicePath: ""}) |
| 31 : _requester = |
| 32 new commons.ApiRequester(client, rootUrl, servicePath, USER_AGENT); |
| 30 } | 33 } |
| 31 | 34 |
| 32 | |
| 33 class OperationsResourceApi { | 35 class OperationsResourceApi { |
| 34 final commons.ApiRequester _requester; | 36 final commons.ApiRequester _requester; |
| 35 | 37 |
| 36 OperationsResourceApi(commons.ApiRequester client) : | 38 OperationsResourceApi(commons.ApiRequester client) : _requester = client; |
| 37 _requester = client; | |
| 38 | 39 |
| 39 /** | 40 /// Starts asynchronous cancellation on a long-running operation. The server |
| 40 * Starts asynchronous cancellation on a long-running operation. The server | 41 /// makes a best effort to cancel the operation, but success is not |
| 41 * makes a best effort to cancel the operation, but success is not | 42 /// guaranteed. If the server doesn't support this method, it returns |
| 42 * guaranteed. If the server doesn't support this method, it returns | 43 /// `google.rpc.Code.UNIMPLEMENTED`. Clients can use |
| 43 * `google.rpc.Code.UNIMPLEMENTED`. Clients can use | 44 /// Operations.GetOperation or |
| 44 * Operations.GetOperation or | 45 /// other methods to check whether the cancellation succeeded or whether the |
| 45 * other methods to check whether the cancellation succeeded or whether the | 46 /// operation completed despite cancellation. On successful cancellation, |
| 46 * operation completed despite cancellation. On successful cancellation, | 47 /// the operation is not deleted; instead, it becomes an operation with |
| 47 * the operation is not deleted; instead, it becomes an operation with | 48 /// an Operation.error value with a google.rpc.Status.code of 1, |
| 48 * an Operation.error value with a google.rpc.Status.code of 1, | 49 /// corresponding to `Code.CANCELLED`. |
| 49 * corresponding to `Code.CANCELLED`. | 50 /// |
| 50 * | 51 /// Request parameters: |
| 51 * Request parameters: | 52 /// |
| 52 * | 53 /// [name] - The name of the operation resource to be cancelled. |
| 53 * [name] - The name of the operation resource to be cancelled. | 54 /// Value must have pattern "^[^/]+$". |
| 54 * Value must have pattern "^[^/]+$". | 55 /// |
| 55 * | 56 /// Completes with a [Empty]. |
| 56 * Completes with a [Empty]. | 57 /// |
| 57 * | 58 /// Completes with a [commons.ApiRequestError] if the API endpoint returned |
| 58 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 59 /// an error. |
| 59 * error. | 60 /// |
| 60 * | 61 /// If the used [http.Client] completes with an error when making a REST |
| 61 * If the used [http.Client] completes with an error when making a REST call, | 62 /// call, this method will complete with the same error. |
| 62 * this method will complete with the same error. | |
| 63 */ | |
| 64 async.Future<Empty> cancel(core.String name) { | 63 async.Future<Empty> cancel(core.String name) { |
| 65 var _url = null; | 64 var _url = null; |
| 66 var _queryParams = new core.Map(); | 65 var _queryParams = new core.Map(); |
| 67 var _uploadMedia = null; | 66 var _uploadMedia = null; |
| 68 var _uploadOptions = null; | 67 var _uploadOptions = null; |
| 69 var _downloadOptions = commons.DownloadOptions.Metadata; | 68 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 70 var _body = null; | 69 var _body = null; |
| 71 | 70 |
| 72 if (name == null) { | 71 if (name == null) { |
| 73 throw new core.ArgumentError("Parameter name is required."); | 72 throw new core.ArgumentError("Parameter name is required."); |
| 74 } | 73 } |
| 75 | 74 |
| 76 _url = 'v1beta1/operations/' + commons.Escaper.ecapeVariableReserved('$name'
) + ':cancel'; | 75 _url = 'v1beta1/operations/' + |
| 76 commons.Escaper.ecapeVariableReserved('$name') + |
| 77 ':cancel'; |
| 77 | 78 |
| 78 var _response = _requester.request(_url, | 79 var _response = _requester.request(_url, "POST", |
| 79 "POST", | 80 body: _body, |
| 80 body: _body, | 81 queryParams: _queryParams, |
| 81 queryParams: _queryParams, | 82 uploadOptions: _uploadOptions, |
| 82 uploadOptions: _uploadOptions, | 83 uploadMedia: _uploadMedia, |
| 83 uploadMedia: _uploadMedia, | 84 downloadOptions: _downloadOptions); |
| 84 downloadOptions: _downloadOptions); | |
| 85 return _response.then((data) => new Empty.fromJson(data)); | 85 return _response.then((data) => new Empty.fromJson(data)); |
| 86 } | 86 } |
| 87 | 87 |
| 88 /** | 88 /// Deletes a long-running operation. This method indicates that the client |
| 89 * Deletes a long-running operation. This method indicates that the client is | 89 /// is |
| 90 * no longer interested in the operation result. It does not cancel the | 90 /// no longer interested in the operation result. It does not cancel the |
| 91 * operation. If the server doesn't support this method, it returns | 91 /// operation. If the server doesn't support this method, it returns |
| 92 * `google.rpc.Code.UNIMPLEMENTED`. | 92 /// `google.rpc.Code.UNIMPLEMENTED`. |
| 93 * | 93 /// |
| 94 * Request parameters: | 94 /// Request parameters: |
| 95 * | 95 /// |
| 96 * [name] - The name of the operation resource to be deleted. | 96 /// [name] - The name of the operation resource to be deleted. |
| 97 * Value must have pattern "^[^/]+$". | 97 /// Value must have pattern "^[^/]+$". |
| 98 * | 98 /// |
| 99 * Completes with a [Empty]. | 99 /// Completes with a [Empty]. |
| 100 * | 100 /// |
| 101 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 101 /// Completes with a [commons.ApiRequestError] if the API endpoint returned |
| 102 * error. | 102 /// an error. |
| 103 * | 103 /// |
| 104 * If the used [http.Client] completes with an error when making a REST call, | 104 /// If the used [http.Client] completes with an error when making a REST |
| 105 * this method will complete with the same error. | 105 /// call, this method will complete with the same error. |
| 106 */ | |
| 107 async.Future<Empty> delete(core.String name) { | 106 async.Future<Empty> delete(core.String name) { |
| 108 var _url = null; | 107 var _url = null; |
| 109 var _queryParams = new core.Map(); | 108 var _queryParams = new core.Map(); |
| 110 var _uploadMedia = null; | 109 var _uploadMedia = null; |
| 111 var _uploadOptions = null; | 110 var _uploadOptions = null; |
| 112 var _downloadOptions = commons.DownloadOptions.Metadata; | 111 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 113 var _body = null; | 112 var _body = null; |
| 114 | 113 |
| 115 if (name == null) { | 114 if (name == null) { |
| 116 throw new core.ArgumentError("Parameter name is required."); | 115 throw new core.ArgumentError("Parameter name is required."); |
| 117 } | 116 } |
| 118 | 117 |
| 119 _url = 'v1beta1/operations/' + commons.Escaper.ecapeVariableReserved('$name'
); | 118 _url = |
| 119 'v1beta1/operations/' + commons.Escaper.ecapeVariableReserved('$name'); |
| 120 | 120 |
| 121 var _response = _requester.request(_url, | 121 var _response = _requester.request(_url, "DELETE", |
| 122 "DELETE", | 122 body: _body, |
| 123 body: _body, | 123 queryParams: _queryParams, |
| 124 queryParams: _queryParams, | 124 uploadOptions: _uploadOptions, |
| 125 uploadOptions: _uploadOptions, | 125 uploadMedia: _uploadMedia, |
| 126 uploadMedia: _uploadMedia, | 126 downloadOptions: _downloadOptions); |
| 127 downloadOptions: _downloadOptions); | |
| 128 return _response.then((data) => new Empty.fromJson(data)); | 127 return _response.then((data) => new Empty.fromJson(data)); |
| 129 } | 128 } |
| 130 | 129 |
| 131 /** | 130 /// Gets the latest state of a long-running operation. Clients can use this |
| 132 * Gets the latest state of a long-running operation. Clients can use this | 131 /// method to poll the operation result at intervals as recommended by the |
| 133 * method to poll the operation result at intervals as recommended by the API | 132 /// API |
| 134 * service. | 133 /// service. |
| 135 * | 134 /// |
| 136 * Request parameters: | 135 /// Request parameters: |
| 137 * | 136 /// |
| 138 * [name] - The name of the operation resource. | 137 /// [name] - The name of the operation resource. |
| 139 * Value must have pattern "^[^/]+$". | 138 /// Value must have pattern "^[^/]+$". |
| 140 * | 139 /// |
| 141 * Completes with a [Operation]. | 140 /// Completes with a [Operation]. |
| 142 * | 141 /// |
| 143 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 142 /// Completes with a [commons.ApiRequestError] if the API endpoint returned |
| 144 * error. | 143 /// an error. |
| 145 * | 144 /// |
| 146 * 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 |
| 147 * this method will complete with the same error. | 146 /// call, this method will complete with the same error. |
| 148 */ | |
| 149 async.Future<Operation> get(core.String name) { | 147 async.Future<Operation> get(core.String name) { |
| 150 var _url = null; | 148 var _url = null; |
| 151 var _queryParams = new core.Map(); | 149 var _queryParams = new core.Map(); |
| 152 var _uploadMedia = null; | 150 var _uploadMedia = null; |
| 153 var _uploadOptions = null; | 151 var _uploadOptions = null; |
| 154 var _downloadOptions = commons.DownloadOptions.Metadata; | 152 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 155 var _body = null; | 153 var _body = null; |
| 156 | 154 |
| 157 if (name == null) { | 155 if (name == null) { |
| 158 throw new core.ArgumentError("Parameter name is required."); | 156 throw new core.ArgumentError("Parameter name is required."); |
| 159 } | 157 } |
| 160 | 158 |
| 161 _url = 'v1beta1/operations/' + commons.Escaper.ecapeVariableReserved('$name'
); | 159 _url = |
| 160 'v1beta1/operations/' + commons.Escaper.ecapeVariableReserved('$name'); |
| 162 | 161 |
| 163 var _response = _requester.request(_url, | 162 var _response = _requester.request(_url, "GET", |
| 164 "GET", | 163 body: _body, |
| 165 body: _body, | 164 queryParams: _queryParams, |
| 166 queryParams: _queryParams, | 165 uploadOptions: _uploadOptions, |
| 167 uploadOptions: _uploadOptions, | 166 uploadMedia: _uploadMedia, |
| 168 uploadMedia: _uploadMedia, | 167 downloadOptions: _downloadOptions); |
| 169 downloadOptions: _downloadOptions); | |
| 170 return _response.then((data) => new Operation.fromJson(data)); | 168 return _response.then((data) => new Operation.fromJson(data)); |
| 171 } | 169 } |
| 172 | 170 |
| 173 /** | 171 /// Lists operations that match the specified filter in the request. If the |
| 174 * Lists operations that match the specified filter in the request. If the | 172 /// server doesn't support this method, it returns `UNIMPLEMENTED`. |
| 175 * server doesn't support this method, it returns `UNIMPLEMENTED`. | 173 /// |
| 176 * | 174 /// NOTE: the `name` binding allows API services to override the binding |
| 177 * NOTE: the `name` binding allows API services to override the binding | 175 /// to use different resource name schemes, such as `users / * /operations`. |
| 178 * to use different resource name schemes, such as `users / * /operations`. To | 176 /// To |
| 179 * override the binding, API services can add a binding such as | 177 /// override the binding, API services can add a binding such as |
| 180 * `"/v1/{name=users / * }/operations"` to their service configuration. | 178 /// `"/v1/{name=users / * }/operations"` to their service configuration. |
| 181 * For backwards compatibility, the default name includes the operations | 179 /// For backwards compatibility, the default name includes the operations |
| 182 * collection id, however overriding users must ensure the name binding | 180 /// collection id, however overriding users must ensure the name binding |
| 183 * is the parent resource, without the operations collection id. | 181 /// is the parent resource, without the operations collection id. |
| 184 * | 182 /// |
| 185 * Request parameters: | 183 /// Request parameters: |
| 186 * | 184 /// |
| 187 * [pageToken] - The standard list page token. | 185 /// [filter] - The standard list filter. |
| 188 * | 186 /// |
| 189 * [name] - The name of the operation's parent resource. | 187 /// [pageToken] - The standard list page token. |
| 190 * | 188 /// |
| 191 * [pageSize] - The standard list page size. | 189 /// [name] - The name of the operation's parent resource. |
| 192 * | 190 /// |
| 193 * [filter] - The standard list filter. | 191 /// [pageSize] - The standard list page size. |
| 194 * | 192 /// |
| 195 * Completes with a [ListOperationsResponse]. | 193 /// Completes with a [ListOperationsResponse]. |
| 196 * | 194 /// |
| 197 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 195 /// Completes with a [commons.ApiRequestError] if the API endpoint returned |
| 198 * error. | 196 /// an error. |
| 199 * | 197 /// |
| 200 * If the used [http.Client] completes with an error when making a REST call, | 198 /// If the used [http.Client] completes with an error when making a REST |
| 201 * this method will complete with the same error. | 199 /// call, this method will complete with the same error. |
| 202 */ | 200 async.Future<ListOperationsResponse> list( |
| 203 async.Future<ListOperationsResponse> list({core.String pageToken, core.String
name, core.int pageSize, core.String filter}) { | 201 {core.String filter, |
| 202 core.String pageToken, |
| 203 core.String name, |
| 204 core.int pageSize}) { |
| 204 var _url = null; | 205 var _url = null; |
| 205 var _queryParams = new core.Map(); | 206 var _queryParams = new core.Map(); |
| 206 var _uploadMedia = null; | 207 var _uploadMedia = null; |
| 207 var _uploadOptions = null; | 208 var _uploadOptions = null; |
| 208 var _downloadOptions = commons.DownloadOptions.Metadata; | 209 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 209 var _body = null; | 210 var _body = null; |
| 210 | 211 |
| 212 if (filter != null) { |
| 213 _queryParams["filter"] = [filter]; |
| 214 } |
| 211 if (pageToken != null) { | 215 if (pageToken != null) { |
| 212 _queryParams["pageToken"] = [pageToken]; | 216 _queryParams["pageToken"] = [pageToken]; |
| 213 } | 217 } |
| 214 if (name != null) { | 218 if (name != null) { |
| 215 _queryParams["name"] = [name]; | 219 _queryParams["name"] = [name]; |
| 216 } | 220 } |
| 217 if (pageSize != null) { | 221 if (pageSize != null) { |
| 218 _queryParams["pageSize"] = ["${pageSize}"]; | 222 _queryParams["pageSize"] = ["${pageSize}"]; |
| 219 } | 223 } |
| 220 if (filter != null) { | |
| 221 _queryParams["filter"] = [filter]; | |
| 222 } | |
| 223 | 224 |
| 224 _url = 'v1beta1/operations'; | 225 _url = 'v1beta1/operations'; |
| 225 | 226 |
| 226 var _response = _requester.request(_url, | 227 var _response = _requester.request(_url, "GET", |
| 227 "GET", | 228 body: _body, |
| 228 body: _body, | 229 queryParams: _queryParams, |
| 229 queryParams: _queryParams, | 230 uploadOptions: _uploadOptions, |
| 230 uploadOptions: _uploadOptions, | 231 uploadMedia: _uploadMedia, |
| 231 uploadMedia: _uploadMedia, | 232 downloadOptions: _downloadOptions); |
| 232 downloadOptions: _downloadOptions); | |
| 233 return _response.then((data) => new ListOperationsResponse.fromJson(data)); | 233 return _response.then((data) => new ListOperationsResponse.fromJson(data)); |
| 234 } | 234 } |
| 235 | |
| 236 } | 235 } |
| 237 | 236 |
| 238 | |
| 239 class SpeechResourceApi { | 237 class SpeechResourceApi { |
| 240 final commons.ApiRequester _requester; | 238 final commons.ApiRequester _requester; |
| 241 | 239 |
| 242 SpeechResourceApi(commons.ApiRequester client) : | 240 SpeechResourceApi(commons.ApiRequester client) : _requester = client; |
| 243 _requester = client; | |
| 244 | 241 |
| 245 /** | 242 /// Performs asynchronous speech recognition: receive results via the |
| 246 * Performs asynchronous speech recognition: receive results via the | 243 /// [google.longrunning.Operations] |
| 247 * [google.longrunning.Operations] | 244 /// (/speech/reference/rest/v1beta1/operations#Operation) |
| 248 * (/speech/reference/rest/v1beta1/operations#Operation) | 245 /// interface. Returns either an |
| 249 * interface. Returns either an | 246 /// `Operation.error` or an `Operation.response` which contains |
| 250 * `Operation.error` or an `Operation.response` which contains | 247 /// an `AsyncRecognizeResponse` message. |
| 251 * an `AsyncRecognizeResponse` message. | 248 /// |
| 252 * | 249 /// [request] - The metadata request object. |
| 253 * [request] - The metadata request object. | 250 /// |
| 254 * | 251 /// Request parameters: |
| 255 * Request parameters: | 252 /// |
| 256 * | 253 /// Completes with a [Operation]. |
| 257 * Completes with a [Operation]. | 254 /// |
| 258 * | 255 /// Completes with a [commons.ApiRequestError] if the API endpoint returned |
| 259 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 256 /// an error. |
| 260 * error. | 257 /// |
| 261 * | 258 /// If the used [http.Client] completes with an error when making a REST |
| 262 * If the used [http.Client] completes with an error when making a REST call, | 259 /// call, this method will complete with the same error. |
| 263 * this method will complete with the same error. | |
| 264 */ | |
| 265 async.Future<Operation> asyncrecognize(AsyncRecognizeRequest request) { | 260 async.Future<Operation> asyncrecognize(AsyncRecognizeRequest request) { |
| 266 var _url = null; | 261 var _url = null; |
| 267 var _queryParams = new core.Map(); | 262 var _queryParams = new core.Map(); |
| 268 var _uploadMedia = null; | 263 var _uploadMedia = null; |
| 269 var _uploadOptions = null; | 264 var _uploadOptions = null; |
| 270 var _downloadOptions = commons.DownloadOptions.Metadata; | 265 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 271 var _body = null; | 266 var _body = null; |
| 272 | 267 |
| 273 if (request != null) { | 268 if (request != null) { |
| 274 _body = convert.JSON.encode((request).toJson()); | 269 _body = convert.JSON.encode((request).toJson()); |
| 275 } | 270 } |
| 276 | 271 |
| 277 _url = 'v1beta1/speech:asyncrecognize'; | 272 _url = 'v1beta1/speech:asyncrecognize'; |
| 278 | 273 |
| 279 var _response = _requester.request(_url, | 274 var _response = _requester.request(_url, "POST", |
| 280 "POST", | 275 body: _body, |
| 281 body: _body, | 276 queryParams: _queryParams, |
| 282 queryParams: _queryParams, | 277 uploadOptions: _uploadOptions, |
| 283 uploadOptions: _uploadOptions, | 278 uploadMedia: _uploadMedia, |
| 284 uploadMedia: _uploadMedia, | 279 downloadOptions: _downloadOptions); |
| 285 downloadOptions: _downloadOptions); | |
| 286 return _response.then((data) => new Operation.fromJson(data)); | 280 return _response.then((data) => new Operation.fromJson(data)); |
| 287 } | 281 } |
| 288 | 282 |
| 289 /** | 283 /// Performs synchronous speech recognition: receive results after all audio |
| 290 * Performs synchronous speech recognition: receive results after all audio | 284 /// has been sent and processed. |
| 291 * has been sent and processed. | 285 /// |
| 292 * | 286 /// [request] - The metadata request object. |
| 293 * [request] - The metadata request object. | 287 /// |
| 294 * | 288 /// Request parameters: |
| 295 * Request parameters: | 289 /// |
| 296 * | 290 /// Completes with a [SyncRecognizeResponse]. |
| 297 * Completes with a [SyncRecognizeResponse]. | 291 /// |
| 298 * | 292 /// Completes with a [commons.ApiRequestError] if the API endpoint returned |
| 299 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 293 /// an error. |
| 300 * error. | 294 /// |
| 301 * | 295 /// If the used [http.Client] completes with an error when making a REST |
| 302 * If the used [http.Client] completes with an error when making a REST call, | 296 /// call, this method will complete with the same error. |
| 303 * this method will complete with the same error. | 297 async.Future<SyncRecognizeResponse> syncrecognize( |
| 304 */ | 298 SyncRecognizeRequest request) { |
| 305 async.Future<SyncRecognizeResponse> syncrecognize(SyncRecognizeRequest request
) { | |
| 306 var _url = null; | 299 var _url = null; |
| 307 var _queryParams = new core.Map(); | 300 var _queryParams = new core.Map(); |
| 308 var _uploadMedia = null; | 301 var _uploadMedia = null; |
| 309 var _uploadOptions = null; | 302 var _uploadOptions = null; |
| 310 var _downloadOptions = commons.DownloadOptions.Metadata; | 303 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 311 var _body = null; | 304 var _body = null; |
| 312 | 305 |
| 313 if (request != null) { | 306 if (request != null) { |
| 314 _body = convert.JSON.encode((request).toJson()); | 307 _body = convert.JSON.encode((request).toJson()); |
| 315 } | 308 } |
| 316 | 309 |
| 317 _url = 'v1beta1/speech:syncrecognize'; | 310 _url = 'v1beta1/speech:syncrecognize'; |
| 318 | 311 |
| 319 var _response = _requester.request(_url, | 312 var _response = _requester.request(_url, "POST", |
| 320 "POST", | 313 body: _body, |
| 321 body: _body, | 314 queryParams: _queryParams, |
| 322 queryParams: _queryParams, | 315 uploadOptions: _uploadOptions, |
| 323 uploadOptions: _uploadOptions, | 316 uploadMedia: _uploadMedia, |
| 324 uploadMedia: _uploadMedia, | 317 downloadOptions: _downloadOptions); |
| 325 downloadOptions: _downloadOptions); | |
| 326 return _response.then((data) => new SyncRecognizeResponse.fromJson(data)); | 318 return _response.then((data) => new SyncRecognizeResponse.fromJson(data)); |
| 327 } | 319 } |
| 328 | |
| 329 } | 320 } |
| 330 | 321 |
| 322 /// The top-level message sent by the client for the `AsyncRecognize` method. |
| 323 class AsyncRecognizeRequest { |
| 324 /// *Required* The audio data to be recognized. |
| 325 RecognitionAudio audio; |
| 331 | 326 |
| 332 | 327 /// *Required* Provides information to the recognizer that specifies how to |
| 333 /** | 328 /// process the request. |
| 334 * The top-level message sent by the client for the `AsyncRecognize` method. | |
| 335 */ | |
| 336 class AsyncRecognizeRequest { | |
| 337 /** *Required* The audio data to be recognized. */ | |
| 338 RecognitionAudio audio; | |
| 339 /** | |
| 340 * *Required* Provides information to the recognizer that specifies how to | |
| 341 * process the request. | |
| 342 */ | |
| 343 RecognitionConfig config; | 329 RecognitionConfig config; |
| 344 | 330 |
| 345 AsyncRecognizeRequest(); | 331 AsyncRecognizeRequest(); |
| 346 | 332 |
| 347 AsyncRecognizeRequest.fromJson(core.Map _json) { | 333 AsyncRecognizeRequest.fromJson(core.Map _json) { |
| 348 if (_json.containsKey("audio")) { | 334 if (_json.containsKey("audio")) { |
| 349 audio = new RecognitionAudio.fromJson(_json["audio"]); | 335 audio = new RecognitionAudio.fromJson(_json["audio"]); |
| 350 } | 336 } |
| 351 if (_json.containsKey("config")) { | 337 if (_json.containsKey("config")) { |
| 352 config = new RecognitionConfig.fromJson(_json["config"]); | 338 config = new RecognitionConfig.fromJson(_json["config"]); |
| 353 } | 339 } |
| 354 } | 340 } |
| 355 | 341 |
| 356 core.Map<core.String, core.Object> toJson() { | 342 core.Map<core.String, core.Object> toJson() { |
| 357 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 343 final core.Map<core.String, core.Object> _json = |
| 344 new core.Map<core.String, core.Object>(); |
| 358 if (audio != null) { | 345 if (audio != null) { |
| 359 _json["audio"] = (audio).toJson(); | 346 _json["audio"] = (audio).toJson(); |
| 360 } | 347 } |
| 361 if (config != null) { | 348 if (config != null) { |
| 362 _json["config"] = (config).toJson(); | 349 _json["config"] = (config).toJson(); |
| 363 } | 350 } |
| 364 return _json; | 351 return _json; |
| 365 } | 352 } |
| 366 } | 353 } |
| 367 | 354 |
| 368 /** | 355 /// A generic empty message that you can re-use to avoid defining duplicated |
| 369 * A generic empty message that you can re-use to avoid defining duplicated | 356 /// empty messages in your APIs. A typical example is to use it as the request |
| 370 * empty messages in your APIs. A typical example is to use it as the request | 357 /// or the response type of an API method. For instance: |
| 371 * or the response type of an API method. For instance: | 358 /// |
| 372 * | 359 /// service Foo { |
| 373 * service Foo { | 360 /// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); |
| 374 * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); | 361 /// } |
| 375 * } | 362 /// |
| 376 * | 363 /// The JSON representation for `Empty` is empty JSON object `{}`. |
| 377 * The JSON representation for `Empty` is empty JSON object `{}`. | |
| 378 */ | |
| 379 class Empty { | 364 class Empty { |
| 380 | |
| 381 Empty(); | 365 Empty(); |
| 382 | 366 |
| 383 Empty.fromJson(core.Map _json) { | 367 Empty.fromJson(core.Map _json) {} |
| 384 } | |
| 385 | 368 |
| 386 core.Map<core.String, core.Object> toJson() { | 369 core.Map<core.String, core.Object> toJson() { |
| 387 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 370 final core.Map<core.String, core.Object> _json = |
| 371 new core.Map<core.String, core.Object>(); |
| 388 return _json; | 372 return _json; |
| 389 } | 373 } |
| 390 } | 374 } |
| 391 | 375 |
| 392 /** The response message for Operations.ListOperations. */ | 376 /// The response message for Operations.ListOperations. |
| 393 class ListOperationsResponse { | 377 class ListOperationsResponse { |
| 394 /** The standard List next-page token. */ | 378 /// The standard List next-page token. |
| 395 core.String nextPageToken; | 379 core.String nextPageToken; |
| 396 /** A list of operations that matches the specified filter in the request. */ | 380 |
| 381 /// A list of operations that matches the specified filter in the request. |
| 397 core.List<Operation> operations; | 382 core.List<Operation> operations; |
| 398 | 383 |
| 399 ListOperationsResponse(); | 384 ListOperationsResponse(); |
| 400 | 385 |
| 401 ListOperationsResponse.fromJson(core.Map _json) { | 386 ListOperationsResponse.fromJson(core.Map _json) { |
| 402 if (_json.containsKey("nextPageToken")) { | 387 if (_json.containsKey("nextPageToken")) { |
| 403 nextPageToken = _json["nextPageToken"]; | 388 nextPageToken = _json["nextPageToken"]; |
| 404 } | 389 } |
| 405 if (_json.containsKey("operations")) { | 390 if (_json.containsKey("operations")) { |
| 406 operations = _json["operations"].map((value) => new Operation.fromJson(val
ue)).toList(); | 391 operations = _json["operations"] |
| 392 .map((value) => new Operation.fromJson(value)) |
| 393 .toList(); |
| 407 } | 394 } |
| 408 } | 395 } |
| 409 | 396 |
| 410 core.Map<core.String, core.Object> toJson() { | 397 core.Map<core.String, core.Object> toJson() { |
| 411 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 398 final core.Map<core.String, core.Object> _json = |
| 399 new core.Map<core.String, core.Object>(); |
| 412 if (nextPageToken != null) { | 400 if (nextPageToken != null) { |
| 413 _json["nextPageToken"] = nextPageToken; | 401 _json["nextPageToken"] = nextPageToken; |
| 414 } | 402 } |
| 415 if (operations != null) { | 403 if (operations != null) { |
| 416 _json["operations"] = operations.map((value) => (value).toJson()).toList()
; | 404 _json["operations"] = |
| 405 operations.map((value) => (value).toJson()).toList(); |
| 417 } | 406 } |
| 418 return _json; | 407 return _json; |
| 419 } | 408 } |
| 420 } | 409 } |
| 421 | 410 |
| 422 /** | 411 /// This resource represents a long-running operation that is the result of a |
| 423 * This resource represents a long-running operation that is the result of a | 412 /// network API call. |
| 424 * network API call. | |
| 425 */ | |
| 426 class Operation { | 413 class Operation { |
| 427 /** | 414 /// If the value is `false`, it means the operation is still in progress. |
| 428 * If the value is `false`, it means the operation is still in progress. | 415 /// If `true`, the operation is completed, and either `error` or `response` |
| 429 * If true, the operation is completed, and either `error` or `response` is | 416 /// is |
| 430 * available. | 417 /// available. |
| 431 */ | |
| 432 core.bool done; | 418 core.bool done; |
| 433 /** The error result of the operation in case of failure or cancellation. */ | 419 |
| 420 /// The error result of the operation in case of failure or cancellation. |
| 434 Status error; | 421 Status error; |
| 435 /** | 422 |
| 436 * Service-specific metadata associated with the operation. It typically | 423 /// Service-specific metadata associated with the operation. It typically |
| 437 * contains progress information and common metadata such as create time. | 424 /// contains progress information and common metadata such as create time. |
| 438 * Some services might not provide such metadata. Any method that returns a | 425 /// Some services might not provide such metadata. Any method that returns a |
| 439 * long-running operation should document the metadata type, if any. | 426 /// long-running operation should document the metadata type, if any. |
| 440 * | 427 /// |
| 441 * The values for Object must be JSON objects. It can consist of `num`, | 428 /// The values for Object must be JSON objects. It can consist of `num`, |
| 442 * `String`, `bool` and `null` as well as `Map` and `List` values. | 429 /// `String`, `bool` and `null` as well as `Map` and `List` values. |
| 443 */ | |
| 444 core.Map<core.String, core.Object> metadata; | 430 core.Map<core.String, core.Object> metadata; |
| 445 /** | 431 |
| 446 * The server-assigned name, which is only unique within the same service that | 432 /// The server-assigned name, which is only unique within the same service |
| 447 * originally returns it. If you use the default HTTP mapping, the | 433 /// that |
| 448 * `name` should have the format of `operations/some/unique/name`. | 434 /// originally returns it. If you use the default HTTP mapping, the |
| 449 */ | 435 /// `name` should have the format of `operations/some/unique/name`. |
| 450 core.String name; | 436 core.String name; |
| 451 /** | 437 |
| 452 * The normal response of the operation in case of success. If the original | 438 /// The normal response of the operation in case of success. If the original |
| 453 * method returns no data on success, such as `Delete`, the response is | 439 /// method returns no data on success, such as `Delete`, the response is |
| 454 * `google.protobuf.Empty`. If the original method is standard | 440 /// `google.protobuf.Empty`. If the original method is standard |
| 455 * `Get`/`Create`/`Update`, the response should be the resource. For other | 441 /// `Get`/`Create`/`Update`, the response should be the resource. For other |
| 456 * methods, the response should have the type `XxxResponse`, where `Xxx` | 442 /// methods, the response should have the type `XxxResponse`, where `Xxx` |
| 457 * is the original method name. For example, if the original method name | 443 /// is the original method name. For example, if the original method name |
| 458 * is `TakeSnapshot()`, the inferred response type is | 444 /// is `TakeSnapshot()`, the inferred response type is |
| 459 * `TakeSnapshotResponse`. | 445 /// `TakeSnapshotResponse`. |
| 460 * | 446 /// |
| 461 * The values for Object must be JSON objects. It can consist of `num`, | 447 /// The values for Object must be JSON objects. It can consist of `num`, |
| 462 * `String`, `bool` and `null` as well as `Map` and `List` values. | 448 /// `String`, `bool` and `null` as well as `Map` and `List` values. |
| 463 */ | |
| 464 core.Map<core.String, core.Object> response; | 449 core.Map<core.String, core.Object> response; |
| 465 | 450 |
| 466 Operation(); | 451 Operation(); |
| 467 | 452 |
| 468 Operation.fromJson(core.Map _json) { | 453 Operation.fromJson(core.Map _json) { |
| 469 if (_json.containsKey("done")) { | 454 if (_json.containsKey("done")) { |
| 470 done = _json["done"]; | 455 done = _json["done"]; |
| 471 } | 456 } |
| 472 if (_json.containsKey("error")) { | 457 if (_json.containsKey("error")) { |
| 473 error = new Status.fromJson(_json["error"]); | 458 error = new Status.fromJson(_json["error"]); |
| 474 } | 459 } |
| 475 if (_json.containsKey("metadata")) { | 460 if (_json.containsKey("metadata")) { |
| 476 metadata = _json["metadata"]; | 461 metadata = _json["metadata"]; |
| 477 } | 462 } |
| 478 if (_json.containsKey("name")) { | 463 if (_json.containsKey("name")) { |
| 479 name = _json["name"]; | 464 name = _json["name"]; |
| 480 } | 465 } |
| 481 if (_json.containsKey("response")) { | 466 if (_json.containsKey("response")) { |
| 482 response = _json["response"]; | 467 response = _json["response"]; |
| 483 } | 468 } |
| 484 } | 469 } |
| 485 | 470 |
| 486 core.Map<core.String, core.Object> toJson() { | 471 core.Map<core.String, core.Object> toJson() { |
| 487 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 472 final core.Map<core.String, core.Object> _json = |
| 473 new core.Map<core.String, core.Object>(); |
| 488 if (done != null) { | 474 if (done != null) { |
| 489 _json["done"] = done; | 475 _json["done"] = done; |
| 490 } | 476 } |
| 491 if (error != null) { | 477 if (error != null) { |
| 492 _json["error"] = (error).toJson(); | 478 _json["error"] = (error).toJson(); |
| 493 } | 479 } |
| 494 if (metadata != null) { | 480 if (metadata != null) { |
| 495 _json["metadata"] = metadata; | 481 _json["metadata"] = metadata; |
| 496 } | 482 } |
| 497 if (name != null) { | 483 if (name != null) { |
| 498 _json["name"] = name; | 484 _json["name"] = name; |
| 499 } | 485 } |
| 500 if (response != null) { | 486 if (response != null) { |
| 501 _json["response"] = response; | 487 _json["response"] = response; |
| 502 } | 488 } |
| 503 return _json; | 489 return _json; |
| 504 } | 490 } |
| 505 } | 491 } |
| 506 | 492 |
| 507 /** | 493 /// Contains audio data in the encoding specified in the `RecognitionConfig`. |
| 508 * Contains audio data in the encoding specified in the `RecognitionConfig`. | 494 /// Either `content` or `uri` must be supplied. Supplying both or neither |
| 509 * Either `content` or `uri` must be supplied. Supplying both or neither | 495 /// returns google.rpc.Code.INVALID_ARGUMENT. See |
| 510 * returns google.rpc.Code.INVALID_ARGUMENT. See | 496 /// [audio limits](https://cloud.google.com/speech/limits#content). |
| 511 * [audio limits](https://cloud.google.com/speech/limits#content). | |
| 512 */ | |
| 513 class RecognitionAudio { | 497 class RecognitionAudio { |
| 514 /** | 498 /// The audio data bytes encoded as specified in |
| 515 * The audio data bytes encoded as specified in | 499 /// `RecognitionConfig`. Note: as with all bytes fields, protobuffers use a |
| 516 * `RecognitionConfig`. Note: as with all bytes fields, protobuffers use a | 500 /// pure binary representation, whereas JSON representations use base64. |
| 517 * pure binary representation, whereas JSON representations use base64. | |
| 518 */ | |
| 519 core.String content; | 501 core.String content; |
| 520 core.List<core.int> get contentAsBytes { | 502 core.List<core.int> get contentAsBytes { |
| 521 return convert.BASE64.decode(content); | 503 return convert.BASE64.decode(content); |
| 522 } | 504 } |
| 523 | 505 |
| 524 void set contentAsBytes(core.List<core.int> _bytes) { | 506 void set contentAsBytes(core.List<core.int> _bytes) { |
| 525 content = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll("+",
"-"); | 507 content = |
| 508 convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll("+", "-"); |
| 526 } | 509 } |
| 527 /** | 510 |
| 528 * URI that points to a file that contains audio data bytes as specified in | 511 /// URI that points to a file that contains audio data bytes as specified in |
| 529 * `RecognitionConfig`. Currently, only Google Cloud Storage URIs are | 512 /// `RecognitionConfig`. Currently, only Google Cloud Storage URIs are |
| 530 * supported, which must be specified in the following format: | 513 /// supported, which must be specified in the following format: |
| 531 * `gs://bucket_name/object_name` (other URI formats return | 514 /// `gs://bucket_name/object_name` (other URI formats return |
| 532 * google.rpc.Code.INVALID_ARGUMENT). For more information, see | 515 /// google.rpc.Code.INVALID_ARGUMENT). For more information, see |
| 533 * [Request URIs](https://cloud.google.com/storage/docs/reference-uris). | 516 /// [Request URIs](https://cloud.google.com/storage/docs/reference-uris). |
| 534 */ | |
| 535 core.String uri; | 517 core.String uri; |
| 536 | 518 |
| 537 RecognitionAudio(); | 519 RecognitionAudio(); |
| 538 | 520 |
| 539 RecognitionAudio.fromJson(core.Map _json) { | 521 RecognitionAudio.fromJson(core.Map _json) { |
| 540 if (_json.containsKey("content")) { | 522 if (_json.containsKey("content")) { |
| 541 content = _json["content"]; | 523 content = _json["content"]; |
| 542 } | 524 } |
| 543 if (_json.containsKey("uri")) { | 525 if (_json.containsKey("uri")) { |
| 544 uri = _json["uri"]; | 526 uri = _json["uri"]; |
| 545 } | 527 } |
| 546 } | 528 } |
| 547 | 529 |
| 548 core.Map<core.String, core.Object> toJson() { | 530 core.Map<core.String, core.Object> toJson() { |
| 549 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 531 final core.Map<core.String, core.Object> _json = |
| 532 new core.Map<core.String, core.Object>(); |
| 550 if (content != null) { | 533 if (content != null) { |
| 551 _json["content"] = content; | 534 _json["content"] = content; |
| 552 } | 535 } |
| 553 if (uri != null) { | 536 if (uri != null) { |
| 554 _json["uri"] = uri; | 537 _json["uri"] = uri; |
| 555 } | 538 } |
| 556 return _json; | 539 return _json; |
| 557 } | 540 } |
| 558 } | 541 } |
| 559 | 542 |
| 560 /** | 543 /// Provides information to the recognizer that specifies how to process the |
| 561 * Provides information to the recognizer that specifies how to process the | 544 /// request. |
| 562 * request. | |
| 563 */ | |
| 564 class RecognitionConfig { | 545 class RecognitionConfig { |
| 565 /** | 546 /// *Required* Encoding of audio data sent in all `RecognitionAudio` |
| 566 * *Required* Encoding of audio data sent in all `RecognitionAudio` messages. | 547 /// messages. |
| 567 * Possible string values are: | 548 /// Possible string values are: |
| 568 * - "ENCODING_UNSPECIFIED" : Not specified. Will return result | 549 /// - "ENCODING_UNSPECIFIED" : Not specified. Will return result |
| 569 * google.rpc.Code.INVALID_ARGUMENT. | 550 /// google.rpc.Code.INVALID_ARGUMENT. |
| 570 * - "LINEAR16" : Uncompressed 16-bit signed little-endian samples (Linear | 551 /// - "LINEAR16" : Uncompressed 16-bit signed little-endian samples (Linear |
| 571 * PCM). | 552 /// PCM). |
| 572 * This is the only encoding that may be used by `AsyncRecognize`. | 553 /// This is the only encoding that may be used by `AsyncRecognize`. |
| 573 * - "FLAC" : This is the recommended encoding for `SyncRecognize` and | 554 /// - "FLAC" : This is the recommended encoding for `SyncRecognize` and |
| 574 * `StreamingRecognize` because it uses lossless compression; therefore | 555 /// `StreamingRecognize` because it uses lossless compression; therefore |
| 575 * recognition accuracy is not compromised by a lossy codec. | 556 /// recognition accuracy is not compromised by a lossy codec. |
| 576 * | 557 /// |
| 577 * The stream FLAC (Free Lossless Audio Codec) encoding is specified at: | 558 /// The stream FLAC (Free Lossless Audio Codec) encoding is specified at: |
| 578 * http://flac.sourceforge.net/documentation.html. | 559 /// http://flac.sourceforge.net/documentation.html. |
| 579 * 16-bit and 24-bit samples are supported. | 560 /// 16-bit and 24-bit samples are supported. |
| 580 * Not all fields in STREAMINFO are supported. | 561 /// Not all fields in STREAMINFO are supported. |
| 581 * - "MULAW" : 8-bit samples that compand 14-bit audio samples using G.711 | 562 /// - "MULAW" : 8-bit samples that compand 14-bit audio samples using G.711 |
| 582 * PCMU/mu-law. | 563 /// PCMU/mu-law. |
| 583 * - "AMR" : Adaptive Multi-Rate Narrowband codec. `sample_rate` must be 8000 | 564 /// - "AMR" : Adaptive Multi-Rate Narrowband codec. `sample_rate` must be |
| 584 * Hz. | 565 /// 8000 Hz. |
| 585 * - "AMR_WB" : Adaptive Multi-Rate Wideband codec. `sample_rate` must be | 566 /// - "AMR_WB" : Adaptive Multi-Rate Wideband codec. `sample_rate` must be |
| 586 * 16000 Hz. | 567 /// 16000 Hz. |
| 587 */ | |
| 588 core.String encoding; | 568 core.String encoding; |
| 589 /** | 569 |
| 590 * *Optional* The language of the supplied audio as a BCP-47 language tag. | 570 /// *Optional* The language of the supplied audio as a BCP-47 language tag. |
| 591 * Example: "en-GB" https://www.rfc-editor.org/rfc/bcp/bcp47.txt | 571 /// Example: "en-GB" https://www.rfc-editor.org/rfc/bcp/bcp47.txt |
| 592 * If omitted, defaults to "en-US". See | 572 /// If omitted, defaults to "en-US". See |
| 593 * [Language Support](https://cloud.google.com/speech/docs/languages) | 573 /// [Language Support](https://cloud.google.com/speech/docs/languages) |
| 594 * for a list of the currently supported language codes. | 574 /// for a list of the currently supported language codes. |
| 595 */ | |
| 596 core.String languageCode; | 575 core.String languageCode; |
| 597 /** | 576 |
| 598 * *Optional* Maximum number of recognition hypotheses to be returned. | 577 /// *Optional* Maximum number of recognition hypotheses to be returned. |
| 599 * Specifically, the maximum number of `SpeechRecognitionAlternative` messages | 578 /// Specifically, the maximum number of `SpeechRecognitionAlternative` |
| 600 * within each `SpeechRecognitionResult`. | 579 /// messages |
| 601 * The server may return fewer than `max_alternatives`. | 580 /// within each `SpeechRecognitionResult`. |
| 602 * Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of | 581 /// The server may return fewer than `max_alternatives`. |
| 603 * one. If omitted, will return a maximum of one. | 582 /// Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of |
| 604 */ | 583 /// one. If omitted, will return a maximum of one. |
| 605 core.int maxAlternatives; | 584 core.int maxAlternatives; |
| 606 /** | 585 |
| 607 * *Optional* If set to `true`, the server will attempt to filter out | 586 /// *Optional* If set to `true`, the server will attempt to filter out |
| 608 * profanities, replacing all but the initial character in each filtered word | 587 /// profanities, replacing all but the initial character in each filtered |
| 609 * with asterisks, e.g. "f***". If set to `false` or omitted, profanities | 588 /// word |
| 610 * won't be filtered out. | 589 /// with asterisks, e.g. "f***". If set to `false` or omitted, profanities |
| 611 */ | 590 /// won't be filtered out. |
| 612 core.bool profanityFilter; | 591 core.bool profanityFilter; |
| 613 /** | 592 |
| 614 * *Required* Sample rate in Hertz of the audio data sent in all | 593 /// *Required* Sample rate in Hertz of the audio data sent in all |
| 615 * `RecognitionAudio` messages. Valid values are: 8000-48000. | 594 /// `RecognitionAudio` messages. Valid values are: 8000-48000. |
| 616 * 16000 is optimal. For best results, set the sampling rate of the audio | 595 /// 16000 is optimal. For best results, set the sampling rate of the audio |
| 617 * source to 16000 Hz. If that's not possible, use the native sample rate of | 596 /// source to 16000 Hz. If that's not possible, use the native sample rate of |
| 618 * the audio source (instead of re-sampling). | 597 /// the audio source (instead of re-sampling). |
| 619 */ | |
| 620 core.int sampleRate; | 598 core.int sampleRate; |
| 621 /** | 599 |
| 622 * *Optional* A means to provide context to assist the speech recognition. | 600 /// *Optional* A means to provide context to assist the speech recognition. |
| 623 */ | |
| 624 SpeechContext speechContext; | 601 SpeechContext speechContext; |
| 625 | 602 |
| 626 RecognitionConfig(); | 603 RecognitionConfig(); |
| 627 | 604 |
| 628 RecognitionConfig.fromJson(core.Map _json) { | 605 RecognitionConfig.fromJson(core.Map _json) { |
| 629 if (_json.containsKey("encoding")) { | 606 if (_json.containsKey("encoding")) { |
| 630 encoding = _json["encoding"]; | 607 encoding = _json["encoding"]; |
| 631 } | 608 } |
| 632 if (_json.containsKey("languageCode")) { | 609 if (_json.containsKey("languageCode")) { |
| 633 languageCode = _json["languageCode"]; | 610 languageCode = _json["languageCode"]; |
| 634 } | 611 } |
| 635 if (_json.containsKey("maxAlternatives")) { | 612 if (_json.containsKey("maxAlternatives")) { |
| 636 maxAlternatives = _json["maxAlternatives"]; | 613 maxAlternatives = _json["maxAlternatives"]; |
| 637 } | 614 } |
| 638 if (_json.containsKey("profanityFilter")) { | 615 if (_json.containsKey("profanityFilter")) { |
| 639 profanityFilter = _json["profanityFilter"]; | 616 profanityFilter = _json["profanityFilter"]; |
| 640 } | 617 } |
| 641 if (_json.containsKey("sampleRate")) { | 618 if (_json.containsKey("sampleRate")) { |
| 642 sampleRate = _json["sampleRate"]; | 619 sampleRate = _json["sampleRate"]; |
| 643 } | 620 } |
| 644 if (_json.containsKey("speechContext")) { | 621 if (_json.containsKey("speechContext")) { |
| 645 speechContext = new SpeechContext.fromJson(_json["speechContext"]); | 622 speechContext = new SpeechContext.fromJson(_json["speechContext"]); |
| 646 } | 623 } |
| 647 } | 624 } |
| 648 | 625 |
| 649 core.Map<core.String, core.Object> toJson() { | 626 core.Map<core.String, core.Object> toJson() { |
| 650 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 627 final core.Map<core.String, core.Object> _json = |
| 628 new core.Map<core.String, core.Object>(); |
| 651 if (encoding != null) { | 629 if (encoding != null) { |
| 652 _json["encoding"] = encoding; | 630 _json["encoding"] = encoding; |
| 653 } | 631 } |
| 654 if (languageCode != null) { | 632 if (languageCode != null) { |
| 655 _json["languageCode"] = languageCode; | 633 _json["languageCode"] = languageCode; |
| 656 } | 634 } |
| 657 if (maxAlternatives != null) { | 635 if (maxAlternatives != null) { |
| 658 _json["maxAlternatives"] = maxAlternatives; | 636 _json["maxAlternatives"] = maxAlternatives; |
| 659 } | 637 } |
| 660 if (profanityFilter != null) { | 638 if (profanityFilter != null) { |
| 661 _json["profanityFilter"] = profanityFilter; | 639 _json["profanityFilter"] = profanityFilter; |
| 662 } | 640 } |
| 663 if (sampleRate != null) { | 641 if (sampleRate != null) { |
| 664 _json["sampleRate"] = sampleRate; | 642 _json["sampleRate"] = sampleRate; |
| 665 } | 643 } |
| 666 if (speechContext != null) { | 644 if (speechContext != null) { |
| 667 _json["speechContext"] = (speechContext).toJson(); | 645 _json["speechContext"] = (speechContext).toJson(); |
| 668 } | 646 } |
| 669 return _json; | 647 return _json; |
| 670 } | 648 } |
| 671 } | 649 } |
| 672 | 650 |
| 673 /** | 651 /// Provides "hints" to the speech recognizer to favor specific words and |
| 674 * Provides "hints" to the speech recognizer to favor specific words and phrases | 652 /// phrases |
| 675 * in the results. | 653 /// in the results. |
| 676 */ | |
| 677 class SpeechContext { | 654 class SpeechContext { |
| 678 /** | 655 /// *Optional* A list of strings containing words and phrases "hints" so that |
| 679 * *Optional* A list of strings containing words and phrases "hints" so that | 656 /// the speech recognition is more likely to recognize them. This can be used |
| 680 * the speech recognition is more likely to recognize them. This can be used | 657 /// to improve the accuracy for specific words and phrases, for example, if |
| 681 * to improve the accuracy for specific words and phrases, for example, if | 658 /// specific commands are typically spoken by the user. This can also be used |
| 682 * specific commands are typically spoken by the user. This can also be used | 659 /// to add additional words to the vocabulary of the recognizer. See |
| 683 * to add additional words to the vocabulary of the recognizer. See | 660 /// [usage limits](https://cloud.google.com/speech/limits#content). |
| 684 * [usage limits](https://cloud.google.com/speech/limits#content). | |
| 685 */ | |
| 686 core.List<core.String> phrases; | 661 core.List<core.String> phrases; |
| 687 | 662 |
| 688 SpeechContext(); | 663 SpeechContext(); |
| 689 | 664 |
| 690 SpeechContext.fromJson(core.Map _json) { | 665 SpeechContext.fromJson(core.Map _json) { |
| 691 if (_json.containsKey("phrases")) { | 666 if (_json.containsKey("phrases")) { |
| 692 phrases = _json["phrases"]; | 667 phrases = _json["phrases"]; |
| 693 } | 668 } |
| 694 } | 669 } |
| 695 | 670 |
| 696 core.Map<core.String, core.Object> toJson() { | 671 core.Map<core.String, core.Object> toJson() { |
| 697 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 672 final core.Map<core.String, core.Object> _json = |
| 673 new core.Map<core.String, core.Object>(); |
| 698 if (phrases != null) { | 674 if (phrases != null) { |
| 699 _json["phrases"] = phrases; | 675 _json["phrases"] = phrases; |
| 700 } | 676 } |
| 701 return _json; | 677 return _json; |
| 702 } | 678 } |
| 703 } | 679 } |
| 704 | 680 |
| 705 /** Alternative hypotheses (a.k.a. n-best list). */ | 681 /// Alternative hypotheses (a.k.a. n-best list). |
| 706 class SpeechRecognitionAlternative { | 682 class SpeechRecognitionAlternative { |
| 707 /** | 683 /// *Output-only* The confidence estimate between 0.0 and 1.0. A higher |
| 708 * *Output-only* The confidence estimate between 0.0 and 1.0. A higher number | 684 /// number |
| 709 * indicates an estimated greater likelihood that the recognized words are | 685 /// indicates an estimated greater likelihood that the recognized words are |
| 710 * correct. This field is typically provided only for the top hypothesis, and | 686 /// correct. This field is typically provided only for the top hypothesis, |
| 711 * only for `is_final=true` results. Clients should not rely on the | 687 /// and |
| 712 * `confidence` field as it is not guaranteed to be accurate, or even set, in | 688 /// only for `is_final=true` results. Clients should not rely on the |
| 713 * any of the results. | 689 /// `confidence` field as it is not guaranteed to be accurate, or even set, |
| 714 * The default of 0.0 is a sentinel value indicating `confidence` was not set. | 690 /// in |
| 715 */ | 691 /// any of the results. |
| 692 /// The default of 0.0 is a sentinel value indicating `confidence` was not |
| 693 /// set. |
| 716 core.double confidence; | 694 core.double confidence; |
| 717 /** | 695 |
| 718 * *Output-only* Transcript text representing the words that the user spoke. | 696 /// *Output-only* Transcript text representing the words that the user spoke. |
| 719 */ | |
| 720 core.String transcript; | 697 core.String transcript; |
| 721 | 698 |
| 722 SpeechRecognitionAlternative(); | 699 SpeechRecognitionAlternative(); |
| 723 | 700 |
| 724 SpeechRecognitionAlternative.fromJson(core.Map _json) { | 701 SpeechRecognitionAlternative.fromJson(core.Map _json) { |
| 725 if (_json.containsKey("confidence")) { | 702 if (_json.containsKey("confidence")) { |
| 726 confidence = _json["confidence"]; | 703 confidence = _json["confidence"]; |
| 727 } | 704 } |
| 728 if (_json.containsKey("transcript")) { | 705 if (_json.containsKey("transcript")) { |
| 729 transcript = _json["transcript"]; | 706 transcript = _json["transcript"]; |
| 730 } | 707 } |
| 731 } | 708 } |
| 732 | 709 |
| 733 core.Map<core.String, core.Object> toJson() { | 710 core.Map<core.String, core.Object> toJson() { |
| 734 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 711 final core.Map<core.String, core.Object> _json = |
| 712 new core.Map<core.String, core.Object>(); |
| 735 if (confidence != null) { | 713 if (confidence != null) { |
| 736 _json["confidence"] = confidence; | 714 _json["confidence"] = confidence; |
| 737 } | 715 } |
| 738 if (transcript != null) { | 716 if (transcript != null) { |
| 739 _json["transcript"] = transcript; | 717 _json["transcript"] = transcript; |
| 740 } | 718 } |
| 741 return _json; | 719 return _json; |
| 742 } | 720 } |
| 743 } | 721 } |
| 744 | 722 |
| 745 /** A speech recognition result corresponding to a portion of the audio. */ | 723 /// A speech recognition result corresponding to a portion of the audio. |
| 746 class SpeechRecognitionResult { | 724 class SpeechRecognitionResult { |
| 747 /** | 725 /// *Output-only* May contain one or more recognition hypotheses (up to the |
| 748 * *Output-only* May contain one or more recognition hypotheses (up to the | 726 /// maximum specified in `max_alternatives`). |
| 749 * maximum specified in `max_alternatives`). | |
| 750 */ | |
| 751 core.List<SpeechRecognitionAlternative> alternatives; | 727 core.List<SpeechRecognitionAlternative> alternatives; |
| 752 | 728 |
| 753 SpeechRecognitionResult(); | 729 SpeechRecognitionResult(); |
| 754 | 730 |
| 755 SpeechRecognitionResult.fromJson(core.Map _json) { | 731 SpeechRecognitionResult.fromJson(core.Map _json) { |
| 756 if (_json.containsKey("alternatives")) { | 732 if (_json.containsKey("alternatives")) { |
| 757 alternatives = _json["alternatives"].map((value) => new SpeechRecognitionA
lternative.fromJson(value)).toList(); | 733 alternatives = _json["alternatives"] |
| 734 .map((value) => new SpeechRecognitionAlternative.fromJson(value)) |
| 735 .toList(); |
| 758 } | 736 } |
| 759 } | 737 } |
| 760 | 738 |
| 761 core.Map<core.String, core.Object> toJson() { | 739 core.Map<core.String, core.Object> toJson() { |
| 762 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 740 final core.Map<core.String, core.Object> _json = |
| 741 new core.Map<core.String, core.Object>(); |
| 763 if (alternatives != null) { | 742 if (alternatives != null) { |
| 764 _json["alternatives"] = alternatives.map((value) => (value).toJson()).toLi
st(); | 743 _json["alternatives"] = |
| 744 alternatives.map((value) => (value).toJson()).toList(); |
| 765 } | 745 } |
| 766 return _json; | 746 return _json; |
| 767 } | 747 } |
| 768 } | 748 } |
| 769 | 749 |
| 770 /** | 750 /// The `Status` type defines a logical error model that is suitable for |
| 771 * The `Status` type defines a logical error model that is suitable for | 751 /// different |
| 772 * different | 752 /// programming environments, including REST APIs and RPC APIs. It is used by |
| 773 * programming environments, including REST APIs and RPC APIs. It is used by | 753 /// [gRPC](https://github.com/grpc). The error model is designed to be: |
| 774 * [gRPC](https://github.com/grpc). The error model is designed to be: | 754 /// |
| 775 * | 755 /// - Simple to use and understand for most users |
| 776 * - Simple to use and understand for most users | 756 /// - Flexible enough to meet unexpected needs |
| 777 * - Flexible enough to meet unexpected needs | 757 /// |
| 778 * | 758 /// # Overview |
| 779 * # Overview | 759 /// |
| 780 * | 760 /// The `Status` message contains three pieces of data: error code, error |
| 781 * The `Status` message contains three pieces of data: error code, error | 761 /// message, |
| 782 * message, | 762 /// and error details. The error code should be an enum value of |
| 783 * and error details. The error code should be an enum value of | 763 /// google.rpc.Code, but it may accept additional error codes if needed. The |
| 784 * google.rpc.Code, but it may accept additional error codes if needed. The | 764 /// error message should be a developer-facing English message that helps |
| 785 * error message should be a developer-facing English message that helps | 765 /// developers *understand* and *resolve* the error. If a localized user-facing |
| 786 * developers *understand* and *resolve* the error. If a localized user-facing | 766 /// error message is needed, put the localized message in the error details or |
| 787 * error message is needed, put the localized message in the error details or | 767 /// localize it in the client. The optional error details may contain arbitrary |
| 788 * localize it in the client. The optional error details may contain arbitrary | 768 /// information about the error. There is a predefined set of error detail |
| 789 * information about the error. There is a predefined set of error detail types | 769 /// types |
| 790 * in the package `google.rpc` that can be used for common error conditions. | 770 /// in the package `google.rpc` that can be used for common error conditions. |
| 791 * | 771 /// |
| 792 * # Language mapping | 772 /// # Language mapping |
| 793 * | 773 /// |
| 794 * The `Status` message is the logical representation of the error model, but it | 774 /// The `Status` message is the logical representation of the error model, but |
| 795 * is not necessarily the actual wire format. When the `Status` message is | 775 /// it |
| 796 * exposed in different client libraries and different wire protocols, it can be | 776 /// is not necessarily the actual wire format. When the `Status` message is |
| 797 * mapped differently. For example, it will likely be mapped to some exceptions | 777 /// exposed in different client libraries and different wire protocols, it can |
| 798 * in Java, but more likely mapped to some error codes in C. | 778 /// be |
| 799 * | 779 /// mapped differently. For example, it will likely be mapped to some |
| 800 * # Other uses | 780 /// exceptions |
| 801 * | 781 /// in Java, but more likely mapped to some error codes in C. |
| 802 * The error model and the `Status` message can be used in a variety of | 782 /// |
| 803 * environments, either with or without APIs, to provide a | 783 /// # Other uses |
| 804 * consistent developer experience across different environments. | 784 /// |
| 805 * | 785 /// The error model and the `Status` message can be used in a variety of |
| 806 * Example uses of this error model include: | 786 /// environments, either with or without APIs, to provide a |
| 807 * | 787 /// consistent developer experience across different environments. |
| 808 * - Partial errors. If a service needs to return partial errors to the client, | 788 /// |
| 809 * it may embed the `Status` in the normal response to indicate the partial | 789 /// Example uses of this error model include: |
| 810 * errors. | 790 /// |
| 811 * | 791 /// - Partial errors. If a service needs to return partial errors to the |
| 812 * - Workflow errors. A typical workflow has multiple steps. Each step may | 792 /// client, |
| 813 * have a `Status` message for error reporting. | 793 /// it may embed the `Status` in the normal response to indicate the partial |
| 814 * | 794 /// errors. |
| 815 * - Batch operations. If a client uses batch request and batch response, the | 795 /// |
| 816 * `Status` message should be used directly inside batch response, one for | 796 /// - Workflow errors. A typical workflow has multiple steps. Each step may |
| 817 * each error sub-response. | 797 /// have a `Status` message for error reporting. |
| 818 * | 798 /// |
| 819 * - Asynchronous operations. If an API call embeds asynchronous operation | 799 /// - Batch operations. If a client uses batch request and batch response, the |
| 820 * results in its response, the status of those operations should be | 800 /// `Status` message should be used directly inside batch response, one for |
| 821 * represented directly using the `Status` message. | 801 /// each error sub-response. |
| 822 * | 802 /// |
| 823 * - Logging. If some API errors are stored in logs, the message `Status` could | 803 /// - Asynchronous operations. If an API call embeds asynchronous operation |
| 824 * be used directly after any stripping needed for security/privacy reasons. | 804 /// results in its response, the status of those operations should be |
| 825 */ | 805 /// represented directly using the `Status` message. |
| 806 /// |
| 807 /// - Logging. If some API errors are stored in logs, the message `Status` |
| 808 /// could |
| 809 /// be used directly after any stripping needed for security/privacy reasons. |
| 826 class Status { | 810 class Status { |
| 827 /** The status code, which should be an enum value of google.rpc.Code. */ | 811 /// The status code, which should be an enum value of google.rpc.Code. |
| 828 core.int code; | 812 core.int code; |
| 829 /** | 813 |
| 830 * A list of messages that carry the error details. There is a common set of | 814 /// A list of messages that carry the error details. There is a common set |
| 831 * message types for APIs to use. | 815 /// of |
| 832 * | 816 /// message types for APIs to use. |
| 833 * The values for Object must be JSON objects. It can consist of `num`, | 817 /// |
| 834 * `String`, `bool` and `null` as well as `Map` and `List` values. | 818 /// The values for Object must be JSON objects. It can consist of `num`, |
| 835 */ | 819 /// `String`, `bool` and `null` as well as `Map` and `List` values. |
| 836 core.List<core.Map<core.String, core.Object>> details; | 820 core.List<core.Map<core.String, core.Object>> details; |
| 837 /** | 821 |
| 838 * A developer-facing error message, which should be in English. Any | 822 /// A developer-facing error message, which should be in English. Any |
| 839 * user-facing error message should be localized and sent in the | 823 /// user-facing error message should be localized and sent in the |
| 840 * google.rpc.Status.details field, or localized by the client. | 824 /// google.rpc.Status.details field, or localized by the client. |
| 841 */ | |
| 842 core.String message; | 825 core.String message; |
| 843 | 826 |
| 844 Status(); | 827 Status(); |
| 845 | 828 |
| 846 Status.fromJson(core.Map _json) { | 829 Status.fromJson(core.Map _json) { |
| 847 if (_json.containsKey("code")) { | 830 if (_json.containsKey("code")) { |
| 848 code = _json["code"]; | 831 code = _json["code"]; |
| 849 } | 832 } |
| 850 if (_json.containsKey("details")) { | 833 if (_json.containsKey("details")) { |
| 851 details = _json["details"]; | 834 details = _json["details"]; |
| 852 } | 835 } |
| 853 if (_json.containsKey("message")) { | 836 if (_json.containsKey("message")) { |
| 854 message = _json["message"]; | 837 message = _json["message"]; |
| 855 } | 838 } |
| 856 } | 839 } |
| 857 | 840 |
| 858 core.Map<core.String, core.Object> toJson() { | 841 core.Map<core.String, core.Object> toJson() { |
| 859 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 842 final core.Map<core.String, core.Object> _json = |
| 843 new core.Map<core.String, core.Object>(); |
| 860 if (code != null) { | 844 if (code != null) { |
| 861 _json["code"] = code; | 845 _json["code"] = code; |
| 862 } | 846 } |
| 863 if (details != null) { | 847 if (details != null) { |
| 864 _json["details"] = details; | 848 _json["details"] = details; |
| 865 } | 849 } |
| 866 if (message != null) { | 850 if (message != null) { |
| 867 _json["message"] = message; | 851 _json["message"] = message; |
| 868 } | 852 } |
| 869 return _json; | 853 return _json; |
| 870 } | 854 } |
| 871 } | 855 } |
| 872 | 856 |
| 873 /** The top-level message sent by the client for the `SyncRecognize` method. */ | 857 /// The top-level message sent by the client for the `SyncRecognize` method. |
| 874 class SyncRecognizeRequest { | 858 class SyncRecognizeRequest { |
| 875 /** *Required* The audio data to be recognized. */ | 859 /// *Required* The audio data to be recognized. |
| 876 RecognitionAudio audio; | 860 RecognitionAudio audio; |
| 877 /** | 861 |
| 878 * *Required* Provides information to the recognizer that specifies how to | 862 /// *Required* Provides information to the recognizer that specifies how to |
| 879 * process the request. | 863 /// process the request. |
| 880 */ | |
| 881 RecognitionConfig config; | 864 RecognitionConfig config; |
| 882 | 865 |
| 883 SyncRecognizeRequest(); | 866 SyncRecognizeRequest(); |
| 884 | 867 |
| 885 SyncRecognizeRequest.fromJson(core.Map _json) { | 868 SyncRecognizeRequest.fromJson(core.Map _json) { |
| 886 if (_json.containsKey("audio")) { | 869 if (_json.containsKey("audio")) { |
| 887 audio = new RecognitionAudio.fromJson(_json["audio"]); | 870 audio = new RecognitionAudio.fromJson(_json["audio"]); |
| 888 } | 871 } |
| 889 if (_json.containsKey("config")) { | 872 if (_json.containsKey("config")) { |
| 890 config = new RecognitionConfig.fromJson(_json["config"]); | 873 config = new RecognitionConfig.fromJson(_json["config"]); |
| 891 } | 874 } |
| 892 } | 875 } |
| 893 | 876 |
| 894 core.Map<core.String, core.Object> toJson() { | 877 core.Map<core.String, core.Object> toJson() { |
| 895 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 878 final core.Map<core.String, core.Object> _json = |
| 879 new core.Map<core.String, core.Object>(); |
| 896 if (audio != null) { | 880 if (audio != null) { |
| 897 _json["audio"] = (audio).toJson(); | 881 _json["audio"] = (audio).toJson(); |
| 898 } | 882 } |
| 899 if (config != null) { | 883 if (config != null) { |
| 900 _json["config"] = (config).toJson(); | 884 _json["config"] = (config).toJson(); |
| 901 } | 885 } |
| 902 return _json; | 886 return _json; |
| 903 } | 887 } |
| 904 } | 888 } |
| 905 | 889 |
| 906 /** | 890 /// The only message returned to the client by `SyncRecognize`. method. It |
| 907 * The only message returned to the client by `SyncRecognize`. method. It | 891 /// contains the result as zero or more sequential `SpeechRecognitionResult` |
| 908 * contains the result as zero or more sequential `SpeechRecognitionResult` | 892 /// messages. |
| 909 * messages. | |
| 910 */ | |
| 911 class SyncRecognizeResponse { | 893 class SyncRecognizeResponse { |
| 912 /** | 894 /// *Output-only* Sequential list of transcription results corresponding to |
| 913 * *Output-only* Sequential list of transcription results corresponding to | 895 /// sequential portions of audio. |
| 914 * sequential portions of audio. | |
| 915 */ | |
| 916 core.List<SpeechRecognitionResult> results; | 896 core.List<SpeechRecognitionResult> results; |
| 917 | 897 |
| 918 SyncRecognizeResponse(); | 898 SyncRecognizeResponse(); |
| 919 | 899 |
| 920 SyncRecognizeResponse.fromJson(core.Map _json) { | 900 SyncRecognizeResponse.fromJson(core.Map _json) { |
| 921 if (_json.containsKey("results")) { | 901 if (_json.containsKey("results")) { |
| 922 results = _json["results"].map((value) => new SpeechRecognitionResult.from
Json(value)).toList(); | 902 results = _json["results"] |
| 903 .map((value) => new SpeechRecognitionResult.fromJson(value)) |
| 904 .toList(); |
| 923 } | 905 } |
| 924 } | 906 } |
| 925 | 907 |
| 926 core.Map<core.String, core.Object> toJson() { | 908 core.Map<core.String, core.Object> toJson() { |
| 927 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 909 final core.Map<core.String, core.Object> _json = |
| 910 new core.Map<core.String, core.Object>(); |
| 928 if (results != null) { | 911 if (results != null) { |
| 929 _json["results"] = results.map((value) => (value).toJson()).toList(); | 912 _json["results"] = results.map((value) => (value).toJson()).toList(); |
| 930 } | 913 } |
| 931 return _json; | 914 return _json; |
| 932 } | 915 } |
| 933 } | 916 } |
| OLD | NEW |