| 1 | import type * as amplify from "@distilled.cloud/aws/amplify"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { App } from "./App.ts"; |
| 5 | |
| 6 | export interface GetArtifactUrlRequest extends amplify.GetArtifactUrlRequest {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `amplify:GetArtifactUrl`. |
| 10 | * |
| 11 | * Bind an {@link App} in the function's init phase to get a callable that |
| 12 | * resolves a pre-signed download URL for a build artifact discovered via |
| 13 | * {@link ListArtifacts}. Provide the implementation with |
| 14 | * `Effect.provide(AWS.Amplify.GetArtifactUrlHttp)`. |
| 15 | * ### Reading Artifacts |
| 16 | * **Example:** Download a Job Artifact |
| 17 | * ```typescript |
| 18 | * // init — bind the operation to the app |
| 19 | * const listArtifacts = yield* AWS.Amplify.ListArtifacts(app); |
| 20 | * const getArtifactUrl = yield* AWS.Amplify.GetArtifactUrl(app); |
| 21 | * |
| 22 | * // runtime — resolve a pre-signed URL for the first artifact |
| 23 | * const { artifacts } = yield* listArtifacts({ |
| 24 | * branchName: "main", |
| 25 | * jobId: "42", |
| 26 | * }); |
| 27 | * const { artifactUrl } = yield* getArtifactUrl({ |
| 28 | * artifactId: artifacts[0].artifactId, |
| 29 | * }); |
| 30 | * ``` |
| 31 | * |
| 32 | * @binding |
| 33 | */ |
| 34 | export interface GetArtifactUrl extends Binding.Service< |
| 35 | GetArtifactUrl, |
| 36 | "AWS.Amplify.GetArtifactUrl", |
| 37 | ( |
| 38 | app: App, |
| 39 | ) => Effect.Effect< |
| 40 | ( |
| 41 | request: GetArtifactUrlRequest, |
| 42 | ) => Effect.Effect< |
| 43 | amplify.GetArtifactUrlResult, |
| 44 | amplify.GetArtifactUrlError |
| 45 | > |
| 46 | > |
| 47 | > {} |
| 48 | |
| 49 | export const GetArtifactUrl = Binding.Service<GetArtifactUrl>( |
| 50 | "AWS.Amplify.GetArtifactUrl", |
| 51 | ); |