list method Null safety

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. E.g. when specifying "en-NZ", you will get supported "en-NZ" voices; when specifying "no", you will get supported "no-*" (Norwegian) and "nb-*" (Norwegian Bokmal) voices; specifying "zh" will also get supported "cmn-*" voices; specifying "zh-hk" will also get supported "yue-hk" voices.

$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>);
}