dlt-hub-sdk
v1.0.1
Published
JavaScript/TypeScript SDK for the unified DLT Hub API (bootcamp, mainHub, talent)
Downloads
218
Maintainers
Readme
dlt-hub-sdk
Official JavaScript client for the DLT Hub unified API. One client, three namespaces: bootcamp, mainHub, and talent.
Requirements: Node.js 18+ (native fetch) or any modern browser. Credentials (cookies) are sent by default in the browser.
Installation
npm install dlt-hub-sdkFrom the monorepo:
{
"dependencies": {
"dlt-hub-sdk": "file:../sdk"
}
}Quick start
import { createDLTHubClient, DLT_HUB_BACKEND_URL } from "dlt-hub-sdk";
const client = createDLTHubClient(DLT_HUB_BACKEND_URL, {
getAccessToken: () => localStorage.getItem("accessToken"), // optional
});
// Bootcamp
const { data } = await client.bootcamp.auth.login({ email, password });
// MainHub
await client.mainHub.newsletter.subscribe({ emailAddress });
// Talent
const talents = await client.talent.talents.getAll();API overview
| Namespace | Path | Resources |
|------------|------------------------|-----------|
| bootcamp | /api/v1/bootcamp | Auth, contact, waitlist, events, cohorts, settings |
| mainHub | /api/v1/mainHub | Ideas, newsletter, projects, testimonials |
| talent | /api/v1/talent | Talents, skills, contact (hire form) |
Bootcamp
// Auth
await client.bootcamp.auth.registerTeam({ ... });
await client.bootcamp.auth.login({ email, password });
await client.bootcamp.auth.logout();
await client.bootcamp.auth.loginStatus();
await client.bootcamp.auth.forgotPassword({ email });
await client.bootcamp.auth.resetPassword(resetToken, { password });
await client.bootcamp.auth.verifyUser(verificationToken);
await client.bootcamp.auth.getSingleTeam(); // protected
await client.bootcamp.auth.sendVerificationEmail(); // protected
// Contact
await client.bootcamp.contact.contactUs({ name, email, message });
await client.bootcamp.contact.getAll(); // protected
await client.bootcamp.contact.get(contactId);
await client.bootcamp.contact.delete(contactId);
await client.bootcamp.contact.updateStatus(contactId, { status });
// Waitlist
await client.bootcamp.waitlist.join({ name, email, phone });
await client.bootcamp.waitlist.getAll(); // protected
await client.bootcamp.waitlist.delete(id);
// Events
await client.bootcamp.events.create({ ... }); // protected
await client.bootcamp.events.getAll();
await client.bootcamp.events.get(eventId);
await client.bootcamp.events.upcoming();
await client.bootcamp.events.past();
await client.bootcamp.events.update(eventId, { ... });
await client.bootcamp.events.delete(eventId);
// Cohorts
await client.bootcamp.cohorts.studentRegister({ ... });
await client.bootcamp.cohorts.corperRegister({ ... });
await client.bootcamp.cohorts.upgradeAdmission({ ... }); // protected
await client.bootcamp.cohorts.getAllAdmissions(); // protected
await client.bootcamp.cohorts.getAllCorpers(); // protected
// Settings
await client.bootcamp.settings.getWaitlistStatus();
await client.bootcamp.settings.updateWaitlistStatus({ ... }); // protectedMainHub
// Ideas
await client.mainHub.ideas.suggest({ fullName, emailAddress, why });
await client.mainHub.ideas.getAll();
await client.mainHub.ideas.get(id);
await client.mainHub.ideas.delete(ideaId);
// Newsletter
await client.mainHub.newsletter.subscribe({ emailAddress });
await client.mainHub.newsletter.getAll();
await client.mainHub.newsletter.get(id);
await client.mainHub.newsletter.delete(subId);
// Projects
await client.mainHub.projects.register({ ... });
await client.mainHub.projects.getAll();
await client.mainHub.projects.get(id);
await client.mainHub.projects.delete(projectId);
// Testimonials
await client.mainHub.testimonials.testify({ ... });
await client.mainHub.testimonials.getAll();
await client.mainHub.testimonials.get(testyId);
await client.mainHub.testimonials.delete(testyId);Talent
// Talents
await client.talent.talents.register({ ... });
await client.talent.talents.getAll();
await client.talent.talents.get(id);
await client.talent.talents.delete(id);
// Skills
await client.talent.skills.create({ ... });
await client.talent.skills.getAll();
await client.talent.skills.update({ ... });
await client.talent.skills.delete({ ... });
// Contact (hire form)
await client.talent.contact.create({ emailAddress, talentId, companyName, calendlyLink });Client options
| Option | Description |
|--------|-------------|
| baseURL | Backend URL. Omit in the browser to use the current origin; in Node defaults to http://localhost:6000. |
| getAccessToken | () => string \| Promise<string> — Used for protected routes (adds Authorization: Bearer <token>). |
| fetch | Custom fetch implementation (e.g. for tests or Node < 18). |
Response & errors
- Success: Methods return the API payload (e.g.
{ success: true, data, message }). - HTTP errors: Thrown as an
Errorwith.status(e.g.401) and.data(parsed response body).
try {
await client.bootcamp.auth.login({ email, wrongPassword });
} catch (err) {
console.log(err.status, err.data?.message);
}Development
From the repo root:
cd sdk
node -e "import('./src/index.js').then(m => { const c = m.createDLTHubClient('http://localhost:6000'); console.log('bootcamp', Object.keys(c.bootcamp)); console.log('mainHub', Object.keys(c.mainHub)); console.log('talent', Object.keys(c.talent)); })"