UNPKG

@lomi./sdk

Version:

Official TypeScript SDK for the lomi. API

56 lines 2.08 kB
/** * Main lomi. SDK class * AUTO-GENERATED - Do not edit manually */ import { DEFAULT_CONFIG } from './config.js'; import { OpenAPI } from './generated/index.js'; // Import all generated services import { AccountsService, BeneficiaryPayoutsService, CheckoutSessionsService, CustomersService, DiscountCouponsService, OrganizationsService, PaymentLinksService, PaymentRequestsService, PayoutsService, ProductsService, RefundsService, SubscriptionsService, TransactionsService, WebhookDeliveryLogsService, WebhooksService, } from './generated/index.js'; export class LomiSDK { /** * Initialize the lomi. SDK */ constructor(config) { const baseUrl = config.environment === 'test' ? 'https://sandbox.api.lomi.africa/v1' : config.baseUrl || DEFAULT_CONFIG.baseUrl; // Configure OpenAPI client OpenAPI.BASE = baseUrl; OpenAPI.HEADERS = { 'X-API-KEY': config.apiKey, ...config.headers, }; // Assign all generated services this.accounts = AccountsService; this.beneficiaryPayouts = BeneficiaryPayoutsService; this.checkoutSessions = CheckoutSessionsService; this.customers = CustomersService; this.discountCoupons = DiscountCouponsService; this.organizations = OrganizationsService; this.paymentLinks = PaymentLinksService; this.paymentRequests = PaymentRequestsService; this.payouts = PayoutsService; this.products = ProductsService; this.refunds = RefundsService; this.subscriptions = SubscriptionsService; this.transactions = TransactionsService; this.webhookDeliveryLogs = WebhookDeliveryLogsService; this.webhooks = WebhooksService; } /** * Update the API key */ setApiKey(apiKey) { OpenAPI.HEADERS = { ...OpenAPI.HEADERS, 'X-API-KEY': apiKey, }; } /** * Get the current base URL */ getBaseUrl() { return OpenAPI.BASE; } } //# sourceMappingURL=sdk.js.map