Documentation
¶
Index ¶
- Constants
- func CheckResponseError(res *http.Response) error
- func NewResponseDecodingError(res *http.Response, err error, data []byte) error
- type Client
- func (c *Client) APIVersion() string
- func (c *Client) BaseURL() (*url.URL, error)
- func (c *Client) Count(ctx context.Context, path string, options interface{}) (int, error)
- func (c *Client) CreateAndDo(ctx context.Context, method, path string, body, options interface{}) (*http.Response, error)
- func (c *Client) Debugf(format string, v ...interface{})
- func (c *Client) Delete(ctx context.Context, path string) (*http.Response, error)
- func (c *Client) Deserialize(res *http.Response, resource interface{}) error
- func (c *Client) Do(req *http.Request) (res *http.Response, err error)
- func (c *Client) Errorf(format string, v ...interface{})
- func (c *Client) Get(ctx context.Context, path string, options interface{}) (*http.Response, error)
- func (c *Client) Infof(format string, v ...interface{})
- func (c *Client) Logf(level log.Level, format string, v ...interface{})
- func (c *Client) NewRequest(ctx context.Context, method, path string, body, options interface{}) (*http.Request, error)
- func (c *Client) Paginate(ctx context.Context, element string, options interface{}) (<-chan PaginationResult, error)
- func (c *Client) Path(relPath string) string
- func (c *Client) Post(ctx context.Context, path string, body interface{}) (*http.Response, error)
- func (c *Client) Put(ctx context.Context, path string, body interface{}) (*http.Response, error)
- func (c *Client) RetryCount() int
- func (c *Client) RetryDelay() time.Duration
- func (c *Client) RetryJitter() time.Duration
- func (c *Client) StoreID() string
- func (c *Client) Tracef(format string, v ...interface{})
- func (c *Client) UserAgent() string
- func (c *Client) Warnf(format string, v ...interface{})
- type CountOptions
- type ListOptions
- type Option
- func WithAPIVersion(apiVersion string) Option
- func WithHTTPTimeout(httpTimeout time.Duration) Option
- func WithLogger(logger log.Logger) Option
- func WithRetryCount(retryCount int) Option
- func WithRetryDelay(retryDelay time.Duration) Option
- func WithRetryJitter(retryJitter time.Duration) Option
- func WithUserAgent(userAgent string) Option
- type PaginationResult
- type RateLimitError
- type RateLimitInfo
- type ResponseDecodingError
- type ResponseError
Constants ¶
View Source
const ( DefaultAPIVersion = "2020-04" DefaultUserAgent = "shop/1.0.0" DefaultHTTPTimeout = 5 * time.Minute DefaultRetryCount = 10 DefaultRetryDelay = 100 * time.Millisecond DefaultRetryJitter = 100 * time.Millisecond )
Variables ¶
This section is empty.
Functions ¶
func CheckResponseError ¶
Types ¶
type Client ¶
func (*Client) APIVersion ¶
func (*Client) CreateAndDo ¶
func (*Client) Deserialize ¶
func (*Client) NewRequest ¶
func (*Client) RetryCount ¶
func (*Client) RetryDelay ¶
func (*Client) RetryJitter ¶
type CountOptions ¶
type CountOptions struct { CreatedAtMin time.Time `url:"created_at_min,omitempty"` CreatedAtMax time.Time `url:"created_at_max,omitempty"` UpdatedAtMin time.Time `url:"updated_at_min,omitempty"` UpdatedAtMax time.Time `url:"updated_at_max,omitempty"` }
General count options that can be used for most collection counts.
type ListOptions ¶
type ListOptions struct { // PageInfo is used with new pagination search. PageInfo string `url:"page_info,omitempty"` // Page is used to specify a specific page to load. // It is the deprecated way to do pagination. Page int `url:"page,omitempty"` Limit int `url:"limit,omitempty"` SinceID int64 `url:"since_id,omitempty"` CreatedAtMin time.Time `url:"created_at_min,omitempty"` CreatedAtMax time.Time `url:"created_at_max,omitempty"` UpdatedAtMin time.Time `url:"updated_at_min,omitempty"` UpdatedAtMax time.Time `url:"updated_at_max,omitempty"` Order string `url:"order,omitempty"` Fields string `url:"fields,omitempty"` Vendor string `url:"vendor,omitempty"` IDs []int64 `url:"ids,omitempty,comma"` }
General list options that can be used for most collections of entities.
type Option ¶
type Option func(c *Client)
func WithAPIVersion ¶
func WithHTTPTimeout ¶
func WithLogger ¶
func WithRetryCount ¶
func WithRetryDelay ¶
func WithRetryJitter ¶
func WithUserAgent ¶
type PaginationResult ¶
type PaginationResult struct {
// contains filtered or unexported fields
}
func (PaginationResult) Err ¶
func (r PaginationResult) Err() error
func (PaginationResult) Item ¶
func (r PaginationResult) Item() *data.Item
type RateLimitError ¶
type RateLimitError struct { ResponseError RetryAfter time.Duration }
type RateLimitInfo ¶
type ResponseDecodingError ¶
type ResponseDecodingError struct { ResponseError Body []byte }
type ResponseError ¶
func (ResponseError) Error ¶
func (e ResponseError) Error() string
Click to show internal directories.
Click to hide internal directories.