| 1 | import type * as schemas from "@distilled.cloud/aws/schemas"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Schema } from "./Schema.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `schemas:GetCodeBindingSource`. |
| 8 | * |
| 9 | * Downloads the generated code-binding package (a zip archive, streamed as |
| 10 | * `Body`) for the bound {@link Schema} in a target language. Generate the |
| 11 | * package first with {@link PutCodeBinding} and wait for |
| 12 | * {@link DescribeCodeBinding} to report `CREATE_COMPLETE`. The registry and |
| 13 | * schema names are injected from the binding. Provide the implementation |
| 14 | * with `Effect.provide(AWS.Schemas.GetCodeBindingSourceHttp)`. |
| 15 | * ### Code Bindings |
| 16 | * **Example:** Download The Generated Package |
| 17 | * ```typescript |
| 18 | * // init — bind the operation to the schema |
| 19 | * const getCodeBindingSource = yield* AWS.Schemas.GetCodeBindingSource(schema); |
| 20 | * |
| 21 | * // runtime — Body is a Stream of Uint8Array chunks (a zip archive) |
| 22 | * const { Body } = yield* getCodeBindingSource({ Language: "Python36" }); |
| 23 | * const bytes = yield* Stream.runFold(Body!, 0, (n, chunk) => n + chunk.length); |
| 24 | * ``` |
| 25 | * |
| 26 | * @binding |
| 27 | */ |
| 28 | export interface GetCodeBindingSource extends Binding.Service< |
| 29 | GetCodeBindingSource, |
| 30 | "AWS.Schemas.GetCodeBindingSource", |
| 31 | (schema: Schema) => Effect.Effect< |
| 32 | (request: { |
| 33 | /** The target language: `Java8`, `Python36`, `TypeScript3`, or `Go1`. */ |
| 34 | Language: string; |
| 35 | /** The version of the schema. Defaults to the latest. */ |
| 36 | SchemaVersion?: string; |
| 37 | }) => Effect.Effect< |
| 38 | schemas.GetCodeBindingSourceResponse, |
| 39 | schemas.GetCodeBindingSourceError |
| 40 | > |
| 41 | > |
| 42 | > {} |
| 43 | export const GetCodeBindingSource = Binding.Service<GetCodeBindingSource>( |
| 44 | "AWS.Schemas.GetCodeBindingSource", |
| 45 | ); |