Vertex AI Search for Retail API v2 - Package cloud.google.com/go/retail/apiv2 (v1.19.2)

Package retail is an auto-generated package for the Vertex AI Search for Retail API.

Vertex AI Search for Retail API is made up of Retail Search, Browse and Recommendations. These discovery AI solutions help you implement personalized search, browse and recommendations, based on machine learning models, across your websites and mobile applications.

General documentation

For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:

Example usage

To get started with this package, create a client.

// go get cloud.google.com/go/retail/apiv2@latest
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := retail.NewAnalyticsClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.

Using the Client

The following is an example of making an API call with the newly created client, mentioned above.

req := &retailpb.ExportAnalyticsMetricsRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#ExportAnalyticsMetricsRequest.
}
op, err := c.ExportAnalyticsMetrics(ctx, req)
if err != nil {
    // TODO: Handle error.
}

resp, err := op.Wait(ctx)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Use of Context

The ctx passed to NewAnalyticsClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.

To close the open connection, use the Close() method.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

AddFulfillmentPlacesOperation

type AddFulfillmentPlacesOperation struct {
	// contains filtered or unexported fields
}

AddFulfillmentPlacesOperation manages a long-running operation from AddFulfillmentPlaces.

func (*AddFulfillmentPlacesOperation) Done

Done reports whether the long-running operation has completed.

func (*AddFulfillmentPlacesOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*AddFulfillmentPlacesOperation) Name

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*AddFulfillmentPlacesOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*AddFulfillmentPlacesOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

AddLocalInventoriesOperation

type AddLocalInventoriesOperation struct {
	// contains filtered or unexported fields
}

AddLocalInventoriesOperation manages a long-running operation from AddLocalInventories.

func (*AddLocalInventoriesOperation) Done

Done reports whether the long-running operation has completed.

func (*AddLocalInventoriesOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*AddLocalInventoriesOperation) Name

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*AddLocalInventoriesOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*AddLocalInventoriesOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

AnalyticsCallOptions

type AnalyticsCallOptions struct {
	ExportAnalyticsMetrics []gax.CallOption
	GetOperation           []gax.CallOption
	ListOperations         []gax.CallOption
}

AnalyticsCallOptions contains the retry settings for each method of AnalyticsClient.

AnalyticsClient

type AnalyticsClient struct {

	// The call options for this service.
	CallOptions *AnalyticsCallOptions

	// LROClient is used internally to handle long-running operations.
	// It is exposed so that its CallOptions can be modified if required.
	// Users should not Close this client.
	LROClient *lroauto.OperationsClient
	// contains filtered or unexported fields
}

AnalyticsClient is a client for interacting with Vertex AI Search for Retail API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

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

func NewAnalyticsClient

func NewAnalyticsClient(ctx context.Context, opts ...option.ClientOption) (*AnalyticsClient, error)

NewAnalyticsClient creates a new analytics service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

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

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewAnalyticsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func NewAnalyticsRESTClient

func NewAnalyticsRESTClient(ctx context.Context, opts ...option.ClientOption) (*AnalyticsClient, error)

NewAnalyticsRESTClient creates a new analytics service rest client.

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

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewAnalyticsRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*AnalyticsClient) Close

func (c *AnalyticsClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*AnalyticsClient) Connection (deprecated)

func (c *AnalyticsClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*AnalyticsClient) ExportAnalyticsMetrics

ExportAnalyticsMetrics exports analytics metrics.

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

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewAnalyticsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.ExportAnalyticsMetricsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#ExportAnalyticsMetricsRequest.
	}
	op, err := c.ExportAnalyticsMetrics(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*AnalyticsClient) ExportAnalyticsMetricsOperation

func (c *AnalyticsClient) ExportAnalyticsMetricsOperation(name string) *ExportAnalyticsMetricsOperation

ExportAnalyticsMetricsOperation returns a new ExportAnalyticsMetricsOperation from a given name. The name must be that of a previously created ExportAnalyticsMetricsOperation, possibly from a different process.

func (*AnalyticsClient) GetOperation

GetOperation is a utility method from google.longrunning.Operations.

Example

package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewAnalyticsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.GetOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
	}
	resp, err := c.GetOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*AnalyticsClient) ListOperations

ListOperations is a utility method from google.longrunning.Operations.

Examples

