| 1 | import type * as codeartifact from "@distilled.cloud/aws/codeartifact"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Repository } from "./Repository.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Request for {@link GetPackageVersionAsset} — `domain`, `domainOwner`, and |
| 8 | * `repository` are injected from the bound {@link Repository}. |
| 9 | */ |
| 10 | export interface GetPackageVersionAssetRequest extends Omit< |
| 11 | codeartifact.GetPackageVersionAssetRequest, |
| 12 | "domain" | "domainOwner" | "repository" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for `codeartifact:GetPackageVersionAsset`. |
| 17 | * |
| 18 | * Downloads one asset (file) of a package version from the bound repository. The result's `asset` is a `Stream` of bytes. Provide the implementation with |
| 19 | * `Effect.provide(AWS.CodeArtifact.GetPackageVersionAssetHttp)`. |
| 20 | * ### Reading Assets |
| 21 | * **Example:** Download an Asset |
| 22 | * ```typescript |
| 23 | * import * as Stream from "effect/Stream"; |
| 24 | * |
| 25 | * const getAsset = yield* AWS.CodeArtifact.GetPackageVersionAsset(repo); |
| 26 | * |
| 27 | * const res = yield* getAsset({ |
| 28 | * format: "generic", |
| 29 | * namespace: "my-ns", |
| 30 | * package: "my-package", |
| 31 | * packageVersion: "1.0.0", |
| 32 | * asset: "artifact.bin", |
| 33 | * }); |
| 34 | * const bytes = yield* Stream.mkString( |
| 35 | * Stream.decodeText(res.asset!), |
| 36 | * ); |
| 37 | * ``` |
| 38 | * |
| 39 | * @binding |
| 40 | */ |
| 41 | export interface GetPackageVersionAsset extends Binding.Service< |
| 42 | GetPackageVersionAsset, |
| 43 | "AWS.CodeArtifact.GetPackageVersionAsset", |
| 44 | ( |
| 45 | repository: Repository, |
| 46 | ) => Effect.Effect< |
| 47 | ( |
| 48 | request: GetPackageVersionAssetRequest, |
| 49 | ) => Effect.Effect< |
| 50 | codeartifact.GetPackageVersionAssetResult, |
| 51 | codeartifact.GetPackageVersionAssetError |
| 52 | > |
| 53 | > |
| 54 | > {} |
| 55 | |
| 56 | export const GetPackageVersionAsset = Binding.Service<GetPackageVersionAsset>( |
| 57 | "AWS.CodeArtifact.GetPackageVersionAsset", |
| 58 | ); |