@poweredbysous/storefront-sdk
v3.7.2
Published
Type-safe TypeScript SDK for SOUS Storefront Backend
Readme
@poweredbysous/storefront-sdk
Type-safe TypeScript SDK for storefront-facing Storefront Backend endpoints (/api/v1) generated from OpenAPI.
Install
npm install @poweredbysous/storefront-sdkpnpm add @poweredbysous/storefront-sdkyarn add @poweredbysous/storefront-sdkUsage
import { createStorefrontClient } from "@poweredbysous/storefront-sdk";
const client = createStorefrontClient({
baseUrl: "https://api.example.com",
vendorId: "BRASSERIE_VD_01",
language: "nl",
});
const response = await client.GET("/api/v1/products/");language sets the Accept-Language request header and, by default, appends
?lang=<language> to GET/HEAD/OPTIONS requests when lang is missing.
Disable query injection with appendLanguageQuery: false.
Error Handling
sdkErrorFromResponse(response) returns SDKError with:
statusHTTP status codecodemachine-readable API error code (when present)retryableretry hint based on status/coderequestIdcorrelation ID fromrequest_id(when present)
Development
npm ci
npm run generate
npm run test
npm run buildGenerated types live in src/generated/schema.ts.
