Discovery Engine v1 API - Class CompletionServiceClient (1.0.0-beta05)

public abstract class CompletionServiceClient

Reference documentation and code samples for the Discovery Engine v1 API class CompletionServiceClient.

CompletionService client wrapper, for convenient use.

Inheritance

object > CompletionServiceClient

Namespace

Google.Cloud.DiscoveryEngine.V1

Assembly

Google.Cloud.DiscoveryEngine.V1.dll

Remarks

Service for Auto-Completion.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the CompletionService service, which is a host of "discoveryengine.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
IReadOnlyListstring
Remarks

The default CompletionService scopes are:

GrpcClient

public virtual CompletionService.CompletionServiceClient GrpcClient { get; }

The underlying gRPC CompletionService client

Property Value
Type Description
CompletionServiceCompletionServiceClient

ImportSuggestionDenyListEntriesOperationsClient

public virtual OperationsClient ImportSuggestionDenyListEntriesOperationsClient { get; }

The long-running operations client for ImportSuggestionDenyListEntries.

Property Value
Type Description
OperationsClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient

PurgeSuggestionDenyListEntriesOperationsClient

public virtual OperationsClient PurgeSuggestionDenyListEntriesOperationsClient { get; }

The long-running operations client for PurgeSuggestionDenyListEntries.

Property Value
Type Description
OperationsClient

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 user input with keyword suggestions.

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.

Example
// Create client
CompletionServiceClient completionServiceClient = CompletionServiceClient.Create();
// Initialize request argument(s)
CompleteQueryRequest request = new CompleteQueryRequest
{
    DataStoreAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
    Query = "",
    QueryModel = "",
    UserPseudoId = "",
    IncludeTailSuggestions = false,
};
// Make the request
CompleteQueryResponse response = completionServiceClient.CompleteQuery(request);

CompleteQueryAsync(CompleteQueryRequest, CallSettings)

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

Completes the specified user input with keyword suggestions.

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
TaskCompleteQueryResponse

A Task containing the RPC response.

Example
// Create client
CompletionServiceClient completionServiceClient = await CompletionServiceClient.CreateAsync();
// Initialize request argument(s)
CompleteQueryRequest request = new CompleteQueryRequest
{
    DataStoreAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
    Query = "",
    QueryModel = "",
    UserPseudoId = "",
    IncludeTailSuggestions = false,
};
// Make the request
CompleteQueryResponse response = await completionServiceClient.CompleteQueryAsync(request);

CompleteQueryAsync(CompleteQueryRequest, CancellationToken)

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

Completes the specified user input with keyword suggestions.

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
TaskCompleteQueryResponse

A Task containing the RPC response.

Example
// Create client
CompletionServiceClient completionServiceClient = await CompletionServiceClient.CreateAsync();
// Initialize request argument(s)
CompleteQueryRequest request = new CompleteQueryRequest
{
    DataStoreAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
    Query = "",
    QueryModel = "",
    UserPseudoId = "",
    IncludeTailSuggestions = false,
};
// 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)

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
TaskCompletionServiceClient

The task representing the created CompletionServiceClient.

ImportSuggestionDenyListEntries(ImportSuggestionDenyListEntriesRequest, CallSettings)

public virtual Operation<ImportSuggestionDenyListEntriesResponse, ImportSuggestionDenyListEntriesMetadata> ImportSuggestionDenyListEntries(ImportSuggestionDenyListEntriesRequest request, CallSettings callSettings = null)

Imports all [SuggestionDenyListEntry][google.cloud.discoveryengine.v1.SuggestionDenyListEntry] for a DataStore.

Parameters
Name Description
request ImportSuggestionDenyListEntriesRequest

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
OperationImportSuggestionDenyListEntriesResponseImportSuggestionDenyListEntriesMetadata

The RPC response.

