lightrail-client
Version:
A Javascript and Typescript client for Lightrail
60 lines (59 loc) • 2.01 kB
TypeScript
import { CreateCurrencyParams, CreateCurrencyResponse, DeleteCurrencyResponse, GetCurrencyResponse, ListCurrenciesResponse, UpdateCurrencyParams, UpdateCurrencyResponse } from "./params";
import { Currency } from "./model/Currency";
/**
* See: https://apidocs.lightrail.com/#operation/CreateCurrency
*
* Example:
* ```js
* const currency = await Lightrail.currencies.createCurrency({
* code: "USD",
* symbol: "$",
* name: "US Dollar",
* decimalPlaces: 2
* });
* ```
*/
export declare function createCurrency(params: CreateCurrencyParams): Promise<CreateCurrencyResponse>;
/**
* See: https://apidocs.lightrail.com/#operation/ListCurrencies
*
* Example:
* ```js
* const currencies = await Lightrail.currencies.listCurrencies();
* ```
*/
export declare function listCurrencies(): Promise<ListCurrenciesResponse>;
/**
* See: https://apidocs.lightrail.com/#operation/GetCurrency
*
* Example:
* ```js
* const usd = await Lightrail.currencies.getCurrency("USD");
* ```
*/
export declare function getCurrency(currency: string | Currency): Promise<GetCurrencyResponse>;
/**
* See: https://apidocs.lightrail.com/#operation/UpdateCurrency
*
* Example:
* ```js
* const updatedUsd = await Lightrail.currencies.updateCurrency("USD", {name: "Freedom Dollars"});
* ```
*/
export declare function updateCurrency(currency: string | Currency, params: UpdateCurrencyParams): Promise<UpdateCurrencyResponse>;
/**
* See: https://apidocs.lightrail.com/#operation/DeleteCurrency
*
* This will only be possible if the currency has not been used because
* Transactions cannot be deleted and Transactions must have a valid currency.
*
* Example:
* ```js
* await Lightrail.currencies.deleteCurrency("USD");
* ```
*/
export declare function deleteCurrency(currency: string | Currency): Promise<DeleteCurrencyResponse>;
/**
* Get currency code from the string (as the ID itself) or Currency object.
*/
export declare function getCurrencyCode(currency: string | Currency): string;