sinlyxe-api
v1.2.0
Published
Official Node.js SDK for the Sinlyxe API
Maintainers
Readme
Sinlyxe SDK
Official Node.js SDK for the Sinlyxe API.
Features
- Zero dependencies - Uses native
fetch(Node.js 18+) - Full TypeScript-like JSDoc support
- Comprehensive error handling
- Rate limit information
- Webhook signature verification
Installation
npm install sinlyxe-apiRequirements
- Node.js 18.0.0 or higher (uses native fetch)
Quick Start
import Sinlyxe from 'sinlyxe-api';
const client = new Sinlyxe('sinlyxe_your_api_key');
// Get account info
const account = await client.account.get();
console.log(`Daily commends remaining: ${account.limits.commend.daily_remaining}`);API Reference
Initialization
import Sinlyxe from 'sinlyxe-api';
// Basic usage
const client = new Sinlyxe('sinlyxe_your_api_key');
// With options
const client = new Sinlyxe('sinlyxe_your_api_key', {
timeout: 60000 // Request timeout in ms (default: 30000)
});Account
// Get account information and limits
const account = await client.account.get();
console.log(account.username);
console.log(account.limits.commend.daily_remaining);
// Get API usage statistics
const usage = await client.account.usage();
console.log(usage.total_requests);
console.log(usage.last_24h_requests);Commend Bot
// Create commend session with per-type control (recommended)
// Cost is calculated as max(friendly, teacher, leader)
const session = await client.commend.create({
steamId: '76561198123456789', // Steam ID, profile URL, or vanity URL
friendly: 50, // Number of friendly commends
teacher: 30, // Number of teacher commends
leader: 20 // Number of leader commends
});
console.log(session.session_id);
// Cost: 50 (the highest of the three)
// Legacy format (sends all 3 types with same count)
const session = await client.commend.create({
steamId: '76561198123456789',
amount: 10 // Sends 10 friendly, 10 teacher, 10 leader
});
// Get session status (includes per-type progress)
const status = await client.commend.get(session.session_id);
console.log(status.status); // 'QUEUED', 'running', 'done', 'canceled'
console.log(status.successful); // Total successful
console.log(status.friendly_completed); // Friendly commends completed
console.log(status.teacher_completed); // Teacher commends completed
console.log(status.leader_completed); // Leader commends completed
// List sessions
const sessions = await client.commend.list({
status: 'done', // Optional filter
limit: 50 // Max 100
});
// Cancel session
await client.commend.cancel(sessionId);Report Bot
// Create report session
const session = await client.report.create({
steamId: '76561198123456789'
});
// Get session status
const status = await client.report.get(session.session_id);
// List sessions
const sessions = await client.report.list({ limit: 20 });Comment Bot
// Create comment session
const session = await client.comment.create({
steamId: '76561198123456789',
amount: 5 // 1-50 comments
});
// Get session status
const status = await client.comment.get(session.session_id);
// List sessions
const sessions = await client.comment.list({ limit: 20 });
// Cancel session
await client.comment.cancel(sessionId);Hourboost - Accounts
// List all accounts
const accounts = await client.hourboost.accounts.list();
// Add new account
const account = await client.hourboost.accounts.add({
username: 'steam_user',
password: 'steam_pass',
sharedSecret: 'optional_2fa_secret' // Optional
});
// Get account details
const details = await client.hourboost.accounts.get('steam_user');
// Update account settings
await client.hourboost.accounts.update('steam_user', {
onlineStatus: true,
autoAcceptFriends: true,
receiveCommends: false,
cardFarming: false,
customGame: 'Custom Game Name',
gameListId: 123
});
// Start/Stop hourboost
await client.hourboost.accounts.start('steam_user');
await client.hourboost.accounts.stop('steam_user');
// Submit Steam Guard code (when required)
await client.hourboost.accounts.submitGuard('steam_user', '12345');
// Set game list
await client.hourboost.accounts.setGameList('steam_user', 123);
// Remove account
await client.hourboost.accounts.remove('steam_user');Hourboost - Game Lists
// List all game lists
const lists = await client.hourboost.gamelists.list();
// Create game list
const list = await client.hourboost.gamelists.create({
name: 'My Games',
games: [730, 570, 440] // CS2, Dota 2, TF2
});
// Get game list
const details = await client.hourboost.gamelists.get(listId);
// Update game list
await client.hourboost.gamelists.update(listId, {
name: 'Updated Name',
games: [730, 570, 440, 252490] // Added Rust
});
// Delete game list
await client.hourboost.gamelists.delete(listId);Error Handling
import Sinlyxe, {
SinlyxeError,
AuthError,
RateLimitError,
ValidationError,
ForbiddenError,
NotFoundError,
ConflictError,
ServiceUnavailableError
} from 'sinlyxe-api';
try {
await client.commend.create({ steamId: '...', friendly: 10, teacher: 10, leader: 10 });
} catch (error) {
if (error instanceof RateLimitError) {
console.log(`Rate limited. Retry after ${error.retryAfter} seconds`);
} else if (error instanceof AuthError) {
console.log('Invalid API key or IP not bound');
} else if (error instanceof ForbiddenError) {
console.log('Access denied:', error.message);
} else if (error instanceof ValidationError) {
console.log('Invalid input:', error.message);
} else if (error instanceof NotFoundError) {
console.log('Not found:', error.message);
} else if (error instanceof ConflictError) {
console.log('Conflict:', error.message);
} else if (error instanceof ServiceUnavailableError) {
console.log('Service unavailable:', error.message);
} else if (error instanceof SinlyxeError) {
console.log(`API Error (${error.status}): ${error.message}`);
}
}Rate Limits
The API has a rate limit of 200 requests per minute per API key. Rate limit information is available after each request:
await client.account.get();
console.log(client.rateLimit);
// {
// limit: 30,
// remaining: 29,
// reset: 1706384400 // Unix timestamp
// }Webhook Verification
When receiving webhooks, verify the signature to ensure authenticity:
import Sinlyxe from 'sinlyxe-api';
// In your webhook handler (e.g., Express)
app.post('/webhook', (req, res) => {
const signature = req.headers['x-sinlyxe-signature'];
const isValid = Sinlyxe.verifyWebhook(req.body, signature, 'your_webhook_secret');
if (!isValid) {
return res.status(401).send('Invalid signature');
}
// Process webhook
const event = req.body;
console.log('Received event:', event.type);
res.status(200).send('OK');
});License
MIT
