From 5787bea9ba28afc5d967b43e1aa21ced64790bb7 Mon Sep 17 00:00:00 2001 From: David Ball Date: Mon, 5 Aug 2024 23:33:51 -0400 Subject: [PATCH] Updated README.md to document the current state of the project. --- README.md | 31 ++++++++++++++++++++++--------- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 48be335..009eeef 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,41 @@ # amazon-pa-api-5.0-sdk-node-ts -I downloaded Amazon's Product Advertising API SDK "Example." +I rebuilt Amazon's Product Advertising API SDK for Node.js but for my particular Node.js. -I'm going to rebuild this mess so I can read it and understand it. +In particular I had the following design requirement: -Here's to setting better examples. +- Transpiles with TypeScript to ESNext module (ESM) without errors as a NodeNext module for NodeNext (Node 18 in my case). +- Sample artifacts from API Scratchpad parses in Node.js with TypeScript using the class types. +- Minimal breaking changes to the initial Product Advertising API 5.0. +- I didn't want to touch the HTTP client they used for now. Refactored by [David A. Ball](https://daball.me). # Product Advertising API 5.0 SDK for NodeJS -[![NPM](https://nodei.co/npm/paapi5-nodejs-sdk.svg?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/paapi5-nodejs-sdk/) +[![NPM](https://nodei.co/npm/amazon-pa-api5-node-ts.png)](https://nodei.co/npm/amazon-pa-api5-node-ts/) -[![Version](https://badge.fury.io/js/paapi5-nodejs-sdk.svg)](http://badge.fury.io/js/paapi5-nodejs-sdk) [![npm](https://img.shields.io/npm/dt/paapi5-nodejs-sdk.svg)](https://www.npmjs.com/package/paapi5-nodejs-sdk) +[![npm version](https://badge.fury.io/js/amazon-pa-api5-node-ts.svg)](https://badge.fury.io/js/amazon-pa-api5-node-ts) [![npm](https://img.shields.io/npm/dt/amazon-pa-api5-node-ts.svg)](https://www.npmjs.com/package/amazon-pa-api5-node-ts) -This repository contains the official Product Advertising API 5.0 NodeJS SDK called **paapi5-nodejs-sdk** that allows you to access the [Product Advertising API](https://webservices.amazon.com/paapi5/documentation/index.html) from your NodeJS app. +This repository started with the official Product Advertising API 5.0 NodeJS SDK called **[paapi5-nodejs-sdk](https://www.npmjs.com/package/paapi5-nodejs-sdk)** that allows you to access the [Product Advertising API](https://webservices.amazon.com/paapi5/documentation/index.html) from your NodeJS app. ## Installation ### For [Node.js](https://nodejs.org/) -The Product Advertising API NodeJS SDK can be installed via [npm](https://www.npmjs.com/package/paapi5-nodejs-sdk): +The Product Advertising API NodeJS SDK can be installed via [npm](https://www.npmjs.com/package/amazon-pa-api5-node-ts): ```shell -npm install paapi5-nodejs-sdk --save +npm install amazon-pa-api5-node-ts --save ``` -You should now be able to `require('paapi5-nodejs-sdk')` in javascript files. +You should now be able to `import * as ProductAdvertisingAPIv1 from 'amazon-pa-api5-node-ts'` in TypeScript files. ### For browser +I assume it works in the browser. I have no idea really. I use it on the server. I'm leaving the documentation up from +the original documentation. + The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following the above steps with Node.js and installing browserify with `npm install -g browserify`, perform the following (assuming *main.js* is your entry file, that's to say your javascript file where you actually @@ -43,6 +49,9 @@ Then include *bundle.js* in the HTML pages. ### Webpack Configuration +I assume it works in Webpack. I'm using it with Vite, for instance, with Astro. I have no idea really. I'm leaving the documentation up from +the original documentation. + Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config: @@ -61,6 +70,9 @@ module: { ## Getting Started +This is an old example. I'm sure you won't have trouble getting started since I've made every effort not to break the original API but it works with all the type hinting of TypeScript. I'm leaving the documentation up from +the original documentation. + Please follow the [installation](#installation) instruction and execute the following JS code: Simple example for [SearchItems](https://webservices.amazon.com/paapi5/documentation/search-items.html) to discover Amazon products with the keyword 'Harry Potter' in Books category: @@ -172,4 +184,5 @@ api.searchItems(searchItemsRequest).then( Complete documentation, installation instructions, and examples are available [here](https://webservices.amazon.com/paapi5/documentation/index.html). ## License + This SDK is distributed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), see LICENSE.txt and NOTICE.txt for more information. diff --git a/package-lock.json b/package-lock.json index 329734b..c56b335 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "amazon-pa-api5-node-ts", - "version": "2.2.6", + "version": "2.2.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "amazon-pa-api5-node-ts", - "version": "2.2.6", + "version": "2.2.7", "license": "Apache-2.0", "dependencies": { "superagent": "^9.0.0" diff --git a/package.json b/package.json index 3613e41..b3f399b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "amazon-pa-api5-node-ts", - "version": "2.2.6", + "version": "2.2.7", "description": "ProductAdvertisingAPI 5.0 NodeJS SDK rewritten in TypeScript.", "license": "Apache-2.0", "main": "dist/src/index.mjs",