Skip to content

A modularized SDK library for Amazon Selling Partner API (fully typed in TypeScript)

License

Notifications You must be signed in to change notification settings

bizon/selling-partner-api-sdk

Repository files navigation

selling-partner-api-sdk

A modularized SDK library for Amazon Selling Partner API (fully typed in TypeScript)

codecov XO code style

Bizon

CI

Codegen Tests Release

Documentation

To learn more about the Selling Partner API, visit the official Amazon documentation.
Also, see the generated documentation for each API client.

Features

This SDK supports the following features:

  • Installing only the API clients you need, versioned independently.
  • Passing client configuration through environment variables.
  • Retrying rate-limited requests by respecting the documented rate-limts and possibly provided headers.
  • Logging (non-auth) API requests, responses and errors.
  • Passing restricted data tokens to API clients.

Packages

  • auth: Authentication helpers for the Selling Partner API.
  • common: Common utilities for the SDK.
  • schemas: JSON schemas and TypeScript types for notifications, reports and feeds.

Clients

This repository contains an API client for each of the available Selling Partner API version:

The API clients are automatically generated from the Swagger/OpenAPI models from the official models repository. A code generation workflow runs twice a day and will create a PR on this repository whenever there are changes to the models.

Schemas

The SDK exposes notifications, reports and feeds schemas through @sp-api-sdk/schemas.
It exposes the JSON schemas as well as typescript types.

For example, if you need the JSON schema for Vendor inventory reports:

import { Reports } from "@sp-api-sdk/schemas";

console.log(Reports.vendorInventoryReport);

If you need the typescript type:

import { Reports } from "@sp-api-sdk/schemas";

const report = (await getVendorInventoryReportData()) as Reports.VendorInventoryReport;

Code generation

To see the code generation process, see the codegen module.

Some of the source Open API models are invalid (see the issues and PRs on the Amazon repository), so this SDK defines some patches to account for those errors.

Each patch files are JSON Patches operations (1 logical change per file).

Active patches

You can browse all the active patches in the patches directory.

License

MIT

Miscellaneous

    ╚⊙ ⊙╝
  ╚═(███)═╝
 ╚═(███)═╝
╚═(███)═╝
 ╚═(███)═╝
  ╚═(███)═╝
   ╚═(███)═╝