| 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:ListSchemaVersions`. |
| 8 | * |
| 9 | * Lists the published versions of the bound {@link Schema} so a function can |
| 10 | * enumerate the history of an event contract (e.g. to detect that a new |
| 11 | * version was published, or to pin consumers to a version range). The |
| 12 | * registry and schema names are injected from the binding. Provide the |
| 13 | * implementation with `Effect.provide(AWS.Schemas.ListSchemaVersionsHttp)`. |
| 14 | * ### Reading Schemas |
| 15 | * **Example:** List All Versions |
| 16 | * ```typescript |
| 17 | * // init — bind the operation to the schema |
| 18 | * const listSchemaVersions = yield* AWS.Schemas.ListSchemaVersions(schema); |
| 19 | * |
| 20 | * // runtime |
| 21 | * const { SchemaVersions } = yield* listSchemaVersions(); |
| 22 | * const versions = (SchemaVersions ?? []).map((v) => v.SchemaVersion); |
| 23 | * ``` |
| 24 | * |
| 25 | * @binding |
| 26 | */ |
| 27 | export interface ListSchemaVersions extends Binding.Service< |
| 28 | ListSchemaVersions, |
| 29 | "AWS.Schemas.ListSchemaVersions", |
| 30 | (schema: Schema) => Effect.Effect< |
| 31 | (request?: { |
| 32 | /** The maximum number of versions to return per page. */ |
| 33 | Limit?: number; |
| 34 | /** The pagination token from a previous response. */ |
| 35 | NextToken?: string; |
| 36 | }) => Effect.Effect< |
| 37 | schemas.ListSchemaVersionsResponse, |
| 38 | schemas.ListSchemaVersionsError |
| 39 | > |
| 40 | > |
| 41 | > {} |
| 42 | export const ListSchemaVersions = Binding.Service<ListSchemaVersions>( |
| 43 | "AWS.Schemas.ListSchemaVersions", |
| 44 | ); |