update method

Future<ThirdPartyLink> update(
  1. ThirdPartyLink request,
  2. List<String> part, {
  3. String? externalChannelId,
  4. String? $fields,
})

Updates an existing resource.

request - The metadata request object.

Request parameters:

part - The part parameter specifies the thirdPartyLink resource parts that the API request and response will include. Supported values are linkingToken, status, and snippet.

externalChannelId - Channel ID to which changes should be applied, for delegation.

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

Completes with a ThirdPartyLink.

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<ThirdPartyLink> update(
  ThirdPartyLink request,
  core.List<core.String> part, {
  core.String? externalChannelId,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  if (part.isEmpty) {
    throw core.ArgumentError('Parameter part cannot be empty.');
  }
  final queryParams_ = <core.String, core.List<core.String>>{
    'part': part,
    if (externalChannelId != null) 'externalChannelId': [externalChannelId],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'youtube/v3/thirdPartyLinks';

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