amazonpa

package module
v0.0.0-...-5b61d1c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2016 License: MIT Imports: 12 Imported by: 0

README

Amazon PA

A Go lang library to interact with Amazon Product Advertising API.

Documentation

Index

Constants

View Source
const EndpointURI = "/onca/xml"

EndpointURI is the fixed request URI of the API

Variables

View Source
var Endpoints = map[string]string{
	"BR": "webservices.amazon.com.br",
	"CA": "webservices.amazon.ca",
	"CN": "webservices.amazon.cn",
	"DE": "webservices.amazon.de",
	"ES": "webservices.amazon.es",
	"FR": "webservices.amazon.fr",
	"IN": "webservices.amazon.in",
	"IT": "webservices.amazon.it",
	"JP": "webservices.amazon.co.jp",
	"MX": "webservices.amazon.com.mx",
	"UK": "webservices.amazon.co.uk",
	"US": "webservices.amazon.com",
}

Endpoints are the Amazon API endpoints by region

Functions

This section is empty.

Types

type Argument

type Argument struct {
	Name  string `xml:"Name,attr"`
	Value string `xml:"Value,attr"`
}

Argument todo

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides the functions to interact with the API

func NewClient

func NewClient(config Config) *Client

NewClient returns a new Client

func (Client) ItemLookup

func (client Client) ItemLookup(query ItemLookupQuery) (*ItemLookupResponse, error)

ItemLookup performs an ItemLookup request

func (Client) ItemLookupByKeyword

func (client Client) ItemLookupByKeyword(keywords []string) (*ItemLookupResponse, error)

ItemLookup performs an ItemLookup request

func (Client) NewRequest

func (client Client) NewRequest(operation string) *Request

NewRequest returns a request with basic parameters

func (Client) ProcessRequest

func (client Client) ProcessRequest(request *Request) ([]byte, error)

ProcessRequest takes a request and queries the API

func (Client) SignRequest

func (client Client) SignRequest(request *Request)

SignRequest produces the signature for the given query string

type Config

type Config struct {
	AccessKey    string
	AccessSecret string
	AssociateTag string
	Region       string
	Secure       bool
}

Config describes the service configuration

type Image

type Image struct {
	XMLName xml.Name `xml:"MediumImage"`
	URL     string
	Height  uint16
	Width   uint16
}

Image todo

type Item

type Item struct {
	ASIN           string
	URL            string
	DetailPageURL  string
	ItemAttributes ItemAttributes
	OfferSummary   OfferSummary
	Offers         Offers
}

Item represents a product returned by the API

type ItemAttributes

type ItemAttributes struct {
	Brand           string
	Creator         string
	Title           string
	ListPrice       Price
	Manufacturer    string
	Publisher       string
	NumberOfItems   int
	PackageQuantity int
	Feature         string
	Model           string
	ProductGroup    string
	ReleaseDate     string
	Studio          string
	Warranty        string
	Size            string
	UPC             string
}

ItemAttributes response group

type ItemLookupQuery

type ItemLookupQuery struct {
	ItemIDs        []string
	IDType         string
	MerchantID     string
	ResponseGroups []string
}

ItemLookupQuery describes the allowed parameters for a ItemLookup request

type ItemLookupRequest

type ItemLookupRequest struct {
	IDType         string   `xml:"IdType"`
	ItemID         string   `xml:"ItemId"`
	ResponseGroups []string `xml:"ResponseGroup"`
	VariationPage  string
}

ItemLookupRequest is the confirmation of a ItemLookup request

type ItemLookupResponse

type ItemLookupResponse struct {
	Response
	Items struct {
		Request struct {
			IsValid           bool
			ItemLookupRequest ItemLookupRequest
		}
		Items []Item `xml:"Item"`
	}
}

ItemLookupResponse describes the API response for the ItemLookup operation

type Offer

type Offer struct {
	Condition       string `xml:"OfferAttributes>Condition"`
	ID              string `xml:"OfferListing>OfferListingId"`
	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
	LowerUsedPrice   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

type Price

type Price struct {
	Amount         uint
	CurrencyCode   string
	FormattedPrice string
}

Price describes the product price as Amount of cents in CurrencyCode

type Request

type Request struct {
	// contains filtered or unexported fields
}

Request represents an API request

func (Request) Parameters

func (request Request) Parameters() map[string]string

Parameters returns the request parameters

func (Request) QueryString

func (request Request) QueryString() string

QueryString returns the query string of the request

func (Request) SetParameter

func (request Request) SetParameter(key string, value string)

SetParameter adds a parameter to the request

func (Request) SignedURL

func (request Request) SignedURL() (string, error)

SignedURL returns the full signed request URL

func (Request) URL

func (request Request) URL() string

URL gives the complete URL of the request without the signature

type Response

type Response struct {
	OperationRequest struct {
		RequestID             string     `xml:"RequestId"`
		Arguments             []Argument `xml:"Arguments>Argument"`
		RequestProcessingTime float64
	}
}

Response describes the generic API Response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL