export interface PushClientOptions { /** API base URL (e.g. http://localhost:9001) */ baseUrl: string; /** API key or JWT token for auth */ token: string; /** App ID — optional, server resolves from API key if omitted */ appId?: string; } export interface PushPayload { title: string; body?: string; icon?: string; image?: string; badge?: string; url?: string; data?: Record; ttl?: number; urgency?: 'very-low' | 'low' | 'normal' | 'high'; } export interface PushSendResult { sent: number; results: { subscriptionId: string; memberId: string; platform: string; success: boolean; error?: string; }[]; } /** A single push subscription record */ export interface PushSubscriptionRecord { /** Unique subscription identifier */ subscriptionId: string; /** Member the subscription belongs to */ memberId: string; /** Push platform */ platform: 'web' | 'fcm' | 'apns'; /** Channels this subscription is enrolled in */ channels: string[]; /** Unix timestamp (ms) when the subscription was created */ createdAt: number; } /** Result of {@link PushClient.listSubscriptions} */ export interface PushSubscriptionsResult { /** List of matching subscriptions */ subscriptions: PushSubscriptionRecord[]; /** Total number of matching subscriptions (may exceed the page) */ total: number; } export declare class PushClient { private baseUrl; private token; private appId?; constructor(options: PushClientOptions); /** * Subscribe this browser to push notifications. * Requests permission, registers service worker, and subscribes. * * @param channels - Channels to subscribe to (default: ['default']) * @param serviceWorkerPath - Path to service worker (default: '/sw.js') * @returns The browser PushSubscription, or null if denied/unsupported * * @example * ```ts * await client.push.subscribe(['news', 'alerts']); * ``` */ subscribe(channels?: string[], serviceWorkerPath?: string): Promise; /** * Send a push notification to one or more members. * * @param payload - Notification content * @param options - Target: `to` (member ID or array), `channel` filter * * @example * ```ts * // Send to one member * await client.push.send({ title: 'Hello' }, { to: 'user-123' }); * * // Send to a channel * await client.push.send({ title: 'News!' }, { to: 'user-123', channel: 'news' }); * * // Send to multiple members * await client.push.send({ title: 'Alert' }, { to: ['user-1', 'user-2'] }); * ``` */ send(payload: PushPayload, options?: { to?: string | string[]; channel?: string; }): Promise; /** * Broadcast a push notification to all subscribers. * * @param payload - Notification content * @param channel - Optional channel filter * * @example * ```ts * // Broadcast to everyone * await client.push.broadcast({ title: 'Maintenance in 1h' }); * * // Broadcast to a specific channel * await client.push.broadcast({ title: 'Breaking!' }, 'news'); * ``` */ broadcast(payload: PushPayload, channel?: string): Promise; /** * Add a channel to a member's push subscriptions. * * @example * ```ts * await client.push.addChannel('user-123', 'sports'); * ``` */ addChannel(memberId: string, channel: string): Promise<{ updated: number; }>; /** * Remove a channel from a member's push subscriptions. * * @example * ```ts * await client.push.removeChannel('user-123', 'sports'); * ``` */ removeChannel(memberId: string, channel: string): Promise<{ updated: number; }>; /** * Register a device for push notifications. * Prefer `subscribe()` for browser Web Push. * * @param platform - 'web', 'fcm', or 'apns' * @param credential - Web Push subscription object, or device token string * @param options - Optional memberId and channels * * @example * ```ts * // FCM * await client.push.register('fcm', deviceToken, { memberId: 'user-1', channels: ['alerts'] }); * * // APNs * await client.push.register('apns', deviceToken, { memberId: 'user-1' }); * ``` */ register(platform: 'web' | 'fcm' | 'apns', credential: any, options?: { memberId?: string; channels?: string[]; }): Promise; /** * Unregister a member's push subscriptions. * * @example * ```ts * await client.push.unregister('user-123'); * await client.push.unregister('user-123', 'web'); // only web * ``` */ unregister(memberId: string, platform?: 'web' | 'fcm' | 'apns'): Promise; /** * Delete a specific subscription by its ID. * * @example * ```ts * await client.push.deleteSubscription('sub_abc123'); * ``` */ deleteSubscription(subscriptionId: string): Promise; /** * Get the VAPID public key for this app. * * @returns The VAPID public key string, or `null` if not configured */ getVapidKey(): Promise; /** * List push subscriptions, optionally filtered by member and/or platform. * * @param options - Filter options * @param options.memberId - Return only subscriptions for this member * @param options.platform - Return only subscriptions for this platform * @param options.limit - Maximum number of subscriptions to return * @returns Matching subscriptions and total count */ listSubscriptions(options?: { memberId?: string; platform?: 'web' | 'fcm' | 'apns'; limit?: number; }): Promise; private api; } //# sourceMappingURL=index.d.ts.map