@canyoncode/canyonos-sdk 0.0.0-stage → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +7 -0
- package/dist/schema.d.ts +8681 -0
- package/dist/schema.js +5 -0
- package/package.json +32 -4
package/README.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# canyonos-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A typed TypeScript client for the CanyonOS REST API (`/v1`).
|
|
4
|
+
|
|
5
|
+
On Docker the API is the dashboard's, on `http://127.0.0.1:3000` unless that port was
|
|
6
|
+
taken, and every request sends the control key in `~/.canyonos/control_key`.
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install @canyoncode/canyonos-sdk
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { createClient } from '@canyoncode/canyonos-sdk';
|
|
14
|
+
|
|
15
|
+
const api = createClient('http://127.0.0.1:3000', { Authorization: 'Bearer <control key>' });
|
|
16
|
+
const { data, error } = await api.GET('/v1/workflow-groups/{workflow_group_id}', {
|
|
17
|
+
params: { path: { workflow_group_id: '<workflow_group_id>' } },
|
|
18
|
+
});
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`src/schema.ts` is generated from `packages/api/openapi.json`. After changing a `/v1`
|
|
22
|
+
route, run `bun run sdk:generate` from the repository root: it writes the spec, this
|
|
23
|
+
client's types and the CLI's types in `packages/cli/canyonos/sdk/models.py`.
|
|
24
|
+
|
|
25
|
+
## Versions
|
|
26
|
+
|
|
27
|
+
Each change to the API's shapes publishes a new `1.0.x`. A breaking change moves the API to `/v2` and the package to a new major version.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { paths } from './schema.js';
|
|
2
|
+
export type { components, operations, paths } from './schema.js';
|
|
3
|
+
/** A client for the CanyonOS API at `baseUrl`, typed by its routes, that sends `headers` with every request. */
|
|
4
|
+
export declare function createClient(baseUrl: string, headers?: HeadersInit): import("openapi-fetch").Client<paths, `${string}/${string}`>;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Canyon Code, Inc.
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
3
|
+
import createFetchClient from 'openapi-fetch';
|
|
4
|
+
/** A client for the CanyonOS API at `baseUrl`, typed by its routes, that sends `headers` with every request. */
|
|
5
|
+
export function createClient(baseUrl, headers) {
|
|
6
|
+
return createFetchClient({ baseUrl, headers });
|
|
7
|
+
}
|