open-index/open-npm huggingface dataset:
npm package: @meaple-com/core
Description: Core SDK for Meaple - ticketing platform
Latest version: 1.1.2

# @meaple-com/core

Core SDK for the [Meaple](https://meaple.com) ticketing platform. Use it to call the Meaple API from Node or the browser with a simple, typed client.

## Installation

```bash
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/types
```

**Peer dependency:** `axios` (^1.12.2) — install it if not already in your project.

## Quick start

```ts
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

```ts
interface MeapleSDKOptions {
  publicKey: string; // Channel ID (X-Channel-Id)
  baseURL: string; // e.g. https://api.meaple.com
}
```

## Utilities

```ts
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.

## Documentation

[https://docs.meaple.com.br/](https://docs.meaple.com.br/)