import { default as Long } from 'long'; import { MtClientOptions, MtClient } from '../network/client.js'; import { ConnectionKind, RpcCallOptions } from '../network/network-manager.js'; import { StorageManagerExtraOptions } from '../storage/storage.js'; import { ICorePlatform } from '../types/platform.js'; import { MustEqual } from '../types/utils.js'; import { ICryptoProvider, InputStringSessionData, Logger } from '../utils/index.js'; import { ConnectionState, ITelegramClient } from './client.types.js'; import { ITelegramStorageProvider } from './storage/provider.js'; import { TelegramStorageManagerExtraOptions, TelegramStorageManager } from './storage/storage.js'; import { RawUpdateInfo, UpdatesManagerParams } from './updates/types.js'; import { Emitter } from '@fuman/utils'; import { tl } from '../tl/index.js'; import { AppConfigManager } from './managers/app-config-manager.js'; import { TimersManager } from './managers/timers.js'; import { UpdatesManager } from './updates/manager.js'; export interface BaseTelegramClientOptions extends MtClientOptions { storage: ITelegramStorageProvider; storageOptions?: StorageManagerExtraOptions & TelegramStorageManagerExtraOptions; updates?: UpdatesManagerParams | false; } export declare class BaseTelegramClient implements ITelegramClient { #private; readonly params: BaseTelegramClientOptions; readonly updates?: UpdatesManager; readonly log: Logger; readonly mt: MtClient; readonly crypto: ICryptoProvider; readonly storage: TelegramStorageManager; readonly platform: ICorePlatform; readonly timers: TimersManager; readonly onServerUpdate: Emitter; readonly onRawUpdate: Emitter; readonly onConnectionState: Emitter; constructor(params: BaseTelegramClientOptions); readonly appConfig: AppConfigManager; private _prepare; /** * **ADVANCED** * * Do all the preparations, but don't connect just yet. * Useful when you want to do some preparations before * connecting, like setting up session. * * Call {@link connect} to actually connect. */ prepare(): Promise; private _connected; private _connect; /** * Initialize the connection to the primary DC. * * You shouldn't usually call this method directly as it is called * implicitly the first time you call {@link call}. */ connect(): Promise; get isConnected(): boolean; disconnect(): Promise; destroy(): Promise; get destroyed(): boolean; [Symbol.asyncDispose](): Promise; notifyLoggedIn(auth: tl.auth.TypeAuthorization | tl.RawUser): Promise; notifyLoggedOut(): Promise; notifyChannelOpened(channelId: number, pts?: number): Promise; notifyChannelClosed(channelId: number): Promise; startUpdatesLoop(): Promise; stopUpdatesLoop(): Promise; /** * Make an RPC call * * This method is still quite low-level and you shouldn't use this * when using high-level API provided by `@mtcute/client`. * * @param message RPC method to call * @param params Additional call parameters */ call(message: MustEqual, params?: RpcCallOptions): Promise; /** * Import the session from the given session string. * * Note that the session will only be imported in case * the storage is missing authorization (i.e. does not contain * auth key for the primary DC), otherwise it will be ignored (unless `force`). * * @param session Session string to import * @param force Whether to overwrite existing session */ importSession(session: string | InputStringSessionData, force?: boolean): Promise; /** * Export current session to a single *LONG* string, containing * all the needed information. * * > **Warning!** Anyone with this string will be able * > to authorize as you and do anything. Treat this * > as your password, and never give it away! * > * > In case you have accidentally leaked this string, * > make sure to revoke this session in account settings: * > "Privacy & Security" > "Active sessions" > * > find the one containing `mtcute` > Revoke, * > or, in case this is a bot, revoke bot token * > with [@BotFather](//t.me/botfather) */ exportSession(): Promise; onError: Emitter; handleClientUpdate(updates: tl.TypeUpdates, noDispatch?: boolean): void; getApiCredentials(): Promise<{ id: number; hash: string; }>; getPoolSize(kind: ConnectionKind, dcId?: number): Promise; getPrimaryDcId(): Promise; computeSrpParams(request: tl.account.RawPassword, password: string): Promise; computeNewPasswordHash(algo: tl.TypePasswordKdfAlgo, password: string): Promise; get stopSignal(): AbortSignal; changePrimaryDc(dcId: number): Promise; getMtprotoMessageId(): Promise; recreateDc(dcId: number): Promise; }