npm.io
0.1.1 • Published 3 months ago

eshop-os-sdk

Licence
MIT
Version
0.1.1
Deps
0
Size
60 kB
Vulns
0
Weekly
0

eshop-os-sdk

TypeScript SDK for the eshopOS public API.

This package is published on npm and maintained by the eshopOS team.

Docs: https://docs.dukalinks.co.ke

Install

bun install

Then in your app workspace:

bun add eshop-os-sdk

Or install it directly from npm:

npm install eshop-os-sdk

For preview builds that track the latest canary release, install the next channel:

npm install eshop-os-sdk@next

Usage

import { EshopOSPublicClient } from 'eshop-os-sdk';

const client = new EshopOSPublicClient({
  baseUrl: 'http://localhost:8080',
  apiKey: process.env.ESHOPOS_PUBLISHABLE_KEY,
  mode: 'test',
});

const countries = await client.listSupportedPaymentCountries();

Auth

You can pass one of:

  • apiKey for key-based integrations (pk, sk, ck)
  • accessToken for OAuth app integrations (eshopos_oat_...)

Do not pass both in one client instance.

SDK sends these headers automatically:

  • Authorization: Bearer <token>
  • X-EshopOS-Mode: test|live (if mode is provided or inferred)

Key Prefixes

  • publishable: eshopos_test_pk_... / eshopos_live_pk_...
  • secret: eshopos_test_sk_... / eshopos_live_sk_...
  • system(client): eshopos_test_ck_... / eshopos_live_ck_...
  • oauth access token: eshopos_oat_...

Generation

OpenAPI operation metadata is generated from openapi/public-v1.yaml:

bun run sdk:generate

Errors

Non-2xx responses throw PublicApiError with:

  • status
  • code
  • requestId
  • details

License

This package is released under MIT.

Keywords