/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { entitlementsCreateEntitlement } from "../funcs/entitlements-create-entitlement.js"; import { entitlementsCreateEntitlementsBulk } from "../funcs/entitlements-create-entitlements-bulk.js"; import { entitlementsDeleteEntitlement } from "../funcs/entitlements-delete-entitlement.js"; import { entitlementsGetAddonEntitlements } from "../funcs/entitlements-get-addon-entitlements.js"; import { entitlementsGetEntitlement } from "../funcs/entitlements-get-entitlement.js"; import { entitlementsGetPlanEntitlements } from "../funcs/entitlements-get-plan-entitlements.js"; import { entitlementsQueryEntitlement } from "../funcs/entitlements-query-entitlement.js"; import { entitlementsUpdateEntitlement } from "../funcs/entitlements-update-entitlement.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { unwrapAsync } from "../types/fp.js"; import * as models from "./models/index.js"; export class Entitlements extends ClientSDK { /** * Get addon entitlements * * @remarks * Use when checking what features or limits an addon grants (e.g. for display or entitlement logic). */ async getAddonEntitlements( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(entitlementsGetAddonEntitlements( this, id, options, )); } /** * Create entitlement * * @remarks * Use when attaching a feature (and its limit) to a plan or addon (e.g. "10 seats" or "1000 API calls"). Defines what the plan/addon includes. */ async createEntitlement( request: models.CreateEntitlementRequest, options?: RequestOptions, ): Promise { return unwrapAsync(entitlementsCreateEntitlement( this, request, options, )); } /** * Create entitlements in bulk * * @remarks * Use when attaching many features to a plan or addon at once (e.g. initial plan setup or import). Bulk version of create entitlement. */ async createEntitlementsBulk( request: models.CreateBulkEntitlementRequest, options?: RequestOptions, ): Promise { return unwrapAsync(entitlementsCreateEntitlementsBulk( this, request, options, )); } /** * Query entitlements * * @remarks * Use when listing or searching entitlements (e.g. plan editor or audit). Returns a paginated list; supports filtering by plan, addon, feature. */ async queryEntitlement( request: models.EntitlementFilter, options?: RequestOptions, ): Promise { return unwrapAsync(entitlementsQueryEntitlement( this, request, options, )); } /** * Get entitlement * * @remarks * Use when you need to load a single entitlement (e.g. to display or edit a feature limit). */ async getEntitlement( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(entitlementsGetEntitlement( this, id, options, )); } /** * Update entitlement * * @remarks * Use when changing an entitlement (e.g. increasing or decreasing a limit). Request body contains the fields to update. */ async updateEntitlement( id: string, body: models.UpdateEntitlementRequest, options?: RequestOptions, ): Promise { return unwrapAsync(entitlementsUpdateEntitlement( this, id, body, options, )); } /** * Delete entitlement * * @remarks * Use when removing a feature from a plan or addon (e.g. deprecating a capability). Returns 200 with success message. */ async deleteEntitlement( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(entitlementsDeleteEntitlement( this, id, options, )); } /** * Get plan entitlements * * @remarks * Use when checking what a plan includes (e.g. feature list or limits for display or gating). */ async getPlanEntitlements( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(entitlementsGetPlanEntitlements( this, id, options, )); } }