/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import { billingBuyCredits } from "../funcs/billingBuyCredits.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import {
  BuyCreditsRequest,
  BuyCreditsResponseBody,
} from "../models/buycreditsop.js";
import { unwrapAsync } from "../types/fp.js";

export class Billing extends ClientSDK {
  /**
   * Purchase credits
   *
   * @remarks
   * Purchases credits for a Vercel team using the default payment method on file. The purchase is charged immediately via Stripe invoice. Supported credit types are `v0`, `gateway`, and `agent`. The `amount` field specifies the number of credits to purchase and must be a positive integer. An optional `source` query parameter can be provided to identify the caller. Defaults to `api` if not specified. This is only available for Owner, Member, Developer, Security, and Billing roles for the supplied team.
   */
  async buyCredits(
    request: BuyCreditsRequest,
    options?: RequestOptions,
  ): Promise<BuyCreditsResponseBody> {
    return unwrapAsync(billingBuyCredits(
      this,
      request,
      options,
    ));
  }
}
