amazon

package
v0.0.0-...-f99b4cc Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearDeviceAuthorization

func ClearDeviceAuthorization() error

func Logout

func Logout() error

Types

type Address

type Address struct {
	ID             string `json:"-"`
	Index          int    `json:"index"`
	Display        string `json:"display"`
	Selected       bool   `json:"selected"`
	FreshAvailable bool   `json:"fresh_available"`
	StoreRegionID  string `json:"-"`
}

type AddressChange

type AddressChange struct {
	OK      bool    `json:"ok"`
	Address Address `json:"address"`
}

type Addresses

type Addresses struct {
	Items     []Address `json:"items"`
	CSRFToken string    `json:"-"`
}

type AuthStatus

type AuthStatus struct {
	Authenticated bool   `json:"authenticated"`
	Account       bool   `json:"account"`
	Orders        bool   `json:"orders"`
	Substitutions bool   `json:"substitutions"`
	CheckedVia    string `json:"checked_via"`
}

type CancelOrderResult

type CancelOrderResult struct {
	OK      bool   `json:"ok"`
	OrderID string `json:"order_id"`
	State   string `json:"state"`
	Message string `json:"message,omitempty"`
}

type Cart

type Cart struct {
	Items     []CartItem `json:"items"`
	CSRFToken string     `json:"-"`
}

type CartItem

type CartItem struct {
	ItemID   string `json:"item_id"`
	ASIN     string `json:"asin"`
	Title    string `json:"title"`
	Quantity int    `json:"quantity"`
	Price    string `json:"unit_price,omitempty"`
	BrandID  string `json:"-"`
}

type CartMutation

type CartMutation struct {
	OK     bool     `json:"ok"`
	Action string   `json:"action"`
	Item   CartItem `json:"item"`
}

type CheckoutLineItem

type CheckoutLineItem struct {
	Type   string `json:"type"`
	Label  string `json:"label"`
	Amount string `json:"amount"`
}

type CheckoutReview

