/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { creditGrantsCreateCreditGrant } from "../funcs/credit-grants-create-credit-grant.js"; import { creditGrantsDeleteCreditGrant } from "../funcs/credit-grants-delete-credit-grant.js"; import { creditGrantsGetAddonCreditGrants } from "../funcs/credit-grants-get-addon-credit-grants.js"; import { creditGrantsGetCreditGrant } from "../funcs/credit-grants-get-credit-grant.js"; import { creditGrantsGetPlanCreditGrants } from "../funcs/credit-grants-get-plan-credit-grants.js"; import { creditGrantsUpdateCreditGrant } from "../funcs/credit-grants-update-credit-grant.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { unwrapAsync } from "../types/fp.js"; import * as models from "./models/index.js"; export class CreditGrants extends ClientSDK { /** * Get addon credit grants * * @remarks * Use when listing credits attached to an addon (e.g. included prepaid or promo credits). */ async getAddonCreditGrants( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(creditGrantsGetAddonCreditGrants( this, id, options, )); } /** * Create credit grant * * @remarks * Use when giving a customer or plan credits (e.g. prepaid balance or promotional credits). Scope can be plan or subscription; supports start/end dates. */ async createCreditGrant( request: models.CreateCreditGrantRequest, options?: RequestOptions, ): Promise { return unwrapAsync(creditGrantsCreateCreditGrant( this, request, options, )); } /** * Get credit grant * * @remarks * Use when you need to load a single credit grant (e.g. for display or to check balance). */ async getCreditGrant( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(creditGrantsGetCreditGrant( this, id, options, )); } /** * Update credit grant * * @remarks * Use when changing a credit grant (e.g. amount or end date). Request body contains the fields to update. */ async updateCreditGrant( id: string, body: models.UpdateCreditGrantRequest, options?: RequestOptions, ): Promise { return unwrapAsync(creditGrantsUpdateCreditGrant( this, id, body, options, )); } /** * Delete credit grant * * @remarks * Use when removing or ending a credit grant (e.g. revoke promo or close prepaid). Plan-scoped grants are archived; subscription-scoped supports optional effective_date in body. */ async deleteCreditGrant( id: string, body?: models.DeleteCreditGrantRequest | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(creditGrantsDeleteCreditGrant( this, id, body, options, )); } /** * Get plan credit grants * * @remarks * Use when listing credits attached to a plan (e.g. included prepaid or promo credits). */ async getPlanCreditGrants( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(creditGrantsGetPlanCreditGrants( this, id, options, )); } }