| 1 | import type { |
| 2 | GetPriceError, |
| 3 | GetPriceRequest, |
| 4 | Price as StripePrice, |
| 5 | } from "@distilled.cloud/stripe/stripe"; |
| 6 | import type * as Effect from "effect/Effect"; |
| 7 | import * as Binding from "../Binding.ts"; |
| 8 | import type { RuntimeContext } from "../RuntimeContext.ts"; |
| 9 | import type { Price } from "./Price.ts"; |
| 10 | |
| 11 | export interface RetrievePriceRequest extends Omit<GetPriceRequest, "price"> {} |
| 12 | |
| 13 | /** |
| 14 | * Retrieve a bound Stripe Price over HTTP. |
| 15 | * |
| 16 | * ### Reading a Price |
| 17 | * **Example:** Bind and retrieve |
| 18 | * ```typescript |
| 19 | * const retrieve = yield* Stripe.RetrievePrice(price); |
| 20 | * const live = yield* retrieve(); |
| 21 | * ``` |
| 22 | * |
| 23 | * @binding |
| 24 | * @product Product |
| 25 | */ |
| 26 | export interface RetrievePrice extends Binding.Service< |
| 27 | RetrievePrice, |
| 28 | "Stripe.RetrievePrice", |
| 29 | ( |
| 30 | price: Price, |
| 31 | ) => Effect.Effect< |
| 32 | ( |
| 33 | request?: RetrievePriceRequest, |
| 34 | ) => Effect.Effect<StripePrice, GetPriceError, RuntimeContext> |
| 35 | > |
| 36 | > {} |
| 37 | |
| 38 | export const RetrievePrice = Binding.Service<RetrievePrice>( |
| 39 | "Stripe.RetrievePrice", |
| 40 | ); |