list method

Future<ListGroupsResponse> list({
  1. String? id,
  2. bool? mine,
  3. String? onBehalfOfContentOwner,
  4. String? pageToken,
  5. String? $fields,
})

Returns a collection of groups that match the API request parameters.

For example, you can retrieve all groups that the authenticated user owns, or you can retrieve one or more groups by their unique IDs.

Request parameters:

id - The id parameter specifies a comma-separated list of the YouTube group ID(s) for the resource(s) that are being retrieved. Each group must be owned by the authenticated user. In a group resource, the id property specifies the group's YouTube group ID. Note that if you do not specify a value for the id parameter, then you must set the mine parameter to true.

mine - This parameter can only be used in a properly authorized request. Set this parameter's value to true to retrieve all groups owned by the authenticated user.

onBehalfOfContentOwner - This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners that own and manage many different YouTube channels. The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the content owner specified in the parameter value. 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 account that the user authenticates with must be linked to the specified YouTube content owner.

pageToken - The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken property identifies the next page that can be retrieved.

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

Completes with a ListGroupsResponse.

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

  const url_ = 'v2/groups';

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