@usestatemachines/sdk 0.1.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 +21 -0
- package/README.md +311 -0
- package/agents/SKILL.md +90 -0
- package/agents/index.d.ts +13 -0
- package/agents/index.js +22 -0
- package/agents/llms.txt +93 -0
- package/agents/prompt.md +49 -0
- package/esm/core.d.ts +9 -0
- package/esm/core.js +12 -0
- package/esm/extensions/client.d.ts +81 -0
- package/esm/extensions/client.js +213 -0
- package/esm/extensions/connection.d.ts +42 -0
- package/esm/extensions/connection.js +133 -0
- package/esm/extensions/errors.d.ts +52 -0
- package/esm/extensions/errors.js +129 -0
- package/esm/extensions/index.d.ts +11 -0
- package/esm/extensions/index.js +7 -0
- package/esm/extensions/signal.d.ts +14 -0
- package/esm/extensions/signal.js +29 -0
- package/esm/extensions/wait.d.ts +19 -0
- package/esm/extensions/wait.js +102 -0
- package/esm/funcs/catalog-get.d.ts +11 -0
- package/esm/funcs/catalog-get.js +76 -0
- package/esm/funcs/catalog-release.d.ts +11 -0
- package/esm/funcs/catalog-release.js +92 -0
- package/esm/funcs/credential-get.d.ts +11 -0
- package/esm/funcs/credential-get.js +76 -0
- package/esm/funcs/environments-create.d.ts +11 -0
- package/esm/funcs/environments-create.js +94 -0
- package/esm/funcs/environments-events.d.ts +12 -0
- package/esm/funcs/environments-events.js +98 -0
- package/esm/funcs/environments-get-connection.d.ts +11 -0
- package/esm/funcs/environments-get-connection.js +96 -0
- package/esm/funcs/environments-get.d.ts +11 -0
- package/esm/funcs/environments-get.js +92 -0
- package/esm/funcs/environments-list.d.ts +11 -0
- package/esm/funcs/environments-list.js +100 -0
- package/esm/funcs/environments-reveal.d.ts +11 -0
- package/esm/funcs/environments-reveal.js +97 -0
- package/esm/funcs/environments-stop.d.ts +11 -0
- package/esm/funcs/environments-stop.js +92 -0
- package/esm/funcs/workspaces-events.d.ts +12 -0
- package/esm/funcs/workspaces-events.js +98 -0
- package/esm/funcs/workspaces-get.d.ts +11 -0
- package/esm/funcs/workspaces-get.js +92 -0
- package/esm/funcs/workspaces-list.d.ts +11 -0
- package/esm/funcs/workspaces-list.js +90 -0
- package/esm/hooks/hooks.d.ts +24 -0
- package/esm/hooks/hooks.js +79 -0
- package/esm/hooks/index.d.ts +2 -0
- package/esm/hooks/index.js +5 -0
- package/esm/hooks/types.d.ts +76 -0
- package/esm/hooks/types.js +4 -0
- package/esm/index.d.ts +5 -0
- package/esm/index.js +7 -0
- package/esm/lib/base64.d.ts +9 -0
- package/esm/lib/base64.js +30 -0
- package/esm/lib/config.d.ts +37 -0
- package/esm/lib/config.js +30 -0
- package/esm/lib/encodings.d.ts +54 -0
- package/esm/lib/encodings.js +406 -0
- package/esm/lib/files.d.ts +25 -0
- package/esm/lib/files.js +90 -0
- package/esm/lib/http.d.ts +66 -0
- package/esm/lib/http.js +208 -0
- package/esm/lib/logger.d.ts +5 -0
- package/esm/lib/logger.js +4 -0
- package/esm/lib/matchers.d.ts +58 -0
- package/esm/lib/matchers.js +201 -0
- package/esm/lib/primitives.d.ts +26 -0
- package/esm/lib/primitives.js +119 -0
- package/esm/lib/retries.d.ts +37 -0
- package/esm/lib/retries.js +156 -0
- package/esm/lib/schemas.d.ts +20 -0
- package/esm/lib/schemas.js +56 -0
- package/esm/lib/sdks.d.ts +62 -0
- package/esm/lib/sdks.js +289 -0
- package/esm/lib/security.d.ts +83 -0
- package/esm/lib/security.js +145 -0
- package/esm/lib/url.d.ts +4 -0
- package/esm/lib/url.js +23 -0
- package/esm/models/actor.d.ts +12 -0
- package/esm/models/actor.js +16 -0
- package/esm/models/api-profile.d.ts +17 -0
- package/esm/models/api-profile.js +22 -0
- package/esm/models/app.d.ts +14 -0
- package/esm/models/app.js +18 -0
- package/esm/models/catalog.d.ts +12 -0
- package/esm/models/catalog.js +15 -0
- package/esm/models/connection-secret.d.ts +14 -0
- package/esm/models/connection-secret.js +18 -0
- package/esm/models/connection.d.ts +26 -0
- package/esm/models/connection.js +30 -0
- package/esm/models/create-environment-input.d.ts +35 -0
- package/esm/models/create-environment-input.js +23 -0
- package/esm/models/credential-kind.d.ts +9 -0
- package/esm/models/credential-kind.js +10 -0
- package/esm/models/credential.d.ts +48 -0
- package/esm/models/credential.js +44 -0
- package/esm/models/environment-app.d.ts +42 -0
- package/esm/models/environment-app.js +44 -0
- package/esm/models/environment-lifetime.d.ts +10 -0
- package/esm/models/environment-lifetime.js +14 -0
- package/esm/models/environment.d.ts +47 -0
- package/esm/models/environment.js +48 -0
- package/esm/models/error-response.d.ts +45 -0
- package/esm/models/error-response.js +47 -0
- package/esm/models/errors/error-response.d.ts +18 -0
- package/esm/models/errors/error-response.js +32 -0
- package/esm/models/errors/http-client-errors.d.ts +43 -0
- package/esm/models/errors/http-client-errors.js +55 -0
- package/esm/models/errors/index.d.ts +6 -0
- package/esm/models/errors/index.js +9 -0
- package/esm/models/errors/response-validation-error.d.ts +25 -0
- package/esm/models/errors/response-validation-error.js +36 -0
- package/esm/models/errors/sdk-validation-error.d.ts +20 -0
- package/esm/models/errors/sdk-validation-error.js +51 -0
- package/esm/models/errors/state-machines-http-error.d.ts +18 -0
- package/esm/models/errors/state-machines-http-error.js +25 -0
- package/esm/models/errors/unexpected-response-error.d.ts +9 -0
- package/esm/models/errors/unexpected-response-error.js +29 -0
- package/esm/models/event-page.d.ts +11 -0
- package/esm/models/event-page.js +16 -0
- package/esm/models/event.d.ts +20 -0
- package/esm/models/event.js +22 -0
- package/esm/models/index.d.ts +19 -0
- package/esm/models/index.js +22 -0
- package/esm/models/operations/create-environments.d.ts +27 -0
- package/esm/models/operations/create-environments.js +27 -0
- package/esm/models/operations/get-catalog.d.ts +13 -0
- package/esm/models/operations/get-catalog.js +13 -0
- package/esm/models/operations/get-connection.d.ts +25 -0
- package/esm/models/operations/get-connection.js +21 -0
- package/esm/models/operations/get-credential.d.ts +13 -0
- package/esm/models/operations/get-credential.js +13 -0
- package/esm/models/operations/get-environment.d.ts +23 -0
- package/esm/models/operations/get-environment.js +20 -0
- package/esm/models/operations/get-release.d.ts +23 -0
- package/esm/models/operations/get-release.js +20 -0
- package/esm/models/operations/get-workspace.d.ts +23 -0
- package/esm/models/operations/get-workspace.js +20 -0
- package/esm/models/operations/index.d.ts +13 -0
- package/esm/models/operations/index.js +16 -0
- package/esm/models/operations/list-environment-events.d.ts +15 -0
- package/esm/models/operations/list-environment-events.js +13 -0
- package/esm/models/operations/list-environments.d.ts +49 -0
- package/esm/models/operations/list-environments.js +40 -0
- package/esm/models/operations/list-workspace-events.d.ts +15 -0
- package/esm/models/operations/list-workspace-events.js +13 -0
- package/esm/models/operations/list-workspaces.d.ts +32 -0
- package/esm/models/operations/list-workspaces.js +27 -0
- package/esm/models/operations/reveal-connection.d.ts +37 -0
- package/esm/models/operations/reveal-connection.js +29 -0
- package/esm/models/operations/stop-environment.d.ts +23 -0
- package/esm/models/operations/stop-environment.js +20 -0
- package/esm/models/release-actor.d.ts +11 -0
- package/esm/models/release-actor.js +15 -0
- package/esm/models/release.d.ts +26 -0
- package/esm/models/release.js +29 -0
- package/esm/models/security.d.ts +11 -0
- package/esm/models/security.js +11 -0
- package/esm/models/workspace.d.ts +16 -0
- package/esm/models/workspace.js +21 -0
- package/esm/sdk/catalog.d.ts +6 -0
- package/esm/sdk/catalog.js +15 -0
- package/esm/sdk/credential.d.ts +5 -0
- package/esm/sdk/credential.js +11 -0
- package/esm/sdk/environments.d.ts +12 -0
- package/esm/sdk/environments.js +35 -0
- package/esm/sdk/index.d.ts +1 -0
- package/esm/sdk/index.js +4 -0
- package/esm/sdk/sdk.d.ts +15 -0
- package/esm/sdk/sdk.js +26 -0
- package/esm/sdk/workspaces.d.ts +8 -0
- package/esm/sdk/workspaces.js +19 -0
- package/esm/types/async.d.ts +22 -0
- package/esm/types/async.js +27 -0
- package/esm/types/blobs.d.ts +3 -0
- package/esm/types/blobs.js +24 -0
- package/esm/types/const-date-time.d.ts +2 -0
- package/esm/types/const-date-time.js +9 -0
- package/esm/types/default-to-zero-value.d.ts +11 -0
- package/esm/types/default-to-zero-value.js +30 -0
- package/esm/types/enums.d.ts +8 -0
- package/esm/types/enums.js +26 -0
- package/esm/types/fp.d.ts +30 -0
- package/esm/types/fp.js +30 -0
- package/esm/types/index.d.ts +9 -0
- package/esm/types/index.js +9 -0
- package/esm/types/operations.d.ts +26 -0
- package/esm/types/operations.js +76 -0
- package/esm/types/primitives.d.ts +8 -0
- package/esm/types/primitives.js +108 -0
- package/esm/types/rfcdate.d.ts +20 -0
- package/esm/types/rfcdate.js +42 -0
- package/esm/types/smart-union.d.ts +6 -0
- package/esm/types/smart-union.js +116 -0
- package/esm/types/streams.d.ts +1 -0
- package/esm/types/streams.js +14 -0
- package/esm/types/unrecognized.d.ts +15 -0
- package/esm/types/unrecognized.js +30 -0
- package/openapi.json +2853 -0
- package/package.json +50 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4-mini";
|
|
5
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as operations from "../models/operations/index.js";
|
|
14
|
+
import { APIPromise } from "../types/async.js";
|
|
15
|
+
export function environmentsCreate(client, request, options) {
|
|
16
|
+
return new APIPromise($do(client, request, options));
|
|
17
|
+
}
|
|
18
|
+
async function $do(client, request, options) {
|
|
19
|
+
const parsed = safeParse(request, (value) => z.parse(operations.CreateEnvironmentsRequest$outboundSchema, value), "Input validation failed");
|
|
20
|
+
if (!parsed.ok) {
|
|
21
|
+
return [parsed, { status: "invalid" }];
|
|
22
|
+
}
|
|
23
|
+
const payload = parsed.value;
|
|
24
|
+
const body = encodeJSON("body", payload.body, { explode: true });
|
|
25
|
+
const pathParams = {
|
|
26
|
+
workspaceId: encodeSimple("workspaceId", payload.workspaceId, {
|
|
27
|
+
explode: false,
|
|
28
|
+
charEncoding: "percent",
|
|
29
|
+
}),
|
|
30
|
+
};
|
|
31
|
+
const path = pathToFunc("/v1/workspaces/{workspaceId}/environments")(pathParams);
|
|
32
|
+
const headers = new Headers(compactMap({
|
|
33
|
+
"Content-Type": "application/json",
|
|
34
|
+
Accept: "application/json",
|
|
35
|
+
"idempotency-key": encodeSimple("idempotency-key", payload["idempotency-key"], { explode: false, charEncoding: "none" }),
|
|
36
|
+
}));
|
|
37
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
38
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
39
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
40
|
+
const context = {
|
|
41
|
+
options: client._options,
|
|
42
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
43
|
+
operationID: "createEnvironments",
|
|
44
|
+
oAuth2Scopes: null,
|
|
45
|
+
resolvedSecurity: requestSecurity,
|
|
46
|
+
securitySource: client._options.apiKey,
|
|
47
|
+
retryConfig: options?.retries
|
|
48
|
+
|| client._options.retryConfig
|
|
49
|
+
|| {
|
|
50
|
+
strategy: "backoff",
|
|
51
|
+
backoff: {
|
|
52
|
+
initialInterval: 1000,
|
|
53
|
+
maxInterval: 5000,
|
|
54
|
+
exponent: 1.5,
|
|
55
|
+
maxElapsedTime: 600000,
|
|
56
|
+
},
|
|
57
|
+
retryConnectionErrors: true,
|
|
58
|
+
}
|
|
59
|
+
|| { strategy: "none" },
|
|
60
|
+
retryCodes: options?.retryCodes || ["502", "503", "504"],
|
|
61
|
+
};
|
|
62
|
+
const requestRes = client._createRequest(context, {
|
|
63
|
+
security: requestSecurity,
|
|
64
|
+
method: "POST",
|
|
65
|
+
baseURL: options?.serverURL,
|
|
66
|
+
path: path,
|
|
67
|
+
headers: headers,
|
|
68
|
+
body: body,
|
|
69
|
+
userAgent: client._options.userAgent,
|
|
70
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
71
|
+
}, options);
|
|
72
|
+
if (!requestRes.ok) {
|
|
73
|
+
return [requestRes, { status: "invalid" }];
|
|
74
|
+
}
|
|
75
|
+
const req = requestRes.value;
|
|
76
|
+
const doResult = await client._do(req, {
|
|
77
|
+
context,
|
|
78
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
79
|
+
retryConfig: context.retryConfig,
|
|
80
|
+
retryCodes: context.retryCodes,
|
|
81
|
+
});
|
|
82
|
+
if (!doResult.ok) {
|
|
83
|
+
return [doResult, { status: "request-error", request: req }];
|
|
84
|
+
}
|
|
85
|
+
const response = doResult.value;
|
|
86
|
+
const responseFields = {
|
|
87
|
+
HttpMeta: { Response: response, Request: req },
|
|
88
|
+
};
|
|
89
|
+
const [result] = await M.match(M.json(202, operations.CreateEnvironmentsResponse$inboundSchema), M.jsonErr([400, 401, 403, 404, 409, 413, 422, 429], errors.ErrorResponse$inboundSchema), M.jsonErr([500, 503], errors.ErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
90
|
+
if (!result.ok) {
|
|
91
|
+
return [result, { status: "complete", request: req, response }];
|
|
92
|
+
}
|
|
93
|
+
return [result, { status: "complete", request: req, response }];
|
|
94
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StateMachinesCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/http-client-errors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
6
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
7
|
+
import { StateMachinesHTTPError } from "../models/errors/state-machines-http-error.js";
|
|
8
|
+
import * as models from "../models/index.js";
|
|
9
|
+
import * as operations from "../models/operations/index.js";
|
|
10
|
+
import { APIPromise } from "../types/async.js";
|
|
11
|
+
import { Result } from "../types/fp.js";
|
|
12
|
+
export declare function environmentsEvents(client: StateMachinesCore, request: operations.ListEnvironmentEventsRequest, options?: RequestOptions): APIPromise<Result<models.EventPage, errors.ErrorResponse | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4-mini";
|
|
5
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as models from "../models/index.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { APIPromise } from "../types/async.js";
|
|
16
|
+
export function environmentsEvents(client, request, options) {
|
|
17
|
+
return new APIPromise($do(client, request, options));
|
|
18
|
+
}
|
|
19
|
+
async function $do(client, request, options) {
|
|
20
|
+
const parsed = safeParse(request, (value) => z.parse(operations.ListEnvironmentEventsRequest$outboundSchema, value), "Input validation failed");
|
|
21
|
+
if (!parsed.ok) {
|
|
22
|
+
return [parsed, { status: "invalid" }];
|
|
23
|
+
}
|
|
24
|
+
const payload = parsed.value;
|
|
25
|
+
const body = null;
|
|
26
|
+
const pathParams = {
|
|
27
|
+
environmentId: encodeSimple("environmentId", payload.environmentId, {
|
|
28
|
+
explode: false,
|
|
29
|
+
charEncoding: "percent",
|
|
30
|
+
}),
|
|
31
|
+
};
|
|
32
|
+
const path = pathToFunc("/v1/environments/{environmentId}/events")(pathParams);
|
|
33
|
+
const query = encodeFormQuery({
|
|
34
|
+
"cursor": payload.cursor,
|
|
35
|
+
"limit": payload.limit,
|
|
36
|
+
});
|
|
37
|
+
const headers = new Headers(compactMap({
|
|
38
|
+
Accept: "application/json",
|
|
39
|
+
}));
|
|
40
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
41
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
42
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
43
|
+
const context = {
|
|
44
|
+
options: client._options,
|
|
45
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
46
|
+
operationID: "listEnvironmentEvents",
|
|
47
|
+
oAuth2Scopes: null,
|
|
48
|
+
resolvedSecurity: requestSecurity,
|
|
49
|
+
securitySource: client._options.apiKey,
|
|
50
|
+
retryConfig: options?.retries
|
|
51
|
+
|| client._options.retryConfig
|
|
52
|
+
|| {
|
|
53
|
+
strategy: "backoff",
|
|
54
|
+
backoff: {
|
|
55
|
+
initialInterval: 1000,
|
|
56
|
+
maxInterval: 5000,
|
|
57
|
+
exponent: 1.5,
|
|
58
|
+
maxElapsedTime: 600000,
|
|
59
|
+
},
|
|
60
|
+
retryConnectionErrors: true,
|
|
61
|
+
}
|
|
62
|
+
|| { strategy: "none" },
|
|
63
|
+
retryCodes: options?.retryCodes || ["502", "503", "504"],
|
|
64
|
+
};
|
|
65
|
+
const requestRes = client._createRequest(context, {
|
|
66
|
+
security: requestSecurity,
|
|
67
|
+
method: "GET",
|
|
68
|
+
baseURL: options?.serverURL,
|
|
69
|
+
path: path,
|
|
70
|
+
headers: headers,
|
|
71
|
+
query: query,
|
|
72
|
+
body: body,
|
|
73
|
+
userAgent: client._options.userAgent,
|
|
74
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
75
|
+
}, options);
|
|
76
|
+
if (!requestRes.ok) {
|
|
77
|
+
return [requestRes, { status: "invalid" }];
|
|
78
|
+
}
|
|
79
|
+
const req = requestRes.value;
|
|
80
|
+
const doResult = await client._do(req, {
|
|
81
|
+
context,
|
|
82
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
83
|
+
retryConfig: context.retryConfig,
|
|
84
|
+
retryCodes: context.retryCodes,
|
|
85
|
+
});
|
|
86
|
+
if (!doResult.ok) {
|
|
87
|
+
return [doResult, { status: "request-error", request: req }];
|
|
88
|
+
}
|
|
89
|
+
const response = doResult.value;
|
|
90
|
+
const responseFields = {
|
|
91
|
+
HttpMeta: { Response: response, Request: req },
|
|
92
|
+
};
|
|
93
|
+
const [result] = await M.match(M.json(200, models.EventPage$inboundSchema), M.jsonErr([400, 401, 403, 404, 409, 413, 422, 429], errors.ErrorResponse$inboundSchema), M.jsonErr([500, 503], errors.ErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
94
|
+
if (!result.ok) {
|
|
95
|
+
return [result, { status: "complete", request: req, response }];
|
|
96
|
+
}
|
|
97
|
+
return [result, { status: "complete", request: req, response }];
|
|
98
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StateMachinesCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/http-client-errors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
6
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
7
|
+
import { StateMachinesHTTPError } from "../models/errors/state-machines-http-error.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
export declare function environmentsGetConnection(client: StateMachinesCore, request: operations.GetConnectionRequest, options?: RequestOptions): APIPromise<Result<operations.GetConnectionResponse, errors.ErrorResponse | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4-mini";
|
|
5
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as operations from "../models/operations/index.js";
|
|
14
|
+
import { APIPromise } from "../types/async.js";
|
|
15
|
+
export function environmentsGetConnection(client, request, options) {
|
|
16
|
+
return new APIPromise($do(client, request, options));
|
|
17
|
+
}
|
|
18
|
+
async function $do(client, request, options) {
|
|
19
|
+
const parsed = safeParse(request, (value) => z.parse(operations.GetConnectionRequest$outboundSchema, value), "Input validation failed");
|
|
20
|
+
if (!parsed.ok) {
|
|
21
|
+
return [parsed, { status: "invalid" }];
|
|
22
|
+
}
|
|
23
|
+
const payload = parsed.value;
|
|
24
|
+
const body = null;
|
|
25
|
+
const pathParams = {
|
|
26
|
+
appKey: encodeSimple("appKey", payload.appKey, {
|
|
27
|
+
explode: false,
|
|
28
|
+
charEncoding: "percent",
|
|
29
|
+
}),
|
|
30
|
+
environmentId: encodeSimple("environmentId", payload.environmentId, {
|
|
31
|
+
explode: false,
|
|
32
|
+
charEncoding: "percent",
|
|
33
|
+
}),
|
|
34
|
+
};
|
|
35
|
+
const path = pathToFunc("/v1/environments/{environmentId}/apps/{appKey}/connection")(pathParams);
|
|
36
|
+
const headers = new Headers(compactMap({
|
|
37
|
+
Accept: "application/json",
|
|
38
|
+
}));
|
|
39
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
40
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
41
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
42
|
+
const context = {
|
|
43
|
+
options: client._options,
|
|
44
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
45
|
+
operationID: "getConnection",
|
|
46
|
+
oAuth2Scopes: null,
|
|
47
|
+
resolvedSecurity: requestSecurity,
|
|
48
|
+
securitySource: client._options.apiKey,
|
|
49
|
+
retryConfig: options?.retries
|
|
50
|
+
|| client._options.retryConfig
|
|
51
|
+
|| {
|
|
52
|
+
strategy: "backoff",
|
|
53
|
+
backoff: {
|
|
54
|
+
initialInterval: 1000,
|
|
55
|
+
maxInterval: 5000,
|
|
56
|
+
exponent: 1.5,
|
|
57
|
+
maxElapsedTime: 600000,
|
|
58
|
+
},
|
|
59
|
+
retryConnectionErrors: true,
|
|
60
|
+
}
|
|
61
|
+
|| { strategy: "none" },
|
|
62
|
+
retryCodes: options?.retryCodes || ["502", "503", "504"],
|
|
63
|
+
};
|
|
64
|
+
const requestRes = client._createRequest(context, {
|
|
65
|
+
security: requestSecurity,
|
|
66
|
+
method: "GET",
|
|
67
|
+
baseURL: options?.serverURL,
|
|
68
|
+
path: path,
|
|
69
|
+
headers: headers,
|
|
70
|
+
body: body,
|
|
71
|
+
userAgent: client._options.userAgent,
|
|
72
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
73
|
+
}, options);
|
|
74
|
+
if (!requestRes.ok) {
|
|
75
|
+
return [requestRes, { status: "invalid" }];
|
|
76
|
+
}
|
|
77
|
+
const req = requestRes.value;
|
|
78
|
+
const doResult = await client._do(req, {
|
|
79
|
+
context,
|
|
80
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
81
|
+
retryConfig: context.retryConfig,
|
|
82
|
+
retryCodes: context.retryCodes,
|
|
83
|
+
});
|
|
84
|
+
if (!doResult.ok) {
|
|
85
|
+
return [doResult, { status: "request-error", request: req }];
|
|
86
|
+
}
|
|
87
|
+
const response = doResult.value;
|
|
88
|
+
const responseFields = {
|
|
89
|
+
HttpMeta: { Response: response, Request: req },
|
|
90
|
+
};
|
|
91
|
+
const [result] = await M.match(M.json(200, operations.GetConnectionResponse$inboundSchema), M.jsonErr([400, 401, 403, 404, 409, 413, 422, 429], errors.ErrorResponse$inboundSchema), M.jsonErr([500, 503], errors.ErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
92
|
+
if (!result.ok) {
|
|
93
|
+
return [result, { status: "complete", request: req, response }];
|
|
94
|
+
}
|
|
95
|
+
return [result, { status: "complete", request: req, response }];
|
|
96
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StateMachinesCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/http-client-errors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
6
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
7
|
+
import { StateMachinesHTTPError } from "../models/errors/state-machines-http-error.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
export declare function environmentsGet(client: StateMachinesCore, request: operations.GetEnvironmentRequest, options?: RequestOptions): APIPromise<Result<operations.GetEnvironmentResponse, errors.ErrorResponse | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4-mini";
|
|
5
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as operations from "../models/operations/index.js";
|
|
14
|
+
import { APIPromise } from "../types/async.js";
|
|
15
|
+
export function environmentsGet(client, request, options) {
|
|
16
|
+
return new APIPromise($do(client, request, options));
|
|
17
|
+
}
|
|
18
|
+
async function $do(client, request, options) {
|
|
19
|
+
const parsed = safeParse(request, (value) => z.parse(operations.GetEnvironmentRequest$outboundSchema, value), "Input validation failed");
|
|
20
|
+
if (!parsed.ok) {
|
|
21
|
+
return [parsed, { status: "invalid" }];
|
|
22
|
+
}
|
|
23
|
+
const payload = parsed.value;
|
|
24
|
+
const body = null;
|
|
25
|
+
const pathParams = {
|
|
26
|
+
environmentId: encodeSimple("environmentId", payload.environmentId, {
|
|
27
|
+
explode: false,
|
|
28
|
+
charEncoding: "percent",
|
|
29
|
+
}),
|
|
30
|
+
};
|
|
31
|
+
const path = pathToFunc("/v1/environments/{environmentId}")(pathParams);
|
|
32
|
+
const headers = new Headers(compactMap({
|
|
33
|
+
Accept: "application/json",
|
|
34
|
+
}));
|
|
35
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
36
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
37
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
38
|
+
const context = {
|
|
39
|
+
options: client._options,
|
|
40
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
41
|
+
operationID: "getEnvironment",
|
|
42
|
+
oAuth2Scopes: null,
|
|
43
|
+
resolvedSecurity: requestSecurity,
|
|
44
|
+
securitySource: client._options.apiKey,
|
|
45
|
+
retryConfig: options?.retries
|
|
46
|
+
|| client._options.retryConfig
|
|
47
|
+
|| {
|
|
48
|
+
strategy: "backoff",
|
|
49
|
+
backoff: {
|
|
50
|
+
initialInterval: 1000,
|
|
51
|
+
maxInterval: 5000,
|
|
52
|
+
exponent: 1.5,
|
|
53
|
+
maxElapsedTime: 600000,
|
|
54
|
+
},
|
|
55
|
+
retryConnectionErrors: true,
|
|
56
|
+
}
|
|
57
|
+
|| { strategy: "none" },
|
|
58
|
+
retryCodes: options?.retryCodes || ["502", "503", "504"],
|
|
59
|
+
};
|
|
60
|
+
const requestRes = client._createRequest(context, {
|
|
61
|
+
security: requestSecurity,
|
|
62
|
+
method: "GET",
|
|
63
|
+
baseURL: options?.serverURL,
|
|
64
|
+
path: path,
|
|
65
|
+
headers: headers,
|
|
66
|
+
body: body,
|
|
67
|
+
userAgent: client._options.userAgent,
|
|
68
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
69
|
+
}, options);
|
|
70
|
+
if (!requestRes.ok) {
|
|
71
|
+
return [requestRes, { status: "invalid" }];
|
|
72
|
+
}
|
|
73
|
+
const req = requestRes.value;
|
|
74
|
+
const doResult = await client._do(req, {
|
|
75
|
+
context,
|
|
76
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
77
|
+
retryConfig: context.retryConfig,
|
|
78
|
+
retryCodes: context.retryCodes,
|
|
79
|
+
});
|
|
80
|
+
if (!doResult.ok) {
|
|
81
|
+
return [doResult, { status: "request-error", request: req }];
|
|
82
|
+
}
|
|
83
|
+
const response = doResult.value;
|
|
84
|
+
const responseFields = {
|
|
85
|
+
HttpMeta: { Response: response, Request: req },
|
|
86
|
+
};
|
|
87
|
+
const [result] = await M.match(M.json(200, operations.GetEnvironmentResponse$inboundSchema), M.jsonErr([400, 401, 403, 404, 409, 413, 422, 429], errors.ErrorResponse$inboundSchema), M.jsonErr([500, 503], errors.ErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
88
|
+
if (!result.ok) {
|
|
89
|
+
return [result, { status: "complete", request: req, response }];
|
|
90
|
+
}
|
|
91
|
+
return [result, { status: "complete", request: req, response }];
|
|
92
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StateMachinesCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/http-client-errors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
6
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
7
|
+
import { StateMachinesHTTPError } from "../models/errors/state-machines-http-error.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
export declare function environmentsList(client: StateMachinesCore, request: operations.ListEnvironmentsRequest, options?: RequestOptions): APIPromise<Result<operations.ListEnvironmentsResponse, errors.ErrorResponse | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4-mini";
|
|
5
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as operations from "../models/operations/index.js";
|
|
14
|
+
import { APIPromise } from "../types/async.js";
|
|
15
|
+
export function environmentsList(client, request, options) {
|
|
16
|
+
return new APIPromise($do(client, request, options));
|
|
17
|
+
}
|
|
18
|
+
async function $do(client, request, options) {
|
|
19
|
+
const parsed = safeParse(request, (value) => z.parse(operations.ListEnvironmentsRequest$outboundSchema, value), "Input validation failed");
|
|
20
|
+
if (!parsed.ok) {
|
|
21
|
+
return [parsed, { status: "invalid" }];
|
|
22
|
+
}
|
|
23
|
+
const payload = parsed.value;
|
|
24
|
+
const body = null;
|
|
25
|
+
const pathParams = {
|
|
26
|
+
workspaceId: encodeSimple("workspaceId", payload.workspaceId, {
|
|
27
|
+
explode: false,
|
|
28
|
+
charEncoding: "percent",
|
|
29
|
+
}),
|
|
30
|
+
};
|
|
31
|
+
const path = pathToFunc("/v1/workspaces/{workspaceId}/environments")(pathParams);
|
|
32
|
+
const query = encodeFormQuery({
|
|
33
|
+
"cursor": payload.cursor,
|
|
34
|
+
"label": payload.label,
|
|
35
|
+
"limit": payload.limit,
|
|
36
|
+
"search": payload.search,
|
|
37
|
+
"status": payload.status,
|
|
38
|
+
});
|
|
39
|
+
const headers = new Headers(compactMap({
|
|
40
|
+
Accept: "application/json",
|
|
41
|
+
}));
|
|
42
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
43
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
44
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
45
|
+
const context = {
|
|
46
|
+
options: client._options,
|
|
47
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
48
|
+
operationID: "listEnvironments",
|
|
49
|
+
oAuth2Scopes: null,
|
|
50
|
+
resolvedSecurity: requestSecurity,
|
|
51
|
+
securitySource: client._options.apiKey,
|
|
52
|
+
retryConfig: options?.retries
|
|
53
|
+
|| client._options.retryConfig
|
|
54
|
+
|| {
|
|
55
|
+
strategy: "backoff",
|
|
56
|
+
backoff: {
|
|
57
|
+
initialInterval: 1000,
|
|
58
|
+
maxInterval: 5000,
|
|
59
|
+
exponent: 1.5,
|
|
60
|
+
maxElapsedTime: 600000,
|
|
61
|
+
},
|
|
62
|
+
retryConnectionErrors: true,
|
|
63
|
+
}
|
|
64
|
+
|| { strategy: "none" },
|
|
65
|
+
retryCodes: options?.retryCodes || ["502", "503", "504"],
|
|
66
|
+
};
|
|
67
|
+
const requestRes = client._createRequest(context, {
|
|
68
|
+
security: requestSecurity,
|
|
69
|
+
method: "GET",
|
|
70
|
+
baseURL: options?.serverURL,
|
|
71
|
+
path: path,
|
|
72
|
+
headers: headers,
|
|
73
|
+
query: query,
|
|
74
|
+
body: body,
|
|
75
|
+
userAgent: client._options.userAgent,
|
|
76
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
77
|
+
}, options);
|
|
78
|
+
if (!requestRes.ok) {
|
|
79
|
+
return [requestRes, { status: "invalid" }];
|
|
80
|
+
}
|
|
81
|
+
const req = requestRes.value;
|
|
82
|
+
const doResult = await client._do(req, {
|
|
83
|
+
context,
|
|
84
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
85
|
+
retryConfig: context.retryConfig,
|
|
86
|
+
retryCodes: context.retryCodes,
|
|
87
|
+
});
|
|
88
|
+
if (!doResult.ok) {
|
|
89
|
+
return [doResult, { status: "request-error", request: req }];
|
|
90
|
+
}
|
|
91
|
+
const response = doResult.value;
|
|
92
|
+
const responseFields = {
|
|
93
|
+
HttpMeta: { Response: response, Request: req },
|
|
94
|
+
};
|
|
95
|
+
const [result] = await M.match(M.json(200, operations.ListEnvironmentsResponse$inboundSchema), M.jsonErr([400, 401, 403, 404, 409, 413, 422, 429], errors.ErrorResponse$inboundSchema), M.jsonErr([500, 503], errors.ErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
96
|
+
if (!result.ok) {
|
|
97
|
+
return [result, { status: "complete", request: req, response }];
|
|
98
|
+
}
|
|
99
|
+
return [result, { status: "complete", request: req, response }];
|
|
100
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StateMachinesCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/http-client-errors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
6
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
7
|
+
import { StateMachinesHTTPError } from "../models/errors/state-machines-http-error.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
export declare function environmentsReveal(client: StateMachinesCore, request: operations.RevealConnectionRequest, options?: RequestOptions): APIPromise<Result<operations.RevealConnectionResponse, errors.ErrorResponse | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4-mini";
|
|
5
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as operations from "../models/operations/index.js";
|
|
14
|
+
import { APIPromise } from "../types/async.js";
|
|
15
|
+
export function environmentsReveal(client, request, options) {
|
|
16
|
+
return new APIPromise($do(client, request, options));
|
|
17
|
+
}
|
|
18
|
+
async function $do(client, request, options) {
|
|
19
|
+
const parsed = safeParse(request, (value) => z.parse(operations.RevealConnectionRequest$outboundSchema, value), "Input validation failed");
|
|
20
|
+
if (!parsed.ok) {
|
|
21
|
+
return [parsed, { status: "invalid" }];
|
|
22
|
+
}
|
|
23
|
+
const payload = parsed.value;
|
|
24
|
+
const body = encodeJSON("body", payload.body, { explode: true });
|
|
25
|
+
const pathParams = {
|
|
26
|
+
appKey: encodeSimple("appKey", payload.appKey, {
|
|
27
|
+
explode: false,
|
|
28
|
+
charEncoding: "percent",
|
|
29
|
+
}),
|
|
30
|
+
environmentId: encodeSimple("environmentId", payload.environmentId, {
|
|
31
|
+
explode: false,
|
|
32
|
+
charEncoding: "percent",
|
|
33
|
+
}),
|
|
34
|
+
};
|
|
35
|
+
const path = pathToFunc("/v1/environments/{environmentId}/apps/{appKey}/connection/reveal")(pathParams);
|
|
36
|
+
const headers = new Headers(compactMap({
|
|
37
|
+
"Content-Type": "application/json",
|
|
38
|
+
Accept: "application/json",
|
|
39
|
+
}));
|
|
40
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
41
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
42
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
43
|
+
const context = {
|
|
44
|
+
options: client._options,
|
|
45
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
46
|
+
operationID: "revealConnection",
|
|
47
|
+
oAuth2Scopes: null,
|
|
48
|
+
resolvedSecurity: requestSecurity,
|
|
49
|
+
securitySource: client._options.apiKey,
|
|
50
|
+
retryConfig: options?.retries
|
|
51
|
+
|| client._options.retryConfig
|
|
52
|
+
|| {
|
|
53
|
+
strategy: "backoff",
|
|
54
|
+
backoff: {
|
|
55
|
+
initialInterval: 1000,
|
|
56
|
+
maxInterval: 5000,
|
|
57
|
+
exponent: 1.5,
|
|
58
|
+
maxElapsedTime: 600000,
|
|
59
|
+
},
|
|
60
|
+
retryConnectionErrors: true,
|
|
61
|
+
}
|
|
62
|
+
|| { strategy: "none" },
|
|
63
|
+
retryCodes: options?.retryCodes || ["502", "503", "504"],
|
|
64
|
+
};
|
|
65
|
+
const requestRes = client._createRequest(context, {
|
|
66
|
+
security: requestSecurity,
|
|
67
|
+
method: "POST",
|
|
68
|
+
baseURL: options?.serverURL,
|
|
69
|
+
path: path,
|
|
70
|
+
headers: headers,
|
|
71
|
+
body: body,
|
|
72
|
+
userAgent: client._options.userAgent,
|
|
73
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
74
|
+
}, options);
|
|
75
|
+
if (!requestRes.ok) {
|
|
76
|
+
return [requestRes, { status: "invalid" }];
|
|
77
|
+
}
|
|
78
|
+
const req = requestRes.value;
|
|
79
|
+
const doResult = await client._do(req, {
|
|
80
|
+
context,
|
|
81
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
82
|
+
retryConfig: context.retryConfig,
|
|
83
|
+
retryCodes: context.retryCodes,
|
|
84
|
+
});
|
|
85
|
+
if (!doResult.ok) {
|
|
86
|
+
return [doResult, { status: "request-error", request: req }];
|
|
87
|
+
}
|
|
88
|
+
const response = doResult.value;
|
|
89
|
+
const responseFields = {
|
|
90
|
+
HttpMeta: { Response: response, Request: req },
|
|
91
|
+
};
|
|
92
|
+
const [result] = await M.match(M.json(200, operations.RevealConnectionResponse$inboundSchema), M.jsonErr([400, 401, 403, 404, 409, 413, 422, 429], errors.ErrorResponse$inboundSchema), M.jsonErr([500, 503], errors.ErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
93
|
+
if (!result.ok) {
|
|
94
|
+
return [result, { status: "complete", request: req, response }];
|
|
95
|
+
}
|
|
96
|
+
return [result, { status: "complete", request: req, response }];
|
|
97
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StateMachinesCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/http-client-errors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
6
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
7
|
+
import { StateMachinesHTTPError } from "../models/errors/state-machines-http-error.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
export declare function environmentsStop(client: StateMachinesCore, request: operations.StopEnvironmentRequest, options?: RequestOptions): APIPromise<Result<operations.StopEnvironmentResponse, errors.ErrorResponse | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|