@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 40 lines 1.2 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 UpdateUsageRequest extends Omit<ag.UpdateUsageRequest, "usagePlanId"> {}
7
8 /**
9 * Runtime binding for granting a temporary quota extension to an API key
10 * on a {@link UsagePlan} (`apigateway:PATCH` on
11 * `/usageplans/{id}/keys/{keyId}/usage`).
12 *
13 * Provide `ApiGateway.UpdateUsageHttp` on the Function effect to implement
14 * the binding.
15 *
16 * ### Metering usage
17 * **Example:** Extend a key's remaining quota
18 * ```typescript
19 * // init
20 * const updateUsage = yield* ApiGateway.UpdateUsage(plan);
21 *
22 * // runtime
23 * yield* updateUsage({
24 * keyId,
25 * patchOperations: [
26 * { op: "replace", path: "/remaining", value: "500" },
27 * ],
28 * });
29 * ```
30 *
31 * @binding
32 */
33 export interface UpdateUsage extends Binding.Service<
34 UpdateUsage,
35 "AWS.ApiGateway.UpdateUsage",
36 <P extends UsagePlan>(
37 usagePlan: P,
38 ) => Effect.Effect<(request: UpdateUsageRequest) => Effect.Effect<ag.Usage, ag.UpdateUsageError>>
39 > {}
40 export const UpdateUsage = Binding.Service<UpdateUsage>("AWS.ApiGateway.UpdateUsage");