package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
	"google.golang.org/api/iterator"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewAnalyticsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.ListOperationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
	}
	it := c.ListOperations(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*longrunningpb.ListOperationsResponse)
	}
}
all
package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewAnalyticsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.ListOperationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
	}
	for resp, err := range c.ListOperations(ctx, req).All() {
		if err != nil {
			// TODO: Handle error and break/return/continue. Iteration will stop after any error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

CatalogCallOptions

type CatalogCallOptions struct {
	ListCatalogs            []gax.CallOption
	UpdateCatalog           []gax.CallOption
	SetDefaultBranch        []gax.CallOption
	GetDefaultBranch        []gax.CallOption
	GetCompletionConfig     []gax.CallOption
	UpdateCompletionConfig  []gax.CallOption
	GetAttributesConfig     []gax.CallOption
	UpdateAttributesConfig  []gax.CallOption
	AddCatalogAttribute     []gax.CallOption
	RemoveCatalogAttribute  []gax.CallOption
	ReplaceCatalogAttribute []gax.CallOption
	GetOperation            []gax.CallOption
	ListOperations          []gax.CallOption
}

CatalogCallOptions contains the retry settings for each method of CatalogClient.

CatalogClient

type CatalogClient struct {

	// The call options for this service.
	CallOptions *CatalogCallOptions
	// contains filtered or unexported fields
}

CatalogClient is a client for interacting with Vertex AI Search for Retail API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Service for managing catalog configuration.

func NewCatalogClient

func NewCatalogClient(ctx context.Context, opts ...option.ClientOption) (*CatalogClient, error)

NewCatalogClient creates a new catalog service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Service for managing catalog configuration.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func NewCatalogRESTClient

func NewCatalogRESTClient(ctx context.Context, opts ...option.ClientOption) (*CatalogClient, error)

NewCatalogRESTClient creates a new catalog service rest client.

Service for managing catalog configuration.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCatalogRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*CatalogClient) AddCatalogAttribute

AddCatalogAttribute adds the specified CatalogAttribute to the AttributesConfig.

If the CatalogAttribute to add already exists, an ALREADY_EXISTS error is returned.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.AddCatalogAttributeRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#AddCatalogAttributeRequest.
	}
	resp, err := c.AddCatalogAttribute(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*CatalogClient) Close

func (c *CatalogClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*CatalogClient) Connection (deprecated)

func (c *CatalogClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*CatalogClient) GetAttributesConfig

GetAttributesConfig gets an AttributesConfig.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.GetAttributesConfigRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#GetAttributesConfigRequest.
	}
	resp, err := c.GetAttributesConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*CatalogClient) GetCompletionConfig

GetCompletionConfig gets a CompletionConfig.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.GetCompletionConfigRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#GetCompletionConfigRequest.
	}
	resp, err := c.GetCompletionConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*CatalogClient) GetDefaultBranch

GetDefaultBranch get which branch is currently default branch set by CatalogService.SetDefaultBranch method under a specified parent catalog.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.GetDefaultBranchRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#GetDefaultBranchRequest.
	}
	resp, err := c.GetDefaultBranch(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*CatalogClient) GetOperation

GetOperation is a utility method from google.longrunning.Operations.

Example

package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.GetOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
	}
	resp, err := c.GetOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*CatalogClient) ListCatalogs

ListCatalogs lists all the Catalogs associated with the project.

Examples

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
	"google.golang.org/api/iterator"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.ListCatalogsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#ListCatalogsRequest.
	}
	it := c.ListCatalogs(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*retailpb.ListCatalogsResponse)
	}
}
all
package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.ListCatalogsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#ListCatalogsRequest.
	}
	for resp, err := range c.ListCatalogs(ctx, req).All() {
		if err != nil {
			// TODO: Handle error and break/return/continue. Iteration will stop after any error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*CatalogClient) ListOperations

ListOperations is a utility method from google.longrunning.Operations.

Examples

package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
	"google.golang.org/api/iterator"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.ListOperationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
	}
	it := c.ListOperations(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*longrunningpb.ListOperationsResponse)
	}
}
all
package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.ListOperationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
	}
	for resp, err := range c.ListOperations(ctx, req).All() {
		if err != nil {
			// TODO: Handle error and break/return/continue. Iteration will stop after any error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*CatalogClient) RemoveCatalogAttribute

RemoveCatalogAttribute removes the specified CatalogAttribute from the AttributesConfig.

If the CatalogAttribute to remove does not exist, a NOT_FOUND error is returned.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.RemoveCatalogAttributeRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#RemoveCatalogAttributeRequest.
	}
	resp, err := c.RemoveCatalogAttribute(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*CatalogClient) ReplaceCatalogAttribute

ReplaceCatalogAttribute replaces the specified CatalogAttribute in the AttributesConfig by updating the catalog attribute with the same CatalogAttribute.key.

If the CatalogAttribute to replace does not exist, a NOT_FOUND error is returned.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.ReplaceCatalogAttributeRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#ReplaceCatalogAttributeRequest.
	}
	resp, err := c.ReplaceCatalogAttribute(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*CatalogClient) SetDefaultBranch

