updateAttributesConfig method

Future<GoogleCloudRetailV2AttributesConfig> updateAttributesConfig(
  1. GoogleCloudRetailV2AttributesConfig request,
  2. String name, {
  3. String? updateMask,
  4. String? $fields,
})

Updates the AttributesConfig.

The catalog attributes in the request will be updated in the catalog, or inserted if they do not exist. Existing catalog attributes not included in the request will remain unchanged. Attributes that are assigned to products, but do not exist at the catalog level, are always included in the response. The product attribute is assigned default values for missing catalog attribute fields, e.g., searchable and dynamic facetable options.

request - The metadata request object.

Request parameters:

name - Required. Immutable. The fully qualified resource name of the attribute config. Format: projects / * /locations / * /catalogs / * /attributesConfig Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/catalogs/\[^/\]+/attributesConfig$.

updateMask - Indicates which fields in the provided AttributesConfig to update. The following is the only supported field: * AttributesConfig.catalog_attributes If not set, all supported fields are updated.

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

Completes with a GoogleCloudRetailV2AttributesConfig.

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<GoogleCloudRetailV2AttributesConfig> updateAttributesConfig(
  GoogleCloudRetailV2AttributesConfig request,
  core.String name, {
  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/' + core.Uri.encodeFull('$name');

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