lightrail-client
Advanced tools
Comparing version 4.5.1 to 4.6.0
import { AttachContactToValueParams, AttachContactToValueResponse, CreateContactParams, CreateContactResponse, DeleteContactResponse, GetContactResponse, ListContactsParams, ListContactsResponse, ListContactsValuesParams, ListContactsValuesResponse, UpdateContactParams, UpdateContactResponse } from "./params"; | ||
import { Contact } from "./model"; | ||
import { DetachContactFromValueParams, DetachContactFromValueResponse } from "./params/contacts/DetachContactFromValueParams"; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/CreateContact | ||
* | ||
* Example: | ||
* ```js | ||
* const contact = await Lightrail.contacts.createContact({ | ||
* id: "abcdefg", | ||
* email: "ex@example.com" | ||
* }); | ||
* ``` | ||
*/ | ||
export declare function createContact(params: CreateContactParams): Promise<CreateContactResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/GetaContact | ||
* | ||
* Example: | ||
* ```js | ||
* const contact = await Lightrail.contacts.getContact("abcdefg"); | ||
* ``` | ||
*/ | ||
export declare function getContact(contact: string | Contact): Promise<GetContactResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListContacts | ||
* | ||
* Example: | ||
* ```js | ||
* const contacts = await Lightrail.contacts.listContacts({limit: 5}); | ||
* const contactsLimited = await Lightrail.contacts.listContacts({limit: 5}); | ||
* ``` | ||
*/ | ||
export declare function listContacts(params?: ListContactsParams): Promise<ListContactsResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListaContactsValues | ||
* | ||
* Example: | ||
* ```js | ||
* const values = await Lightrail.contacts.listContactsValues("abcdefg"); | ||
* const valuesLimited = await Lightrail.contacts.listContactsValues("abcdefg", {limit: 5}); | ||
* ``` | ||
*/ | ||
export declare function listContactsValues(contact: string | Contact, params?: ListContactsValuesParams): Promise<ListContactsValuesResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/UpdateContact | ||
* | ||
* Example: | ||
* ```js | ||
* const updatedContact = await Lightrail.contacts.updateContact("abcdefg", {email: "new.ex@example.com"}); | ||
* ``` | ||
*/ | ||
export declare function updateContact(contact: string | Contact, params: UpdateContactParams): Promise<UpdateContactResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/AttachContactToValue | ||
* | ||
* Example: | ||
* ```js | ||
* const valueAttachedById = await Lightrail.contacts.attachContactToValue("abcdefg", {valueId: "hijklmnop"}); | ||
* const valueAttachedByCode = await Lightrail.contacts.attachContactToValue("abcdefg", {code: "PROMOCODE"}); | ||
* ``` | ||
*/ | ||
export declare function attachContactToValue(contact: string | Contact, params: AttachContactToValueParams): Promise<AttachContactToValueResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/DetachContactFromValue | ||
* | ||
* Example: | ||
* ```js | ||
* const valueDetached = await Lightrail.contacts.detachContactFromValue("abcdefg", {valueId: "hijklmnop"}); | ||
* ``` | ||
*/ | ||
export declare function detachContactFromValue(contact: string | Contact, params: DetachContactFromValueParams): Promise<DetachContactFromValueResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/DeleteContact | ||
* | ||
* Example: | ||
* ```js | ||
* await Lightrail.contacts.deleteContact("abcdefg"}); | ||
* ``` | ||
*/ | ||
export declare function deleteContact(contact: string | Contact): Promise<DeleteContactResponse>; | ||
/** | ||
* @internal | ||
* Get contactId from the string (as the ID itself) or Contact object. | ||
*/ | ||
export declare function getContactId(contact: string | Contact): string; |
@@ -16,2 +16,13 @@ "use strict"; | ||
const LightrailRequestError_1 = require("./LightrailRequestError"); | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/CreateContact | ||
* | ||
* Example: | ||
* ```js | ||
* const contact = await Lightrail.contacts.createContact({ | ||
* id: "abcdefg", | ||
* email: "ex@example.com" | ||
* }); | ||
* ``` | ||
*/ | ||
function createContact(params) { | ||
@@ -33,2 +44,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.createContact = createContact; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/GetaContact | ||
* | ||
* Example: | ||
* ```js | ||
* const contact = await Lightrail.contacts.getContact("abcdefg"); | ||
* ``` | ||
*/ | ||
function getContact(contact) { | ||
@@ -45,2 +64,11 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.getContact = getContact; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListContacts | ||
* | ||
* Example: | ||
* ```js | ||
* const contacts = await Lightrail.contacts.listContacts({limit: 5}); | ||
* const contactsLimited = await Lightrail.contacts.listContacts({limit: 5}); | ||
* ``` | ||
*/ | ||
function listContacts(params) { | ||
@@ -56,2 +84,11 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.listContacts = listContacts; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListaContactsValues | ||
* | ||
* Example: | ||
* ```js | ||
* const values = await Lightrail.contacts.listContactsValues("abcdefg"); | ||
* const valuesLimited = await Lightrail.contacts.listContactsValues("abcdefg", {limit: 5}); | ||
* ``` | ||
*/ | ||
function listContactsValues(contact, params) { | ||
@@ -68,2 +105,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.listContactsValues = listContactsValues; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/UpdateContact | ||
* | ||
* Example: | ||
* ```js | ||
* const updatedContact = await Lightrail.contacts.updateContact("abcdefg", {email: "new.ex@example.com"}); | ||
* ``` | ||
*/ | ||
function updateContact(contact, params) { | ||
@@ -80,2 +125,11 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.updateContact = updateContact; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/AttachContactToValue | ||
* | ||
* Example: | ||
* ```js | ||
* const valueAttachedById = await Lightrail.contacts.attachContactToValue("abcdefg", {valueId: "hijklmnop"}); | ||
* const valueAttachedByCode = await Lightrail.contacts.attachContactToValue("abcdefg", {code: "PROMOCODE"}); | ||
* ``` | ||
*/ | ||
function attachContactToValue(contact, params) { | ||
@@ -92,2 +146,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.attachContactToValue = attachContactToValue; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/DetachContactFromValue | ||
* | ||
* Example: | ||
* ```js | ||
* const valueDetached = await Lightrail.contacts.detachContactFromValue("abcdefg", {valueId: "hijklmnop"}); | ||
* ``` | ||
*/ | ||
function detachContactFromValue(contact, params) { | ||
@@ -104,2 +166,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.detachContactFromValue = detachContactFromValue; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/DeleteContact | ||
* | ||
* Example: | ||
* ```js | ||
* await Lightrail.contacts.deleteContact("abcdefg"}); | ||
* ``` | ||
*/ | ||
function deleteContact(contact) { | ||
@@ -117,2 +187,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
/** | ||
* @internal | ||
* Get contactId from the string (as the ID itself) or Contact object. | ||
@@ -119,0 +190,0 @@ */ |
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>; | ||
@@ -8,0 +56,0 @@ /** |
@@ -16,2 +16,15 @@ "use strict"; | ||
const lightrail = require("./index"); | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/CreateCurrency | ||
* | ||
* Example: | ||
* ```js | ||
* const currency = await Lightrail.currencies.createCurrency({ | ||
* code: "USD", | ||
* symbol: "$", | ||
* name: "US Dollar", | ||
* decimalPlaces: 2 | ||
* }); | ||
* ``` | ||
*/ | ||
function createCurrency(params) { | ||
@@ -33,2 +46,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.createCurrency = createCurrency; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListCurrencies | ||
* | ||
* Example: | ||
* ```js | ||
* const currencies = await Lightrail.currencies.listCurrencies(); | ||
* ``` | ||
*/ | ||
function listCurrencies() { | ||
@@ -44,2 +65,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.listCurrencies = listCurrencies; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/GetCurrency | ||
* | ||
* Example: | ||
* ```js | ||
* const usd = await Lightrail.currencies.getCurrency("USD"); | ||
* ``` | ||
*/ | ||
function getCurrency(currency) { | ||
@@ -59,2 +88,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.getCurrency = getCurrency; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/UpdateCurrency | ||
* | ||
* Example: | ||
* ```js | ||
* const updatedUsd = await Lightrail.currencies.updateCurrency("USD", {name: "Freedom Dollars"}); | ||
* ``` | ||
*/ | ||
function updateCurrency(currency, params) { | ||
@@ -77,2 +114,13 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.updateCurrency = updateCurrency; | ||
/** | ||
* 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"); | ||
* ``` | ||
*/ | ||
function deleteCurrency(currency) { | ||
@@ -79,0 +127,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -10,3 +10,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -13,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -10,3 +10,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -13,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
export declare type CodeGenerationParams = {} | { | ||
length: number; | ||
characters?: string; | ||
charset?: string; | ||
prefix?: string; | ||
suffix?: string; | ||
}; |
@@ -7,2 +7,3 @@ import { Value } from "../../model"; | ||
import { DiscountSellerLiabilityRule } from "../../model"; | ||
import { CodeGenerationParams } from ".."; | ||
export interface CreateValueParams { | ||
@@ -22,2 +23,3 @@ id: string; | ||
discountSellerLiabilityRule?: DiscountSellerLiabilityRule; | ||
generateCode?: CodeGenerationParams; | ||
genericCodeOptions?: GenericCodeOptions; | ||
@@ -32,3 +34,6 @@ redemptionRule?: RedemptionRule; | ||
} | ||
export interface CreateValueQueryParams { | ||
showCode?: boolean; | ||
} | ||
export interface CreateValueResponse extends LightrailResponse<Value> { | ||
} |
import { CreateIssuanceParams, CreateIssuanceResponse, CreateProgramParams, CreateProgramResponse, DeleteProgramResponse, GetIssuanceResponse, GetProgramResponse, ListIssuancesParams, ListIssuancesResponse, ListProgramsParams, ListProgramsResponse, UpdateProgramParams, UpdateProgramResponse } from "./params"; | ||
import { Issuance, Program } from "./model"; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/CreateProgram | ||
* | ||
* Example: | ||
* ```js | ||
* const program = await Lightrail.programs.createProgram({ | ||
* id: "abcdefg", | ||
* currency: "USD", | ||
* name: "Gift Cards", | ||
* minInitialBalance: 250, | ||
* maxInitialBalance: 50000 | ||
* }); | ||
* ``` | ||
*/ | ||
export declare function createProgram(params: CreateProgramParams): Promise<CreateProgramResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListPrograms | ||
* | ||
* Example: | ||
* ```js | ||
* const programs = await Lightrail.programs.listPrograms(); | ||
* const programsLimited = await Lightrail.programs.listPrograms({limit: 5}); | ||
* ``` | ||
*/ | ||
export declare function listPrograms(params?: ListProgramsParams): Promise<ListProgramsResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/GetaProgram | ||
* | ||
* Example: | ||
* ```js | ||
* const program = await Lightrail.programs.getProgram("abcdefg"); | ||
* ``` | ||
*/ | ||
export declare function getProgram(program: string | Program): Promise<GetProgramResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/UpdateProgram | ||
* | ||
* Example: | ||
* ```js | ||
* const program = await Lightrail.programs.updateProgram("abcdefg", {name: "Awesome Gift Cards"}); | ||
* ``` | ||
*/ | ||
export declare function updateProgram(program: string | Program, params: UpdateProgramParams): Promise<UpdateProgramResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/DeleteProgram | ||
* | ||
* Example: | ||
* ```js | ||
* await Lightrail.programs.deleteProgram("abcdefg"); | ||
* ``` | ||
*/ | ||
export declare function deleteProgram(program: string | Program): Promise<DeleteProgramResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/CreateIssuance | ||
* | ||
* Example: | ||
* ```js | ||
* const issuance = await Lightrail.programs.createIssuance("abcdefg", { | ||
* id: "hijklmnop", | ||
* name: "Some cards", | ||
* count: 500, | ||
* generateCode: {}, | ||
* balance: 5000 | ||
* }); | ||
* ``` | ||
*/ | ||
export declare function createIssuance(program: string | Program, params: CreateIssuanceParams): Promise<CreateIssuanceResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListIssuances | ||
* | ||
* Example: | ||
* ```js | ||
* const issuances = await Lightrail.programs.listIssuances("abcdefg"); | ||
* const issuancesLimited = await Lightrail.programs.listIssuances("abcdefg", {limit: 5}); | ||
* ``` | ||
*/ | ||
export declare function listIssuances(program: string | Program, params?: ListIssuancesParams): Promise<ListIssuancesResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/GetanIssuance | ||
* | ||
* Example: | ||
* ```js | ||
* const issuance = await Lightrail.programs.getIssuance("abcdefg", "hijklmnop"); | ||
* ``` | ||
*/ | ||
export declare function getIssuance(program: string | Program, issuance: string | Issuance): Promise<GetIssuanceResponse>; | ||
/** | ||
* @internal | ||
* Get programId from the string (as the ID itself) or Program object. | ||
@@ -16,4 +95,5 @@ */ | ||
/** | ||
* @internal | ||
* Get issuanceId from the string (as the ID itself) or Issuance object. | ||
*/ | ||
export declare function getIssuanceId(issuance: string | Issuance): string; |
@@ -16,2 +16,16 @@ "use strict"; | ||
const requestUtils_1 = require("./requestUtils"); | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/CreateProgram | ||
* | ||
* Example: | ||
* ```js | ||
* const program = await Lightrail.programs.createProgram({ | ||
* id: "abcdefg", | ||
* currency: "USD", | ||
* name: "Gift Cards", | ||
* minInitialBalance: 250, | ||
* maxInitialBalance: 50000 | ||
* }); | ||
* ``` | ||
*/ | ||
function createProgram(params) { | ||
@@ -33,2 +47,11 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.createProgram = createProgram; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListPrograms | ||
* | ||
* Example: | ||
* ```js | ||
* const programs = await Lightrail.programs.listPrograms(); | ||
* const programsLimited = await Lightrail.programs.listPrograms({limit: 5}); | ||
* ``` | ||
*/ | ||
function listPrograms(params) { | ||
@@ -44,2 +67,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.listPrograms = listPrograms; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/GetaProgram | ||
* | ||
* Example: | ||
* ```js | ||
* const program = await Lightrail.programs.getProgram("abcdefg"); | ||
* ``` | ||
*/ | ||
function getProgram(program) { | ||
@@ -56,2 +87,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.getProgram = getProgram; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/UpdateProgram | ||
* | ||
* Example: | ||
* ```js | ||
* const program = await Lightrail.programs.updateProgram("abcdefg", {name: "Awesome Gift Cards"}); | ||
* ``` | ||
*/ | ||
function updateProgram(program, params) { | ||
@@ -71,2 +110,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.updateProgram = updateProgram; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/DeleteProgram | ||
* | ||
* Example: | ||
* ```js | ||
* await Lightrail.programs.deleteProgram("abcdefg"); | ||
* ``` | ||
*/ | ||
function deleteProgram(program) { | ||
@@ -83,2 +130,16 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.deleteProgram = deleteProgram; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/CreateIssuance | ||
* | ||
* Example: | ||
* ```js | ||
* const issuance = await Lightrail.programs.createIssuance("abcdefg", { | ||
* id: "hijklmnop", | ||
* name: "Some cards", | ||
* count: 500, | ||
* generateCode: {}, | ||
* balance: 5000 | ||
* }); | ||
* ``` | ||
*/ | ||
function createIssuance(program, params) { | ||
@@ -101,2 +162,11 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.createIssuance = createIssuance; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListIssuances | ||
* | ||
* Example: | ||
* ```js | ||
* const issuances = await Lightrail.programs.listIssuances("abcdefg"); | ||
* const issuancesLimited = await Lightrail.programs.listIssuances("abcdefg", {limit: 5}); | ||
* ``` | ||
*/ | ||
function listIssuances(program, params) { | ||
@@ -113,2 +183,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.listIssuances = listIssuances; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/GetanIssuance | ||
* | ||
* Example: | ||
* ```js | ||
* const issuance = await Lightrail.programs.getIssuance("abcdefg", "hijklmnop"); | ||
* ``` | ||
*/ | ||
function getIssuance(program, issuance) { | ||
@@ -130,2 +208,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
/** | ||
* @internal | ||
* Get programId from the string (as the ID itself) or Program object. | ||
@@ -149,2 +228,3 @@ */ | ||
/** | ||
* @internal | ||
* Get issuanceId from the string (as the ID itself) or Issuance object. | ||
@@ -151,0 +231,0 @@ */ |
import { CapturePendingParams, CapturePendingResponse, CheckoutParams, CheckoutResponse, CreditParams, CreditResponse, DebitParams, DebitResponse, GetTransactionChainResponse, GetTransactionResponse, ListTransactionsParams, ListTransactionsResponse, ReverseParams, ReverseResponse, TransferParams, TransferResponse, VoidPendingParams, VoidPendingResponse } from "./params"; | ||
import { Transaction } from "./model"; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/Checkout | ||
* | ||
* Example: | ||
* ```js | ||
* const checkoutTx = await Lightrail.transactions.checkout({ | ||
* id: "abcdefg", | ||
* currency: "USD", | ||
* lineItems: [ | ||
* { | ||
* productId: "pedals", | ||
* unitPrice: 100000, | ||
* taxRate: 0 | ||
* } | ||
* ], | ||
* sources: [ | ||
* { | ||
* rail: "lightrail", | ||
* code: "PROMOCODE" | ||
* }, | ||
* { | ||
* rail: "stripe", | ||
* source: "tok_visa" | ||
* } | ||
* ] | ||
* ); | ||
* ``` | ||
*/ | ||
export declare function checkout(params: CheckoutParams): Promise<CheckoutResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/Debit | ||
* | ||
* Example: | ||
* ```js | ||
* const debitTx = await Lightrail.transactions.debit({ | ||
* id: "abcdefg", | ||
* currency: "USD", | ||
* source: { | ||
* rail: "lightrail", | ||
* valueId: "hijklmnop" | ||
* }, | ||
* amount: 1000 | ||
* ); | ||
* ``` | ||
*/ | ||
export declare function debit(params: DebitParams): Promise<DebitResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/Credit | ||
* | ||
* Example: | ||
* ```js | ||
* const creditTx = await Lightrail.transactions.credit({ | ||
* id: "abcdefg", | ||
* currency: "USD", | ||
* destination: { | ||
* rail: "lightrail", | ||
* valueId: "hijklmnop" | ||
* }, | ||
* amount: 1000 | ||
* ); | ||
* ``` | ||
*/ | ||
export declare function credit(params: CreditParams): Promise<CreditResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/Transfer | ||
* | ||
* Example: | ||
* ```js | ||
* const transferTx = await Lightrail.transactions.transfer({ | ||
* id: "abcdefg", | ||
* currency: "USD", | ||
* source: { | ||
* rail: "lightrail", | ||
* valueId: "hijklmnop" | ||
* }, | ||
* destination: { | ||
* rail: "lightrail", | ||
* valueId: "qrstuv" | ||
* }, | ||
* amount: 1000 | ||
* ); | ||
* ``` | ||
*/ | ||
export declare function transfer(params: TransferParams): Promise<TransferResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/Reverse | ||
* | ||
* Example: | ||
* ```js | ||
* const reverseTx = await Lightrail.transactions.reverse("hijklmnop" { | ||
* id: "abcdefg" // This is the ID of the reverse transaction created. | ||
* ); | ||
* ``` | ||
*/ | ||
export declare function reverse(transactionToReverse: string | Transaction, params: ReverseParams): Promise<ReverseResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/CapturePending | ||
* | ||
* Example: | ||
* ```js | ||
* const captureTx = await Lightrail.transactions.capturePending("hijklmnop" { | ||
* id: "abcdefg" // This is the ID of the capture transaction created. | ||
* ); | ||
* ``` | ||
*/ | ||
export declare function capturePending(transactionToCapture: string | Transaction, params: CapturePendingParams): Promise<CapturePendingResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/VoidPending | ||
* | ||
* Example: | ||
* ```js | ||
* const voidTx = await Lightrail.transactions.voidPending("hijklmnop" { | ||
* id: "abcdefg" // This is the ID of the void transaction created. | ||
* ); | ||
* ``` | ||
*/ | ||
export declare function voidPending(transactionToVoid: string | Transaction, params: VoidPendingParams): Promise<VoidPendingResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListTransactions | ||
* | ||
* Example: | ||
* ```js | ||
* const transactions = await Lightrail.transactions.listTransactions(); | ||
* const transactionsLimited = await Lightrail.transactions.listTransactions({limit: 5}); | ||
* ``` | ||
*/ | ||
export declare function listTransactions(params?: ListTransactionsParams): Promise<ListTransactionsResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/GetaTransaction | ||
* | ||
* Example: | ||
* ```js | ||
* const transaction = await Lightrail.transactions.getTransaction("abcdefg"); | ||
* ``` | ||
*/ | ||
export declare function getTransaction(transaction: string | Transaction): Promise<GetTransactionResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/GetTransactionChain | ||
* | ||
* Example: | ||
* ```js | ||
* const transactions = await Lightrail.transactions.getTransactionChain("abcdefg"); | ||
* ``` | ||
*/ | ||
export declare function getTransactionChain(transaction: string | Transaction): Promise<GetTransactionChainResponse>; | ||
/** | ||
* @internal | ||
* Get transactionId from the string (as the ID itself) or Transaction object. | ||
*/ | ||
export declare function getTransactionId(transaction: string | Transaction): string; |
@@ -16,2 +16,30 @@ "use strict"; | ||
const requestUtils_1 = require("./requestUtils"); | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/Checkout | ||
* | ||
* Example: | ||
* ```js | ||
* const checkoutTx = await Lightrail.transactions.checkout({ | ||
* id: "abcdefg", | ||
* currency: "USD", | ||
* lineItems: [ | ||
* { | ||
* productId: "pedals", | ||
* unitPrice: 100000, | ||
* taxRate: 0 | ||
* } | ||
* ], | ||
* sources: [ | ||
* { | ||
* rail: "lightrail", | ||
* code: "PROMOCODE" | ||
* }, | ||
* { | ||
* rail: "stripe", | ||
* source: "tok_visa" | ||
* } | ||
* ] | ||
* ); | ||
* ``` | ||
*/ | ||
function checkout(params) { | ||
@@ -33,2 +61,18 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.checkout = checkout; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/Debit | ||
* | ||
* Example: | ||
* ```js | ||
* const debitTx = await Lightrail.transactions.debit({ | ||
* id: "abcdefg", | ||
* currency: "USD", | ||
* source: { | ||
* rail: "lightrail", | ||
* valueId: "hijklmnop" | ||
* }, | ||
* amount: 1000 | ||
* ); | ||
* ``` | ||
*/ | ||
function debit(params) { | ||
@@ -50,2 +94,18 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.debit = debit; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/Credit | ||
* | ||
* Example: | ||
* ```js | ||
* const creditTx = await Lightrail.transactions.credit({ | ||
* id: "abcdefg", | ||
* currency: "USD", | ||
* destination: { | ||
* rail: "lightrail", | ||
* valueId: "hijklmnop" | ||
* }, | ||
* amount: 1000 | ||
* ); | ||
* ``` | ||
*/ | ||
function credit(params) { | ||
@@ -67,2 +127,22 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.credit = credit; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/Transfer | ||
* | ||
* Example: | ||
* ```js | ||
* const transferTx = await Lightrail.transactions.transfer({ | ||
* id: "abcdefg", | ||
* currency: "USD", | ||
* source: { | ||
* rail: "lightrail", | ||
* valueId: "hijklmnop" | ||
* }, | ||
* destination: { | ||
* rail: "lightrail", | ||
* valueId: "qrstuv" | ||
* }, | ||
* amount: 1000 | ||
* ); | ||
* ``` | ||
*/ | ||
function transfer(params) { | ||
@@ -84,2 +164,12 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.transfer = transfer; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/Reverse | ||
* | ||
* Example: | ||
* ```js | ||
* const reverseTx = await Lightrail.transactions.reverse("hijklmnop" { | ||
* id: "abcdefg" // This is the ID of the reverse transaction created. | ||
* ); | ||
* ``` | ||
*/ | ||
function reverse(transactionToReverse, params) { | ||
@@ -101,2 +191,12 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.reverse = reverse; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/CapturePending | ||
* | ||
* Example: | ||
* ```js | ||
* const captureTx = await Lightrail.transactions.capturePending("hijklmnop" { | ||
* id: "abcdefg" // This is the ID of the capture transaction created. | ||
* ); | ||
* ``` | ||
*/ | ||
function capturePending(transactionToCapture, params) { | ||
@@ -118,2 +218,12 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.capturePending = capturePending; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/VoidPending | ||
* | ||
* Example: | ||
* ```js | ||
* const voidTx = await Lightrail.transactions.voidPending("hijklmnop" { | ||
* id: "abcdefg" // This is the ID of the void transaction created. | ||
* ); | ||
* ``` | ||
*/ | ||
function voidPending(transactionToVoid, params) { | ||
@@ -135,2 +245,11 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.voidPending = voidPending; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListTransactions | ||
* | ||
* Example: | ||
* ```js | ||
* const transactions = await Lightrail.transactions.listTransactions(); | ||
* const transactionsLimited = await Lightrail.transactions.listTransactions({limit: 5}); | ||
* ``` | ||
*/ | ||
function listTransactions(params) { | ||
@@ -146,2 +265,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.listTransactions = listTransactions; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/GetaTransaction | ||
* | ||
* Example: | ||
* ```js | ||
* const transaction = await Lightrail.transactions.getTransaction("abcdefg"); | ||
* ``` | ||
*/ | ||
function getTransaction(transaction) { | ||
@@ -158,2 +285,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.getTransaction = getTransaction; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/GetTransactionChain | ||
* | ||
* Example: | ||
* ```js | ||
* const transactions = await Lightrail.transactions.getTransactionChain("abcdefg"); | ||
* ``` | ||
*/ | ||
function getTransactionChain(transaction) { | ||
@@ -171,2 +306,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
/** | ||
* @internal | ||
* Get transactionId from the string (as the ID itself) or Transaction object. | ||
@@ -173,0 +309,0 @@ */ |
@@ -1,15 +0,89 @@ | ||
import { ChangeValuesCodeParams, ChangeValuesCodeResponse, CreateValueParams, CreateValueResponse, DeleteValueResponse, GetValueParams, GetValueResponse, ListContactsParams, ListContactsResponse, ListTransactionsParams, ListTransactionsResponse, ListValuesParams, ListValuesResponse, UpdateValueParams, UpdateValueResponse } from "./params"; | ||
import { ChangeValuesCodeParams, ChangeValuesCodeResponse, CreateValueParams, CreateValueQueryParams, CreateValueResponse, DeleteValueResponse, GetValueParams, GetValueResponse, ListContactsParams, ListContactsResponse, ListTransactionsParams, ListTransactionsResponse, ListValuesParams, ListValuesResponse, UpdateValueParams, UpdateValueResponse } from "./params"; | ||
import { Value } from "./model"; | ||
import { ContentType } from "./params/ContentType"; | ||
export declare function createValue(params: CreateValueParams): Promise<CreateValueResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/CreateValue | ||
* | ||
* Example: | ||
* ```js | ||
* const value = await Lightrail.values.createValue({ | ||
* id: "abcdefg", | ||
* currency: "USD", | ||
* balance: 500 | ||
* }); | ||
* const valueWithGeneratedCode = await Lightrail.values.createValue({ | ||
* id: "hijklmnop", | ||
* currency: "USD", | ||
* balance: 500, | ||
* generateCode: {} | ||
* }, {codeCode: true}); | ||
* ``` | ||
*/ | ||
export declare function createValue(params: CreateValueParams, queryParams?: CreateValueQueryParams): Promise<CreateValueResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListValues | ||
* | ||
* Example: | ||
* ```js | ||
* const values = await Lightrail.values.listValues(); | ||
* const valuesLimited = await Lightrail.values.listValues({limit: 5}); | ||
* ``` | ||
*/ | ||
export declare function listValues(params?: ListValuesParams, contentType?: ContentType): Promise<ListValuesResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/GetValue | ||
* | ||
* Example: | ||
* ```js | ||
* const value = await Lightrail.values.getValue("abcdefg"); | ||
* ``` | ||
*/ | ||
export declare function getValue(value: string | Value, params?: GetValueParams): Promise<GetValueResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/UpdateValue | ||
* | ||
* Example: | ||
* ```js | ||
* const updatedValue = await Lightrail.values.updateValue("abcdefg", {frozen: true}); | ||
* ``` | ||
*/ | ||
export declare function updateValue(value: string | Value, params: UpdateValueParams): Promise<UpdateValueResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ChangeValueCode | ||
* | ||
* Example: | ||
* ```js | ||
* const updatedValue = await Lightrail.values.changeValuesCode("abcdefg", {code: "PROMOCODE"}); | ||
* ``` | ||
*/ | ||
export declare function changeValuesCode(value: string | Value, params: ChangeValuesCodeParams): Promise<ChangeValuesCodeResponse>; | ||
/** | ||
* Example: | ||
* ```js | ||
* await Lightrail.values.deleteValue("abcdefg"); | ||
* ``` | ||
*/ | ||
export declare function deleteValue(value: string | Value): Promise<DeleteValueResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListValueTransactions | ||
* | ||
* Example: | ||
* ```js | ||
* const transactions = await Lightrail.values.listValuesTransactions("abcdefg"); | ||
* ``` | ||
*/ | ||
export declare function listValuesTransactions(value: string | Value, params?: ListTransactionsParams): Promise<ListTransactionsResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListValueAttachedContacts | ||
* | ||
* Example: | ||
* ```js | ||
* const contacts = await Lightrail.values.listValuesAttachedContacts("abcdefg"); | ||
* ``` | ||
*/ | ||
export declare function listValuesAttachedContacts(value: string | Value, params?: ListContactsParams): Promise<ListContactsResponse>; | ||
/** | ||
* @internal | ||
* Get contactId from the string (as the ID itself) or Contact object. | ||
*/ | ||
export declare function getValueId(value: string | Value): string; |
@@ -16,3 +16,21 @@ "use strict"; | ||
const lightrail = require("./index"); | ||
function createValue(params) { | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/CreateValue | ||
* | ||
* Example: | ||
* ```js | ||
* const value = await Lightrail.values.createValue({ | ||
* id: "abcdefg", | ||
* currency: "USD", | ||
* balance: 500 | ||
* }); | ||
* const valueWithGeneratedCode = await Lightrail.values.createValue({ | ||
* id: "hijklmnop", | ||
* currency: "USD", | ||
* balance: 500, | ||
* generateCode: {} | ||
* }, {codeCode: true}); | ||
* ``` | ||
*/ | ||
function createValue(params, queryParams) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -25,3 +43,3 @@ if (!params) { | ||
} | ||
const resp = yield lightrail.request("POST", "values").send(params); | ||
const resp = yield lightrail.request("POST", "values").send(params).query(queryParams); | ||
if (requestUtils_1.isSuccessStatus(resp.status)) { | ||
@@ -34,2 +52,11 @@ return requestUtils_1.formatResponse(resp); | ||
exports.createValue = createValue; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListValues | ||
* | ||
* Example: | ||
* ```js | ||
* const values = await Lightrail.values.listValues(); | ||
* const valuesLimited = await Lightrail.values.listValues({limit: 5}); | ||
* ``` | ||
*/ | ||
function listValues(params, contentType = "application/json") { | ||
@@ -45,2 +72,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.listValues = listValues; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/GetValue | ||
* | ||
* Example: | ||
* ```js | ||
* const value = await Lightrail.values.getValue("abcdefg"); | ||
* ``` | ||
*/ | ||
function getValue(value, params) { | ||
@@ -57,2 +92,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.getValue = getValue; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/UpdateValue | ||
* | ||
* Example: | ||
* ```js | ||
* const updatedValue = await Lightrail.values.updateValue("abcdefg", {frozen: true}); | ||
* ``` | ||
*/ | ||
function updateValue(value, params) { | ||
@@ -69,2 +112,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.updateValue = updateValue; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ChangeValueCode | ||
* | ||
* Example: | ||
* ```js | ||
* const updatedValue = await Lightrail.values.changeValuesCode("abcdefg", {code: "PROMOCODE"}); | ||
* ``` | ||
*/ | ||
function changeValuesCode(value, params) { | ||
@@ -81,2 +132,8 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.changeValuesCode = changeValuesCode; | ||
/** | ||
* Example: | ||
* ```js | ||
* await Lightrail.values.deleteValue("abcdefg"); | ||
* ``` | ||
*/ | ||
function deleteValue(value) { | ||
@@ -93,2 +150,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.deleteValue = deleteValue; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListValueTransactions | ||
* | ||
* Example: | ||
* ```js | ||
* const transactions = await Lightrail.values.listValuesTransactions("abcdefg"); | ||
* ``` | ||
*/ | ||
function listValuesTransactions(value, params) { | ||
@@ -105,2 +170,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.listValuesTransactions = listValuesTransactions; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListValueAttachedContacts | ||
* | ||
* Example: | ||
* ```js | ||
* const contacts = await Lightrail.values.listValuesAttachedContacts("abcdefg"); | ||
* ``` | ||
*/ | ||
function listValuesAttachedContacts(value, params) { | ||
@@ -118,2 +191,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
/** | ||
* @internal | ||
* Get contactId from the string (as the ID itself) or Contact object. | ||
@@ -120,0 +194,0 @@ */ |
import { Webhook, WebhookSecret } from "./model"; | ||
import { CreateWebhookParams, CreateWebhookResponse, CreateWebhookSecretResponse, GetWebhookResponse, GetWebhookSecretResponse, ListWebhooksResponse, UpdateWebhookParams, UpdateWebhookResponse } from "./params"; | ||
/** | ||
* Example: | ||
* ```js | ||
* const signature = "abcdefg"; // webhook signature | ||
* const payload = "{}"; // webhook payload JSON string | ||
* const secret = "the secret stored in your system"; | ||
* const verified = Lightrail.webhooks.verifySignature(signature, payload, secret); | ||
* ``` | ||
*/ | ||
export declare function verifySignature(signatureHeader: string, payload: string, webhookSecret?: string): boolean; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/CreateWebhook | ||
* | ||
* Example: | ||
* ```js | ||
* const webhook = await Lightrail.webhooks.createWebhook({ | ||
* id: "abcdefg", | ||
* url: "https://www.example.com/webhook", | ||
* events: ["*"] | ||
* }); | ||
* ``` | ||
*/ | ||
export declare function createWebhook(params: CreateWebhookParams): Promise<CreateWebhookResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/GetWebhook | ||
* | ||
* Example: | ||
* ```js | ||
* const webhook = await Lightrail.webhooks.getWebhook("abcdefg"); | ||
* ``` | ||
*/ | ||
export declare function getWebhook(webhook: string | Webhook): Promise<GetWebhookResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListWebhooks | ||
* | ||
* Example: | ||
* ```js | ||
* const webhooks = await Lightrail.webhooks.listWebhooks(); | ||
* ``` | ||
*/ | ||
export declare function listWebhooks(): Promise<ListWebhooksResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/UpdateWebhook | ||
* | ||
* Example: | ||
* ```js | ||
* const updatedWebhook = await Lightrail.webhooks.updateWebhook("abcdefg", {url: "https://www.example.com/webhookUpdated"}); | ||
* ``` | ||
*/ | ||
export declare function updateWebhook(webhook: string | Webhook, params: UpdateWebhookParams): Promise<UpdateWebhookResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/DeleteWebhook | ||
* | ||
* Example: | ||
* ```js | ||
* await Lightrail.webhooks.deleteWebhook("abcdefg"); | ||
* ``` | ||
*/ | ||
export declare function deleteWebhook(webhook: string | Webhook): Promise<void>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/CreateSecret | ||
* | ||
* Example: | ||
* ```js | ||
* const webhookSecret = await Lightrail.webhooks.createWebhookSecret("abcdefg"); | ||
* ``` | ||
*/ | ||
export declare function createWebhookSecret(webhook: string | Webhook): Promise<CreateWebhookSecretResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/GetSecret | ||
* | ||
* Example: | ||
* ```js | ||
* const webhookSecret = await Lightrail.webhooks.getWebhookSecret("abcdefg", "hijklmnop"); | ||
* ``` | ||
*/ | ||
export declare function getWebhookSecret(webhook: string | Webhook, webhookSecret: string | WebhookSecret): Promise<GetWebhookSecretResponse>; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/DeleteSecret | ||
* | ||
* Example: | ||
* ```js | ||
* await Lightrail.webhooks.deleteWebhookSecret("abcdefg", "hijklmnop"); | ||
* ``` | ||
*/ | ||
export declare function deleteWebhookSecret(webhook: string | Webhook, webhookSecret: string | WebhookSecret): Promise<void>; | ||
/** | ||
* @internal | ||
* Get webhookId from the string (as the ID itself) or Webhook object. | ||
@@ -17,4 +95,5 @@ */ | ||
/** | ||
* @internal | ||
* Get webhookSecretId from the string (as the ID itself) or WebhookSecret object. | ||
*/ | ||
export declare function getWebhookSecretId(webhookSecret: string | WebhookSecret): string; |
@@ -17,2 +17,11 @@ "use strict"; | ||
const requestUtils_1 = require("./requestUtils"); | ||
/** | ||
* Example: | ||
* ```js | ||
* const signature = "abcdefg"; // webhook signature | ||
* const payload = "{}"; // webhook payload JSON string | ||
* const secret = "the secret stored in your system"; | ||
* const verified = Lightrail.webhooks.verifySignature(signature, payload, secret); | ||
* ``` | ||
*/ | ||
function verifySignature(signatureHeader, payload, webhookSecret) { | ||
@@ -38,2 +47,14 @@ const secret = webhookSecret ? webhookSecret : index_1.configuration.webhookSecret; | ||
exports.verifySignature = verifySignature; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/CreateWebhook | ||
* | ||
* Example: | ||
* ```js | ||
* const webhook = await Lightrail.webhooks.createWebhook({ | ||
* id: "abcdefg", | ||
* url: "https://www.example.com/webhook", | ||
* events: ["*"] | ||
* }); | ||
* ``` | ||
*/ | ||
function createWebhook(params) { | ||
@@ -55,2 +76,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.createWebhook = createWebhook; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/GetWebhook | ||
* | ||
* Example: | ||
* ```js | ||
* const webhook = await Lightrail.webhooks.getWebhook("abcdefg"); | ||
* ``` | ||
*/ | ||
function getWebhook(webhook) { | ||
@@ -67,2 +96,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.getWebhook = getWebhook; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/ListWebhooks | ||
* | ||
* Example: | ||
* ```js | ||
* const webhooks = await Lightrail.webhooks.listWebhooks(); | ||
* ``` | ||
*/ | ||
function listWebhooks() { | ||
@@ -78,2 +115,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.listWebhooks = listWebhooks; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/UpdateWebhook | ||
* | ||
* Example: | ||
* ```js | ||
* const updatedWebhook = await Lightrail.webhooks.updateWebhook("abcdefg", {url: "https://www.example.com/webhookUpdated"}); | ||
* ``` | ||
*/ | ||
function updateWebhook(webhook, params) { | ||
@@ -90,2 +135,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.updateWebhook = updateWebhook; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/DeleteWebhook | ||
* | ||
* Example: | ||
* ```js | ||
* await Lightrail.webhooks.deleteWebhook("abcdefg"); | ||
* ``` | ||
*/ | ||
function deleteWebhook(webhook) { | ||
@@ -102,2 +155,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.deleteWebhook = deleteWebhook; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/CreateSecret | ||
* | ||
* Example: | ||
* ```js | ||
* const webhookSecret = await Lightrail.webhooks.createWebhookSecret("abcdefg"); | ||
* ``` | ||
*/ | ||
function createWebhookSecret(webhook) { | ||
@@ -114,2 +175,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.createWebhookSecret = createWebhookSecret; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/GetSecret | ||
* | ||
* Example: | ||
* ```js | ||
* const webhookSecret = await Lightrail.webhooks.getWebhookSecret("abcdefg", "hijklmnop"); | ||
* ``` | ||
*/ | ||
function getWebhookSecret(webhook, webhookSecret) { | ||
@@ -127,2 +196,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.getWebhookSecret = getWebhookSecret; | ||
/** | ||
* See: https://apidocs.lightrail.com/#operation/DeleteSecret | ||
* | ||
* Example: | ||
* ```js | ||
* await Lightrail.webhooks.deleteWebhookSecret("abcdefg", "hijklmnop"); | ||
* ``` | ||
*/ | ||
function deleteWebhookSecret(webhook, webhookSecret) { | ||
@@ -141,2 +218,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
/** | ||
* @internal | ||
* Get webhookId from the string (as the ID itself) or Webhook object. | ||
@@ -160,2 +238,3 @@ */ | ||
/** | ||
* @internal | ||
* Get webhookSecretId from the string (as the ID itself) or WebhookSecret object. | ||
@@ -162,0 +241,0 @@ */ |
{ | ||
"name": "lightrail-client", | ||
"version": "4.5.1", | ||
"version": "4.6.0", | ||
"description": "A Javascript and Typescript client for Lightrail", | ||
@@ -12,5 +12,6 @@ "main": "dist/index.js", | ||
"build": "tsc", | ||
"docs": "rimraf ./docs && typedoc src/ --out docs --mode modules --module commonjs --target es6 --excludePrivate --excludeNotExported --exclude '**/*.test.ts' --name 'Lightrail Client for JavaScript and TypeScript' && touch ./docs/.nojekyll && gh-pages -d docs -t", | ||
"clean": "rimraf ./dist", | ||
"lint": "eslint . --ext .ts,.tsx", | ||
"prepublishOnly": "npm run clean && npm run build && npm run lint && npm run test", | ||
"prepublishOnly": "npm run clean && npm run build && npm run lint && npm run test && npm run docs", | ||
"test": "mocha --timeout=5000 --recursive --throw-deprecation --require ts-node/register --require dotenv-safe/config \"src/**/*.test.ts\"" | ||
@@ -38,3 +39,3 @@ }, | ||
"devDependencies": { | ||
"@types/chai": "^4.2.12", | ||
"@types/chai": "^4.2.13", | ||
"@types/chai-as-promised": "^7.1.3", | ||
@@ -46,5 +47,5 @@ "@types/dotenv-safe": "^8.1.1", | ||
"@types/parse-link-header": "^1.0.0", | ||
"@types/superagent": "^4.1.9", | ||
"@typescript-eslint/eslint-plugin": "^3.10.0", | ||
"@typescript-eslint/parser": "^3.10.0", | ||
"@types/superagent": "^4.1.10", | ||
"@typescript-eslint/eslint-plugin": "^4.4.1", | ||
"@typescript-eslint/parser": "^4.4.1", | ||
"chai": "^4.2.0", | ||
@@ -54,9 +55,11 @@ "chai-as-promised": "^7.1.1", | ||
"dotenv-safe": "^8.2.0", | ||
"eslint": "^7.7.0", | ||
"eslint": "^7.11.0", | ||
"gh-pages": "^3.1.0", | ||
"mitm": "^1.7.1", | ||
"mocha": "^8.1.1", | ||
"mocha": "^8.1.3", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^9.0.0", | ||
"typescript": "^3.9.7", | ||
"uuid": "^8.3.0" | ||
"typedoc": "^0.19.2", | ||
"typescript": "^4.0.3", | ||
"uuid": "^8.3.1" | ||
}, | ||
@@ -63,0 +66,0 @@ "dependencies": { |
# Lightrail Client for JavaScript and TypeScript | ||
Lightrail is a modern platform for digital account credits, gift cards, promotions, and points (to learn more, visit [Lightrail](https://www.lightrail.com/)). This is a basic library for developers to easily connect with the Lightrail API using Javascript or Typescript. | ||
Lightrail is a modern platform for digital account credits, gift cards, promotions, and points (to learn more, visit [Lightrail](https://www.lightrail.com/)). This is a basic library for developers to easily connect with the Lightrail API using Javascript or Typescript. You can find JS API documentation at https://giftbit.github.io/lightrail-client-javascript/ . | ||
@@ -11,21 +11,15 @@ This client runs on your server and makes calls to the Lightrail server. | ||
##### Contacts | ||
Create, Get, List, Update, Delete, List Values, Attach to Value, Detach from Value | ||
[Contacts](https://giftbit.github.io/lightrail-client-javascript/modules/_contacts_.html): Create, Get, List, Update, Delete, List Values, Attach to Value, Detach from Value | ||
##### Values | ||
Create, Get by Id, Get by FullCode, List, Update, Delete | ||
[Values](https://giftbit.github.io/lightrail-client-javascript/modules/_values_.html): Create, Get by Id, Get by FullCode, List, Update, Delete | ||
##### Programs | ||
Create, Get, List, Update, Delete, Create Issuance, Get Issuance, List Issuances | ||
[Programs](https://giftbit.github.io/lightrail-client-javascript/modules/_programs_.html): Create, Get, List, Update, Delete, Create Issuance, Get Issuance, List Issuances | ||
##### Transactions | ||
Checkout, Debit, Credit, Transfer, Reverse, Capture Pending, Void Pending, Get, Get Transaction Chain, List | ||
[Transactions](https://giftbit.github.io/lightrail-client-javascript/modules/_transactions_.html): Checkout, Debit, Credit, Transfer, Reverse, Capture Pending, Void Pending, Get, Get Transaction Chain, List | ||
##### Currencies | ||
Create, Get, List, Update, Delete | ||
[Currencies](https://giftbit.github.io/lightrail-client-javascript/modules/_currencies_.html): Create, Get, List, Update, Delete | ||
##### Webhooks | ||
Create, Get, List, Update, Delete, Create Secret, Get Secret, Delete Secret | ||
[Webhooks](https://giftbit.github.io/lightrail-client-javascript/modules/_webhooks_.html): Create, Get, List, Update, Delete, Create Secret, Get Secret, Delete Secret | ||
Note that the Lightrail API supports many other features and we are still working on covering them in this library. For a complete list of Lightrail API features check out the [Lightrail API documentation](https://www.lightrail.com/docs/). | ||
For a complete list of Lightrail API features check out the [Lightrail API documentation](https://apidocs.lightrail.com/). | ||
@@ -36,3 +30,3 @@ ## Usage | ||
Before using this client, you'll need to configure it to use your API key: | ||
Before using this client, you'll need to [configure](https://giftbit.github.io/lightrail-client-javascript/modules/_index_.html#configure) it to use your API key: | ||
@@ -39,0 +33,0 @@ ```javascript |
128053
3351
23
70