Retail v2 API - Class ServingConfigServiceClient (2.5.0)

public abstract class ServingConfigServiceClient

Reference documentation and code samples for the Retail v2 API class ServingConfigServiceClient.

ServingConfigService client wrapper, for convenient use.

Inheritance

object > ServingConfigServiceClient

Namespace

GoogleCloudGoogle.Cloud.RetailV2

Assembly

Google.Cloud.Retail.V2.dll

Remarks

Service for modifying ServingConfig.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the ServingConfigService service, which is a host of "retail.googleapis.com" and a port of 443.

Property Value
TypeDescription
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default ServingConfigService scopes.

Property Value
TypeDescription
IReadOnlyListstring
Remarks

The default ServingConfigService scopes are:

GrpcClient

public virtual ServingConfigService.ServingConfigServiceClient GrpcClient { get; }

The underlying gRPC ServingConfigService client

Property Value
TypeDescription
ServingConfigServiceServingConfigServiceClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
TypeDescription
LocationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

Methods

AddControl(AddControlRequest, CallSettings)

public virtual ServingConfig AddControl(AddControlRequest request, CallSettings callSettings = null)

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.

Parameters
NameDescription
requestAddControlRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ServingConfig

The RPC response.

Example
// Create client
ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.Create();
// Initialize request argument(s)
AddControlRequest request = new AddControlRequest
{
    ServingConfigAsServingConfigName = ServingConfigName.FromProjectLocationCatalogServingConfig("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"),
    ControlId = "",
};
// Make the request
ServingConfig response = servingConfigServiceClient.AddControl(request);

AddControl(ServingConfigName, CallSettings)

public virtual ServingConfig AddControl(ServingConfigName servingConfig, CallSettings callSettings = null)

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.

Parameters
NameDescription
servingConfigServingConfigName

Required. The source ServingConfig resource name . Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ServingConfig

The RPC response.

Example
// Create client
ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.Create();
// Initialize request argument(s)
ServingConfigName servingConfig = ServingConfigName.FromProjectLocationCatalogServingConfig("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]");
// Make the request
ServingConfig response = servingConfigServiceClient.AddControl(servingConfig);

AddControl(string, CallSettings)

public virtual ServingConfig AddControl(string servingConfig, CallSettings callSettings = null)

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.

Parameters
NameDescription
servingConfigstring

Required. The source ServingConfig resource name . Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ServingConfig

The RPC response.

Example
// Create client
ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.Create();
// Initialize request argument(s)
string servingConfig = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]/servingConfigs/[SERVING_CONFIG]";
// Make the request
ServingConfig response = servingConfigServiceClient.AddControl(servingConfig);

AddControlAsync(AddControlRequest, CallSettings)

public virtual Task<ServingConfig> AddControlAsync(AddControlRequest request, CallSettings callSettings = null)

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.

Parameters
NameDescription
requestAddControlRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskServingConfig

A Task containing the RPC response.

Example
// Create client
ServingConfigServiceClient servingConfigServiceClient = await ServingConfigServiceClient.CreateAsync();
// Initialize request argument(s)
AddControlRequest request = new AddControlRequest
{
    ServingConfigAsServingConfigName = ServingConfigName.FromProjectLocationCatalogServingConfig("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"),
    ControlId = "",
};
// Make the request
ServingConfig response = await servingConfigServiceClient.AddControlAsync(request);

AddControlAsync(AddControlRequest, CancellationToken)

public virtual Task<ServingConfig> AddControlAsync(AddControlRequest request, CancellationToken cancellationToken)

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.

Parameters
NameDescription
requestAddControlRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskServingConfig

A Task containing the RPC response.

Example
// Create client
ServingConfigServiceClient servingConfigServiceClient = await ServingConfigServiceClient.CreateAsync();
// Initialize request argument(s)
AddControlRequest request = new AddControlRequest
{
    ServingConfigAsServingConfigName = ServingConfigName.FromProjectLocationCatalogServingConfig("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"),
    ControlId = "",
};
// Make the request
ServingConfig response = await servingConfigServiceClient.AddControlAsync(request);

AddControlAsync(ServingConfigName, CallSettings)

public virtual Task<ServingConfig> AddControlAsync(ServingConfigName servingConfig, CallSettings callSettings = null)

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.

Parameters
NameDescription
servingConfigServingConfigName

Required. The source ServingConfig resource name . Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskServingConfig

A Task containing the RPC response.

Example
// Create client
ServingConfigServiceClient servingConfigServiceClient = await ServingConfigServiceClient.CreateAsync();
// Initialize request argument(s)
ServingConfigName servingConfig = ServingConfigName.FromProjectLocationCatalogServingConfig("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]");
// Make the request
ServingConfig response = await servingConfigServiceClient.AddControlAsync(servingConfig);

AddControlAsync(ServingConfigName, CancellationToken)

public virtual Task<ServingConfig> AddControlAsync(ServingConfigName servingConfig, CancellationToken cancellationToken)

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.

Parameters
NameDescription
servingConfigServingConfigName

Required. The source ServingConfig resource name . Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskServingConfig

A Task containing the RPC response.

Example
// Create client
ServingConfigServiceClient servingConfigServiceClient = await ServingConfigServiceClient.CreateAsync();
// Initialize request argument(s)
ServingConfigName servingConfig = ServingConfigName.FromProjectLocationCatalogServingConfig("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]");
// Make the request
ServingConfig response = await servingConfigServiceClient.AddControlAsync(servingConfig);

AddControlAsync(string, CallSettings)

public virtual Task<ServingConfig> AddControlAsync(string servingConfig, CallSettings callSettings = null)

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.

Parameters
NameDescription
servingConfigstring

Required. The source ServingConfig resource name . Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskServingConfig

A Task containing the RPC response.

Example
// Create client
ServingConfigServiceClient servingConfigServiceClient = await ServingConfigServiceClient.CreateAsync();
// Initialize request argument(s)
string servingConfig = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]/servingConfigs/[SERVING_CONFIG]";
// Make the request
ServingConfig response = await servingConfigServiceClient.AddControlAsync(servingConfig);

AddControlAsync(string, CancellationToken)

public virtual Task<ServingConfig> AddControlAsync(string servingConfig, CancellationToken cancellationToken)

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.

Parameters
NameDescription
servingConfigstring

Required. The source ServingConfig resource name . Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskServingConfig

A Task containing the RPC response.

Example
// Create client
ServingConfigServiceClient servingConfigServiceClient = await ServingConfigServiceClient.CreateAsync();
// Initialize request argument(s)
string servingConfig = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]/servingConfigs/[SERVING_CONFIG]";
// Make the request
ServingConfig response = await servingConfigServiceClient.AddControlAsync(servingConfig);

Create()

public static ServingConfigServiceClient Create()

Synchronously creates a ServingConfigServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ServingConfigServiceClientBuilder.

Returns
TypeDescription
ServingConfigServiceClient

The created ServingConfigServiceClient.

CreateAsync(CancellationToken)

public static Task<ServingConfigServiceClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a ServingConfigServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ServingConfigServiceClientBuilder.

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
TaskServingConfigServiceClient

The task representing the created ServingConfigServiceClient.

CreateServingConfig(CatalogName, ServingConfig, string, CallSettings)

public virtual ServingConfig CreateServingConfig(CatalogName parent, ServingConfig servingConfig, string servingConfigId, CallSettings callSettings = null)

Creates a ServingConfig.

A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a FAILED_PRECONDITION error is returned.

Parameters
NameDescription
parentCatalogName

Required. Full resource name of parent. Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}

servingConfigServingConfig

Required. The ServingConfig to create.

servingConfigIdstring

Required. The ID to use for the ServingConfig, which will become the final component of the ServingConfig's resource name.

This value should be 4-63 characters, and valid characters are /[a-z][0-9]-_/.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ServingConfig

The RPC response.

Example
// Create client
ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.Create();
// Initialize request argument(s)
CatalogName parent = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]");
ServingConfig servingConfig = new ServingConfig();
string servingConfigId = "";
// Make the request
ServingConfig response = servingConfigServiceClient.CreateServingConfig(parent, servingConfig, servingConfigId);

CreateServingConfig(CreateServingConfigRequest, CallSettings)

public virtual ServingConfig CreateServingConfig(CreateServingConfigRequest request, CallSettings callSettings = null)

Creates a ServingConfig.

A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a FAILED_PRECONDITION error is returned.

Parameters
NameDescription
requestCreateServingConfigRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ServingConfig

The RPC response.

Example
// Create client
ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.Create();
// Initialize request argument(s)
CreateServingConfigRequest request = new CreateServingConfigRequest
{
    ParentAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
    ServingConfig = new ServingConfig(),
    ServingConfigId = "",
};
// Make the request
ServingConfig response = servingConfigServiceClient.CreateServingConfig(request);

CreateServingConfig(string, ServingConfig, string, CallSettings)

public virtual ServingConfig CreateServingConfig(string parent, ServingConfig servingConfig, string servingConfigId, CallSettings callSettings = null)

Creates a ServingConfig.

A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a FAILED_PRECONDITION error is returned.

Parameters
NameDescription
parentstring

Required. Full resource name of parent. Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}

servingConfigServingConfig

Required. The ServingConfig to create.

servingConfigIdstring

