import { Patient } from '../../icc-api/model/Patient'; import { AbstractFilter } from '../filters/filters'; import { User } from '../../icc-api/model/User'; import { IccAuthApi } from '../../icc-api'; import { Service } from '../../icc-api/model/Service'; import { HealthElement } from '../../icc-api/model/HealthElement'; import { MaintenanceTask } from '../../icc-api/model/MaintenanceTask'; import { HealthcareParty } from '../../icc-api/model/HealthcareParty'; import { Device } from '../../icc-api/model/Device'; import { Contact } from '../../icc-api/model/Contact'; import { Message } from '../../icc-api/model/Message'; import { Topic } from '../../icc-api/model/Topic'; import { RelatedPerson } from '../../icc-api/model/RelatedPerson'; export type EventTypes = 'CREATE' | 'UPDATE' | 'DELETE'; export type SubscriptionOptions = { connectionMaxRetry?: number; connectionRetryIntervalMs?: number; debug?: boolean; }; export declare function subscribeToEntityEvents(basePath: string, authApi: IccAuthApi, entityClass: 'Patient', eventTypes: EventTypes[], filter: AbstractFilter | undefined, eventFired: (entity: Patient) => Promise, options: SubscriptionOptions, decryptor: (encrypted: Patient) => Promise): Promise; export declare function subscribeToEntityEvents(basePath: string, authApi: IccAuthApi, entityClass: 'Service', eventTypes: EventTypes[], filter: AbstractFilter | undefined, eventFired: (entity: Service) => Promise, options: SubscriptionOptions, decryptor: (encrypted: Service) => Promise): Promise; export declare function subscribeToEntityEvents(basePath: string, authApi: IccAuthApi, entityClass: 'Contact', eventTypes: EventTypes[], filter: AbstractFilter | undefined, eventFired: (entity: Contact) => Promise, options: SubscriptionOptions, decryptor: (encrypted: Contact) => Promise): Promise; export declare function subscribeToEntityEvents(basePath: string, authApi: IccAuthApi, entityClass: 'HealthElement', eventTypes: EventTypes[], filter: AbstractFilter | undefined, eventFired: (entity: HealthElement) => Promise, options: SubscriptionOptions, decryptor: (encrypted: HealthElement) => Promise): Promise; export declare function subscribeToEntityEvents(basePath: string, authApi: IccAuthApi, entityClass: 'Message', eventTypes: EventTypes[], filter: AbstractFilter | undefined, eventFired: (entity: Message) => Promise, options: SubscriptionOptions, decryptor: (encrypted: Message) => Promise): Promise; export declare function subscribeToEntityEvents(basePath: string, authApi: IccAuthApi, entityClass: 'Topic', eventTypes: EventTypes[], filter: AbstractFilter | undefined, eventFired: (entity: Topic) => Promise, options: SubscriptionOptions, decryptor: (encrypted: Topic) => Promise): Promise; export declare function subscribeToEntityEvents(basePath: string, authApi: IccAuthApi, entityClass: 'RelatedPerson', eventTypes: EventTypes[], filter: AbstractFilter | undefined, eventFired: (entity: RelatedPerson) => Promise, options: SubscriptionOptions, decryptor: (encrypted: RelatedPerson) => Promise): Promise; export declare function subscribeToEntityEvents(basePath: string, authApi: IccAuthApi, entityClass: 'User', eventTypes: EventTypes[], filter: AbstractFilter | undefined, eventFired: (entity: User) => Promise, options: SubscriptionOptions): Promise; export declare function subscribeToEntityEvents(basePath: string, authApi: IccAuthApi, entityClass: 'MaintenanceTask', eventTypes: EventTypes[], filter: AbstractFilter | undefined, eventFired: (entity: MaintenanceTask) => Promise, options: SubscriptionOptions, decryptor: (encrypted: MaintenanceTask) => Promise): Promise; export declare function subscribeToEntityEvents(basePath: string, authApi: IccAuthApi, entityClass: 'HealthcareParty', eventTypes: EventTypes[], filter: AbstractFilter | undefined, eventFired: (entity: HealthcareParty) => Promise, options: SubscriptionOptions): Promise; export declare function subscribeToEntityEvents(basePath: string, authApi: IccAuthApi, entityClass: 'Device', eventTypes: EventTypes[], filter: AbstractFilter | undefined, eventFired: (entity: Device) => Promise, options: SubscriptionOptions): Promise; export type ConnectionStatus = 'NOT_CONNECTED' | 'CONNECTED' | 'CLOSED' | 'ERROR'; export type StatusCallback = (ws: WebSocketWrapper) => void; export type ErrorStatusCallback = (ws: WebSocketWrapper, error?: Error) => void; export type ConnectionStatusFunction = { [K in ConnectionStatus]: K extends 'ERROR' ? ErrorStatusCallback : StatusCallback; }; export type ConnectionStatusFunctions = { [K in ConnectionStatus]?: K extends 'ERROR' ? Array : Array; }; export type WebSocketWrapperMessageCallback = (data: any) => void; export declare class WebSocketWrapper { private readonly url; private readonly authProvider; private readonly maxRetries; private readonly retryDelay; private readonly statusCallbacks; private readonly messageCallback; private readonly debug; private readonly pingLifetime; private socket; private retries; private closed; private lastPingReceived; private intervalIds; private readonly methodPath; private constructor(); static create(url: string, authProvider: WebSocketAuthProvider, maxRetries?: number, retryDelay?: number, statusCallbacks?: ConnectionStatusFunctions, messageCallback?: WebSocketWrapperMessageCallback, debug?: boolean): Promise; send(data: Buffer | ArrayBuffer | string): void; close(): void; addStatusCallback(status: ConnectionStatus, callback: ConnectionStatusFunction[ConnectionStatus]): void; private connect; private callStatusCallbacks; } interface WebSocketAuthProvider { getBearerToken(): Promise; } export {};