@johnfoderaro/apaw
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "@johnfoderaro/apaw", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Amazon Product Advertising API 5.x Wrapper", | ||
@@ -33,3 +33,3 @@ "main": "index.js", | ||
"eslint": "^6.8.0", | ||
"eslint-config-airbnb-base": "^14.0.0", | ||
"eslint-config-airbnb-base": "^14.1.0", | ||
"eslint-plugin-import": "^2.20.1", | ||
@@ -36,0 +36,0 @@ "jest": "^25.1.0" |
@@ -5,3 +5,3 @@ # Apaw | ||
**Apaw** is a dependency-free Node.js wrapper around the Amazon Product Advertising API (PAAPI). This module handles making signed HTTP requests to version 5 of the Amazon Product Advertising API. For more detailed information on the Amazon Product Advertising API and how to use it, [please read Amazon's documentation](https://webservices.amazon.com/paapi5/documentation/). | ||
**Apaw** is a dependency-free Node.js wrapper around version 5.x of the Amazon Product Advertising API (PAAPI). This module handles making the AWS Signature Version 4 signed HTTP requests for the PAAPI service. For more detailed information on the Amazon Product Advertising API and how to use it, [please read Amazon's documentation](https://webservices.amazon.com/paapi5/documentation/). | ||
@@ -13,2 +13,4 @@ ## Installation | ||
```javascript | ||
const Apaw = require('@johnfoderaro/apaw'); | ||
const apaw = Apaw({ | ||
@@ -43,5 +45,7 @@ host: 'webservices.amazon.com', | ||
## Usage | ||
### Apaw(parameters) | ||
`Apaw(parameters)` accepts an object that must include the following parameters: | ||
### Apaw(parameters).request(operation, payload) | ||
The `Apaw` factory function returns an object with the method `request`. Below is a summary of the required arguments for both functions: | ||
- `parameters` is an object that must include the following: | ||
```javascript | ||
@@ -60,11 +64,28 @@ { | ||
### Apaw(parameters).request(operation, payload) | ||
`Apaw(parameters).request(operation, payload)` is the only method available in the returned object from the instantiated `Apaw` factory function. This method creates and makes the signed HTTP request to the specified operation with the provided payload and returns a Promise. | ||
- `operation` is a case sensitive string that must be a valid operation as outlined by the PAAPI documentation. | ||
- `operation` is a case sensitive string that must be a valid operation. | ||
- `payload` is an object that must contain valid request key/values. | ||
```javascript | ||
'SearchItems' | ||
``` | ||
- `payload` is an object that must contain valid request key/values as outlined by the PAAPI documentation. | ||
```javascript | ||
{ | ||
Keywords: 'Harry', | ||
Marketplace: 'www.amazon.com', | ||
PartnerTag: 'xyz-20', | ||
PartnerType: 'Associates', | ||
Resources: [ | ||
'Images.Primary.Small', | ||
'ItemInfo.Title', | ||
'Offers.Listings.Price', | ||
], | ||
SearchIndex: 'All', | ||
} | ||
``` | ||
For information on `operation` and how to properly create and format the `payload` object, please consult [PAAPI "Operations" documentation](https://webservices.amazon.com/paapi5/documentation/operations.html). | ||
This method Rejects errors emitted by the Node `https` module or Resolves an object with the following shape: | ||
The `request` method Rejects errors emitted by the Node `https` module or Resolves an object with the following shape: | ||
@@ -71,0 +92,0 @@ ```javascript |
20753
101