gizmovsky
v1.2.1
Published
Unofficial SDK for Gizmo API
Maintainers
Readme
gizmovsky
Unofficial Node.js SDK for the Gizmo cyber-club management API — v1, v2 and v3 (operator and user scopes).
- 110 generated v3 modules, 55 v2, 21 v1 — full endpoint coverage per version
- Basic auth (operator) or bearer token (user scope
/api/user/v3/...) - Server-Sent Events stream wrapper (v3
eventStream) with typed event filters - ESM + CJS builds, TypeScript declarations, request timeout out of the box
Installation
npm install gizmovskyQuick start
import { GizmoSDK } from 'gizmovsky'
const sdk = new GizmoSDK({
ip: '127.0.0.1',
port: 80,
ssl: false,
username: 'admin',
password: 'admin',
timeout: 30000, // ms, default 30000; 0 disables
})
// v3 (current Gizmo)
const users = await sdk.v3.users.getUsers()
const hosts = await sdk.v3.hosts.getHosts()
await sdk.v3.users.postUsersByIdLogin(userId, hostId)
// v2 / v1 are also available
const products = await sdk.v2.products.getAll()Every response is the raw Gizmo envelope: { version, result, httpStatusCode, message, isError }.
User scope (bearer token)
// 1) obtain a token with the operator client
const res = await sdk.v3.auth.getUserAuthAccesstoken({ username, password })
const token = res.result.token
// 2) create a client on behalf of that user
const userSdk = new GizmoSDK({ ip, port, bearerToken: token })
const cart = await userSdk.v3.carts.getUserCart()Events (SSE)
const stream = sdk.v3.eventStream()
stream.invoiceCreated().assetCheckedOut().run((ev) => console.log(ev))
// later: stream.abort()Custom requests
Anything not covered by a generated module:
const raw = await sdk.client.request('get', '/api/v3/branches', {}, { Limit: 100 })Version compatibility
Generated from the official OpenAPI documents of each Gizmo release
(http://<server>/openapi/v3.json). Tested against Gizmo v3.0.
Endpoints present in the spec but broken server-side (a few /reports/* and
/achievements* return 500 on some builds) are Gizmo's own issues.
Contributing
Pull requests and issues are welcome. Regenerate modules with tools/generate.cjs
from a fresh OpenAPI document, then npm run build.
License
MIT
