| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515 |
- declare namespace AliVCInteraction {
- class AliVCIMAttachmentManager {
- private static instance;
- private wasmIns;
- private attachmentManager;
- private uploader;
- constructor(wasmIns: any, wasmInterface: any);
- static getInstance(wasmIns: any, wasmInterface: any): AliVCIMAttachmentManager;
- getAttachmentReq(attachmentReq: ImAttachmentReq): Promise<any>;
- /**
- * 上传附件
- * @param {string} reqId
- * @param {ImAttachmentReq} attachmentReq
- * @returns {ImAttachmentRes}
- */
- uploadAttachment(reqId: string, attachmentReq: ImAttachmentReq): Promise<ImAttachmentRes>;
- /**
- * 取消上传附件
- * @param {string} reqId
- * @returns
- */
- cancelAttachmentUpload(reqId: string): Promise<void>;
- /**
- * 删除已上传附件
- * @param {ImAttachmentRes} attachment
- * @returns
- */
- deleteAttachment(attachment: ImAttachmentRes): Promise<void>;
- destroy(): void;
- }
- class AliVCIMGroupManager extends EventEmitter<ImGroupListener> {
- private wasmIns;
- private wasmGroupManager;
- private groupListener;
- constructor(wasmIns: any, wasmInterface: any);
- addGroupListener(): void;
- removeGroupListener(): void;
- destroy(): void;
- /**
- * 创建群组,限管理员才能操作
- * @param {ImCreateGroupReq} req
- * @returns {Promise<ImCreateGroupRsp>}
- */
- createGroup(req: ImCreateGroupReq): Promise<ImCreateGroupRsp>;
- /**
- * 查询群组信息
- * @param {string | ImQueryGroupReq} groupIdOrReq
- * @returns {Promise<ImGroupInfo>}
- */
- queryGroup(groupIdOrReq: string | ImQueryGroupReq): Promise<ImGroupInfo>;
- /**
- * 关闭群组,限管理员才能操作
- * @param {string | ImCloseGroupReq} groupIdOrReq
- * @returns {Promise<void>}
- */
- closeGroup(groupIdOrReq: string | ImCloseGroupReq): Promise<void>;
- /**
- * 加入群组
- * @param {string | ImJoinGroupReq} groupIdOrReq
- * @returns {Promise<ImGroupInfo>}
- */
- joinGroup(groupIdOrReq: string | ImJoinGroupReq): Promise<ImGroupInfo>;
- /**
- * 离开群组
- * @param {string | ImLeaveGroupReq} groupIdOrReq
- * @returns {Promise<void>}
- */
- leaveGroup(groupIdOrReq: string | ImLeaveGroupReq): Promise<void>;
- /**
- * 修改群组信息
- * @param {ImModifyGroupReq} req
- * @returns {Promise<void>}
- */
- modifyGroup(req: ImModifyGroupReq): Promise<void>;
- /**
- * 查询最近组成员
- * @param {string | ImListRecentGroupUserReq} groupIdOrReq
- * @returns {Promise<ImListRecentGroupUserRsp>}
- */
- listRecentGroupUser(groupIdOrReq: string | ImListRecentGroupUserReq): Promise<ImListRecentGroupUserRsp>;
- /**
- * 查询群组成员,限管理员才能操作
- * @param {string | ImListGroupUserReq} groupIdOrReq
- * @returns {Promise<ImListGroupUserRsp>}
- */
- listGroupUser(groupIdOrReq: string | ImListGroupUserReq): Promise<ImListGroupUserRsp>;
- /**
- * 全体禁言,限管理员才能操作
- * @param {string | ImMuteAllReq} groupIdOrReq
- * @returns {Promise<void>}
- */
- muteAll(groupIdOrReq: string | ImMuteAllReq): Promise<void>;
- /**
- * 取消全体禁言,限管理员才能操作
- * @param {string | ImCancelMuteAllReq} groupIdOrReq
- * @returns {Promise<void>}
- */
- cancelMuteAll(groupIdOrReq: string | ImCancelMuteAllReq): Promise<void>;
- /**
- * 禁言指定用户,限管理员才能操作
- * @param {ImMuteUserReq} req
- * @returns {Promise<void>}
- */
- muteUser(req: ImMuteUserReq): Promise<void>;
- /**
- * 取消禁言指定用户,限管理员才能操作
- * @param {ImCancelMuteUserReq} req
- * @returns {Promise<void>}
- */
- cancelMuteUser(req: ImCancelMuteUserReq): Promise<void>;
- /**
- * 查询禁言用户列表,限管理员才能操作
- * @param {string | ImListMuteUsersReq} groupIdOrReq
- * @returns {Promise<ImListMuteUsersRsp>}
- */
- listMuteUsers(groupIdOrReq: string | ImListMuteUsersReq): Promise<ImListMuteUsersRsp>;
- }
- class AliVCIMMessageManager extends EventEmitter<ImMessageListener> {
- private wasmIns;
- private wasmMessageManager;
- private messageListener;
- private streamMessageManager;
- constructor(wasmIns: any, wasmInterface: any);
- addMessageListener(): void;
- removeMessageListener(): void;
- destroy(): void;
- /**
- * 发送单聊普通消息
- * @param {ImSendMessageToUserReq} req
- * @returns {string} messageId
- */
- sendC2cMessage(req: ImSendMessageToUserReq): Promise<string>;
- /**
- * 发送群聊普通消息
- * @param {ImSendMessageToGroupReq} req
- * @returns {string} messageId
- */
- sendGroupMessage(req: ImSendMessageToGroupReq): Promise<string>;
- /**
- * 查询消息列表
- * @param {ImListMessageReq} req
- * @returns {ImListMessageRsp}
- */
- listMessage(req: ImListMessageReq): Promise<ImListMessageRsp>;
- /**
- * 查询最近消息
- * @param {string |ImListRecentMessageReq} groupIdOrReq
- * @returns {ImListRecentMessageRsp}
- */
- listRecentMessage(groupIdOrReq: string | ImListRecentMessageReq): Promise<ImListRecentMessageRsp>;
- /**
- * 查询历史消息,该接口主要用户直播结束后的历史消息回放,用户无需进入群组可查询,比较耗时,在直播过程中不建议使用,另外该接口后续可能会收费。
- * @param {ImListHistoryMessageReq} req
- * @returns {ImListHistoryMessageRsp}
- */
- listHistoryMessage(req: ImListHistoryMessageReq): Promise<ImListHistoryMessageRsp>;
- /**
- * 删除/撤回群消息
- */
- deleteMessage(req: ImDeleteMessageReq): Promise<void>;
- /**
- * 创建流式消息
- */
- createStreamMessage(req: ImCreateStreamMessageReq): Promise<ImStreamMessageSender>;
- /**
- * 拒收流式消息
- */
- rejectStreamMessage(req: ImRejectStreamMessageReq): Promise<void>;
- /**
- * 自定义流式消息转发
- */
- forwardCustomMessage(req: ImForwardCustomMessageReq): Promise<ImForwardCustomMessageRsp>;
- }
- /**
- * Minimal `EventEmitter` interface that is molded against the Node.js
- * `EventEmitter` interface.
- */
- class EventEmitter<
- EventTypes extends EventEmitter.ValidEventTypes = string | symbol,
- Context extends any = any
- > {
- static prefixed: string | boolean;
- /**
- * Return an array listing the events for which the emitter has registered
- * listeners.
- */
- eventNames(): Array<EventEmitter.EventNames<EventTypes>>;
- /**
- * Return the listeners registered for a given event.
- */
- listeners<T extends EventEmitter.EventNames<EventTypes>>(
- event: T
- ): Array<EventEmitter.EventListener<EventTypes, T>>;
- /**
- * Return the number of listeners listening to a given event.
- */
- listenerCount(event: EventEmitter.EventNames<EventTypes>): number;
- /**
- * Calls each of the listeners registered for a given event.
- */
- emit<T extends EventEmitter.EventNames<EventTypes>>(
- event: T,
- ...args: EventEmitter.EventArgs<EventTypes, T>
- ): boolean;
- /**
- * Add a listener for a given event.
- */
- on<T extends EventEmitter.EventNames<EventTypes>>(
- event: T,
- fn: EventEmitter.EventListener<EventTypes, T>,
- context?: Context
- ): this;
- addListener<T extends EventEmitter.EventNames<EventTypes>>(
- event: T,
- fn: EventEmitter.EventListener<EventTypes, T>,
- context?: Context
- ): this;
- /**
- * Add a one-time listener for a given event.
- */
- once<T extends EventEmitter.EventNames<EventTypes>>(
- event: T,
- fn: EventEmitter.EventListener<EventTypes, T>,
- context?: Context
- ): this;
- /**
- * Remove the listeners of a given event.
- */
- removeListener<T extends EventEmitter.EventNames<EventTypes>>(
- event: T,
- fn?: EventEmitter.EventListener<EventTypes, T>,
- context?: Context,
- once?: boolean
- ): this;
- off<T extends EventEmitter.EventNames<EventTypes>>(
- event: T,
- fn?: EventEmitter.EventListener<EventTypes, T>,
- context?: Context,
- once?: boolean
- ): this;
- /**
- * Remove all listeners, or those of the specified event.
- */
- removeAllListeners(event?: EventEmitter.EventNames<EventTypes>): this;
- }
- namespace EventEmitter {
- interface ListenerFn<Args extends any[] = any[]> {
- (...args: Args): void;
- }
- interface EventEmitterStatic {
- new <
- EventTypes extends ValidEventTypes = string | symbol,
- Context = any
- >(): EventEmitter<EventTypes, Context>;
- }
- /**
- * `object` should be in either of the following forms:
- * ```
- * interface EventTypes {
- * 'event-with-parameters': any[]
- * 'event-with-example-handler': (...args: any[]) => void
- * }
- * ```
- */
- type ValidEventTypes = string | symbol | object;
- type EventNames<T extends ValidEventTypes> = T extends string | symbol
- ? T
- : keyof T;
- type ArgumentMap<T extends object> = {
- [K in keyof T]: T[K] extends (...args: any[]) => void
- ? Parameters<T[K]>
- : T[K] extends any[]
- ? T[K]
- : any[];
- };
- type EventListener<
- T extends ValidEventTypes,
- K extends EventNames<T>
- > = T extends string | symbol
- ? (...args: any[]) => void
- : (
- ...args: ArgumentMap<Exclude<T, string | symbol>>[Extract<K, keyof T>]
- ) => void;
- type EventArgs<
- T extends ValidEventTypes,
- K extends EventNames<T>
- > = Parameters<EventListener<T, K>>;
- const EventEmitter: EventEmitterStatic;
- }
- interface ImAttachmentProgress {
- progress: number;
- totalSize: number;
- currentSize: number;
- }
- interface ImAttachmentReq {
- id: string;
- fileType: ImAttachmentType;
- fileName: string;
- file?: File | Blob;
- filePath?: string;
- extra?: string;
- onProgress?: (res: ImAttachmentProgress) => void;
- }
- interface ImAttachmentRes {
- id: string;
- fileType: ImAttachmentType;
- fileSize: number;
- fileName: string;
- accessKey: string;
- fileDuration: number;
- extra: string;
- }
- enum ImAttachmentType {
- IMAGE = 1,
- AUDIO = 2,
- VIDEO = 3,
- OTHER = 4
- }
- interface ImAuth {
- /**
- * 随机数,格式:"AK-随机串", 最长64字节, 仅限A-Z,a-z,0-9及"_",可为空
- */
- nonce: string;
- /**
- * 过期时间:从1970到过期时间的秒数
- */
- timestamp: number;
- /**
- * 角色,为admin时,表示该用户可以调用管控接口,可为空,如果要给当前用户admin权限,应该传admin
- */
- role?: string;
- /**
- * token
- */
- token: string;
- }
- interface ImCancelMuteAllReq {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- }
- interface ImCancelMuteUserReq {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- /**
- * @param userList 被取消禁言的用户列表
- */
- userList: string[];
- }
- interface ImCloseGroupReq {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- }
- interface ImCreateGroupReq {
- /**
- * @param groupId 群组id,【可选】id为空的话,会由sdk内部生成
- */
- groupId?: string;
- /**
- * @param groupName 群组名称
- */
- groupName: string;
- /**
- * @param extension 业务扩展字段
- */
- groupMeta?: string;
- }
- interface ImCreateGroupRsp {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- /**
- * @param alreadyExist 是否已经创建过
- */
- alreadyExist: boolean;
- }
- interface ImCreateStreamMessageReq {
- /**
- * 数据类型
- */
- dataType: ImStreamMessageDataType;
- /**
- * 数据接收类型
- */
- receiverType: ImStreamMessageReceiverType;
- /**
- * 数据接收者ID
- */
- receiverId: string;
- }
- interface ImDeleteMessageReq {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- /**
- * @param messageId 消息id
- */
- messageId: string;
- }
- let ImEngine: typeof ImEngine_2;
- class ImEngine_2 extends EventEmitter<ImSdkListener> {
- private wasmIns;
- private wasmEngine;
- private wasmInterface;
- private transport?;
- private appEventManager?;
- private eventListener;
- private messageManager?;
- private groupManager?;
- private attachmentManager?;
- private pluginProvider?;
- private uploader;
- private supportsWebRtc;
- private supportWASM;
- private initFlag;
- constructor();
- static engine: ImEngine_2;
- /**
- * @brief 获取 SDK 引擎实例(单例)
- * @returns ImEngine
- */
- static createEngine(): ImEngine_2;
- /**
- * 当前 SDK 是否支持,支持 WASM 或者 ASM
- * @returns
- */
- static isSupport(): boolean;
- static getSdkVersion(): string;
- private initTransport;
- private initAppEvent;
- private loadWasm;
- private preloadUploader;
- private initNativePlugin;
- /**
- * @brief 初始化
- * @param config SDK配置信息
- */
- init(config: ImSdkConfig): Promise<0 | ImErrors.ERROR_CLIENT_REPEATED_INIT>;
- /**
- * 添加 Engine 事件监听
- */
- private addEventListener;
- private removeEventListener;
- private destroy;
- /**
- * @brief 销毁
- */
- unInit(): boolean;
- /**
- * @brief 登录
- * @param req 登录请求数据
- */
- login(loginReq: ImLoginReq): Promise<void>;
- /**
- * @brief 登出
- */
- logout(): Promise<void>;
- /**
- * 强制重连
- */
- reconnect(): void;
- /**
- * @brief 获取当前登录用户 ID
- */
- getCurrentUserId(): string;
- /**
- * @brief 是否登录
- */
- isLogin(): boolean;
- /**
- * @brief 是否已退出登录
- */
- isLogout(): boolean;
- /**
- * @brief 获取消息管理器 {AliVCIMMessageInterface}
- * @return 返回消息管理器实例
- */
- getMessageManager(): AliVCIMMessageManager | undefined;
- /**
- * @brief 获取群组管理器 {AliVCIMGroupInterface}
- * @return 返回群组管理器实例
- */
- getGroupManager(): AliVCIMGroupManager | undefined;
- /**
- * @brief 获取附件管理器 {AliVCIMAttachmentInterface}
- * @return 返回附件管理器实例
- */
- getAttachmentManager(): AliVCIMAttachmentManager | undefined;
- }
- enum ImErrors {
- /**
- * 已经登录
- */
- ERROR_HAS_LOGIN = 304,
- /**
- * 参数错误;参数无法解析
- */
- ERROR_INVALID_PARAM = 400,
- /**
- * 错误码(subcode) 说明
- * 403 操作无权限; 或登录时鉴权失败
- */
- ERROR_NO_PERMISSION = 403,
- /**
- * no session,可能因为客户网络变化等原因导致的连接变化,服务器在新连接上收到消息无法正常处理,需要reconnect 信令。
- */
- ERROR_NO_SESSION = 404,
- /**
- * 审核不通过
- */
- ERROR_AUDIT_FAIL = 406,
- /**
- * 繁忙,发送太快,稍候重试
- * 服务端同学确认不需要区分这两个错误
- */
- ERROR_INTERNAL_BUSY = 412,
- ERROR_INTERNAL_BUSY2 = 413,
- /**
- * 发送 c2c 消息对方用户不在线
- */
- ERROR_USER_OFFLINE = 424,
- /**
- * 未加入群组
- */
- ERROR_GROUP_NOT_JOINED = 425,
- /**
- * 操作过快,短时间内,发起过多请求。如同一个用户,1秒内发起2次登录。
- */
- ERROR_INTERNAL_BUSY3 = 429,
- /**
- * 群组不存在
- */
- ERROR_GROUP_NOT_EXIST = 440,
- /**
- * 群组已删除
- */
- ERROR_GROUP_DELETED = 441,
- /**
- * 无法在该群组中发送消息,被禁言
- */
- ERROR_SEND_GROUP_MSG_FAIL = 442,
- /**
- * 进了太多的群组, 列表人数超大等
- */
- ERROR_REACH_MAX = 443,
- /**
- * 无法加入该群,被禁止加入(暂无需求未实现)预留
- */
- ERROR_JOIN_GROUP_FAIL = 450,
- /**
- * ots 查询错误
- */
- ERROR_OTS_FAIL = 480,
- /**
- * 系统临时错误,稍候重试
- */
- ERROR_INTERNALE_RROR = 500,
- /**
- * 底层重复初始化
- */
- ERROR_CLIENT_REPEATED_INIT = -1,
- /**
- * 初始化配置信息有误
- */
- ERROR_CLIENT_INIT_INVALID_PARAM = -2,
- /**
- * 未初始化
- */
- ERROR_CLIENT_NOT_INIT = 1,
- /**
- * 参数异常
- */
- ERROR_CLIENT_INVALID_PARAM = 2,
- /**
- * 状态有误
- */
- ERROR_CLIENT_INVALID_STATE = 3,
- /**
- * 建连失败
- */
- ERROR_CLIENT_CONNECT_ERROR = 4,
- /**
- * 建连超时
- */
- ERROR_CLIENT_CONNECT_TIMEOUT = 5,
- /**
- * 发送失败
- */
- ERROR_CLIENT_SEND_FAILED = 6,
- /**
- * 发送取消
- */
- ERROR_CLIENT_SEND_CANCEL = 7,
- /**
- * 发送超时
- */
- ERROR_CLIENT_SEND_TIMEOUT = 8,
- /**
- * 订阅失败
- */
- ERROR_CLIENT_SUB_ERROR = 9,
- /**
- * 订阅通道断连
- */
- ERROR_CLIENT_SUB_DISCONNECT = 10,
- /**
- * 订阅超时
- */
- ERROR_CLIENT_SUB_TIMEOUT = 11,
- /**
- * 压缩失败
- */
- ERROR_CLIENT_COMPRESS_ERROR = 12,
- /**
- * 解压失败
- */
- ERROR_CLIENT_DECOMPRESS_ERROR = 13,
- /**
- * 加密失败
- */
- ERROR_CLIENT_ENCRYPT_ERROR = 14,
- /**
- * 解密失败
- */
- ERROR_CLIENT_DECRYPT_ERROR = 15,
- /**
- * 消息体封装失败
- */
- ERROR_CLIENT_CONVERTER_ERROR = 16,
- /**
- * 消息体解析失败
- */
- ERROR_CLIENT_PARSE_ERROR = 17,
- /**
- * 数据为空
- */
- ERROR_CLIENT_DATA_EMPTY = 18,
- /**
- * 数据错误
- */
- ERROR_CLIENT_DATA_ERROR = 19,
- /**
- * 地址出错(可能是AppSign有误,如头部带了空格、内容被截断等)
- */
- ERROR_CLIENT_URL_ERROR = 20,
- /**
- * 建连取消
- */
- CONNECT_CANCEL = 21,
- /**
- * 重试超过次数限制
- */
- RETRY_OVER_TIME = 22,
- /**
- * 状态错误
- */
- ERROR_INVALID_STATE = 601,
- /**
- * 未登录
- */
- ERROR_NOT_LOGIN = 602,
- /**
- * 收到上次session的消息
- */
- ERROR_RECEIVE_LAST_SESSION = 603,
- /**
- * Parse Data Error
- */
- ERROR_PARSE_DATA_ERROR = 604
- }
- interface ImForwardCustomMessageReq {
- /**
- * 数据接收者ID
- */
- receiverId: string;
- /**
- * 数据,若需要传对象,需要序列化
- */
- data: string;
- }
- interface ImForwardCustomMessageRsp {
- /**
- * 流式消息ID
- */
- messageId: string;
- /**
- * 数据,若返回的是对象,需要反序列化
- */
- data: string;
- }
- interface ImGroupInfo {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- /**
- * @param groupName 群组名称
- */
- groupName: string;
- /**
- * @param groupMeta 群组透传信息
- */
- groupMeta: string;
- /**
- * @param createTime 创建时间
- */
- createTime: number;
- /**
- * @param creator 创建者id
- */
- creator: string;
- /**
- * @param admins 管理员列表
- */
- admins: string[];
- /**
- * @param statistics 群组统计
- */
- statistics: ImGroupStatistics;
- /**
- * @param muteStatus 群禁言信息
- */
- muteStatus: ImGroupMuteStatus;
- }
- interface ImGroupInfoStatus {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- /**
- * @param groupMeta 群组扩展信息
- */
- groupMeta: string;
- /**
- * @param adminList 管理员列表
- */
- adminList: string[];
- }
- interface ImGroupListener {
- /**
- * @deprecated 1.4.1 后请使用 memberdatachange 事件
- *
- * 群组成员变化
- * @param groupId 群组ID
- * @param memberCount 当前群组人数
- * @param joinUsers 加入的用户
- * @param leaveUsers 离开的用户
- */
- memberchange: (groupId: string, memberCount: number, joinUsers: ImUser[], leaveUsers: ImUser[]) => void;
- /**
- * 1.4.1 版本新增新的群组成员变化,返回的是一个对象
- * @param data 群组成员变化数据对象
- * @param data.groupId 群组ID
- * @param data.onlineCount 当前群组在线人数
- * @param data.pv 加入群组累积pv数
- * @param data.isBigGroup 是否是大群组
- * @param data.joinUsers 加入的用户
- * @param data.leaveUsers 离开的用户
- */
- memberdatachange: (data: ImMemberChangeData) => void;
- /**
- * 退出群组
- * @param groupId 群组ID
- * @param reason 退出原因 1: 群被解散, 2:被踢出来了
- */
- exit: (groupId: string, reason: number) => void;
- /**
- * 群组静音状态变化
- * @param groupId 群组ID
- * @param status 静音状态
- */
- mutechange: (groupId: string, status: ImGroupMuteStatus) => void;
- /**
- * 群组信息变化
- * @param groupId 群组ID
- * @param info 群组信息
- */
- infochange: (groupId: string, info: ImGroupInfoStatus) => void;
- }
- interface ImGroupMuteStatus {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- /**
- * @param muteAll 是否全员禁言
- */
- muteAll: boolean;
- /**
- * @param muteUserList 禁言用户ID列表
- */
- muteUserList: string[];
- /**
- * @param whiteUserList 白名单用户ID列表
- */
- whiteUserList: string[];
- }
- interface ImGroupStatistics {
- /**
- * @param pv PV
- */
- pv: number;
- /**
- * @param onlineCount 在线人数
- */
- onlineCount: number;
- /**
- * @param msgAmount 消息数量
- */
- msgAmount: {
- [key: string]: number;
- };
- }
- interface ImJoinGroupReq {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- }
- interface ImLeaveGroupReq {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- }
- interface ImListGroupUserReq {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- /**
- * @param sortType 排序方式,ASC-先加入优先,DESC-后加入优先
- */
- sortType?: ImSortType;
- /**
- * @param nextPageToken 默认表示第一页,遍历时服务端会返回,客户端获取下一页时,应带上
- */
- nextPageToken?: number;
- /**
- * @deprecated 请使用 nextPageToken
- */
- nextpagetoken?: number;
- /**
- * @param pageSize 最大不超过50
- */
- pageSize?: number;
- }
- interface ImListGroupUserRsp {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- /**
- * @param nextPageToken 下一页的token
- */
- nextPageToken: number;
- /**
- * @deprecated 请使用 nextPageToken
- */
- nextpagetoken?: number;
- /**
- * @param hasMore 是否还有下一页
- */
- hasMore: boolean;
- /**
- * @param userList 返回的群组的在线成员列表
- */
- userList: ImUser[];
- }
- interface ImListHistoryMessageReq {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- /**
- * @param type 消息类型
- */
- type: number;
- /**
- * @param nextPageToken 不传时表示第一页,遍历时服务端会返回,客户端获取下一页时,应带上
- */
- nextPageToken?: number;
- /**
- * @param sortType 排序类型,默认为时间递增
- */
- sortType?: ImSortType;
- /**
- * @param pageSize 取值范围 10~30
- */
- pageSize?: number;
- /**
- * @param begintime 按时间范围遍历,开始时间,不传时表示最早时间,单位:秒
- */
- beginTime?: number;
- /**
- * @param endtime 按时间范围遍历,结束时间,不传时表示最晚时间,单位:秒
- */
- endTime?: number;
- }
- interface ImListHistoryMessageRsp {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- /**
- * @param nextPageToken 不传时表示第一页,遍历时服务端会返回,客户端获取下一页时,应带上
- */
- nextPageToken?: number;
- /**
- *@param hasMore 是否有更多数据
- */
- hasMore: boolean;
- /**
- *@param messageList 返回消息列表
- **/
- messageList: ImMessage[];
- }
- interface ImListMessageReq {
- /**
- * @param groupId 话题id,聊天插件实例id
- */
- groupId: string;
- /**
- * @param type 消息类型
- */
- type: number;
- /**
- * @param nextPageToken 不传时表示第一页,遍历时服务端会返回,客户端获取下一页时应带上
- */
- nextPageToken?: number;
- /**
- * @deprecated 请使用nextPageToken
- */
- nextpagetoken?: number;
- /**
- * @param sortType 排序类型,默认为时间递增
- */
- sortType?: ImSortType;
- /**
- * @param pageSize 分页拉取的大小,默认10条,最大30条
- */
- pageSize?: number;
- /**
- * @param begintime 按时间范围遍历,开始时间,不传时表示最早时间,单位:秒
- */
- beginTime?: number;
- /**
- * @param endtime 按时间范围遍历,结束时间,不传时表示最晚时间,单位:秒
- */
- endTime?: number;
- }
- interface ImListMessageRsp {
- /**
- ** @param groupId 群组id
- */
- groupId: string;
- /**
- *@param nextpagetoken 客户端获取下一页时,应带上
- */
- nextPageToken: number;
- /**
- * @deprecated 请使用 nextPageToken
- */
- nextpagetoken?: number;
- /**
- *@param hasmore 是否有更多数据
- */
- hasMore: boolean;
- /**
- *@param messageList 返回消息列表
- **/
- messageList: ImMessage[];
- }
- interface ImListMuteUsersReq {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- }
- interface ImListMuteUsersRsp {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- /**
- * @param muteAll 是否全员禁言
- */
- muteAll: boolean;
- /**
- * @param muteUserList 禁言用户ID列表
- */
- muteUserList: string[];
- /**
- * @param whiteUserList 白名单用户ID列表
- */
- whiteUserList: string[];
- }
- interface ImListRecentGroupUserReq {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- }
- interface ImListRecentGroupUserRsp {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- /**
- * @param total 群组成员总数
- */
- total: number;
- /**
- * @param userList 返回的群组的在线成员列表
- */
- userList: ImUser[];
- }
- interface ImListRecentMessageReq {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- /**
- * @param seqnum 消息序列号
- */
- seqnum?: number;
- /**
- * @param pageSize 分页拉取的大小,默认50条
- */
- pageSize?: number;
- }
- interface ImListRecentMessageRsp {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- /**
- * @param messageList 返回消息列表
- */
- messageList: ImMessage[];
- }
- interface ImLoginReq {
- user: ImUser;
- /**
- * 用户鉴权信息
- */
- userAuth: ImAuth;
- }
- enum ImLogLevel {
- NONE = 0,
- DBUG = 1,
- INFO = 2,
- WARN = 3,
- ERROR = 4
- }
- interface ImMemberChangeData {
- groupId: string;
- onlineCount: number;
- pv: number;
- isBigGroup: boolean;
- joinUsers: ImUser[];
- leaveUsers: ImUser[];
- }
- interface ImMessage {
- /**
- * @param groupId 话题id,聊天插件实例id
- */
- groupId?: string;
- /**
- * @param messageId 消息id
- */
- messageId: string;
- /**
- *@param type 消息类型。系统消息小于10000
- */
- type: number;
- /**
- *@param sender 发送者
- */
- sender?: ImUser;
- /**
- **@param data 消息内容
- */
- data: string;
- /**
- *@param seqnum 消息顺序号
- */
- seqnum: number;
- /**
- *@param timestamp 消息发送时间
- */
- timestamp: number;
- /**
- *@param level 消息分级
- **/
- level: ImMessageLevel;
- /**
- * @param repeatCount 消息统计数量增长值,默认1,主要用于聚合同类型消息。
- */
- repeatCount: number;
- /**
- * @param totalMsgs 同类型的消息数量
- */
- totalMsgs: number;
- }
- enum ImMessageLevel {
- NORMAL = 0,
- HIGH = 1
- }
- interface ImMessageListener {
- /**
- * 接收到c2c消息
- * @param msg 消息
- */
- recvc2cmessage: (msg: ImMessage) => void;
- /**
- * 接收到群消息
- * @param msg 消息
- * @param groupId 群id
- */
- recvgroupmessage: (msg: ImMessage, groupId: string) => void;
- /**
- * 删除群消息
- * @param msgId 消息id
- * @param groupId 群id
- */
- deletegroupmessage: (msgId: string, groupId: string) => void;
- /**
- * 流消息结束通知
- * @param {string} messageId 消息ID
- * @param {number} endCode 结束原因:0正常处理结束,1主动取消,2与智能体服务连接异常断开,3连接超时断开,4收到新的开始切片,5包请求异常
- * @param {number} [subCode] 详情码
- * @param {string} [subMsg] 详情信息
- */
- streammessageend: (messageId: string, endCode: number, subCode?: number, subMsg?: string) => void;
- /**
- * 接收到流消息
- * @param message 流消息
- */
- recvstreammessage: (message: ImStreamMessage) => void;
- }
- interface ImModifyGroupReq {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- /**
- * @param forceUpdateGroupMeta 为true表示强制刷新groupMeta信息,若groupMeta为空则表示清空;
- * 为false,则只有groupMeta不空才更新groupMeta信息
- */
- forceUpdateGroupMeta?: boolean;
- /**
- * @param groupMeta 群信息扩展字段
- */
- groupMeta?: string;
- /**
- * @param forceUpdateAdmins 为true表示强制刷新admins信息,若admins为空则表示清空;
- * 为false,则只有admins不空才更新admins信息
- */
- forceUpdateAdmins?: boolean;
- /**
- * @param admins 群管理员ID列表,最多设置3个管理员
- */
- admins?: string[];
- }
- interface ImMuteAllReq {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- }
- interface ImMuteUserReq {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- /**
- * @param userList 需要禁言的用户列表
- */
- userList: string[];
- }
- interface ImQueryGroupReq {
- /**
- * @param groupId 群组id
- */
- groupId: string;
- }
- interface ImRejectStreamMessageReq {
- /**
- * 流式消息ID
- */
- messageId: string;
- /**
- * 数据接收类型
- */
- receiverType: ImStreamMessageReceiverType;
- /**
- * 错误码
- */
- code: number;
- /**
- * 错误信息
- */
- msg: string;
- }
- interface ImSdkConfig {
- /**
- * 设备唯一标识
- */
- deviceId?: string;
- /**
- * 应用ID
- */
- appId: string;
- /**
- * 应用签名
- */
- appSign: string;
- /**
- * 日志级别
- */
- logLevel?: ImLogLevel;
- /**
- * 来源
- */
- source?: string;
- /**
- * 心跳超时时间,单位是秒,默认 99s,允许 [15-120]s
- */
- heartbeatTimeout?: number;
- /**
- * @param extra 用户自定义参数
- */
- extra?: {
- [key: string]: string;
- };
- /**
- * @param uploader 附件上传器参数
- */
- uploader?: {
- /**
- * 是否提前加载,默认 false
- */
- preload?: boolean;
- /**
- * 指定sdk文件地址
- */
- sdkUrl?: string;
- };
- }
- interface ImSdkListener {
- /**
- * 连接中
- */
- connecting: () => void;
- /**
- * 连接成功
- */
- connectsuccess: () => void;
- /**
- * 连接失败
- */
- connectfailed: (error: Error) => void;
- /**
- * 连接断开
- * @param code 断开原因 1:主动退出, 2:被踢出 3:超时等其他原因 4:在其他端上登录
- */
- disconnect: (code: number) => void;
- /**
- * 连接状态变化
- * state 状态 0:未连接 1:连接中 2:已连接 3:已断联
- */
- linkstate: (data: {
- previousState: number;
- currentState: number;
- }) => void;
- /**
- * token过期
- * @param callback 更新 Token 的回调
- */
- tokenexpired: (callback: TokenCallback) => void;
- /**
- * 重连成功
- */
- reconnectsuccess: (groupInfos: ImGroupInfo[]) => void;
- }
- interface ImSendMessageToGroupReq {
- /**
- * @param groupId 话题id,聊天插件实例id
- */
- groupId: string;
- /**
- * @param type 消息类型,小于等于10000位系统消息,大于10000位自定义消息
- */
- type: number;
- /**
- * @param data 消息体
- */
- data: string;
- /**
- * @param skipMuteCheck 跳过禁言检测,true:忽略被禁言用户,还可发消息;false:当被禁言时,消息无法发送,默认为false,即为不跳过禁言检测。
- */
- skipMuteCheck?: boolean;
- /**
- * @param skipAudit 跳过安全审核,true:发送的消息不经过阿里云安全审核服务审核;false:发送的消息经过阿里云安全审核服务审核,审核失败则不发送;
- */
- skipAudit?: boolean;
- /**
- * @param level 消息分级
- */
- level?: ImMessageLevel;
- /**
- * @param noStorage 为true时,表示该消息不需要存储,也无法拉取查询
- */
- noStorage?: boolean;
- /**
- * @param repeatCount 消息统计数量增长值,默认1,主要用于聚合同类型消息,只发送一次请求,例如点赞场景
- */
- repeatCount?: number;
- }
- interface ImSendMessageToUserReq {
- /**
- * 消息类型。系统消息小于10000
- */
- type: number;
- /**
- * 消息体
- */
- data: string;
- /**
- * 接收者用户
- */
- receiverId: string;
- /**
- * 跳过安全审核,true:发送的消息不经过阿里云安全审核服务审核;false:发送的消息经过阿里云安全审核服务审核,审核失败则不发送;
- */
- skipAudit?: boolean;
- /**
- * 消息分级
- */
- level?: ImMessageLevel;
- }
- enum ImSortType {
- ASC = 0,
- DESC = 1
- }
- interface ImStreamData {
- seqNum: number;
- byteData: ArrayBuffer;
- }
- interface ImStreamMessage {
- /**
- * 流式消息ID
- */
- messageId: string;
- /**
- * 发送用户
- */
- sender: ImUser;
- /**
- * 流式消息帧数据
- */
- data: ImStreamData;
- }
- enum ImStreamMessageDataType {
- TEXT = 1,// 文本
- BINARY_FILE = 2
- }
- enum ImStreamMessageReceiverType {
- SERVER = 0
- }
- class ImStreamMessageSender extends EventEmitter<ImStreamMessageSenderListener> {
- private wasmIns;
- private sender;
- constructor(wasmIns: any);
- setSender(sender: any): void;
- getMessageId(): string;
- /**
- * 发送字节数据
- * @param {Uint8Array} byteData 字节数据
- * @param {boolean} isLast 是否结束流
- * @param {ImAttachmentRes[]} [attachments] 附件列表
- */
- sendByteData(byteData: Uint8Array, isLast: boolean, attachments?: ImAttachmentRes[]): void;
- /**
- * 取消发送
- * @param {number} [code] 取消码
- * @param {string} [msg] 取消原因
- */
- cancel(code?: number, msg?: string): void;
- destroy(): void;
- }
- interface ImStreamMessageSenderListener {
- /**
- * 流消息结束通知
- * @param {string} messageId 消息ID
- * @param {number} endCode 结束原因:0正常处理结束,1主动取消,2与智能体服务连接异常断开,3连接超时断开,4收到新的开始切片,5包请求异常
- * @param {number} [subCode] 详情码
- * @param {string} [subMsg] 详情信息
- */
- streammessageend: (messageId: string, endCode: number, subCode?: number, subMsg?: string) => void;
- }
- enum ImStreamMessageStatus {
- CONTINUE = 0,// 中间帧
- START = 1,// 开始帧
- END = 2,// 结束帧
- ALL = 3,// 一次性传输
- CANCEL = 4
- }
- enum ImStreamMessageType {
- NORMAL = 0
- }
- interface ImUser {
- /**
- * @param user_id 用户id
- */
- userId: string;
- /**
- * @param user_extension 用户扩展信息
- */
- userExtension?: string;
- }
- type TokenCallback = (error: {
- code?: number;
- msg: string;
- } | null, auth?: ImAuth) => void;
- }
|