DITO TypeScript SDK
The official TypeScript SDK for building applications with the DITO talent discovery platform. Perfect for web applications, Node.js servers, and AI agent integrations.
Installation
Install the DITO SDK using your preferred package manager:
npm
npm install @dito/sdk
yarn
yarn add @dito/sdk
pnpm
pnpm add @dito/sdk
Quick Start
Get started with the DITO SDK in just a few lines of code:
import { DitoClient } from '@dito/sdk';
// Initialize the client
const dito = new DitoClient({
apiKey: 'your-api-key',
baseURL: 'https://api.dito.guru'
});
// Get user's soul information
const soul = await dito.souls.getSoul();
console.log(`Welcome ${soul.seeker_name}! Your stage: ${soul.current_level}`);
// Start a talent journey
const journey = await dito.talents.startJourney('Programming');
console.log(`Journey started: ${journey.talent_label}`);
Configuration
Configure the SDK with your API credentials and preferences:
import { DitoClient, DitoConfig } from '@dito/sdk';
const config: DitoConfig = {
apiKey: process.env.DITO_API_KEY!,
baseURL: 'https://api.dito.guru',
timeout: 10000,
retries: 3,
retryDelay: 1000,
enableLogging: true
};
const dito = new DitoClient(config);
Environment Variables
Set up your environment variables for secure configuration:
DITO_API_KEY=your-api-key-here
DITO_BASE_URL=https://api.dito.guru
DITO_ENABLE_LOGGING=true
Authentication
The DITO SDK supports multiple authentication methods:
// Using API Key (Recommended for server-side)
const dito = new DitoClient({
apiKey: 'your-api-key',
baseURL: 'https://api.dito.guru'
});
// Using JWT Token (For user-specific operations)
const dito = new DitoClient({
jwt: 'your-jwt-token',
baseURL: 'https://api.dito.guru'
});
// Setting up 2FA for enhanced security
const twoFA = await dito.auth.setup2FA();
console.log('Scan this QR code:', twoFA.qr_code_url);
// Verify 2FA token
await dito.auth.verify2FA('123456');
Soul Management
Create and manage digital souls representing unique talents:
Get Current Soul
const soul = await dito.souls.getSoul();
console.log(soul.seeker_name, soul.current_level, soul.ember_points);
Update Soul Stage
await dito.souls.updateStage('blazing');
console.log('Soul evolved to blazing stage!');
Available Methods
| Method | Description | Returns |
|---|---|---|
getSoul() |
Get current user's soul information | Soul |
updateSoul(data) |
Update soul information | Soul |
deleteSoul() |
Delete current soul (requires 2FA) | boolean |
Talent System
Discover, develop, and validate talents through the DITO ecosystem:
List Available Talents
const talents = await dito.talents.listTalents();
talents.forEach(talent => {
console.log(`${talent.label}: ${talent.progress}% complete`);
});
Start Talent Journey
const journey = await dito.talents.startJourney('Web Development', {
description: 'Learning modern web development skills',
evidence: 'GitHub portfolio: https://github.com/user/portfolio'
});
console.log(`Journey ID: ${journey.talent_id}`);
Arena Events
Participate in competitive talent showcases and community events:
Get Active Events
const events = await dito.arena.getEvents();
console.log(`${events.length} active arena events`);
events.forEach(event => {
console.log(`${event.title}: ${event.participants.length} participants`);
});
Join Arena Event
await dito.arena.joinEvent('coding-challenge-2026');
console.log('Successfully joined coding challenge!');
Ember Economy
Interact with DITO's token economy for talent validation and rewards:
Check Ember Balance
const balance = await dito.ember.getBalance();
console.log(`Current balance: ${balance.balance} EMBER`);
Transfer Ember
await dito.ember.transfer({
recipientId: 'soul-12345',
amount: 100,
note: 'Great mentoring session!'
});
console.log('Ember transferred successfully!');
Error Handling
The SDK provides comprehensive error handling with typed error responses:
import { DitoError, DitoApiError } from '@dito/sdk';
try {
const soul = await dito.souls.getSoul();
} catch (error) {
if (error instanceof DitoApiError) {
console.error(`API Error ${error.statusCode}: ${error.message}`);
console.error(`Error Code: ${error.code}`);
} else if (error instanceof DitoError) {
console.error(`SDK Error: ${error.message}`);
} else {
console.error('Unexpected error:', error);
}
}
TypeScript Support
The SDK is built with TypeScript and provides full type safety:
import { Soul, Talent, ArenaEvent, EmberTransaction } from '@dito/sdk';
// All API responses are fully typed
const soul: Soul = await dito.souls.getSoul();
const talents: Talent[] = await dito.talents.listTalents();
const events: ArenaEvent[] = await dito.arena.getEvents();
// Type-safe configuration
const config: DitoConfig = {
apiKey: 'your-key',
timeout: 5000,
retries: 3
};