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 CreateLibraryItem} — `instanceId` and `appId` are injected from the bound Q App.
8 */
9export interface CreateLibraryItemRequest extends Omit<
10 qapps.CreateLibraryItemInput,
11 "instanceId" | "appId"
12> {}
13
14/**
15 * Runtime binding for `qapps:CreateLibraryItem`.
16 *
17 * Publishes a version of the bound Q App into the instance's library so other users can discover and run it. Provide the implementation with
18 * `Effect.provide(AWS.QApps.CreateLibraryItemHttp)`.
19 * ### Library Items
20 * **Example:** Publish the App to the Library
21 * ```typescript
22 * // init — bind the operation to the Q App
23 * const createLibraryItem = yield* AWS.QApps.CreateLibraryItem(app);
24 *
25 * // runtime
26 * const item = yield* createLibraryItem({
27 * appVersion: 1,
28 * categories: [categoryId],
29 * });
30 * console.log(item.libraryItemId);
31 * ```
32 *
33 * @binding
34 */
35export interface CreateLibraryItem extends Binding.Service<
36 CreateLibraryItem,
37 "AWS.QApps.CreateLibraryItem",
38 (
39 app: QApp,
40 ) => Effect.Effect<
41 (
42 request: CreateLibraryItemRequest,
43 ) => Effect.Effect<
44 qapps.CreateLibraryItemOutput,
45 qapps.CreateLibraryItemError
46 >
47 >
48> {}
49
50export const CreateLibraryItem = Binding.Service<CreateLibraryItem>(
51 "AWS.QApps.CreateLibraryItem",
52);