Retail v2 API - Class AnalyticsServiceClient (2.9.0)

public abstract class AnalyticsServiceClient

Reference documentation and code samples for the Retail v2 API class AnalyticsServiceClient.

AnalyticsService client wrapper, for convenient use.

Inheritance

object > AnalyticsServiceClient

Namespace

Google.Cloud.Retail.V2

Assembly

Google.Cloud.Retail.V2.dll

Remarks

Service for managing & accessing retail search business metric. Retail recommendation business metric is currently not available.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
Type Description
IReadOnlyListstring
Remarks

The default AnalyticsService scopes are:

ExportAnalyticsMetricsOperationsClient

public virtual OperationsClient ExportAnalyticsMetricsOperationsClient { get; }

The long-running operations client for ExportAnalyticsMetrics.

Property Value
Type Description
OperationsClient

GrpcClient

public virtual AnalyticsService.AnalyticsServiceClient GrpcClient { get; }

The underlying gRPC AnalyticsService client

Property Value
Type Description
AnalyticsServiceAnalyticsServiceClient

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 AnalyticsServiceClient Create()

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

Returns
Type Description
AnalyticsServiceClient

The created AnalyticsServiceClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskAnalyticsServiceClient

The task representing the created AnalyticsServiceClient.

ExportAnalyticsMetrics(ExportAnalyticsMetricsRequest, CallSettings)

public virtual Operation<ExportAnalyticsMetricsResponse, ExportMetadata> ExportAnalyticsMetrics(ExportAnalyticsMetricsRequest request, CallSettings callSettings = null)

Exports analytics metrics.

Operation.response is of type ExportAnalyticsMetricsResponse. Operation.metadata is of type ExportMetadata.

Parameters
Name Description
request ExportAnalyticsMetricsRequest

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
OperationExportAnalyticsMetricsResponseExportMetadata

The RPC response.

Example
// Create client
AnalyticsServiceClient analyticsServiceClient = AnalyticsServiceClient.Create();
// Initialize request argument(s)
ExportAnalyticsMetricsRequest request = new ExportAnalyticsMetricsRequest
{
    Catalog = "",
    OutputConfig = new OutputConfig(),
    Filter = "",
};
// Make the request
Operation<ExportAnalyticsMetricsResponse, ExportMetadata> response = analyticsServiceClient.ExportAnalyticsMetrics(request);

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

ExportAnalyticsMetricsAsync(ExportAnalyticsMetricsRequest, CallSettings)

public virtual Task<Operation<ExportAnalyticsMetricsResponse, ExportMetadata>> ExportAnalyticsMetricsAsync(ExportAnalyticsMetricsRequest request, CallSettings callSettings = null)

Exports analytics metrics.

Operation.response is of type ExportAnalyticsMetricsResponse. Operation.metadata is of type ExportMetadata.

Parameters
Name Description
request ExportAnalyticsMetricsRequest

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
TaskOperationExportAnalyticsMetricsResponseExportMetadata

A Task containing the RPC response.

Example
// Create client
AnalyticsServiceClient analyticsServiceClient = await AnalyticsServiceClient.CreateAsync();
// Initialize request argument(s)
ExportAnalyticsMetricsRequest request = new ExportAnalyticsMetricsRequest
{
    Catalog = "",
    OutputConfig = new OutputConfig(),
    Filter = "",
};
// Make the request
Operation<ExportAnalyticsMetricsResponse, ExportMetadata> response = await analyticsServiceClient.ExportAnalyticsMetricsAsync(request);

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

ExportAnalyticsMetricsAsync(ExportAnalyticsMetricsRequest, CancellationToken)

public virtual Task<Operation<ExportAnalyticsMetricsResponse, ExportMetadata>> ExportAnalyticsMetricsAsync(ExportAnalyticsMetricsRequest request, CancellationToken cancellationToken)

Exports analytics metrics.

Operation.response is of type ExportAnalyticsMetricsResponse. Operation.metadata is of type ExportMetadata.

Parameters
Name Description
request ExportAnalyticsMetricsRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationExportAnalyticsMetricsResponseExportMetadata

A Task containing the RPC response.

Example
// Create client
AnalyticsServiceClient analyticsServiceClient = await AnalyticsServiceClient.CreateAsync();
// Initialize request argument(s)
ExportAnalyticsMetricsRequest request = new ExportAnalyticsMetricsRequest
{
    Catalog = "",
    OutputConfig = new OutputConfig(),
    Filter = "",
};
// Make the request
Operation<ExportAnalyticsMetricsResponse, ExportMetadata> response = await analyticsServiceClient.ExportAnalyticsMetricsAsync(request);

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

PollOnceExportAnalyticsMetrics(string, CallSettings)

public virtual Operation<ExportAnalyticsMetricsResponse, ExportMetadata> PollOnceExportAnalyticsMetrics(string operationName, CallSettings callSettings = null)

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

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
OperationExportAnalyticsMetricsResponseExportMetadata

The result of polling the operation.

PollOnceExportAnalyticsMetricsAsync(string, CallSettings)

public virtual Task<Operation<ExportAnalyticsMetricsResponse, ExportMetadata>> PollOnceExportAnalyticsMetricsAsync(string operationName, CallSettings callSettings = null)

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

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
TaskOperationExportAnalyticsMetricsResponseExportMetadata

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.

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.