@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 46 lines 1.66 KB
Raw
1 import type * as agw2 from "@distilled.cloud/aws/apigatewayv2";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { Api } from "./Api.ts";
5
6 /**
7 * Request options for {@link ExportApi}. `ApiId` is resolved from the
8 * bound {@link Api}; `Specification` defaults to `OAS30` (the only
9 * supported value — exports are OpenAPI 3.0, HTTP APIs only).
10 */
11 export interface ExportApiRequest extends Partial<Omit<agw2.ExportApiRequest, "ApiId">> {}
12
13 /**
14 * Runtime binding for exporting an HTTP API's OpenAPI 3.0 definition
15 * (`apigateway:GET` on `/apis/{apiId}/exports/{specification}`).
16 *
17 * Bind an {@link Api} inside a function runtime to serve or snapshot the
18 * live API definition — e.g. publishing your own `/openapi.json` route or
19 * diffing deployed routes against the source of truth. The response
20 * `body` is a byte `Stream` of the JSON (or YAML) document. Provide
21 * `ApiGatewayV2.ExportApiHttp` on the Function effect to implement the
22 * binding.
23 *
24 * ### Exporting API definitions
25 * **Example:** Serve the live OpenAPI document
26 * ```typescript
27 * // init
28 * const exportApi = yield* ApiGatewayV2.ExportApi(api);
29 *
30 * // runtime
31 * const exported = yield* exportApi({ OutputType: "JSON" });
32 * const document = yield* Stream.mkString(Stream.decodeText(exported.body!));
33 * ```
34 *
35 * @binding
36 */
37 export interface ExportApi extends Binding.Service<
38 ExportApi,
39 "AWS.ApiGatewayV2.ExportApi",
40 <A extends Api>(
41 api: A,
42 ) => Effect.Effect<
43 (request?: ExportApiRequest) => Effect.Effect<agw2.ExportApiResponse, agw2.ExportApiError>
44 >
45 > {}
46 export const ExportApi = Binding.Service<ExportApi>("AWS.ApiGatewayV2.ExportApi");