@hematite/sdk
v0.0.5
Published
Official TypeScript/JavaScript SDK for hematite
Readme
@hematite/sdk
Official TypeScript/JavaScript SDK for hematite.
Warning: This SDK is not yet ready for production use. The hematite.gg API is not yet published, and the SDK may change or break until the API is officially released.
Requirements
- Node.js 18 or higher
- A hematite token
Install
npm install @hematite/sdkUsage
import { Hematite } from "@hematite/sdk";
const hematite = new Hematite("YOUR_API_TOKEN");
// Users
const user = await hematite.users.fetch(1);
await hematite.users.edit(user, { username: "Real_Filip" });
// Images
const image = await hematite.images.fetch(1234);
await hematite.images.edit(image, { title: "New Title", description: "New Description" });
// Badges
const badges = await hematite.badges.fetch();
for (const badge of badges.values()) {
console.log(badge.name, badge.url);
}API overview
| Export | Description |
| ------------------------ | ----------------------------------- |
| Hematite | Main client; accepts an API token. |
| hematite.users | User manager (fetch, edit, cache). |
| hematite.images | Image manager (fetch, edit, cache). |
| hematite.badges | Badge manager (fetch, cache). |
| hematite.api | Low-level generated API client. |
| User, Image, Badge | Structure classes. |
| CDN_BASE_URL | CDN base URL constant. |
License
See LICENSE. Use of this SDK is permitted only for integrating with hematite.gg.
