patch method

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

Updates an existing line item.

Returns the updated line item if successful. Requests to this endpoint cannot be made concurrently with the following requests updating the same line item: * BulkEditAssignedTargetingOptions * BulkUpdateLineItems * assignedTargetingOptions.create * assignedTargetingOptions.delete YouTube & Partners line items cannot be created or updated using the API. This method regularly experiences high latency. We recommend [increasing your default timeout](/display-video/api/guides/best-practices/timeouts#client_library_timeout) to avoid errors.

request - The metadata request object.

Request parameters:

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

lineItemId - Output only. The unique ID of the line item. 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 LineItem.

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<LineItem> patch(
  LineItem request,
  core.String advertiserId,
  core.String lineItemId, {
  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') +
      '/lineItems/' +
      core.Uri.encodeFull('$lineItemId');

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