import type { Client } from 'openapi-fetch'; import type { RequestOptions } from './common.js'; import type { CreateStripeCustomerPortalSessionParams, CustomerAppData, CustomerCreate, CustomerReplaceUpdate, operations, paths, StripeCustomerAppDataBase } from './schemas.js'; /** * Customers * Manage customer subscription lifecycles and plan assignments. */ export declare class Customers { private client; apps: CustomerApps; entitlementsV1: CustomerEntitlements; entitlements: CustomerEntitlementsV2; stripe: CustomerStripe; constructor(client: Client); /** * Create a customer * @param customer - The customer to create * @param signal - An optional abort signal * @returns The created customer */ create(customer: CustomerCreate, options?: RequestOptions): Promise<{ readonly id: string; name: string; description?: string; metadata?: import("./schemas.js").components["schemas"]["Metadata"] | null; readonly createdAt: Date; readonly updatedAt: Date; readonly deletedAt?: Date; key?: string; usageAttribution?: import("./schemas.js").components["schemas"]["CustomerUsageAttribution"]; primaryEmail?: string; currency?: import("./schemas.js").components["schemas"]["CurrencyCode"]; billingAddress?: import("./schemas.js").components["schemas"]["Address"]; readonly currentSubscriptionId?: string; readonly subscriptions?: import("./schemas.js").components["schemas"]["Subscription"][]; readonly annotations?: import("./schemas.js").components["schemas"]["Annotations"]; } | undefined>; /** * Get a customer by ID * @param customerIdOrKey - The ID or Key of the customer * @param signal - An optional abort signal * @returns The customer */ get(customerIdOrKey: operations['getCustomer']['parameters']['path']['customerIdOrKey'], options?: RequestOptions): Promise<{ readonly id: string; name: string; description?: string; metadata?: import("./schemas.js").components["schemas"]["Metadata"] | null; readonly createdAt: Date; readonly updatedAt: Date; readonly deletedAt?: Date; key?: string; usageAttribution?: import("./schemas.js").components["schemas"]["CustomerUsageAttribution"]; primaryEmail?: string; currency?: import("./schemas.js").components["schemas"]["CurrencyCode"]; billingAddress?: import("./schemas.js").components["schemas"]["Address"]; readonly currentSubscriptionId?: string; readonly subscriptions?: import("./schemas.js").components["schemas"]["Subscription"][]; readonly annotations?: import("./schemas.js").components["schemas"]["Annotations"]; } | undefined>; /** * Update a customer * @param customerIdOrKey - The ID or Key of the customer * @param customer - The customer to update * @param signal - An optional abort signal * @returns The updated customer */ update(customerIdOrKey: operations['updateCustomer']['parameters']['path']['customerIdOrKey'], customer: CustomerReplaceUpdate, options?: RequestOptions): Promise<{ readonly id: string; name: string; description?: string; metadata?: import("./schemas.js").components["schemas"]["Metadata"] | null; readonly createdAt: Date; readonly updatedAt: Date; readonly deletedAt?: Date; key?: string; usageAttribution?: import("./schemas.js").components["schemas"]["CustomerUsageAttribution"]; primaryEmail?: string; currency?: import("./schemas.js").components["schemas"]["CurrencyCode"]; billingAddress?: import("./schemas.js").components["schemas"]["Address"]; readonly currentSubscriptionId?: string; readonly subscriptions?: import("./schemas.js").components["schemas"]["Subscription"][]; readonly annotations?: import("./schemas.js").components["schemas"]["Annotations"]; } | undefined>; /** * Delete a customer * @param customerIdOrKey - The ID or Key of the customer * @param signal - An optional abort signal * @returns The deleted customer */ delete(customerIdOrKey: operations['deleteCustomer']['parameters']['path']['customerIdOrKey'], options?: RequestOptions): Promise; /** * List customers * @param signal - An optional abort signal * @returns The list of customers */ list(query?: operations['listCustomers']['parameters']['query'], options?: RequestOptions): Promise<{ totalCount: number; page: number; pageSize: number; items: import("./schemas.js").components["schemas"]["Customer"][]; } | undefined>; /** * Get customer access * @param customerIdOrKey - The ID or Key of the customer * @param options - Optional request options * @returns The customer access information */ getAccess(customerIdOrKey: operations['getCustomerAccess']['parameters']['path']['customerIdOrKey'], options?: RequestOptions): Promise<{ readonly entitlements: { [key: string]: import("./schemas.js").components["schemas"]["EntitlementValue"]; }; } | undefined>; /** * List customer subscriptions * @param customerIdOrKey - The ID or key of the customer * @param query - The query parameters * @param signal - An optional abort signal * @returns The list of customer subscriptions */ listSubscriptions(customerIdOrKey: operations['listCustomerSubscriptions']['parameters']['path']['customerIdOrKey'], query?: operations['listCustomerSubscriptions']['parameters']['query'], options?: RequestOptions): Promise<{ totalCount: number; page: number; pageSize: number; items: import("./schemas.js").components["schemas"]["Subscription"][]; } | undefined>; } /** * Customer Apps * Manage customer apps. */ export declare class CustomerApps { private client; constructor(client: Client); /** * Upsert customer app data * @param customerIdOrKey - The ID or Key of the customer * @param appData - The app data to upsert * @param signal - An optional abort signal * @returns The upserted app data */ upsert(customerIdOrKey: operations['upsertCustomerAppData']['parameters']['path']['customerIdOrKey'], appData: CustomerAppData[], options?: RequestOptions): Promise<({ readonly app?: import("./schemas.js").components["schemas"]["CustomInvoicingApp"]; id?: string; type: "custom_invoicing"; metadata?: import("./schemas.js").components["schemas"]["Metadata"]; } | { id?: string; type: "stripe"; stripeCustomerId: string; stripeDefaultPaymentMethodId?: string; readonly app?: import("./schemas.js").components["schemas"]["StripeApp"]; } | { readonly app?: import("./schemas.js").components["schemas"]["SandboxApp"]; id?: string; type: "sandbox"; })[] | undefined>; /** * List customer app data * @param customerIdOrKey - The ID or key of the customer * @param query - The query parameters * @param signal - An optional abort signal * @returns The list of customer app data */ list(customerIdOrKey: operations['listCustomerAppData']['parameters']['path']['customerIdOrKey'], query?: operations['listCustomerAppData']['parameters']['query'], options?: RequestOptions): Promise<{ totalCount: number; page: number; pageSize: number; items: import("./schemas.js").components["schemas"]["CustomerAppData"][]; } | undefined>; /** * Delete customer app data * @param customerIdOrKey - The ID or key of the customer * @param appId - The ID of the app * @param signal - An optional abort signal * @returns The deleted customer app data */ delete(customerIdOrKey: operations['deleteCustomerAppData']['parameters']['path']['customerIdOrKey'], appId: operations['deleteCustomerAppData']['parameters']['path']['appId'], options?: RequestOptions): Promise; } /** * Customer Stripe * Manage customer Stripe data. */ export declare class CustomerStripe { private client; constructor(client: Client); /** * Upsert customer stripe app data * @param customerIdOrKey - The ID or Key of the customer * @param appData - The app data to upsert * @param signal - An optional abort signal * @returns The upserted customer stripe app data */ upsert(customerIdOrKey: operations['upsertCustomerStripeAppData']['parameters']['path']['customerIdOrKey'], stripeAppData: StripeCustomerAppDataBase, options?: RequestOptions): Promise<{ id?: string; type: "stripe"; stripeCustomerId: string; stripeDefaultPaymentMethodId?: string; readonly app?: import("./schemas.js").components["schemas"]["StripeApp"]; } | undefined>; /** * Get customer stripe app data * @param customerIdOrKey - The ID or key of the customer * @param query - The query parameters * @param signal - An optional abort signal * @returns The customer stripe app data */ get(customerIdOrKey: operations['getCustomerStripeAppData']['parameters']['path']['customerIdOrKey'], options?: RequestOptions): Promise<{ id?: string; type: "stripe"; stripeCustomerId: string; stripeDefaultPaymentMethodId?: string; readonly app?: import("./schemas.js").components["schemas"]["StripeApp"]; } | undefined>; /** * Create a Stripe customer portal session * @param customerIdOrKey - The ID or Key of the customer * @param params - The parameters for creating a Stripe customer portal session * @param signal - An optional abort signal * @returns The Stripe customer portal session */ createPortalSession(customerIdOrKey: operations['createCustomerStripePortalSession']['parameters']['path']['customerIdOrKey'], params: CreateStripeCustomerPortalSessionParams, options?: RequestOptions): Promise<{ id: string; stripeCustomerId: string; configurationId: string; livemode: boolean; createdAt: Date; returnUrl: string; locale: string; url: string; } | undefined>; } /** * Customer Entitlements */ export declare class CustomerEntitlements { private client; constructor(client: Client); /** * Get the value of an entitlement for a customer * @param customerIdOrKey - The ID or Key of the customer * @param featureKey - The key of the feature * @param signal - An optional abort signal * @returns The value of the entitlement */ value(customerIdOrKey: operations['getCustomerEntitlementValue']['parameters']['path']['customerIdOrKey'], featureKey: operations['getCustomerEntitlementValue']['parameters']['path']['featureKey'], options?: RequestOptions): Promise<{ readonly hasAccess: boolean; readonly balance?: number; readonly usage?: number; readonly overage?: number; readonly totalAvailableGrantAmount?: number; readonly config?: string; } | undefined>; } /** * Customer Entitlements V2 */ export declare class CustomerEntitlementsV2 { private client; constructor(client: Client); /** * List all entitlements for a customer * @param customerIdOrKey - The ID or Key of the customer * @param options - Request options including query parameters * @returns List of customer entitlements */ list(customerIdOrKey: operations['listCustomerEntitlementsV2']['parameters']['path']['customerIdOrKey'], options?: RequestOptions & { query?: operations['listCustomerEntitlementsV2']['parameters']['query']; }): Promise<{ totalCount: number; page: number; pageSize: number; items: import("./schemas.js").components["schemas"]["EntitlementV2"][]; } | undefined>; /** * Create a customer entitlement * @param customerIdOrKey - The ID or Key of the customer * @param entitlement - The entitlement data to create * @param options - Request options * @returns The created entitlement */ create(customerIdOrKey: operations['createCustomerEntitlementV2']['parameters']['path']['customerIdOrKey'], entitlement: operations['createCustomerEntitlementV2']['requestBody']['content']['application/json'], options?: RequestOptions): Promise | undefined>; /** * Get a specific customer entitlement * @param customerIdOrKey - The ID or Key of the customer * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement * @param options - Request options * @returns The entitlement */ get(customerIdOrKey: operations['getCustomerEntitlementV2']['parameters']['path']['customerIdOrKey'], entitlementIdOrFeatureKey: operations['getCustomerEntitlementV2']['parameters']['path']['entitlementIdOrFeatureKey'], options?: RequestOptions): Promise | undefined>; /** * Delete a customer entitlement * @param customerIdOrKey - The ID or Key of the customer * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement * @param options - Request options * @returns The deletion response */ delete(customerIdOrKey: operations['deleteCustomerEntitlementV2']['parameters']['path']['customerIdOrKey'], entitlementIdOrFeatureKey: operations['deleteCustomerEntitlementV2']['parameters']['path']['entitlementIdOrFeatureKey'], options?: RequestOptions): Promise; /** * Override a customer entitlement * @param customerIdOrKey - The ID or Key of the customer * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement * @param entitlement - The new entitlement data * @param options - Request options * @returns The overridden entitlement */ override(customerIdOrKey: operations['overrideCustomerEntitlementV2']['parameters']['path']['customerIdOrKey'], entitlementIdOrFeatureKey: operations['overrideCustomerEntitlementV2']['parameters']['path']['entitlementIdOrFeatureKey'], entitlement: operations['overrideCustomerEntitlementV2']['requestBody']['content']['application/json'], options?: RequestOptions): Promise | undefined>; /** * List grants for a customer entitlement * @param customerIdOrKey - The ID or Key of the customer * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement * @param options - Request options including query parameters * @returns List of entitlement grants */ listGrants(customerIdOrKey: operations['listCustomerEntitlementGrantsV2']['parameters']['path']['customerIdOrKey'], entitlementIdOrFeatureKey: operations['listCustomerEntitlementGrantsV2']['parameters']['path']['entitlementIdOrFeatureKey'], options?: RequestOptions & { query?: operations['listCustomerEntitlementGrantsV2']['parameters']['query']; }): Promise<{ totalCount: number; page: number; pageSize: number; items: import("./schemas.js").components["schemas"]["EntitlementGrantV2"][]; } | undefined>; /** * Create a grant for a customer entitlement * @param customerIdOrKey - The ID or Key of the customer * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement * @param grant - The grant data to create * @param options - Request options * @returns The created grant */ createGrant(customerIdOrKey: operations['createCustomerEntitlementGrantV2']['parameters']['path']['customerIdOrKey'], entitlementIdOrFeatureKey: operations['createCustomerEntitlementGrantV2']['parameters']['path']['entitlementIdOrFeatureKey'], grant: operations['createCustomerEntitlementGrantV2']['requestBody']['content']['application/json'], options?: RequestOptions): Promise<{ readonly createdAt: Date; readonly updatedAt: Date; readonly deletedAt?: Date; amount: number; priority?: number; effectiveAt: Date; minRolloverAmount?: number; metadata?: import("./schemas.js").components["schemas"]["Metadata"]; maxRolloverAmount?: number; expiration?: import("./schemas.js").components["schemas"]["ExpirationPeriod"]; annotations?: import("./schemas.js").components["schemas"]["Annotations"]; readonly id: string; readonly entitlementId: string; nextRecurrence?: Date; readonly expiresAt?: Date; voidedAt?: Date; recurrence?: import("./schemas.js").components["schemas"]["RecurringPeriod"]; } | undefined>; /** * Get the value of a customer entitlement * @param customerIdOrKey - The ID or Key of the customer * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement * @param options - Request options including query parameters * @returns The entitlement value */ value(customerIdOrKey: operations['getCustomerEntitlementValueV2']['parameters']['path']['customerIdOrKey'], entitlementIdOrFeatureKey: operations['getCustomerEntitlementValueV2']['parameters']['path']['entitlementIdOrFeatureKey'], options?: RequestOptions & { query?: operations['getCustomerEntitlementValueV2']['parameters']['query']; }): Promise<{ readonly hasAccess: boolean; readonly balance?: number; readonly usage?: number; readonly overage?: number; readonly totalAvailableGrantAmount?: number; readonly config?: string; readonly grantBalances?: { [key: string]: number; }; } | undefined>; /** * Get the history of a customer entitlement * @param customerIdOrKey - The ID or Key of the customer * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement * @param windowSize - The window size for the history * @param options - Request options including query parameters * @returns The entitlement history */ history(customerIdOrKey: operations['getCustomerEntitlementHistoryV2']['parameters']['path']['customerIdOrKey'], entitlementIdOrFeatureKey: operations['getCustomerEntitlementHistoryV2']['parameters']['path']['entitlementIdOrFeatureKey'], windowSize: operations['getCustomerEntitlementHistoryV2']['parameters']['query']['windowSize'], options?: RequestOptions & { query?: Omit; }): Promise<{ windowedHistory: import("./schemas.js").components["schemas"]["BalanceHistoryWindow"][]; burndownHistory: import("./schemas.js").components["schemas"]["GrantBurnDownHistorySegment"][]; } | undefined>; /** * Reset the usage of a customer entitlement * @param customerIdOrKey - The ID or Key of the customer * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement * @param reset - The reset data * @param options - Request options * @returns The reset response */ resetUsage(customerIdOrKey: operations['resetCustomerEntitlementUsageV2']['parameters']['path']['customerIdOrKey'], entitlementIdOrFeatureKey: operations['resetCustomerEntitlementUsageV2']['parameters']['path']['entitlementIdOrFeatureKey'], reset: operations['resetCustomerEntitlementUsageV2']['requestBody']['content']['application/json'], options?: RequestOptions): Promise; }