0.1.5 • Published 5d ago
@psphyo/c3-celerity-sdk
Licence
MIT
Version
0.1.5
Deps
0
Size
110 kB
Vulns
0
Weekly
817
@psphyo/c3-celerity-sdk
TypeScript SDK for the C3 CELERITY panel API (Hysteria2 + Xray VLESS control panel).
Features
- Typed client for users, nodes, groups, subscriptions, stats, sync, and auth endpoints
- Built-in retry/backoff and rate-limit handling
- One-file-per-endpoint runnable examples
- Works with Node.js 18+ (native fetch)
Installation
npm install @psphyo/c3-celerity-sdkQuick Start
import { CelerityClient } from '@psphyo/c3-celerity-sdk';
const client = new CelerityClient({
baseUrl: 'https://your-panel.example.com',
apiKey: 'ck_your_api_key_here',
});
const stats = await client.getStats();
console.log(stats);Client Configuration
const client = new CelerityClient({
baseUrl: 'https://your-panel.example.com',
apiKey: 'ck_your_api_key_here',
timeout: 30000,
retryAttempts: 3,
retryDelay: 1000,
});Endpoint Coverage
Users
listUsers(options)getUser(userId)createUser(payload)updateUser(userId, payload)deleteUser(userId)bulkDeleteUsers(userIds)enableUser(userId)disableUser(userId)addUserToGroups(userId, groupIds)removeUserFromGroup(userId, groupId)kickUser(userId)
Nodes
listNodes(options)getNode(nodeId)createNode(payload)updateNode(nodeId, payload)deleteNode(nodeId)getNodeConfig(nodeId, format)getNodeStatus(nodeId)resetNodeStatus(nodeId)getNodeUsers(nodeId)syncNode(nodeId)updateNodeConfig(nodeId, payload)setupNode(nodeId, payload)setupPortHopping(nodeId, payload)addNodeToGroups(nodeId, groupIds)removeNodeFromGroup(nodeId, groupId)getAgentInfo(nodeId)
Subscriptions
getSubscriptionInfo(token)getSubscriptionLink(token, format)
Groups
listGroups()getGroup(groupId)createGroup(payload)updateGroup(groupId, payload)deleteGroup(groupId)
Panel
getStats()syncAll()authUser(addr, auth)
Error Handling
import { HttpError, RateLimitError } from '@psphyo/c3-celerity-sdk';
try {
await client.getUser('missing-user');
} catch (error) {
if (error instanceof RateLimitError) {
console.error('Rate limited. Retry after:', error.retryAfter);
} else if (error instanceof HttpError) {
console.error(error.status, error.statusText, error.data);
}
}License
MIT