UNPKG

veend-sdk

Version:

a nodejs package for veend products

27 lines (26 loc) 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Veend = void 0; // index.ts const apiClients_1 = require("./apiClients"); const onlending_1 = require("./modules/onlending"); const prime_1 = require("./modules/prime"); class Veend { validateClient(clientId = "_") { const [userId, accountId] = clientId.split("_"); if (!userId || !accountId) { throw new Error("Invalid clientId format. Expected 'userId_accountId'."); } return [userId, accountId]; } constructor(options) { const [userId, account] = this.validateClient(options.clientId); this.userId = userId; this.account = account; this.apiClient = new apiClients_1.APIClient(options.env === "production", options.developerToken, options.clientId, options.xtag || "VeendHQ SDK", options.xJwt || "VeendHQ SDK"); // Initialize modules this.onlending = new onlending_1.OnlendingService(this.apiClient, this.account, this.userId); this.prime = new prime_1.PrimeService(this.apiClient, this.account, this.userId); } } exports.Veend = Veend;