@meaple-com/core
v1.1.1
Published
Core SDK for Meaple - ticketing platform
Readme
@meaple-com/core
Core SDK for the Meaple ticketing platform. Use it to call the Meaple API from Node or the browser with a simple, typed client.
Installation
npm install @meaple-com/core @meaple-com/types
# or
pnpm add @meaple-com/core @meaple-com/types
# or
bun add @meaple-com/core @meaple-com/typesPeer dependency: axios (^1.12.2) — install it if not already in your project.
Quick start
import { MeapleSDK } from '@meaple-com/core';
const sdk = new MeapleSDK({
publicKey: 'YOUR_CHANNEL_ID',
baseURL: 'https://api.meaple.com',
});
// Optional: set bearer token for authenticated requests
sdk.setGlobalToken('user-jwt-token');
// List events
const { events } = await sdk.events.find({ limit: 10 });
// Get a single event
const event = await sdk.events.get('event-id', 'event-slug');
// Categories
const categories = await sdk.categories.find();
// Check coupon
const coupon = await sdk.coupon.check('PROMO20', 'event-id');
// Create order (typically used with react-query in a React app)
const order = await sdk.orders.create({ ...createOrderPayload });API resources
| Resource | Methods / usage |
| ---------------- | --------------------------------------- |
| sdk.users | User events, orders, refunds |
| sdk.events | find, get, tickets, products |
| sdk.orders | get, create |
| sdk.categories | find |
| sdk.coupon | check |
| sdk.payments | Platform fee, etc. |
| sdk.tickets | Transfer, edit user ticket, create file |
All methods are typed with @meaple-com/types.
Options
interface MeapleSDKOptions {
publicKey: string; // Channel ID (X-Channel-Id)
baseURL: string; // e.g. https://api.meaple.com
}Utilities
import { descriptionToHtml } from '@meaple-com/core';
// Convert Meaple description blocks to HTML
const html = descriptionToHtml(event.description);Use with React
For React apps, use @meaple-com/react-query for hooks and @meaple-com/react-headless-components for UI building blocks. They depend on @meaple-com/core and the same SDK instance.
