UNPKG

@nangohq/types

Version:

Types used in Nango applications

52 lines (51 loc) 1.24 kB
import type { BillingCustomer, BillingUsageMetric } from '../billing/types'; import type { ReplaceInObject } from '../utils'; import type { DBPlan } from './db.js'; import type { Endpoint } from '../api'; export type ApiPlan = ReplaceInObject<DBPlan, Date, string>; export type PostPlanExtendTrial = Endpoint<{ Method: 'POST'; Path: '/api/v1/plans/trial/extension'; Querystring: { env: string; }; Success: { data: { success: boolean; }; }; }>; export interface PlanDefinition { code: string; title: string; description: string; canUpgrade: boolean; canDowngrade: false; cta?: string; hidden?: boolean; flags: Omit<Partial<DBPlan>, 'id' | 'account_id'>; } export type GetPlans = Endpoint<{ Method: 'GET'; Path: '/api/v1/plans'; Querystring: { env: string; }; Success: { data: PlanDefinition[]; }; }>; export type GetUsage = Endpoint<{ Method: 'GET'; Path: '/api/v1/plans/usage'; Querystring: { env: string; }; Success: { data: { customer: BillingCustomer; current: BillingUsageMetric[]; previous: BillingUsageMetric[]; }; }; }>;