patch method

Future<Creative> patch(
  1. Creative request,
  2. String advertiserId,
  3. String creativeId, {
  4. String? updateMask,
  5. String? $fields,
})

Updates an existing creative.

Returns the updated creative if successful. A ["Standard" user role](//support.google.com/displayvideo/answer/2723011) or greater for the parent advertiser or partner is required to make this request.

request - The metadata request object.

Request parameters:

advertiserId - Output only. The unique ID of the advertiser the creative belongs to. Value must have pattern ^\[^/\]+$.

creativeId - Output only. The unique ID of the creative. Assigned by the system. Value must have pattern ^\[^/\]+$.

updateMask - Required. The mask to control which fields to update.

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

Completes with a Creative.

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<Creative> patch(
  Creative request,
  core.String advertiserId,
  core.String creativeId, {
  core.String? updateMask,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (updateMask != null) 'updateMask': [updateMask],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v2/advertisers/' +
      core.Uri.encodeFull('$advertiserId') +
      '/creatives/' +
      core.Uri.encodeFull('$creativeId');

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