list method

Future<ListVoicesResponse> list({
  1. String? languageCode,
  2. String? $fields,
})

Returns a list of Voice supported for synthesis.

Request parameters:

languageCode - Optional. Recommended. [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If not specified, the API will return all supported voices. If specified, the ListVoices call will only return voices that can be used to synthesize this language_code. For example, if you specify "en-NZ", all "en-NZ" voices will be returned. If you specify "no", both "no-\*" (Norwegian) and "nb-\*" (Norwegian Bokmal) voices will be returned.

$fields - Selector specifying which fields to include in a partial response.

Completes with a ListVoicesResponse.

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<ListVoicesResponse> list({
  core.String? languageCode,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (languageCode != null) 'languageCode': [languageCode],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'v1/voices';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return ListVoicesResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}