Gemini Enterprise for Customer Experience v1 API - Class WidgetServiceClient (1.0.0-beta01)

public abstract class WidgetServiceClient

Reference documentation and code samples for the Gemini Enterprise for Customer Experience v1 API class WidgetServiceClient.

WidgetService client wrapper, for convenient use.

Inheritance

object > WidgetServiceClient

Derived Types

Namespace

Google.Cloud.Ces.V1

Assembly

Google.Cloud.Ces.V1.dll

Remarks

Provides APIs for widgets to interact with CES APIs.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the WidgetService service, which is a host of "ces.googleapis.com" and a port of 443.

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default WidgetService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

GrpcClient

public virtual WidgetService.WidgetServiceClient GrpcClient { get; }

The underlying gRPC WidgetService client

Property Value
Type Description
WidgetServiceWidgetServiceClient

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

Create()

public static WidgetServiceClient Create()

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

Returns
Type Description
WidgetServiceClient

The created WidgetServiceClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskWidgetServiceClient

The task representing the created WidgetServiceClient.

GenerateChatToken(GenerateChatTokenRequest, CallSettings)

public virtual GenerateChatTokenResponse GenerateChatToken(GenerateChatTokenRequest request, CallSettings callSettings = null)

Generates a session scoped token for chat widget to authenticate with Session APIs.

Parameters
Name Description
request GenerateChatTokenRequest

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
GenerateChatTokenResponse

The RPC response.

Example
// Create client
WidgetServiceClient widgetServiceClient = WidgetServiceClient.Create();
// Initialize request argument(s)
GenerateChatTokenRequest request = new GenerateChatTokenRequest
{
    SessionName = SessionName.FromProjectLocationAppSession("[PROJECT]", "[LOCATION]", "[APP]", "[SESSION]"),
    DeploymentAsDeploymentName = DeploymentName.FromProjectLocationAppDeployment("[PROJECT]", "[LOCATION]", "[APP]", "[DEPLOYMENT]"),
    RecaptchaToken = "",
};
// Make the request
GenerateChatTokenResponse response = widgetServiceClient.GenerateChatToken(request);

GenerateChatTokenAsync(GenerateChatTokenRequest, CallSettings)

public virtual Task<GenerateChatTokenResponse> GenerateChatTokenAsync(GenerateChatTokenRequest request, CallSettings callSettings = null)

Generates a session scoped token for chat widget to authenticate with Session APIs.

Parameters
Name Description
request GenerateChatTokenRequest

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
TaskGenerateChatTokenResponse

A Task containing the RPC response.

Example
// Create client
WidgetServiceClient widgetServiceClient = await WidgetServiceClient.CreateAsync();
// Initialize request argument(s)
GenerateChatTokenRequest request = new GenerateChatTokenRequest
{
    SessionName = SessionName.FromProjectLocationAppSession("[PROJECT]", "[LOCATION]", "[APP]", "[SESSION]"),
    DeploymentAsDeploymentName = DeploymentName.FromProjectLocationAppDeployment("[PROJECT]", "[LOCATION]", "[APP]", "[DEPLOYMENT]"),
    RecaptchaToken = "",
};
// Make the request
GenerateChatTokenResponse response = await widgetServiceClient.GenerateChatTokenAsync(request);

GenerateChatTokenAsync(GenerateChatTokenRequest, CancellationToken)

public virtual Task<GenerateChatTokenResponse> GenerateChatTokenAsync(GenerateChatTokenRequest request, CancellationToken cancellationToken)

Generates a session scoped token for chat widget to authenticate with Session APIs.

Parameters
Name Description
request GenerateChatTokenRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGenerateChatTokenResponse

A Task containing the RPC response.

Example
// Create client
WidgetServiceClient widgetServiceClient = await WidgetServiceClient.CreateAsync();
// Initialize request argument(s)
GenerateChatTokenRequest request = new GenerateChatTokenRequest
{
    SessionName = SessionName.FromProjectLocationAppSession("[PROJECT]", "[LOCATION]", "[APP]", "[SESSION]"),
    DeploymentAsDeploymentName = DeploymentName.FromProjectLocationAppDeployment("[PROJECT]", "[LOCATION]", "[APP]", "[DEPLOYMENT]"),
    RecaptchaToken = "",
};
// Make the request
GenerateChatTokenResponse response = await widgetServiceClient.GenerateChatTokenAsync(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.

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.