UNPKG

telegram-mtproto

Version:
85 lines (71 loc) 1.52 kB
//@flow export type MessageTypes = | 'msg_container' | 'bad_server_salt' | 'bad_msg_notification' | 'message' | 'new_session_created' | 'msgs_ack' | 'msg_detailed_info' | 'msg_new_detailed_info' | 'msgs_state_info' | 'rpc_result' | 'rpc_error' export type APIObject = { _: string, [field: string]: any, } export type MTPRpcResultᐳ = { _: 'rpc_result', req_msg_id: string, result?: APIObject } export type MTPRpcErrorᐳ = { _: 'rpc_error', error_code: number, error_message: string, } export type MTPAckᐳ = { _: 'msgs_ack', msg_ids: string[], } export type MTPMessageᐳ = { _: 'message', msg_id: string, seqno: number, bytes: number, body: MTPRpcResultᐳ, } export type MTPContainerᐳ = { _: 'msg_container', messages: MTPMessageᐳ[], } export type MTP = | MTPRpcResultᐳ | MTPAckᐳ | MTPContainerᐳ | MTPRpcErrorexport typeMTNewSessionCreated = { +_: string & 'new_session_created', +first_msg_id: string, +unique_id: string, +server_salt: string, } export typeMTBadSalt = { +_: string & 'bad_server_salt', +bad_msg_id: string, +bad_msg_seqno: number, +error_code: number, +new_server_salt: string, } export typeMTBadNotification = { +_: string & 'bad_msg_notification', +bad_msg_id: string, +bad_msg_seqno: number, +error_code: number, } export typeMTRpcResult = { +_: string & 'rpc_result', +req_msg_id: string, +result?: APIObject }