Class CompletionServiceClient (1.5.0)

public abstract class CompletionServiceClient

CompletionService client wrapper, for convenient use.

Inheritance

Object > CompletionServiceClient

Namespace

Google.Cloud.Retail.V2

Assembly

Google.Cloud.Retail.V2.dll

Remarks

Auto-completion service for retail.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the CompletionService 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 CompletionService scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

The default CompletionService scopes are:

GrpcClient

public virtual CompletionService.CompletionServiceClient GrpcClient { get; }

The underlying gRPC CompletionService client

Property Value
TypeDescription
CompletionService.CompletionServiceClient

ImportCompletionDataOperationsClient

public virtual OperationsClient ImportCompletionDataOperationsClient { get; }

The long-running operations client for ImportCompletionData.

Property Value
TypeDescription
OperationsClient

Methods

CompleteQuery(CompleteQueryRequest, CallSettings)

public virtual CompleteQueryResponse CompleteQuery(CompleteQueryRequest request, CallSettings callSettings = null)

Completes the specified prefix with keyword suggestions.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

Parameters
NameDescription
requestCompleteQueryRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CompleteQueryResponse

The RPC response.

Example
// Create client
CompletionServiceClient completionServiceClient = CompletionServiceClient.Create();
// Initialize request argument(s)
CompleteQueryRequest request = new CompleteQueryRequest
{
    CatalogAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
    Query = "",
    LanguageCodes = { "", },
    DeviceType = "",
    MaxSuggestions = 0,
    Dataset = "",
    VisitorId = "",
};
// Make the request
CompleteQueryResponse response = completionServiceClient.CompleteQuery(request);

CompleteQueryAsync(CompleteQueryRequest, CallSettings)

public virtual Task<CompleteQueryResponse> CompleteQueryAsync(CompleteQueryRequest request, CallSettings callSettings = null)

Completes the specified prefix with keyword suggestions.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

Parameters
NameDescription
requestCompleteQueryRequest

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<CompleteQueryResponse>

A Task containing the RPC response.

Example
// Create client
CompletionServiceClient completionServiceClient = await CompletionServiceClient.CreateAsync();
// Initialize request argument(s)
CompleteQueryRequest request = new CompleteQueryRequest
{
    CatalogAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
    Query = "",
    LanguageCodes = { "", },
    DeviceType = "",
    MaxSuggestions = 0,
    Dataset = "",
    VisitorId = "",
};
// Make the request
CompleteQueryResponse response = await completionServiceClient.CompleteQueryAsync(request);

CompleteQueryAsync(CompleteQueryRequest, CancellationToken)

public virtual Task<CompleteQueryResponse> CompleteQueryAsync(CompleteQueryRequest request, CancellationToken cancellationToken)

Completes the specified prefix with keyword suggestions.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

Parameters
NameDescription
requestCompleteQueryRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CompleteQueryResponse>

A Task containing the RPC response.

Example
// Create client
CompletionServiceClient completionServiceClient = await CompletionServiceClient.CreateAsync();
// Initialize request argument(s)
CompleteQueryRequest request = new CompleteQueryRequest
{
    CatalogAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
    Query = "",
    LanguageCodes = { "", },
    DeviceType = "",
    MaxSuggestions = 0,
    Dataset = "",
    VisitorId = "",
};
// Make the request
CompleteQueryResponse response = await completionServiceClient.CompleteQueryAsync(request);

Create()

public static CompletionServiceClient Create()

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

Returns
TypeDescription
CompletionServiceClient

The created CompletionServiceClient.

CreateAsync(CancellationToken)

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

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

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<CompletionServiceClient>

The task representing the created CompletionServiceClient.

ImportCompletionData(ImportCompletionDataRequest, CallSettings)

public virtual Operation<ImportCompletionDataResponse, ImportMetadata> ImportCompletionData(ImportCompletionDataRequest request, CallSettings callSettings = null)

Bulk import of processed completion dataset.

Request processing may be synchronous. Partial updating is not supported.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

Parameters
NameDescription
requestImportCompletionDataRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<ImportCompletionDataResponse, ImportMetadata>

