Skip to content

PricingPlansAPI

Defined in: v1/pricing_plans.ts:20

Handles all pricing plan-related API operations. Intended to be instantiated by a parent API client that provides the base fetch logic.

These endpoints are read-only. Creating or modifying pricing plans is not supported in this SDK.

new PricingPlansAPI(baseFetch): PricingPlansAPI

Defined in: v1/pricing_plans.ts:29

Creates a new PricingPlansAPI instance.

<T>(endpoint, schema) => Promise<T>

A generic fetch function provided by the parent client. Handles request execution and response validation against a Zod schema.

PricingPlansAPI

const pricingPlans = new PricingPlansAPI((endpoint, schema) => myClient.fetch(endpoint, schema));

getById(id): Promise<{ pricing_plan: { course_id?: number; created_at?: string; currency: string; description?: string | null; enrollment_cap?: number | null; free_trial_length?: number | null; frequency?: { access_limit_date?: string | null; access_limit_duration?: number | null; access_limit_interval?: string | null; billing_interval?: string | null; billing_interval_count?: number | null; type?: string; }; id: number; name?: string; price: number; updated_at?: string; }; }>

Defined in: v1/pricing_plans.ts:57

Retrieves a single pricing plan by its unique numeric ID. Includes full frequency configuration, free trial length, and enrolment cap.

number

The unique identifier of the pricing plan.

Promise<{ pricing_plan: { course_id?: number; created_at?: string; currency: string; description?: string | null; enrollment_cap?: number | null; free_trial_length?: number | null; frequency?: { access_limit_date?: string | null; access_limit_duration?: number | null; access_limit_interval?: string | null; billing_interval?: string | null; billing_interval_count?: number | null; type?: string; }; id: number; name?: string; price: number; updated_at?: string; }; }>

A promise resolving to a validated PricingPlanDetailResponse object.

If no pricing plan exists with the given ID or the request fails.

const { pricing_plan } = await pricingPlansAPI.getById(4444);
console.log(`${pricing_plan.name}${pricing_plan.currency} ${pricing_plan.price}`);

getList(page?, per?): Promise<{ meta?: { from?: number; number_of_pages?: number; page?: number; per_page?: number; to?: number; total?: number; }; pricing_plans: { course_id?: number; created_at?: string; currency: string; id: number; name?: string; price: number; updated_at?: string; }[]; }>

Defined in: v1/pricing_plans.ts:39

Retrieves a paginated list of all pricing plans across the school.

number = 1

The page number to retrieve. Defaults to 1.

number = 20

The number of results per page. Defaults to 20, maximum: 100.

Promise<{ meta?: { from?: number; number_of_pages?: number; page?: number; per_page?: number; to?: number; total?: number; }; pricing_plans: { course_id?: number; created_at?: string; currency: string; id: number; name?: string; price: number; updated_at?: string; }[]; }>

A promise resolving to a validated PricingPlansResponse object.

const { pricing_plans } = await pricingPlansAPI.getList();