func (c *CatalogClient) SetDefaultBranch(ctx context.Context, req *retailpb.SetDefaultBranchRequest, opts ...gax.CallOption) error

SetDefaultBranch set a specified branch id as default branch. API methods such as SearchService.Search, ProductService.GetProduct, ProductService.ListProducts will treat requests using “default_branch” to the actual branch id set as default.

For example, if projects//locations//catalogs//branches/1 is set as default, setting SearchRequest.branch to projects//locations//catalogs//branches/default_branch is equivalent to setting SearchRequest.branch to projects//locations//catalogs/*/branches/1.

Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using projects//locations//catalogs/*/branches/default_branch as SearchRequest.branch to route the traffic to this staging branch.

CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one.

More specifically:

PredictionService will only return product IDs from branch {newBranch}.

SearchService will only return product IDs from branch {newBranch}
(if branch is not explicitly set).

UserEventService will only join events with products from branch
{newBranch}.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.SetDefaultBranchRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#SetDefaultBranchRequest.
	}
	err = c.SetDefaultBranch(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*CatalogClient) UpdateAttributesConfig

UpdateAttributesConfig updates the AttributesConfig.

The catalog attributes in the request will be updated in the catalog, or inserted if they do not exist. Existing catalog attributes not included in the request will remain unchanged. Attributes that are assigned to products, but do not exist at the catalog level, are always included in the response. The product attribute is assigned default values for missing catalog attribute fields, e.g., searchable and dynamic facetable options.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.UpdateAttributesConfigRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#UpdateAttributesConfigRequest.
	}
	resp, err := c.UpdateAttributesConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*CatalogClient) UpdateCatalog

func (c *CatalogClient) UpdateCatalog(ctx context.Context, req *retailpb.UpdateCatalogRequest, opts ...gax.CallOption) (*retailpb.Catalog, error)

UpdateCatalog updates the Catalogs.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.UpdateCatalogRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#UpdateCatalogRequest.
	}
	resp, err := c.UpdateCatalog(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*CatalogClient) UpdateCompletionConfig

UpdateCompletionConfig updates the CompletionConfigs.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.UpdateCompletionConfigRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#UpdateCompletionConfigRequest.
	}
	resp, err := c.UpdateCompletionConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

CatalogIterator

type CatalogIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*retailpb.Catalog, nextPageToken string, err error)
	// contains filtered or unexported fields
}

CatalogIterator manages a stream of *retailpb.Catalog.

func (*CatalogIterator) All

func (it *CatalogIterator) All() iter.Seq2[*retailpb.Catalog, error]

All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.

func (*CatalogIterator) Next

func (it *CatalogIterator) Next() (*retailpb.Catalog, error)

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*CatalogIterator) PageInfo

func (it *CatalogIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.

CompletionCallOptions

type CompletionCallOptions struct {
	CompleteQuery        []gax.CallOption
	ImportCompletionData []gax.CallOption
	GetOperation         []gax.CallOption
	ListOperations       []gax.CallOption
}

CompletionCallOptions contains the retry settings for each method of CompletionClient.

CompletionClient

type CompletionClient struct {

	// The call options for this service.
	CallOptions *CompletionCallOptions

	// LROClient is used internally to handle long-running operations.
	// It is exposed so that its CallOptions can be modified if required.
	// Users should not Close this client.
	LROClient *lroauto.OperationsClient
	// contains filtered or unexported fields
}

CompletionClient is a client for interacting with Vertex AI Search for Retail API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Autocomplete service for retail.

This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.

func NewCompletionClient

func NewCompletionClient(ctx context.Context, opts ...option.ClientOption) (*CompletionClient, error)

NewCompletionClient creates a new completion service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Autocomplete service for retail.

This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCompletionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func NewCompletionRESTClient

func NewCompletionRESTClient(ctx context.Context, opts ...option.ClientOption) (*CompletionClient, error)

NewCompletionRESTClient creates a new completion service rest client.

Autocomplete service for retail.

This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCompletionRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*CompletionClient) Close

func (c *CompletionClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*CompletionClient) CompleteQuery

CompleteQuery completes the specified prefix with keyword suggestions.

This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCompletionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.CompleteQueryRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#CompleteQueryRequest.
	}
	resp, err := c.CompleteQuery(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*CompletionClient) Connection (deprecated)

func (c *CompletionClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*CompletionClient) GetOperation

GetOperation is a utility method from google.longrunning.Operations.

Example

package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCompletionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.GetOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
	}
	resp, err := c.GetOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*CompletionClient) ImportCompletionData

ImportCompletionData 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. Enable Retail Search on Cloud Console before using this feature.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCompletionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.ImportCompletionDataRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#ImportCompletionDataRequest.
	}
	op, err := c.ImportCompletionData(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*CompletionClient) ImportCompletionDataOperation

func (c *CompletionClient) ImportCompletionDataOperation(name string) *ImportCompletionDataOperation

ImportCompletionDataOperation returns a new ImportCompletionDataOperation from a given name. The name must be that of a previously created ImportCompletionDataOperation, possibly from a different process.

func (*CompletionClient) ListOperations

ListOperations is a utility method from google.longrunning.Operations.

Examples

package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
	"google.golang.org/api/iterator"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCompletionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.ListOperationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
	}
	it := c.ListOperations(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*longrunningpb.ListOperationsResponse)
	}
}
all
package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewCompletionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.ListOperationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
	}
	for resp, err := range c.ListOperations(ctx, req).All() {
		if err != nil {
			// TODO: Handle error and break/return/continue. Iteration will stop after any error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

ControlCallOptions

type ControlCallOptions struct {
	CreateControl  []gax.CallOption
	DeleteControl  []gax.CallOption
	UpdateControl  []gax.CallOption
	GetControl     []gax.CallOption
	ListControls   []gax.CallOption
	GetOperation   []gax.CallOption
	ListOperations []gax.CallOption
}

ControlCallOptions contains the retry settings for each method of ControlClient.

ControlClient

type ControlClient struct {

	// The call options for this service.
	CallOptions *ControlCallOptions
	// contains filtered or unexported fields
}

ControlClient is a client for interacting with Vertex AI Search for Retail API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Service for modifying Control.

func NewControlClient

func NewControlClient(ctx context.Context, opts ...option.ClientOption) (*ControlClient, error)

NewControlClient creates a new control service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Service for modifying Control.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewControlClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func NewControlRESTClient

func NewControlRESTClient(ctx context.Context, opts ...option.ClientOption) (*ControlClient, error)

NewControlRESTClient creates a new control service rest client.

Service for modifying Control.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewControlRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*ControlClient) Close

func (c *ControlClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*ControlClient) Connection (deprecated)

func (c *ControlClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*ControlClient) CreateControl

func (c *ControlClient) CreateControl(ctx context.Context, req *retailpb.CreateControlRequest, opts ...gax.CallOption) (*retailpb.Control, error)

CreateControl creates a Control.

If the Control to create already exists, an ALREADY_EXISTS error is returned.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewControlClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.CreateControlRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#CreateControlRequest.
	}
	resp, err := c.CreateControl(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ControlClient) DeleteControl

func (c *ControlClient) DeleteControl(ctx context.Context, req *retailpb.DeleteControlRequest, opts ...gax.CallOption) error

DeleteControl deletes a Control.

If the Control to delete does not exist, a NOT_FOUND error is returned.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewControlClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.DeleteControlRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#DeleteControlRequest.
	}
	err = c.DeleteControl(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*ControlClient) GetControl

GetControl gets a Control.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewControlClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.GetControlRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#GetControlRequest.
	}
	resp, err := c.GetControl(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ControlClient) GetOperation

GetOperation is a utility method from google.longrunning.Operations.

Example

package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewControlClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.GetOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
	}
	resp, err := c.GetOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ControlClient) ListControls

ListControls lists all Controls by their parent Catalog.

Examples

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
	"google.golang.org/api/iterator"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewControlClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.ListControlsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#ListControlsRequest.
	}
	it := c.ListControls(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*retailpb.ListControlsResponse)
	}
}
all
package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewControlClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.ListControlsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#ListControlsRequest.
	}
	for resp, err := range c.ListControls(ctx, req).All() {
		if err != nil {
			// TODO: Handle error and break/return/continue. Iteration will stop after any error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*ControlClient) ListOperations

ListOperations is a utility method from google.longrunning.Operations.

Examples

package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
	"google.golang.org/api/iterator"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewControlClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.ListOperationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
	}
	it := c.ListOperations(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*longrunningpb.ListOperationsResponse)
	}
}
all
package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewControlClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.ListOperationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
	}
	for resp, err := range c.ListOperations(ctx, req).All() {
		if err != nil {
			// TODO: Handle error and break/return/continue. Iteration will stop after any error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*ControlClient) UpdateControl

func (c *ControlClient) UpdateControl(ctx context.Context, req *retailpb.UpdateControlRequest, opts ...gax.CallOption) (*retailpb.Control, error)

UpdateControl updates a Control.

Control cannot be set to a different oneof field, if so an INVALID_ARGUMENT is returned. If the Control to update does not exist, a NOT_FOUND error is returned.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewControlClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.UpdateControlRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#UpdateControlRequest.
	}
	resp, err := c.UpdateControl(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

ControlIterator

type ControlIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*retailpb.Control, nextPageToken string, err error)
	// contains filtered or unexported fields
}

ControlIterator manages a stream of *retailpb.Control.

func (*ControlIterator) All

func (it *ControlIterator) All() iter.Seq2[*retailpb.Control, error]

All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.

func (*ControlIterator) Next

func (it *ControlIterator) Next() (*retailpb.Control, error)

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*ControlIterator) PageInfo

func (it *ControlIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.

CreateModelOperation

type CreateModelOperation struct {
	// contains filtered or unexported fields
}

CreateModelOperation manages a long-running operation from CreateModel.

func (*CreateModelOperation) Done

func (op *CreateModelOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*CreateModelOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*CreateModelOperation) Name

func (op *CreateModelOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*CreateModelOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*CreateModelOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

ExportAnalyticsMetricsOperation

type ExportAnalyticsMetricsOperation struct {
	// contains filtered or unexported fields
}

ExportAnalyticsMetricsOperation manages a long-running operation from ExportAnalyticsMetrics.

func (*ExportAnalyticsMetricsOperation) Done

Done reports whether the long-running operation has completed.

func (*ExportAnalyticsMetricsOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*ExportAnalyticsMetricsOperation) Name

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*ExportAnalyticsMetricsOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*ExportAnalyticsMetricsOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

GenerativeQuestionCallOptions

type GenerativeQuestionCallOptions struct {
	UpdateGenerativeQuestionsFeatureConfig []gax.CallOption
	GetGenerativeQuestionsFeatureConfig    []gax.CallOption
	ListGenerativeQuestionConfigs          []gax.CallOption
	UpdateGenerativeQuestionConfig         []gax.CallOption
	BatchUpdateGenerativeQuestionConfigs   []gax.CallOption
	GetOperation                           []gax.CallOption
	ListOperations                         []gax.CallOption
}

GenerativeQuestionCallOptions contains the retry settings for each method of GenerativeQuestionClient.

GenerativeQuestionClient

type GenerativeQuestionClient struct {

	// The call options for this service.
	CallOptions *GenerativeQuestionCallOptions
	// contains filtered or unexported fields
}

GenerativeQuestionClient is a client for interacting with Vertex AI Search for Retail API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Service for managing LLM generated questions in search serving.

func NewGenerativeQuestionClient

func NewGenerativeQuestionClient(ctx context.Context, opts ...option.ClientOption) (*GenerativeQuestionClient, error)

NewGenerativeQuestionClient creates a new generative question service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Service for managing LLM generated questions in search serving.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewGenerativeQuestionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func NewGenerativeQuestionRESTClient

func NewGenerativeQuestionRESTClient(ctx context.Context, opts ...option.ClientOption) (*GenerativeQuestionClient, error)

NewGenerativeQuestionRESTClient creates a new generative question service rest client.

Service for managing LLM generated questions in search serving.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewGenerativeQuestionRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*GenerativeQuestionClient) BatchUpdateGenerativeQuestionConfigs

BatchUpdateGenerativeQuestionConfigs allows management of multiple questions.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewGenerativeQuestionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.BatchUpdateGenerativeQuestionConfigsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#BatchUpdateGenerativeQuestionConfigsRequest.
	}
	resp, err := c.BatchUpdateGenerativeQuestionConfigs(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*GenerativeQuestionClient) Close

func (c *GenerativeQuestionClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*GenerativeQuestionClient) Connection (deprecated)

func (c *GenerativeQuestionClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*GenerativeQuestionClient) GetGenerativeQuestionsFeatureConfig

GetGenerativeQuestionsFeatureConfig manages overal generative question feature state – enables toggling feature on and off.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewGenerativeQuestionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.GetGenerativeQuestionsFeatureConfigRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#GetGenerativeQuestionsFeatureConfigRequest.
	}
	resp, err := c.GetGenerativeQuestionsFeatureConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*GenerativeQuestionClient) GetOperation

GetOperation is a utility method from google.longrunning.Operations.

Example

package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewGenerativeQuestionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.GetOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
	}
	resp, err := c.GetOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*GenerativeQuestionClient) ListGenerativeQuestionConfigs

ListGenerativeQuestionConfigs returns all questions for a given catalog.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewGenerativeQuestionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.ListGenerativeQuestionConfigsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#ListGenerativeQuestionConfigsRequest.
	}
	resp, err := c.ListGenerativeQuestionConfigs(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*GenerativeQuestionClient) ListOperations

ListOperations is a utility method from google.longrunning.Operations.

Examples