type CheckoutReview struct {
	ItemCount         int                `json:"item_count"`
	DeliveryAddress   string             `json:"delivery_address"`
	DeliveryWindow    string             `json:"delivery_window"`
	PaymentMethod     string             `json:"payment_method"`
	OrderTotal        string             `json:"order_total"`
	Breakdown         []CheckoutLineItem `json:"breakdown"`
	MaximumTotal      string             `json:"maximum_total"`
	ConfirmationToken string             `json:"confirmation_token"`
	ExpiresAt         string             `json:"expires_at"`
	// contains filtered or unexported fields
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient() (*Client, error)

func (*Client) AddToCartAtPriceFromURL

func (c *Client) AddToCartAtPriceFromURL(ctx context.Context, asin, displayedPrice, productURL string) (CartMutation, error)

func (*Client) Addresses

func (c *Client) Addresses(ctx context.Context) (Addresses, error)

func (*Client) AuthStatus

func (c *Client) AuthStatus(ctx context.Context) (AuthStatus, error)

func (*Client) CancelOrder

func (c *Client) CancelOrder(ctx context.Context, orderID, confirmation string) (CancelOrderResult, error)

func (*Client) Cart

func (c *Client) Cart(ctx context.Context) (Cart, error)

func (*Client) CheckoutPreview

func (c *Client) CheckoutPreview(ctx context.Context, maxTotalCents int64) (CheckoutReview, error)

func (*Client) CheckoutPreviewWithTip

func (c *Client) CheckoutPreviewWithTip(ctx context.Context, maxTotalCents, tipCents int64) (CheckoutReview, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) DeliverySlots

func (c *Client) DeliverySlots(ctx context.Context) (DeliverySlots, error)

func (*Client) Doctor

func (c *Client) Doctor(ctx context.Context) (DoctorResult, error)

func (*Client) PlaceOrder

func (c *Client) PlaceOrder(ctx context.Context, token, confirmation string, maxTotalCents int64) (PlaceOrderResult, error)

func (*Client) RecentOrders

func (c *Client) RecentOrders(ctx context.Context) (Orders, error)

func (*Client) RemoveFromCart

func (c *Client) RemoveFromCart(ctx context.Context, identifier string) (CartMutation, error)

func (*Client) Search

func (c *Client) Search(ctx context.Context, query string, limit int) (SearchResult, error)

Search reproduces the Fresh-scoped search navigation seen in HAR req_0464, req_0607, and req_0724. The random browser-only crid/ref parameters are not required for the server-side result page.

func (*Client) SelectDeliverySlot

func (c *Client) SelectDeliverySlot(ctx context.Context, index int) (DeliverySlotChange, error)

func (*Client) SetCartQuantity

func (c *Client) SetCartQuantity(ctx context.Context, identifier string, quantity int) (CartMutation, error)

func (*Client) SetCheckoutTip

func (c *Client) SetCheckoutTip(ctx context.Context, tipCents int64) (CheckoutReview, error)

func (*Client) SetSubstitution

func (c *Client) SetSubstitution(ctx context.Context, identifier, policy string) (SubstitutionChange, error)

func (*Client) Substitutions

func (c *Client) Substitutions(ctx context.Context) (Substitutions, error)

func (*Client) UseAddress

func (c *Client) UseAddress(ctx context.Context, identifier string) (AddressChange, error)

type DeliverySlot

type DeliverySlot struct {
	Index        int    `json:"index"`
	Date         string `json:"date"`
	Window       string `json:"window"`
	Availability string `json:"availability"`
	Selected     bool   `json:"selected"`
	// contains filtered or unexported fields
}

type DeliverySlotChange

type DeliverySlotChange struct {
	OK   bool         `json:"ok"`
	Slot DeliverySlot `json:"slot"`
}

type DeliverySlots

type DeliverySlots struct {
	Items []DeliverySlot `json:"items"`
	// contains filtered or unexported fields
}

type DeviceAuthChallenge

type DeviceAuthChallenge struct {
	Status    string `json:"status"`
	Code      string `json:"code"`
	URL       string `json:"url"`
	ExpiresAt string `json:"expires_at"`
}

func StartDeviceAuthorization

func StartDeviceAuthorization(ctx context.Context) (DeviceAuthChallenge, error)

type DeviceAuthResult

type DeviceAuthResult struct {
	Status          string     `json:"status"`
	Authenticated   bool       `json:"authenticated"`
	CookiesReplaced bool       `json:"cookies_replaced,omitempty"`
	CookieCount     int        `json:"cookie_count,omitempty"`
	FreshVerified   bool       `json:"fresh_verified,omitempty"`
	AuthStatus      AuthStatus `json:"auth_status,omitempty"`
}

func CompleteDeviceAuthorization

func CompleteDeviceAuthorization(ctx context.Context) (DeviceAuthResult, error)

func RefreshDeviceAuthorization

func RefreshDeviceAuthorization(ctx context.Context) (DeviceAuthResult, error)

type DoctorResult

type DoctorResult struct {
	OK               bool   `json:"ok"`
	HTTPVersion      string `json:"http_version"`
	UserAgent        string `json:"user_agent"`
	JA3Hash          string `json:"ja3_hash,omitempty"`
	JA4              string `json:"ja4,omitempty"`
	HTTP2Fingerprint string `json:"http2_fingerprint,omitempty"`
}

type Order

type Order struct {
	Index    int    `json:"index"`
	MaskedID string `json:"order_id"`
	Summary  string `json:"summary,omitempty"`
	ID       string `json:"-"`
}

type Orders

type Orders struct {
	Items []Order `json:"items"`
}

type PlaceOrderResult

type PlaceOrderResult struct {
	OK       bool   `json:"ok"`
	Accepted bool   `json:"accepted"`
	OrderID  string `json:"order_id,omitempty"`
	Message  string `json:"message"`
}

type Product

type Product struct {
	ASIN         string `json:"asin"`
	Title        string `json:"title"`
	Price        string `json:"price,omitempty"`
	UnitPrice    string `json:"unit_price,omitempty"`
	Promotion    string `json:"promotion,omitempty"`
	Availability string `json:"availability,omitempty"`
	InCart       int    `json:"in_cart,omitempty"`
	URL          string `json:"url"`
}

type SearchResult

type SearchResult struct {
	Query     string    `json:"query"`
	Products  []Product `json:"products"`
	PageTitle string    `json:"page_title,omitempty"`
}

type Substitution

type Substitution struct {
	Index  int    `json:"index"`
	ASIN   string `json:"asin"`
	Title  string `json:"title"`
	Policy string `json:"policy"`
}

type SubstitutionChange

type SubstitutionChange struct {
	OK   bool         `json:"ok"`
	Item Substitution `json:"item"`
}

type Substitutions

type Substitutions struct {
	Items []Substitution `json:"items"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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