@melonly-moderation/api-client
Version:
Official TypeScript client for the Melonly API with full type safety and zero dependencies (basically)
117 lines (81 loc) โข 2.55 kB
Markdown
[](https://badge.fury.io/js/%40melonly%2Fapi-client)
[](http://www.typescriptlang.org/)
[](https://opensource.org/licenses/MIT)
[](https://github.com/NoahCxrest/MelonlyTSAPIWrapper/actions)
Official TypeScript client for the Melonly API with type safety and a simple developer experience.
- **TypeScript Support** - Type definitions for all API endpoints
- **No External Dependencies**
- **Basic Error Handling**
- **Pagination Support**
```bash
npm install @melonly-moderation/api-client
```
```bash
yarn add @melonly-moderation/api-client
```
```bash
pnpm add @melonly-moderation/api-client
```
```typescript
import { MelonlyClient } from "@melonly-moderation/api-client";
const client = new MelonlyClient({
token: "your-api-token-here",
});
// Example usage
const serverInfo = await client.getServerInfo();
console.log(serverInfo);
```
```typescript
const client = new MelonlyClient({
token: "your-api-token", // Required
// baseUrl?: 'https://api.custom', // Optional
// timeout?: 30000, // Optional
// headers?: { ... } // Optional
});
```
```typescript
// Get server info
const server = await client.getServerInfo();
// List applications
const apps = await client.getApplications({ page: 1, limit: 10 });
// Get a specific application
const app = await client.getApplication("application-id");
```
Basic error handling is supported. See the API for thrown errors.
You can use environment variables for your API token:
```env
MELONLY_API_TOKEN=your-production-token-here
```
```typescript
const client = new MelonlyClient({
token: process.env.MELONLY_API_TOKEN!,
});
```
```bash
npm test
```
```bash
git clone https://github.com/NoahCxrest/MelonlyTSAPIWrapper.git
cd MelonlyTSAPIWrapper
npm install
npm run build
```
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
Made with โค๏ธ by the Melonly team