package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
	"google.golang.org/api/iterator"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewGenerativeQuestionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.ListOperationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
	}
	it := c.ListOperations(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*longrunningpb.ListOperationsResponse)
	}
}
all
package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewGenerativeQuestionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.ListOperationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
	}
	for resp, err := range c.ListOperations(ctx, req).All() {
		if err != nil {
			// TODO: Handle error and break/return/continue. Iteration will stop after any error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*GenerativeQuestionClient) UpdateGenerativeQuestionConfig

UpdateGenerativeQuestionConfig allows management of individual questions.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewGenerativeQuestionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.UpdateGenerativeQuestionConfigRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#UpdateGenerativeQuestionConfigRequest.
	}
	resp, err := c.UpdateGenerativeQuestionConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*GenerativeQuestionClient) UpdateGenerativeQuestionsFeatureConfig

UpdateGenerativeQuestionsFeatureConfig manages overal generative question feature state – enables toggling feature on and off.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewGenerativeQuestionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.UpdateGenerativeQuestionsFeatureConfigRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#UpdateGenerativeQuestionsFeatureConfigRequest.
	}
	resp, err := c.UpdateGenerativeQuestionsFeatureConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

ImportCompletionDataOperation

type ImportCompletionDataOperation struct {
	// contains filtered or unexported fields
}

ImportCompletionDataOperation manages a long-running operation from ImportCompletionData.

func (*ImportCompletionDataOperation) Done

Done reports whether the long-running operation has completed.

func (*ImportCompletionDataOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*ImportCompletionDataOperation) Name

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*ImportCompletionDataOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*ImportCompletionDataOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

ImportProductsOperation

type ImportProductsOperation struct {
	// contains filtered or unexported fields
}

ImportProductsOperation manages a long-running operation from ImportProducts.

func (*ImportProductsOperation) Done

func (op *ImportProductsOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*ImportProductsOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*ImportProductsOperation) Name

func (op *ImportProductsOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*ImportProductsOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*ImportProductsOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

ImportUserEventsOperation

type ImportUserEventsOperation struct {
	// contains filtered or unexported fields
}

ImportUserEventsOperation manages a long-running operation from ImportUserEvents.

func (*ImportUserEventsOperation) Done

func (op *ImportUserEventsOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*ImportUserEventsOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*ImportUserEventsOperation) Name

func (op *ImportUserEventsOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*ImportUserEventsOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*ImportUserEventsOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

ModelCallOptions

type ModelCallOptions struct {
	CreateModel    []gax.CallOption
	GetModel       []gax.CallOption
	PauseModel     []gax.CallOption
	ResumeModel    []gax.CallOption
	DeleteModel    []gax.CallOption
	ListModels     []gax.CallOption
	UpdateModel    []gax.CallOption
	TuneModel      []gax.CallOption
	GetOperation   []gax.CallOption
	ListOperations []gax.CallOption
}

ModelCallOptions contains the retry settings for each method of ModelClient.

ModelClient

type ModelClient struct {

	// The call options for this service.
	CallOptions *ModelCallOptions

	// LROClient is used internally to handle long-running operations.
	// It is exposed so that its CallOptions can be modified if required.
	// Users should not Close this client.
	LROClient *lroauto.OperationsClient
	// contains filtered or unexported fields
}

ModelClient is a client for interacting with Vertex AI Search for Retail API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Service for performing CRUD operations on models. Recommendation models contain all the metadata necessary to generate a set of models for the Predict() API. A model is queried indirectly via a ServingConfig, which associates a model with a given Placement (e.g. Frequently Bought Together on Home Page).

This service allows you to do the following:

Initiate training of a model.

Pause training of an existing model.

List all the available models along with their metadata.

Control their tuning schedule.

func NewModelClient

func NewModelClient(ctx context.Context, opts ...option.ClientOption) (*ModelClient, error)

NewModelClient creates a new model service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Service for performing CRUD operations on models. Recommendation models contain all the metadata necessary to generate a set of models for the Predict() API. A model is queried indirectly via a ServingConfig, which associates a model with a given Placement (e.g. Frequently Bought Together on Home Page).

This service allows you to do the following:

Initiate training of a model.

Pause training of an existing model.

List all the available models along with their metadata.

Control their tuning schedule.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewModelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func NewModelRESTClient

func NewModelRESTClient(ctx context.Context, opts ...option.ClientOption) (*ModelClient, error)

NewModelRESTClient creates a new model service rest client.

Service for performing CRUD operations on models. Recommendation models contain all the metadata necessary to generate a set of models for the Predict() API. A model is queried indirectly via a ServingConfig, which associates a model with a given Placement (e.g. Frequently Bought Together on Home Page).

This service allows you to do the following:

Initiate training of a model.

Pause training of an existing model.

List all the available models along with their metadata.

Control their tuning schedule.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewModelRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*ModelClient) Close

func (c *ModelClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*ModelClient) Connection (deprecated)

func (c *ModelClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*ModelClient) CreateModel

CreateModel creates a new model.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewModelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.CreateModelRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#CreateModelRequest.
	}
	op, err := c.CreateModel(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ModelClient) CreateModelOperation

