lightrail-client
Version:
A Javascript and Typescript client for Lightrail
39 lines (38 loc) • 1.7 kB
TypeScript
import * as superagent from "superagent";
import * as contacts from "./contacts";
import * as model from "./model";
import * as params from "./params";
import * as programs from "./programs";
import * as values from "./values";
import * as currencies from "./currencies";
import * as transactions from "./transactions";
import * as webhooks from "./webhooks";
import { LightrailOptions } from "./LightrailOptions";
import { LightrailRequestError } from "./LightrailRequestError";
import { GenerateShopperTokenOptions } from "./GenerateShopperTokenOptions";
export { LightrailOptions, LightrailRequestError, contacts, model, params, programs, values, currencies, transactions, webhooks };
/**
* These values are all configurable from configure().
*/
export declare const configuration: LightrailOptions;
/**
* Configure the Lightrail client.
*/
export declare function configure(options: Partial<LightrailOptions>): void;
/**
* Initiate a new request to the Lightrail server.
*/
export declare function request(method: string, path: string): superagent.Request;
/**
* Generate a shopper token that can be used to make Lightrail calls
* restricted to that particular shopper. The shopper can be defined by the
* contactId, or an empty string for anonymous.
*
* eg: `generateShopperToken("user-12345");`
* eg: `generateShopperToken("user-12345", {validityInSeconds: 43200});`
*
* @param contactId the ID of the contact
* @param options the number of seconds the shopper token will be valid for *OR* a GenerateShopperTokenOptions object
* @returns the shopper token
*/
export declare function generateShopperToken(contactId: string, options?: GenerateShopperTokenOptions): string;