UNPKG

@periskope/baileys

Version:

WhatsApp API

54 lines 2.75 kB
import { Boom } from '@hapi/boom'; import type { SocketConfig } from '../Types/index.js'; import { MessageRetryManager } from '../Utils/index.js'; import { type BinaryNode } from '../WABinary/index.js'; import { BinaryInfo } from '../WAM/BinaryInfo.js'; import { USyncQuery } from '../WAUSync/index.js'; import { WebSocketClient } from './Client/index.js'; /** * Connects to WA servers and performs: * - simple queries (no retry mechanism, wait for connection establishment) * - listen to messages and emit events * - query phone connection */ export declare const makeSocket: (config: SocketConfig) => { type: "md"; ws: WebSocketClient; ev: import("../Types/index.js").BaileysEventEmitter & { process(handler: (events: Partial<import("../Types/index.js").BaileysEventMap>) => void | Promise<void>): () => void; buffer(): void; createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>; flush(): boolean; isBuffering(): boolean; }; authState: { creds: import("../Types/index.js").AuthenticationCreds; keys: import("../Types/index.js").SignalKeyStoreWithTransaction; }; signalRepository: import("../Types/index.js").SignalRepositoryWithLIDStore; readonly user: import("../Types/index.js").Contact | undefined; generateMessageTag: () => string; query: (node: BinaryNode, timeoutMs?: number) => Promise<any>; waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T | undefined>; waitForSocketOpen: () => Promise<void>; sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>; sendNode: (frame: BinaryNode) => Promise<void>; logout: (msg?: string) => Promise<void>; end: (error: Error | undefined) => void; onUnexpectedError: (err: Error | Boom, msg: string) => void; uploadPreKeys: (count?: number, retryCount?: number) => Promise<void>; uploadPreKeysToServerIfRequired: () => Promise<void>; requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>; wamBuffer: BinaryInfo; /** Waits for the connection to WA to reach a state */ waitForConnectionUpdate: (check: (u: Partial<import("../Types/index.js").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>; sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>; executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../index.js").USyncQueryResult | undefined>; onWhatsApp: (...jids: string[]) => Promise<{ jid: string; exists: boolean; lid: string; }[] | undefined>; messageRetryManager: MessageRetryManager | null; }; //# sourceMappingURL=socket.d.ts.map