download method

Future<Media?> download(
  1. String id, {
  2. String? onBehalfOf,
  3. String? onBehalfOfContentOwner,
  4. String? tfmt,
  5. String? tlang,
  6. String? $fields,
  7. DownloadOptions downloadOptions = commons.DownloadOptions.metadata,
})

Downloads a caption track.

Request parameters:

id - The ID of the caption track to download, required for One Platform.

onBehalfOf - ID of the Google+ Page for the channel that the request is be on behalf of

onBehalfOfContentOwner - Note: This parameter is intended exclusively for YouTube content partners. The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner.

tfmt - Convert the captions into this format. Supported options are sbv, srt, and vtt.

tlang - tlang is the language code; machine translate the captions into this language.

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

downloadOptions - Options for downloading. A download can be either a Metadata (default) or Media download. Partial Media downloads are possible as well.

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<commons.Media?> download(
  core.String id, {
  core.String? onBehalfOf,
  core.String? onBehalfOfContentOwner,
  core.String? tfmt,
  core.String? tlang,
  core.String? $fields,
  commons.DownloadOptions downloadOptions = commons.DownloadOptions.metadata,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (onBehalfOf != null) 'onBehalfOf': [onBehalfOf],
    if (onBehalfOfContentOwner != null)
      'onBehalfOfContentOwner': [onBehalfOfContentOwner],
    if (tfmt != null) 'tfmt': [tfmt],
    if (tlang != null) 'tlang': [tlang],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'youtube/v3/captions/' + commons.escapeVariable('$id');

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
    downloadOptions: downloadOptions,
  );
  if (downloadOptions.isMetadataDownload) {
    return null;
  } else {
    return response_ as commons.Media;
  }
}