UNPKG

@paddle/paddle-node-sdk

Version:

A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.

66 lines (65 loc) 3.19 kB
import { Client } from './internal/api/client.js'; import { Environment, LogLevel } from './internal/index.js'; import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomerPortalSessionsResource, CustomersResource, DiscountGroupsResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PaymentMethodsResource, PricesResource, PricingPreviewResource, ProductsResource, ReportsResource, SimulationRunEventsResource, SimulationRunsResource, SimulationsResource, SimulationTypesResource, SubscriptionsResource, TransactionsResource, ClientTokensResource, MetricsResource, } from './resources/index.js'; import { EventsResource } from './resources/events/index.js'; import { Webhooks } from './notifications/index.js'; export class Paddle { client; defaultPaddleOptions = { environment: Environment.production, logLevel: LogLevel.error, }; products; prices; transactions; adjustments; customers; customerPortalSessions; addresses; businesses; discounts; discountGroups; subscriptions; paymentMethods; pricingPreview; events; webhooks; eventTypes; notificationSettings; notifications; reports; simulationTypes; simulations; simulationRuns; simulationRunEvents; clientTokens; metrics; constructor(apiKey, options) { this.client = new Client(apiKey, options ? { ...this.defaultPaddleOptions, ...options } : { ...this.defaultPaddleOptions }); this.products = new ProductsResource(this.client); this.prices = new PricesResource(this.client); this.transactions = new TransactionsResource(this.client); this.adjustments = new AdjustmentsResource(this.client); this.customers = new CustomersResource(this.client); this.customerPortalSessions = new CustomerPortalSessionsResource(this.client); this.addresses = new AddressesResource(this.client); this.businesses = new BusinessesResource(this.client); this.discounts = new DiscountsResource(this.client); this.discountGroups = new DiscountGroupsResource(this.client); this.subscriptions = new SubscriptionsResource(this.client); this.paymentMethods = new PaymentMethodsResource(this.client); this.pricingPreview = new PricingPreviewResource(this.client); this.events = new EventsResource(this.client); this.webhooks = new Webhooks(); this.eventTypes = new EventTypesResource(this.client); this.notificationSettings = new NotificationSettingsResource(this.client); this.notifications = new NotificationsResource(this.client); this.reports = new ReportsResource(this.client); this.simulationTypes = new SimulationTypesResource(this.client); this.simulations = new SimulationsResource(this.client); this.simulationRuns = new SimulationRunsResource(this.client); this.simulationRunEvents = new SimulationRunEventsResource(this.client); this.clientTokens = new ClientTokensResource(this.client); this.metrics = new MetricsResource(this.client); } }