patch method

Future<RepricingRule> patch(
  1. RepricingRule request,
  2. String merchantId,
  3. String ruleId, {
  4. String? $fields,
})

Updates a repricing rule in your Merchant Center account.

All mutable fields will be overwritten in each update request. In each update, you must provide all required mutable fields, or an error will be thrown. If you do not provide an optional field in the update request, if that field currently exists, it will be deleted from the rule.

request - The metadata request object.

Request parameters:

merchantId - Required. The id of the merchant who owns the repricing rule.

ruleId - Required. The id of the rule to update.

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

Completes with a RepricingRule.

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

  final url_ = commons.escapeVariable('$merchantId') +
      '/repricingrules/' +
      commons.escapeVariable('$ruleId');

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