@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 39 lines 1.27 KB
Raw
1 import type * as ag from "@distilled.cloud/aws/api-gateway";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { UsagePlan } from "./UsagePlan.ts";
5
6 export interface GetUsagePlanKeyRequest extends Omit<ag.GetUsagePlanKeyRequest, "usagePlanId"> {}
7
8 /**
9 * Runtime binding for reading a single API key enrolled in a
10 * {@link UsagePlan} (`apigateway:GET` on `/usageplans/{id}/keys/{keyId}`).
11 *
12 * Provide `ApiGateway.GetUsagePlanKeyHttp` on the Function effect to
13 * implement the binding.
14 *
15 * ### Managing plan keys
16 * **Example:** Check a key's enrollment
17 * ```typescript
18 * // init
19 * const getUsagePlanKey = yield* ApiGateway.GetUsagePlanKey(plan);
20 *
21 * // runtime
22 * const enrolled = yield* getUsagePlanKey({ keyId }).pipe(
23 * Effect.map(() => true),
24 * Effect.catchTag("NotFoundException", () => Effect.succeed(false)),
25 * );
26 * ```
27 *
28 * @binding
29 */
30 export interface GetUsagePlanKey extends Binding.Service<
31 GetUsagePlanKey,
32 "AWS.ApiGateway.GetUsagePlanKey",
33 <P extends UsagePlan>(
34 usagePlan: P,
35 ) => Effect.Effect<
36 (request: GetUsagePlanKeyRequest) => Effect.Effect<ag.UsagePlanKey, ag.GetUsagePlanKeyError>
37 >
38 > {}
39 export const GetUsagePlanKey = Binding.Service<GetUsagePlanKey>("AWS.ApiGateway.GetUsagePlanKey");