Documentation
¶
Overview ¶
Package shelfatlas is the official Go client for the ShelfAtlas Catalog API — read access to normalised Danish retail catalog data (products, offers, stores, chains, and price history).
Index ¶
- type CatalogError
- type Chain
- type Client
- func (c *Client) GetOffer(ctx context.Context, id string) (*Offer, error)
- func (c *Client) GetProduct(ctx context.Context, id string) (*Product, error)
- func (c *Client) GetStore(ctx context.Context, id string) (*Store, error)
- func (c *Client) IterOffers(ctx context.Context, p OfferListParams) iter.Seq2[Offer, error]
- func (c *Client) IterProductOffers(ctx context.Context, productID string, p PageParams) iter.Seq2[Offer, error]
- func (c *Client) IterProducts(ctx context.Context, p ProductListParams) iter.Seq2[Product, error]
- func (c *Client) IterStores(ctx context.Context, p StoreListParams) iter.Seq2[Store, error]
- func (c *Client) ListChains(ctx context.Context) ([]Chain, error)
- func (c *Client) ListOffers(ctx context.Context, p OfferListParams) (*Page[Offer], error)
- func (c *Client) ListProductOffers(ctx context.Context, productID string, p PageParams) (*Page[Offer], error)
- func (c *Client) ListProducts(ctx context.Context, p ProductListParams) (*Page[Product], error)
- func (c *Client) ListStores(ctx context.Context, p StoreListParams) (*Page[Store], error)
- func (c *Client) NearestStores(ctx context.Context, p NearestParams) (*Page[Store], error)
- func (c *Client) PriceHistory(ctx context.Context, p PriceHistoryParams) ([]PriceHistoryPoint, error)
- type ErrorCode
- type NearestParams
- type Offer
- type OfferListParams
- type Option
- type Page
- type PageParams
- type Pagination
- type PriceHistoryParams
- type PriceHistoryPoint
- type Product
- type ProductListParams
- type Store
- type StoreListParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CatalogError ¶
CatalogError is returned by every client method on failure.
RetryAfterSec is populated from the Retry-After header on a rate_limited (429) response. Callers can type-assert: var e *CatalogError; errors.As(err, &e).
func (*CatalogError) Error ¶
func (e *CatalogError) Error() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a ShelfAtlas Catalog API client. Create one with NewClient.
func NewClient ¶
NewClient returns a client for baseURL (e.g. "https://api.shelfatlas.com") authenticated with a ShelfAtlas API key.
func (*Client) GetProduct ¶
func (*Client) IterOffers ¶
func (*Client) IterProductOffers ¶
func (*Client) IterProducts ¶
func (*Client) IterStores ¶
func (*Client) ListOffers ¶
func (*Client) ListProductOffers ¶
func (*Client) ListProducts ¶
func (*Client) ListStores ¶
func (*Client) NearestStores ¶
func (*Client) PriceHistory ¶
func (c *Client) PriceHistory(ctx context.Context, p PriceHistoryParams) ([]PriceHistoryPoint, error)
type ErrorCode ¶
type ErrorCode string
ErrorCode mirrors the TypeScript and Python SDKs' error taxonomy so behaviour is consistent across languages.
type NearestParams ¶
type OfferListParams ¶
type Option ¶
type Option func(*Client)
Option configures a Client.
func WithBaseDelay ¶
WithBaseDelay sets the exponential-backoff base delay.
func WithHTTPClient ¶
WithHTTPClient sets the underlying *http.Client (e.g. for custom transports).
func WithMaxAttempts ¶
WithMaxAttempts sets the total attempts (including the first) for retryable GETs.
func WithTimeout ¶
WithTimeout sets the per-request timeout on the default http client.
type Page ¶
type Page[T any] struct { Data []T Pagination *Pagination }
Page is one page of a cursor-paginated listing.
type PageParams ¶
type Pagination ¶
type PriceHistoryParams ¶
type PriceHistoryPoint ¶
type ProductListParams ¶
type Store ¶
type Store struct {
ID string `json:"id"`
Name string `json:"name"`
ChainSlug string `json:"chainSlug"`
ChainName string `json:"chainName"`
Address string `json:"address"`
City string `json:"city"`
PostalCode *string `json:"postalCode"`
Lat float64 `json:"lat"`
Lng float64 `json:"lng"`
OpeningHours map[string]any `json:"openingHours"`
Timezone string `json:"timezone"`
}