public abstract class CompletionServiceClient
CompletionService client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.Retail.V2Assembly
Google.Cloud.Retail.V2.dll
Remarks
Auto-completion service for retail.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
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 | |
---|---|
Type | Description |
String |
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }
The default CompletionService scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyList<String> |
The default CompletionService scopes are:
GrpcClient
public virtual CompletionService.CompletionServiceClient GrpcClient { get; }
The underlying gRPC CompletionService client
Property Value | |
---|---|
Type | Description |
CompletionService.CompletionServiceClient |
ImportCompletionDataOperationsClient
public virtual OperationsClient ImportCompletionDataOperationsClient { get; }
The long-running operations client for ImportCompletionData
.
Property Value | |
---|---|
Type | Description |
OperationsClient |
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
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 enable Retail Search on Cloud Console before using this feature.
Parameters | |
---|---|
Name | Description |
request | CompleteQueryRequest 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 |
CompleteQueryResponse | The RPC response. |
// 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 enable Retail Search on Cloud Console before using this feature.
Parameters | |
---|---|
Name | Description |
request | CompleteQueryRequest 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 |
Task<CompleteQueryResponse> | A Task containing the RPC response. |
// 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 enable Retail Search on Cloud Console before using this feature.
Parameters | |
---|---|
Name | Description |
request | CompleteQueryRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<CompleteQueryResponse> | A Task containing the RPC response. |
// 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 | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
cancellationToken | CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
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 is asynchronous. Partial updating is not supported.
The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Parameters | |
---|---|
Name | Description |
request | ImportCompletionDataRequest 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 |
Operation<ImportCompletionDataResponse, ImportMetadata> | The RPC response. |
// 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 is asynchronous. Partial updating is not supported.
The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Parameters | |
---|---|
Name | Description |
request | ImportCompletionDataRequest 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 |
Task<Operation<ImportCompletionDataResponse, ImportMetadata>> | A Task containing the RPC response. |
// 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 is asynchronous. Partial updating is not supported.
The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Parameters | |
---|---|
Name | Description |
request | ImportCompletionDataRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Operation<ImportCompletionDataResponse, ImportMetadata>> | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
operationName | String The name of a previously invoked operation. Must not be |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
operationName | String The name of a previously invoked operation. Must not be |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
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.