| 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 ListJobsRequest extends Omit< |
| 7 | amplify.ListJobsRequest, |
| 8 | "appId" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `amplify:ListJobs`. |
| 13 | * |
| 14 | * Bind an {@link App} in the function's init phase to get a callable that |
| 15 | * lists the build jobs of one of the app's branches, newest first. Provide the |
| 16 | * implementation with `Effect.provide(AWS.Amplify.ListJobsHttp)`. |
| 17 | * ### Observing Jobs |
| 18 | * **Example:** Read the Latest Job of a Branch |
| 19 | * ```typescript |
| 20 | * // init — bind the operation to the app |
| 21 | * const listJobs = yield* AWS.Amplify.ListJobs(app); |
| 22 | * |
| 23 | * // runtime — the first summary is the most recent job |
| 24 | * const { jobSummaries } = yield* listJobs({ |
| 25 | * branchName: "main", |
| 26 | * maxResults: 1, |
| 27 | * }); |
| 28 | * const latest = jobSummaries[0]; |
| 29 | * ``` |
| 30 | * |
| 31 | * @binding |
| 32 | */ |
| 33 | export interface ListJobs extends Binding.Service< |
| 34 | ListJobs, |
| 35 | "AWS.Amplify.ListJobs", |
| 36 | ( |
| 37 | app: App, |
| 38 | ) => Effect.Effect< |
| 39 | ( |
| 40 | request: ListJobsRequest, |
| 41 | ) => Effect.Effect<amplify.ListJobsResult, amplify.ListJobsError> |
| 42 | > |
| 43 | > {} |
| 44 | |
| 45 | export const ListJobs = Binding.Service<ListJobs>("AWS.Amplify.ListJobs"); |