feat: extract cloudly api client
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
# @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`.
|
||||
Reference in New Issue
Block a user