@basetime/a2w-api-ts
Version:
Client library that communicates with the addtowallet API.
29 lines (28 loc) • 1.07 kB
TypeScript
import { Requester } from '../http/Requester';
import { BarcodeRenderInput } from '../types/Barcode';
import Endpoint from './Endpoint';
/**
* Communicate with the `/barcodes` endpoint.
*
* Accessed via `client.barcodes`. The barcode route lives outside `/api/v1`, so this
* endpoint is constructed with `{ siteRoot: true }` — the inherited `this.do` builds
* absolute URLs against the requester's current site base URL.
*/
export default class BarcodesEndpoint extends Endpoint {
/**
* Constructor.
*
* @param req The object to use to make requests.
*/
constructor(req: Requester);
/**
* Renders a barcode and returns the PNG body as a string.
*
* The body is returned via `Response.text()` to match the SDK's existing pkpass
* download convention. Consumers that need the binary buffer should call the URL
* directly via `client.http.fetch(...)` with a custom `Accept` header.
*
* @param input The barcode render input.
*/
render: (input: BarcodeRenderInput) => Promise<string>;
}