Documentation
¶
Overview ¶
Package amazonproduct provides methods for interacting with the Amazon Product Advertising API
Index ¶
- func GenerateAmazonUrl(api AmazonProductAPI, Operation string, Parameters map[string]string) (finalUrl *url.URL, err error)
- func SetTimestamp(origUrl *url.URL) (err error)
- func SignAmazonUrl(origUrl *url.URL, api AmazonProductAPI) (signedUrl string, err error)
- type AWSResponse
- type AmazonProductAPI
- func (api AmazonProductAPI) BrowseNodeLookup(nodeId string) (string, error)
- func (api AmazonProductAPI) BrowseNodeLookupWithResponseGroup(nodeId string, responseGroup string) (string, error)
- func (api AmazonProductAPI) CartAdd(items map[string]int, cartid, HMAC string) (string, error)
- func (api AmazonProductAPI) CartClear(CartId, HMAC string) (string, error)
- func (api AmazonProductAPI) CartCreate(items map[string]int) (string, error)
- func (api AmazonProductAPI) CartGet(CartId, HMAC string) (string, error)
- func (api AmazonProductAPI) ItemLookup(ItemId string) (string, error)
- func (api AmazonProductAPI) ItemLookupWithParams(params map[string]string) (string, error)
- func (api AmazonProductAPI) ItemLookupWithResponseGroup(ItemId string, ResponseGroup string) (string, error)
- func (api AmazonProductAPI) ItemSearch(SearchIndex string, Parameters map[string]string) (string, error)
- func (api AmazonProductAPI) ItemSearchByKeyword(Keywords string, page int) (string, error)
- func (api AmazonProductAPI) ItemSearchByKeywordWithResponseGroup(Keywords string, ResponseGroup string) (string, error)
- func (api AmazonProductAPI) MultipleItemLookup(ItemIds []string) (string, error)
- func (api AmazonProductAPI) MultipleItemLookupWithResponseGroup(ItemIds []string, ResponseGroup string) (string, error)
- type Argument
- type BrowseNode
- type BrowseNodeLookupRequest
- type BrowseNodeLookupResponse
- type Creator
- type EditorialReview
- type EditorialReviews
- type Image
- type ImageSet
- type ImageSets
- type Item
- type ItemAttributes
- type ItemLookupRequest
- type ItemLookupResponse
- type ItemSearchRequest
- type ItemSearchResponse
- type Offer
- type OfferSummary
- type Offers
- type Price
- type TopSeller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateAmazonUrl ¶
func SetTimestamp ¶
func SignAmazonUrl ¶
func SignAmazonUrl(origUrl *url.URL, api AmazonProductAPI) (signedUrl string, err error)
Types ¶
type AWSResponse ¶
type AWSResponse struct {
OperationRequest struct {
RequestID string `xml:"RequestId"`
Arguments []Argument `xml:"Arguments>Argument"`
RequestProcessingTime float64
}
}
Response describes the generic API Response
type AmazonProductAPI ¶
type AmazonProductAPI struct {
AccessKey string
SecretKey string
AssociateTag string
Host string
Client *http.Client
}
func (AmazonProductAPI) BrowseNodeLookup ¶
func (api AmazonProductAPI) BrowseNodeLookup(nodeId string) (string, error)
BrowseNodeLookup takes a BrowseNodeId and returns the result.
func (AmazonProductAPI) BrowseNodeLookupWithResponseGroup ¶
func (api AmazonProductAPI) BrowseNodeLookupWithResponseGroup(nodeId string, responseGroup string) (string, error)
func (AmazonProductAPI) CartAdd ¶
CartAdd takes a map containing ASINs and quantities and adds them to the given cart. Up to 10 items are allowed
func (AmazonProductAPI) CartClear ¶
func (api AmazonProductAPI) CartClear(CartId, HMAC string) (string, error)
CartClear takes a CartId and HMAC that were returned when generating a cart It then removes the contents of the cart
func (AmazonProductAPI) CartCreate ¶
func (api AmazonProductAPI) CartCreate(items map[string]int) (string, error)
CartCreate takes a map containing ASINs and quantities. Up to 10 items are allowed
func (AmazonProductAPI) CartGet ¶
func (api AmazonProductAPI) CartGet(CartId, HMAC string) (string, error)
Cart get takes a CartID and HMAC that were returned when generating a cart Returns the contents of the specified cart
func (AmazonProductAPI) ItemLookup ¶
func (api AmazonProductAPI) ItemLookup(ItemId string) (string, error)
ItemLookup takes a product ID (ASIN) and returns the result
func (AmazonProductAPI) ItemLookupWithParams ¶
func (api AmazonProductAPI) ItemLookupWithParams(params map[string]string) (string, error)
ItemLookupWithParams takes the params for ItemLookup and returns the result
func (AmazonProductAPI) ItemLookupWithResponseGroup ¶
func (api AmazonProductAPI) ItemLookupWithResponseGroup(ItemId string, ResponseGroup string) (string, error)
ItemLookupWithResponseGroup takes a product ID (ASIN) and a ResponseGroup and returns the result
func (AmazonProductAPI) ItemSearch ¶
func (AmazonProductAPI) ItemSearchByKeyword ¶
func (api AmazonProductAPI) ItemSearchByKeyword(Keywords string, page int) (string, error)
ItemSearchByKeyword takes a string containing keywords and returns the search results
func (AmazonProductAPI) ItemSearchByKeywordWithResponseGroup ¶
func (api AmazonProductAPI) ItemSearchByKeywordWithResponseGroup(Keywords string, ResponseGroup string) (string, error)
func (AmazonProductAPI) MultipleItemLookup ¶
func (api AmazonProductAPI) MultipleItemLookup(ItemIds []string) (string, error)
MultipleItemLookup takes an array of product IDs (ASIN) and returns the result
func (AmazonProductAPI) MultipleItemLookupWithResponseGroup ¶
func (api AmazonProductAPI) MultipleItemLookupWithResponseGroup(ItemIds []string, ResponseGroup string) (string, error)
MultipleItemLookupWithResponseGroup takes an array of product IDs (ASIN) as well as a ResponseGroup and returns the result
type BrowseNode ¶
type BrowseNode struct {
BrowseNodeID string `xml:"BrowseNodeId"`
Name string
TopSellers struct {
TopSeller []TopSeller
}
Ancestors struct {
BrowseNode []BrowseNode
}
}
BrowseNode represents a browse node returned by API
type BrowseNodeLookupRequest ¶
BrowseNodeLookupRequest is the confirmation of a BrowseNodeInfo request
type BrowseNodeLookupResponse ¶
type BrowseNodeLookupResponse struct {
AWSResponse
BrowseNodes struct {
Request struct {
IsValid bool
BrowseNodeLookupRequest BrowseNodeLookupRequest
}
BrowseNode BrowseNode
}
}
type EditorialReview ¶
EditorialReview response attribute
type EditorialReviews ¶
type EditorialReviews struct {
EditorialReview EditorialReview
}
EditorialReviews response group
type Item ¶
type Item struct {
ASIN string
URL string
DetailPageURL string
ItemAttributes *ItemAttributes
OfferSummary OfferSummary
Offers Offers
SalesRank int
SmallImage *Image
MediumImage *Image
LargeImage *Image
ImageSets *ImageSets
EditorialReviews EditorialReviews
BrowseNodes struct {
BrowseNode []BrowseNode
}
}
Item represents a product returned by the API
type ItemAttributes ¶
type ItemAttributes struct {
Author []string
Binding string
Brand string
Color string
EAN string
EISBN string
Creator []Creator
Title string
ListPrice Price
Manufacturer string
Publisher string
NumberOfItems int
PackageQuantity int
Feature []string
Model string
ProductGroup string
PublicationDate string
ReleaseDate string
Studio string
Warranty string
Size string
UPC string
}
ItemAttributes response group
type ItemLookupRequest ¶
type ItemLookupRequest struct {
IDType string `xml:"IdType"`
ItemID string `xml:"ItemId"`
ResponseGroup string `xml:"ResponseGroup"`
VariationPage string
}
ItemLookupRequest is the confirmation of a ItemLookup request
type ItemLookupResponse ¶
type ItemLookupResponse struct {
AWSResponse
Items struct {
Request struct {
IsValid bool
ItemLookupRequest ItemLookupRequest
}
Item []Item `xml:"Item"`
}
}
ItemLookupResponse describes the API response for the ItemLookup operation
type ItemSearchRequest ¶
type ItemSearchRequest struct {
Keywords string `xml:"Keywords"`
SearchIndex string `xml:"SearchIndex"`
ResponseGroup string `xml:"ResponseGroup"`
}
ItemSearchRequest is the confirmation of a ItemSearch request
type ItemSearchResponse ¶
type ItemSearchResponse struct {
AWSResponse
Items struct {
Request struct {
IsValid bool
ItemSearchRequest ItemSearchRequest
}
Items []Item `xml:"Item"`
TotalResults int
TotalPages int
MoreSearchResultsUrl string
}
}
type Offer ¶
type Offer struct {
Condition string `xml:"OfferAttributes>Condition"`
ID string `xml:"OfferListing>OfferListingId"`
IsEligibleForPrime bool `xml:"OfferListing>IsEligibleForPrime"`
Price Price `xml:"OfferListing>Price"`
PercentageSaved uint `xml:"OfferListing>PercentageSaved"`
Availability string `xml:"OfferListing>Availability"`
}
Offer response attribute
type OfferSummary ¶
type OfferSummary struct {
LowestNewPrice Price
LowestUsedPrice Price
TotalNew int
TotalUsed int
TotalCollectible int
TotalRefurbished int
}
OfferSummary response group
type Offers ¶
type Offers struct {
TotalOffers int
TotalOfferPages int
MoreOffersURL string `xml:"MoreOffersUrl"`
Offers []Offer `xml:"Offer"`
}
Offers response group