| 1 | import type { |
| 2 | GetPlanError, |
| 3 | GetPlanRequest, |
| 4 | Plan as StripePlan, |
| 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 { Plan } from "./Plan.ts"; |
| 10 | |
| 11 | export interface RetrievePlanRequest extends Omit<GetPlanRequest, "plan"> {} |
| 12 | |
| 13 | /** |
| 14 | * Retrieve a bound Stripe Plan over HTTP. |
| 15 | * |
| 16 | * ### Reading a Plan |
| 17 | * **Example:** Bind and retrieve |
| 18 | * ```typescript |
| 19 | * const retrieve = yield* Stripe.RetrievePlan(plan); |
| 20 | * const live = yield* retrieve(); |
| 21 | * ``` |
| 22 | * |
| 23 | * @binding |
| 24 | * @product Product |
| 25 | */ |
| 26 | export interface RetrievePlan extends Binding.Service< |
| 27 | RetrievePlan, |
| 28 | "Stripe.RetrievePlan", |
| 29 | ( |
| 30 | plan: Plan, |
| 31 | ) => Effect.Effect< |
| 32 | ( |
| 33 | request?: RetrievePlanRequest, |
| 34 | ) => Effect.Effect<StripePlan, GetPlanError, RuntimeContext> |
| 35 | > |
| 36 | > {} |
| 37 | |
| 38 | export const RetrievePlan = Binding.Service<RetrievePlan>( |
| 39 | "Stripe.RetrievePlan", |
| 40 | ); |