Code Monkey home page Code Monkey logo

amazing's Introduction

Go Client for the Amazon Product API

A golang client for the amazon product api. This is very much WIP but it's still quite usable for simple tasks such as lookup and search. Handles annoying things such as signature signing and xml -> struct mapping.

MIT license.

Install

go get github.com/dominicphillips/amazing

Configuration

Initialize a client with your ServiceDomain, AssociateTag, AWSAccessKeyId & AWSSecretKey. Service Domain may be one of the following:

CA
CN
DE
ES
FR
IT
JP
UK
US

client, err := amazing.NewAmazing("DE", "tag", "access", "secret")

Or from environment variables (recommended)

export AMAZING_ASSOCIATE_TAG=
export AMAZING_ACCESS_KEY=
export AMAZING_SECRET_KEY=

----------

client, err := amazing.NewAmazingFromEnv("DE")

Currently these operations are supported:

ItemLookup
result, err := client.ItemLookup(params)

ItemSearch
result, err := client.ItemSearch(params)

SimilarityLookup
result, err := client.SimilarityLookup(params)

Params are of type url.Values, for ItemLookup you would pass them like this:

params := url.Values{
  "IdType":        []string{"ASIN"},
  "ItemId":        []string{"B00BIYAO3K"},
  "Operation":     []string{"ItemLookup"},
}

result, err := client.ItemLookup(params)

Results are defined in response.go, you may also pass in your own structs to the Request() function directly:

client, _ := amazing.NewAmazingFromEnv("DE")

params := url.Values{
    "SearchIndex": []string{"All"},
    "Operation":   []string{"ItemSearch"},
    "Keywords":    []string{"Golang"},
}
type CustomResult struct {
    XMLName          xml.Name `xml:"ItemSearchResponse"`
    OperationRequest AmazonOperationRequest
    AmazonItems      AmazonItems `xml:"Items"`
}
var result CustomResult
err := client.Request(params, &result)

For a quick reference over the various parameters, response groups etc. check the quick reference card.

amazing's People

Contributors

dominicphillips avatar jjhendricks avatar metaprogrammed avatar mndrix avatar artnez avatar mattn avatar bryfry avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.