1import type * as qapps from "@distilled.cloud/aws/qapps";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { QApp } from "./QApp.ts";
5
6/**
7 * Request for {@link CreatePresignedUrl} — `instanceId` and `appId` are injected from the bound Q App.
8 */
9export interface CreatePresignedUrlRequest extends Omit<
10 qapps.CreatePresignedUrlInput,
11 "instanceId" | "appId"
12> {}
13
14/**
15 * Runtime binding for `qapps:CreatePresignedUrl`.
16 *
17 * Creates a presigned upload URL for a file-upload card of the bound Q App. Provide the implementation with
18 * `Effect.provide(AWS.QApps.CreatePresignedUrlHttp)`.
19 * ### Files
20 * **Example:** Create a Presigned Upload URL
21 * ```typescript
22 * // init — bind the operation to the Q App
23 * const createPresignedUrl = yield* AWS.QApps.CreatePresignedUrl(app);
24 *
25 * // runtime
26 * const upload = yield* createPresignedUrl({
27 * cardId,
28 * fileContentsSha256,
29 * fileName: "report.pdf",
30 * scope: "SESSION",
31 * sessionId,
32 * });
33 * console.log(upload.presignedUrl);
34 * ```
35 *
36 * @binding
37 */
38export interface CreatePresignedUrl extends Binding.Service<
39 CreatePresignedUrl,
40 "AWS.QApps.CreatePresignedUrl",
41 (
42 app: QApp,
43 ) => Effect.Effect<
44 (
45 request: CreatePresignedUrlRequest,
46 ) => Effect.Effect<
47 qapps.CreatePresignedUrlOutput,
48 qapps.CreatePresignedUrlError
49 >
50 >
51> {}
52
53export const CreatePresignedUrl = Binding.Service<CreatePresignedUrl>(
54 "AWS.QApps.CreatePresignedUrl",
55);