Documentation
¶
Overview ¶
Package productstudio is an auto-generated package for the Merchant API.
Programmatically manage your Merchant Center Accounts.
NOTE: This package is in beta. It is not stable, and may be subject to changes.
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.
// go get cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha@latest ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := productstudio.NewImageClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.
Using the Client ¶
The following is an example of making an API call with the newly created client, mentioned above.
req := &productstudiopb.GenerateProductImageBackgroundRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha/productstudiopb#GenerateProductImageBackgroundRequest. } resp, err := c.GenerateProductImageBackground(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context ¶
The ctx passed to NewImageClient 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.
Index ¶
- func DefaultAuthScopes() []string
- type ImageCallOptions
- type ImageClient
- func (c *ImageClient) Close() error
- func (c *ImageClient) Connection() *grpc.ClientConndeprecated
- func (c *ImageClient) GenerateProductImageBackground(ctx context.Context, ...) (*productstudiopb.GenerateProductImageBackgroundResponse, error)
- func (c *ImageClient) RemoveProductImageBackground(ctx context.Context, req *productstudiopb.RemoveProductImageBackgroundRequest, ...) (*productstudiopb.RemoveProductImageBackgroundResponse, error)
- func (c *ImageClient) UpscaleProductImage(ctx context.Context, req *productstudiopb.UpscaleProductImageRequest, ...) (*productstudiopb.UpscaleProductImageResponse, error)
- type TextSuggestionsCallOptions
- type TextSuggestionsClient
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type ImageCallOptions ¶
type ImageCallOptions struct { GenerateProductImageBackground []gax.CallOption RemoveProductImageBackground []gax.CallOption UpscaleProductImage []gax.CallOption }
ImageCallOptions contains the retry settings for each method of ImageClient.
type ImageClient ¶
type ImageClient struct { // The call options for this service. CallOptions *ImageCallOptions // contains filtered or unexported fields }
ImageClient is a client for interacting with Merchant API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service that exposes Generative AI (GenAI) endpoints for creating and enhancing product image content.
func NewImageClient ¶
func NewImageClient(ctx context.Context, opts ...option.ClientOption) (*ImageClient, error)
NewImageClient creates a new image service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service that exposes Generative AI (GenAI) endpoints for creating and enhancing product image content.
Example ¶
package main import ( "context" productstudio "cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha" ) 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 := productstudio.NewImageClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
func NewImageRESTClient ¶
func NewImageRESTClient(ctx context.Context, opts ...option.ClientOption) (*ImageClient, error)
NewImageRESTClient creates a new image service rest client.
Service that exposes Generative AI (GenAI) endpoints for creating and enhancing product image content.
Example ¶
package main import ( "context" productstudio "cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha" ) 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 := productstudio.NewImageRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
func (*ImageClient) Close ¶
func (c *ImageClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ImageClient) Connection
deprecated
func (c *ImageClient) 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 (*ImageClient) GenerateProductImageBackground ¶
func (c *ImageClient) GenerateProductImageBackground(ctx context.Context, req *productstudiopb.GenerateProductImageBackgroundRequest, opts ...gax.CallOption) (*productstudiopb.GenerateProductImageBackgroundResponse, error)
GenerateProductImageBackground generateProductImageBackground generates a new image where the background of the original image is replaced by an AI generated scene based on provided product information and a text prompt.
Example ¶
package main import ( "context" productstudio "cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha" productstudiopb "cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha/productstudiopb" ) 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 := productstudio.NewImageClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &productstudiopb.GenerateProductImageBackgroundRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha/productstudiopb#GenerateProductImageBackgroundRequest. } resp, err := c.GenerateProductImageBackground(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
func (*ImageClient) RemoveProductImageBackground ¶
func (c *ImageClient) RemoveProductImageBackground(ctx context.Context, req *productstudiopb.RemoveProductImageBackgroundRequest, opts ...gax.CallOption) (*productstudiopb.RemoveProductImageBackgroundResponse, error)
RemoveProductImageBackground removeProductImageBackground generates a new image where the background of the original image is removed.
Example ¶
package main import ( "context" productstudio "cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha" productstudiopb "cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha/productstudiopb" ) 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 := productstudio.NewImageClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &productstudiopb.RemoveProductImageBackgroundRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha/productstudiopb#RemoveProductImageBackgroundRequest. } resp, err := c.RemoveProductImageBackground(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
func (*ImageClient) UpscaleProductImage ¶
func (c *ImageClient) UpscaleProductImage(ctx context.Context, req *productstudiopb.UpscaleProductImageRequest, opts ...gax.CallOption) (*productstudiopb.UpscaleProductImageResponse, error)
UpscaleProductImage upscaleProductImage generates a new image where the resolution of the original image is enhanced.
Example ¶
package main import ( "context" productstudio "cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha" productstudiopb "cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha/productstudiopb" ) 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 := productstudio.NewImageClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &productstudiopb.UpscaleProductImageRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha/productstudiopb#UpscaleProductImageRequest. } resp, err := c.UpscaleProductImage(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
type TextSuggestionsCallOptions ¶
type TextSuggestionsCallOptions struct {
GenerateProductTextSuggestions []gax.CallOption
}
TextSuggestionsCallOptions contains the retry settings for each method of TextSuggestionsClient.
type TextSuggestionsClient ¶
type TextSuggestionsClient struct { // The call options for this service. CallOptions *TextSuggestionsCallOptions // contains filtered or unexported fields }
TextSuggestionsClient is a client for interacting with Merchant API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service that exposes Generative AI (GenAI) endpoints for creating and enhancing product text content, such as titles, descriptions, etc.
func NewTextSuggestionsClient ¶
func NewTextSuggestionsClient(ctx context.Context, opts ...option.ClientOption) (*TextSuggestionsClient, error)
NewTextSuggestionsClient creates a new text suggestions service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service that exposes Generative AI (GenAI) endpoints for creating and enhancing product text content, such as titles, descriptions, etc.
Example ¶
package main import ( "context" productstudio "cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha" ) 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 := productstudio.NewTextSuggestionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
func NewTextSuggestionsRESTClient ¶
func NewTextSuggestionsRESTClient(ctx context.Context, opts ...option.ClientOption) (*TextSuggestionsClient, error)
NewTextSuggestionsRESTClient creates a new text suggestions service rest client.
Service that exposes Generative AI (GenAI) endpoints for creating and enhancing product text content, such as titles, descriptions, etc.
Example ¶
package main import ( "context" productstudio "cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha" ) 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 := productstudio.NewTextSuggestionsRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
func (*TextSuggestionsClient) Close ¶
func (c *TextSuggestionsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*TextSuggestionsClient) Connection
deprecated
func (c *TextSuggestionsClient) 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 (*TextSuggestionsClient) GenerateProductTextSuggestions ¶
func (c *TextSuggestionsClient) GenerateProductTextSuggestions(ctx context.Context, req *productstudiopb.GenerateProductTextSuggestionsRequest, opts ...gax.CallOption) (*productstudiopb.GenerateProductTextSuggestionsResponse, error)
GenerateProductTextSuggestions generateProductTextSuggestions generates a set of candidate text completions (e.g., product titles, descriptions) based on provided product information. This endpoint leverages GenAI models to create suggestions for improving existing product text or generating new content.
Example ¶
package main import ( "context" productstudio "cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha" productstudiopb "cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha/productstudiopb" ) 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 := productstudio.NewTextSuggestionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &productstudiopb.GenerateProductTextSuggestionsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha/productstudiopb#GenerateProductTextSuggestionsRequest. } resp, err := c.GenerateProductTextSuggestions(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }