Documentation ¶
Overview ¶
Package merchantapi provides access to the Merchant API.
For product documentation, see: https://developers.devsite.corp.google.com/merchant/api
Library status ¶
These client libraries are officially supported by Google. However, this library is considered complete and is in maintenance mode. This means that we will address critical bugs and security issues but will not add any new features.
When possible, we recommend using our newer [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go) that are still actively being worked and iterated on.
Creating a client ¶
Usage example:
import "google.golang.org/api/merchantapi/quota_v1beta" ... ctx := context.Background() merchantapiService, err := merchantapi.NewService(ctx)
In this example, Google Application Default Credentials are used for authentication. For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
Other authentication options ¶
To use an API key for authentication (note: some APIs do not support API keys), use google.golang.org/api/option.WithAPIKey:
merchantapiService, err := merchantapi.NewService(ctx, option.WithAPIKey("AIza..."))
To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow, use google.golang.org/api/option.WithTokenSource:
config := &oauth2.Config{...} // ... token, err := config.Exchange(ctx, ...) merchantapiService, err := merchantapi.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
See google.golang.org/api/option.ClientOption for details on options.
Index ¶
- Constants
- type AccountsQuotasListCall
- func (c *AccountsQuotasListCall) Context(ctx context.Context) *AccountsQuotasListCall
- func (c *AccountsQuotasListCall) Do(opts ...googleapi.CallOption) (*ListQuotaGroupsResponse, error)
- func (c *AccountsQuotasListCall) Fields(s ...googleapi.Field) *AccountsQuotasListCall
- func (c *AccountsQuotasListCall) Header() http.Header
- func (c *AccountsQuotasListCall) IfNoneMatch(entityTag string) *AccountsQuotasListCall
- func (c *AccountsQuotasListCall) PageSize(pageSize int64) *AccountsQuotasListCall
- func (c *AccountsQuotasListCall) PageToken(pageToken string) *AccountsQuotasListCall
- func (c *AccountsQuotasListCall) Pages(ctx context.Context, f func(*ListQuotaGroupsResponse) error) error
- type AccountsQuotasService
- type AccountsService
- type ListQuotaGroupsResponse
- type MethodDetails
- type ProductChange
- type ProductStatusChangeMessage
- type QuotaGroup
- type Service
Constants ¶
const (
// Manage your product listings and accounts for Google Shopping
ContentScope = "https://www.googleapis.com/auth/content"
)
OAuth2 scopes used by this API.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountsQuotasListCall ¶
type AccountsQuotasListCall struct {
// contains filtered or unexported fields
}
func (*AccountsQuotasListCall) Context ¶
func (c *AccountsQuotasListCall) Context(ctx context.Context) *AccountsQuotasListCall
Context sets the context to be used in this call's Do method.
func (*AccountsQuotasListCall) Do ¶
func (c *AccountsQuotasListCall) Do(opts ...googleapi.CallOption) (*ListQuotaGroupsResponse, error)
Do executes the "merchantapi.accounts.quotas.list" call. Any non-2xx status code is an error. Response headers are in either *ListQuotaGroupsResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*AccountsQuotasListCall) Fields ¶
func (c *AccountsQuotasListCall) Fields(s ...googleapi.Field) *AccountsQuotasListCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*AccountsQuotasListCall) Header ¶
func (c *AccountsQuotasListCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
func (*AccountsQuotasListCall) IfNoneMatch ¶
func (c *AccountsQuotasListCall) IfNoneMatch(entityTag string) *AccountsQuotasListCall
IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.
func (*AccountsQuotasListCall) PageSize ¶
func (c *AccountsQuotasListCall) PageSize(pageSize int64) *AccountsQuotasListCall
PageSize sets the optional parameter "pageSize": The maximum number of quotas to return in the response, used for paging. Defaults to 500; values above 1000 will be coerced to 1000.
func (*AccountsQuotasListCall) PageToken ¶
func (c *AccountsQuotasListCall) PageToken(pageToken string) *AccountsQuotasListCall
PageToken sets the optional parameter "pageToken": Token (if provided) to retrieve the subsequent page. All other parameters must match the original call that provided the page token.
func (*AccountsQuotasListCall) Pages ¶
func (c *AccountsQuotasListCall) Pages(ctx context.Context, f func(*ListQuotaGroupsResponse) error) error
Pages invokes f for each page of results. A non-nil error returned from f will halt the iteration. The provided context supersedes any context provided to the Context method.
type AccountsQuotasService ¶
type AccountsQuotasService struct {
// contains filtered or unexported fields
}
func NewAccountsQuotasService ¶
func NewAccountsQuotasService(s *Service) *AccountsQuotasService
func (*AccountsQuotasService) List ¶
func (r *AccountsQuotasService) List(parent string) *AccountsQuotasListCall
List: Lists the daily call quota and usage per group for your Merchant Center account.
- parent: The merchant account who owns the collection of method quotas Format: accounts/{account}.
type AccountsService ¶
type AccountsService struct { Quotas *AccountsQuotasService // contains filtered or unexported fields }
func NewAccountsService ¶
func NewAccountsService(s *Service) *AccountsService
type ListQuotaGroupsResponse ¶
type ListQuotaGroupsResponse struct { // NextPageToken: A token, which can be sent as `page_token` to retrieve the // next page. If this field is omitted, there are no subsequent pages. NextPageToken string `json:"nextPageToken,omitempty"` // QuotaGroups: The methods, current quota usage and limits per each group. The // quota is shared between all methods in the group. The groups are sorted in // descending order based on quotaUsage. QuotaGroups []*QuotaGroup `json:"quotaGroups,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "NextPageToken") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "NextPageToken") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
ListQuotaGroupsResponse: Response message for the ListMethodGroups method.
func (ListQuotaGroupsResponse) MarshalJSON ¶
func (s ListQuotaGroupsResponse) MarshalJSON() ([]byte, error)
type MethodDetails ¶
type MethodDetails struct { // Method: Output only. The name of the method for example `products.list`. Method string `json:"method,omitempty"` // Path: Output only. The path for the method such as // `products/v1/productInputs.insert` Path string `json:"path,omitempty"` // Subapi: Output only. The sub-API that the method belongs to. Subapi string `json:"subapi,omitempty"` // Version: Output only. The API version that the method belongs to. Version string `json:"version,omitempty"` // ForceSendFields is a list of field names (e.g. "Method") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Method") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
MethodDetails: The method details per method in the Merchant API.
func (MethodDetails) MarshalJSON ¶
func (s MethodDetails) MarshalJSON() ([]byte, error)
type ProductChange ¶
type ProductChange struct { // NewValue: The new value of the changed resource or attribute. NewValue string `json:"newValue,omitempty"` // OldValue: The old value of the changed resource or attribute. OldValue string `json:"oldValue,omitempty"` // RegionCode: Countries that have the change (if applicable) RegionCode string `json:"regionCode,omitempty"` // ReportingContext: Reporting contexts that have the change (if applicable) // // Possible values: // "REPORTING_CONTEXT_ENUM_UNSPECIFIED" - Not specified. // "SHOPPING_ADS" - [Shopping // ads](https://support.google.com/merchants/answer/6149970). // "DISCOVERY_ADS" - Deprecated: Use `DEMAND_GEN_ADS` instead. [Discovery and // Demand Gen ads](https://support.google.com/merchants/answer/13389785). // "DEMAND_GEN_ADS" - [Demand Gen // ads](https://support.google.com/merchants/answer/13389785). // "DEMAND_GEN_ADS_DISCOVER_SURFACE" - [Demand Gen ads on Discover // surface](https://support.google.com/merchants/answer/13389785). // "VIDEO_ADS" - [Video // ads](https://support.google.com/google-ads/answer/6340491). // "DISPLAY_ADS" - [Display // ads](https://support.google.com/merchants/answer/6069387). // "LOCAL_INVENTORY_ADS" - [Local inventory // ads](https://support.google.com/merchants/answer/3271956). // "VEHICLE_INVENTORY_ADS" - [Vehicle inventory // ads](https://support.google.com/merchants/answer/11544533). // "FREE_LISTINGS" - [Free product // listings](https://support.google.com/merchants/answer/9199328). // "FREE_LOCAL_LISTINGS" - [Free local product // listings](https://support.google.com/merchants/answer/9825611). // "FREE_LOCAL_VEHICLE_LISTINGS" - [Free local vehicle // listings](https://support.google.com/merchants/answer/11544533). // "YOUTUBE_SHOPPING" - [YouTube // Shopping](https://support.google.com/merchants/answer/13478370). // "CLOUD_RETAIL" - [Cloud // retail](https://cloud.google.com/solutions/retail). // "LOCAL_CLOUD_RETAIL" - [Local cloud // retail](https://cloud.google.com/solutions/retail). // "PRODUCT_REVIEWS" - [Product // Reviews](https://support.google.com/merchants/answer/14620732). // "MERCHANT_REVIEWS" - [Merchant // Reviews](https://developers.google.com/merchant-review-feeds). ReportingContext string `json:"reportingContext,omitempty"` // ForceSendFields is a list of field names (e.g. "NewValue") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "NewValue") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
ProductChange: The change that happened to the product including old value, new value, country code as the region code and reporting context.
func (ProductChange) MarshalJSON ¶
func (s ProductChange) MarshalJSON() ([]byte, error)
type ProductStatusChangeMessage ¶
type ProductStatusChangeMessage struct { // Account: The target account that owns the entity that changed. Format : // `accounts/{merchant_id}` Account string `json:"account,omitempty"` // Attribute: The attribute in the resource that changed, in this case it will // be always `Status`. // // Possible values: // "ATTRIBUTE_UNSPECIFIED" - Unspecified attribute // "STATUS" - Status of the changed entity Attribute string `json:"attribute,omitempty"` // Changes: A message to describe the change that happened to the product Changes []*ProductChange `json:"changes,omitempty"` // ManagingAccount: The account that manages the merchant's account. can be the // same as merchant id if it is standalone account. Format : // `accounts/{service_provider_id}` ManagingAccount string `json:"managingAccount,omitempty"` // Resource: The product name. Format: // `{product.name=accounts/{account}/products/{product}}` Resource string `json:"resource,omitempty"` // ResourceId: The product id. ResourceId string `json:"resourceId,omitempty"` // ResourceType: The resource that changed, in this case it will always be // `Product`. // // Possible values: // "RESOURCE_UNSPECIFIED" - Unspecified resource // "PRODUCT" - Resource type : product ResourceType string `json:"resourceType,omitempty"` // ForceSendFields is a list of field names (e.g. "Account") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Account") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
ProductStatusChangeMessage: The message that the merchant will receive to notify about product status change event
func (ProductStatusChangeMessage) MarshalJSON ¶
func (s ProductStatusChangeMessage) MarshalJSON() ([]byte, error)
type QuotaGroup ¶
type QuotaGroup struct { // MethodDetails: Output only. List of all methods group quota applies to. MethodDetails []*MethodDetails `json:"methodDetails,omitempty"` // Name: Identifier. The resource name of the quota group. Format: // accounts/{account}/quotas/{group} Note: There is no guarantee on the format // of {group} Name string `json:"name,omitempty"` // QuotaLimit: Output only. The maximum number of calls allowed per day for the // group. QuotaLimit int64 `json:"quotaLimit,omitempty,string"` // QuotaMinuteLimit: Output only. The maximum number of calls allowed per // minute for the group. QuotaMinuteLimit int64 `json:"quotaMinuteLimit,omitempty,string"` // QuotaUsage: Output only. The current quota usage, meaning the number of // calls already made on a given day to the methods in the group. The daily // quota limits reset at at 12:00 PM midday UTC. QuotaUsage int64 `json:"quotaUsage,omitempty,string"` // ForceSendFields is a list of field names (e.g. "MethodDetails") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "MethodDetails") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
QuotaGroup: The group information for methods in the Merchant API. The quota is shared between all methods in the group. Even if none of the methods within the group have usage the information for the group is returned.
func (QuotaGroup) MarshalJSON ¶
func (s QuotaGroup) MarshalJSON() ([]byte, error)
type Service ¶
type Service struct { BasePath string // API endpoint base URL UserAgent string // optional additional User-Agent fragment Accounts *AccountsService // contains filtered or unexported fields }
func New
deprecated
New creates a new Service. It uses the provided http.Client for requests.
Deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
func NewService ¶
NewService creates a new Service.