Required. The ID to use for the ServingConfig, which will become the final component of the ServingConfig's resource name.

This value should be 4-63 characters, and valid characters are /[a-z][0-9]-_/.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ServingConfig

The RPC response.

Example
// Create client
ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]";
ServingConfig servingConfig = new ServingConfig();
string servingConfigId = "";
// Make the request
ServingConfig response = servingConfigServiceClient.CreateServingConfig(parent, servingConfig, servingConfigId);

CreateServingConfigAsync(CatalogName, ServingConfig, string, CallSettings)

public virtual Task<ServingConfig> CreateServingConfigAsync(CatalogName parent, ServingConfig servingConfig, string servingConfigId, CallSettings callSettings = null)

Creates a ServingConfig.

A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a FAILED_PRECONDITION error is returned.

Parameters
NameDescription
parentCatalogName

Required. Full resource name of parent. Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}

servingConfigServingConfig

Required. The ServingConfig to create.

servingConfigIdstring

Required. The ID to use for the ServingConfig, which will become the final component of the ServingConfig's resource name.

This value should be 4-63 characters, and valid characters are /[a-z][0-9]-_/.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskServingConfig

A Task containing the RPC response.

Example
// Create client
ServingConfigServiceClient servingConfigServiceClient = await ServingConfigServiceClient.CreateAsync();
// Initialize request argument(s)
CatalogName parent = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]");
ServingConfig servingConfig = new ServingConfig();
string servingConfigId = "";
// Make the request
ServingConfig response = await servingConfigServiceClient.CreateServingConfigAsync(parent, servingConfig, servingConfigId);

CreateServingConfigAsync(CatalogName, ServingConfig, string, CancellationToken)

public virtual Task<ServingConfig> CreateServingConfigAsync(CatalogName parent, ServingConfig servingConfig, string servingConfigId, CancellationToken cancellationToken)

Creates a ServingConfig.

A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a FAILED_PRECONDITION error is returned.

Parameters
NameDescription
parentCatalogName

Required. Full resource name of parent. Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}

servingConfigServingConfig

Required. The ServingConfig to create.

servingConfigIdstring

Required. The ID to use for the ServingConfig, which will become the final component of the ServingConfig's resource name.

This value should be 4-63 characters, and valid characters are /[a-z][0-9]-_/.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskServingConfig

A Task containing the RPC response.

Example
// Create client
ServingConfigServiceClient servingConfigServiceClient = await ServingConfigServiceClient.CreateAsync();
// Initialize request argument(s)
CatalogName parent = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]");
ServingConfig servingConfig = new ServingConfig();
string servingConfigId = "";
// Make the request
ServingConfig response = await servingConfigServiceClient.CreateServingConfigAsync(parent, servingConfig, servingConfigId);

CreateServingConfigAsync(CreateServingConfigRequest, CallSettings)

public virtual Task<ServingConfig> CreateServingConfigAsync(CreateServingConfigRequest request, CallSettings callSettings = null)

Creates a ServingConfig.

A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a FAILED_PRECONDITION error is returned.

Parameters
NameDescription
requestCreateServingConfigRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskServingConfig

A Task containing the RPC response.

Example
// Create client
ServingConfigServiceClient servingConfigServiceClient = await ServingConfigServiceClient.CreateAsync();
// Initialize request argument(s)
CreateServingConfigRequest request = new CreateServingConfigRequest
{
    ParentAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
    ServingConfig = new ServingConfig(),
    ServingConfigId = "",
};
// Make the request
ServingConfig response = await servingConfigServiceClient.CreateServingConfigAsync(request);

CreateServingConfigAsync(CreateServingConfigRequest, CancellationToken)

public virtual Task<ServingConfig> CreateServingConfigAsync(CreateServingConfigRequest request, CancellationToken cancellationToken)

Creates a ServingConfig.

A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a FAILED_PRECONDITION error is returned.

Parameters
NameDescription
requestCreateServingConfigRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskServingConfig

A Task containing the RPC response.

Example
// Create client
ServingConfigServiceClient servingConfigServiceClient = await ServingConfigServiceClient.CreateAsync();
// Initialize request argument(s)
CreateServingConfigRequest request = new CreateServingConfigRequest
{
    ParentAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
    ServingConfig = new ServingConfig(),
    ServingConfigId = "",
};
// Make the request
ServingConfig response = await servingConfigServiceClient.CreateServingConfigAsync(request);

CreateServingConfigAsync(string, ServingConfig, string, CallSettings)

public virtual Task<ServingConfig> CreateServingConfigAsync(string parent, ServingConfig servingConfig, string servingConfigId, CallSettings callSettings = null)

Creates a ServingConfig.

A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a FAILED_PRECONDITION error is returned.

Parameters
NameDescription
parent