// Type definitions for titli-video-sdk/server (Node.js 20+, ESM, zero dependencies). // import { TitliClient, TitliError, verifyWebhook } from 'titli-video-sdk/server'; // Every method resolves with the API's JSON answer (see https://videosdk.titliapp.com/docs/rest-api). /** The API's error object: code, message, error_code, user_code, user_message, docs_url, and what the code adds. */ export interface TitliApiError { code?: string; message?: string; error_code?: string; user_code?: string; user_message?: string; user_message_hi?: string; docs_url?: string; legacy_code?: string; refunded?: boolean; price?: number; [key: string]: unknown; } export declare class TitliError extends Error { constructor(status: number, code: string, message: string, error?: TitliApiError); status: number; code: string; error: TitliApiError; userMessage: string | null; userCode: string | null; /** Seconds, from the Retry-After header of a 429. */ retryAfter: number | null; } type Json = Record; export interface TitliClientOptions { /** Default https://api-videosdk.titliapp.com */ baseUrl?: string; keyId: string; /** Keep it on your server only. */ keySecret: string; } export declare class TitliClient { constructor(options: TitliClientOptions); readonly baseUrl: string; request(method: string, path: string, body?: unknown): Promise; me(): Promise; balance(): Promise; endUser(endUserId: string): Promise; createCall(opts?: { type?: 'video' | 'audio'; payerEndUserId?: string; maxDurationSeconds?: number; metadata?: unknown }): Promise; getCall(callId: string): Promise; listCalls(params?: Record): Promise; token(callId: string, opts?: { endUserId?: string; role?: 'user' | 'host' | string; name?: string; ttlSeconds?: number }): Promise; endCall(callId: string): Promise; removeParticipant(callId: string, endUserId: string): Promise; muteParticipant(callId: string, endUserId: string): Promise; receipt(callId: string): Promise; usage(opts?: { from?: string; to?: string }): Promise; publicKey(): Promise; liveStreams(opts?: { type?: string }): Promise; joinLiveStream(ref: string, opts?: { endUserId?: string; name?: string }): Promise; leaveLiveStream(ref: string, opts?: { endUserId?: string }): Promise; renewLiveStreamToken(ref: string, opts?: { endUserId?: string }): Promise; gifts(opts?: { includeHidden?: boolean }): Promise; giftSettings(): Promise; updateGiftSettings(opts?: { enabled?: boolean; defaultMarkupPct?: number }): Promise; updateGift(giftId: string, opts?: { hidden?: boolean; price?: number | null }): Promise; sendCallGift(callId: string, opts?: { giftId?: string; count?: number; clientRequestId?: string; expectedPrice?: number }): Promise; sendLiveStreamGift(ref: string, opts?: { endUserId?: string; giftId?: string; count?: number; clientRequestId?: string; expectedPrice?: number }): Promise; giftSends(params?: Record): Promise; giftSend(id: string): Promise; giftStats(params?: Record): Promise; [method: string]: any; } /** What your app needs of the gift list: the gifts with YOUR price. Your cost and what you keep stay on your server. */ export declare function giftsForApp(list: Json): { enabled: boolean; version: string | null; currency: string; max_count?: number; gifts: Array<{ gift_id: string; name: string; icon_url?: string; animation_url?: string; category?: string; price: number; currency: string }>; }; /** What your app needs of a gift that was not sent. */ export declare function giftErrorForApp(e: TitliError): { error: Pick }; /** True when a gift send was refused before anything was debited (give your user the money back at once). */ export declare function giftRefusedBeforeDebit(e: unknown): boolean; /** Checks the Titli-Signature header (t=,v1=.")>) and rejects old deliveries. */ export declare function verifyWebhook(rawBody: string | Buffer, signatureHeader: string | undefined | null, secret: string, opts?: { toleranceSec?: number }): boolean; /** Canonical JSON (keys sorted recursively, no whitespace), as signed in receipts. */ export declare function canonical(v: unknown): string; /** Verifies a call receipt's Ed25519 signature with the key from GET /v1/receipts/public-key. */ export declare function verifyReceipt(receipt: unknown, signatureB64: string, publicKeyPem: string): boolean;