interface ITelegramClient {
    appConfig: PublicPart<AppConfigManager>;
    log: Logger;
    onConnectionState: Emitter<ConnectionState>;
    onError: Emitter<Error>;
    onRawUpdate: Emitter<RawUpdateInfo>;
    onServerUpdate: Emitter<TypeUpdates>;
    platform: ICorePlatform;
    stopSignal: AbortSignal;
    storage: PublicPart<TelegramStorageManager>;
    timers: Pick<TimersManager, "cancel" | "create" | "exists">;
    call<T extends RpcMethod>(
        message: MustEqual<T, RpcMethod>,
        params?: RpcCallOptions,
    ): Promise<RpcCallReturn[T["_"]]>;
    changePrimaryDc(newDc: number): Promise<void>;
    close(): Promise<void>;
    computeNewPasswordHash(
        algo: TypePasswordKdfAlgo,
        password: string,
    ): Promise<Uint8Array>;
    computeSrpParams(
        request: RawPassword,
        password: string,
    ): Promise<RawInputCheckPasswordSRP>;
    connect(): Promise<void>;
    exportSession(): Promise<string>;
    getApiCredentials(): Promise<{ hash: string; id: number }>;
    getMtprotoMessageId(): Promise<Long>;
    getPoolSize(kind: ConnectionKind, dcId?: number): Promise<number>;
    getPrimaryDcId(): Promise<number>;
    handleClientUpdate(updates: TypeUpdates, noDispatch?: boolean): void;
    importSession(
        session: string | InputStringSessionData,
        force?: boolean,
    ): Promise<void>;
    notifyChannelClosed(channelId: number): Promise<boolean>;
    notifyChannelOpened(channelId: number, pts?: number): Promise<boolean>;
    notifyLoggedIn(auth: RawUser | TypeAuthorization): Promise<RawUser>;
    notifyLoggedOut(): Promise<void>;
    prepare(): Promise<void>;
    recreateDc(dcId: number): Promise<void>;
    startUpdatesLoop(): Promise<void>;
    stopUpdatesLoop(): Promise<void>;
}

Properties

appConfig: PublicPart<AppConfigManager>
log: Logger
onConnectionState: Emitter<ConnectionState>
onError: Emitter<Error>
onRawUpdate: Emitter<RawUpdateInfo>
onServerUpdate: Emitter<TypeUpdates>
platform: ICorePlatform
stopSignal: AbortSignal
timers: Pick<TimersManager, "cancel" | "create" | "exists">

Methods

  • Type Parameters

    • T extends RpcMethod

    Parameters

    Returns Promise<RpcCallReturn[T["_"]]>

  • Parameters

    • newDc: number

    Returns Promise<void>

  • Returns Promise<void>

  • Parameters

    Returns Promise<Uint8Array>

  • Returns Promise<void>

  • Returns Promise<string>

  • Returns Promise<{ hash: string; id: number }>

  • Returns Promise<Long>

  • Parameters

    Returns Promise<number>

  • Returns Promise<number>

  • Parameters

    Returns void

  • Parameters

    Returns Promise<void>

  • Parameters

    • channelId: number

    Returns Promise<boolean>

  • Parameters

    • channelId: number
    • Optionalpts: number

    Returns Promise<boolean>

  • Returns Promise<void>

  • Returns Promise<void>

  • Parameters

    • dcId: number

    Returns Promise<void>

  • Returns Promise<void>

  • Returns Promise<void>