func (c *ModelClient) CreateModelOperation(name string) *CreateModelOperation

CreateModelOperation returns a new CreateModelOperation from a given name. The name must be that of a previously created CreateModelOperation, possibly from a different process.

func (*ModelClient) DeleteModel

func (c *ModelClient) DeleteModel(ctx context.Context, req *retailpb.DeleteModelRequest, opts ...gax.CallOption) error

DeleteModel deletes an existing model.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewModelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.DeleteModelRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#DeleteModelRequest.
	}
	err = c.DeleteModel(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*ModelClient) GetModel

func (c *ModelClient) GetModel(ctx context.Context, req *retailpb.GetModelRequest, opts ...gax.CallOption) (*retailpb.Model, error)

GetModel gets a model.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewModelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.GetModelRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#GetModelRequest.
	}
	resp, err := c.GetModel(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ModelClient) GetOperation

GetOperation is a utility method from google.longrunning.Operations.

Example

package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewModelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.GetOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
	}
	resp, err := c.GetOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ModelClient) ListModels

func (c *ModelClient) ListModels(ctx context.Context, req *retailpb.ListModelsRequest, opts ...gax.CallOption) *ModelIterator

ListModels lists all the models linked to this event store.

Examples

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
	"google.golang.org/api/iterator"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewModelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.ListModelsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#ListModelsRequest.
	}
	it := c.ListModels(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*retailpb.ListModelsResponse)
	}
}
all
package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewModelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.ListModelsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#ListModelsRequest.
	}
	for resp, err := range c.ListModels(ctx, req).All() {
		if err != nil {
			// TODO: Handle error and break/return/continue. Iteration will stop after any error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*ModelClient) ListOperations

ListOperations is a utility method from google.longrunning.Operations.

Examples

package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
	"google.golang.org/api/iterator"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewModelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.ListOperationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
	}
	it := c.ListOperations(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*longrunningpb.ListOperationsResponse)
	}
}
all
package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewModelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.ListOperationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
	}
	for resp, err := range c.ListOperations(ctx, req).All() {
		if err != nil {
			// TODO: Handle error and break/return/continue. Iteration will stop after any error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*ModelClient) PauseModel

func (c *ModelClient) PauseModel(ctx context.Context, req *retailpb.PauseModelRequest, opts ...gax.CallOption) (*retailpb.Model, error)

PauseModel pauses the training of an existing model.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewModelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.PauseModelRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#PauseModelRequest.
	}
	resp, err := c.PauseModel(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ModelClient) ResumeModel

func (c *ModelClient) ResumeModel(ctx context.Context, req *retailpb.ResumeModelRequest, opts ...gax.CallOption) (*retailpb.Model, error)

ResumeModel resumes the training of an existing model.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewModelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.ResumeModelRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#ResumeModelRequest.
	}
	resp, err := c.ResumeModel(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ModelClient) TuneModel

TuneModel tunes an existing model.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewModelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.TuneModelRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#TuneModelRequest.
	}
	op, err := c.TuneModel(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ModelClient) TuneModelOperation

func (c *ModelClient) TuneModelOperation(name string) *TuneModelOperation

TuneModelOperation returns a new TuneModelOperation from a given name. The name must be that of a previously created TuneModelOperation, possibly from a different process.

func (*ModelClient) UpdateModel

func (c *ModelClient) UpdateModel(ctx context.Context, req *retailpb.UpdateModelRequest, opts ...gax.CallOption) (*retailpb.Model, error)

UpdateModel update of model metadata. Only fields that currently can be updated are: filtering_option and periodic_tuning_state. If other values are provided, this API method ignores them.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewModelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.UpdateModelRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#UpdateModelRequest.
	}
	resp, err := c.UpdateModel(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

ModelIterator

type ModelIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*retailpb.Model, nextPageToken string, err error)
	// contains filtered or unexported fields
}

ModelIterator manages a stream of *retailpb.Model.

func (*ModelIterator) All

func (it *ModelIterator) All() iter.Seq2[*retailpb.Model, error]

All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.

func (*ModelIterator) Next

func (it *ModelIterator) Next() (*retailpb.Model, error)

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*ModelIterator) PageInfo

func (it *ModelIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.

OperationIterator

type OperationIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error)
	// contains filtered or unexported fields
}

