list method

Future<CommentListResponse> list(
  1. List<String> part, {
  2. List<String>? id,
  3. int? maxResults,
  4. String? pageToken,
  5. String? parentId,
  6. String? textFormat,
  7. String? $fields,
})

Retrieves a list of resources, possibly filtered.

Request parameters:

part - The part parameter specifies a comma-separated list of one or more comment resource properties that the API response will include.

id - Returns the comments with the given IDs for One Platform.

maxResults - The maxResults parameter specifies the maximum number of items that should be returned in the result set. Value must be between "1" and "100".

pageToken - The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved.

parentId - Returns replies to the specified comment. Note, currently YouTube features only one level of replies (ie replies to top level comments). However replies to replies may be supported in the future.

textFormat - The requested text format for the returned comments. Possible string values are:

  • "textFormatUnspecified"
  • "html" : Returns the comments in HTML format. This is the default value.
  • "plainText" : Returns the comments in plain text format.

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

Completes with a CommentListResponse.

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<CommentListResponse> list(
  core.List<core.String> part, {
  core.List<core.String>? id,
  core.int? maxResults,
  core.String? pageToken,
  core.String? parentId,
  core.String? textFormat,
  core.String? $fields,
}) async {
  if (part.isEmpty) {
    throw core.ArgumentError('Parameter part cannot be empty.');
  }
  final queryParams_ = <core.String, core.List<core.String>>{
    'part': part,
    if (id != null) 'id': id,
    if (maxResults != null) 'maxResults': ['${maxResults}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if (parentId != null) 'parentId': [parentId],
    if (textFormat != null) 'textFormat': [textFormat],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'youtube/v3/comments';

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