public abstract class PredictionServiceClientPredictionService client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.Retail.V2Assembly
Google.Cloud.Retail.V2.dll
Remarks
Service for making recommendation prediction.
Properties
DefaultEndpoint
public static string DefaultEndpoint { get; }The default endpoint for the PredictionService service, which is a host of "retail.googleapis.com" and a port of 443.
| Property Value | |
|---|---|
| Type | Description |
String |
|
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }The default PredictionService scopes.
| Property Value | |
|---|---|
| Type | Description |
IReadOnlyList<String> |
|
The default PredictionService scopes are:
GrpcClient
public virtual PredictionService.PredictionServiceClient GrpcClient { get; }The underlying gRPC PredictionService client
| Property Value | |
|---|---|
| Type | Description |
PredictionService.PredictionServiceClient |
|
Methods
Create()
public static PredictionServiceClient Create()Synchronously creates a PredictionServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use PredictionServiceClientBuilder.
| Returns | |
|---|---|
| Type | Description |
PredictionServiceClient |
The created PredictionServiceClient. |
CreateAsync(CancellationToken)
public static Task<PredictionServiceClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))Asynchronously creates a PredictionServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use PredictionServiceClientBuilder.
| Parameter | |
|---|---|
| Name | Description |
cancellationToken |
CancellationTokenThe CancellationToken to use while creating the client. |
| Returns | |
|---|---|
| Type | Description |
Task<PredictionServiceClient> |
The task representing the created PredictionServiceClient. |
Predict(PredictRequest, CallSettings)
public virtual PredictResponse Predict(PredictRequest request, CallSettings callSettings = null)Makes a recommendation prediction.
| Parameters | |
|---|---|
| Name | Description |
request |
PredictRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PredictResponse |
The RPC response. |
// Create client
PredictionServiceClient predictionServiceClient = PredictionServiceClient.Create();
// Initialize request argument(s)
PredictRequest request = new PredictRequest
{
Placement = "",
UserEvent = new UserEvent(),
PageSize = 0,
PageToken = "",
Filter = "",
ValidateOnly = false,
Params = { { "", new Value() }, },
Labels = { { "", "" }, },
};
// Make the request
PredictResponse response = predictionServiceClient.Predict(request);
PredictAsync(PredictRequest, CallSettings)
public virtual Task<PredictResponse> PredictAsync(PredictRequest request, CallSettings callSettings = null)Makes a recommendation prediction.
| Parameters | |
|---|---|
| Name | Description |
request |
PredictRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
Task<PredictResponse> |
A Task containing the RPC response. |
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
PredictRequest request = new PredictRequest
{
Placement = "",
UserEvent = new UserEvent(),
PageSize = 0,
PageToken = "",
Filter = "",
ValidateOnly = false,
Params = { { "", new Value() }, },
Labels = { { "", "" }, },
};
// Make the request
PredictResponse response = await predictionServiceClient.PredictAsync(request);
PredictAsync(PredictRequest, CancellationToken)
public virtual Task<PredictResponse> PredictAsync(PredictRequest request, CancellationToken cancellationToken)Makes a recommendation prediction.
| Parameters | |
|---|---|
| Name | Description |
request |
PredictRequestThe request object containing all of the parameters for the API call. |
cancellationToken |
CancellationTokenA CancellationToken to use for this RPC. |
| Returns | |
|---|---|
| Type | Description |
Task<PredictResponse> |
A Task containing the RPC response. |
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
PredictRequest request = new PredictRequest
{
Placement = "",
UserEvent = new UserEvent(),
PageSize = 0,
PageToken = "",
Filter = "",
ValidateOnly = false,
Params = { { "", new Value() }, },
Labels = { { "", "" }, },
};
// Make the request
PredictResponse response = await predictionServiceClient.PredictAsync(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. |
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.