Documentation
¶
Index ¶
- type BCClient
- func (s *BCClient) BuildUrlRequest(endpoint string) (req *http.Request, err error)
- func (s *BCClient) DoRequest(req *http.Request) ([]byte, error)
- func (s *BCClient) GetAndUnmarshal(endpoint string, outData interface{}) error
- func (s *BCClient) GetAndUnmarshalRaw(fullEndpoint string, outData interface{}) error
- func (s *BCClient) GetAndUnmarshalWithQuery(endpoint string, rawQuery string, outData interface{}) error
- func (s *BCClient) GetBody(url string) (body []byte, err error)
- func (s *BCClient) SetBaseURL(url string)
- type Client
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BCClient ¶
type BCClient struct {
AuthToken string
AuthClient string
StoreKey string
BaseURL string
Limit int
}
BCClient represents the client wrapper containing BC specific connection details
func NewClient ¶
NewClient create a new client wrapper based on BC connection details, default result limit is set to 50
func (*BCClient) BuildUrlRequest ¶ added in v0.3.4
BuildUrl - gets the golang request out of the endpoint (e.g. /v2/orders/) needed for sending to the BC api
func (*BCClient) DoRequest ¶
DoRequest will call out to bigcommerce API for the passed in request, this is mostly used internal to the package but can be used to expand on the library
func (*BCClient) GetAndUnmarshal ¶ added in v0.3.4
GetAndUnmarshal - gets the request body of a plain url and unmarshals to passed in struct pointer
Example of the endpoint parameter would be "/v2/orders/" and the client will handle the store key and base url pieces
func (*BCClient) GetAndUnmarshalRaw ¶ added in v0.5.0
GetAndUnmarshalRaw - gets the request body of a full plain bigcommerce url and unmarshals to passed in struct pointer
Example of the fullEndpoint parameter would be "https://api.bigcommerce.com/stores/{{YOUR-STORE-KEY}}/v2/orders/12039/products" the client will not manipulate the endpoint in any way. This function is used by things like Resource.EagerGet
func (*BCClient) GetAndUnmarshalWithQuery ¶ added in v0.3.4
func (s *BCClient) GetAndUnmarshalWithQuery(endpoint string, rawQuery string, outData interface{}) error
GetAndUnmarshalWithQuery - gets the request body of the url with a query string added on and unmarshals to passed in struct pointer
Example of the endpoint parameter would be "/v2/orders/count/" and the client will handle the store key and base url pieces
func (*BCClient) SetBaseURL ¶
SetBaseURL will override the default (https://api.bigcommerce.com/stores/) base url of the client to the string passed in
type Client ¶ added in v0.5.0
type Client interface {
SetBaseURL(url string)
DoRequest(req *http.Request) ([]byte, error)
GetBody(url string) (body []byte, err error)
BuildUrlRequest(endpoint string) (req *http.Request, err error)
GetAndUnmarshal(endpoint string, outData interface{}) error
GetAndUnmarshalRaw(fullEndpoint string, outData interface{}) error
GetAndUnmarshalWithQuery(endpoint string, rawQuery string, outData interface{}) error
}