Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. ContextOAuth2 = contextKey("token") // ContextBasicAuth takes BasicAuth as authentication for the request. ContextBasicAuth = contextKey("basic") // ContextAccessToken takes a string oauth2 access token as authentication for the request. ContextAccessToken = contextKey("accesstoken") // ContextAPIKey takes an APIKey as authentication for the request ContextAPIKey = contextKey("apikey") )
Functions ¶
Types ¶
type APIClient ¶
type APIClient struct { CategoryApi *CategoryApiService ProductApi *ProductApiService // contains filtered or unexported fields }
APIClient manages communication with the Keepa API API v1.0.0 In most cases there should be only one, shared, APIClient.
func NewAPIClient ¶
func NewAPIClient(cfg *Configuration) *APIClient
NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.
func (*APIClient) ChangeBasePath ¶
Change base path to allow switching to mocks
type APIKey ¶
APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type APIResponse ¶
type APIResponse struct { *http.Response `json:"-"` Message string `json:"message,omitempty"` // Operation is the name of the OpenAPI operation. Operation string `json:"operation,omitempty"` // RequestURL is the request URL. This value is always available, even if the // embedded *http.Response is nil. RequestURL string `json:"url,omitempty"` // Method is the HTTP method used for the request. This value is always // available, even if the embedded *http.Response is nil. Method string `json:"method,omitempty"` // Payload holds the contents of the response body (which may be nil or empty). // This is provided here as the raw response.Body() reader will have already // been drained. Payload []byte `json:"-"` }
func NewAPIResponse ¶
func NewAPIResponse(r *http.Response) *APIResponse
func NewAPIResponseWithError ¶
func NewAPIResponseWithError(errorMessage string) *APIResponse
type BasicAuth ¶
type BasicAuth struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` }
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
type Category ¶
type Category struct { // Integer value for the Amazon locale you want to access. (1-com, 2-co.uk, 3-de, 4-fr, 5-co.jp, 6-ca, 7-cn, 8-it, 9-es, 10-in, 11-com.mx, 12-com.br, 13-com.au) DomainId int32 `json:"domainId"` // The category node id used by Amazon. Represents the identifier of the category. Also part of the Product object’s categories and rootCategory fields. Always a positive Long value. Note - The id 9223372036854775807 (max signed long value) denotes a blank category with the name “?”. We use this in cases where a product is listed in no or non-existent categories. CatId int32 `json:"catId"` // The name of the category. Name string `json:"name"` // List of all sub categories. null or [] (empty array) if the category has no sub categories. Children []int32 `json:"children"` // The parent category’s Id. Always a positive Long value. If it is 0 the category is a root category and has no parent category. Parent int32 `json:"parent"` // The highest (root category) sales rank we have observed of a product that is listed in this category. Note- Estimate, as the value is from the Keepa product database and not retrieved from Amazon. HighestRank int32 `json:"highestRank"` // Number of products that are listed in this category. Note- Estimate, as the value is from the Keepa product database and not retrieved from Amazon. ProductCount int32 `json:"productCount"` }
type CategoryApiService ¶
type CategoryApiService service
func (*CategoryApiService) Category ¶
func (a *CategoryApiService) Category(ctx context.Context, key string, domain int32, category int32, parents int32) ([]Category, *http.Response, error)
CategoryApiService Returns Amazon category information from Keepa API. Retrieve category objects using their node ids and (optional) their parent tree.
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param key Your private API key.
- @param domain Integer value for the Amazon locale you want to access. (1-com, 2-co.uk, 3-de, 4-fr, 5-co.jp, 6-ca, 7-cn, 8-it, 9-es, 10-in, 11-com.mx, 12-com.br, 13-com.au)
- @param category The category node id of the category you want to request. For batch requests a comma separated list of ids (up to 10, the token cost stays the same). Alternatively you can specify the value 0, which will retrieve a list of all root categories.
- @param parents Whether or not to include the category tree for each category. (1 = include, 0 = do not include.)
@return []Category
type Configuration ¶
type Configuration struct { BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` HTTPClient *http.Client }
func NewConfiguration ¶
func NewConfiguration() *Configuration
func (*Configuration) AddDefaultHeader ¶
func (c *Configuration) AddDefaultHeader(key string, value string)
type GenericOpenAPIError ¶
type GenericOpenAPIError struct {
// contains filtered or unexported fields
}
GenericOpenAPIError Provides access to the body, error and model on returned errors.
func (GenericOpenAPIError) Body ¶
func (e GenericOpenAPIError) Body() []byte
Body returns the raw bytes of the response
func (GenericOpenAPIError) Error ¶
func (e GenericOpenAPIError) Error() string
Error returns non-empty string if there was an error.
func (GenericOpenAPIError) Model ¶
func (e GenericOpenAPIError) Model() interface{}
Model returns the unpacked model of the error
type ProductApiService ¶
type ProductApiService service