The RPC response.

Example
// Create client
CompletionServiceClient completionServiceClient = CompletionServiceClient.Create();
// Initialize request argument(s)
ImportCompletionDataRequest request = new ImportCompletionDataRequest
{
    ParentAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
    InputConfig = new CompletionDataInputConfig(),
    NotificationPubsubTopic = "",
};
// Make the request
Operation<ImportCompletionDataResponse, ImportMetadata> response = completionServiceClient.ImportCompletionData(request);

// Poll until the returned long-running operation is complete
Operation<ImportCompletionDataResponse, ImportMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
ImportCompletionDataResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ImportCompletionDataResponse, ImportMetadata> retrievedResponse = completionServiceClient.PollOnceImportCompletionData(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ImportCompletionDataResponse retrievedResult = retrievedResponse.Result;
}

ImportCompletionDataAsync(ImportCompletionDataRequest, CallSettings)

public virtual Task<Operation<ImportCompletionDataResponse, ImportMetadata>> ImportCompletionDataAsync(ImportCompletionDataRequest request, CallSettings callSettings = null)

Bulk import of processed completion dataset.

Request processing may be synchronous. Partial updating is not supported.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

Parameters
NameDescription
requestImportCompletionDataRequest

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<Operation<ImportCompletionDataResponse, ImportMetadata>>

A Task containing the RPC response.

Example
// Create client
CompletionServiceClient completionServiceClient = await CompletionServiceClient.CreateAsync();
// Initialize request argument(s)
ImportCompletionDataRequest request = new ImportCompletionDataRequest
{
    ParentAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
    InputConfig = new CompletionDataInputConfig(),
    NotificationPubsubTopic = "",
};
// Make the request
Operation<ImportCompletionDataResponse, ImportMetadata> response = await completionServiceClient.ImportCompletionDataAsync(request);

// Poll until the returned long-running operation is complete
Operation<ImportCompletionDataResponse, ImportMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ImportCompletionDataResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ImportCompletionDataResponse, ImportMetadata> retrievedResponse = await completionServiceClient.PollOnceImportCompletionDataAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ImportCompletionDataResponse retrievedResult = retrievedResponse.Result;
}

ImportCompletionDataAsync(ImportCompletionDataRequest, CancellationToken)

public virtual Task<Operation<ImportCompletionDataResponse, ImportMetadata>> ImportCompletionDataAsync(ImportCompletionDataRequest request, CancellationToken cancellationToken)

Bulk import of processed completion dataset.

Request processing may be synchronous. Partial updating is not supported.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

Parameters
NameDescription
requestImportCompletionDataRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<ImportCompletionDataResponse, ImportMetadata>>

A Task containing the RPC response.

Example
// Create client
CompletionServiceClient completionServiceClient = await CompletionServiceClient.CreateAsync();
// Initialize request argument(s)
ImportCompletionDataRequest request = new ImportCompletionDataRequest
{
    ParentAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
    InputConfig = new CompletionDataInputConfig(),
    NotificationPubsubTopic = "",
};
// Make the request
Operation<ImportCompletionDataResponse, ImportMetadata> response = await completionServiceClient.ImportCompletionDataAsync(request);

// Poll until the returned long-running operation is complete
Operation<ImportCompletionDataResponse, ImportMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ImportCompletionDataResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ImportCompletionDataResponse, ImportMetadata> retrievedResponse = await completionServiceClient.PollOnceImportCompletionDataAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ImportCompletionDataResponse retrievedResult = retrievedResponse.Result;
}

PollOnceImportCompletionData(String, CallSettings)

public virtual Operation<ImportCompletionDataResponse, ImportMetadata> PollOnceImportCompletionData(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of ImportCompletionData .

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<ImportCompletionDataResponse, ImportMetadata>

The result of polling the operation.

PollOnceImportCompletionDataAsync(String, CallSettings)

public virtual Task<Operation<ImportCompletionDataResponse, ImportMetadata>> PollOnceImportCompletionDataAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of ImportCompletionData.

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<ImportCompletionDataResponse, ImportMetadata>>

A task representing the result of polling the operation.

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.