sailfork / t3code-github / .repos/ alchemy-effect/ packages/ stripe/ src/ RetrieveCreditGrantHttp.ts

import { GetBillingCreditGrant } from "@distilled.cloud/stripe/stripe";
import * as Layer from "effect/Layer";
import { RetrieveCreditGrant } from "./RetrieveCreditGrant.ts";
import { makeHttpStripeIdBinding } from "./StripeHttp.ts";

/**
 * HTTP implementation of {@link RetrieveCreditGrant}. Provide it on the
 * Function or Worker Effect.
 *
 * @layer
 * @product Billing
 * @provides Stripe.RetrieveCreditGrant
 */
export const RetrieveCreditGrantHttp = Layer.effect(
  RetrieveCreditGrant,
  makeHttpStripeIdBinding({
    tag: "Stripe.RetrieveCreditGrant",
    operation: GetBillingCreditGrant,
    idField: "id",
    permissions: ["credit_grants_read"],
  }),
);