acpfeed

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package acpfeed provides models and an HTTP client for the ACP Feed API.

The Feed API is hosted by agents and called by merchants. Merchants create feed metadata and push product upserts to the agent. Products omitted from an upsert remain unchanged.

NewClientWithResponses returns a client that decodes each documented JSON response into the corresponding JSON200, JSON201, JSON400, or JSON404 field.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCreateFeedRequest

func NewCreateFeedRequest(server string, body CreateFeedJSONRequestBody) (*http.Request, error)

NewCreateFeedRequest calls the generic CreateFeed builder with application/json body

func NewCreateFeedRequestWithBody

func NewCreateFeedRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewCreateFeedRequestWithBody constructs an http.Request for the CreateFeed method, with any body, and a specified content type

func NewGetFeedProductsRequest

func NewGetFeedProductsRequest(server string, id FeedId) (*http.Request, error)

NewGetFeedProductsRequest constructs an http.Request for the GetFeedProducts method

func NewGetFeedRequest

func NewGetFeedRequest(server string, id FeedId) (*http.Request, error)

NewGetFeedRequest constructs an http.Request for the GetFeed method

func NewUpsertFeedProductsRequest

func NewUpsertFeedProductsRequest(server string, id FeedId, body UpsertFeedProductsJSONRequestBody) (*http.Request, error)

NewUpsertFeedProductsRequest calls the generic UpsertFeedProducts builder with application/json body

func NewUpsertFeedProductsRequestWithBody

func NewUpsertFeedProductsRequestWithBody(server string, id FeedId, contentType string, body io.Reader) (*http.Request, error)

NewUpsertFeedProductsRequestWithBody constructs an http.Request for the UpsertFeedProducts method, with any body, and a specified content type

Types

type Availability

type Availability struct {
	// Available Indicates whether the variant is currently purchasable. Use status for fulfillment context.
	Available *bool `json:"available,omitempty"`

	// Status Extensible fulfillment state for the variant. Known values include in_stock, limited_stock, backorder, preorder, out_of_stock, and discontinued.
	Status *string `json:"status,omitempty"`
}

Availability Purchasability and fulfillment state for a variant.

type Barcode

type Barcode struct {
	// Type Barcode scheme or identifier type, such as GTIN, UPC, or EAN.
	Type string `json:"type"`

	// Value Raw barcode value as provided by the merchant.
	Value string `json:"value"`
}

Barcode Machine-readable identifier attached to a variant, such as a GTIN or UPC.

type Category

type Category struct {
	// Taxonomy Names the taxonomy system used for the category value, such as google_product_category, shopify, or merchant.
	Taxonomy *string `json:"taxonomy,omitempty"`

	// Value Category label or hierarchical path, for example Mens > Sweaters > Crewnecks.
	Value string `json:"value"`
}

Category Category assignment for a product or variant within a specific taxonomy.

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) CreateFeed