OperationIterator manages a stream of *longrunningpb.Operation.

func (*OperationIterator) All

func (it *OperationIterator) All() iter.Seq2[*longrunningpb.Operation, error]

All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.

func (*OperationIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*OperationIterator) PageInfo

func (it *OperationIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.

PredictionCallOptions

type PredictionCallOptions struct {
	Predict        []gax.CallOption
	GetOperation   []gax.CallOption
	ListOperations []gax.CallOption
}

PredictionCallOptions contains the retry settings for each method of PredictionClient.

PredictionClient

type PredictionClient struct {

	// The call options for this service.
	CallOptions *PredictionCallOptions
	// contains filtered or unexported fields
}

PredictionClient is a client for interacting with Vertex AI Search for Retail API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Service for making recommendation prediction.

func NewPredictionClient

func NewPredictionClient(ctx context.Context, opts ...option.ClientOption) (*PredictionClient, error)

NewPredictionClient creates a new prediction service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Service for making recommendation prediction.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewPredictionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func NewPredictionRESTClient

func NewPredictionRESTClient(ctx context.Context, opts ...option.ClientOption) (*PredictionClient, error)

NewPredictionRESTClient creates a new prediction service rest client.

Service for making recommendation prediction.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewPredictionRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*PredictionClient) Close

func (c *PredictionClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*PredictionClient) Connection (deprecated)

func (c *PredictionClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*PredictionClient) GetOperation

GetOperation is a utility method from google.longrunning.Operations.

Example

package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewPredictionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.GetOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
	}
	resp, err := c.GetOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*PredictionClient) ListOperations

ListOperations is a utility method from google.longrunning.Operations.

Examples

package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
	"google.golang.org/api/iterator"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewPredictionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.ListOperationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
	}
	it := c.ListOperations(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*longrunningpb.ListOperationsResponse)
	}
}
all
package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewPredictionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.ListOperationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
	}
	for resp, err := range c.ListOperations(ctx, req).All() {
		if err != nil {
			// TODO: Handle error and break/return/continue. Iteration will stop after any error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*PredictionClient) Predict

Predict makes a recommendation prediction.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewPredictionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &retailpb.PredictRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2/retailpb#PredictRequest.
	}
	resp, err := c.Predict(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

ProductCallOptions

type ProductCallOptions struct {
	CreateProduct           []gax.CallOption
	GetProduct              []gax.CallOption
	ListProducts            []gax.CallOption
	UpdateProduct           []gax.CallOption
	DeleteProduct           []gax.CallOption
	PurgeProducts           []gax.CallOption
	ImportProducts          []gax.CallOption
	SetInventory            []gax.CallOption
	AddFulfillmentPlaces    []gax.CallOption
	RemoveFulfillmentPlaces []gax.CallOption
	AddLocalInventories     []gax.CallOption
	RemoveLocalInventories  []gax.CallOption
	GetOperation            []gax.CallOption
	ListOperations          []gax.CallOption
}

ProductCallOptions contains the retry settings for each method of ProductClient.

ProductClient

type ProductClient struct {

	// The call options for this service.
	CallOptions *ProductCallOptions

	// LROClient is used internally to handle long-running operations.
	// It is exposed so that its CallOptions can be modified if required.
	// Users should not Close this client.
	LROClient *lroauto.OperationsClient
	// contains filtered or unexported fields
}

ProductClient is a client for interacting with Vertex AI Search for Retail API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Service for ingesting Product information of the customer’s website.

func NewProductClient

func NewProductClient(ctx context.Context, opts ...option.ClientOption) (*ProductClient, error)

NewProductClient creates a new product service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Service for ingesting Product information of the customer’s website.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewProductClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func NewProductRESTClient

func NewProductRESTClient(ctx context.Context, opts ...option.ClientOption) (*ProductClient, error)

NewProductRESTClient creates a new product service rest client.

Service for ingesting Product information of the customer’s website.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := retail.NewProductRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*ProductClient) AddFulfillmentPlaces

AddFulfillmentPlaces we recommend that you use the ProductService.AddLocalInventories method instead of the ProductService.AddFulfillmentPlaces method. ProductService.AddLocalInventories achieves the same results but provides more fine-grained control over ingesting local inventory data.

Incrementally adds place IDs to Product.fulfillment_info.place_ids.

This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.

The returned Operations will be obsolete after 1 day, and GetOperation API will return NOT_FOUND afterwards.

If conflicting updates are issued, the Operations associated with the stale updates will not be marked as done until being obsolete.

Example

package main

import (
	"context"

	retail "cloud.google.com/go/retail/apiv2"

	retailpb "cloud.google.com/go/retail/apiv2/retailpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c,