1import type * as polly from "@distilled.cloud/aws/polly";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4
5/**
6 * Runtime binding for `polly:GetSpeechSynthesisTask` — retrieve the status
7 * (and output S3 URI) of an asynchronous synthesis task by its TaskId.
8 *
9 * The binding takes no arguments and grants the function
10 * `polly:GetSpeechSynthesisTask`. Provide the implementation with
11 * `Effect.provide(AWS.Polly.GetSpeechSynthesisTaskHttp)`.
12 *
13 * ### Asynchronous Synthesis
14 * **Example:** Poll a synthesis task until it completes
15 * ```typescript
16 * // init
17 * const getSpeechSynthesisTask = yield* AWS.Polly.GetSpeechSynthesisTask();
18 *
19 * // runtime — bounded poll until the task leaves the queue
20 * const task = yield* getSpeechSynthesisTask({ TaskId: taskId }).pipe(
21 * Effect.repeat({
22 * schedule: Schedule.spaced("2 seconds"),
23 * until: (r): boolean =>
24 * r.SynthesisTask?.TaskStatus === "completed" ||
25 * r.SynthesisTask?.TaskStatus === "failed",
26 * times: 25,
27 * }),
28 * );
29 * ```
30 *
31 * @binding
32 */
33export interface GetSpeechSynthesisTask extends Binding.Service<
34 GetSpeechSynthesisTask,
35 "AWS.Polly.GetSpeechSynthesisTask",
36 () => Effect.Effect<
37 (
38 request: polly.GetSpeechSynthesisTaskInput,
39 ) => Effect.Effect<
40 polly.GetSpeechSynthesisTaskOutput,
41 polly.GetSpeechSynthesisTaskError
42 >
43 >
44> {}
45export const GetSpeechSynthesisTask = Binding.Service<GetSpeechSynthesisTask>(
46 "AWS.Polly.GetSpeechSynthesisTask",
47);