func (c *Client) CreateFeed(ctx context.Context, body CreateFeedJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

CreateFeed Create a feed

Creates a feed resource and returns server-managed metadata for the new feed.

Takes a body of the `application/json` content type.

Corresponds with POST /feeds (the `CreateFeed` operationId).

func (*Client) CreateFeedWithBody

func (c *Client) CreateFeedWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

CreateFeedWithBody Create a feed

Creates a feed resource and returns server-managed metadata for the new feed.

Takes any type of body and a specified content type.

Corresponds with POST /feeds (the `CreateFeed` operationId).

func (*Client) GetFeed

func (c *Client) GetFeed(ctx context.Context, id FeedId, reqEditors ...RequestEditorFn) (*http.Response, error)

GetFeed Retrieve feed metadata

Returns server-managed metadata for the specified feed.

Corresponds with GET /feeds/{id} (the `GetFeed` operationId).

func (*Client) GetFeedProducts

func (c *Client) GetFeedProducts(ctx context.Context, id FeedId, reqEditors ...RequestEditorFn) (*http.Response, error)

GetFeedProducts Retrieve products for a feed

Returns the full current product set for the specified feed.

Corresponds with GET /feeds/{id}/products (the `GetFeedProducts` operationId).

func (*Client) UpsertFeedProducts

func (c *Client) UpsertFeedProducts(ctx context.Context, id FeedId, body UpsertFeedProductsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

UpsertFeedProducts Upsert products for a feed

Upserts products into the specified feed by `Product.id`. Products omitted from the request remain unchanged.

Takes a body of the `application/json` content type.

Corresponds with PATCH /feeds/{id}/products (the `UpsertFeedProducts` operationId).

func (*Client) UpsertFeedProductsWithBody

func (c *Client) UpsertFeedProductsWithBody(ctx context.Context, id FeedId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

UpsertFeedProductsWithBody Upsert products for a feed

Upserts products into the specified feed by `Product.id`. Products omitted from the request remain unchanged.

Takes any type of body and a specified content type.

Corresponds with PATCH /feeds/{id}/products (the `UpsertFeedProducts` operationId).

type ClientInterface

type ClientInterface interface {

	// CreateFeedWithBody Create a feed
	//
	// Creates a feed resource and returns server-managed metadata for the new feed.
	//
	// Takes any type of body and a specified content type.
	//
	// Corresponds with POST /feeds (the `CreateFeed` operationId).
	CreateFeedWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	// CreateFeed Create a feed
	//
	// Creates a feed resource and returns server-managed metadata for the new feed.
	//
	// Takes a body of the `application/json` content type.
	//
	// Corresponds with POST /feeds (the `CreateFeed` operationId).
	CreateFeed(ctx context.Context, body CreateFeedJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetFeed Retrieve feed metadata
	//
	// Returns server-managed metadata for the specified feed.
	//
	// Corresponds with GET /feeds/{id} (the `GetFeed` operationId).
	GetFeed(ctx context.Context, id FeedId, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetFeedProducts Retrieve products for a feed
	//
	// Returns the full current product set for the specified feed.
	//
	// Corresponds with GET /feeds/{id}/products (the `GetFeedProducts` operationId).
	GetFeedProducts(ctx context.Context, id FeedId, reqEditors ...RequestEditorFn) (*http.Response, error)

	// UpsertFeedProductsWithBody Upsert products for a feed
	//
	// Upserts products into the specified feed by `Product.id`. Products omitted from the request remain unchanged.
	//
	// Takes any type of body and a specified content type.
	//
	// Corresponds with PATCH /feeds/{id}/products (the `UpsertFeedProducts` operationId).
	UpsertFeedProductsWithBody(ctx context.Context, id FeedId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	// UpsertFeedProducts Upsert products for a feed
	//
	// Upserts products into the specified feed by `Product.id`. Products omitted from the request remain unchanged.
	//
	// Takes a body of the `application/json` content type.
	//
	// Corresponds with PATCH /feeds/{id}/products (the `UpsertFeedProducts` operationId).
	UpsertFeedProducts(ctx context.Context, id FeedId, body UpsertFeedProductsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

Example
package main

import (
	"context"
	"fmt"
	"net/http"
	"net/http/httptest"

	"github.com/sumup/acp/acpfeed"
)

func main() {
	server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		w.Header().Set("Content-Type", "application/json")
		w.WriteHeader(http.StatusCreated)
		_, _ = w.Write([]byte(`{"id":"feed_8f3K2x","target_country":"US"}`))
	}))
	defer server.Close()

	client, err := acpfeed.NewClientWithResponses(server.URL)
	if err != nil {
		panic(err)
	}
	country := "US"
	response, err := client.CreateFeedWithResponse(context.Background(), acpfeed.CreateFeedRequest{
		TargetCountry: &country,
	})
	if err != nil {
		panic(err)
	}
	if response.JSON201 == nil {
		panic(fmt.Errorf("create feed: %s", response.Status()))
	}

	fmt.Println(response.JSON201.Id, *response.JSON201.TargetCountry)
}
Output:
feed_8f3K2x US

func (*ClientWithResponses) CreateFeedWithBodyWithResponse

func (c *ClientWithResponses) CreateFeedWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateFeedResponse, error)

CreateFeedWithBodyWithResponse Create a feed

Creates a feed resource and returns server-managed metadata for the new feed.

Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).

Corresponds with POST /feeds (the `CreateFeed` operationId).

func (*ClientWithResponses) CreateFeedWithResponse

func (c *ClientWithResponses) CreateFeedWithResponse(ctx context.Context, body CreateFeedJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateFeedResponse, error)

CreateFeedWithResponse Create a feed

Creates a feed resource and returns server-managed metadata for the new feed.

Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).

Corresponds with POST /feeds (the `CreateFeed` operationId).

func (*ClientWithResponses) GetFeedProductsWithResponse

func (c *ClientWithResponses) GetFeedProductsWithResponse(ctx context.Context, id FeedId, reqEditors ...RequestEditorFn) (*GetFeedProductsResponse, error)

GetFeedProductsWithResponse Retrieve products for a feed

Returns the full current product set for the specified feed.

Returns a wrapper object for the known response body format(s).

Corresponds with GET /feeds/{id}/products (the `GetFeedProducts` operationId).

func (*ClientWithResponses) GetFeedWithResponse

func (c *ClientWithResponses) GetFeedWithResponse(ctx context.Context, id FeedId, reqEditors ...RequestEditorFn) (*GetFeedResponse, error)

GetFeedWithResponse Retrieve feed metadata

Returns server-managed metadata for the specified feed.

Returns a wrapper object for the known response body format(s).

Corresponds with GET /feeds/{id} (the `GetFeed` operationId).

func (*ClientWithResponses) UpsertFeedProductsWithBodyWithResponse

func (c *ClientWithResponses) UpsertFeedProductsWithBodyWithResponse(ctx context.Context, id FeedId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpsertFeedProductsResponse, error)

UpsertFeedProductsWithBodyWithResponse Upsert products for a feed

Upserts products into the specified feed by `Product.id`. Products omitted from the request remain unchanged.

Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).

Corresponds with PATCH /feeds/{id}/products (the `UpsertFeedProducts` operationId).

func (*ClientWithResponses) UpsertFeedProductsWithResponse

func (c *ClientWithResponses) UpsertFeedProductsWithResponse(ctx context.Context, id FeedId, body UpsertFeedProductsJSONRequestBody, reqEditors ...RequestEditorFn) (*UpsertFeedProductsResponse, error)

UpsertFeedProductsWithResponse Upsert products for a feed

Upserts products into the specified feed by `Product.id`. Products omitted from the request remain unchanged.

Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).

