inventories

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

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

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

Use of Context

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

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 LocalInventoryCallOptions

type LocalInventoryCallOptions struct {
	ListLocalInventories []gax.CallOption
	InsertLocalInventory []gax.CallOption
	DeleteLocalInventory []gax.CallOption
}

LocalInventoryCallOptions contains the retry settings for each method of LocalInventoryClient.

type LocalInventoryClient

type LocalInventoryClient struct {

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

LocalInventoryClient 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 to manage local inventory for products

func NewLocalInventoryClient

func NewLocalInventoryClient(ctx context.Context, opts ...option.ClientOption) (*LocalInventoryClient, error)

NewLocalInventoryClient creates a new local 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 to manage local inventory for products

Example
package main

import (
	"context"

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

	// TODO: Use client.
	_ = c
}
Output:

func NewLocalInventoryRESTClient

func NewLocalInventoryRESTClient(ctx context.Context, opts ...option.ClientOption) (*LocalInventoryClient, error)

NewLocalInventoryRESTClient creates a new local inventory service rest client.

Service to manage local inventory for products

Example
package main

import (
	"context"

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

	// TODO: Use client.
	_ = c
}
Output:

func (*LocalInventoryClient) Close

func (c *LocalInventoryClient) Close() error

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

func (*LocalInventoryClient) Connection deprecated

func (c *LocalInventoryClient) 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 (*LocalInventoryClient) DeleteLocalInventory

DeleteLocalInventory deletes the specified LocalInventory from the given product in your merchant account. It might take a up to an hour for the LocalInventory to be deleted from the specific product. Once you have received a successful delete response, wait for that period before attempting a delete again.

Example
package main

import (
	"context"

	inventories "cloud.google.com/go/shopping/merchant/inventories/apiv1beta"
	inventoriespb "cloud.google.com/go/shopping/merchant/inventories/apiv1beta/inventoriespb"
)

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

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

func (*LocalInventoryClient) InsertLocalInventory

InsertLocalInventory inserts a LocalInventory resource to a product in your merchant account.

Replaces the full LocalInventory resource if an entry with the same [storeCode][google.shopping.merchant.inventories.v1beta.LocalInventory.store_code] already exists for the product.

It might take up to 30 minutes for the new or updated LocalInventory resource to appear in products.

Example
package main

import (
	"context"

	inventories "cloud.google.com/go/shopping/merchant/inventories/apiv1beta"
	inventoriespb "cloud.google.com/go/shopping/merchant/inventories/apiv1beta/inventoriespb"
)

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

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

func (*LocalInventoryClient) ListLocalInventories

ListLocalInventories lists the LocalInventory resources for the given product in your merchant account. The response might contain fewer items than specified by pageSize. If pageToken was returned in previous request, it can be used to obtain additional results.

LocalInventory resources are listed per product for a given account.

Example
package main

import (
	"context"

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

	req := &inventoriespb.ListLocalInventoriesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/shopping/merchant/inventories/apiv1beta/inventoriespb#ListLocalInventoriesRequest.
	}
	it := c.ListLocalInventories(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.(*inventoriespb.ListLocalInventoriesResponse)
	}
}
Output:

type LocalInventoryIterator

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

LocalInventoryIterator manages a stream of *inventoriespb.LocalInventory.

func (*LocalInventoryIterator) Next

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

func (*LocalInventoryIterator) PageInfo

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

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

type RegionalInventoryCallOptions

type RegionalInventoryCallOptions struct {
	ListRegionalInventories []gax.CallOption
	InsertRegionalInventory []gax.CallOption
	DeleteRegionalInventory []gax.CallOption
}

RegionalInventoryCallOptions contains the retry settings for each method of RegionalInventoryClient.

type RegionalInventoryClient

type RegionalInventoryClient struct {

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

RegionalInventoryClient 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 to manage regional inventory for products. There is also separate regions resource and API to manage regions definitions.

func NewRegionalInventoryClient

func NewRegionalInventoryClient(ctx context.Context, opts ...option.ClientOption) (*RegionalInventoryClient, error)

NewRegionalInventoryClient creates a new regional 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 to manage regional inventory for products. There is also separate regions resource and API to manage regions definitions.

Example
package main

import (
	"context"

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

	// TODO: Use client.
	_ = c
}
Output:

func NewRegionalInventoryRESTClient

func NewRegionalInventoryRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionalInventoryClient, error)

NewRegionalInventoryRESTClient creates a new regional inventory service rest client.

Service to manage regional inventory for products. There is also separate regions resource and API to manage regions definitions.

Example
package main

import (
	"context"

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

	// TODO: Use client.
	_ = c
}
Output:

func (*RegionalInventoryClient) Close

func (c *RegionalInventoryClient) Close() error

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

func (*RegionalInventoryClient) Connection deprecated

func (c *RegionalInventoryClient) 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 (*RegionalInventoryClient) DeleteRegionalInventory

DeleteRegionalInventory deletes the specified RegionalInventory resource from the given product in your merchant account. It might take up to an hour for the RegionalInventory to be deleted from the specific product. Once you have received a successful delete response, wait for that period before attempting a delete again.

Example
package main

import (
	"context"

	inventories "cloud.google.com/go/shopping/merchant/inventories/apiv1beta"
	inventoriespb "cloud.google.com/go/shopping/merchant/inventories/apiv1beta/inventoriespb"
)

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

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

func (*RegionalInventoryClient) InsertRegionalInventory

InsertRegionalInventory inserts a RegionalInventory to a given product in your merchant account.

Replaces the full RegionalInventory resource if an entry with the same [region][google.shopping.merchant.inventories.v1beta.RegionalInventory.region] already exists for the product.

It might take up to 30 minutes for the new or updated RegionalInventory resource to appear in products.

Example
package main

import (
	"context"

	inventories "cloud.google.com/go/shopping/merchant/inventories/apiv1beta"
	inventoriespb "cloud.google.com/go/shopping/merchant/inventories/apiv1beta/inventoriespb"
)

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

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

func (*RegionalInventoryClient) ListRegionalInventories

ListRegionalInventories lists the RegionalInventory resources for the given product in your merchant account. The response might contain fewer items than specified by pageSize. If pageToken was returned in previous request, it can be used to obtain additional results.

RegionalInventory resources are listed per product for a given account.

Example
package main

import (
	"context"

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

	req := &inventoriespb.ListRegionalInventoriesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/shopping/merchant/inventories/apiv1beta/inventoriespb#ListRegionalInventoriesRequest.
	}
	it := c.ListRegionalInventories(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.(*inventoriespb.ListRegionalInventoriesResponse)
	}
}
Output:

type RegionalInventoryIterator

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

RegionalInventoryIterator manages a stream of *inventoriespb.RegionalInventory.

func (*RegionalInventoryIterator) Next

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

func (*RegionalInventoryIterator) PageInfo

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL