forked from ezkl/go-amazon-mws-api
/
amazonmws.go
53 lines (40 loc) · 1.48 KB
/
amazonmws.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// amazonmws provides methods for interacting with the Amazon Marketplace Services API.
package amazonmws
import (
"fmt"
)
/*
GetLowestOfferListingsForASIN takes a list of ASINs and returns the result.
*/
func (api AmazonMWSAPI) GetLowestOfferListingsForASIN(items []string, itemCondition string) (string, error) {
params := make(map[string]string)
for k, v := range items {
key := fmt.Sprintf("ASINList.ASIN.%d", (k + 1))
params[key] = string(v)
}
params["MarketplaceId"] = string(api.MarketplaceId)
params["ItemCondition"] = itemCondition
return api.genSignAndFetch("GetLowestOfferListingsForASIN", "/Products/2011-10-01", params)
}
/*
GetCompetitivePricingForAsin takes a list of ASINs and returns the result.
*/
func (api AmazonMWSAPI) GetCompetitivePricingForASIN(items []string) (string, error) {
params := make(map[string]string)
for k, v := range items {
key := fmt.Sprintf("ASINList.ASIN.%d", (k + 1))
params[key] = string(v)
}
params["MarketplaceId"] = string(api.MarketplaceId)
return api.genSignAndFetch("GetCompetitivePricingForASIN", "/Products/2011-10-01", params)
}
func (api AmazonMWSAPI) GetMatchingProductForId(idType string, idList []string) (string, error) {
params := make(map[string]string)
for k, v := range idList {
key := fmt.Sprintf("IdList.Id.%d", (k + 1))
params[key] = string(v)
}
params["IdType"] = idType
params["MarketplaceId"] = string(api.MarketplaceId)
return api.genSignAndFetch("GetMatchingProductForId", "/Products/2011-10-01", params)
}