Versions in this module Expand all Collapse all v0 v0.1.2 Oct 26, 2026 Changes in this version + const DefaultAPIKey + const DefaultBaseURL + const DefaultRefreshURL + const DefaultUserAgent + const KindOnline + const KindStore + const PurchaseOnline + const PurchaseStore + var ErrBlocked = errors.New("target blocked the request (bot protection)") + var ErrNotAuthenticated = errors.New("target auth check failed") + var ErrNotFound = errors.New("target: not found") + func CleanText(s string) string + func IsCardTender(paymentType, subType string) bool + func IsReceiptID(id string) bool + func ParseTime(s string) time.Time + func SaveSession(path string, s *Session) error + func SessionPath(dir, account string) (string, error) + type Charge struct + CardCharged float64 + ChargedAt string + Date string + InvoiceID string + Lines []ChargeLine + Payments []Payment + Total float64 + type ChargeLine struct + Amount float64 + Fee bool + Name string + Quantity float64 + TCIN string + type Client struct + func NewClient(session *Session, opts ...ClientOption) *Client + func Open(path string, opts ...ClientOption) (*Client, error) + func (c *Client) Check(ctx context.Context, rawURL string) error + func (c *Client) EnsureFresh(ctx context.Context, minLeft time.Duration) (bool, error) + func (c *Client) Get(ctx context.Context, target string) (json.RawMessage, error) + func (c *Client) Invoice(ctx context.Context, orderNumber, invoiceID string) (*Invoice, error) + func (c *Client) Invoices(ctx context.Context, orderNumber string) (*InvoiceList, error) + func (c *Client) OnlineOrder(ctx context.Context, orderNumber string) (*OnlineOrder, error) + func (c *Client) OrderHistory(ctx context.Context, purchaseType string, page, pageSize int) (*OrderHistoryResponse, error) + func (c *Client) Purchase(ctx context.Context, id string) (*Purchase, error) + func (c *Client) Refresh(ctx context.Context) error + func (c *Client) Session() *Session + func (c *Client) StoreOrder(ctx context.Context, receiptID string) (*StoreOrder, error) + func (c *Client) Summaries(ctx context.Context, opts ListOptions) ([]Summary, bool, error) + type ClientOption func(*Client) + func WithBaseURL(u string) ClientOption + func WithDumpDir(dir string) ClientOption + func WithHTTPClient(h *http.Client) ClientOption + func WithLogger(l *slog.Logger) ClientOption + func WithPacing(minInterval, jitter time.Duration) ClientOption + func WithRefreshURL(u string) ClientOption + type HistoryLister interface + OrderHistory func(ctx context.Context, purchaseType string, page, pageSize int) (*OrderHistoryResponse, error) + type Invoice struct + Date string + ID string + Lines []InvoiceLine + Payments []InvoicePayment + TotalAmount Money + Type string + type InvoiceLine struct + EffectiveAmount Money + Item Item + OrderLineKey string + Quantity float64 + TotalTax Money + UnitPrice Money + type InvoiceList struct + Invoices []InvoiceSummary + func (l *InvoiceList) Charges() []InvoiceSummary + type InvoicePayment struct + SubType string + SubTypeValue string + TotalCharged Money + Type string + func (p InvoicePayment) IsCard() bool + type InvoiceSummary struct + Amount Money + Date string + ID string + Type string + type Item struct + Description string + ListPrice Money + ProductClassification ProductClassification + TCIN string + UnitPrice Money + func (i Item) Name() string + type ListOptions struct + Kinds []string + MaxPages int + Since time.Time + Until time.Time + type Money float64 + func (m *Money) UnmarshalJSON(data []byte) error + type OnlineOrder struct + OrderDate string + OrderNumber string + OrderType string + Packages []Package + Payments []PaymentTransaction + Summary Totals + func (o *OnlineOrder) Lines() []OrderLine + type OrderHistoryResponse struct + Orders []OrderSummary + TotalOrders int + TotalPages int + type OrderLine struct + Item Item + LineNumber int + OrderLineKey string + OriginalQuantity float64 + Quantity *float64 + func (l OrderLine) Qty() float64 + type OrderSummary struct + OrderDate string + OrderLines []OrderLine + OrderNumber string + OrderPurchaseType string + OrderType string + Packages []Package + PlacedDate string + StoreID string + StoreReceiptID string + Summary Totals + func HistorySince(ctx context.Context, l HistoryLister, purchaseType string, since time.Time, ...) (orders []OrderSummary, complete bool, err error) + func (s OrderSummary) Date() string + func (s OrderSummary) ID() string + func (s OrderSummary) Lines() []OrderLine + type Package struct + Fulfillment struct{ ... } + GroupingMetadata struct{ ... } + OrderLines []OrderLine + func (p Package) Cancelled() bool + type Payment struct + Amount float64 + Card bool + Name string + SubType string + Type string + type PaymentTransaction struct + Amount Money + DisplayType string + PaymentSubType string + PaymentSubtype string + PaymentType string + SubTypeValue string + func (p PaymentTransaction) DisplayName() string + func (p PaymentTransaction) IsCard() bool + func (p PaymentTransaction) SubType() string + type ProductClassification struct + ProductSubtypeName string + ProductTypeName string + type Purchase struct + CardCharged float64 + Charges []Charge + Date string + ID string + Items []PurchaseItem + Kind string + Payments []Payment + PlacedAt string + StoreID string + Subtotal float64 + Tax float64 + Total float64 + func PurchaseFromOnline(o *OnlineOrder, invoices []*Invoice) *Purchase + func PurchaseFromStore(s *StoreOrder) *Purchase + type PurchaseItem struct + Name string + Price float64 + ProductSubtype string + ProductType string + Quantity float64 + TCIN string + UnitPrice float64 + type Session struct + APIKey string + Cookie string + Headers map[string]string + RefreshedAt time.Time + SavedAt time.Time + SourceURL string + func LoadSession(path string) (*Session, error) + func ParseSession(raw string, now time.Time) (*Session, error) + func (s *Session) AccessTokenExpiry() (time.Time, bool) + func (s *Session) Account() string + func (s *Session) SignedIn() bool + type StoreOrder struct + GrandTotal Money + OrderLines []OrderLine + OrderPurchaseDate string + OrderType string + PaymentTransactions []PaymentTransaction + StoreID string + StoreReceiptID string + Summary Totals + type Summary struct + Date string + ID string + Items []SummaryItem + Kind string + OrderType string + PlacedAt string + Total float64 + func SummaryOf(s OrderSummary) Summary + type SummaryItem struct + Name string + Quantity float64 + TCIN string + type Totals struct + GrandTotal Money + TotalProductPrice Money + TotalTaxes Money