@leaflow/sdk 0.0.0-dev.13.g732c6b7 → 0.0.0-dev.130.g2ad4b23
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 +22 -12
- package/dist/account/v1/index.d.ts +14 -2
- package/dist/account/v1/schema.d.ts +368 -81
- package/dist/assistant/v1/index.d.ts +30 -2
- package/dist/assistant/v1/schema.d.ts +1089 -133
- package/dist/billing/v1/index.d.ts +192 -0
- package/dist/billing/v1/index.js +5 -0
- package/dist/billing/v1/schema.d.ts +4625 -0
- package/dist/billing/v1/schema.js +5 -0
- package/dist/canopy/v1/schema.d.ts +113 -109
- package/dist/compute/v1/index.d.ts +30 -6
- package/dist/compute/v1/schema.d.ts +1202 -273
- package/dist/dns/v1/index.d.ts +42 -0
- package/dist/dns/v1/index.js +5 -0
- package/dist/dns/v1/schema.d.ts +887 -0
- package/dist/dns/v1/schema.js +5 -0
- package/dist/fleet/v1/index.d.ts +6 -0
- package/dist/fleet/v1/index.js +5 -0
- package/dist/fleet/v1/schema.d.ts +156 -0
- package/dist/fleet/v1/schema.js +5 -0
- package/dist/iam/v1/index.d.ts +26 -4
- package/dist/iam/v1/schema.d.ts +515 -88
- package/dist/index.d.ts +5 -0
- package/dist/monitoring/v1/index.d.ts +84 -4
- package/dist/monitoring/v1/schema.d.ts +2420 -527
- package/dist/notification/v1/index.d.ts +76 -0
- package/dist/notification/v1/index.js +5 -0
- package/dist/notification/v1/schema.d.ts +2048 -0
- package/dist/notification/v1/schema.js +5 -0
- package/dist/support/v1/index.d.ts +50 -0
- package/dist/support/v1/index.js +5 -0
- package/dist/support/v1/schema.d.ts +1082 -0
- package/dist/support/v1/schema.js +5 -0
- package/dist/tunnel/v1/index.d.ts +14 -36
- package/dist/tunnel/v1/schema.d.ts +70 -510
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
# leaflow-ts
|
|
2
2
|
|
|
3
|
-
Leaflow 平台的 TypeScript SDK(`@leaflow/sdk`)
|
|
4
|
-
|
|
3
|
+
Leaflow 平台的 TypeScript SDK(`@leaflow/sdk`),由
|
|
4
|
+
[leaflowapis](https://github.com/leaflowapis/leaflowapis) 生成。
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
```
|
|
7
|
+
npm i @leaflow/sdk openapi-fetch
|
|
8
|
+
```
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
npm 要 `v1.2.3`——上一版两者挤在一个仓库里,结果是 Go 那半从来没被正确发布过,而没有任何东西
|
|
10
|
-
会报错(`go get` 只是拿不到)。
|
|
10
|
+
当前只含类型。请求由 `openapi-fetch` 发出,路径与参数由契约约束。
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
```ts
|
|
13
|
+
import createClient from 'openapi-fetch';
|
|
14
|
+
import type { compute } from '@leaflow/sdk';
|
|
13
15
|
|
|
16
|
+
const api = createClient<compute.paths>({
|
|
17
|
+
baseUrl: 'https://compute.leaflow.cloud',
|
|
18
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const { data, error } = await api.GET('/api/v1/instances', {
|
|
22
|
+
params: { query: { limit: 20 } },
|
|
23
|
+
});
|
|
14
24
|
```
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
|
|
26
|
+
每个操作另有 `<操作>Result` / `<操作>Body` / `<操作>Query` 三个类型别名。
|
|
27
|
+
|
|
28
|
+
## 重新生成
|
|
17
29
|
|
|
18
30
|
```
|
|
19
|
-
git submodule update --remote leaflowapis # 要跟进新契约时才做
|
|
20
31
|
npm run generate
|
|
21
32
|
```
|
|
22
33
|
|
|
23
|
-
|
|
24
|
-
重试或者强推——前者会打架,后者会丢东西。
|
|
34
|
+
契约版本记在 `CONTRACTS_REF`。
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export type { paths, components, operations, webhooks } from "./schema.js";
|
|
2
2
|
import type { operations } from "./schema.js";
|
|
3
|
+
/** `GET /account/v1/settings` 成功时的响应体。 */
|
|
4
|
+
export type GetSettingsResult = operations["get-settings"]["responses"][200]["content"]["application/json"];
|
|
5
|
+
/** `GET /account/v1/locales` 成功时的响应体。 */
|
|
6
|
+
export type ListLocalesResult = operations["list-locales"]["responses"][200]["content"]["application/json"];
|
|
3
7
|
/** `GET /account/v1/agreements` 成功时的响应体。 */
|
|
4
8
|
export type ListAgreementsResult = operations["list-agreements"]["responses"][200]["content"]["application/json"];
|
|
5
9
|
/** `GET /account/v1/me/consents` 成功时的响应体。 */
|
|
@@ -14,6 +18,10 @@ export type RegisterResult = operations["register"]["responses"][201]["content"]
|
|
|
14
18
|
export type RegisterBody = NonNullable<operations["register"]["requestBody"]>["content"]["application/json"];
|
|
15
19
|
/** `GET /account/v1/me` 成功时的响应体。 */
|
|
16
20
|
export type GetAccountResult = operations["get-account"]["responses"][200]["content"]["application/json"];
|
|
21
|
+
/** `PATCH /account/v1/me` 成功时的响应体。 */
|
|
22
|
+
export type UpdateAccountResult = operations["update-account"]["responses"][200]["content"]["application/json"];
|
|
23
|
+
/** `PATCH /account/v1/me` 的请求体。 */
|
|
24
|
+
export type UpdateAccountBody = NonNullable<operations["update-account"]["requestBody"]>["content"]["application/json"];
|
|
17
25
|
/** `GET /account/v1/me/identity-verification` 成功时的响应体。 */
|
|
18
26
|
export type GetIdentityVerificationResult = operations["get-identity-verification"]["responses"][200]["content"]["application/json"];
|
|
19
27
|
/** `POST /account/v1/me/identity-verification` 成功时的响应体。 */
|
|
@@ -24,6 +32,10 @@ export type SubmitIdentityVerificationBody = NonNullable<operations["submit-iden
|
|
|
24
32
|
export type ListMyInvitationsResult = operations["list-my-invitations"]["responses"][200]["content"]["application/json"];
|
|
25
33
|
/** `GET /account/v1/me/invitations` 的查询参数。 */
|
|
26
34
|
export type ListMyInvitationsQuery = operations["list-my-invitations"]["parameters"]["query"];
|
|
35
|
+
/** `GET /account/v1/invitations/by-token` 成功时的响应体。 */
|
|
36
|
+
export type PreviewInvitationByTokenResult = operations["preview-invitation-by-token"]["responses"][200]["content"]["application/json"];
|
|
37
|
+
/** `GET /account/v1/invitations/by-token` 的查询参数。 */
|
|
38
|
+
export type PreviewInvitationByTokenQuery = operations["preview-invitation-by-token"]["parameters"]["query"];
|
|
27
39
|
/** `POST /account/v1/me/invitations/accept` 成功时的响应体。 */
|
|
28
40
|
export type AcceptInvitationByTokenResult = operations["accept-invitation-by-token"]["responses"][200]["content"]["application/json"];
|
|
29
41
|
/** `POST /account/v1/me/invitations/accept` 的请求体。 */
|
|
@@ -38,5 +50,5 @@ export type ListProjectsQuery = operations["list-projects"]["parameters"]["query
|
|
|
38
50
|
export type CreateProjectResult = operations["create-project"]["responses"][201]["content"]["application/json"];
|
|
39
51
|
/** `POST /account/v1/projects` 的请求体。 */
|
|
40
52
|
export type CreateProjectBody = NonNullable<operations["create-project"]["requestBody"]>["content"]["application/json"];
|
|
41
|
-
/** `POST /account/v1/projects/{projectId}/
|
|
42
|
-
export type
|
|
53
|
+
/** `POST /account/v1/projects/{projectId}/scoped-tokens` 成功时的响应体。 */
|
|
54
|
+
export type CreateScopedTokenResult = operations["create-scoped-token"]["responses"][201]["content"]["application/json"];
|