1import type * as codeartifact from "@distilled.cloud/aws/codeartifact";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Repository } from "./Repository.ts";
5
6/**
7 * Request for {@link ListPackages} — `domain`, `domainOwner`, and
8 * `repository` are injected from the bound {@link Repository}.
9 */
10export interface ListPackagesRequest extends Omit<
11 codeartifact.ListPackagesRequest,
12 "domain" | "domainOwner" | "repository"
13> {}
14
15/**
16 * Runtime binding for `codeartifact:ListPackages`.
17 *
18 * Lists the packages stored in the bound repository. Provide the implementation with
19 * `Effect.provide(AWS.CodeArtifact.ListPackagesHttp)`.
20 * ### Browsing Packages
21 * **Example:** List Packages by Prefix
22 * ```typescript
23 * const listPackages = yield* AWS.CodeArtifact.ListPackages(repo);
24 *
25 * const res = yield* listPackages({ packagePrefix: "my-" });
26 * for (const pkg of res.packages ?? []) console.log(pkg.package);
27 * ```
28 *
29 * @binding
30 */
31export interface ListPackages extends Binding.Service<
32 ListPackages,
33 "AWS.CodeArtifact.ListPackages",
34 (
35 repository: Repository,
36 ) => Effect.Effect<
37 (
38 request: ListPackagesRequest,
39 ) => Effect.Effect<
40 codeartifact.ListPackagesResult,
41 codeartifact.ListPackagesError
42 >
43 >
44> {}
45
46export const ListPackages = Binding.Service<ListPackages>(
47 "AWS.CodeArtifact.ListPackages",
48);