SDK
Official Cmdop SDK for building integrations and custom applications.
Packages
| Package | Description |
|---|---|
@cmdop/sdk | Core SDK for Node.js |
@cmdop/react | React hooks and components |
Features
- Type-safe - Full TypeScript support
- Real-time - WebSocket subscriptions
- Cross-platform - Node.js and browser support
Quick Start
Installation
npm install @cmdop/sdkBasic Usage
import { Cmdop } from '@cmdop/sdk';
const client = new Cmdop({
apiKey: 'your-api-key',
});
// List machines
const machines = await client.machines.list();
// Execute command
const result = await client.commands.exec(
machineId,
'ls -la'
);React Usage
import { CmdopProvider, useMachines } from '@cmdop/react';
function App() {
return (
<CmdopProvider apiKey="your-api-key">
<MachineList />
</CmdopProvider>
);
}
function MachineList() {
const { machines, loading } = useMachines();
if (loading) return <div>Loading...</div>;
return (
<ul>
{machines.map(m => (
<li key={m.id}>{m.name}</li>
))}
</ul>
);
}