Files
api/readme.md
T

35 lines
737 B
Markdown
Raw Normal View History

2026-04-25 14:57:58 +00:00
# @serve.zone/api
Type-safe API client for Cloudly and the serve.zone control plane.
## Install
```bash
pnpm add @serve.zone/api
```
## Usage
```typescript
import { CloudlyApiClient } from '@serve.zone/api';
const client = new CloudlyApiClient({
registerAs: 'api',
cloudlyUrl: 'https://cloudly.example.com:443',
});
await client.start();
const identity = await client.getIdentityByToken('service-token', {
tagConnection: true,
statefullIdentity: true,
});
const clusterConfig = await client.getClusterConfigFromCloudlyByIdentity(identity);
```
## Notes
- The client uses TypedSocket for WebSocket RPC and TypedRequest for HTTP fallback in selected methods.
- Shared contracts are provided by `@serve.zone/interfaces`.