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

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
TypeDescription
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default RecommendationService scopes.

Property Value
TypeDescription
IReadOnlyListstring
Remarks

The default RecommendationService scopes are:

GrpcClient

public virtual RecommendationService.RecommendationServiceClient GrpcClient { get; }

The underlying gRPC RecommendationService client

Property Value
TypeDescription
RecommendationServiceRecommendationServiceClient

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

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
TypeDescription
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
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
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
NameDescription
requestRecommendRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
requestRecommendRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
requestRecommendRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
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
TypeDescription
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.