Merchant API v1beta - Package cloud.google.com/go/shopping/merchant/lfp/apiv1beta (v0.8.5)

Package lfp 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:

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 := lfp.NewLfpInventoryClient(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 := lfp.NewLfpInventoryClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

req := &lfppb.InsertLfpInventoryRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb#InsertLfpInventoryRequest.
}
resp, err := c.InsertLfpInventory(ctx, req)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Use of Context

The ctx passed to NewLfpInventoryClient 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.

LfpInventoryCallOptions

type LfpInventoryCallOptions struct {
	InsertLfpInventory []gax.CallOption
}

LfpInventoryCallOptions contains the retry settings for each method of LfpInventoryClient.

LfpInventoryClient

type LfpInventoryClient struct {

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

LfpInventoryClient 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 for a LFP partner (at https://support.google.com/merchants/answer/7676652) to submit local inventories for a merchant.

func NewLfpInventoryClient

func NewLfpInventoryClient(ctx context.Context, opts ...option.ClientOption) (*LfpInventoryClient, error)

NewLfpInventoryClient creates a new lfp inventory 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 a LFP partner (at https://support.google.com/merchants/answer/7676652) to submit local inventories for a merchant.

Example

package main

import (
	"context"

	lfp "cloud.google.com/go/shopping/merchant/lfp/apiv1beta"
)

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 := lfp.NewLfpInventoryClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func NewLfpInventoryRESTClient

func NewLfpInventoryRESTClient(ctx context.Context, opts ...option.ClientOption) (*LfpInventoryClient, error)

NewLfpInventoryRESTClient creates a new lfp inventory service rest client.

Service for a LFP partner (at https://support.google.com/merchants/answer/7676652) to submit local inventories for a merchant.

Example

package main

import (
	"context"

	lfp "cloud.google.com/go/shopping/merchant/lfp/apiv1beta"
)

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 := lfp.NewLfpInventoryRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*LfpInventoryClient) Close

func (c *LfpInventoryClient) Close() error

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

func (*LfpInventoryClient) Connection (deprecated)

func (c *LfpInventoryClient) 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 (*LfpInventoryClient) InsertLfpInventory

InsertLfpInventory inserts a LfpInventory resource for the given target merchant account. If the resource already exists, it will be replaced. The inventory automatically expires after 30 days.

Example

package main

import (
	"context"

	lfp "cloud.google.com/go/shopping/merchant/lfp/apiv1beta"
	lfppb "cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb"
)

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 := lfp.NewLfpInventoryClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &lfppb.InsertLfpInventoryRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb#InsertLfpInventoryRequest.
	}
	resp, err := c.InsertLfpInventory(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

LfpSaleCallOptions

type LfpSaleCallOptions struct {
	InsertLfpSale []gax.CallOption
}

LfpSaleCallOptions contains the retry settings for each method of LfpSaleClient.

LfpSaleClient

type LfpSaleClient struct {

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

LfpSaleClient 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 for a LFP partner (at https://support.google.com/merchants/answer/7676652) to submit sales data for a merchant.

func NewLfpSaleClient

func NewLfpSaleClient(ctx context.Context, opts ...option.ClientOption) (*LfpSaleClient, error)

NewLfpSaleClient creates a new lfp sale 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 a LFP partner (at https://support.google.com/merchants/answer/7676652) to submit sales data for a merchant.

Example

package main

import (
	"context"

	lfp "cloud.google.com/go/shopping/merchant/lfp/apiv1beta"
)

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 := lfp.NewLfpSaleClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func NewLfpSaleRESTClient

func NewLfpSaleRESTClient(ctx context.Context, opts ...option.ClientOption) (*LfpSaleClient, error)

NewLfpSaleRESTClient creates a new lfp sale service rest client.

Service for a LFP partner (at https://support.google.com/merchants/answer/7676652) to submit sales data for a merchant.

Example

package main

import (
	"context"

	lfp "cloud.google.com/go/shopping/merchant/lfp/apiv1beta"
)

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 := lfp.NewLfpSaleRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*LfpSaleClient) Close

func (c *LfpSaleClient) Close() error

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

func (*LfpSaleClient) Connection (deprecated)

func (c *LfpSaleClient) 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 (*LfpSaleClient) InsertLfpSale

func (c *LfpSaleClient) InsertLfpSale(ctx context.Context, req *lfppb.InsertLfpSaleRequest, opts ...gax.CallOption) (*lfppb.LfpSale, error)

InsertLfpSale inserts a LfpSale for the given merchant.

Example

package main

import (
	"context"

	lfp "cloud.google.com/go/shopping/merchant/lfp/apiv1beta"
	lfppb "cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb"
)

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 := lfp.NewLfpSaleClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &lfppb.InsertLfpSaleRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb#InsertLfpSaleRequest.
	}
	resp, err := c.InsertLfpSale(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

LfpStoreCallOptions

type LfpStoreCallOptions struct {
	GetLfpStore    []gax.CallOption
	InsertLfpStore []gax.CallOption
	DeleteLfpStore []gax.CallOption
	ListLfpStores  []gax.CallOption
}

LfpStoreCallOptions contains the retry settings for each method of LfpStoreClient.

LfpStoreClient

type LfpStoreClient struct {

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

LfpStoreClient 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 for a LFP partner (at https://support.google.com/merchants/answer/7676652) to submit local stores for a merchant.

func NewLfpStoreClient

func NewLfpStoreClient(ctx context.Context, opts ...option.ClientOption) (*LfpStoreClient, error)

NewLfpStoreClient creates a new lfp store 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 a LFP partner (at https://support.google.com/merchants/answer/7676652) to submit local stores for a merchant.

Example

package main

import (
	"context"

	lfp "cloud.google.com/go/shopping/merchant/lfp/apiv1beta"
)

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 := lfp.NewLfpStoreClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func NewLfpStoreRESTClient

func NewLfpStoreRESTClient(ctx context.Context, opts ...option.ClientOption) (*LfpStoreClient, error)

NewLfpStoreRESTClient creates a new lfp store service rest client.

Service for a LFP partner (at https://support.google.com/merchants/answer/7676652) to submit local stores for a merchant.

Example

package main

import (
	"context"

	lfp "cloud.google.com/go/shopping/merchant/lfp/apiv1beta"
)

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 := lfp.NewLfpStoreRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*LfpStoreClient) Close

func (c *LfpStoreClient) Close() error

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

func (*LfpStoreClient) Connection (deprecated)

func (c *LfpStoreClient) 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 (*LfpStoreClient) DeleteLfpStore

func (c *LfpStoreClient) DeleteLfpStore(ctx context.Context, req *lfppb.DeleteLfpStoreRequest, opts ...gax.CallOption) error

DeleteLfpStore deletes a store for a target merchant.

Example

package main

import (
	"context"

	lfp "cloud.google.com/go/shopping/merchant/lfp/apiv1beta"
	lfppb "cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb"
)

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 := lfp.NewLfpStoreClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &lfppb.DeleteLfpStoreRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb#DeleteLfpStoreRequest.
	}
	err = c.DeleteLfpStore(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*LfpStoreClient) GetLfpStore

func (c *LfpStoreClient) GetLfpStore(ctx context.Context, req *lfppb.GetLfpStoreRequest, opts ...gax.CallOption) (*lfppb.LfpStore, error)

GetLfpStore retrieves information about a store.

Example

package main

import (
	"context"

	lfp "cloud.google.com/go/shopping/merchant/lfp/apiv1beta"
	lfppb "cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb"
)

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 := lfp.NewLfpStoreClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &lfppb.GetLfpStoreRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb#GetLfpStoreRequest.
	}
	resp, err := c.GetLfpStore(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*LfpStoreClient) InsertLfpStore

func (c *LfpStoreClient) InsertLfpStore(ctx context.Context, req *lfppb.InsertLfpStoreRequest, opts ...gax.CallOption) (*lfppb.LfpStore, error)

InsertLfpStore inserts a store for the target merchant. If the store with the same store code already exists, it will be replaced.

Example

package main

import (
	"context"

	lfp "cloud.google.com/go/shopping/merchant/lfp/apiv1beta"
	lfppb "cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb"
)

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 := lfp.NewLfpStoreClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &lfppb.InsertLfpStoreRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb#InsertLfpStoreRequest.
	}
	resp, err := c.InsertLfpStore(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*LfpStoreClient) ListLfpStores

ListLfpStores lists the stores of the target merchant, specified by the filter in ListLfpStoresRequest.

Example

package main

import (
	"context"

	lfp "cloud.google.com/go/shopping/merchant/lfp/apiv1beta"
	lfppb "cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb"
	"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 := lfp.NewLfpStoreClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &lfppb.ListLfpStoresRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb#ListLfpStoresRequest.
	}
	it := c.ListLfpStores(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.(*lfppb.ListLfpStoresResponse)
	}
}

LfpStoreIterator

type LfpStoreIterator 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 []*lfppb.LfpStore, nextPageToken string, err error)
	// contains filtered or unexported fields
}

LfpStoreIterator manages a stream of *lfppb.LfpStore.

func (*LfpStoreIterator) Next

func (it *LfpStoreIterator) Next() (*lfppb.LfpStore, 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 (*LfpStoreIterator) PageInfo

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

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