batchTranslateText method
- BatchTranslateTextRequest request,
- String parent, {
- String? $fields,
Translates a large volume of text in asynchronous batch mode.
This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
request
- The metadata request object.
Request parameters:
parent
- Required. Location to make a call. Must refer to a caller's
project. Format:
projects/{project-number-or-id}/locations/{location-id}
. The global
location is not supported for batch translation. Only AutoML Translation
models or glossaries within the same region (have the same location-id)
can be used, otherwise an INVALID_ARGUMENT (400) error is returned.
Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+$
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Operation.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<Operation> batchTranslateText(
BatchTranslateTextRequest request,
core.String parent, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v3/' + core.Uri.encodeFull('$parent') + ':batchTranslateText';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Operation.fromJson(response_ as core.Map<core.String, core.dynamic>);
}