patch method
- ProductInput request,
- String name, {
- String? dataSource,
- String? updateMask,
- String? $fields,
Updates the existing product input in your Merchant Center account.
After inserting, updating, or deleting a product input, it may take several minutes before the processed product can be retrieved.
request
- The metadata request object.
Request parameters:
name
- Identifier. The name of the product input. Format:
accounts/{account}/productInputs/{productinput}
where the last section
productinput
consists of: content_language~feed_label~offer_id
example
for product input name is accounts/123/productInputs/en~US~sku123
. A
legacy local product input name would be
accounts/123/productInputs/local~en~US~sku123
. Note: For calls to the
v1beta version, the productInput
section consists of:
channel~content_language~feed_label~offer_id
, for example:
accounts/123/productInputs/online~en~US~sku123
.
Value must have pattern ^accounts/\[^/\]+/productInputs/\[^/\]+$
.
dataSource
- Required. The primary or supplemental product data source
where data_source
name identifies the product input to be updated. Only
API data sources are supported. Format:
accounts/{account}/dataSources/{datasource}
. For example,
accounts/123456/dataSources/104628
.
updateMask
- Optional. The list of product attributes to be updated. If
the update mask is omitted, then it is treated as implied field mask
equivalent to all fields that are populated (have a non-empty value).
Attributes specified in the update mask without a value specified in the
body will be deleted from the product. Update mask can only be specified
for top level fields in attributes and custom attributes. To specify the
update mask for custom attributes you need to add the custom_attribute.
prefix. Providing special "*" value for full product replacement is not
supported.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a ProductInput.
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<ProductInput> patch(
ProductInput request,
core.String name, {
core.String? dataSource,
core.String? updateMask,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (dataSource != null) 'dataSource': [dataSource],
if (updateMask != null) 'updateMask': [updateMask],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'products/v1/' + core.Uri.encodeFull('$name');
final response_ = await _requester.request(
url_,
'PATCH',
body: body_,
queryParams: queryParams_,
);
return ProductInput.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}