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.
NOTE: This package is in alpha. It is not stable, and is likely to change.
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:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage
To get started with this package, create a client.
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.
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/apiv2alpha/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
func (op *AddFulfillmentPlacesOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*AddFulfillmentPlacesOperation) Metadata
func (op *AddFulfillmentPlacesOperation) Metadata() (*retailpb.AddFulfillmentPlacesMetadata, error)
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
func (op *AddFulfillmentPlacesOperation) 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 (*AddFulfillmentPlacesOperation) Poll
func (op *AddFulfillmentPlacesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.AddFulfillmentPlacesResponse, error)
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
func (op *AddFulfillmentPlacesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.AddFulfillmentPlacesResponse, error)
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
func (op *AddLocalInventoriesOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*AddLocalInventoriesOperation) Metadata
func (op *AddLocalInventoriesOperation) Metadata() (*retailpb.AddLocalInventoriesMetadata, error)
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
func (op *AddLocalInventoriesOperation) 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 (*AddLocalInventoriesOperation) Poll
func (op *AddLocalInventoriesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.AddLocalInventoriesResponse, error)
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
func (op *AddLocalInventoriesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.AddLocalInventoriesResponse, error)
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/apiv2alpha"
)
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/apiv2alpha"
)
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
func (c *AnalyticsClient) ExportAnalyticsMetrics(ctx context.Context, req *retailpb.ExportAnalyticsMetricsRequest, opts ...gax.CallOption) (*ExportAnalyticsMetricsOperation, error)
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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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
func (c *AnalyticsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
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/apiv2alpha"
)
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
func (c *AnalyticsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
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/apiv2alpha"
"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/apiv2alpha"
)
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.
}
// TODO: Use resp.
_ = resp
}
}
BranchCallOptions
type BranchCallOptions struct {
ListBranches []gax.CallOption
GetBranch []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
BranchCallOptions contains the retry settings for each method of BranchClient.
BranchClient
type BranchClient struct {
// The call options for this service.
CallOptions *BranchCallOptions
// contains filtered or unexported fields
}
BranchClient 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 Branch Management
Branches are automatically created when a Catalog is created. There are fixed three branches in each catalog, and may use ListBranches method to get the details of all branches.
func NewBranchClient
func NewBranchClient(ctx context.Context, opts ...option.ClientOption) (*BranchClient, error)
NewBranchClient creates a new branch 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 Branch Management
Branches are automatically created when a Catalog is created. There are fixed three branches in each catalog, and may use ListBranches method to get the details of all branches.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
)
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.NewBranchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewBranchRESTClient
func NewBranchRESTClient(ctx context.Context, opts ...option.ClientOption) (*BranchClient, error)
NewBranchRESTClient creates a new branch service rest client.
Service for Branch Management
Branches are automatically created when a Catalog is created. There are fixed three branches in each catalog, and may use ListBranches method to get the details of all branches.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
)
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.NewBranchRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*BranchClient) Close
func (c *BranchClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*BranchClient) Connection (deprecated)
func (c *BranchClient) 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 (*BranchClient) GetBranch
func (c *BranchClient) GetBranch(ctx context.Context, req *retailpb.GetBranchRequest, opts ...gax.CallOption) (*retailpb.Branch, error)
GetBranch retrieves a Branch.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewBranchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.GetBranchRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#GetBranchRequest.
}
resp, err := c.GetBranch(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*BranchClient) GetOperation
func (c *BranchClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
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/apiv2alpha"
)
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.NewBranchClient(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 (*BranchClient) ListBranches
func (c *BranchClient) ListBranches(ctx context.Context, req *retailpb.ListBranchesRequest, opts ...gax.CallOption) (*retailpb.ListBranchesResponse, error)
ListBranches lists all instances of Branch under the specified parent Catalog.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewBranchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.ListBranchesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#ListBranchesRequest.
}
resp, err := c.ListBranches(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*BranchClient) ListOperations
func (c *BranchClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
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/apiv2alpha"
"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.NewBranchClient(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/apiv2alpha"
)
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.NewBranchClient(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.
}
// 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
BatchRemoveCatalogAttributes []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/apiv2alpha"
)
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/apiv2alpha"
)
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
func (c *CatalogClient) AddCatalogAttribute(ctx context.Context, req *retailpb.AddCatalogAttributeRequest, opts ...gax.CallOption) (*retailpb.AttributesConfig, error)
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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/retailpb#AddCatalogAttributeRequest.
}
resp, err := c.AddCatalogAttribute(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CatalogClient) BatchRemoveCatalogAttributes
func (c *CatalogClient) BatchRemoveCatalogAttributes(ctx context.Context, req *retailpb.BatchRemoveCatalogAttributesRequest, opts ...gax.CallOption) (*retailpb.BatchRemoveCatalogAttributesResponse, error)
BatchRemoveCatalogAttributes removes all specified CatalogAttributes from the AttributesConfig.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.BatchRemoveCatalogAttributesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#BatchRemoveCatalogAttributesRequest.
}
resp, err := c.BatchRemoveCatalogAttributes(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
func (c *CatalogClient) GetAttributesConfig(ctx context.Context, req *retailpb.GetAttributesConfigRequest, opts ...gax.CallOption) (*retailpb.AttributesConfig, error)
GetAttributesConfig gets an AttributesConfig.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/retailpb#GetAttributesConfigRequest.
}
resp, err := c.GetAttributesConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CatalogClient) GetCompletionConfig
func (c *CatalogClient) GetCompletionConfig(ctx context.Context, req *retailpb.GetCompletionConfigRequest, opts ...gax.CallOption) (*retailpb.CompletionConfig, error)
GetCompletionConfig gets a CompletionConfig.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/retailpb#GetCompletionConfigRequest.
}
resp, err := c.GetCompletionConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CatalogClient) GetDefaultBranch
func (c *CatalogClient) GetDefaultBranch(ctx context.Context, req *retailpb.GetDefaultBranchRequest, opts ...gax.CallOption) (*retailpb.GetDefaultBranchResponse, error)
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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/retailpb#GetDefaultBranchRequest.
}
resp, err := c.GetDefaultBranch(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CatalogClient) GetOperation
func (c *CatalogClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
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/apiv2alpha"
)
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
func (c *CatalogClient) ListCatalogs(ctx context.Context, req *retailpb.ListCatalogsRequest, opts ...gax.CallOption) *CatalogIterator
ListCatalogs lists all the Catalogs associated with the project.
Examples
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/retailpb#ListCatalogsRequest.
}
for resp, err := range c.ListCatalogs(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*CatalogClient) ListOperations
func (c *CatalogClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
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/apiv2alpha"
"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/apiv2alpha"
)
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.
}
// TODO: Use resp.
_ = resp
}
}
func (*CatalogClient) RemoveCatalogAttribute
func (c *CatalogClient) RemoveCatalogAttribute(ctx context.Context, req *retailpb.RemoveCatalogAttributeRequest, opts ...gax.CallOption) (*retailpb.AttributesConfig, error)
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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/retailpb#RemoveCatalogAttributeRequest.
}
resp, err := c.RemoveCatalogAttribute(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CatalogClient) ReplaceCatalogAttribute
func (c *CatalogClient) ReplaceCatalogAttribute(ctx context.Context, req *retailpb.ReplaceCatalogAttributeRequest, opts ...gax.CallOption) (*retailpb.AttributesConfig, error)
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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/retailpb#SetDefaultBranchRequest.
}
err = c.SetDefaultBranch(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*CatalogClient) UpdateAttributesConfig
func (c *CatalogClient) UpdateAttributesConfig(ctx context.Context, req *retailpb.UpdateAttributesConfigRequest, opts ...gax.CallOption) (*retailpb.AttributesConfig, error)
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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/retailpb#UpdateCatalogRequest.
}
resp, err := c.UpdateCatalog(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CatalogClient) UpdateCompletionConfig
func (c *CatalogClient) UpdateCompletionConfig(ctx context.Context, req *retailpb.UpdateCompletionConfigRequest, opts ...gax.CallOption) (*retailpb.CompletionConfig, error)
UpdateCompletionConfig updates the CompletionConfigs.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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/apiv2alpha"
)
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/apiv2alpha"
)
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
func (c *CompletionClient) CompleteQuery(ctx context.Context, req *retailpb.CompleteQueryRequest, opts ...gax.CallOption) (*retailpb.CompleteQueryResponse, error)
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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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
func (c *CompletionClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
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/apiv2alpha"
)
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
func (c *CompletionClient) ImportCompletionData(ctx context.Context, req *retailpb.ImportCompletionDataRequest, opts ...gax.CallOption) (*ImportCompletionDataOperation, error)
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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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
func (c *CompletionClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
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/apiv2alpha"
"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/apiv2alpha"
)
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.
}
// 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/apiv2alpha"
)
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/apiv2alpha"
)
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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/retailpb#DeleteControlRequest.
}
err = c.DeleteControl(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ControlClient) GetControl
func (c *ControlClient) GetControl(ctx context.Context, req *retailpb.GetControlRequest, opts ...gax.CallOption) (*retailpb.Control, error)
GetControl gets a Control.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/retailpb#GetControlRequest.
}
resp, err := c.GetControl(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ControlClient) GetOperation
func (c *ControlClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
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/apiv2alpha"
)
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
func (c *ControlClient) ListControls(ctx context.Context, req *retailpb.ListControlsRequest, opts ...gax.CallOption) *ControlIterator
ListControls lists all Controls by their parent Catalog.
Examples
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/retailpb#ListControlsRequest.
}
for resp, err := range c.ListControls(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ControlClient) ListOperations
func (c *ControlClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
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/apiv2alpha"
"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/apiv2alpha"
)
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.
}
// 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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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.
CreateMerchantCenterAccountLinkOperation
type CreateMerchantCenterAccountLinkOperation struct {
// contains filtered or unexported fields
}
CreateMerchantCenterAccountLinkOperation manages a long-running operation from CreateMerchantCenterAccountLink.
func (*CreateMerchantCenterAccountLinkOperation) Done
func (op *CreateMerchantCenterAccountLinkOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateMerchantCenterAccountLinkOperation) Metadata
func (op *CreateMerchantCenterAccountLinkOperation) Metadata() (*retailpb.CreateMerchantCenterAccountLinkMetadata, error)
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 (*CreateMerchantCenterAccountLinkOperation) Name
func (op *CreateMerchantCenterAccountLinkOperation) 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 (*CreateMerchantCenterAccountLinkOperation) Poll
func (op *CreateMerchantCenterAccountLinkOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.MerchantCenterAccountLink, error)
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 (*CreateMerchantCenterAccountLinkOperation) Wait
func (op *CreateMerchantCenterAccountLinkOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.MerchantCenterAccountLink, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
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
func (op *CreateModelOperation) Metadata() (*retailpb.CreateModelMetadata, error)
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
func (op *CreateModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.Model, error)
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
func (op *CreateModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.Model, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
EnrollSolutionOperation
type EnrollSolutionOperation struct {
// contains filtered or unexported fields
}
EnrollSolutionOperation manages a long-running operation from EnrollSolution.
func (*EnrollSolutionOperation) Done
func (op *EnrollSolutionOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*EnrollSolutionOperation) Metadata
func (op *EnrollSolutionOperation) Metadata() (*retailpb.EnrollSolutionMetadata, error)
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 (*EnrollSolutionOperation) Name
func (op *EnrollSolutionOperation) 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 (*EnrollSolutionOperation) Poll
func (op *EnrollSolutionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.EnrollSolutionResponse, error)
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 (*EnrollSolutionOperation) Wait
func (op *EnrollSolutionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.EnrollSolutionResponse, error)
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
func (op *ExportAnalyticsMetricsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ExportAnalyticsMetricsOperation) Metadata
func (op *ExportAnalyticsMetricsOperation) Metadata() (*retailpb.ExportMetadata, error)
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
func (op *ExportAnalyticsMetricsOperation) 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 (*ExportAnalyticsMetricsOperation) Poll
func (op *ExportAnalyticsMetricsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.ExportAnalyticsMetricsResponse, error)
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
func (op *ExportAnalyticsMetricsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.ExportAnalyticsMetricsResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
ExportProductsOperation
type ExportProductsOperation struct {
// contains filtered or unexported fields
}
ExportProductsOperation manages a long-running operation from ExportProducts.
func (*ExportProductsOperation) Done
func (op *ExportProductsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ExportProductsOperation) Metadata
func (op *ExportProductsOperation) Metadata() (*retailpb.ExportMetadata, error)
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 (*ExportProductsOperation) Name
func (op *ExportProductsOperation) 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 (*ExportProductsOperation) Poll
func (op *ExportProductsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.ExportProductsResponse, error)
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 (*ExportProductsOperation) Wait
func (op *ExportProductsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.ExportProductsResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
ExportUserEventsOperation
type ExportUserEventsOperation struct {
// contains filtered or unexported fields
}
ExportUserEventsOperation manages a long-running operation from ExportUserEvents.
func (*ExportUserEventsOperation) Done
func (op *ExportUserEventsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ExportUserEventsOperation) Metadata
func (op *ExportUserEventsOperation) Metadata() (*retailpb.ExportMetadata, error)
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 (*ExportUserEventsOperation) Name
func (op *ExportUserEventsOperation) 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 (*ExportUserEventsOperation) Poll
func (op *ExportUserEventsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.ExportUserEventsResponse, error)
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 (*ExportUserEventsOperation) Wait
func (op *ExportUserEventsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.ExportUserEventsResponse, error)
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/apiv2alpha"
)
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/apiv2alpha"
)
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
func (c *GenerativeQuestionClient) BatchUpdateGenerativeQuestionConfigs(ctx context.Context, req *retailpb.BatchUpdateGenerativeQuestionConfigsRequest, opts ...gax.CallOption) (*retailpb.BatchUpdateGenerativeQuestionConfigsResponse, error)
BatchUpdateGenerativeQuestionConfigs allows management of multiple questions.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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
func (c *GenerativeQuestionClient) GetGenerativeQuestionsFeatureConfig(ctx context.Context, req *retailpb.GetGenerativeQuestionsFeatureConfigRequest, opts ...gax.CallOption) (*retailpb.GenerativeQuestionsFeatureConfig, error)
GetGenerativeQuestionsFeatureConfig manages overal generative question feature state – enables toggling feature on and off.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/retailpb#GetGenerativeQuestionsFeatureConfigRequest.
}
resp, err := c.GetGenerativeQuestionsFeatureConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GenerativeQuestionClient) GetOperation
func (c *GenerativeQuestionClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
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/apiv2alpha"
)
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
func (c *GenerativeQuestionClient) ListGenerativeQuestionConfigs(ctx context.Context, req *retailpb.ListGenerativeQuestionConfigsRequest, opts ...gax.CallOption) (*retailpb.ListGenerativeQuestionConfigsResponse, error)
ListGenerativeQuestionConfigs returns all questions for a given catalog.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/retailpb#ListGenerativeQuestionConfigsRequest.
}
resp, err := c.ListGenerativeQuestionConfigs(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GenerativeQuestionClient) ListOperations
func (c *GenerativeQuestionClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
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/apiv2alpha"
"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/apiv2alpha"
)
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.
}
// TODO: Use resp.
_ = resp
}
}
func (*GenerativeQuestionClient) UpdateGenerativeQuestionConfig
func (c *GenerativeQuestionClient) UpdateGenerativeQuestionConfig(ctx context.Context, req *retailpb.UpdateGenerativeQuestionConfigRequest, opts ...gax.CallOption) (*retailpb.GenerativeQuestionConfig, error)
UpdateGenerativeQuestionConfig allows management of individual questions.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/retailpb#UpdateGenerativeQuestionConfigRequest.
}
resp, err := c.UpdateGenerativeQuestionConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GenerativeQuestionClient) UpdateGenerativeQuestionsFeatureConfig
func (c *GenerativeQuestionClient) UpdateGenerativeQuestionsFeatureConfig(ctx context.Context, req *retailpb.UpdateGenerativeQuestionsFeatureConfigRequest, opts ...gax.CallOption) (*retailpb.GenerativeQuestionsFeatureConfig, error)
UpdateGenerativeQuestionsFeatureConfig manages overal generative question feature state – enables toggling feature on and off.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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
func (op *ImportCompletionDataOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ImportCompletionDataOperation) Metadata
func (op *ImportCompletionDataOperation) Metadata() (*retailpb.ImportMetadata, error)
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
func (op *ImportCompletionDataOperation) 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 (*ImportCompletionDataOperation) Poll
func (op *ImportCompletionDataOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.ImportCompletionDataResponse, error)
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
func (op *ImportCompletionDataOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.ImportCompletionDataResponse, error)
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
func (op *ImportProductsOperation) Metadata() (*retailpb.ImportMetadata, error)
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
func (op *ImportProductsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.ImportProductsResponse, error)
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
func (op *ImportProductsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.ImportProductsResponse, error)
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
func (op *ImportUserEventsOperation) Metadata() (*retailpb.ImportMetadata, error)
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
func (op *ImportUserEventsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.ImportUserEventsResponse, error)
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
func (op *ImportUserEventsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.ImportUserEventsResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
MerchantCenterAccountLinkCallOptions
type MerchantCenterAccountLinkCallOptions struct {
ListMerchantCenterAccountLinks []gax.CallOption
CreateMerchantCenterAccountLink []gax.CallOption
DeleteMerchantCenterAccountLink []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
MerchantCenterAccountLinkCallOptions contains the retry settings for each method of MerchantCenterAccountLinkClient.
MerchantCenterAccountLinkClient
type MerchantCenterAccountLinkClient struct {
// The call options for this service.
CallOptions *MerchantCenterAccountLinkCallOptions
// 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
}
MerchantCenterAccountLinkClient 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.
Merchant Center Link service to link a Branch to a Merchant Center Account.
func NewMerchantCenterAccountLinkClient
func NewMerchantCenterAccountLinkClient(ctx context.Context, opts ...option.ClientOption) (*MerchantCenterAccountLinkClient, error)
NewMerchantCenterAccountLinkClient creates a new merchant center account link service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Merchant Center Link service to link a Branch to a Merchant Center Account.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
)
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.NewMerchantCenterAccountLinkClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewMerchantCenterAccountLinkRESTClient
func NewMerchantCenterAccountLinkRESTClient(ctx context.Context, opts ...option.ClientOption) (*MerchantCenterAccountLinkClient, error)
NewMerchantCenterAccountLinkRESTClient creates a new merchant center account link service rest client.
Merchant Center Link service to link a Branch to a Merchant Center Account.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
)
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.NewMerchantCenterAccountLinkRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*MerchantCenterAccountLinkClient) Close
func (c *MerchantCenterAccountLinkClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*MerchantCenterAccountLinkClient) Connection (deprecated)
func (c *MerchantCenterAccountLinkClient) 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 (*MerchantCenterAccountLinkClient) CreateMerchantCenterAccountLink
func (c *MerchantCenterAccountLinkClient) CreateMerchantCenterAccountLink(ctx context.Context, req *retailpb.CreateMerchantCenterAccountLinkRequest, opts ...gax.CallOption) (*CreateMerchantCenterAccountLinkOperation, error)
CreateMerchantCenterAccountLink creates a MerchantCenterAccountLink.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewMerchantCenterAccountLinkClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.CreateMerchantCenterAccountLinkRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#CreateMerchantCenterAccountLinkRequest.
}
op, err := c.CreateMerchantCenterAccountLink(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*MerchantCenterAccountLinkClient) CreateMerchantCenterAccountLinkOperation
func (c *MerchantCenterAccountLinkClient) CreateMerchantCenterAccountLinkOperation(name string) *CreateMerchantCenterAccountLinkOperation
CreateMerchantCenterAccountLinkOperation returns a new CreateMerchantCenterAccountLinkOperation from a given name. The name must be that of a previously created CreateMerchantCenterAccountLinkOperation, possibly from a different process.
func (*MerchantCenterAccountLinkClient) DeleteMerchantCenterAccountLink
func (c *MerchantCenterAccountLinkClient) DeleteMerchantCenterAccountLink(ctx context.Context, req *retailpb.DeleteMerchantCenterAccountLinkRequest, opts ...gax.CallOption) error
DeleteMerchantCenterAccountLink deletes a MerchantCenterAccountLink. If the MerchantCenterAccountLink to delete does not exist, a NOT_FOUND error is returned.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewMerchantCenterAccountLinkClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.DeleteMerchantCenterAccountLinkRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#DeleteMerchantCenterAccountLinkRequest.
}
err = c.DeleteMerchantCenterAccountLink(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*MerchantCenterAccountLinkClient) GetOperation
func (c *MerchantCenterAccountLinkClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
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/apiv2alpha"
)
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.NewMerchantCenterAccountLinkClient(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 (*MerchantCenterAccountLinkClient) ListMerchantCenterAccountLinks
func (c *MerchantCenterAccountLinkClient) ListMerchantCenterAccountLinks(ctx context.Context, req *retailpb.ListMerchantCenterAccountLinksRequest, opts ...gax.CallOption) (*retailpb.ListMerchantCenterAccountLinksResponse, error)
ListMerchantCenterAccountLinks lists all MerchantCenterAccountLinks under the specified parent Catalog.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewMerchantCenterAccountLinkClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.ListMerchantCenterAccountLinksRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#ListMerchantCenterAccountLinksRequest.
}
resp, err := c.ListMerchantCenterAccountLinks(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*MerchantCenterAccountLinkClient) ListOperations
func (c *MerchantCenterAccountLinkClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
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/apiv2alpha"
"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.NewMerchantCenterAccountLinkClient(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/apiv2alpha"
)
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.NewMerchantCenterAccountLinkClient(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.
}
// TODO: Use resp.
_ = resp
}
}
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/apiv2alpha"
)
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/apiv2alpha"
)
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
func (c *ModelClient) CreateModel(ctx context.Context, req *retailpb.CreateModelRequest, opts ...gax.CallOption) (*CreateModelOperation, error)
CreateModel creates a new model.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/retailpb#GetModelRequest.
}
resp, err := c.GetModel(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ModelClient) GetOperation
func (c *ModelClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
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/apiv2alpha"
)
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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/retailpb#ListModelsRequest.
}
for resp, err := range c.ListModels(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ModelClient) ListOperations
func (c *ModelClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
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/apiv2alpha"
"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/apiv2alpha"
)
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.
}
// 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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/retailpb#ResumeModelRequest.
}
resp, err := c.ResumeModel(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ModelClient) TuneModel
func (c *ModelClient) TuneModel(ctx context.Context, req *retailpb.TuneModelRequest, opts ...gax.CallOption) (*TuneModelOperation, error)
TuneModel tunes an existing model.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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
func (it *OperationIterator) Next() (*longrunningpb.Operation, 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 (*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/apiv2alpha"
)
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/apiv2alpha"
)
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
func (c *PredictionClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
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/apiv2alpha"
)
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
func (c *PredictionClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
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/apiv2alpha"
"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/apiv2alpha"
)
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.
}
// TODO: Use resp.
_ = resp
}
}
func (*PredictionClient) Predict
func (c *PredictionClient) Predict(ctx context.Context, req *retailpb.PredictRequest, opts ...gax.CallOption) (*retailpb.PredictResponse, error)
Predict makes a recommendation prediction.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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/apiv2alpha/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
ExportProducts []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/apiv2alpha"
)
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/apiv2alpha"
)
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
func (c *ProductClient) AddFulfillmentPlaces(ctx context.Context, req *retailpb.AddFulfillmentPlacesRequest, opts ...gax.CallOption) (*AddFulfillmentPlacesOperation, error)
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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProductClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.AddFulfillmentPlacesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#AddFulfillmentPlacesRequest.
}
op, err := c.AddFulfillmentPlaces(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ProductClient) AddFulfillmentPlacesOperation
func (c *ProductClient) AddFulfillmentPlacesOperation(name string) *AddFulfillmentPlacesOperation
AddFulfillmentPlacesOperation returns a new AddFulfillmentPlacesOperation from a given name. The name must be that of a previously created AddFulfillmentPlacesOperation, possibly from a different process.
func (*ProductClient) AddLocalInventories
func (c *ProductClient) AddLocalInventories(ctx context.Context, req *retailpb.AddLocalInventoriesRequest, opts ...gax.CallOption) (*AddLocalInventoriesOperation, error)
AddLocalInventories updates local inventory information for a Product at a list of places, while respecting the last update timestamps of each inventory field.
This process is asynchronous and does not require the Product to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
Local inventory information can only be modified using this method. ProductService.CreateProduct and ProductService.UpdateProduct has no effect on local inventories.
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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProductClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.AddLocalInventoriesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#AddLocalInventoriesRequest.
}
op, err := c.AddLocalInventories(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ProductClient) AddLocalInventoriesOperation
func (c *ProductClient) AddLocalInventoriesOperation(name string) *AddLocalInventoriesOperation
AddLocalInventoriesOperation returns a new AddLocalInventoriesOperation from a given name. The name must be that of a previously created AddLocalInventoriesOperation, possibly from a different process.
func (*ProductClient) Close
func (c *ProductClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ProductClient) Connection (deprecated)
func (c *ProductClient) 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 (*ProductClient) CreateProduct
func (c *ProductClient) CreateProduct(ctx context.Context, req *retailpb.CreateProductRequest, opts ...gax.CallOption) (*retailpb.Product, error)
CreateProduct creates a Product.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProductClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.CreateProductRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#CreateProductRequest.
}
resp, err := c.CreateProduct(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ProductClient) DeleteProduct
func (c *ProductClient) DeleteProduct(ctx context.Context, req *retailpb.DeleteProductRequest, opts ...gax.CallOption) error
DeleteProduct deletes a Product.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProductClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.DeleteProductRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#DeleteProductRequest.
}
err = c.DeleteProduct(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ProductClient) ExportProducts
func (c *ProductClient) ExportProducts(ctx context.Context, req *retailpb.ExportProductsRequest, opts ...gax.CallOption) (*ExportProductsOperation, error)
ExportProducts exports multiple Products.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProductClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.ExportProductsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#ExportProductsRequest.
}
op, err := c.ExportProducts(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ProductClient) ExportProductsOperation
func (c *ProductClient) ExportProductsOperation(name string) *ExportProductsOperation
ExportProductsOperation returns a new ExportProductsOperation from a given name. The name must be that of a previously created ExportProductsOperation, possibly from a different process.
func (*ProductClient) GetOperation
func (c *ProductClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
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/apiv2alpha"
)
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()
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 (*ProductClient) GetProduct
func (c *ProductClient) GetProduct(ctx context.Context, req *retailpb.GetProductRequest, opts ...gax.CallOption) (*retailpb.Product, error)
GetProduct gets a Product.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProductClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.GetProductRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#GetProductRequest.
}
resp, err := c.GetProduct(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ProductClient) ImportProducts
func (c *ProductClient) ImportProducts(ctx context.Context, req *retailpb.ImportProductsRequest, opts ...gax.CallOption) (*ImportProductsOperation, error)
ImportProducts bulk import of multiple Products.
Request processing may be synchronous. Non-existing items are created.
Note that it is possible for a subset of the Products to be successfully updated.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProductClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.ImportProductsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#ImportProductsRequest.
}
op, err := c.ImportProducts(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ProductClient) ImportProductsOperation
func (c *ProductClient) ImportProductsOperation(name string) *ImportProductsOperation
ImportProductsOperation returns a new ImportProductsOperation from a given name. The name must be that of a previously created ImportProductsOperation, possibly from a different process.
func (*ProductClient) ListOperations
func (c *ProductClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
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/apiv2alpha"
"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.NewProductClient(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/apiv2alpha"
)
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()
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.
}
// TODO: Use resp.
_ = resp
}
}
func (*ProductClient) ListProducts
func (c *ProductClient) ListProducts(ctx context.Context, req *retailpb.ListProductsRequest, opts ...gax.CallOption) *ProductIterator
ListProducts gets a list of Products.
Examples
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProductClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.ListProductsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#ListProductsRequest.
}
it := c.ListProducts(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.ListProductsResponse)
}
}
all
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProductClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.ListProductsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#ListProductsRequest.
}
for resp, err := range c.ListProducts(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ProductClient) PurgeProducts
func (c *ProductClient) PurgeProducts(ctx context.Context, req *retailpb.PurgeProductsRequest, opts ...gax.CallOption) (*PurgeProductsOperation, error)
PurgeProducts permanently deletes all selected Products under a branch.
This process is asynchronous. If the request is valid, the removal will be enqueued and processed offline. Depending on the number of Products, this operation could take hours to complete. Before the operation completes, some Products may still be returned by ProductService.GetProduct or ProductService.ListProducts.
Depending on the number of Products, this operation could take hours to complete. To get a sample of Products that would be deleted, set PurgeProductsRequest.force to false.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProductClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.PurgeProductsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#PurgeProductsRequest.
}
op, err := c.PurgeProducts(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ProductClient) PurgeProductsOperation
func (c *ProductClient) PurgeProductsOperation(name string) *PurgeProductsOperation
PurgeProductsOperation returns a new PurgeProductsOperation from a given name. The name must be that of a previously created PurgeProductsOperation, possibly from a different process.
func (*ProductClient) RemoveFulfillmentPlaces
func (c *ProductClient) RemoveFulfillmentPlaces(ctx context.Context, req *retailpb.RemoveFulfillmentPlacesRequest, opts ...gax.CallOption) (*RemoveFulfillmentPlacesOperation, error)
RemoveFulfillmentPlaces we recommend that you use the ProductService.RemoveLocalInventories method instead of the ProductService.RemoveFulfillmentPlaces method. ProductService.RemoveLocalInventories achieves the same results but provides more fine-grained control over ingesting local inventory data.
Incrementally removes place IDs from a 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 removed 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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProductClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.RemoveFulfillmentPlacesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#RemoveFulfillmentPlacesRequest.
}
op, err := c.RemoveFulfillmentPlaces(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ProductClient) RemoveFulfillmentPlacesOperation
func (c *ProductClient) RemoveFulfillmentPlacesOperation(name string) *RemoveFulfillmentPlacesOperation
RemoveFulfillmentPlacesOperation returns a new RemoveFulfillmentPlacesOperation from a given name. The name must be that of a previously created RemoveFulfillmentPlacesOperation, possibly from a different process.
func (*ProductClient) RemoveLocalInventories
func (c *ProductClient) RemoveLocalInventories(ctx context.Context, req *retailpb.RemoveLocalInventoriesRequest, opts ...gax.CallOption) (*RemoveLocalInventoriesOperation, error)
RemoveLocalInventories remove local inventory information for a Product at a list of places at a removal timestamp.
This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
Local inventory information can only be removed using this method. ProductService.CreateProduct and ProductService.UpdateProduct has no effect on local inventories.
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/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProductClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.RemoveLocalInventoriesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#RemoveLocalInventoriesRequest.
}
op, err := c.RemoveLocalInventories(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ProductClient) RemoveLocalInventoriesOperation
func (c *ProductClient) RemoveLocalInventoriesOperation(name string) *RemoveLocalInventoriesOperation
RemoveLocalInventoriesOperation returns a new RemoveLocalInventoriesOperation from a given name. The name must be that of a previously created RemoveLocalInventoriesOperation, possibly from a different process.
func (*ProductClient) SetInventory
func (c *ProductClient) SetInventory(ctx context.Context, req *retailpb.SetInventoryRequest, opts ...gax.CallOption) (*SetInventoryOperation, error)
SetInventory updates inventory information for a Product while respecting the last update timestamps of each inventory field.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update is enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
When inventory is updated with ProductService.CreateProduct and ProductService.UpdateProduct, the specified inventory field value(s) overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update times for the specified inventory fields are overwritten by the times of the ProductService.CreateProduct or ProductService.UpdateProduct request.
If no inventory fields are set in CreateProductRequest.product, then any pre-existing inventory information for this product is used.
If no inventory fields are set in SetInventoryRequest.set_mask, then any existing inventory information is preserved.
Pre-existing inventory information can only be updated with ProductService.SetInventory, ProductService.AddFulfillmentPlaces, and ProductService.RemoveFulfillmentPlaces.
The returned Operations is obsolete after one day, and the GetOperation API returns NOT_FOUND afterwards.
If conflicting updates are issued, the Operations associated with the stale updates are not marked as done until they are obsolete.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProductClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.SetInventoryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#SetInventoryRequest.
}
op, err := c.SetInventory(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ProductClient) SetInventoryOperation
func (c *ProductClient) SetInventoryOperation(name string) *SetInventoryOperation
SetInventoryOperation returns a new SetInventoryOperation from a given name. The name must be that of a previously created SetInventoryOperation, possibly from a different process.
func (*ProductClient) UpdateProduct
func (c *ProductClient) UpdateProduct(ctx context.Context, req *retailpb.UpdateProductRequest, opts ...gax.CallOption) (*retailpb.Product, error)
UpdateProduct updates a Product.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProductClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.UpdateProductRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#UpdateProductRequest.
}
resp, err := c.UpdateProduct(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
ProductIterator
type ProductIterator 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.Product, nextPageToken string, err error)
// contains filtered or unexported fields
}
ProductIterator manages a stream of *retailpb.Product.
func (*ProductIterator) All
func (it *ProductIterator) All() iter.Seq2[*retailpb.Product, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ProductIterator) Next
func (it *ProductIterator) Next() (*retailpb.Product, 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 (*ProductIterator) PageInfo
func (it *ProductIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
ProjectCallOptions
type ProjectCallOptions struct {
GetProject []gax.CallOption
AcceptTerms []gax.CallOption
EnrollSolution []gax.CallOption
ListEnrolledSolutions []gax.CallOption
GetLoggingConfig []gax.CallOption
UpdateLoggingConfig []gax.CallOption
GetAlertConfig []gax.CallOption
UpdateAlertConfig []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
ProjectCallOptions contains the retry settings for each method of ProjectClient.
ProjectClient
type ProjectClient struct {
// The call options for this service.
CallOptions *ProjectCallOptions
// 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
}
ProjectClient 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 settings at Project level.
func NewProjectClient
func NewProjectClient(ctx context.Context, opts ...option.ClientOption) (*ProjectClient, error)
NewProjectClient creates a new project 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 settings at Project level.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
)
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.NewProjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewProjectRESTClient
func NewProjectRESTClient(ctx context.Context, opts ...option.ClientOption) (*ProjectClient, error)
NewProjectRESTClient creates a new project service rest client.
Service for settings at Project level.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
)
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.NewProjectRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*ProjectClient) AcceptTerms
func (c *ProjectClient) AcceptTerms(ctx context.Context, req *retailpb.AcceptTermsRequest, opts ...gax.CallOption) (*retailpb.Project, error)
AcceptTerms accepts service terms for this project. By making requests to this API, you agree to the terms of service linked below. https://cloud.google.com/retail/data-use-terms (at https://cloud.google.com/retail/data-use-terms)
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.AcceptTermsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#AcceptTermsRequest.
}
resp, err := c.AcceptTerms(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ProjectClient) Close
func (c *ProjectClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ProjectClient) Connection (deprecated)
func (c *ProjectClient) 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 (*ProjectClient) EnrollSolution
func (c *ProjectClient) EnrollSolution(ctx context.Context, req *retailpb.EnrollSolutionRequest, opts ...gax.CallOption) (*EnrollSolutionOperation, error)
EnrollSolution the method enrolls a solution of type [Retail Search][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH] into a project.
The [Recommendations AI solution type][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_RECOMMENDATION] is enrolled by default when your project enables Retail API, so you don’t need to call the enrollSolution method for recommendations.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.EnrollSolutionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#EnrollSolutionRequest.
}
op, err := c.EnrollSolution(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ProjectClient) EnrollSolutionOperation
func (c *ProjectClient) EnrollSolutionOperation(name string) *EnrollSolutionOperation
EnrollSolutionOperation returns a new EnrollSolutionOperation from a given name. The name must be that of a previously created EnrollSolutionOperation, possibly from a different process.
func (*ProjectClient) GetAlertConfig
func (c *ProjectClient) GetAlertConfig(ctx context.Context, req *retailpb.GetAlertConfigRequest, opts ...gax.CallOption) (*retailpb.AlertConfig, error)
GetAlertConfig get the AlertConfig of the requested project.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.GetAlertConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#GetAlertConfigRequest.
}
resp, err := c.GetAlertConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ProjectClient) GetLoggingConfig
func (c *ProjectClient) GetLoggingConfig(ctx context.Context, req *retailpb.GetLoggingConfigRequest, opts ...gax.CallOption) (*retailpb.LoggingConfig, error)
GetLoggingConfig gets the LoggingConfig of the requested project.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.GetLoggingConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#GetLoggingConfigRequest.
}
resp, err := c.GetLoggingConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ProjectClient) GetOperation
func (c *ProjectClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
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/apiv2alpha"
)
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.NewProjectClient(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 (*ProjectClient) GetProject
func (c *ProjectClient) GetProject(ctx context.Context, req *retailpb.GetProjectRequest, opts ...gax.CallOption) (*retailpb.Project, error)
GetProject gets the project.
Throws NOT_FOUND if the project wasn’t initialized for the Retail API service.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.GetProjectRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#GetProjectRequest.
}
resp, err := c.GetProject(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ProjectClient) ListEnrolledSolutions
func (c *ProjectClient) ListEnrolledSolutions(ctx context.Context, req *retailpb.ListEnrolledSolutionsRequest, opts ...gax.CallOption) (*retailpb.ListEnrolledSolutionsResponse, error)
ListEnrolledSolutions lists all the retail API solutions the project has enrolled.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.ListEnrolledSolutionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#ListEnrolledSolutionsRequest.
}
resp, err := c.ListEnrolledSolutions(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ProjectClient) ListOperations
func (c *ProjectClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
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/apiv2alpha"
"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.NewProjectClient(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/apiv2alpha"
)
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.NewProjectClient(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.
}
// TODO: Use resp.
_ = resp
}
}
func (*ProjectClient) UpdateAlertConfig
func (c *ProjectClient) UpdateAlertConfig(ctx context.Context, req *retailpb.UpdateAlertConfigRequest, opts ...gax.CallOption) (*retailpb.AlertConfig, error)
UpdateAlertConfig update the alert config of the requested project.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.UpdateAlertConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#UpdateAlertConfigRequest.
}
resp, err := c.UpdateAlertConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ProjectClient) UpdateLoggingConfig
func (c *ProjectClient) UpdateLoggingConfig(ctx context.Context, req *retailpb.UpdateLoggingConfigRequest, opts ...gax.CallOption) (*retailpb.LoggingConfig, error)
UpdateLoggingConfig updates the LoggingConfig of the requested project.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewProjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.UpdateLoggingConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#UpdateLoggingConfigRequest.
}
resp, err := c.UpdateLoggingConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
PurgeProductsOperation
type PurgeProductsOperation struct {
// contains filtered or unexported fields
}
PurgeProductsOperation manages a long-running operation from PurgeProducts.
func (*PurgeProductsOperation) Done
func (op *PurgeProductsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*PurgeProductsOperation) Metadata
func (op *PurgeProductsOperation) Metadata() (*retailpb.PurgeProductsMetadata, error)
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 (*PurgeProductsOperation) Name
func (op *PurgeProductsOperation) 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 (*PurgeProductsOperation) Poll
func (op *PurgeProductsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.PurgeProductsResponse, error)
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 (*PurgeProductsOperation) Wait
func (op *PurgeProductsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.PurgeProductsResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
PurgeUserEventsOperation
type PurgeUserEventsOperation struct {
// contains filtered or unexported fields
}
PurgeUserEventsOperation manages a long-running operation from PurgeUserEvents.
func (*PurgeUserEventsOperation) Done
func (op *PurgeUserEventsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*PurgeUserEventsOperation) Metadata
func (op *PurgeUserEventsOperation) Metadata() (*retailpb.PurgeMetadata, error)
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 (*PurgeUserEventsOperation) Name
func (op *PurgeUserEventsOperation) 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 (*PurgeUserEventsOperation) Poll
func (op *PurgeUserEventsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.PurgeUserEventsResponse, error)
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 (*PurgeUserEventsOperation) Wait
func (op *PurgeUserEventsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.PurgeUserEventsResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
RejoinUserEventsOperation
type RejoinUserEventsOperation struct {
// contains filtered or unexported fields
}
RejoinUserEventsOperation manages a long-running operation from RejoinUserEvents.
func (*RejoinUserEventsOperation) Done
func (op *RejoinUserEventsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*RejoinUserEventsOperation) Metadata
func (op *RejoinUserEventsOperation) Metadata() (*retailpb.RejoinUserEventsMetadata, error)
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 (*RejoinUserEventsOperation) Name
func (op *RejoinUserEventsOperation) 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 (*RejoinUserEventsOperation) Poll
func (op *RejoinUserEventsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.RejoinUserEventsResponse, error)
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 (*RejoinUserEventsOperation) Wait
func (op *RejoinUserEventsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.RejoinUserEventsResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
RemoveFulfillmentPlacesOperation
type RemoveFulfillmentPlacesOperation struct {
// contains filtered or unexported fields
}
RemoveFulfillmentPlacesOperation manages a long-running operation from RemoveFulfillmentPlaces.
func (*RemoveFulfillmentPlacesOperation) Done
func (op *RemoveFulfillmentPlacesOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*RemoveFulfillmentPlacesOperation) Metadata
func (op *RemoveFulfillmentPlacesOperation) Metadata() (*retailpb.RemoveFulfillmentPlacesMetadata, error)
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 (*RemoveFulfillmentPlacesOperation) Name
func (op *RemoveFulfillmentPlacesOperation) 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 (*RemoveFulfillmentPlacesOperation) Poll
func (op *RemoveFulfillmentPlacesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.RemoveFulfillmentPlacesResponse, error)
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 (*RemoveFulfillmentPlacesOperation) Wait
func (op *RemoveFulfillmentPlacesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.RemoveFulfillmentPlacesResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
RemoveLocalInventoriesOperation
type RemoveLocalInventoriesOperation struct {
// contains filtered or unexported fields
}
RemoveLocalInventoriesOperation manages a long-running operation from RemoveLocalInventories.
func (*RemoveLocalInventoriesOperation) Done
func (op *RemoveLocalInventoriesOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*RemoveLocalInventoriesOperation) Metadata
func (op *RemoveLocalInventoriesOperation) Metadata() (*retailpb.RemoveLocalInventoriesMetadata, error)
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 (*RemoveLocalInventoriesOperation) Name
func (op *RemoveLocalInventoriesOperation) 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 (*RemoveLocalInventoriesOperation) Poll
func (op *RemoveLocalInventoriesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.RemoveLocalInventoriesResponse, error)
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 (*RemoveLocalInventoriesOperation) Wait
func (op *RemoveLocalInventoriesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.RemoveLocalInventoriesResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
SearchCallOptions
type SearchCallOptions struct {
Search []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
SearchCallOptions contains the retry settings for each method of SearchClient.
SearchClient
type SearchClient struct {
// The call options for this service.
CallOptions *SearchCallOptions
// contains filtered or unexported fields
}
SearchClient 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 search.
This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.
func NewSearchClient
func NewSearchClient(ctx context.Context, opts ...option.ClientOption) (*SearchClient, error)
NewSearchClient creates a new search 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 search.
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/apiv2alpha"
)
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.NewSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewSearchRESTClient
func NewSearchRESTClient(ctx context.Context, opts ...option.ClientOption) (*SearchClient, error)
NewSearchRESTClient creates a new search service rest client.
Service for search.
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/apiv2alpha"
)
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.NewSearchRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*SearchClient) Close
func (c *SearchClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*SearchClient) Connection (deprecated)
func (c *SearchClient) 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 (*SearchClient) GetOperation
func (c *SearchClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
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/apiv2alpha"
)
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.NewSearchClient(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 (*SearchClient) ListOperations
func (c *SearchClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
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/apiv2alpha"
"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.NewSearchClient(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/apiv2alpha"
)
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.NewSearchClient(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.
}
// TODO: Use resp.
_ = resp
}
}
func (*SearchClient) Search
func (c *SearchClient) Search(ctx context.Context, req *retailpb.SearchRequest, opts ...gax.CallOption) *SearchResponse_SearchResultIterator
Search performs a search.
This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.
Examples
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.SearchRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#SearchRequest.
}
it := c.Search(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.SearchResponse)
}
}
all
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.SearchRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#SearchRequest.
}
for resp, err := range c.Search(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
SearchResponse_SearchResultIterator
type SearchResponse_SearchResultIterator 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.SearchResponse_SearchResult, nextPageToken string, err error)
// contains filtered or unexported fields
}
SearchResponse_SearchResultIterator manages a stream of *retailpb.SearchResponse_SearchResult.
func (*SearchResponse_SearchResultIterator) All
func (it *SearchResponse_SearchResultIterator) All() iter.Seq2[*retailpb.SearchResponse_SearchResult, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*SearchResponse_SearchResultIterator) Next
func (it *SearchResponse_SearchResultIterator) Next() (*retailpb.SearchResponse_SearchResult, 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 (*SearchResponse_SearchResultIterator) PageInfo
func (it *SearchResponse_SearchResultIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
ServingConfigCallOptions
type ServingConfigCallOptions struct {
CreateServingConfig []gax.CallOption
DeleteServingConfig []gax.CallOption
UpdateServingConfig []gax.CallOption
GetServingConfig []gax.CallOption
ListServingConfigs []gax.CallOption
AddControl []gax.CallOption
RemoveControl []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
ServingConfigCallOptions contains the retry settings for each method of ServingConfigClient.
ServingConfigClient
type ServingConfigClient struct {
// The call options for this service.
CallOptions *ServingConfigCallOptions
// contains filtered or unexported fields
}
ServingConfigClient 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 ServingConfig.
func NewServingConfigClient
func NewServingConfigClient(ctx context.Context, opts ...option.ClientOption) (*ServingConfigClient, error)
NewServingConfigClient creates a new serving config 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 ServingConfig.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
)
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.NewServingConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewServingConfigRESTClient
func NewServingConfigRESTClient(ctx context.Context, opts ...option.ClientOption) (*ServingConfigClient, error)
NewServingConfigRESTClient creates a new serving config service rest client.
Service for modifying ServingConfig.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
)
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.NewServingConfigRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*ServingConfigClient) AddControl
func (c *ServingConfigClient) AddControl(ctx context.Context, req *retailpb.AddControlRequest, opts ...gax.CallOption) (*retailpb.ServingConfig, error)
AddControl enables a Control on the specified ServingConfig. The control is added in the last position of the list of controls it belongs to (e.g. if it’s a facet spec control it will be applied in the last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum number of control allowed for that type of control.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewServingConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.AddControlRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#AddControlRequest.
}
resp, err := c.AddControl(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ServingConfigClient) Close
func (c *ServingConfigClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ServingConfigClient) Connection (deprecated)
func (c *ServingConfigClient) 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 (*ServingConfigClient) CreateServingConfig
func (c *ServingConfigClient) CreateServingConfig(ctx context.Context, req *retailpb.CreateServingConfigRequest, opts ...gax.CallOption) (*retailpb.ServingConfig, error)
CreateServingConfig creates a ServingConfig.
A maximum of 100 ServingConfigs are allowed in a Catalog, otherwise a FAILED_PRECONDITION error is returned.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewServingConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.CreateServingConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#CreateServingConfigRequest.
}
resp, err := c.CreateServingConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ServingConfigClient) DeleteServingConfig
func (c *ServingConfigClient) DeleteServingConfig(ctx context.Context, req *retailpb.DeleteServingConfigRequest, opts ...gax.CallOption) error
DeleteServingConfig deletes a ServingConfig.
Returns a NotFound error if the ServingConfig does not exist.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewServingConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.DeleteServingConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#DeleteServingConfigRequest.
}
err = c.DeleteServingConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ServingConfigClient) GetOperation
func (c *ServingConfigClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
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/apiv2alpha"
)
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.NewServingConfigClient(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 (*ServingConfigClient) GetServingConfig
func (c *ServingConfigClient) GetServingConfig(ctx context.Context, req *retailpb.GetServingConfigRequest, opts ...gax.CallOption) (*retailpb.ServingConfig, error)
GetServingConfig gets a ServingConfig.
Returns a NotFound error if the ServingConfig does not exist.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewServingConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.GetServingConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#GetServingConfigRequest.
}
resp, err := c.GetServingConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ServingConfigClient) ListOperations
func (c *ServingConfigClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
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/apiv2alpha"
"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.NewServingConfigClient(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/apiv2alpha"
)
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.NewServingConfigClient(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.
}
// TODO: Use resp.
_ = resp
}
}
func (*ServingConfigClient) ListServingConfigs
func (c *ServingConfigClient) ListServingConfigs(ctx context.Context, req *retailpb.ListServingConfigsRequest, opts ...gax.CallOption) *ServingConfigIterator
ListServingConfigs lists all ServingConfigs linked to this catalog.
Examples
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewServingConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.ListServingConfigsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#ListServingConfigsRequest.
}
it := c.ListServingConfigs(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.ListServingConfigsResponse)
}
}
all
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewServingConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.ListServingConfigsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#ListServingConfigsRequest.
}
for resp, err := range c.ListServingConfigs(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ServingConfigClient) RemoveControl
func (c *ServingConfigClient) RemoveControl(ctx context.Context, req *retailpb.RemoveControlRequest, opts ...gax.CallOption) (*retailpb.ServingConfig, error)
RemoveControl disables a Control on the specified ServingConfig. The control is removed from the ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewServingConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.RemoveControlRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#RemoveControlRequest.
}
resp, err := c.RemoveControl(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ServingConfigClient) UpdateServingConfig
func (c *ServingConfigClient) UpdateServingConfig(ctx context.Context, req *retailpb.UpdateServingConfigRequest, opts ...gax.CallOption) (*retailpb.ServingConfig, error)
UpdateServingConfig updates a ServingConfig.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewServingConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.UpdateServingConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#UpdateServingConfigRequest.
}
resp, err := c.UpdateServingConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
ServingConfigIterator
type ServingConfigIterator 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.ServingConfig, nextPageToken string, err error)
// contains filtered or unexported fields
}
ServingConfigIterator manages a stream of *retailpb.ServingConfig.
func (*ServingConfigIterator) All
func (it *ServingConfigIterator) All() iter.Seq2[*retailpb.ServingConfig, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ServingConfigIterator) Next
func (it *ServingConfigIterator) Next() (*retailpb.ServingConfig, 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 (*ServingConfigIterator) PageInfo
func (it *ServingConfigIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
SetInventoryOperation
type SetInventoryOperation struct {
// contains filtered or unexported fields
}
SetInventoryOperation manages a long-running operation from SetInventory.
func (*SetInventoryOperation) Done
func (op *SetInventoryOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*SetInventoryOperation) Metadata
func (op *SetInventoryOperation) Metadata() (*retailpb.SetInventoryMetadata, error)
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 (*SetInventoryOperation) Name
func (op *SetInventoryOperation) 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 (*SetInventoryOperation) Poll
func (op *SetInventoryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.SetInventoryResponse, error)
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 (*SetInventoryOperation) Wait
func (op *SetInventoryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.SetInventoryResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
TuneModelOperation
type TuneModelOperation struct {
// contains filtered or unexported fields
}
TuneModelOperation manages a long-running operation from TuneModel.
func (*TuneModelOperation) Done
func (op *TuneModelOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*TuneModelOperation) Metadata
func (op *TuneModelOperation) Metadata() (*retailpb.TuneModelMetadata, error)
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 (*TuneModelOperation) Name
func (op *TuneModelOperation) 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 (*TuneModelOperation) Poll
func (op *TuneModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.TuneModelResponse, error)
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 (*TuneModelOperation) Wait
func (op *TuneModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.TuneModelResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
UserEventCallOptions
type UserEventCallOptions struct {
WriteUserEvent []gax.CallOption
CollectUserEvent []gax.CallOption
PurgeUserEvents []gax.CallOption
ImportUserEvents []gax.CallOption
ExportUserEvents []gax.CallOption
RejoinUserEvents []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
UserEventCallOptions contains the retry settings for each method of UserEventClient.
UserEventClient
type UserEventClient struct {
// The call options for this service.
CallOptions *UserEventCallOptions
// 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
}
UserEventClient 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 end user actions on the customer website.
func NewUserEventClient
func NewUserEventClient(ctx context.Context, opts ...option.ClientOption) (*UserEventClient, error)
NewUserEventClient creates a new user event 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 end user actions on the customer website.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
)
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.NewUserEventClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewUserEventRESTClient
func NewUserEventRESTClient(ctx context.Context, opts ...option.ClientOption) (*UserEventClient, error)
NewUserEventRESTClient creates a new user event service rest client.
Service for ingesting end user actions on the customer website.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
)
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.NewUserEventRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*UserEventClient) Close
func (c *UserEventClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*UserEventClient) CollectUserEvent
func (c *UserEventClient) CollectUserEvent(ctx context.Context, req *retailpb.CollectUserEventRequest, opts ...gax.CallOption) (*httpbodypb.HttpBody, error)
CollectUserEvent writes a single user event from the browser. This uses a GET request to due to browser restriction of POST-ing to a 3rd party domain.
This method is used only by the Retail API JavaScript pixel and Google Tag Manager. Users should not call this method directly.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewUserEventClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.CollectUserEventRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#CollectUserEventRequest.
}
resp, err := c.CollectUserEvent(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*UserEventClient) Connection (deprecated)
func (c *UserEventClient) 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 (*UserEventClient) ExportUserEvents
func (c *UserEventClient) ExportUserEvents(ctx context.Context, req *retailpb.ExportUserEventsRequest, opts ...gax.CallOption) (*ExportUserEventsOperation, error)
ExportUserEvents exports user events.
Operation.response is of type ExportResponse. Operation.metadata is of type ExportMetadata.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewUserEventClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.ExportUserEventsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#ExportUserEventsRequest.
}
op, err := c.ExportUserEvents(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*UserEventClient) ExportUserEventsOperation
func (c *UserEventClient) ExportUserEventsOperation(name string) *ExportUserEventsOperation
ExportUserEventsOperation returns a new ExportUserEventsOperation from a given name. The name must be that of a previously created ExportUserEventsOperation, possibly from a different process.
func (*UserEventClient) GetOperation
func (c *UserEventClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
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/apiv2alpha"
)
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.NewUserEventClient(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 (*UserEventClient) ImportUserEvents
func (c *UserEventClient) ImportUserEvents(ctx context.Context, req *retailpb.ImportUserEventsRequest, opts ...gax.CallOption) (*ImportUserEventsOperation, error)
ImportUserEvents bulk import of User events. Request processing might be synchronous. Events that already exist are skipped. Use this method for backfilling historical user events.
Operation.response is of type ImportResponse. Note that it is possible for a subset of the items to be successfully inserted. Operation.metadata is of type ImportMetadata.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewUserEventClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.ImportUserEventsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#ImportUserEventsRequest.
}
op, err := c.ImportUserEvents(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*UserEventClient) ImportUserEventsOperation
func (c *UserEventClient) ImportUserEventsOperation(name string) *ImportUserEventsOperation
ImportUserEventsOperation returns a new ImportUserEventsOperation from a given name. The name must be that of a previously created ImportUserEventsOperation, possibly from a different process.
func (*UserEventClient) ListOperations
func (c *UserEventClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
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/apiv2alpha"
"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.NewUserEventClient(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/apiv2alpha"
)
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.NewUserEventClient(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.
}
// TODO: Use resp.
_ = resp
}
}
func (*UserEventClient) PurgeUserEvents
func (c *UserEventClient) PurgeUserEvents(ctx context.Context, req *retailpb.PurgeUserEventsRequest, opts ...gax.CallOption) (*PurgeUserEventsOperation, error)
PurgeUserEvents deletes permanently all user events specified by the filter provided. Depending on the number of events specified by the filter, this operation could take hours or days to complete. To test a filter, use the list command first.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewUserEventClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.PurgeUserEventsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#PurgeUserEventsRequest.
}
op, err := c.PurgeUserEvents(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*UserEventClient) PurgeUserEventsOperation
func (c *UserEventClient) PurgeUserEventsOperation(name string) *PurgeUserEventsOperation
PurgeUserEventsOperation returns a new PurgeUserEventsOperation from a given name. The name must be that of a previously created PurgeUserEventsOperation, possibly from a different process.
func (*UserEventClient) RejoinUserEvents
func (c *UserEventClient) RejoinUserEvents(ctx context.Context, req *retailpb.RejoinUserEventsRequest, opts ...gax.CallOption) (*RejoinUserEventsOperation, error)
RejoinUserEvents starts a user-event rejoin operation with latest product catalog. Events are not annotated with detailed product information for products that are missing from the catalog when the user event is ingested. These events are stored as unjoined events with limited usage on training and serving. You can use this method to start a join operation on specified events with the latest version of product catalog. You can also use this method to correct events joined with the wrong product catalog. A rejoin operation can take hours or days to complete.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewUserEventClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.RejoinUserEventsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#RejoinUserEventsRequest.
}
op, err := c.RejoinUserEvents(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*UserEventClient) RejoinUserEventsOperation
func (c *UserEventClient) RejoinUserEventsOperation(name string) *RejoinUserEventsOperation
RejoinUserEventsOperation returns a new RejoinUserEventsOperation from a given name. The name must be that of a previously created RejoinUserEventsOperation, possibly from a different process.
func (*UserEventClient) WriteUserEvent
func (c *UserEventClient) WriteUserEvent(ctx context.Context, req *retailpb.WriteUserEventRequest, opts ...gax.CallOption) (*retailpb.UserEvent, error)
WriteUserEvent writes a single user event.
Example
package main
import (
"context"
retail "cloud.google.com/go/retail/apiv2alpha"
retailpb "cloud.google.com/go/retail/apiv2alpha/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.NewUserEventClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &retailpb.WriteUserEventRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#WriteUserEventRequest.
}
resp, err := c.WriteUserEvent(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}