Discovery Engine v1beta API - Class RecommendationServiceClient (1.0.0-beta15)

public abstract class RecommendationServiceClient

Reference documentation and code samples for the Discovery Engine v1beta API class RecommendationServiceClient.

RecommendationService client wrapper, for convenient use.

Inheritance

object > RecommendationServiceClient

Namespace

Google.Cloud.DiscoveryEngine.V1Beta

Assembly

Google.Cloud.DiscoveryEngine.V1Beta.dll

Remarks

Service for making recommendations.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default RecommendationService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default RecommendationService scopes are:

GrpcClient

public virtual RecommendationService.RecommendationServiceClient GrpcClient { get; }

The underlying gRPC RecommendationService client

Property Value
Type Description
RecommendationServiceRecommendationServiceClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Create()

public static RecommendationServiceClient Create()

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

Returns
Type Description
RecommendationServiceClient

The created RecommendationServiceClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskRecommendationServiceClient

The task representing the created RecommendationServiceClient.

Recommend(RecommendRequest, CallSettings)

public virtual RecommendResponse Recommend(RecommendRequest request, CallSettings callSettings = null)

Makes a recommendation, which requires a contextual user event.

Parameters
Name Description
request RecommendRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
RecommendResponse

The RPC response.

Example
// Create client
RecommendationServiceClient recommendationServiceClient = RecommendationServiceClient.Create();
// Initialize request argument(s)
RecommendRequest request = new RecommendRequest
{
    ServingConfigAsServingConfigName = ServingConfigName.FromProjectLocationDataStoreServingConfig("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[SERVING_CONFIG]"),
    UserEvent = new UserEvent(),
    PageSize = 0,
    Filter = "",
    ValidateOnly = false,
    Params = { { "", new Value() }, },
    UserLabels = { { "", "" }, },
};
// Make the request
RecommendResponse response = recommendationServiceClient.Recommend(request);

RecommendAsync(RecommendRequest, CallSettings)

public virtual Task<RecommendResponse> RecommendAsync(RecommendRequest request, CallSettings callSettings = null)

Makes a recommendation, which requires a contextual user event.

Parameters
Name Description
request RecommendRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskRecommendResponse

A Task containing the RPC response.

Example
// Create client
RecommendationServiceClient recommendationServiceClient = await RecommendationServiceClient.CreateAsync();
// Initialize request argument(s)
RecommendRequest request = new RecommendRequest
{
    ServingConfigAsServingConfigName = ServingConfigName.FromProjectLocationDataStoreServingConfig("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[SERVING_CONFIG]"),
    UserEvent = new UserEvent(),
    PageSize = 0,
    Filter = "",
    ValidateOnly = false,
    Params = { { "", new Value() }, },
    UserLabels = { { "", "" }, },
};
// Make the request
RecommendResponse response = await recommendationServiceClient.RecommendAsync(request);

RecommendAsync(RecommendRequest, CancellationToken)

public virtual Task<RecommendResponse> RecommendAsync(RecommendRequest request, CancellationToken cancellationToken)

Makes a recommendation, which requires a contextual user event.

Parameters
Name Description
request RecommendRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskRecommendResponse

A Task containing the RPC response.

Example
// Create client
RecommendationServiceClient recommendationServiceClient = await RecommendationServiceClient.CreateAsync();
// Initialize request argument(s)
RecommendRequest request = new RecommendRequest
{
    ServingConfigAsServingConfigName = ServingConfigName.FromProjectLocationDataStoreServingConfig("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[SERVING_CONFIG]"),
    UserEvent = new UserEvent(),
    PageSize = 0,
    Filter = "",
    ValidateOnly = false,
    Params = { { "", new Value() }, },
    UserLabels = { { "", "" }, },
};
// Make the request
RecommendResponse response = await recommendationServiceClient.RecommendAsync(request);

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
Type Description
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.