| 1 | import type * as rekognition from "@distilled.cloud/aws/rekognition"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Runtime binding for `rekognition:DetectLabels` — detect real-world |
| 7 | * entities (objects, scenes, concepts) in a JPEG or PNG image. |
| 8 | * |
| 9 | * Rekognition is a pure pay-per-call service with no resource to manage: |
| 10 | * the binding takes no arguments and grants the function |
| 11 | * `rekognition:DetectLabels` (the action has no resource-level IAM). |
| 12 | * Pass the image as raw bytes (`Image.Bytes`) or as an S3 object |
| 13 | * reference (`Image.S3Object`) — raw distilled types, no marshalling. |
| 14 | * Provide the implementation with |
| 15 | * `Effect.provide(AWS.Rekognition.DetectLabelsHttp)`. |
| 16 | * |
| 17 | * ### Detecting Labels |
| 18 | * **Example:** Detect Labels in Image Bytes |
| 19 | * ```typescript |
| 20 | * // init |
| 21 | * const detectLabels = yield* AWS.Rekognition.DetectLabels(); |
| 22 | * |
| 23 | * // runtime |
| 24 | * const result = yield* detectLabels({ |
| 25 | * Image: { Bytes: imageBytes }, |
| 26 | * MaxLabels: 10, |
| 27 | * MinConfidence: 50, |
| 28 | * }); |
| 29 | * const names = (result.Labels ?? []).map((label) => label.Name); |
| 30 | * ``` |
| 31 | * |
| 32 | * @binding |
| 33 | */ |
| 34 | export interface DetectLabels extends Binding.Service< |
| 35 | DetectLabels, |
| 36 | "AWS.Rekognition.DetectLabels", |
| 37 | () => Effect.Effect< |
| 38 | ( |
| 39 | request: rekognition.DetectLabelsRequest, |
| 40 | ) => Effect.Effect< |
| 41 | rekognition.DetectLabelsResponse, |
| 42 | rekognition.DetectLabelsError |
| 43 | > |
| 44 | > |
| 45 | > {} |
| 46 | export const DetectLabels = Binding.Service<DetectLabels>( |
| 47 | "AWS.Rekognition.DetectLabels", |
| 48 | ); |