Corresponds with PATCH /feeds/{id}/products (the `UpsertFeedProducts` operationId).

Example
package main

import (
	"context"
	"fmt"
	"net/http"
	"net/http/httptest"

	"github.com/sumup/acp/acpfeed"
)

func main() {
	server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		w.Header().Set("Content-Type", "application/json")
		_, _ = w.Write([]byte(`{"id":"feed_8f3K2x","accepted":true}`))
	}))
	defer server.Close()

	client, err := acpfeed.NewClientWithResponses(server.URL)
	if err != nil {
		panic(err)
	}
	response, err := client.UpsertFeedProductsWithResponse(
		context.Background(),
		"feed_8f3K2x",
		acpfeed.UpsertProductsRequest{
			Products: []acpfeed.Product{
				{
					Id: "prod_classic_tee",
					Variants: []acpfeed.Variant{
						{Id: "sku-red-m", Title: "Classic Tee - Red / Medium"},
					},
				},
			},
		},
	)
	if err != nil {
		panic(err)
	}
	if response.JSON200 == nil {
		panic(fmt.Errorf("upsert products: %s", response.Status()))
	}

	fmt.Println(response.JSON200.Id, response.JSON200.Accepted)
}
Output:
feed_8f3K2x true

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {

	// CreateFeedWithBodyWithResponse Create a feed
	//
	// Creates a feed resource and returns server-managed metadata for the new feed.
	//
	// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with POST /feeds (the `CreateFeed` operationId).
	CreateFeedWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateFeedResponse, error)

	// CreateFeedWithResponse Create a feed
	//
	// Creates a feed resource and returns server-managed metadata for the new feed.
	//
	// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with POST /feeds (the `CreateFeed` operationId).
	CreateFeedWithResponse(ctx context.Context, body CreateFeedJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateFeedResponse, error)

	// GetFeedWithResponse Retrieve feed metadata
	//
	// Returns server-managed metadata for the specified feed.
	//
	// Returns a wrapper object for the known response body format(s).
	//
	// Corresponds with GET /feeds/{id} (the `GetFeed` operationId).
	GetFeedWithResponse(ctx context.Context, id FeedId, reqEditors ...RequestEditorFn) (*GetFeedResponse, error)

	// GetFeedProductsWithResponse Retrieve products for a feed
	//
	// Returns the full current product set for the specified feed.
	//
	// Returns a wrapper object for the known response body format(s).
	//
	// Corresponds with GET /feeds/{id}/products (the `GetFeedProducts` operationId).
	GetFeedProductsWithResponse(ctx context.Context, id FeedId, reqEditors ...RequestEditorFn) (*GetFeedProductsResponse, error)

	// UpsertFeedProductsWithBodyWithResponse Upsert products for a feed
	//
	// Upserts products into the specified feed by `Product.id`. Products omitted from the request remain unchanged.
	//
	// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with PATCH /feeds/{id}/products (the `UpsertFeedProducts` operationId).
	UpsertFeedProductsWithBodyWithResponse(ctx context.Context, id FeedId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpsertFeedProductsResponse, error)

	// UpsertFeedProductsWithResponse Upsert products for a feed
	//
	// Upserts products into the specified feed by `Product.id`. Products omitted from the request remain unchanged.
	//
	// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with PATCH /feeds/{id}/products (the `UpsertFeedProducts` operationId).
	UpsertFeedProductsWithResponse(ctx context.Context, id FeedId, body UpsertFeedProductsJSONRequestBody, reqEditors ...RequestEditorFn) (*UpsertFeedProductsResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type Condition

type Condition = []string

Condition Extensible list of applicable item conditions, such as new or secondhand.

type CreateFeedJSONRequestBody

type CreateFeedJSONRequestBody = CreateFeedRequest

CreateFeedJSONRequestBody defines body for CreateFeed for application/json ContentType.

type CreateFeedRequest

type CreateFeedRequest struct {
	// TargetCountry Optional ISO 3166-1 alpha-2 country code describing the feed's target market.
	TargetCountry *string `json:"target_country,omitempty"`
}

CreateFeedRequest Request payload used to create a feed.

type CreateFeedResponse

type CreateFeedResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON201 the response for an HTTP 201 `application/json` response
	JSON201 *FeedMetadata
	// JSON400 the response for an HTTP 400 `application/json` response
	JSON400 *Error
}

