patch method

Future<GoogleCloudRetailV2Product> patch(
  1. GoogleCloudRetailV2Product request,
  2. String name, {
  3. bool? allowMissing,
  4. String? updateMask,
  5. String? $fields,
})

Updates a Product.

request - The metadata request object.

Request parameters:

name - Immutable. Full resource name of the product, such as projects / * /locations/global/catalogs/default_catalog/branches/default_branch/products/product_id. Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/catalogs/\[^/\]+/branches/\[^/\]+/products/.*$.

allowMissing - If set to true, and the Product is not found, a new Product will be created. In this situation, update_mask is ignored.

updateMask - Indicates which fields in the provided Product to update. The immutable and output only fields are NOT supported. If not set, all supported fields (the fields that are neither immutable nor output only) are updated. If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned. The attribute key can be updated by setting the mask path as "attributes.${key_name}". If a key name is present in the mask but not in the patching product from the request, this key will be deleted after the update.

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

Completes with a GoogleCloudRetailV2Product.

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

  final url_ = 'v2/' + core.Uri.encodeFull('$name');

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