Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeHMACKey(key string) string
- func NewInvalidShopError(s string) error
- func NewRequestError(err error) error
- func NewUnexpectedResponseCodeError(code int) error
- type Auction
- type Client
- func (c *Client) BulkSearch(ctx context.Context, shops []Shop, opts SearchOptions) ([]Item, error)
- func (c *Client) FindHMAC(ctx context.Context) error
- func (c *Client) HMACSecret() string
- func (c *Client) Search(ctx context.Context, shop Shop, opts SearchOptions) ([]Item, error)
- func (c *Client) Translate(ctx context.Context, text string) (string, error)
- type ClientOption
- type HMACAttributes
- type HMACInput
- type Item
- type SearchOptions
- type Shop
Constants ¶
View Source
const (
CaesarShift = -3
)
View Source
const (
// DefaultBaseURL is the default base URL for the Sendico API.
DefaultBaseURL = "https://sendico.com"
)
Variables ¶
View Source
var ( ErrRequest = errors.New("sendico request failed") ErrSecretNotFound = errors.New("sendico API secret not found") ErrInvalidShop = errors.New("invalid shop") )
View Source
var ShopMap = map[string]Shop{ YahooAuctions.Identifier(): YahooAuctions, Mercari.Identifier(): Mercari, Rakuma.Identifier(): Rakuma, Rakuten.Identifier(): Rakuten, Yahoo.Identifier(): Yahoo, }
View Source
var Shops = []Shop{ Mercari, Rakuma, Rakuten, YahooAuctions, Yahoo, }
Functions ¶
func DecodeHMACKey ¶ added in v0.4.0
func NewInvalidShopError ¶
func NewRequestError ¶
Types ¶
type Auction ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) BulkSearch ¶
BulkSearch performs a search for the given term on the specified merchants. It will only return the first page of results.
func (*Client) FindHMAC ¶ added in v0.3.0
FindHMAC finds the HMAC secret key used to sign requests to the Sendico API. This is very jank, it will go through the frontend's SSR'd nuxt data and attempt to find the latest hmac secret key(s). This will most likely break at some point in the future.
func (*Client) HMACSecret ¶ added in v0.3.0
HMACSecret returns the HMAC secret key used to sign requests to the Sendico API.
type ClientOption ¶
type ClientOption func(*Client)
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOption
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
type HMACAttributes ¶ added in v0.3.0
func BuildHMAC ¶ added in v0.3.0
func BuildHMAC(in HMACInput) (*HMACAttributes, error)
type HMACInput ¶ added in v0.3.0
type HMACInput struct {
Secret string
Path string
Payload *orderedmap.OrderedMap[string, any]
Timestamp int64
Nonce string
}
type Item ¶
type Item struct {
*Auction
Shop Shop `json:"shop"`
Code string `json:"code"`
Name string `json:"name"`
Category *json.Number `json:"category"`
URL string `json:"url"`
Image string `json:"img"`
PriceYen int `json:"price"`
PriceUSD int `json:"converted_price"`
Labels []string `json:"labels"`
}
func (*Item) SendicoLink ¶
type SearchOptions ¶
type Shop ¶
type Shop int
func ShopsFromBits ¶
func (Shop) Identifier ¶
func (Shop) MarshalJSON ¶
func (*Shop) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.