A type-safe wrapper for the Webdock.io API.
Full API documentation is available at api.webdock.io
npm install @webdock/sdkpnpm install @webdock/sdkbun install @webdock/sdkWe don't like throwing errors, and to be honest, neither should you. That's why we designed this package with Go-style error handling:
import { Webdock } from "@webdock/sdk"
async function main() {
const client = new Webdock("your-token-here")
const accountInfo = await client.account.info()
if (accountInfo.success) {
console.log(accountInfo.response.body.userId)
} else {
console.error("Failed to fetch account info:", accountInfo.error)
}
}
main()import { Webdock } from "@webdock/sdk"
const client = new Webdock("your-token-here")
// Example usage with error handling
const servers = await client.servers.list()
if (servers.success) {
console.log("Servers:", servers.response.body)
} else {
console.error("Error:", servers.error)
}This package is designed for modern TypeScript projects:
- ES Modules: Works out of the box with
"type": "module"in yourpackage.json - CommonJS: If using
"type": "commonjs", add"verbatimModuleSyntax": falseto yourtsconfig.json
{
"compilerOptions": {
"verbatimModuleSyntax": false
}
}The legacy package is still available but deprecated. You can import it for existing projects:
import { oldWebdock } from "@webdock/sdk"
const pong = await oldWebdock.PingService.getPing()Note: The old package is now deprecated. Please migrate to the new SDK for continued support and updates.