Documentation ¶
Overview ¶
Package css is an auto-generated package for the CSS API.
Programmatically manage your Comparison Shopping Service (CSS) account data at scale.
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.
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 := css.NewAccountsClient(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 := css.NewAccountsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &csspb.GetAccountRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/css/apiv1/csspb#GetAccountRequest. } resp, err := c.GetAccount(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context ¶
The ctx passed to NewAccountsClient 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 AccountIterator
- type AccountLabelIterator
- type AccountLabelsCallOptions
- type AccountLabelsClient
- func (c *AccountLabelsClient) Close() error
- func (c *AccountLabelsClient) Connection() *grpc.ClientConndeprecated
- func (c *AccountLabelsClient) CreateAccountLabel(ctx context.Context, req *csspb.CreateAccountLabelRequest, ...) (*csspb.AccountLabel, error)
- func (c *AccountLabelsClient) DeleteAccountLabel(ctx context.Context, req *csspb.DeleteAccountLabelRequest, ...) error
- func (c *AccountLabelsClient) ListAccountLabels(ctx context.Context, req *csspb.ListAccountLabelsRequest, ...) *AccountLabelIterator
- func (c *AccountLabelsClient) UpdateAccountLabel(ctx context.Context, req *csspb.UpdateAccountLabelRequest, ...) (*csspb.AccountLabel, error)
- type AccountsCallOptions
- type AccountsClient
- func (c *AccountsClient) Close() error
- func (c *AccountsClient) Connection() *grpc.ClientConndeprecated
- func (c *AccountsClient) GetAccount(ctx context.Context, req *csspb.GetAccountRequest, opts ...gax.CallOption) (*csspb.Account, error)
- func (c *AccountsClient) ListChildAccounts(ctx context.Context, req *csspb.ListChildAccountsRequest, ...) *AccountIterator
- func (c *AccountsClient) UpdateLabels(ctx context.Context, req *csspb.UpdateAccountLabelsRequest, ...) (*csspb.Account, error)
- type CssProductInputsCallOptions
- type CssProductInputsClient
- func (c *CssProductInputsClient) Close() error
- func (c *CssProductInputsClient) Connection() *grpc.ClientConndeprecated
- func (c *CssProductInputsClient) DeleteCssProductInput(ctx context.Context, req *csspb.DeleteCssProductInputRequest, ...) error
- func (c *CssProductInputsClient) InsertCssProductInput(ctx context.Context, req *csspb.InsertCssProductInputRequest, ...) (*csspb.CssProductInput, error)
- type CssProductIterator
- type CssProductsCallOptions
- type CssProductsClient
- func (c *CssProductsClient) Close() error
- func (c *CssProductsClient) Connection() *grpc.ClientConndeprecated
- func (c *CssProductsClient) GetCssProduct(ctx context.Context, req *csspb.GetCssProductRequest, opts ...gax.CallOption) (*csspb.CssProduct, error)
- func (c *CssProductsClient) ListCssProducts(ctx context.Context, req *csspb.ListCssProductsRequest, opts ...gax.CallOption) *CssProductIterator
Examples ¶
- AccountLabelsClient.CreateAccountLabel
- AccountLabelsClient.DeleteAccountLabel
- AccountLabelsClient.ListAccountLabels
- AccountLabelsClient.ListAccountLabels (All)
- AccountLabelsClient.UpdateAccountLabel
- AccountsClient.GetAccount
- AccountsClient.ListChildAccounts
- AccountsClient.ListChildAccounts (All)
- AccountsClient.UpdateLabels
- CssProductInputsClient.DeleteCssProductInput
- CssProductInputsClient.InsertCssProductInput
- CssProductsClient.GetCssProduct
- CssProductsClient.ListCssProducts
- CssProductsClient.ListCssProducts (All)
- NewAccountLabelsClient
- NewAccountLabelsRESTClient
- NewAccountsClient
- NewAccountsRESTClient
- NewCssProductInputsClient
- NewCssProductInputsRESTClient
- NewCssProductsClient
- NewCssProductsRESTClient
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 AccountIterator ¶
type AccountIterator 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 []*csspb.Account, nextPageToken string, err error) // contains filtered or unexported fields }
AccountIterator manages a stream of *csspb.Account.
func (*AccountIterator) All ¶ added in v0.9.0
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*AccountIterator) Next ¶
func (it *AccountIterator) Next() (*csspb.Account, 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 (*AccountIterator) PageInfo ¶
func (it *AccountIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type AccountLabelIterator ¶
type AccountLabelIterator 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 []*csspb.AccountLabel, nextPageToken string, err error) // contains filtered or unexported fields }
AccountLabelIterator manages a stream of *csspb.AccountLabel.
func (*AccountLabelIterator) All ¶ added in v0.9.0
func (it *AccountLabelIterator) All() iter.Seq2[*csspb.AccountLabel, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*AccountLabelIterator) Next ¶
func (it *AccountLabelIterator) Next() (*csspb.AccountLabel, 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 (*AccountLabelIterator) PageInfo ¶
func (it *AccountLabelIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type AccountLabelsCallOptions ¶
type AccountLabelsCallOptions struct { ListAccountLabels []gax.CallOption CreateAccountLabel []gax.CallOption UpdateAccountLabel []gax.CallOption DeleteAccountLabel []gax.CallOption }
AccountLabelsCallOptions contains the retry settings for each method of AccountLabelsClient.
type AccountLabelsClient ¶
type AccountLabelsClient struct { // The call options for this service. CallOptions *AccountLabelsCallOptions // contains filtered or unexported fields }
AccountLabelsClient is a client for interacting with CSS API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Manages Merchant Center and CSS accounts labels.
func NewAccountLabelsClient ¶
func NewAccountLabelsClient(ctx context.Context, opts ...option.ClientOption) (*AccountLabelsClient, error)
NewAccountLabelsClient creates a new account labels service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Manages Merchant Center and CSS accounts labels.
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" ) 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 := css.NewAccountLabelsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewAccountLabelsRESTClient ¶
func NewAccountLabelsRESTClient(ctx context.Context, opts ...option.ClientOption) (*AccountLabelsClient, error)
NewAccountLabelsRESTClient creates a new account labels service rest client.
Manages Merchant Center and CSS accounts labels.
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" ) 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 := css.NewAccountLabelsRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*AccountLabelsClient) Close ¶
func (c *AccountLabelsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*AccountLabelsClient) Connection
deprecated
func (c *AccountLabelsClient) 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 (*AccountLabelsClient) CreateAccountLabel ¶
func (c *AccountLabelsClient) CreateAccountLabel(ctx context.Context, req *csspb.CreateAccountLabelRequest, opts ...gax.CallOption) (*csspb.AccountLabel, error)
CreateAccountLabel creates a new label, not assigned to any account.
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" csspb "cloud.google.com/go/shopping/css/apiv1/csspb" ) 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 := css.NewAccountLabelsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &csspb.CreateAccountLabelRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/css/apiv1/csspb#CreateAccountLabelRequest. } resp, err := c.CreateAccountLabel(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*AccountLabelsClient) DeleteAccountLabel ¶
func (c *AccountLabelsClient) DeleteAccountLabel(ctx context.Context, req *csspb.DeleteAccountLabelRequest, opts ...gax.CallOption) error
DeleteAccountLabel deletes a label and removes it from all accounts to which it was assigned.
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" csspb "cloud.google.com/go/shopping/css/apiv1/csspb" ) 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 := css.NewAccountLabelsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &csspb.DeleteAccountLabelRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/css/apiv1/csspb#DeleteAccountLabelRequest. } err = c.DeleteAccountLabel(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*AccountLabelsClient) ListAccountLabels ¶
func (c *AccountLabelsClient) ListAccountLabels(ctx context.Context, req *csspb.ListAccountLabelsRequest, opts ...gax.CallOption) *AccountLabelIterator
ListAccountLabels lists the labels assigned to an account.
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" csspb "cloud.google.com/go/shopping/css/apiv1/csspb" "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 := css.NewAccountLabelsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &csspb.ListAccountLabelsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/css/apiv1/csspb#ListAccountLabelsRequest. } it := c.ListAccountLabels(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.(*csspb.ListAccountLabelsResponse) } }
Output:
Example (All) ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" csspb "cloud.google.com/go/shopping/css/apiv1/csspb" ) 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 := css.NewAccountLabelsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &csspb.ListAccountLabelsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/css/apiv1/csspb#ListAccountLabelsRequest. } for resp, err := range c.ListAccountLabels(ctx, req).All() { if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*AccountLabelsClient) UpdateAccountLabel ¶
func (c *AccountLabelsClient) UpdateAccountLabel(ctx context.Context, req *csspb.UpdateAccountLabelRequest, opts ...gax.CallOption) (*csspb.AccountLabel, error)
UpdateAccountLabel updates a label.
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" csspb "cloud.google.com/go/shopping/css/apiv1/csspb" ) 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 := css.NewAccountLabelsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &csspb.UpdateAccountLabelRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/css/apiv1/csspb#UpdateAccountLabelRequest. } resp, err := c.UpdateAccountLabel(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type AccountsCallOptions ¶
type AccountsCallOptions struct { ListChildAccounts []gax.CallOption GetAccount []gax.CallOption UpdateLabels []gax.CallOption }
AccountsCallOptions contains the retry settings for each method of AccountsClient.
type AccountsClient ¶
type AccountsClient struct { // The call options for this service. CallOptions *AccountsCallOptions // contains filtered or unexported fields }
AccountsClient is a client for interacting with CSS API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for managing CSS/MC account information.
func NewAccountsClient ¶
func NewAccountsClient(ctx context.Context, opts ...option.ClientOption) (*AccountsClient, error)
NewAccountsClient creates a new accounts 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 CSS/MC account information.
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" ) 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 := css.NewAccountsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewAccountsRESTClient ¶
func NewAccountsRESTClient(ctx context.Context, opts ...option.ClientOption) (*AccountsClient, error)
NewAccountsRESTClient creates a new accounts service rest client.
Service for managing CSS/MC account information.
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" ) 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 := css.NewAccountsRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*AccountsClient) Close ¶
func (c *AccountsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*AccountsClient) Connection
deprecated
func (c *AccountsClient) 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 (*AccountsClient) GetAccount ¶
func (c *AccountsClient) GetAccount(ctx context.Context, req *csspb.GetAccountRequest, opts ...gax.CallOption) (*csspb.Account, error)
GetAccount retrieves a single CSS/MC account by ID.
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" csspb "cloud.google.com/go/shopping/css/apiv1/csspb" ) 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 := css.NewAccountsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &csspb.GetAccountRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/css/apiv1/csspb#GetAccountRequest. } resp, err := c.GetAccount(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*AccountsClient) ListChildAccounts ¶
func (c *AccountsClient) ListChildAccounts(ctx context.Context, req *csspb.ListChildAccountsRequest, opts ...gax.CallOption) *AccountIterator
ListChildAccounts lists all the accounts under the specified CSS account ID, and optionally filters by label ID and account name.
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" csspb "cloud.google.com/go/shopping/css/apiv1/csspb" "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 := css.NewAccountsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &csspb.ListChildAccountsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/css/apiv1/csspb#ListChildAccountsRequest. } it := c.ListChildAccounts(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.(*csspb.ListChildAccountsResponse) } }
Output:
Example (All) ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" csspb "cloud.google.com/go/shopping/css/apiv1/csspb" ) 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 := css.NewAccountsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &csspb.ListChildAccountsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/css/apiv1/csspb#ListChildAccountsRequest. } for resp, err := range c.ListChildAccounts(ctx, req).All() { if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*AccountsClient) UpdateLabels ¶
func (c *AccountsClient) UpdateLabels(ctx context.Context, req *csspb.UpdateAccountLabelsRequest, opts ...gax.CallOption) (*csspb.Account, error)
UpdateLabels updates labels assigned to CSS/MC accounts by a CSS domain.
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" csspb "cloud.google.com/go/shopping/css/apiv1/csspb" ) 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 := css.NewAccountsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &csspb.UpdateAccountLabelsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/css/apiv1/csspb#UpdateAccountLabelsRequest. } resp, err := c.UpdateLabels(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type CssProductInputsCallOptions ¶
type CssProductInputsCallOptions struct { InsertCssProductInput []gax.CallOption DeleteCssProductInput []gax.CallOption }
CssProductInputsCallOptions contains the retry settings for each method of CssProductInputsClient.
type CssProductInputsClient ¶
type CssProductInputsClient struct { // The call options for this service. CallOptions *CssProductInputsCallOptions // contains filtered or unexported fields }
CssProductInputsClient is a client for interacting with CSS API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service to use CssProductInput resource. This service helps to insert/update/delete CSS Products.
func NewCssProductInputsClient ¶
func NewCssProductInputsClient(ctx context.Context, opts ...option.ClientOption) (*CssProductInputsClient, error)
NewCssProductInputsClient creates a new css product inputs service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service to use CssProductInput resource. This service helps to insert/update/delete CSS Products.
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" ) 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 := css.NewCssProductInputsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewCssProductInputsRESTClient ¶
func NewCssProductInputsRESTClient(ctx context.Context, opts ...option.ClientOption) (*CssProductInputsClient, error)
NewCssProductInputsRESTClient creates a new css product inputs service rest client.
Service to use CssProductInput resource. This service helps to insert/update/delete CSS Products.
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" ) 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 := css.NewCssProductInputsRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*CssProductInputsClient) Close ¶
func (c *CssProductInputsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*CssProductInputsClient) Connection
deprecated
func (c *CssProductInputsClient) 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 (*CssProductInputsClient) DeleteCssProductInput ¶
func (c *CssProductInputsClient) DeleteCssProductInput(ctx context.Context, req *csspb.DeleteCssProductInputRequest, opts ...gax.CallOption) error
DeleteCssProductInput deletes a CSS Product input from your CSS Center account.
After a delete it may take several minutes until the input is no longer available.
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" csspb "cloud.google.com/go/shopping/css/apiv1/csspb" ) 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 := css.NewCssProductInputsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &csspb.DeleteCssProductInputRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/css/apiv1/csspb#DeleteCssProductInputRequest. } err = c.DeleteCssProductInput(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*CssProductInputsClient) InsertCssProductInput ¶
func (c *CssProductInputsClient) InsertCssProductInput(ctx context.Context, req *csspb.InsertCssProductInputRequest, opts ...gax.CallOption) (*csspb.CssProductInput, error)
InsertCssProductInput uploads a CssProductInput to your CSS Center account. If an input with the same contentLanguage, identity, feedLabel and feedId already exists, this method replaces that entry.
After inserting, updating, or deleting a CSS Product input, it may take several minutes before the processed CSS Product can be retrieved.
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" csspb "cloud.google.com/go/shopping/css/apiv1/csspb" ) 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 := css.NewCssProductInputsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &csspb.InsertCssProductInputRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/css/apiv1/csspb#InsertCssProductInputRequest. } resp, err := c.InsertCssProductInput(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type CssProductIterator ¶
type CssProductIterator 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 []*csspb.CssProduct, nextPageToken string, err error) // contains filtered or unexported fields }
CssProductIterator manages a stream of *csspb.CssProduct.
func (*CssProductIterator) All ¶ added in v0.9.0
func (it *CssProductIterator) All() iter.Seq2[*csspb.CssProduct, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*CssProductIterator) Next ¶
func (it *CssProductIterator) Next() (*csspb.CssProduct, 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 (*CssProductIterator) PageInfo ¶
func (it *CssProductIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type CssProductsCallOptions ¶
type CssProductsCallOptions struct { GetCssProduct []gax.CallOption ListCssProducts []gax.CallOption }
CssProductsCallOptions contains the retry settings for each method of CssProductsClient.
type CssProductsClient ¶
type CssProductsClient struct { // The call options for this service. CallOptions *CssProductsCallOptions // contains filtered or unexported fields }
CssProductsClient is a client for interacting with CSS API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for doing get and list on Css Products(a.k.a Aggregate Offers internally).
func NewCssProductsClient ¶
func NewCssProductsClient(ctx context.Context, opts ...option.ClientOption) (*CssProductsClient, error)
NewCssProductsClient creates a new css products 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 doing get and list on Css Products(a.k.a Aggregate Offers internally).
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" ) 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 := css.NewCssProductsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewCssProductsRESTClient ¶
func NewCssProductsRESTClient(ctx context.Context, opts ...option.ClientOption) (*CssProductsClient, error)
NewCssProductsRESTClient creates a new css products service rest client.
Service for doing get and list on Css Products(a.k.a Aggregate Offers internally).
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" ) 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 := css.NewCssProductsRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*CssProductsClient) Close ¶
func (c *CssProductsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*CssProductsClient) Connection
deprecated
func (c *CssProductsClient) 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 (*CssProductsClient) GetCssProduct ¶
func (c *CssProductsClient) GetCssProduct(ctx context.Context, req *csspb.GetCssProductRequest, opts ...gax.CallOption) (*csspb.CssProduct, error)
GetCssProduct retrieves the processed CSS Product from your CSS Center account. After inserting, updating, or deleting a product input, it may take several minutes before the updated final product can be retrieved.
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" csspb "cloud.google.com/go/shopping/css/apiv1/csspb" ) 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 := css.NewCssProductsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &csspb.GetCssProductRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/css/apiv1/csspb#GetCssProductRequest. } resp, err := c.GetCssProduct(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*CssProductsClient) ListCssProducts ¶
func (c *CssProductsClient) ListCssProducts(ctx context.Context, req *csspb.ListCssProductsRequest, opts ...gax.CallOption) *CssProductIterator
ListCssProducts lists the processed CSS Products in your CSS Center account. The response might contain fewer items than specified by pageSize. Rely on pageToken to determine if there are more items to be requested.
After inserting, updating, or deleting a CSS product input, it may take several minutes before the updated processed CSS product can be retrieved.
Example ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" csspb "cloud.google.com/go/shopping/css/apiv1/csspb" "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 := css.NewCssProductsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &csspb.ListCssProductsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/css/apiv1/csspb#ListCssProductsRequest. } it := c.ListCssProducts(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.(*csspb.ListCssProductsResponse) } }
Output:
Example (All) ¶
package main import ( "context" css "cloud.google.com/go/shopping/css/apiv1" csspb "cloud.google.com/go/shopping/css/apiv1/csspb" ) 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 := css.NewCssProductsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &csspb.ListCssProductsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/shopping/css/apiv1/csspb#ListCssProductsRequest. } for resp, err := range c.ListCssProducts(ctx, req).All() { if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output: