Documentation ¶
Index ¶
- Variables
- type Bricklink
- type BricklinkOption
- func WithBaseURL(baseURL string) BricklinkOption
- func WithConsumerKey(consumerKey string) BricklinkOption
- func WithConsumerSecret(consumerKey string) BricklinkOption
- func WithEnv(files ...string) BricklinkOption
- func WithHTTPClient(client internal.HTTPClient) BricklinkOption
- func WithOAuthTokenKey(oAuthToken string) BricklinkOption
- func WithOAuthTokenSecret(oAuthToken string) BricklinkOption
- func WithTimeout(timeout time.Duration) BricklinkOption
- type ItemType
Constants ¶
This section is empty.
Variables ¶
var ItemCodeMap = make(map[string]ItemType)
var ItemTypeMap = map[ItemType]string{ ItemTypeMinifig: "minifig", ItemTypePart: "part", ItemTypeSet: "set", ItemTypeBook: "book", ItemTypeCatalog: "catalog", ItemTypeGear: "gear", ItemTypeInstruction: "instruction", ItemTypeOriginalBox: "original_box", ItemTypeUnsortedLot: "unsorted_lot", }
Functions ¶
This section is empty.
Types ¶
type Bricklink ¶
type Bricklink struct { Client internal.HTTPClient Timeout time.Duration Rand *rand.Rand // contains filtered or unexported fields }
Bricklink is a wrapper for the Bricklink API.
func New ¶
func New(opts ...BricklinkOption) (*Bricklink, error)
New creates a new Bricklink API wrapper.
func (*Bricklink) NewRequest ¶
func (b *Bricklink) NewRequest(method string, path string, params map[string]string, body []byte) (*http.Request, error)
NewRequest creates a new HTTP request with auth headers and the specified method and path. The body is optional. If present, it should be sent as an urlencoded strings.NewReader(body).
func (*Bricklink) NewRequestWithContext ¶
func (b *Bricklink) NewRequestWithContext(ctx context.Context, method, path string, params map[string]string, body []byte) (*http.Request, error)
NewRequestWithContext creates a new HTTP request with auth headers and the specified method and path. The body is optional. If present, it should be sent as an urlencoded strings.NewReader(body).
type BricklinkOption ¶
type BricklinkOption func(opts *Bricklink)
func WithBaseURL ¶
func WithBaseURL(baseURL string) BricklinkOption
func WithConsumerKey ¶
func WithConsumerKey(consumerKey string) BricklinkOption
func WithConsumerSecret ¶
func WithConsumerSecret(consumerKey string) BricklinkOption
func WithEnv ¶
func WithEnv(files ...string) BricklinkOption
WithEnv reads the environment variables from the specified files and sets them on the client. If the files are not specified, it will read from .env in the project root. If the expected file is not found, it will do nothing.
func WithHTTPClient ¶
func WithHTTPClient(client internal.HTTPClient) BricklinkOption
func WithOAuthTokenKey ¶
func WithOAuthTokenKey(oAuthToken string) BricklinkOption
func WithOAuthTokenSecret ¶
func WithOAuthTokenSecret(oAuthToken string) BricklinkOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) BricklinkOption