func ParseCreateFeedResponse

func ParseCreateFeedResponse(rsp *http.Response) (*CreateFeedResponse, error)

ParseCreateFeedResponse parses an HTTP response from a CreateFeedWithResponse call

func (CreateFeedResponse) ContentType

func (r CreateFeedResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (CreateFeedResponse) GetBody

func (r CreateFeedResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (CreateFeedResponse) GetJSON201

func (r CreateFeedResponse) GetJSON201() *FeedMetadata

GetJSON201 returns the response for an HTTP 201 `application/json` response

func (CreateFeedResponse) GetJSON400

func (r CreateFeedResponse) GetJSON400() *Error

GetJSON400 returns the response for an HTTP 400 `application/json` response

func (CreateFeedResponse) Status

func (r CreateFeedResponse) Status() string

Status returns HTTPResponse.Status

func (CreateFeedResponse) StatusCode

func (r CreateFeedResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Description

type Description struct {
	// Html HTML-formatted description content.
	Html *string `json:"html,omitempty"`

	// Markdown Markdown-formatted description content.
	Markdown *string `json:"markdown,omitempty"`

	// Plain Plain-text description intended for clients that do not render rich formatting.
	Plain *string `json:"plain,omitempty"`
}

Description Structured long-form or rich-text description content for a product or variant.

type Error

type Error struct {
	// Code Machine-readable error code for programmatic handling.
	Code string `json:"code"`

	// Message Human-readable explanation of the error.
	Message string `json:"message"`

	// Param Optional request parameter or field associated with the error.
	Param *string `json:"param,omitempty"`

	// Type High-level error category.
	Type string `json:"type"`
}

Error Structured error returned when a feed request cannot be fulfilled.

type FeedId

type FeedId = string

FeedId defines model for FeedId.

type FeedMetadata

type FeedMetadata struct {
	// Id Stable identifier for the feed resource.
	Id string `json:"id"`

	// TargetCountry Optional ISO 3166-1 alpha-2 country code describing the feed's target market.
	TargetCountry *string `json:"target_country,omitempty"`

	// UpdatedAt Timestamp of the most recent update applied to this feed.
	UpdatedAt *time.Time `json:"updated_at,omitempty"`
}

FeedMetadata Server-managed metadata describing a feed resource.

type GetFeedProductsResponse

type GetFeedProductsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *ProductsResponse
	// JSON404 the response for an HTTP 404 `application/json` response
	JSON404 *Error
}

func ParseGetFeedProductsResponse

func ParseGetFeedProductsResponse(rsp *http.Response) (*GetFeedProductsResponse, error)

ParseGetFeedProductsResponse parses an HTTP response from a GetFeedProductsWithResponse call

func (GetFeedProductsResponse) ContentType

func (r GetFeedProductsResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (GetFeedProductsResponse) GetBody

func (r GetFeedProductsResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (GetFeedProductsResponse) GetJSON200

func (r GetFeedProductsResponse) GetJSON200() *ProductsResponse

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (GetFeedProductsResponse) GetJSON404

func (r GetFeedProductsResponse) GetJSON404() *Error

GetJSON404 returns the response for an HTTP 404 `application/json` response

func (GetFeedProductsResponse) Status

func (r GetFeedProductsResponse) Status() string

Status returns HTTPResponse.Status

func (GetFeedProductsResponse) StatusCode

func (r GetFeedProductsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetFeedResponse

type GetFeedResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *FeedMetadata
	// JSON404 the response for an HTTP 404 `application/json` response
	JSON404 *Error
}

func ParseGetFeedResponse

func ParseGetFeedResponse(rsp *http.Response) (*GetFeedResponse, error)

ParseGetFeedResponse parses an HTTP response from a GetFeedWithResponse call

func (GetFeedResponse) ContentType

func (r GetFeedResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (GetFeedResponse) GetBody

func (r GetFeedResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (GetFeedResponse) GetJSON200

func (r GetFeedResponse) GetJSON200() *FeedMetadata

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (GetFeedResponse) GetJSON404

func (r GetFeedResponse) GetJSON404() *Error

GetJSON404 returns the response for an HTTP 404 `application/json` response

func (GetFeedResponse) Status

func (r GetFeedResponse) Status() string

Status returns HTTPResponse.Status

func (GetFeedResponse) StatusCode

func (r GetFeedResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type Link struct {
	// Title Human-readable label for the linked resource.
	Title *string `json:"title,omitempty"`

	// Type Extensible link type, such as privacy_policy, terms_of_service, refund_policy, shipping_policy, or faq.
	Type string `json:"type"`

	// Url Canonical URL for the linked resource.
	Url string `json:"url"`
}

Link Merchant-provided informational or policy link associated with a seller.

type Measure

type Measure struct {
	// Unit Unit label for the measured quantity, such as oz, ml, or kg.
	Unit string `json:"unit"`

	// Value Measured quantity for the package or item.
	Value float32 `json:"value"`
}

Measure Measured quantity paired with a unit for unit-price calculations.

type Media

type Media struct {
	// AltText Human-readable alternate text describing the asset.
	AltText *string `json:"alt_text,omitempty"`

	// Height Rendered height of the asset in pixels, when known.
	Height *int `json:"height,omitempty"`

	// Type Media kind, such as image, video, or model.
	Type string `json:"type"`

	// Url Canonical URL where the media asset can be retrieved.
	Url string `json:"url"`

	// Width Rendered width of the asset in pixels, when known.
	Width *int `json:"width,omitempty"`
}

Media Media asset associated with a product or variant.

type Price

type Price struct {
	// Amount Monetary amount expressed in ISO 4217 minor units.
	Amount int `json:"amount"`

	// Currency Three-letter ISO 4217 currency identifier.
	Currency string `json:"currency"`
}

Price Monetary amount expressed in minor units with an associated ISO 4217 currency code.

type Product

type Product struct {
	// Description Structured description content for the product.
	Description *Description `json:"description,omitempty"`

	// Id Stable global identifier for this product.
	Id string `json:"id"`

	// Media Media assets associated with the product.
	Media *[]Media `json:"media,omitempty"`

	// Title Display title for the product.
	Title *string `json:"title,omitempty"`

	// Url Canonical URL for the product detail page.
	Url *string `json:"url,omitempty"`

	// Variants Purchasable variants grouped under this product.
	Variants []Variant `json:"variants"`
}

Product Catalog product grouping one or more purchasable variants within a feed.

type ProductsResponse

type ProductsResponse struct {
	// Products Full list of products currently associated with the feed.
	Products []Product `json:"products"`
}

ProductsResponse Response envelope containing the current product set for a feed.

type ReferenceMeasure

type ReferenceMeasure struct {
	// Unit Reference unit label, such as ml, g, or oz.
	Unit string `json:"unit"`

	// Value Reference quantity used to normalize the unit price.
	Value int `json:"value"`
}

ReferenceMeasure Reference unit used when normalizing a unit price for display.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type Seller

type Seller struct {
	// Links Informational or policy links associated with this seller.
	Links *[]Link `json:"links,omitempty"`

	// Name Display name of the seller or merchant of record.
	Name *string `json:"name,omitempty"`
}

Seller Merchant or seller identity associated with a variant offer.

type UnitPrice

type UnitPrice struct {
	// Amount Normalized price amount expressed in ISO 4217 minor units.
	Amount int `json:"amount"`

	// Currency Three-letter ISO 4217 currency identifier.
	Currency string `json:"currency"`

	// Measure Actual packaged measure associated with the sale item.
	Measure Measure `json:"measure"`

	// Reference Reference measure used to display the normalized unit price.
	Reference ReferenceMeasure `json:"reference"`
}

UnitPrice Normalized unit price for products sold by weight, volume, or measure.

type UpsertFeedProductsJSONRequestBody

type UpsertFeedProductsJSONRequestBody = UpsertProductsRequest

UpsertFeedProductsJSONRequestBody defines body for UpsertFeedProducts for application/json ContentType.

type UpsertFeedProductsResponse

type UpsertFeedProductsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *UpsertProductsResponse
	// JSON400 the response for an HTTP 400 `application/json` response
	JSON400 *Error
	// JSON404 the response for an HTTP 404 `application/json` response
	JSON404 *Error
}

func ParseUpsertFeedProductsResponse

func ParseUpsertFeedProductsResponse(rsp *http.Response) (*UpsertFeedProductsResponse, error)

ParseUpsertFeedProductsResponse parses an HTTP response from a UpsertFeedProductsWithResponse call

func (UpsertFeedProductsResponse) ContentType

func (r UpsertFeedProductsResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (UpsertFeedProductsResponse) GetBody

func (r UpsertFeedProductsResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (UpsertFeedProductsResponse) GetJSON200

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (UpsertFeedProductsResponse) GetJSON400

func (r UpsertFeedProductsResponse) GetJSON400() *Error

GetJSON400 returns the response for an HTTP 400 `application/json` response

func (UpsertFeedProductsResponse) GetJSON404

func (r UpsertFeedProductsResponse) GetJSON404() *Error

GetJSON404 returns the response for an HTTP 404 `application/json` response

func (UpsertFeedProductsResponse) Status

Status returns HTTPResponse.Status

func (UpsertFeedProductsResponse) StatusCode

func (r UpsertFeedProductsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type UpsertProductsRequest

type UpsertProductsRequest struct {
	// Products Subset of products to create or update within the feed, matched by Product.id.
	Products []Product `json:"products"`
}

UpsertProductsRequest Request payload that partially upserts products into a feed. Products omitted from the request remain unchanged.

type UpsertProductsResponse

type UpsertProductsResponse struct {
	// Accepted Whether the submitted product upsert payload was accepted for processing.
	Accepted bool `json:"accepted"`

	// Id Identifier for the feed whose product upsert was processed.
	Id string `json:"id"`
}

UpsertProductsResponse Acknowledgement returned after accepting an upsert payload for a feed.

type Variant

type Variant struct {
	// Availability Purchasability and fulfillment state for the variant.
	Availability *Availability `json:"availability,omitempty"`

	// Barcodes Machine-readable identifiers associated with this variant.
	Barcodes *[]Barcode `json:"barcodes,omitempty"`

	// Categories Category assignments associated with this variant.
	Categories *[]Category `json:"categories,omitempty"`

	// Condition Extensible list of conditions applicable to this variant.
	Condition *Condition `json:"condition,omitempty"`

	// Description Structured description content for the variant.
	Description *Description `json:"description,omitempty"`

	// Id Stable global identifier for this variant.
	Id string `json:"id"`

	// ListPrice Reference or pre-discount price for the variant.
	ListPrice *Price `json:"list_price,omitempty"`

	// Marketplace Marketplace or intermediary platform through which this variant is offered, if applicable.
	Marketplace *Seller `json:"marketplace,omitempty"`

	// Media Media assets specific to this variant. The first item is the primary listing asset.
	Media *[]Media `json:"media,omitempty"`

	// Price Active selling price for the variant.
	Price *Price `json:"price,omitempty"`

	// Seller Seller or merchant of record for this variant.
	Seller *Seller `json:"seller,omitempty"`

	// Title Display title for the variant.
	Title string `json:"title"`

	// UnitPrice Normalized unit price, when applicable.
	UnitPrice *UnitPrice `json:"unit_price,omitempty"`

	// Url Canonical URL for the variant detail page.
	Url *string `json:"url,omitempty"`

	// VariantOptions Option selections that distinguish this variant, such as Color: Red or Size: Small.
	VariantOptions *[]VariantOption `json:"variant_options,omitempty"`
}

Variant Purchasable variant of a product within a feed.

type VariantOption

type VariantOption struct {
	// Name Display name of the option dimension, such as Color or Size.
	Name string `json:"name"`

	// Value Selected option value for this variant.
	Value string `json:"value"`
}

VariantOption One selected characteristic of a variant, such as size or color.

Jump to

Keyboard shortcuts

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