Example
// Create client
CompletionServiceClient completionServiceClient = CompletionServiceClient.Create();
// Initialize request argument(s)
ImportSuggestionDenyListEntriesRequest request = new ImportSuggestionDenyListEntriesRequest
{
    ParentAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
    InlineSource = new ImportSuggestionDenyListEntriesRequest.Types.InlineSource(),
};
// Make the request
Operation<ImportSuggestionDenyListEntriesResponse, ImportSuggestionDenyListEntriesMetadata> response = completionServiceClient.ImportSuggestionDenyListEntries(request);

// Poll until the returned long-running operation is complete
Operation<ImportSuggestionDenyListEntriesResponse, ImportSuggestionDenyListEntriesMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
ImportSuggestionDenyListEntriesResponse 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<ImportSuggestionDenyListEntriesResponse, ImportSuggestionDenyListEntriesMetadata> retrievedResponse = completionServiceClient.PollOnceImportSuggestionDenyListEntries(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ImportSuggestionDenyListEntriesResponse retrievedResult = retrievedResponse.Result;
}

ImportSuggestionDenyListEntriesAsync(ImportSuggestionDenyListEntriesRequest, CallSettings)

public virtual Task<Operation<ImportSuggestionDenyListEntriesResponse, ImportSuggestionDenyListEntriesMetadata>> ImportSuggestionDenyListEntriesAsync(ImportSuggestionDenyListEntriesRequest request, CallSettings callSettings = null)

Imports all [SuggestionDenyListEntry][google.cloud.discoveryengine.v1.SuggestionDenyListEntry] for a DataStore.

Parameters
Name Description
request ImportSuggestionDenyListEntriesRequest

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
TaskOperationImportSuggestionDenyListEntriesResponseImportSuggestionDenyListEntriesMetadata

A Task containing the RPC response.

Example
// Create client
CompletionServiceClient completionServiceClient = await CompletionServiceClient.CreateAsync();
// Initialize request argument(s)
ImportSuggestionDenyListEntriesRequest request = new ImportSuggestionDenyListEntriesRequest
{
    ParentAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
    InlineSource = new ImportSuggestionDenyListEntriesRequest.Types.InlineSource(),
};
// Make the request
Operation<ImportSuggestionDenyListEntriesResponse, ImportSuggestionDenyListEntriesMetadata> response = await completionServiceClient.ImportSuggestionDenyListEntriesAsync(request);

// Poll until the returned long-running operation is complete
Operation<ImportSuggestionDenyListEntriesResponse, ImportSuggestionDenyListEntriesMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ImportSuggestionDenyListEntriesResponse 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<ImportSuggestionDenyListEntriesResponse, ImportSuggestionDenyListEntriesMetadata> retrievedResponse = await completionServiceClient.PollOnceImportSuggestionDenyListEntriesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ImportSuggestionDenyListEntriesResponse retrievedResult = retrievedResponse.Result;
}

ImportSuggestionDenyListEntriesAsync(ImportSuggestionDenyListEntriesRequest, CancellationToken)

public virtual Task<Operation<ImportSuggestionDenyListEntriesResponse, ImportSuggestionDenyListEntriesMetadata>> ImportSuggestionDenyListEntriesAsync(ImportSuggestionDenyListEntriesRequest request, CancellationToken cancellationToken)

Imports all [SuggestionDenyListEntry][google.cloud.discoveryengine.v1.SuggestionDenyListEntry] for a DataStore.

Parameters
Name Description
request ImportSuggestionDenyListEntriesRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationImportSuggestionDenyListEntriesResponseImportSuggestionDenyListEntriesMetadata

A Task containing the RPC response.

Example
// Create client
CompletionServiceClient completionServiceClient = await CompletionServiceClient.CreateAsync();
// Initialize request argument(s)
ImportSuggestionDenyListEntriesRequest request = new ImportSuggestionDenyListEntriesRequest
{
    ParentAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
    InlineSource = new ImportSuggestionDenyListEntriesRequest.Types.InlineSource(),
};
// Make the request
Operation<ImportSuggestionDenyListEntriesResponse, ImportSuggestionDenyListEntriesMetadata> response = await completionServiceClient.ImportSuggestionDenyListEntriesAsync(request);

// Poll until the returned long-running operation is complete
Operation<ImportSuggestionDenyListEntriesResponse, ImportSuggestionDenyListEntriesMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ImportSuggestionDenyListEntriesResponse 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<ImportSuggestionDenyListEntriesResponse, ImportSuggestionDenyListEntriesMetadata> retrievedResponse = await completionServiceClient.PollOnceImportSuggestionDenyListEntriesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ImportSuggestionDenyListEntriesResponse retrievedResult = retrievedResponse.Result;
}

PollOnceImportSuggestionDenyListEntries(string, CallSettings)

public virtual Operation<ImportSuggestionDenyListEntriesResponse, ImportSuggestionDenyListEntriesMetadata> PollOnceImportSuggestionDenyListEntries(string operationName, CallSettings callSettings = null)

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

Parameters
Name Description
operationName string

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationImportSuggestionDenyListEntriesResponseImportSuggestionDenyListEntriesMetadata

The result of polling the operation.

PollOnceImportSuggestionDenyListEntriesAsync(string, CallSettings)

public virtual Task<Operation<ImportSuggestionDenyListEntriesResponse, ImportSuggestionDenyListEntriesMetadata>> PollOnceImportSuggestionDenyListEntriesAsync(string operationName, CallSettings callSettings = null)

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

Parameters
Name Description
operationName string

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationImportSuggestionDenyListEntriesResponseImportSuggestionDenyListEntriesMetadata

A task representing the result of polling the operation.

PollOncePurgeSuggestionDenyListEntries(string, CallSettings)

public virtual Operation<PurgeSuggestionDenyListEntriesResponse, PurgeSuggestionDenyListEntriesMetadata> PollOncePurgeSuggestionDenyListEntries(string operationName, CallSettings callSettings = null)

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

Parameters
Name Description
operationName string

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationPurgeSuggestionDenyListEntriesResponsePurgeSuggestionDenyListEntriesMetadata

The result of polling the operation.

PollOncePurgeSuggestionDenyListEntriesAsync(string, CallSettings)

public virtual Task<Operation<PurgeSuggestionDenyListEntriesResponse, PurgeSuggestionDenyListEntriesMetadata>> PollOncePurgeSuggestionDenyListEntriesAsync(string operationName, CallSettings callSettings = null)

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

Parameters
Name Description
operationName string

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationPurgeSuggestionDenyListEntriesResponsePurgeSuggestionDenyListEntriesMetadata

A task representing the result of polling the operation.

PurgeSuggestionDenyListEntries(PurgeSuggestionDenyListEntriesRequest, CallSettings)

public virtual Operation<PurgeSuggestionDenyListEntriesResponse, PurgeSuggestionDenyListEntriesMetadata> PurgeSuggestionDenyListEntries(PurgeSuggestionDenyListEntriesRequest request, CallSettings callSettings = null)

Permanently deletes all [SuggestionDenyListEntry][google.cloud.discoveryengine.v1.SuggestionDenyListEntry] for a DataStore.

Parameters
Name Description
request PurgeSuggestionDenyListEntriesRequest

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
OperationPurgeSuggestionDenyListEntriesResponsePurgeSuggestionDenyListEntriesMetadata

The RPC response.

Example
// Create client
CompletionServiceClient completionServiceClient = CompletionServiceClient.Create();
// Initialize request argument(s)
PurgeSuggestionDenyListEntriesRequest request = new PurgeSuggestionDenyListEntriesRequest
{
    ParentAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
};
// Make the request
Operation<PurgeSuggestionDenyListEntriesResponse, PurgeSuggestionDenyListEntriesMetadata> response = completionServiceClient.PurgeSuggestionDenyListEntries(request);

// Poll until the returned long-running operation is complete
Operation<PurgeSuggestionDenyListEntriesResponse, PurgeSuggestionDenyListEntriesMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
PurgeSuggestionDenyListEntriesResponse 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<PurgeSuggestionDenyListEntriesResponse, PurgeSuggestionDenyListEntriesMetadata> retrievedResponse = completionServiceClient.PollOncePurgeSuggestionDenyListEntries(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    PurgeSuggestionDenyListEntriesResponse retrievedResult = retrievedResponse.Result;
}

PurgeSuggestionDenyListEntriesAsync(PurgeSuggestionDenyListEntriesRequest, CallSettings)

public virtual Task<Operation<PurgeSuggestionDenyListEntriesResponse, PurgeSuggestionDenyListEntriesMetadata>> PurgeSuggestionDenyListEntriesAsync(PurgeSuggestionDenyListEntriesRequest request, CallSettings callSettings = null)

Permanently deletes all [SuggestionDenyListEntry][google.cloud.discoveryengine.v1.SuggestionDenyListEntry] for a DataStore.

Parameters
Name Description
request PurgeSuggestionDenyListEntriesRequest

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
TaskOperationPurgeSuggestionDenyListEntriesResponsePurgeSuggestionDenyListEntriesMetadata

A Task containing the RPC response.

Example
// Create client
CompletionServiceClient completionServiceClient = await CompletionServiceClient.CreateAsync();
// Initialize request argument(s)
PurgeSuggestionDenyListEntriesRequest request = new PurgeSuggestionDenyListEntriesRequest
{
    ParentAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
};
// Make the request
Operation<PurgeSuggestionDenyListEntriesResponse, PurgeSuggestionDenyListEntriesMetadata> response = await completionServiceClient.PurgeSuggestionDenyListEntriesAsync(request);

// Poll until the returned long-running operation is complete
Operation<PurgeSuggestionDenyListEntriesResponse, PurgeSuggestionDenyListEntriesMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
PurgeSuggestionDenyListEntriesResponse 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<PurgeSuggestionDenyListEntriesResponse, PurgeSuggestionDenyListEntriesMetadata> retrievedResponse = await completionServiceClient.PollOncePurgeSuggestionDenyListEntriesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    PurgeSuggestionDenyListEntriesResponse retrievedResult = retrievedResponse.Result;
}

PurgeSuggestionDenyListEntriesAsync(PurgeSuggestionDenyListEntriesRequest, CancellationToken)

public virtual Task<Operation<PurgeSuggestionDenyListEntriesResponse, PurgeSuggestionDenyListEntriesMetadata>> PurgeSuggestionDenyListEntriesAsync(PurgeSuggestionDenyListEntriesRequest request, CancellationToken cancellationToken)

Permanently deletes all [SuggestionDenyListEntry][google.cloud.discoveryengine.v1.SuggestionDenyListEntry] for a DataStore.

Parameters
Name Description
request PurgeSuggestionDenyListEntriesRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationPurgeSuggestionDenyListEntriesResponsePurgeSuggestionDenyListEntriesMetadata

A Task containing the RPC response.

Example
// Create client
CompletionServiceClient completionServiceClient = await CompletionServiceClient.CreateAsync();
// Initialize request argument(s)
PurgeSuggestionDenyListEntriesRequest request = new PurgeSuggestionDenyListEntriesRequest
{
    ParentAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
};
// Make the request
Operation<PurgeSuggestionDenyListEntriesResponse, PurgeSuggestionDenyListEntriesMetadata> response = await completionServiceClient.PurgeSuggestionDenyListEntriesAsync(request);

// Poll until the returned long-running operation is complete
Operation<PurgeSuggestionDenyListEntriesResponse, PurgeSuggestionDenyListEntriesMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
PurgeSuggestionDenyListEntriesResponse 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<PurgeSuggestionDenyListEntriesResponse, PurgeSuggestionDenyListEntriesMetadata> retrievedResponse = await completionServiceClient.PollOncePurgeSuggestionDenyListEntriesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    PurgeSuggestionDenyListEntriesResponse retrievedResult = retrievedResponse.Result;
}

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.

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.