@boxrouter/sdk 0.0.0-stage → 0.12.190
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/NOTICE +40 -0
- package/README.md +508 -2
- package/dist/addresses.d.ts +5 -0
- package/dist/addresses.js +10 -0
- package/dist/api-error.d.ts +62 -0
- package/dist/api-error.js +264 -0
- package/dist/boxrouter.d.ts +68 -0
- package/dist/boxrouter.js +291 -0
- package/dist/browser-session/index.d.ts +17 -0
- package/dist/browser-session/index.js +48 -0
- package/dist/browser-session/operations.gen.d.ts +272 -0
- package/dist/browser-session/operations.gen.js +58 -0
- package/dist/browser-session/responseContracts/api_keys.d.ts +2 -0
- package/dist/browser-session/responseContracts/api_keys.js +10 -0
- package/dist/browser-session/responseContracts/credits.d.ts +2 -0
- package/dist/browser-session/responseContracts/credits.js +8 -0
- package/dist/browser-session/responseContracts/github.d.ts +2 -0
- package/dist/browser-session/responseContracts/github.js +11 -0
- package/dist/browser-session/responseContracts/identity.d.ts +2 -0
- package/dist/browser-session/responseContracts/identity.js +30 -0
- package/dist/browser-session/responseContracts/organizations.d.ts +2 -0
- package/dist/browser-session/responseContracts/organizations.js +17 -0
- package/dist/browser-session/responseContracts/privacy.d.ts +2 -0
- package/dist/browser-session/responseContracts/privacy.js +7 -0
- package/dist/browser-session/responseContracts.gen.d.ts +3 -0
- package/dist/browser-session/responseContracts.gen.js +10 -0
- package/dist/browser-session/responseValidators/api_keys-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/api_keys-diagnostics.d.cts +4 -0
- package/dist/browser-session/responseValidators/api_keys.cjs +2 -0
- package/dist/browser-session/responseValidators/api_keys.d.cts +4 -0
- package/dist/browser-session/responseValidators/credits-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/credits-diagnostics.d.cts +3 -0
- package/dist/browser-session/responseValidators/credits.cjs +2 -0
- package/dist/browser-session/responseValidators/credits.d.cts +3 -0
- package/dist/browser-session/responseValidators/github-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/github-diagnostics.d.cts +3 -0
- package/dist/browser-session/responseValidators/github.cjs +2 -0
- package/dist/browser-session/responseValidators/github.d.cts +3 -0
- package/dist/browser-session/responseValidators/identity-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/identity-diagnostics.d.cts +23 -0
- package/dist/browser-session/responseValidators/identity.cjs +2 -0
- package/dist/browser-session/responseValidators/identity.d.cts +23 -0
- package/dist/browser-session/responseValidators/organizations-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/organizations-diagnostics.d.cts +15 -0
- package/dist/browser-session/responseValidators/organizations.cjs +2 -0
- package/dist/browser-session/responseValidators/organizations.d.cts +15 -0
- package/dist/browser-session/responseValidators/privacy-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/privacy-diagnostics.d.cts +2 -0
- package/dist/browser-session/responseValidators/privacy.cjs +2 -0
- package/dist/browser-session/responseValidators/privacy.d.cts +2 -0
- package/dist/client/client.gen.d.ts +2 -0
- package/dist/client/client.gen.js +168 -0
- package/dist/client/index.d.ts +10 -0
- package/dist/client/index.js +17 -0
- package/dist/client/types.gen.d.ts +120 -0
- package/dist/client/types.gen.js +3 -0
- package/dist/client/utils.gen.d.ts +37 -0
- package/dist/client/utils.gen.js +239 -0
- package/dist/client.gen.d.ts +12 -0
- package/dist/client.gen.js +6 -0
- package/dist/command-check.gen.d.ts +14 -0
- package/dist/command-check.gen.js +23 -0
- package/dist/command-input.gen.d.ts +6 -0
- package/dist/command-input.gen.js +45 -0
- package/dist/core/auth.gen.d.ts +25 -0
- package/dist/core/auth.gen.js +18 -0
- package/dist/core/binaryStream.d.ts +8 -0
- package/dist/core/binaryStream.js +76 -0
- package/dist/core/bodySerializer.gen.d.ts +25 -0
- package/dist/core/bodySerializer.gen.js +60 -0
- package/dist/core/commandValidators.cjs +1 -0
- package/dist/core/commandValidators.d.cts +14 -0
- package/dist/core/eventValidation.d.ts +17 -0
- package/dist/core/eventValidation.js +56 -0
- package/dist/core/eventValidators.cjs +1 -0
- package/dist/core/eventValidators.d.cts +2 -0
- package/dist/core/json.d.ts +3 -0
- package/dist/core/json.js +33 -0
- package/dist/core/params.gen.d.ts +43 -0
- package/dist/core/params.gen.js +112 -0
- package/dist/core/pathSerializer.gen.d.ts +33 -0
- package/dist/core/pathSerializer.gen.js +115 -0
- package/dist/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/core/queryKeySerializer.gen.js +98 -0
- package/dist/core/responseContracts/actions.d.ts +2 -0
- package/dist/core/responseContracts/actions.js +30 -0
- package/dist/core/responseContracts/agents.d.ts +2 -0
- package/dist/core/responseContracts/agents.js +7 -0
- package/dist/core/responseContracts/artifacts.d.ts +2 -0
- package/dist/core/responseContracts/artifacts.js +8 -0
- package/dist/core/responseContracts/commands.d.ts +2 -0
- package/dist/core/responseContracts/commands.js +6 -0
- package/dist/core/responseContracts/credits.d.ts +2 -0
- package/dist/core/responseContracts/credits.js +27 -0
- package/dist/core/responseContracts/files.d.ts +2 -0
- package/dist/core/responseContracts/files.js +15 -0
- package/dist/core/responseContracts/github.d.ts +2 -0
- package/dist/core/responseContracts/github.js +8 -0
- package/dist/core/responseContracts/images.d.ts +2 -0
- package/dist/core/responseContracts/images.js +8 -0
- package/dist/core/responseContracts/launchRuns.d.ts +2 -0
- package/dist/core/responseContracts/launchRuns.js +10 -0
- package/dist/core/responseContracts/launches.d.ts +2 -0
- package/dist/core/responseContracts/launches.js +10 -0
- package/dist/core/responseContracts/operations.d.ts +2 -0
- package/dist/core/responseContracts/operations.js +7 -0
- package/dist/core/responseContracts/previews.d.ts +2 -0
- package/dist/core/responseContracts/previews.js +8 -0
- package/dist/core/responseContracts/pricing.d.ts +2 -0
- package/dist/core/responseContracts/pricing.js +6 -0
- package/dist/core/responseContracts/processes.d.ts +2 -0
- package/dist/core/responseContracts/processes.js +11 -0
- package/dist/core/responseContracts/provider_accounts.d.ts +2 -0
- package/dist/core/responseContracts/provider_accounts.js +13 -0
- package/dist/core/responseContracts/providers.d.ts +2 -0
- package/dist/core/responseContracts/providers.js +6 -0
- package/dist/core/responseContracts/routing.d.ts +2 -0
- package/dist/core/responseContracts/routing.js +8 -0
- package/dist/core/responseContracts/sandboxes.d.ts +2 -0
- package/dist/core/responseContracts/sandboxes.js +15 -0
- package/dist/core/responseContracts/secrets.d.ts +2 -0
- package/dist/core/responseContracts/secrets.js +8 -0
- package/dist/core/responseContracts/spend_limits.d.ts +2 -0
- package/dist/core/responseContracts/spend_limits.js +8 -0
- package/dist/core/responseContracts/terminals.d.ts +2 -0
- package/dist/core/responseContracts/terminals.js +11 -0
- package/dist/core/responseContracts/usage.d.ts +2 -0
- package/dist/core/responseContracts/usage.js +7 -0
- package/dist/core/responseContracts/volumes.d.ts +2 -0
- package/dist/core/responseContracts/volumes.js +19 -0
- package/dist/core/responseContracts.gen.d.ts +3 -0
- package/dist/core/responseContracts.gen.js +27 -0
- package/dist/core/responseModes.d.ts +19 -0
- package/dist/core/responseModes.js +13 -0
- package/dist/core/responseValidation.d.ts +44 -0
- package/dist/core/responseValidation.js +174 -0
- package/dist/core/responseValidators/actions-diagnostics.cjs +4 -0
- package/dist/core/responseValidators/actions-diagnostics.d.cts +24 -0
- package/dist/core/responseValidators/actions.cjs +2 -0
- package/dist/core/responseValidators/actions.d.cts +24 -0
- package/dist/core/responseValidators/agents-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/agents-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/agents.cjs +2 -0
- package/dist/core/responseValidators/agents.d.cts +2 -0
- package/dist/core/responseValidators/artifacts-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/artifacts-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/artifacts.cjs +2 -0
- package/dist/core/responseValidators/artifacts.d.cts +2 -0
- package/dist/core/responseValidators/commands-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/commands-diagnostics.d.cts +1 -0
- package/dist/core/responseValidators/commands.cjs +2 -0
- package/dist/core/responseValidators/commands.d.cts +1 -0
- package/dist/core/responseValidators/compact.cjs +122 -0
- package/dist/core/responseValidators/credits-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/credits-diagnostics.d.cts +21 -0
- package/dist/core/responseValidators/credits.cjs +2 -0
- package/dist/core/responseValidators/credits.d.cts +21 -0
- package/dist/core/responseValidators/files-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/files-diagnostics.d.cts +5 -0
- package/dist/core/responseValidators/files.cjs +2 -0
- package/dist/core/responseValidators/files.d.cts +5 -0
- package/dist/core/responseValidators/github-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/github-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/github.cjs +2 -0
- package/dist/core/responseValidators/github.d.cts +2 -0
- package/dist/core/responseValidators/images-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/images-diagnostics.d.cts +3 -0
- package/dist/core/responseValidators/images.cjs +2 -0
- package/dist/core/responseValidators/images.d.cts +3 -0
- package/dist/core/responseValidators/launchRuns-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/launchRuns-diagnostics.d.cts +5 -0
- package/dist/core/responseValidators/launchRuns.cjs +2 -0
- package/dist/core/responseValidators/launchRuns.d.cts +5 -0
- package/dist/core/responseValidators/launches-diagnostics.cjs +10 -0
- package/dist/core/responseValidators/launches-diagnostics.d.cts +5 -0
- package/dist/core/responseValidators/launches.cjs +2 -0
- package/dist/core/responseValidators/launches.d.cts +5 -0
- package/dist/core/responseValidators/operations-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/operations-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/operations.cjs +2 -0
- package/dist/core/responseValidators/operations.d.cts +2 -0
- package/dist/core/responseValidators/previews-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/previews-diagnostics.d.cts +3 -0
- package/dist/core/responseValidators/previews.cjs +2 -0
- package/dist/core/responseValidators/previews.d.cts +3 -0
- package/dist/core/responseValidators/pricing-diagnostics.cjs +7 -0
- package/dist/core/responseValidators/pricing-diagnostics.d.cts +1 -0
- package/dist/core/responseValidators/pricing.cjs +2 -0
- package/dist/core/responseValidators/pricing.d.cts +1 -0
- package/dist/core/responseValidators/processes-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/processes-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/processes.cjs +2 -0
- package/dist/core/responseValidators/processes.d.cts +2 -0
- package/dist/core/responseValidators/provider_accounts-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/provider_accounts-diagnostics.d.cts +8 -0
- package/dist/core/responseValidators/provider_accounts.cjs +2 -0
- package/dist/core/responseValidators/provider_accounts.d.cts +8 -0
- package/dist/core/responseValidators/providers-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/providers-diagnostics.d.cts +1 -0
- package/dist/core/responseValidators/providers.cjs +2 -0
- package/dist/core/responseValidators/providers.d.cts +1 -0
- package/dist/core/responseValidators/routing-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/routing-diagnostics.d.cts +3 -0
- package/dist/core/responseValidators/routing.cjs +2 -0
- package/dist/core/responseValidators/routing.d.cts +3 -0
- package/dist/core/responseValidators/sandboxes-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/sandboxes-diagnostics.d.cts +10 -0
- package/dist/core/responseValidators/sandboxes.cjs +2 -0
- package/dist/core/responseValidators/sandboxes.d.cts +10 -0
- package/dist/core/responseValidators/secrets-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/secrets-diagnostics.d.cts +1 -0
- package/dist/core/responseValidators/secrets.cjs +2 -0
- package/dist/core/responseValidators/secrets.d.cts +1 -0
- package/dist/core/responseValidators/spend_limits-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/spend_limits-diagnostics.d.cts +3 -0
- package/dist/core/responseValidators/spend_limits.cjs +2 -0
- package/dist/core/responseValidators/spend_limits.d.cts +3 -0
- package/dist/core/responseValidators/terminals-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/terminals-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/terminals.cjs +2 -0
- package/dist/core/responseValidators/terminals.d.cts +2 -0
- package/dist/core/responseValidators/usage-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/usage-diagnostics.d.cts +1 -0
- package/dist/core/responseValidators/usage.cjs +2 -0
- package/dist/core/responseValidators/usage.d.cts +1 -0
- package/dist/core/responseValidators/volumes-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/volumes-diagnostics.d.cts +10 -0
- package/dist/core/responseValidators/volumes.cjs +2 -0
- package/dist/core/responseValidators/volumes.d.cts +10 -0
- package/dist/core/serverSentEvents.gen.d.ts +30 -0
- package/dist/core/serverSentEvents.gen.js +313 -0
- package/dist/core/streamErrors.d.ts +32 -0
- package/dist/core/streamErrors.js +51 -0
- package/dist/core/types.gen.d.ts +83 -0
- package/dist/core/types.gen.js +3 -0
- package/dist/core/utils.gen.d.ts +19 -0
- package/dist/core/utils.gen.js +93 -0
- package/dist/creation.gen.d.ts +21 -0
- package/dist/creation.gen.js +35 -0
- package/dist/data-origin.d.ts +25 -0
- package/dist/data-origin.js +57 -0
- package/dist/error-codes.gen.d.ts +2 -0
- package/dist/error-codes.gen.js +2 -0
- package/dist/idempotency.gen.d.ts +1 -0
- package/dist/idempotency.gen.js +60 -0
- package/dist/images.d.ts +74 -0
- package/dist/images.js +88 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +80 -0
- package/dist/launch-input.gen.d.ts +9 -0
- package/dist/launch-input.gen.js +83 -0
- package/dist/launch.d.ts +28 -0
- package/dist/launch.js +222 -0
- package/dist/namespace-actions.d.mts +307 -0
- package/dist/namespace-actions.mjs +595 -0
- package/dist/namespace-agents.d.mts +33 -0
- package/dist/namespace-agents.mjs +40 -0
- package/dist/namespace-artifacts.d.mts +46 -0
- package/dist/namespace-artifacts.mjs +69 -0
- package/dist/namespace-base.d.mts +7 -0
- package/dist/namespace-base.mjs +7 -0
- package/dist/namespace-commands.d.mts +57 -0
- package/dist/namespace-commands.mjs +57 -0
- package/dist/namespace-credits.d.mts +213 -0
- package/dist/namespace-credits.mjs +476 -0
- package/dist/namespace-files.d.mts +203 -0
- package/dist/namespace-files.mjs +334 -0
- package/dist/namespace-github.d.mts +50 -0
- package/dist/namespace-github.mjs +68 -0
- package/dist/namespace-images.d.mts +52 -0
- package/dist/namespace-images.mjs +78 -0
- package/dist/namespace-launch_runs.d.mts +89 -0
- package/dist/namespace-launch_runs.mjs +133 -0
- package/dist/namespace-launches.d.mts +89 -0
- package/dist/namespace-launches.mjs +133 -0
- package/dist/namespace-operations.d.mts +45 -0
- package/dist/namespace-operations.mjs +52 -0
- package/dist/namespace-previews.d.mts +79 -0
- package/dist/namespace-previews.mjs +101 -0
- package/dist/namespace-pricing.d.mts +31 -0
- package/dist/namespace-pricing.mjs +22 -0
- package/dist/namespace-processes.d.mts +125 -0
- package/dist/namespace-processes.mjs +184 -0
- package/dist/namespace-provider_accounts.d.mts +156 -0
- package/dist/namespace-provider_accounts.mjs +241 -0
- package/dist/namespace-providers.d.mts +28 -0
- package/dist/namespace-providers.mjs +24 -0
- package/dist/namespace-routing.d.mts +64 -0
- package/dist/namespace-routing.mjs +86 -0
- package/dist/namespace-sandboxes.d.mts +287 -0
- package/dist/namespace-sandboxes.mjs +402 -0
- package/dist/namespace-secrets.d.mts +46 -0
- package/dist/namespace-secrets.mjs +68 -0
- package/dist/namespace-spend_limits.d.mts +48 -0
- package/dist/namespace-spend_limits.mjs +70 -0
- package/dist/namespace-terminals.d.mts +112 -0
- package/dist/namespace-terminals.mjs +177 -0
- package/dist/namespace-usage.d.mts +46 -0
- package/dist/namespace-usage.mjs +53 -0
- package/dist/namespace-volumes.d.mts +110 -0
- package/dist/namespace-volumes.mjs +269 -0
- package/dist/operations.d.ts +14 -0
- package/dist/operations.js +31 -0
- package/dist/retry.d.ts +8 -0
- package/dist/retry.js +63 -0
- package/dist/routing-choices.gen.d.ts +132 -0
- package/dist/routing-choices.gen.js +136 -0
- package/dist/routing.d.ts +23 -0
- package/dist/routing.js +38 -0
- package/dist/sandbox-handle.gen.d.ts +8 -0
- package/dist/sandbox-handle.gen.js +14 -0
- package/dist/sandboxes.d.ts +213 -0
- package/dist/sandboxes.js +507 -0
- package/dist/sdk.gen.d.ts +2029 -0
- package/dist/sdk.gen.js +3862 -0
- package/dist/server-timing.d.ts +19 -0
- package/dist/server-timing.gen.d.ts +265 -0
- package/dist/server-timing.gen.js +254 -0
- package/dist/server-timing.js +421 -0
- package/dist/spend-limits.d.ts +17 -0
- package/dist/spend-limits.js +26 -0
- package/dist/telemetry.d.ts +51 -0
- package/dist/telemetry.gen.d.ts +1 -0
- package/dist/telemetry.gen.js +5 -0
- package/dist/telemetry.js +438 -0
- package/dist/terminal.d.ts +61 -0
- package/dist/terminal.js +266 -0
- package/dist/transfer.d.ts +75 -0
- package/dist/transfer.js +389 -0
- package/dist/types.gen.d.ts +15016 -0
- package/dist/types.gen.js +3 -0
- package/dist/user-agent.d.ts +2 -0
- package/dist/user-agent.js +18 -0
- package/dist/version.gen.d.ts +1 -0
- package/dist/version.gen.js +5 -0
- package/dist/volumes.d.ts +33 -0
- package/dist/volumes.js +221 -0
- package/dist/waits.d.ts +31 -0
- package/dist/waits.js +42 -0
- package/dist/workflow-policy.gen.d.ts +41 -0
- package/dist/workflow-policy.gen.js +45 -0
- package/package.json +135 -4
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { HeyApiClient } from './namespace-base.mjs';
|
|
2
|
+
export class Sandboxes extends HeyApiClient {
|
|
3
|
+
/**
|
|
4
|
+
* Prove a headless Chromium in the sandbox
|
|
5
|
+
*
|
|
6
|
+
* You can rely on:
|
|
7
|
+
* - Returns only the automation channels that loaded a page served inside the sandbox; when none does, the call is refused.
|
|
8
|
+
*
|
|
9
|
+
* Not promised: installing a browser in the sandbox.
|
|
10
|
+
*
|
|
11
|
+
* Loads a page from a server inside the guest in the image's own headless Chromium
|
|
12
|
+
* and reads the CDP endpoint: Playwright and CDP on glibc images, CDP on Alpine.
|
|
13
|
+
* Create the sandbox from an image with Python 3 and Playwright with Chromium (or a
|
|
14
|
+
* Chromium binary); BoxRouter's standard image has neither. An image without them, or a sandbox
|
|
15
|
+
* where no channel passes, such as one with too little memory, is refused with
|
|
16
|
+
* `422 unsupported_feature`. Afterwards run browser scripts through commands or processes.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
browser(options) {
|
|
20
|
+
return (options.client ?? this.client).post({
|
|
21
|
+
responseStyle: 'data',
|
|
22
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
23
|
+
in: 'cookie',
|
|
24
|
+
name: '__Host-boxrouter_session',
|
|
25
|
+
type: 'apiKey'
|
|
26
|
+
}],
|
|
27
|
+
url: '/sandboxes/{sandbox_id}/browser',
|
|
28
|
+
...options
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Pause a sandbox and keep it
|
|
33
|
+
*
|
|
34
|
+
* You can rely on:
|
|
35
|
+
* - On return the sandbox is paused, and the result says whether running processes are kept or only files.
|
|
36
|
+
* - The remaining lifetime budget is preserved.
|
|
37
|
+
*
|
|
38
|
+
* You can set: lifetime.
|
|
39
|
+
*
|
|
40
|
+
* Stops compute and keeps the sandbox where it is. The sandbox must have been created with
|
|
41
|
+
* the `pause_resume` requirement. The result says what was kept (running processes, or
|
|
42
|
+
* only files) and how much lifetime remains. Resume the sandbox before doing more work in it.
|
|
43
|
+
*
|
|
44
|
+
* 404 means the sandbox does not exist in this workspace. A sandbox that exists but
|
|
45
|
+
* was not created through this API is refused with `409 invalid_state`; one that has
|
|
46
|
+
* ended answers `410 sandbox_ended`.
|
|
47
|
+
*
|
|
48
|
+
*/
|
|
49
|
+
pause(options) {
|
|
50
|
+
return (options.client ?? this.client).post({
|
|
51
|
+
responseStyle: 'data',
|
|
52
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
53
|
+
in: 'cookie',
|
|
54
|
+
name: '__Host-boxrouter_session',
|
|
55
|
+
type: 'apiKey'
|
|
56
|
+
}],
|
|
57
|
+
url: '/sandboxes/{sandbox_id}/pause',
|
|
58
|
+
...options
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Resume the same paused sandbox
|
|
63
|
+
*
|
|
64
|
+
* You can rely on:
|
|
65
|
+
* - Resumes the same sandbox on its original provider and account, never a replacement.
|
|
66
|
+
* - On return the sandbox is running, and the result says whether processes from before the pause were lost.
|
|
67
|
+
* - The sandbox runs on with the lifetime budget it had left; resume takes no new budget.
|
|
68
|
+
* - Resuming a sandbox that is already running succeeds and changes nothing, so a retry is safe.
|
|
69
|
+
*
|
|
70
|
+
* Not promised: that previews opened before the pause still work.
|
|
71
|
+
*
|
|
72
|
+
* Starts a paused or stopped sandbox again and returns its remaining lifetime. Resume takes
|
|
73
|
+
* no fields: send no body or `{}`, and any other field fails with `400 invalid_request`. To
|
|
74
|
+
* change how long the sandbox may run, extend its lifetime, which works while it is running,
|
|
75
|
+
* paused or stopped.
|
|
76
|
+
*
|
|
77
|
+
* Resuming a sandbox that is already running changes nothing, so you can safely send the call
|
|
78
|
+
* again. 404 means the sandbox does not exist in this workspace. A sandbox that cannot be
|
|
79
|
+
* resumed fails with 409: `invalid_state` while it is being created or destroyed, or when it
|
|
80
|
+
* was not created through this API; `lifetime_used_up` when its lifetime is spent (extend it,
|
|
81
|
+
* then resume); `volume_lease_lost` or `volume_busy` when its Volume cannot follow. A sandbox
|
|
82
|
+
* that has ended answers `410 sandbox_ended`.
|
|
83
|
+
*
|
|
84
|
+
* Those refusals happen before anything is resumed and report `outcome: not_started`. If the
|
|
85
|
+
* provider resumed the sandbox and a later step failed, the outcome is never `not_started`:
|
|
86
|
+
* `502 volume_restore_failed` (the sandbox restarted without its Volume mounted) reports
|
|
87
|
+
* `outcome: partial` with an `operation_id`, and the sandbox is running without its Volume.
|
|
88
|
+
* Do not send the resume again; destroy the sandbox and create a new one with the Volume
|
|
89
|
+
* attached. A lifetime failure after the resume reports `outcome: unknown`; read the operation
|
|
90
|
+
* before acting.
|
|
91
|
+
*
|
|
92
|
+
*/
|
|
93
|
+
resume(options) {
|
|
94
|
+
return (options.client ?? this.client).post({
|
|
95
|
+
responseStyle: 'data',
|
|
96
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
97
|
+
in: 'cookie',
|
|
98
|
+
name: '__Host-boxrouter_session',
|
|
99
|
+
type: 'apiKey'
|
|
100
|
+
}],
|
|
101
|
+
url: '/sandboxes/{sandbox_id}/resume',
|
|
102
|
+
...options,
|
|
103
|
+
headers: {
|
|
104
|
+
'Content-Type': 'application/json',
|
|
105
|
+
...options.headers
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Extend a sandbox lifetime
|
|
111
|
+
*
|
|
112
|
+
* You can rely on:
|
|
113
|
+
* - The value is the new total running-time budget, not an increment, so sending it again is safe; a budget shorter than the current one or than the running time already used is refused. On success the sandbox may run for at least the requested total; extending a paused or stopped sandbox sets the budget it resumes with.
|
|
114
|
+
*
|
|
115
|
+
* You can set: lifetime_seconds.
|
|
116
|
+
*
|
|
117
|
+
* Not promised: that the sandbox ends exactly when the budget runs out.
|
|
118
|
+
*
|
|
119
|
+
* Refused with not_named unless the creation request asked for resources.extendable_lifetime. It is
|
|
120
|
+
* not a re-match: the only check is the route's max_lifetime_seconds for this account,
|
|
121
|
+
* against the current run, and over it the answer is lifetime_limit. Allowed while
|
|
122
|
+
* running, paused or stopped: a paused or stopped sandbox resumes with the new budget.
|
|
123
|
+
* A total shorter than the current budget is invalid_request (400); a total below the
|
|
124
|
+
* running time already used is lifetime_limit (409).
|
|
125
|
+
*
|
|
126
|
+
* 404 means the sandbox does not exist in this workspace. A sandbox that exists but
|
|
127
|
+
* was not created through this API is refused with `409 invalid_state`; one that has
|
|
128
|
+
* ended answers `410 sandbox_ended`.
|
|
129
|
+
*
|
|
130
|
+
*/
|
|
131
|
+
extend(options) {
|
|
132
|
+
return (options.client ?? this.client).post({
|
|
133
|
+
responseStyle: 'data',
|
|
134
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
135
|
+
in: 'cookie',
|
|
136
|
+
name: '__Host-boxrouter_session',
|
|
137
|
+
type: 'apiKey'
|
|
138
|
+
}],
|
|
139
|
+
url: '/sandboxes/{sandbox_id}/lifetime',
|
|
140
|
+
...options,
|
|
141
|
+
headers: {
|
|
142
|
+
'Content-Type': 'application/json',
|
|
143
|
+
...options.headers
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Change a running sandbox's outbound network policy
|
|
149
|
+
*
|
|
150
|
+
* You can rely on:
|
|
151
|
+
* - Connections opened after the call returns follow the new policy, and the sandbox keeps its processes and files.
|
|
152
|
+
* - An uncertain outcome is never resent.
|
|
153
|
+
*
|
|
154
|
+
* You can set: policy, allow, deny.
|
|
155
|
+
*
|
|
156
|
+
* Not promised: that connections already open when the call returns are closed; name lookups and DNS traffic.
|
|
157
|
+
*
|
|
158
|
+
* Switches the sandbox's outbound network policy, or changes its entries. Each call starts
|
|
159
|
+
* from the policy the sandbox has now: the last one this call applied, or else the one named
|
|
160
|
+
* when the sandbox was created (`open` if it named none).
|
|
161
|
+
*
|
|
162
|
+
* The sandbox must have been created with the `network_lockdown` requirement naming the
|
|
163
|
+
* settings the change needs. Otherwise the call fails with `not_named`, and `fix` shows the
|
|
164
|
+
* requirement to send:
|
|
165
|
+
*
|
|
166
|
+
* - Switching to a different policy needs `switchable`, and the target policy listed in
|
|
167
|
+
* `switches_to` unless it is the policy the sandbox was created with. Switching back to the
|
|
168
|
+
* created policy with different entries also needs `changeable`.
|
|
169
|
+
* - Changing the entries of the current policy needs `changeable`, even when the entries are
|
|
170
|
+
* the same. After one switch, a further call that names the new policy needs `changeable`.
|
|
171
|
+
* - Deny entries on an allowlist need `deny_wins`, and an HTTP rule among the entries needs
|
|
172
|
+
* `http_rules`.
|
|
173
|
+
*
|
|
174
|
+
* `422 unsupported_feature` with outcome `not_started` means the route cannot switch policies.
|
|
175
|
+
*
|
|
176
|
+
*/
|
|
177
|
+
updateNetworkPolicy(options) {
|
|
178
|
+
return (options.client ?? this.client).post({
|
|
179
|
+
responseStyle: 'data',
|
|
180
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
181
|
+
in: 'cookie',
|
|
182
|
+
name: '__Host-boxrouter_session',
|
|
183
|
+
type: 'apiKey'
|
|
184
|
+
}],
|
|
185
|
+
url: '/sandboxes/{sandbox_id}/network-policy',
|
|
186
|
+
...options,
|
|
187
|
+
headers: {
|
|
188
|
+
'Content-Type': 'application/json',
|
|
189
|
+
...options.headers
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* List workspace sandboxes
|
|
195
|
+
*
|
|
196
|
+
* You can rely on:
|
|
197
|
+
* - Lists only the workspace's own sandboxes, each with its latest recorded state.
|
|
198
|
+
* - A label filter matches exactly: only sandboxes carrying every requested label are listed.
|
|
199
|
+
*
|
|
200
|
+
* You can set: filters, sort, cursor, limit.
|
|
201
|
+
*
|
|
202
|
+
* Not promised: a fresh observation of each sandbox from its provider.
|
|
203
|
+
*
|
|
204
|
+
* Lists your workspace's sandboxes from BoxRouter's records, without asking providers. `state`
|
|
205
|
+
* is the latest state BoxRouter recorded, or `unknown` if it recorded none; get one sandbox to
|
|
206
|
+
* check its provider live. `observed_at` is when the list was read, and `state_recorded_at` is
|
|
207
|
+
* when that state was recorded, which can be earlier.
|
|
208
|
+
*
|
|
209
|
+
* `lifecycle` defaults to `all`; send `lifecycle=live` to list only live sandboxes, or `ended` for
|
|
210
|
+
* the rest. You can repeat the `state` and `provider` parameters to match any
|
|
211
|
+
* of several values; repeated `label` parameters must all match. Unknown query parameters fail the request. The page counts apply every
|
|
212
|
+
* filter except `lifecycle`, and `by_state` also ignores `state`, so you can show counts while
|
|
213
|
+
* changing those two filters. `source` filters by what created the sandbox, and a sandbox's
|
|
214
|
+
* origin stays readable after it ends or is removed.
|
|
215
|
+
*
|
|
216
|
+
*/
|
|
217
|
+
list(options) {
|
|
218
|
+
return (options?.client ?? this.client).get({
|
|
219
|
+
responseStyle: 'data',
|
|
220
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
221
|
+
in: 'cookie',
|
|
222
|
+
name: '__Host-boxrouter_session',
|
|
223
|
+
type: 'apiKey'
|
|
224
|
+
}],
|
|
225
|
+
url: '/sandboxes',
|
|
226
|
+
...options
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Create a sandbox
|
|
231
|
+
*
|
|
232
|
+
* **create (standard image)**
|
|
233
|
+
*
|
|
234
|
+
* You can rely on:
|
|
235
|
+
* - Sandboxes are created from the requested image.
|
|
236
|
+
*
|
|
237
|
+
* You can set: image, lifetime, requirements.
|
|
238
|
+
*
|
|
239
|
+
* **volume mount**
|
|
240
|
+
*
|
|
241
|
+
* You can rely on:
|
|
242
|
+
* - The named checkpoint, or the head when none is named, is restored into the mount folder, replacing what the image has there; an empty volume restores nothing.
|
|
243
|
+
*
|
|
244
|
+
* You can set: volume.
|
|
245
|
+
*
|
|
246
|
+
* Not promised: mounting a provider's own volumes.
|
|
247
|
+
*
|
|
248
|
+
* Creates a sandbox and returns it once it is ready to run commands. Send `{}`, or no
|
|
249
|
+
* body, for the default: the standard image on the best eligible route, running for up
|
|
250
|
+
* to 300 seconds. A credit-funded sandbox on a route that can extend a lifetime runs
|
|
251
|
+
* instead for as long as your credit balance covers it when you leave out
|
|
252
|
+
* `lifetime_seconds`; `funded_until` on the sandbox says how far it is funded.
|
|
253
|
+
*
|
|
254
|
+
* Describe what you need and BoxRouter picks a route that meets all of it:
|
|
255
|
+
*
|
|
256
|
+
* - `requirements`: capabilities such as `pause_resume`, `previews` or
|
|
257
|
+
* `network_lockdown`, each with the settings you need.
|
|
258
|
+
* - `resources`: minimum CPU and memory, and a region.
|
|
259
|
+
* - `lifetime_seconds` and `at_end`: how long the sandbox may run, and whether it is
|
|
260
|
+
* destroyed or paused afterward.
|
|
261
|
+
* - `preferences`: how to choose among eligible routes (`sort`, `only`, `ignore`,
|
|
262
|
+
* `order`, `allow_fallbacks`).
|
|
263
|
+
* - `volume`: a Volume to mount, optionally at a checkpoint.
|
|
264
|
+
* - `secret_refs`: saved workspace secrets to add to the environment.
|
|
265
|
+
*
|
|
266
|
+
* BoxRouter never relaxes a requirement to find a cheaper or faster route. If no route
|
|
267
|
+
* can meet the request, the call fails with `409 no_eligible_route`, `details` names each
|
|
268
|
+
* route that was ruled out and the nearest changes, and nothing is created. A field that
|
|
269
|
+
* BoxRouter does not recognize fails with `400 invalid_request`; it is never ignored.
|
|
270
|
+
* Choosing a connected account or route whose provider is not enabled for you fails with
|
|
271
|
+
* `409 provider_not_enabled` before any route is considered. The response records the
|
|
272
|
+
* contract the sandbox was created under and why its route was chosen.
|
|
273
|
+
*
|
|
274
|
+
* A created sandbox does not mean your application is listening on a port yet. If the
|
|
275
|
+
* outcome of a create is unclear, BoxRouter does not retry it or move to another
|
|
276
|
+
* provider; read the operation named by `operation_id` to find out what happened.
|
|
277
|
+
*
|
|
278
|
+
* A `volume` has one writer at a time. If its previous writer is ending (its destroy
|
|
279
|
+
* was accepted, or cleanup of its access is pending), this call waits for the
|
|
280
|
+
* release, at most 120 seconds, and then creates the sandbox, so you need no polling or
|
|
281
|
+
* retry. If the release does not finish in that time, or the writer is still running,
|
|
282
|
+
* the call fails with `409 volume_busy`, outcome `not_started`, and
|
|
283
|
+
* `details.writer_sandbox_id` names the writer. A running writer fails at once.
|
|
284
|
+
*
|
|
285
|
+
*/
|
|
286
|
+
create(options) {
|
|
287
|
+
return (options?.client ?? this.client).post({
|
|
288
|
+
responseStyle: 'data',
|
|
289
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
290
|
+
in: 'cookie',
|
|
291
|
+
name: '__Host-boxrouter_session',
|
|
292
|
+
type: 'apiKey'
|
|
293
|
+
}],
|
|
294
|
+
url: '/sandboxes',
|
|
295
|
+
...options,
|
|
296
|
+
headers: {
|
|
297
|
+
'Content-Type': 'application/json',
|
|
298
|
+
...options?.headers
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Explain routing without creating
|
|
304
|
+
*
|
|
305
|
+
* You can rely on:
|
|
306
|
+
* - Evaluates the body exactly as create would and returns the routes create would try, in order, without provisioning, reserving or recording anything.
|
|
307
|
+
*
|
|
308
|
+
* You can set: creation body.
|
|
309
|
+
*
|
|
310
|
+
* Not promised: that a later create finds the same routes eligible.
|
|
311
|
+
*
|
|
312
|
+
* Each eligible route carries the contract it would grant, every excluded route the
|
|
313
|
+
* checks it failed, and the nearest changes are listed; a later creation checks again.
|
|
314
|
+
* A workspace with nothing to match against, that is no provider keys and no credits,
|
|
315
|
+
* or a `preferences.only` pin on a provider the workspace has not connected, answers 409 no_eligible_route with the same fix
|
|
316
|
+
* POST /sandboxes gives, because a dry run answers what the creation it stands for
|
|
317
|
+
* would.
|
|
318
|
+
*
|
|
319
|
+
*/
|
|
320
|
+
match(options) {
|
|
321
|
+
return (options?.client ?? this.client).post({
|
|
322
|
+
responseStyle: 'data',
|
|
323
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
324
|
+
in: 'cookie',
|
|
325
|
+
name: '__Host-boxrouter_session',
|
|
326
|
+
type: 'apiKey'
|
|
327
|
+
}],
|
|
328
|
+
url: '/sandboxes/match',
|
|
329
|
+
...options,
|
|
330
|
+
headers: {
|
|
331
|
+
'Content-Type': 'application/json',
|
|
332
|
+
...options?.headers
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Destroy a sandbox
|
|
338
|
+
*
|
|
339
|
+
* You can rely on:
|
|
340
|
+
* - Never deletes another generation of the sandbox.
|
|
341
|
+
* - Returns once accepted: 204 when confirmed, else 202 with an operation that completes lifecycle work; GET /operations/{id} reports completion.
|
|
342
|
+
* - While a destroy is unresolved, a repeated destroy is accepted as the same pending operation and makes no second provider call; once the destroy is confirmed, a repeat returns 204 with no body.
|
|
343
|
+
*
|
|
344
|
+
* You can set: nothing.
|
|
345
|
+
*
|
|
346
|
+
* Not promised: how long teardown takes; that the sandbox is already absent from listings on return.
|
|
347
|
+
*
|
|
348
|
+
* Requests destruction on the original upstream account, including persistent sandbox
|
|
349
|
+
* storage where the provider's destroy operation removes it. Separately owned volumes
|
|
350
|
+
* are not deleted. DELETE returns once the provider accepts the destroy, always as 202
|
|
351
|
+
* with the sandbox: `state` is `destroyed` when the provider confirmed within the request
|
|
352
|
+
* and `destroying` while lifecycle work remains, and `operation_id` is set while work
|
|
353
|
+
* remains. BoxRouter finishes an accepted destroy without the caller. GET
|
|
354
|
+
* /operations/{operation_id} reports the operation's outcome; for an accepted destroy this
|
|
355
|
+
* includes any remaining stop, final usage, and deletion work.
|
|
356
|
+
*
|
|
357
|
+
* A repeat DELETE while destruction is unresolved returns 202 with the existing
|
|
358
|
+
* operation_id and makes no second provider call. Once destruction is confirmed,
|
|
359
|
+
* repeat DELETEs return 202 with the destroyed sandbox and no `operation_id`. Unknown or
|
|
360
|
+
* unowned sandbox IDs return 404.
|
|
361
|
+
*
|
|
362
|
+
*/
|
|
363
|
+
destroy(options) {
|
|
364
|
+
return (options.client ?? this.client).delete({
|
|
365
|
+
responseStyle: 'data',
|
|
366
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
367
|
+
in: 'cookie',
|
|
368
|
+
name: '__Host-boxrouter_session',
|
|
369
|
+
type: 'apiKey'
|
|
370
|
+
}],
|
|
371
|
+
url: '/sandboxes/{sandbox_id}',
|
|
372
|
+
...options
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Get a sandbox
|
|
377
|
+
*
|
|
378
|
+
* You can rely on:
|
|
379
|
+
* - Returns a handle for the id, or not_found.
|
|
380
|
+
*
|
|
381
|
+
* You can set: sandbox id.
|
|
382
|
+
*
|
|
383
|
+
* Returns the sandbox with its current state, checked with the provider, without resuming it.
|
|
384
|
+
* `observed_at` is when the provider was checked. `state_recorded_at` is when BoxRouter last
|
|
385
|
+
* recorded the state it returns; it is null if a concurrent change replaced the state during
|
|
386
|
+
* the read. `origin` says what created the sandbox and stays readable after the sandbox ends or
|
|
387
|
+
* is removed, even when the provider can no longer be checked.
|
|
388
|
+
*
|
|
389
|
+
*/
|
|
390
|
+
get(options) {
|
|
391
|
+
return (options.client ?? this.client).get({
|
|
392
|
+
responseStyle: 'data',
|
|
393
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
394
|
+
in: 'cookie',
|
|
395
|
+
name: '__Host-boxrouter_session',
|
|
396
|
+
type: 'apiKey'
|
|
397
|
+
}],
|
|
398
|
+
url: '/sandboxes/{sandbox_id}',
|
|
399
|
+
...options
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client/index.js';
|
|
2
|
+
import { HeyApiClient } from './namespace-base.mjs';
|
|
3
|
+
import type { SecretsDeleteData, SecretsDeleteErrors, SecretsDeleteResponses, SecretsListData, SecretsListErrors, SecretsListResponses, SecretsPutData, SecretsPutErrors, SecretsPutResponses } from './types.gen.js';
|
|
4
|
+
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
|
|
5
|
+
/**
|
|
6
|
+
* You can provide a client instance returned by `createClient()` instead of
|
|
7
|
+
* individual options. This might be also useful if you want to implement a
|
|
8
|
+
* custom client.
|
|
9
|
+
*/
|
|
10
|
+
client?: Client;
|
|
11
|
+
/**
|
|
12
|
+
* You can pass arbitrary values through the `meta` object. This can be
|
|
13
|
+
* used to access values that aren't defined as part of the SDK function.
|
|
14
|
+
*/
|
|
15
|
+
meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
|
|
16
|
+
};
|
|
17
|
+
export declare class Secrets extends HeyApiClient {
|
|
18
|
+
/**
|
|
19
|
+
* List workspace secret names
|
|
20
|
+
*
|
|
21
|
+
* Requires `credentials:manage` on API keys; dashboard browser sessions are also
|
|
22
|
+
* authorized. An execution key alone cannot administer workspace secrets. Lists
|
|
23
|
+
* metadata only; secret values are never returned.
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
list<ThrowOnError extends boolean = true>(options?: Options<SecretsListData, ThrowOnError>): RequestResult<SecretsListResponses, SecretsListErrors, ThrowOnError, 'data'>;
|
|
27
|
+
/**
|
|
28
|
+
* Delete a workspace secret
|
|
29
|
+
*
|
|
30
|
+
* Requires `credentials:manage` on API keys; dashboard browser sessions are also
|
|
31
|
+
* authorized. An execution key alone cannot administer workspace secrets. Remove the
|
|
32
|
+
* named workspace secret and return no secret data.
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
delete<ThrowOnError extends boolean = true>(options: Options<SecretsDeleteData, ThrowOnError>): RequestResult<SecretsDeleteResponses, SecretsDeleteErrors, ThrowOnError, 'data'>;
|
|
36
|
+
/**
|
|
37
|
+
* Store a workspace secret
|
|
38
|
+
*
|
|
39
|
+
* Requires `credentials:manage` on API keys; dashboard browser sessions are also
|
|
40
|
+
* authorized. An execution key alone cannot administer workspace secrets. Create or
|
|
41
|
+
* replace a workspace-scoped secret. The value is accepted only in this request body;
|
|
42
|
+
* it is never returned by this or any secret listing operation.
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
put<ThrowOnError extends boolean = true>(options: Options<SecretsPutData, ThrowOnError>): RequestResult<SecretsPutResponses, SecretsPutErrors, ThrowOnError, 'data'>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { HeyApiClient } from './namespace-base.mjs';
|
|
2
|
+
export class Secrets extends HeyApiClient {
|
|
3
|
+
/**
|
|
4
|
+
* List workspace secret names
|
|
5
|
+
*
|
|
6
|
+
* Requires `credentials:manage` on API keys; dashboard browser sessions are also
|
|
7
|
+
* authorized. An execution key alone cannot administer workspace secrets. Lists
|
|
8
|
+
* metadata only; secret values are never returned.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
list(options) {
|
|
12
|
+
return (options?.client ?? this.client).get({
|
|
13
|
+
responseStyle: 'data',
|
|
14
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
15
|
+
in: 'cookie',
|
|
16
|
+
name: '__Host-boxrouter_session',
|
|
17
|
+
type: 'apiKey'
|
|
18
|
+
}],
|
|
19
|
+
url: '/secrets',
|
|
20
|
+
...options
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Delete a workspace secret
|
|
25
|
+
*
|
|
26
|
+
* Requires `credentials:manage` on API keys; dashboard browser sessions are also
|
|
27
|
+
* authorized. An execution key alone cannot administer workspace secrets. Remove the
|
|
28
|
+
* named workspace secret and return no secret data.
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
delete(options) {
|
|
32
|
+
return (options.client ?? this.client).delete({
|
|
33
|
+
responseStyle: 'data',
|
|
34
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
35
|
+
in: 'cookie',
|
|
36
|
+
name: '__Host-boxrouter_session',
|
|
37
|
+
type: 'apiKey'
|
|
38
|
+
}],
|
|
39
|
+
url: '/secrets/{name}',
|
|
40
|
+
...options
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Store a workspace secret
|
|
45
|
+
*
|
|
46
|
+
* Requires `credentials:manage` on API keys; dashboard browser sessions are also
|
|
47
|
+
* authorized. An execution key alone cannot administer workspace secrets. Create or
|
|
48
|
+
* replace a workspace-scoped secret. The value is accepted only in this request body;
|
|
49
|
+
* it is never returned by this or any secret listing operation.
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
52
|
+
put(options) {
|
|
53
|
+
return (options.client ?? this.client).put({
|
|
54
|
+
responseStyle: 'data',
|
|
55
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
56
|
+
in: 'cookie',
|
|
57
|
+
name: '__Host-boxrouter_session',
|
|
58
|
+
type: 'apiKey'
|
|
59
|
+
}],
|
|
60
|
+
url: '/secrets/{name}',
|
|
61
|
+
...options,
|
|
62
|
+
headers: {
|
|
63
|
+
'Content-Type': 'application/json',
|
|
64
|
+
...options.headers
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client/index.js';
|
|
2
|
+
import { HeyApiClient } from './namespace-base.mjs';
|
|
3
|
+
import type { SpendLimitsClearData, SpendLimitsClearErrors, SpendLimitsClearResponses, SpendLimitsListData, SpendLimitsListErrors, SpendLimitsListResponses, SpendLimitsSetData, SpendLimitsSetErrors, SpendLimitsSetResponses } from './types.gen.js';
|
|
4
|
+
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
|
|
5
|
+
/**
|
|
6
|
+
* You can provide a client instance returned by `createClient()` instead of
|
|
7
|
+
* individual options. This might be also useful if you want to implement a
|
|
8
|
+
* custom client.
|
|
9
|
+
*/
|
|
10
|
+
client?: Client;
|
|
11
|
+
/**
|
|
12
|
+
* You can pass arbitrary values through the `meta` object. This can be
|
|
13
|
+
* used to access values that aren't defined as part of the SDK function.
|
|
14
|
+
*/
|
|
15
|
+
meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
|
|
16
|
+
};
|
|
17
|
+
export declare class SpendLimits extends HeyApiClient {
|
|
18
|
+
/**
|
|
19
|
+
* List managed-compute spend limits
|
|
20
|
+
*
|
|
21
|
+
* Requires account-management permission; execution keys receive 403. Returns the
|
|
22
|
+
* workspace cap and every key's cap; a scope with no cap has `spend_limit: null`.
|
|
23
|
+
* Each capped scope also carries `spent` so far in its current period, holds included:
|
|
24
|
+
* `workspace_spent_nanodollars` for the workspace and `spent_nanodollars` per key.
|
|
25
|
+
* Limits and usage are scoped to the configured test or live billing book. BYOK usage
|
|
26
|
+
* is excluded.
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
list<ThrowOnError extends boolean = true>(options?: Options<SpendLimitsListData, ThrowOnError>): RequestResult<SpendLimitsListResponses, SpendLimitsListErrors, ThrowOnError, 'data'>;
|
|
30
|
+
/**
|
|
31
|
+
* Clear a managed-compute spend cap
|
|
32
|
+
*
|
|
33
|
+
* Requires account-management permission. Removes the scope's cap. Clearing a scope
|
|
34
|
+
* with no cap succeeds and returns `spend_limit: null`.
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
clear<ThrowOnError extends boolean = true>(options: Options<SpendLimitsClearData, ThrowOnError>): RequestResult<SpendLimitsClearResponses, SpendLimitsClearErrors, ThrowOnError, 'data'>;
|
|
38
|
+
/**
|
|
39
|
+
* Set a managed-compute spend cap
|
|
40
|
+
*
|
|
41
|
+
* Requires account-management permission. The cap applies to the scope's settled
|
|
42
|
+
* managed charges and open managed holds. `limit_period` sets when it resets: `daily`
|
|
43
|
+
* and `monthly` at 00:00 UTC (monthly on the first of the month), `total` never.
|
|
44
|
+
* Replaces any cap the scope already has. BYOK usage is excluded.
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
set<ThrowOnError extends boolean = true>(options: Options<SpendLimitsSetData, ThrowOnError>): RequestResult<SpendLimitsSetResponses, SpendLimitsSetErrors, ThrowOnError, 'data'>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { HeyApiClient } from './namespace-base.mjs';
|
|
2
|
+
export class SpendLimits extends HeyApiClient {
|
|
3
|
+
/**
|
|
4
|
+
* List managed-compute spend limits
|
|
5
|
+
*
|
|
6
|
+
* Requires account-management permission; execution keys receive 403. Returns the
|
|
7
|
+
* workspace cap and every key's cap; a scope with no cap has `spend_limit: null`.
|
|
8
|
+
* Each capped scope also carries `spent` so far in its current period, holds included:
|
|
9
|
+
* `workspace_spent_nanodollars` for the workspace and `spent_nanodollars` per key.
|
|
10
|
+
* Limits and usage are scoped to the configured test or live billing book. BYOK usage
|
|
11
|
+
* is excluded.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
list(options) {
|
|
15
|
+
return (options?.client ?? this.client).get({
|
|
16
|
+
responseStyle: 'data',
|
|
17
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
18
|
+
in: 'cookie',
|
|
19
|
+
name: '__Host-boxrouter_session',
|
|
20
|
+
type: 'apiKey'
|
|
21
|
+
}],
|
|
22
|
+
url: '/spend-limits',
|
|
23
|
+
...options
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Clear a managed-compute spend cap
|
|
28
|
+
*
|
|
29
|
+
* Requires account-management permission. Removes the scope's cap. Clearing a scope
|
|
30
|
+
* with no cap succeeds and returns `spend_limit: null`.
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
clear(options) {
|
|
34
|
+
return (options.client ?? this.client).delete({
|
|
35
|
+
responseStyle: 'data',
|
|
36
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
37
|
+
in: 'cookie',
|
|
38
|
+
name: '__Host-boxrouter_session',
|
|
39
|
+
type: 'apiKey'
|
|
40
|
+
}],
|
|
41
|
+
url: '/spend-limits/{scope}',
|
|
42
|
+
...options
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Set a managed-compute spend cap
|
|
47
|
+
*
|
|
48
|
+
* Requires account-management permission. The cap applies to the scope's settled
|
|
49
|
+
* managed charges and open managed holds. `limit_period` sets when it resets: `daily`
|
|
50
|
+
* and `monthly` at 00:00 UTC (monthly on the first of the month), `total` never.
|
|
51
|
+
* Replaces any cap the scope already has. BYOK usage is excluded.
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
set(options) {
|
|
55
|
+
return (options.client ?? this.client).put({
|
|
56
|
+
responseStyle: 'data',
|
|
57
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
58
|
+
in: 'cookie',
|
|
59
|
+
name: '__Host-boxrouter_session',
|
|
60
|
+
type: 'apiKey'
|
|
61
|
+
}],
|
|
62
|
+
url: '/spend-limits/{scope}',
|
|
63
|
+
...options,
|
|
64
|
+
headers: {
|
|
65
|
+
'Content-Type': 'application/json',
|
|
66
|
+
...options.headers
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|