| 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 { Registry } from "./Registry.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `schemas:SearchSchemas`. |
| 8 | * |
| 9 | * Searches the bound {@link Registry}'s schemas by keyword — matching both |
| 10 | * schema names and content — so a function can discover event contracts at |
| 11 | * runtime. The registry name is injected from the binding. Provide the |
| 12 | * implementation with `Effect.provide(AWS.Schemas.SearchSchemasHttp)`. |
| 13 | * ### Searching a Registry |
| 14 | * **Example:** Find Schemas By Keyword |
| 15 | * ```typescript |
| 16 | * // init — bind the operation to the registry |
| 17 | * const searchSchemas = yield* AWS.Schemas.SearchSchemas(registry); |
| 18 | * |
| 19 | * // runtime |
| 20 | * const { Schemas } = yield* searchSchemas({ Keywords: "order" }); |
| 21 | * const names = (Schemas ?? []).map((s) => s.SchemaName); |
| 22 | * ``` |
| 23 | * |
| 24 | * @binding |
| 25 | */ |
| 26 | export interface SearchSchemas extends Binding.Service< |
| 27 | SearchSchemas, |
| 28 | "AWS.Schemas.SearchSchemas", |
| 29 | (registry: Registry) => Effect.Effect< |
| 30 | (request?: { |
| 31 | /** Keywords matched against schema names and content. */ |
| 32 | Keywords?: string; |
| 33 | /** The maximum number of results to return per page. */ |
| 34 | Limit?: number; |
| 35 | /** The pagination token from a previous response. */ |
| 36 | NextToken?: string; |
| 37 | }) => Effect.Effect< |
| 38 | schemas.SearchSchemasResponse, |
| 39 | schemas.SearchSchemasError |
| 40 | > |
| 41 | > |
| 42 | > {} |
| 43 | export const SearchSchemas = Binding.Service<SearchSchemas>( |
| 44 | "AWS.Schemas.SearchSchemas", |
| 45 | ); |