@b3os/sdk 0.0.0-stage → 0.0.1
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/LICENSE +202 -0
- package/README.md +233 -2
- package/dist/cjs/core/client.d.ts +165 -0
- package/dist/cjs/core/client.js +825 -0
- package/dist/cjs/core/client.js.map +1 -0
- package/dist/cjs/core/errors.d.ts +101 -0
- package/dist/cjs/core/errors.js +249 -0
- package/dist/cjs/core/errors.js.map +1 -0
- package/dist/cjs/core/index.d.ts +12 -0
- package/dist/cjs/core/index.js +42 -0
- package/dist/cjs/core/index.js.map +1 -0
- package/dist/cjs/core/jobs.d.ts +31 -0
- package/dist/cjs/core/jobs.js +72 -0
- package/dist/cjs/core/jobs.js.map +1 -0
- package/dist/cjs/core/namespace.d.ts +7 -0
- package/dist/cjs/core/namespace.js +13 -0
- package/dist/cjs/core/namespace.js.map +1 -0
- package/dist/cjs/core/op.d.ts +47 -0
- package/dist/cjs/core/op.js +5 -0
- package/dist/cjs/core/op.js.map +1 -0
- package/dist/cjs/core/promise.d.ts +106 -0
- package/dist/cjs/core/promise.js +200 -0
- package/dist/cjs/core/promise.js.map +1 -0
- package/dist/cjs/core/response.d.ts +54 -0
- package/dist/cjs/core/response.js +92 -0
- package/dist/cjs/core/response.js.map +1 -0
- package/dist/cjs/core/sse.d.ts +79 -0
- package/dist/cjs/core/sse.js +291 -0
- package/dist/cjs/core/sse.js.map +1 -0
- package/dist/cjs/core/timing.d.ts +20 -0
- package/dist/cjs/core/timing.js +96 -0
- package/dist/cjs/core/timing.js.map +1 -0
- package/dist/cjs/core/transport.d.ts +80 -0
- package/dist/cjs/core/transport.js +472 -0
- package/dist/cjs/core/transport.js.map +1 -0
- package/dist/cjs/core/util.d.ts +25 -0
- package/dist/cjs/core/util.js +142 -0
- package/dist/cjs/core/util.js.map +1 -0
- package/dist/cjs/core/ws.d.ts +52 -0
- package/dist/cjs/core/ws.js +181 -0
- package/dist/cjs/core/ws.js.map +1 -0
- package/dist/cjs/generated/client.d.ts +62 -0
- package/dist/cjs/generated/client.js +130 -0
- package/dist/cjs/generated/client.js.map +1 -0
- package/dist/cjs/generated/errors.d.ts +4 -0
- package/dist/cjs/generated/errors.js +160 -0
- package/dist/cjs/generated/errors.js.map +1 -0
- package/dist/cjs/generated/ids.d.ts +114 -0
- package/dist/cjs/generated/ids.js +47 -0
- package/dist/cjs/generated/ids.js.map +1 -0
- package/dist/cjs/generated/jobs.d.ts +10 -0
- package/dist/cjs/generated/jobs.js +24 -0
- package/dist/cjs/generated/jobs.js.map +1 -0
- package/dist/cjs/generated/ns/actions.d.ts +161 -0
- package/dist/cjs/generated/ns/actions.js +304 -0
- package/dist/cjs/generated/ns/actions.js.map +1 -0
- package/dist/cjs/generated/ns/infer.d.ts +190 -0
- package/dist/cjs/generated/ns/infer.js +253 -0
- package/dist/cjs/generated/ns/infer.js.map +1 -0
- package/dist/cjs/generated/ns/keys.d.ts +76 -0
- package/dist/cjs/generated/ns/keys.js +144 -0
- package/dist/cjs/generated/ns/keys.js.map +1 -0
- package/dist/cjs/generated/ns/limits.d.ts +22 -0
- package/dist/cjs/generated/ns/limits.js +32 -0
- package/dist/cjs/generated/ns/limits.js.map +1 -0
- package/dist/cjs/generated/ns/orgs.d.ts +38 -0
- package/dist/cjs/generated/ns/orgs.js +68 -0
- package/dist/cjs/generated/ns/orgs.js.map +1 -0
- package/dist/cjs/generated/ns/projects.d.ts +57 -0
- package/dist/cjs/generated/ns/projects.js +115 -0
- package/dist/cjs/generated/ns/projects.js.map +1 -0
- package/dist/cjs/generated/ns/render.d.ts +159 -0
- package/dist/cjs/generated/ns/render.js +299 -0
- package/dist/cjs/generated/ns/render.js.map +1 -0
- package/dist/cjs/generated/ns/requests.d.ts +36 -0
- package/dist/cjs/generated/ns/requests.js +54 -0
- package/dist/cjs/generated/ns/requests.js.map +1 -0
- package/dist/cjs/generated/ns/routines.d.ts +212 -0
- package/dist/cjs/generated/ns/routines.js +419 -0
- package/dist/cjs/generated/ns/routines.js.map +1 -0
- package/dist/cjs/generated/ns/sandboxes.d.ts +318 -0
- package/dist/cjs/generated/ns/sandboxes.js +549 -0
- package/dist/cjs/generated/ns/sandboxes.js.map +1 -0
- package/dist/cjs/generated/ns/usage.d.ts +30 -0
- package/dist/cjs/generated/ns/usage.js +49 -0
- package/dist/cjs/generated/ns/usage.js.map +1 -0
- package/dist/cjs/generated/ns/vault.d.ts +69 -0
- package/dist/cjs/generated/ns/vault.js +122 -0
- package/dist/cjs/generated/ns/vault.js.map +1 -0
- package/dist/cjs/generated/ns/vision.d.ts +376 -0
- package/dist/cjs/generated/ns/vision.js +736 -0
- package/dist/cjs/generated/ns/vision.js.map +1 -0
- package/dist/cjs/generated/ns/webhooks.d.ts +50 -0
- package/dist/cjs/generated/ns/webhooks.js +91 -0
- package/dist/cjs/generated/ns/webhooks.js.map +1 -0
- package/dist/cjs/generated/types.d.ts +4613 -0
- package/dist/cjs/generated/types.js +4 -0
- package/dist/cjs/generated/types.js.map +1 -0
- package/dist/cjs/index.d.ts +22 -0
- package/dist/cjs/index.js +81 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/webhooks.d.ts +19 -0
- package/dist/cjs/webhooks.js +85 -0
- package/dist/cjs/webhooks.js.map +1 -0
- package/dist/esm/core/client.d.ts +165 -0
- package/dist/esm/core/client.js +821 -0
- package/dist/esm/core/client.js.map +1 -0
- package/dist/esm/core/errors.d.ts +101 -0
- package/dist/esm/core/errors.js +239 -0
- package/dist/esm/core/errors.js.map +1 -0
- package/dist/esm/core/index.d.ts +12 -0
- package/dist/esm/core/index.js +15 -0
- package/dist/esm/core/index.js.map +1 -0
- package/dist/esm/core/jobs.d.ts +31 -0
- package/dist/esm/core/jobs.js +66 -0
- package/dist/esm/core/jobs.js.map +1 -0
- package/dist/esm/core/namespace.d.ts +7 -0
- package/dist/esm/core/namespace.js +9 -0
- package/dist/esm/core/namespace.js.map +1 -0
- package/dist/esm/core/op.d.ts +47 -0
- package/dist/esm/core/op.js +4 -0
- package/dist/esm/core/op.js.map +1 -0
- package/dist/esm/core/promise.d.ts +106 -0
- package/dist/esm/core/promise.js +193 -0
- package/dist/esm/core/promise.js.map +1 -0
- package/dist/esm/core/response.d.ts +54 -0
- package/dist/esm/core/response.js +86 -0
- package/dist/esm/core/response.js.map +1 -0
- package/dist/esm/core/sse.d.ts +79 -0
- package/dist/esm/core/sse.js +286 -0
- package/dist/esm/core/sse.js.map +1 -0
- package/dist/esm/core/timing.d.ts +20 -0
- package/dist/esm/core/timing.js +92 -0
- package/dist/esm/core/timing.js.map +1 -0
- package/dist/esm/core/transport.d.ts +80 -0
- package/dist/esm/core/transport.js +465 -0
- package/dist/esm/core/transport.js.map +1 -0
- package/dist/esm/core/util.d.ts +25 -0
- package/dist/esm/core/util.js +128 -0
- package/dist/esm/core/util.js.map +1 -0
- package/dist/esm/core/ws.d.ts +52 -0
- package/dist/esm/core/ws.js +175 -0
- package/dist/esm/core/ws.js.map +1 -0
- package/dist/esm/generated/client.d.ts +62 -0
- package/dist/esm/generated/client.js +126 -0
- package/dist/esm/generated/client.js.map +1 -0
- package/dist/esm/generated/errors.d.ts +4 -0
- package/dist/esm/generated/errors.js +157 -0
- package/dist/esm/generated/errors.js.map +1 -0
- package/dist/esm/generated/ids.d.ts +114 -0
- package/dist/esm/generated/ids.js +42 -0
- package/dist/esm/generated/ids.js.map +1 -0
- package/dist/esm/generated/jobs.d.ts +10 -0
- package/dist/esm/generated/jobs.js +21 -0
- package/dist/esm/generated/jobs.js.map +1 -0
- package/dist/esm/generated/ns/actions.d.ts +161 -0
- package/dist/esm/generated/ns/actions.js +300 -0
- package/dist/esm/generated/ns/actions.js.map +1 -0
- package/dist/esm/generated/ns/infer.d.ts +190 -0
- package/dist/esm/generated/ns/infer.js +249 -0
- package/dist/esm/generated/ns/infer.js.map +1 -0
- package/dist/esm/generated/ns/keys.d.ts +76 -0
- package/dist/esm/generated/ns/keys.js +140 -0
- package/dist/esm/generated/ns/keys.js.map +1 -0
- package/dist/esm/generated/ns/limits.d.ts +22 -0
- package/dist/esm/generated/ns/limits.js +28 -0
- package/dist/esm/generated/ns/limits.js.map +1 -0
- package/dist/esm/generated/ns/orgs.d.ts +38 -0
- package/dist/esm/generated/ns/orgs.js +64 -0
- package/dist/esm/generated/ns/orgs.js.map +1 -0
- package/dist/esm/generated/ns/projects.d.ts +57 -0
- package/dist/esm/generated/ns/projects.js +111 -0
- package/dist/esm/generated/ns/projects.js.map +1 -0
- package/dist/esm/generated/ns/render.d.ts +159 -0
- package/dist/esm/generated/ns/render.js +295 -0
- package/dist/esm/generated/ns/render.js.map +1 -0
- package/dist/esm/generated/ns/requests.d.ts +36 -0
- package/dist/esm/generated/ns/requests.js +50 -0
- package/dist/esm/generated/ns/requests.js.map +1 -0
- package/dist/esm/generated/ns/routines.d.ts +212 -0
- package/dist/esm/generated/ns/routines.js +415 -0
- package/dist/esm/generated/ns/routines.js.map +1 -0
- package/dist/esm/generated/ns/sandboxes.d.ts +318 -0
- package/dist/esm/generated/ns/sandboxes.js +545 -0
- package/dist/esm/generated/ns/sandboxes.js.map +1 -0
- package/dist/esm/generated/ns/usage.d.ts +30 -0
- package/dist/esm/generated/ns/usage.js +45 -0
- package/dist/esm/generated/ns/usage.js.map +1 -0
- package/dist/esm/generated/ns/vault.d.ts +69 -0
- package/dist/esm/generated/ns/vault.js +118 -0
- package/dist/esm/generated/ns/vault.js.map +1 -0
- package/dist/esm/generated/ns/vision.d.ts +376 -0
- package/dist/esm/generated/ns/vision.js +732 -0
- package/dist/esm/generated/ns/vision.js.map +1 -0
- package/dist/esm/generated/ns/webhooks.d.ts +50 -0
- package/dist/esm/generated/ns/webhooks.js +87 -0
- package/dist/esm/generated/ns/webhooks.js.map +1 -0
- package/dist/esm/generated/types.d.ts +4613 -0
- package/dist/esm/generated/types.js +3 -0
- package/dist/esm/generated/types.js.map +1 -0
- package/dist/esm/index.d.ts +22 -0
- package/dist/esm/index.js +28 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/webhooks.d.ts +19 -0
- package/dist/esm/webhooks.js +79 -0
- package/dist/esm/webhooks.js.map +1 -0
- package/package.json +98 -4
- package/src/core/client.ts +1022 -0
- package/src/core/errors.ts +296 -0
- package/src/core/index.ts +45 -0
- package/src/core/jobs.ts +94 -0
- package/src/core/namespace.ts +10 -0
- package/src/core/op.ts +53 -0
- package/src/core/promise.ts +268 -0
- package/src/core/response.ts +115 -0
- package/src/core/sse.ts +305 -0
- package/src/core/timing.ts +106 -0
- package/src/core/transport.ts +489 -0
- package/src/core/util.ts +138 -0
- package/src/core/ws.ts +215 -0
- package/src/generated/client.ts +143 -0
- package/src/generated/errors.ts +313 -0
- package/src/generated/ids.ts +47 -0
- package/src/generated/jobs.ts +25 -0
- package/src/generated/ns/actions.ts +353 -0
- package/src/generated/ns/infer.ts +332 -0
- package/src/generated/ns/keys.ts +152 -0
- package/src/generated/ns/limits.ts +35 -0
- package/src/generated/ns/orgs.ts +77 -0
- package/src/generated/ns/projects.ts +122 -0
- package/src/generated/ns/render.ts +348 -0
- package/src/generated/ns/requests.ts +61 -0
- package/src/generated/ns/routines.ts +474 -0
- package/src/generated/ns/sandboxes.ts +671 -0
- package/src/generated/ns/usage.ts +56 -0
- package/src/generated/ns/vault.ts +136 -0
- package/src/generated/ns/vision.ts +836 -0
- package/src/generated/ns/webhooks.ts +100 -0
- package/src/generated/types.ts +5131 -0
- package/src/index.ts +30 -0
- package/src/webhooks.ts +100 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// Generated by packages/sdk/scripts/generate.mjs from packages/spec/dist. Do not edit; run `pnpm generate`.
|
|
2
|
+
|
|
3
|
+
import type { RequestOptions } from "../../core/client.ts";
|
|
4
|
+
import { Namespace } from "../../core/namespace.ts";
|
|
5
|
+
import type { Op } from "../../core/op.ts";
|
|
6
|
+
import type { APIPromise, ListPromise } from "../../core/promise.ts";
|
|
7
|
+
import type * as T from "../types.ts";
|
|
8
|
+
|
|
9
|
+
const listKeysOp: Op = {
|
|
10
|
+
id: "platformListKeys",
|
|
11
|
+
method: "GET",
|
|
12
|
+
path: "/v1/keys",
|
|
13
|
+
edge: true,
|
|
14
|
+
timeoutMs: 10000,
|
|
15
|
+
scope: "platform:read",
|
|
16
|
+
};
|
|
17
|
+
const createKeyOp: Op = {
|
|
18
|
+
id: "platformCreateKey",
|
|
19
|
+
method: "POST",
|
|
20
|
+
path: "/v1/keys",
|
|
21
|
+
body: "json",
|
|
22
|
+
edge: true,
|
|
23
|
+
idem: true,
|
|
24
|
+
timeoutMs: 10000,
|
|
25
|
+
scope: "platform:write",
|
|
26
|
+
};
|
|
27
|
+
const getCurrentKeyOp: Op = {
|
|
28
|
+
id: "platformGetCurrentKey",
|
|
29
|
+
method: "GET",
|
|
30
|
+
path: "/v1/keys/current",
|
|
31
|
+
edge: true,
|
|
32
|
+
timeoutMs: 5000,
|
|
33
|
+
scope: "authenticated",
|
|
34
|
+
};
|
|
35
|
+
const revokeKeyOp: Op = {
|
|
36
|
+
id: "platformRevokeKey",
|
|
37
|
+
method: "DELETE",
|
|
38
|
+
path: "/v1/keys/{key_id}",
|
|
39
|
+
params: ["key_id"],
|
|
40
|
+
edge: true,
|
|
41
|
+
timeoutMs: 10000,
|
|
42
|
+
scope: "platform:write",
|
|
43
|
+
};
|
|
44
|
+
const getKeyOp: Op = {
|
|
45
|
+
id: "platformGetKey",
|
|
46
|
+
method: "GET",
|
|
47
|
+
path: "/v1/keys/{key_id}",
|
|
48
|
+
params: ["key_id"],
|
|
49
|
+
edge: true,
|
|
50
|
+
timeoutMs: 10000,
|
|
51
|
+
scope: "platform:read",
|
|
52
|
+
};
|
|
53
|
+
const updateKeyOp: Op = {
|
|
54
|
+
id: "platformUpdateKey",
|
|
55
|
+
method: "PATCH",
|
|
56
|
+
path: "/v1/keys/{key_id}",
|
|
57
|
+
params: ["key_id"],
|
|
58
|
+
body: "json",
|
|
59
|
+
edge: true,
|
|
60
|
+
timeoutMs: 10000,
|
|
61
|
+
scope: "platform:write",
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** Descriptors of every keys operation, keyed by method name (for tooling and custom clients). */
|
|
65
|
+
export const keysOps = {
|
|
66
|
+
listKeys: listKeysOp,
|
|
67
|
+
createKey: createKeyOp,
|
|
68
|
+
getCurrentKey: getCurrentKeyOp,
|
|
69
|
+
revokeKey: revokeKeyOp,
|
|
70
|
+
getKey: getKeyOp,
|
|
71
|
+
updateKey: updateKeyOp,
|
|
72
|
+
} as const;
|
|
73
|
+
|
|
74
|
+
/** API keys (`/v1/keys`; served by beta-api.b3os.org). */
|
|
75
|
+
export class KeysAPI extends Namespace {
|
|
76
|
+
/**
|
|
77
|
+
* List API keys
|
|
78
|
+
*
|
|
79
|
+
* Lists the organization's API keys and CLI tokens (secrets are never returned), newest first. `kind` tells
|
|
80
|
+
* them apart; revoke a lost CLI token like any key.
|
|
81
|
+
*
|
|
82
|
+
* `GET /v1/keys` · scope `platform:read` · served by beta-api.b3os.org
|
|
83
|
+
*/
|
|
84
|
+
listKeys(params?: T.PlatformListKeysParams, options?: RequestOptions): ListPromise<T.ApiKeyList, T.ApiKey> {
|
|
85
|
+
return this._client._list<T.ApiKeyList, T.ApiKey>(listKeysOp, { query: params }, options);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Create an API key
|
|
90
|
+
*
|
|
91
|
+
* Creates a key in your project (or `project`, in the same organization). `scopes` and `spend_cap_usd` may not
|
|
92
|
+
* exceed the caller's own, and when the caller expires, `expires_at` must be set and no later than the caller's
|
|
93
|
+
* expiry (`forbidden`, reason `scope_escalation`). The response is the only time `secret` is returned.
|
|
94
|
+
*
|
|
95
|
+
* `POST /v1/keys` · scope `platform:write` · served by beta-api.b3os.org
|
|
96
|
+
*/
|
|
97
|
+
createKey(body: T.ApiKeyCreateRequest, options?: RequestOptions): APIPromise<T.ApiKeyWithSecret> {
|
|
98
|
+
return this._client._call<T.ApiKeyWithSecret>(createKeyOp, { body }, options);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Describe the calling credential
|
|
103
|
+
*
|
|
104
|
+
* Returns who is calling: the key or CLI token (or dashboard session, or sandbox), its organization and
|
|
105
|
+
* project, scopes, spend cap and expiry. Any valid credential may call it, whatever its scopes.
|
|
106
|
+
*
|
|
107
|
+
* `GET /v1/keys/current` · scope `authenticated` · served by beta-api.b3os.org
|
|
108
|
+
*/
|
|
109
|
+
getCurrentKey(options?: RequestOptions): APIPromise<T.CurrentPrincipal> {
|
|
110
|
+
return this._client._call<T.CurrentPrincipal>(getCurrentKeyOp, {}, options);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Revoke an API key
|
|
115
|
+
*
|
|
116
|
+
* Revokes the key. The operations the edge answers itself refuse it at once; every other request refuses it
|
|
117
|
+
* within 10 seconds (the edge keeps a key's record at most 10 seconds after reading it from its primary
|
|
118
|
+
* database, and never reads keys from a replica). The edge also pushes the revocation to nodes, so open
|
|
119
|
+
* streams authenticated by it close within 60 seconds. Routines published with it pause their triggers.
|
|
120
|
+
* Returns the revoked key; it stays listed for audit. Changes made with `PATCH /v1/keys/{key_id}` take effect
|
|
121
|
+
* within the same 10 seconds.
|
|
122
|
+
*
|
|
123
|
+
* `DELETE /v1/keys/{key_id}` · scope `platform:write` · served by beta-api.b3os.org
|
|
124
|
+
*/
|
|
125
|
+
revokeKey(keyId: string, options?: RequestOptions): APIPromise<T.ApiKey> {
|
|
126
|
+
return this._client._call<T.ApiKey>(revokeKeyOp, { path: [keyId] }, options);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Get an API key
|
|
131
|
+
*
|
|
132
|
+
* Returns one key's metadata, spend this period and last use. The secret is never returned.
|
|
133
|
+
*
|
|
134
|
+
* `GET /v1/keys/{key_id}` · scope `platform:read` · served by beta-api.b3os.org
|
|
135
|
+
*/
|
|
136
|
+
getKey(keyId: string, options?: RequestOptions): APIPromise<T.ApiKey> {
|
|
137
|
+
return this._client._call<T.ApiKey>(getKeyOp, { path: [keyId] }, options);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Update an API key
|
|
142
|
+
*
|
|
143
|
+
* Renames a key or changes its spend cap, expiry or metadata. Scopes cannot change; create a new key instead.
|
|
144
|
+
* A caller with a spend cap or an expiry cannot set a larger cap or a later (or no) expiry than its own
|
|
145
|
+
* (`forbidden`, reason `scope_escalation`).
|
|
146
|
+
*
|
|
147
|
+
* `PATCH /v1/keys/{key_id}` · scope `platform:write` · served by beta-api.b3os.org
|
|
148
|
+
*/
|
|
149
|
+
updateKey(keyId: string, body: T.ApiKeyUpdateRequest, options?: RequestOptions): APIPromise<T.ApiKey> {
|
|
150
|
+
return this._client._call<T.ApiKey>(updateKeyOp, { path: [keyId], body }, options);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Generated by packages/sdk/scripts/generate.mjs from packages/spec/dist. Do not edit; run `pnpm generate`.
|
|
2
|
+
|
|
3
|
+
import type { RequestOptions } from "../../core/client.ts";
|
|
4
|
+
import { Namespace } from "../../core/namespace.ts";
|
|
5
|
+
import type { Op } from "../../core/op.ts";
|
|
6
|
+
import type { APIPromise } from "../../core/promise.ts";
|
|
7
|
+
import type * as T from "../types.ts";
|
|
8
|
+
|
|
9
|
+
const getLimitsOp: Op = {
|
|
10
|
+
id: "platformGetLimits",
|
|
11
|
+
method: "GET",
|
|
12
|
+
path: "/v1/limits",
|
|
13
|
+
edge: true,
|
|
14
|
+
timeoutMs: 10000,
|
|
15
|
+
scope: "authenticated",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** Descriptors of every limits operation, keyed by method name (for tooling and custom clients). */
|
|
19
|
+
export const limitsOps = { getLimits: getLimitsOp } as const;
|
|
20
|
+
|
|
21
|
+
/** Limits that apply to the caller (`/v1/limits`; served by beta-api.b3os.org). */
|
|
22
|
+
export class LimitsAPI extends Namespace {
|
|
23
|
+
/**
|
|
24
|
+
* Get your limits
|
|
25
|
+
*
|
|
26
|
+
* Returns every limit that applies to the caller with its current usage: concurrency, rates, quotas and size
|
|
27
|
+
* caps per product, plus the key's spend cap. Any valid credential may call it. The IDs match the `limit`
|
|
28
|
+
* member of `429` and `422` problems.
|
|
29
|
+
*
|
|
30
|
+
* `GET /v1/limits` · scope `authenticated` · served by beta-api.b3os.org
|
|
31
|
+
*/
|
|
32
|
+
getLimits(options?: RequestOptions): APIPromise<T.Limits> {
|
|
33
|
+
return this._client._call<T.Limits>(getLimitsOp, {}, options);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Generated by packages/sdk/scripts/generate.mjs from packages/spec/dist. Do not edit; run `pnpm generate`.
|
|
2
|
+
|
|
3
|
+
import type { RequestOptions } from "../../core/client.ts";
|
|
4
|
+
import { Namespace } from "../../core/namespace.ts";
|
|
5
|
+
import type { Op } from "../../core/op.ts";
|
|
6
|
+
import type { APIPromise, ListPromise } from "../../core/promise.ts";
|
|
7
|
+
import type * as T from "../types.ts";
|
|
8
|
+
|
|
9
|
+
const listOrgsOp: Op = {
|
|
10
|
+
id: "platformListOrgs",
|
|
11
|
+
method: "GET",
|
|
12
|
+
path: "/v1/orgs",
|
|
13
|
+
edge: true,
|
|
14
|
+
timeoutMs: 10000,
|
|
15
|
+
scope: "authenticated",
|
|
16
|
+
};
|
|
17
|
+
const getOrgOp: Op = {
|
|
18
|
+
id: "platformGetOrg",
|
|
19
|
+
method: "GET",
|
|
20
|
+
path: "/v1/orgs/{org_id}",
|
|
21
|
+
params: ["org_id"],
|
|
22
|
+
edge: true,
|
|
23
|
+
timeoutMs: 10000,
|
|
24
|
+
scope: "platform:read",
|
|
25
|
+
};
|
|
26
|
+
const listMembersOp: Op = {
|
|
27
|
+
id: "platformListMembers",
|
|
28
|
+
method: "GET",
|
|
29
|
+
path: "/v1/orgs/{org_id}/members",
|
|
30
|
+
params: ["org_id"],
|
|
31
|
+
edge: true,
|
|
32
|
+
timeoutMs: 10000,
|
|
33
|
+
scope: "platform:read",
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** Descriptors of every orgs operation, keyed by method name (for tooling and custom clients). */
|
|
37
|
+
export const orgsOps = { listOrgs: listOrgsOp, getOrg: getOrgOp, listMembers: listMembersOp } as const;
|
|
38
|
+
|
|
39
|
+
/** Organizations and members (`/v1/orgs`; served by beta-api.b3os.org). */
|
|
40
|
+
export class OrgsAPI extends Namespace {
|
|
41
|
+
/**
|
|
42
|
+
* List organizations
|
|
43
|
+
*
|
|
44
|
+
* Lists the organizations the caller belongs to (an API key belongs to exactly one).
|
|
45
|
+
*
|
|
46
|
+
* `GET /v1/orgs` · scope `authenticated` · served by beta-api.b3os.org
|
|
47
|
+
*/
|
|
48
|
+
listOrgs(options?: RequestOptions): APIPromise<T.OrganizationList> {
|
|
49
|
+
return this._client._call<T.OrganizationList>(listOrgsOp, {}, options);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Get an organization
|
|
54
|
+
*
|
|
55
|
+
* Returns one organization the caller belongs to, with the caller's role in it.
|
|
56
|
+
*
|
|
57
|
+
* `GET /v1/orgs/{org_id}` · scope `platform:read` · served by beta-api.b3os.org
|
|
58
|
+
*/
|
|
59
|
+
getOrg(orgId: string, options?: RequestOptions): APIPromise<T.Organization> {
|
|
60
|
+
return this._client._call<T.Organization>(getOrgOp, { path: [orgId] }, options);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* List members
|
|
65
|
+
*
|
|
66
|
+
* Lists the organization's members and their roles.
|
|
67
|
+
*
|
|
68
|
+
* `GET /v1/orgs/{org_id}/members` · scope `platform:read` · served by beta-api.b3os.org
|
|
69
|
+
*/
|
|
70
|
+
listMembers(
|
|
71
|
+
orgId: string,
|
|
72
|
+
params?: T.PlatformListMembersParams,
|
|
73
|
+
options?: RequestOptions,
|
|
74
|
+
): ListPromise<T.MemberList, T.Member> {
|
|
75
|
+
return this._client._list<T.MemberList, T.Member>(listMembersOp, { path: [orgId], query: params }, options);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// Generated by packages/sdk/scripts/generate.mjs from packages/spec/dist. Do not edit; run `pnpm generate`.
|
|
2
|
+
|
|
3
|
+
import type { RequestOptions } from "../../core/client.ts";
|
|
4
|
+
import { Namespace } from "../../core/namespace.ts";
|
|
5
|
+
import type { Op } from "../../core/op.ts";
|
|
6
|
+
import type { APIPromise, ListPromise } from "../../core/promise.ts";
|
|
7
|
+
import type * as T from "../types.ts";
|
|
8
|
+
|
|
9
|
+
const listProjectsOp: Op = {
|
|
10
|
+
id: "platformListProjects",
|
|
11
|
+
method: "GET",
|
|
12
|
+
path: "/v1/projects",
|
|
13
|
+
edge: true,
|
|
14
|
+
timeoutMs: 10000,
|
|
15
|
+
scope: "platform:read",
|
|
16
|
+
};
|
|
17
|
+
const createProjectOp: Op = {
|
|
18
|
+
id: "platformCreateProject",
|
|
19
|
+
method: "POST",
|
|
20
|
+
path: "/v1/projects",
|
|
21
|
+
body: "json",
|
|
22
|
+
edge: true,
|
|
23
|
+
idem: true,
|
|
24
|
+
timeoutMs: 10000,
|
|
25
|
+
scope: "platform:write",
|
|
26
|
+
};
|
|
27
|
+
const deleteProjectOp: Op = {
|
|
28
|
+
id: "platformDeleteProject",
|
|
29
|
+
method: "DELETE",
|
|
30
|
+
path: "/v1/projects/{project_id}",
|
|
31
|
+
params: ["project_id"],
|
|
32
|
+
edge: true,
|
|
33
|
+
timeoutMs: 15000,
|
|
34
|
+
scope: "platform:write",
|
|
35
|
+
};
|
|
36
|
+
const getProjectOp: Op = {
|
|
37
|
+
id: "platformGetProject",
|
|
38
|
+
method: "GET",
|
|
39
|
+
path: "/v1/projects/{project_id}",
|
|
40
|
+
params: ["project_id"],
|
|
41
|
+
edge: true,
|
|
42
|
+
timeoutMs: 10000,
|
|
43
|
+
scope: "platform:read",
|
|
44
|
+
};
|
|
45
|
+
const updateProjectOp: Op = {
|
|
46
|
+
id: "platformUpdateProject",
|
|
47
|
+
method: "PATCH",
|
|
48
|
+
path: "/v1/projects/{project_id}",
|
|
49
|
+
params: ["project_id"],
|
|
50
|
+
body: "json",
|
|
51
|
+
edge: true,
|
|
52
|
+
timeoutMs: 10000,
|
|
53
|
+
scope: "platform:write",
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** Descriptors of every projects operation, keyed by method name (for tooling and custom clients). */
|
|
57
|
+
export const projectsOps = {
|
|
58
|
+
listProjects: listProjectsOp,
|
|
59
|
+
createProject: createProjectOp,
|
|
60
|
+
deleteProject: deleteProjectOp,
|
|
61
|
+
getProject: getProjectOp,
|
|
62
|
+
updateProject: updateProjectOp,
|
|
63
|
+
} as const;
|
|
64
|
+
|
|
65
|
+
/** Projects (`/v1/projects`; served by beta-api.b3os.org). */
|
|
66
|
+
export class ProjectsAPI extends Namespace {
|
|
67
|
+
/**
|
|
68
|
+
* List projects
|
|
69
|
+
*
|
|
70
|
+
* Lists the projects of the caller's organization.
|
|
71
|
+
*
|
|
72
|
+
* `GET /v1/projects` · scope `platform:read` · served by beta-api.b3os.org
|
|
73
|
+
*/
|
|
74
|
+
listProjects(params?: T.PlatformListProjectsParams, options?: RequestOptions): ListPromise<T.ProjectList, T.Project> {
|
|
75
|
+
return this._client._list<T.ProjectList, T.Project>(listProjectsOp, { query: params }, options);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Create a project
|
|
80
|
+
*
|
|
81
|
+
* Creates a project in the caller's organization. Objects, keys, connections and usage are separated per project.
|
|
82
|
+
*
|
|
83
|
+
* `POST /v1/projects` · scope `platform:write` · served by beta-api.b3os.org
|
|
84
|
+
*/
|
|
85
|
+
createProject(body: T.ProjectCreateRequest, options?: RequestOptions): APIPromise<T.Project> {
|
|
86
|
+
return this._client._call<T.Project>(createProjectOp, { body }, options);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Delete a project
|
|
91
|
+
*
|
|
92
|
+
* Deletes an empty project: it must have no running sandboxes, open browser sessions or active routines
|
|
93
|
+
* (`project_not_empty`), and may not be the organization's last project (`last_project`). Its keys are revoked.
|
|
94
|
+
*
|
|
95
|
+
* `DELETE /v1/projects/{project_id}` · scope `platform:write` · served by beta-api.b3os.org
|
|
96
|
+
*/
|
|
97
|
+
deleteProject(projectId: string, options?: RequestOptions): APIPromise<T.Deleted> {
|
|
98
|
+
return this._client._call<T.Deleted>(deleteProjectOp, { path: [projectId] }, options);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Get a project
|
|
103
|
+
*
|
|
104
|
+
* Returns one project of the caller's organization.
|
|
105
|
+
*
|
|
106
|
+
* `GET /v1/projects/{project_id}` · scope `platform:read` · served by beta-api.b3os.org
|
|
107
|
+
*/
|
|
108
|
+
getProject(projectId: string, options?: RequestOptions): APIPromise<T.Project> {
|
|
109
|
+
return this._client._call<T.Project>(getProjectOp, { path: [projectId] }, options);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Update a project
|
|
114
|
+
*
|
|
115
|
+
* Renames a project or replaces its metadata.
|
|
116
|
+
*
|
|
117
|
+
* `PATCH /v1/projects/{project_id}` · scope `platform:write` · served by beta-api.b3os.org
|
|
118
|
+
*/
|
|
119
|
+
updateProject(projectId: string, body: T.ProjectUpdateRequest, options?: RequestOptions): APIPromise<T.Project> {
|
|
120
|
+
return this._client._call<T.Project>(updateProjectOp, { path: [projectId], body }, options);
|
|
121
|
+
}
|
|
122
|
+
}
|