/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { plansClonePlan } from "../funcs/plans-clone-plan.js"; import { plansCreatePlan } from "../funcs/plans-create-plan.js"; import { plansDeletePlan } from "../funcs/plans-delete-plan.js"; import { plansGetPlan } from "../funcs/plans-get-plan.js"; import { plansQueryPlan } from "../funcs/plans-query-plan.js"; import { plansSyncPlanPrices } from "../funcs/plans-sync-plan-prices.js"; import { plansUpdatePlan } from "../funcs/plans-update-plan.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { unwrapAsync } from "../types/fp.js"; import * as models from "./models/index.js"; export class Plans extends ClientSDK { /** * Create plan * * @remarks * Use when defining a new pricing plan (e.g. Free, Pro, Enterprise). Attach prices and entitlements; customers subscribe to plans. */ async createPlan( request: models.CreatePlanRequest, options?: RequestOptions, ): Promise { return unwrapAsync(plansCreatePlan( this, request, options, )); } /** * Query plans * * @remarks * Use when listing or searching plans (e.g. plan picker or admin catalog). Returns a paginated list; supports filtering and sorting. */ async queryPlan( request: models.PlanFilter, options?: RequestOptions, ): Promise { return unwrapAsync(plansQueryPlan( this, request, options, )); } /** * Get plan * * @remarks * Use when you need to load a single plan (e.g. for display or to create a subscription). */ async getPlan( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(plansGetPlan( this, id, options, )); } /** * Update plan * * @remarks * Use when changing plan details (e.g. name, interval, or metadata). Partial update supported. */ async updatePlan( id: string, body: models.UpdatePlanRequest, options?: RequestOptions, ): Promise { return unwrapAsync(plansUpdatePlan( this, id, body, options, )); } /** * Delete plan * * @remarks * Use when retiring a plan (e.g. end-of-life). Existing subscriptions may be affected. Returns 200 with success message. */ async deletePlan( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(plansDeletePlan( this, id, options, )); } /** * Clone a plan * * @remarks * Clone an existing plan, copying its active prices, published entitlements, and published credit grants */ async clonePlan( id: string, body: models.ClonePlanRequest, options?: RequestOptions, ): Promise { return unwrapAsync(plansClonePlan( this, id, body, options, )); } /** * Synchronize plan prices * * @remarks * Use when you have changed plan prices and need to push them to all active subscriptions (e.g. global price update). Returns workflow ID. */ async syncPlanPrices( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(plansSyncPlanPrices( this, id, options, )); } }