addControl method
- GoogleCloudRetailV2AddControlRequest request,
- String servingConfig, {
- String? $fields,
Enables a Control on the specified ServingConfig.
The control is added in the last position of the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum number of control allowed for that type of control.
request
- The metadata request object.
Request parameters:
servingConfig
- Required. The source ServingConfig resource name .
Format:
projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
Value must have pattern
^projects/\[^/\]+/locations/\[^/\]+/catalogs/\[^/\]+/servingConfigs/\[^/\]+$
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a GoogleCloudRetailV2ServingConfig.
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<GoogleCloudRetailV2ServingConfig> addControl(
GoogleCloudRetailV2AddControlRequest request,
core.String servingConfig, {
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_ = 'v2/' + core.Uri.encodeFull('$servingConfig') + ':addControl';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return GoogleCloudRetailV2ServingConfig.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}