Class PredictionServiceClient (2.0.0)

public abstract class PredictionServiceClient

PredictionService client wrapper, for convenient use.

Inheritance

Object > PredictionServiceClient

Namespace

Google.Cloud.Retail.V2

Assembly

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

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default PredictionService scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

The default PredictionService scopes are:

GrpcClient

public virtual PredictionService.PredictionServiceClient GrpcClient { get; }

The underlying gRPC PredictionService client

Property Value
TypeDescription
PredictionService.PredictionServiceClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

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

The CancellationToken to use while creating the client.

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

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PredictResponse

The RPC response.

Example
// 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
NameDescription
requestPredictRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<PredictResponse>

A Task containing the RPC response.

Example
// 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
NameDescription
requestPredictRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<PredictResponse>

A Task containing the RPC response.

Example
// 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
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.