类/枚举

更新时间: 2024/05/13 16:54:26

本文介绍 NIM SDK API 的类和枚举信息。

支持平台

Android iOS macOS/Windows Web/uni-app/小程序 Harmony

V2NIMSuccessCallback

操作成功回调对象。

Andoroid
javapublic interface V2NIMSuccessCallback<T> {
    void onSuccess(T t);
}
iOS
objective-ctypedef void (^V2NIMSuccessCallback)(void);
macOS/Windows
cpptemplate <typename T>
class V2NIMSuccessCallback : public nstd::function<void(T)> {
public:
    using nstd::function<void(T)>::function;
    using nstd::function<void(T)>::operator=;
    using nstd::function<void(T)>::operator();
    V2NIMSuccessCallback<T>(nstd::function<void(T)> func)
        : nstd::function<void(T)>(func) {}
};

template <>
class V2NIMSuccessCallback<void> : public nstd::function<void()> {
public:
    using nstd::function<void()>::function;
    using nstd::function<void()>::operator=;
    using nstd::function<void()>::operator();
    V2NIMSuccessCallback<void>(nstd::function<void()> func)
        : nstd::function<void()>(func) {}
};

成员函数

onSuccess

操作成功回调。

参数名称 类型 描述
value T 回调数据类型

V2NIMFailureCallback

操作失败回调对象。

Andoroid
javapublic interface V2NIMFailureCallback {
    void onFailure(V2NIMError error);
}
iOS
objective-ctypedef void (^V2NIMFailureCallback)(V2NIMError *error);
macOS/Windows
cppusing V2NIMFailureCallback = nstd::function<void(V2NIMError error)>;

成员函数

onFailed

操作失败回调。

参数名称 类型 描述
error V2NIMError 回调错误详情

V2NIMProgressCallback

操作进度回调对象。

Andoroid
javapublic interface V2NIMProgressCallback {
    // progress int
    // 进度回调 取值范围[0,100],表示百分比
    // 100表示上传成功
    // 0表示未开始上传
    void onProgress(int progress);
}
iOS
objective-ctypedef void (^V2NIMProgressCallback)(NSUInteger);
macOS/Windows
cppusing V2NIMProgressCallback = nstd::function<void(uint32_t progress)>;
Web/uni-app/小程序
typescriptexport type V2NIMProgressCallback = (progress: { [key: string]: any }) => void
Harmony
typescriptexport type V2NIMProgressCallback = (progress: number) => void

成员函数

onProgress

操作进度回调。

参数名称 类型 描述
progress int 操作进度,取值范围 [0,100],100 表示操作成功,0 表示未开始。

V2NIMError

错误信息。具体错误码请参见API 错误码文档

参数名称 类型 描述
code int 错误码
desc String 错误描述
detail Map 错误详情,用于补充上下文细节。

V2NIMLoginOption

登录配置参数。

Andoroid
javapublic class V2NIMLoginOption {

    public Integer getRetryCount() {
        return retryCount;
    }

    public void setRetryCount(Integer retryCount) {
        this.retryCount = retryCount;
    }

    public long getTimeout() {
        return timeout;
    }

    public void setTimeout(long timeout) {
        this.timeout = timeout;
    }

    public boolean getForceMode() {
        return forceMode;
    }

    public void setForceMode(boolean forceMode) {
        this.forceMode = forceMode;
    }

    public V2NIMLoginAuthType getAuthType() {
        return authType;
    }

    public void setAuthType(V2NIMLoginAuthType authType) {
        this.authType = authType;
    }

    public V2NIMTokenProvider getTokenProvider() {
        return tokenProvider;
    }

    public void setTokenProvider(V2NIMTokenProvider tokenProvider) {
        this.tokenProvider = tokenProvider;
    }

    public V2NIMLoginExtensionProvider getLoginExtensionProvider() {
        return loginExtensionProvider;
    }

    public void setLoginExtensionProvider(V2NIMLoginExtensionProvider loginExtensionProvider) {
        this.loginExtensionProvider = loginExtensionProvider;
    }

    public V2NIMDataSyncLevel getSyncLevel() {
        return syncLevel;
    }

    public void setSyncLevel(V2NIMDataSyncLevel syncLevel) {
        this.syncLevel = syncLevel;
    }
}
iOS
objective-c@interface V2NIMLoginOption : NSObject

@property(nonatomic,assign) NSInteger retryCount;

@property(nonatomic,assign) NSInteger timeout;

@property(nonatomic,assign) BOOL forceMode;

@property(nonatomic,assign) V2NIMLoginAuthType authType;

@property(nullable,nonatomic,strong) id<V2NIMTokenProvider> tokenProvider;

@property(nullable,nonatomic,strong) id<V2NIMLoginExtensionProvider> loginExtensionProvider;

@property(nonatomic,assign) V2NIMDataSyncLevel syncLevel;

@end
macOS/Windows
cppstruct V2NIMLoginOption {
    uint32_t retryCount{3};
    uint64_t timeout{V2NIM_DEFAULT_LOGIN_TIMEOUT};
    bool forceMode{false};
    V2NIMLoginAuthType authType{V2NIM_LOGIN_AUTH_TYPE_DEFAULT};
    V2NIMTokenProvider tokenProvider{nullptr};
    V2NIMLoginExtensionProvider loginExtensionProvider{nullptr};
    V2NIMDataSyncLevel syncLevel{V2NIM_DATA_SYNC_LEVEL_FULL};
};
Web/uni-app/小程序
typescriptexport type V2NIMLoginOption = {
  retryCount?: number
  timeout?: number
  forceMode?: boolean
  authType?: V2NIMLoginAuthType
  loginExtensionProvider?: (accountId: string) => Promise<string> | string
  tokenProvider?: (accountId: string) => Promise<string> | string
  syncLevel?: V2NIMDataSyncLevel
}
Harmony
typescriptexport interface V2NIMLoginOption {

  retryCount?: number
  timeout?: number
  forceMode?: boolean
  authType?: V2NIMLoginAuthType
  loginExtensionProvider?: V2NIMLoginExtensionProvider
  tokenProvider?: V2NIMTokenProvider
  syncLevel?: V2NIMDataSyncLevel
}

成员参数

如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

名称 类型 是否必填 默认值 描述
retryCount int 3 登录失败后,重试登录的次数。
若登录成功后因网络原因断开连接,则不限次数重连。
timeout int 60000 登录超时时间,单位毫秒。
系统会在超时时间内重试登录,重试次数最大为 retryCount
forceMode Bool false 多端登录互踢时是否强制登录:
  • true:强制登录模式。设置为该模式后,如果在控制台配置了多端登录互踢策略,则无论本端是否为登陆存续状态(未登出但退出应用),登录成功时将其他在线设备端踢下线。
  • false:非强制登录模式。设置为该模式后,如果在控制台配置了多端登录互踢策略
    • 如果本段为登录存续状态,本端登录失败且返回 417 错误码(禁止多端登录)。此时可决定再次登录并设置强制登录模式或放弃登录。
    • 如果本段为非登录存续状态,则登录成功时将其他在线设备端踢下线。
  • authType V2NIMLoginAuthType 0 鉴权方式,包括静态 Token 鉴权(默认)、动态 Token 鉴权、通过第三方回调鉴权。
    tokenProvider V2NIMTokenProvider 否,若使用动态 Token 鉴权则为必填 - 获取动态 Token 回调,用于动态 Token 登录鉴权。该回调在登录连接完成、登录鉴权校验前触发。若函数执行有异常或返回非预期内容(非法字符串),则登录中止并报错。
    loginExtensionProvider V2NIMLoginExtensionProvider 否,若使用第三方回调鉴权则为必填 - 获取用户登录业务扩展数据回调,用于第三方登录鉴权。该回调在登录连接完成、登录鉴权校验前触发。若函数执行有异常或返回非预期内容(非法字符串),则登录中止并报错。
    syncLevel V2NIMDataSyncLevel - 数据同步模式,分为完全同步和基础数据同步。Web 端仅支持完全同步。

    V2NIMTokenProvider

    获取动态 Token 回调。

    Andoroid
    javapublic interface V2NIMTokenProvider {
        String getToken(String account);
    }
    
    iOS
    objective-c@protocol V2NIMTokenProvider <NSObject>
    
    - (nullable NSString *)getToken:(NSString *)accountId;
    
    @end
    
    macOS/Windows
    cppusing V2NIMTokenProvider = nstd::function<nstd::optional<nstd::string>(nstd::string accountId)>;
    
    Web/uni-app/小程序
    typescriptexport type V2NIMTokenProvider = (accountId: string) => Promise<string> | string
    
    Harmony
    typescriptexport type V2NIMTokenProvider = (accountId: string) => Promise<string> | string
    

    成员参数

    如果您的应用平台为 Android 或 iOS,则需要调用对应的成员函数获取对应参数。

    名称 类型 描述
    accountId String 登录账号

    V2NIMLoginExtensionProvider

    用户登录业务扩展数据回调。

    Andoroid
    javapublic interface V2NIMLoginExtensionProvider {
        String getLoginExtension(String accountId);
    }
    
    iOS
    objective-c@protocol V2NIMLoginExtensionProvider <NSObject>
    
    - (nullable NSString *)getLoginExtension:(NSString *)accountId;
    
    @end
    
    macOS/Windows
    cppusing V2NIMLoginExtensionProvider = nstd::function<nstd::optional<nstd::string>(nstd::string accountId)>;
    
    Web/uni-app/小程序
    typescriptexport type V2NIMLoginExtensionProvider = (accountId: string) => Promise<string> | string
    
    Harmony
    typescriptexport type V2NIMLoginExtensionProvider = (accountId: string) => Promise<string> | string
    

    成员参数

    如果您的应用平台为 Android 或 iOS,则需要调用对应的成员函数获取对应参数。

    名称 类型 描述
    accountId String 登录账号

    V2NIMLoginClient

    当前处于登录状态的客户端信息。

    Andoroid
    javapublic interface V2NIMLoginClient {
        V2NIMLoginClientType getType();
    
        String getOs();
    
        long getTimestamp();
    
        String getCustomTag();
    
        int getCustomClientType();
    
        String getClientId();
    }
    
    iOS
    objective-c@interface V2NIMLoginClient : NSObject
    
    @property(nonatomic,assign,readonly) V2NIMLoginClientType type;
    
    @property(nullable,nonatomic,copy,readonly) NSString *os;
    
    @property(nonatomic,assign,readonly) NSTimeInterval timestamp;
    
    @property(nullable,nonatomic,copy,readonly) NSString *customTag;
    
    @property(nonatomic,assign,readonly) NSInteger customClientType;
    
    @property(nullable,nonatomic,copy,readonly) NSString *clientId;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMLoginClient {
        V2NIMLoginClientType type{V2NIM_LOGIN_CLIENT_TYPE_UNKNOWN};
        nstd::string os;
        uint64_t timestamp{0};
        nstd::string customTag;
        uint32_t customClientType{0};
        nstd::string clientId;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMLoginClient = {
      type: V2NIMLoginClientType
      os: string
      timestamp: number
      customTag?: string
      customClientType?: number
      clientId: string
    }
    
    Harmony
    typescriptexport interface V2NIMLoginClient {
      type: V2NIMLoginClientType
      os: string
      timestamp: number
      customTag?: string
      customClientType?: number
      clientId: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    参数名称 类型 是否只读 默认值 描述
    type V2NIMLoginClientType - 客户端类型。
    os String - 客户端操作系统
    timestamp long - 客户端登录时间戳
    customTag String - 自定义标签,不得超过 32 个字符。可以通过该参数对不同终端设备进行区分。
    customClientType int 0 自定义客户端类型,小于或等于 0 表示无自定义类型。
    clientId String - 客户端 ID,客户端唯一标识。

    V2NIMReconnectDelayProvider

    登录重连延时回调对象。

    Andoroid
    javapublic interface V2NIMReconnectDelayProvider {
        long getReconnectDelay(long delay);
    }
    
    iOS
    objective-c@protocol V2NIMReconnectDelayProvider <NSObject>
    
    - (nullable uint32_t *)getReconnectDelay:(uint32_t *)delay;
    
    @end
    
    macOS/Windows
    cppusing V2NIMReconnectDelayProvider = nstd::function<nstd::optional<nstd::int>(nstd::int delay)>;
    
    Web/uni-app/小程序
    typescriptexport type V2NIMReconnectDelayProvider = (delay: number) => number
    
    Harmony
    typescriptexport type V2NIMReconnectDelayProvider = (delay: number) => number
    

    成员参数

    如果平台为 Android 或 iOS,则需要通过成员函数 getReconnectDelay 获取登录重连延时。

    参数名称 类型 是否必填 默认值 描述
    delay 视平台而定 - 登录重连延时

    返回值

    登录重连延时时间,单位为毫秒。

    V2NIMKickedOfflineDetail

    登录客户端被踢详细信息。

    Andoroid
    javapublic interface V2NIMKickedOfflineDetail {
        V2NIMKickedOfflineReason getReason();
    
        String getReasonDesc();
    
        V2NIMLoginClientType getClientType();
    
        Integer getCustomClientType();
    }
    
    iOS
    objective-c@interface V2NIMKickedOfflineDetail : NSObject
    
    @property(nonatomic,assign,readonly) V2NIMKickedOfflineReason reason;
    @property(nullable,nonatomic,copy,readonly) NSString *reasonDesc;
    @property(nonatomic,assign,readonly) V2NIMLoginClientType clientType;
    @property(nonatomic,assign,readonly) NSInteger customClientType;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMKickedOfflineDetail {
        V2NIMKickedOfflineReason reason{V2NIM_KICKED_OFFLINE_REASON_CLIENT_EXCLUSIVE};
        nstd::string reasonDesc;
        V2NIMLoginClientType clientType{V2NIM_LOGIN_CLIENT_TYPE_UNKNOWN};
        uint32_t customClientType{0};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMKickedOfflineDetail = {
      reason: V2NIMKickedOfflineReason
      reasonDesc: string
      clientType: V2NIMLoginClientType
      customClientType: number
    }
    
    Harmony
    typescriptexport interface V2NIMKickedOfflineDetail {
      reason: V2NIMKickedOfflineReason
      reasonDesc: string
      clientType: V2NIMLoginClientType
      customClientType: number
    }
    

    成员参数

    如果平台为 Android,则需要通过成员函数 getReconnectDelay 获取登录重连延时。

    参数名称 类型 是否必填 默认值 描述
    reason V2NIMKickedOfflineReason - - 客户端被踢原因类型
    reasonDesc String - - 客户端被踢原因详情
    clientType V2NIMLoginClientType - - 踢端的客户端类型
    customClientType int - - 踢端自定义客户端类型

    V2NIMDataSyncDetail

    数据同步状态详细信息。

    Andoroid
    javapublic interface V2NIMDataSyncDetail {
        V2NIMDataSyncType getType();
        V2NIMDataSyncState getState();
        V2NIMError getError();
    }
    
    iOS
    objective-c@interface V2NIMDataSyncDetail : NSObject
    
    @property(nonatomic,assign,readonly) V2NIMDataSyncType type;
    @property(nonatomic,assign,readonly) V2NIMDataSyncState state;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMDataSyncDetail {
        V2NIMDataSyncType type{V2NIM_DATA_SYNC_MAIN};
        V2NIMDataSyncState state{V2NIM_DATA_SYNC_STATE_WAITING};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMDataSyncDetail = {
    
      type: V2NIMDataSyncType
      state: V2NIMDataSyncState
    }
    
    Harmony
    typescriptexport interface V2NIMDataSyncDetail {
    
      type: V2NIMDataSyncType
      state: V2NIMDataSyncState
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    参数名称 类型 是否必填 默认值 描述
    type V2NIMDataSyncType - - 同步数据类型
    state V2NIMDataSyncState - - 同步数据状态类型

    V2NIMLoginListener

    登录相关监听器。

    Andoroid
    javapublic interface V2NIMLoginListener {
    
        void onLoginStatus(V2NIMLoginStatus status);
    
        void onLoginFailed(V2NIMError error);
    
        void onKickedOffline(V2NIMKickedOfflineDetail detail);
    
        void onLoginClientChanged(V2NIMLoginClientChange change, List<V2NIMLoginClient> clients);
    }
    
    iOS
    objective-c@protocol V2NIMLoginListener <NSObject>
    
    @optional
    
    - (void)onLoginStatus:(V2NIMLoginStatus)status;
    
    - (void)onLoginFailed:(V2NIMError *)error;
    
    - (void)onKickedOffline:(V2NIMKickedOfflineDetail *)detail;
    
    - (void)onLoginClientChanged:(V2NIMLoginClientChange)change
                         clients:(nullable NSArray<V2NIMLoginClient *> *)clients;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMLoginListener {
        nstd::function<void(V2NIMLoginStatus)> onLoginStatus;
        nstd::function<void(V2NIMError)> onLoginFailed;
        nstd::function<void(V2NIMKickedOfflineDetail)> onKickedOffline;
        nstd::function<void(V2NIMLoginClientChange, nstd::vector<V2NIMLoginClient>)> onLoginClientChanged;
        /// @internal
        bool operator==(const V2NIMLoginListener& other) const {
            return onLoginStatus == other.onLoginStatus && onLoginFailed == other.onLoginFailed && onKickedOffline == other.onKickedOffline &&
                   onLoginClientChanged == other.onLoginClientChanged;
        }
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMLoginListener = {
    
      onLoginStatus: [status: V2NIMLoginStatus]
      onLoginFailed: [error: V2NIMError]
      onKickedOffline: [detail: V2NIMKickedOfflineDetail]
      onLoginClientChanged: [change: V2NIMLoginClientChange, clients: V2NIMLoginClient[]]
      onConnectStatus: [status: V2NIMConnectStatus]
      onDisconnected: [error: V2NIMError]
      onConnectFailed: [error: V2NIMError]
      onDataSync: [type: V2NIMDataSyncType, state: V2NIMDataSyncState, error?: V2NIMError]
    }
    
    Harmony
    typescriptexport interface V2NIMLoginListener extends NIMEBaseListener {
    
      onLoginStatus: [status: V2NIMLoginStatus]
      onLoginFailed: [error: V2NIMError]
      onKickedOffline: [detail: V2NIMKickedOfflineDetail]
      onLoginClientChanged: [change: V2NIMLoginClientChange, clients: V2NIMLoginClient[]]
      onConnectStatus: [status: V2NIMConnectStatus]
      onDisconnected: [error: V2NIMError]
      onConnectFailed: [error: V2NIMError]
      onDataSync: [type: V2NIMDataSyncType, state: V2NIMDataSyncState, error?: V2NIMError]
    }
    

    成员函数

    • onLoginStatus

      登录状态变化回调。

      参数名称 类型 描述
      status V2NIMLoginStatus 登录状态
    • onLoginFailed

      登录失败回调。

      参数名称 类型 描述
      error V2NIMError 登录失败错误码及错误信息
    • onKickedOffline

      客户端被踢回调。

      参数名称 类型 描述
      detail V2NIMKickedOfflineDetail 客户端被踢详细信息
    • onLoginClientChanged

      多端登录时,其他在线客户端登录状态变化回调。

      参数名称 类型 描述
      change V2NIMLoginClientChange 其他客户端登录状态变更原因
      clients List<V2NIMLoginClient> 其他客户端登录状态变更具体信息

    V2NIMLoginDetailListener

    登录连接状态监听器。

    Andoroid
    javapublic interface V2NIMLoginDetailListener {
    
        void onConnectStatus(V2NIMConnectStatus status);
    
        void onDisconnected(V2NIMError error);
    
        void onConnectFailed(V2NIMError error);
    
        void onDataSync(V2NIMDataSyncType type, V2NIMDataSyncState state, V2NIMError error);
    }
    
    iOS
    objective-c@protocol V2NIMLoginDetailListener <NSObject>
    
    @optional
    
    - (void)onConnectStatus:(V2NIMConnectStatus)status;
    
    - (void)onDisconnected:(nullable V2NIMError *)error;
    
    - (void)onConnectFailed:(nullable V2NIMError *)error;
    
    - (void)onDataSync:(V2NIMDataSyncType)type
                 state:(V2NIMDataSyncState)state
                 error:(nullable V2NIMError *)error;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMLoginDetailListener {
        nstd::function<void(V2NIMConnectStatus)> onConnectStatus;
        nstd::function<void(nstd::optional<V2NIMError>)> onDisconnected;
        nstd::function<void(V2NIMError)> onConnectFailed;
        nstd::function<void(V2NIMDataSyncType, V2NIMDataSyncState, nstd::optional<V2NIMError>)> onDataSync;
        bool operator==(const V2NIMLoginDetailListener& other) const {
            return onConnectStatus == other.onConnectStatus && onDisconnected == other.onDisconnected && onConnectFailed == other.onConnectFailed &&
                   onDataSync == other.onDataSync;
        }
    };
    
    Web/uni-app/小程序

    web 端不区分 detail 事件,所以上文的 V2NIMLoginListener 包含 detail 相关的事件

    Harmony

    Harmony 不区分 detail 事件,所以上文的 V2NIMLoginListener 包含 detail 相关的事件

    成员函数

    • onConnectStatus

      登录连接状态变化回调。

      参数名称 类型 描述
      status V2NIMConnectStatus 登录连接状态
    • onDisconnected

      登录连接断开回调。

      参数名称 类型 描述
      error V2NIMError 登录连接断开错误码及错误信息
    • onConnectFailed

      登录连接失败回调。

      参数名称 类型 描述
      error V2NIMError 登录连接失败错误码及错误信息
    • onDataSync

      数据同步状态变化回调。

      参数名称 类型 描述
      type V2NIMDataSyncType 数据同步类型
      state V2NIMDataSyncState 数据同步状态
      error V2NIMError 数据同步失败错误码及错误信息

    V2NIMConversationOption

    会话查询选项。

    Andoroid
    javapublic class V2NIMConversationOption {
        private List<V2NIMConversationType> conversationTypes = null;
        private boolean onlyUnread = false;
        private List<String> conversationGroupIds = null;
    
        public V2NIMConversationOption() {}
    
        public V2NIMConversationOption(List<V2NIMConversationType> conversationTypes) {
            this.conversationTypes = conversationTypes;
        }
    
        public V2NIMConversationOption(List<V2NIMConversationType> conversationTypes, boolean onlyUnread) {
            this.conversationTypes = conversationTypes;
            this.onlyUnread = onlyUnread;
        }
    }
        public V2NIMConversationOption(List<V2NIMConversationType> conversationTypes, boolean onlyUnread, List<String> conversationGroupIds) {
            this.conversationTypes = conversationTypes;
            this.onlyUnread = onlyUnread;
            this.conversationGroupIds = conversationGroupIds;
        }
    
        public List<V2NIMConversationType> getConversationTypes() {
            return conversationTypes;
        }
    
        public void setConversationTypes(List<V2NIMConversationType> conversationTypes) {
            this.conversationTypes = conversationTypes;
        }
    
        public boolean isOnlyUnread() {
            return onlyUnread;
        }
    
        public void setOnlyUnread(boolean onlyUnread) {
            this.onlyUnread = onlyUnread;
        }
    
        public List<String> getConversationGroupIds() {
            return conversationGroupIds;
        }
    
        public void setConversationGroupIds(List<String> conversationGroupIds) {
            this.conversationGroupIds = conversationGroupIds;
        }
    
        public void setOnlyUnread(boolean onlyUnread) {
            this.onlyUnread = onlyUnread;
        }
    
        public List<String> getConversationGroupIds() {
            return conversationGroupIds;
        }
    
        @Override
        public String toString() {
            return "V2NIMConversationOption{" +
                    "conversationTypes=" + conversationTypes +
                    ", onlyUnread=" + onlyUnread +
                    ", conversationGroupIds=" + conversationGroupIds +
                    '}';
        }
    }
    
    iOS
    objective-c@interface V2NIMConversationOption : NSObject
    
    @property(nullable,nonatomic,copy,readwrite) NSArray<NSNumber *> *conversationTypes;
    
    @property(nonatomic,assign,readwrite) BOOL onlyUnread;
    
    @property(nullable,nonatomic,copy,readwrite) NSArray<NSString *> *conversationGroupIds;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMConversationOption {
        nstd::vector<V2NIMConversationType> conversationTypes;
        nstd::optional<nstd::vector<nstd::string>> conversationGroupIds;
        bool onlyUnread{false};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMConversationOption = {
      conversationTypes?: V2NIMConversationType[]
      onlyUnread?: boolean
      conversationGroupIds?: string[]
    }
    
    Harmony
    typescriptexport interface V2NIMConversationOption {
      conversationTypes?: V2NIMConversationType[]
      onlyUnread?: boolean
      conversationGroupIds?: string[]
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    conversationTypes List<V2NIMConversationType> [] 或 null 会话类型,null 表示不限制会话类型
    onlyUnread Bool false 是否仅查询未读会话:
  • true:仅查询未读会话
  • false:查询所有会话
  • conversationGroupIds Optional<List> null 会话分组 ID 列表。null 表示查询所有会话分组,empty 表示查询未添加到会话分组的会话。

    V2NIMConversationResult

    会话查询结果。

    Andoroid
    javapublic interface V2NIMConversationResult extends Serializable {
        long getOffset();
    
        boolean isFinished();
    
        List<V2NIMConversation> getConversationList();
    }
    
    iOS
    objective-c@interface V2NIMConversationResult : NSObject
    
    @property(nonatomic,assign,readonly) long long cursor;
    
    @property(nonatomic,assign,readonly) BOOL finished;
    
    @property(nullable,nonatomic,copy,readonly) NSArray<V2NIMConversation *> *conversationList;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMConversationResult {
        uint64_t offset{0};
        bool finished{false};
        V2NIMConversationList conversationList;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMConversationResult = {
      offset: number
      finished: boolean
      conversationList: V2NIMConversation[]
    }
    
    Harmony
    typescriptexport interface V2NIMConversationResult {
      offset: number
      finished: boolean
      conversationList: V2NIMConversation[]
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    offset long 分页偏移
    finished Bool 数据是否获取完毕:
  • true:获取完毕
  • false:未获取完毕,需要继续调用方法获取。
  • conversationList List<V2NIMConversation> 会话对象列表

    V2NIMConversation

    会话对象。

    Andoroid
    javapublic interface V2NIMConversation extends Serializable {
    
        String getConversationId();
    
        V2NIMConversationType getType();
    
        String getName();
    
        String getAvatar();
    
        boolean isMute();
    
        boolean isStickTop();
    
        List<String> getGroupIds();
    
        String getLocalExtension();
    
        String getServerExtension();
    
        V2NIMMessage getLastMessage();
    
        int getUnreadCount();
    
        long getOrder();
    
        long getCreateTime();
    
        long getUpdateTime();
    
    }
    
    iOS
    objective-c@interface V2NIMConversation : NSObject <NSCopying>
    
    @property(nonatomic,copy,readonly) NSString *conversationId;
    
    @property(nonatomic,assign,readonly) V2NIMConversationType type;
    
    @property(nullable,nonatomic,copy,readonly) NSString *name;
    
    @property(nullable,nonatomic,copy,readonly) NSString *avatar;
    
    @property(nonatomic,assign,readonly) BOOL mute;
    
    @property(nonatomic,assign,readonly) BOOL stickTop;
    
    @property(nullable,nonatomic,copy,readonly) NSArray<NSString *> *grpupIds;
    
    @property(nullable,nonatomic,copy,readonly) NSString *localExtension;
    
    @property(nullable,nonatomic,copy,readonly) NSString *serverExtension;
    
    @property(nullable,nonatomic,copy,readonly) V2NIMMessage *lastMessage;
    
    @property(nonatomic,assign,readonly) NSInteger unreadCount;
    
    @property(nonatomic,assign,readonly) NSTimeInterval orderTime;
    
    @property(nonatomic,assign,readonly) NSTimeInterval createTime;
    
    @property(nonatomic,assign,readonly) NSTimeInterval updateTime;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMConversation {
        nstd::string conversationId;
        V2NIMConversationType type{V2NIM_CONVERSATION_TYPE_UNKNOWN};
        nstd::optional<nstd::string> name;
        nstd::optional<nstd::string> avatar;
        nstd::optional<bool> mute;
        bool stickTop{false};
        nstd::vector<nstd::string> groupIds;
        nstd::string localExtension;
        nstd::string serverExtension;
        V2NIMMessage lastMessage;
        uint32_t unreadCount{0};
        uint64_t sortOrder{0};
        uint64_t createTime{0};
        uint64_t updateTime{0};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMConversation = {
      conversationId: string
      type: V2NIMConversationType
      name?: string
      avatar?: string
      mute?: boolean
      stickTop: boolean
      groupIds?: string[]
      localExtension: string
      serverExtension: string
      lastMessage?: V2NIMMessage
      unreadCount: number
      sortOrder: number
      createTime: number
      updateTime: number
    }
    
    Harmony
    typescript/**
     * v2 会话结构
     */
    export interface V2NIMConversation {
    
      conversationId: string
      type: V2NIMConversationType
      name?: string
      avatar?: string
      mute?: boolean
      stickTop: boolean
      groupIds?: string[]
      localExtension?: string
      serverExtension: string
      lastMessage?: V2NIMLastMessage
      unreadCount: number
      sortOrder: number
      createTime: number
      updateTime: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 默认值 描述
    conversationId String - 会话 ID,通过调用 V2NIMConversationIdUtil 的对应函数创建。组成方式: 用户账号(accountId)|会话类型(V2NIMConversationType)|聊天对象账号(accountId)或群组 ID。
    type V2NIMConversationType V2NIM_CONVERSATION_TYPE_UNKNOWN 会话类型
    name String null 会话名称。
  • 如果会话类型为单聊,则为聊天对象的用户名(好友备注/用户名称/用户账号)。
  • 如果会话类型为群组或超大群,则为群组名(群组名称/群组 ID)。
  • avatar String null 会话头像。
  • 如果会话类型为单聊,则为聊天对象的头像。
  • 如果会话类型为群组或超大群,则为群组头像。
  • mute boolean null 会话是否为静音状态。
    stickTop boolean false 会话是否为置顶状态。
    groupIds List null 会话所属分组列表。
    localExtension String "" 会话本地扩展字段,不会多端同步。长度上限为 1024 字节。如果平台为 Web,该字段仅在当前实例生命周期内有效。
    serverExtension String "" 会话服务端扩展字段,多端同步。长度上限为 1024 字节。
    lastMessage V2NIMLastMessage null 会话中最后一条消息
    unreadCount int 0 会话消息未读数
    createTime long 0 会话创建时间戳(毫秒)
    updateTime long 0 会话更新时间戳(毫秒)
    sortOrder long 0 会话排序字段。默认将置顶会话排首位,如有多条置顶会话,则按其创建时间进行排序。

    V2NIMConversationFilter

    会话过滤器对象。

    Andoroid
    javapublic class V2NIMConversationFilter {
    
        private List<V2NIMConversationType> conversationTypes = null;
        private String conversationGroupId = null;
        private boolean ignoreMuted = false;
        private Set<V2NIMConversationType> conversationTypeSet = null;
    
        public V2NIMConversationFilter() {
        }
    
        public V2NIMConversationFilter(List<V2NIMConversationType> types) {
            this.conversationTypes = types;
            if (types != null) {
                this.conversationTypeSet = new HashSet<>(types);
            }
        }
    }
    
    public class V2NIMConversationFilter {
    
        private List<V2NIMConversationType> conversationTypes;
        private Set<V2NIMConversationType> conversationTypeSet;
        private String conversationGroupId;
        private boolean ignoreMuted;
    
        public V2NIMConversationFilter(List<V2NIMConversationType> types, String groupId) {
            this.conversationTypes = types;
            if (types != null) {
                this.conversationTypeSet = new HashSet<>(types);
            }
            this.conversationGroupId = groupId;
        }
    
        public V2NIMConversationFilter(List<V2NIMConversationType> types, String groupId, boolean ignoreMuted) {
            this.conversationTypes = types;
            if (types != null) {
                this.conversationTypeSet = new HashSet<>(types);
            }
            this.conversationGroupId = groupId;
            this.ignoreMuted = ignoreMuted;
        }
    
        public List<V2NIMConversationType> getConversationTypes() {
            return conversationTypes;
        }
    }
    
        public Set<V2NIMConversationType> getConversationTypeSet() {
            if(CollectionUtil.isNotEmpty(conversationTypes) && CollectionUtil.isEmpty(conversationTypeSet)) {
                conversationTypeSet = new HashSet<>(conversationTypes);
            }
            return conversationTypeSet;
        }
    
        public void setConversationTypes(List<V2NIMConversationType> conversationTypes) {
            this.conversationTypes = conversationTypes;
        }
    
        public String getConversationGroupId() {
            return conversationGroupId;
        }
    
        public void setConversationGroupId(String conversationGroupId) {
            this.conversationGroupId = conversationGroupId;
        }
    
        public boolean isIgnoreMuted() {
            return ignoreMuted;
        }
    
        public void setIgnoreMuted(boolean ignoreMuted) {
            this.ignoreMuted = ignoreMuted;
        }
    
        @Override
        public boolean equals(Object o) {
            if (this == o) {
                return true;
            }
            if (!(o instanceof V2NIMConversationFilter)) {
                return false;
            }
            V2NIMConversationFilter that = (V2NIMConversationFilter) o;
            return ignoreMuted == that.ignoreMuted && Objects.equals(conversationGroupId, that.conversationGroupId) && Objects.equals(getConversationTypeSet(), that.getConversationTypeSet());
        }
    
        @Override
        public int hashCode() {
            return Objects.hash(conversationGroupId, ignoreMuted, getConversationTypeSet());
        }
    
        @Override
        public String toString() {
            return "V2NIMConversationFilter{" +
                    "conversationTypes=" + conversationTypes +
                    ", conversationGroupId='" + conversationGroupId + '\'' +
                    ", ignoreMuted=" + ignoreMuted +
                    '}';
        }
    
        public boolean isValid() {
            return !CollectionUtil.isEmpty(conversationTypes) || !TextUtils.isEmpty(conversationGroupId) || ignoreMuted;
        }
    }
    
    iOS
    objective-c@interface V2NIMConversationFilter : NSObject <NSCopying>
    
    @property(nullable,nonatomic,copy,readwrite) NSArray<NSNumber *> *conversationTypes;
    
    @property(nullable,nonatomic,copy,readwrite) NSArray<NSString *> *conversationGroupIds;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMConversationFilter {
        nstd::set<V2NIMConversationType> conversationTypes;
        nstd::string conversationGroupId;
        bool ignoreMuted{false};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMConversationFilter = {
      conversationTypes?: V2NIMConversationType[]
      conversationGroupId?: string
      ignoreMuted?: boolean
    }
    
    Harmony
    typescriptexport interface V2NIMConversationFilter {
      conversationTypes?: V2NIMConversationType[]
      conversationGroupId?: string
      ignoreMuted?: boolean
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    conversationTypes List null 会话类型列表,null 表示不按照会话类型过滤。
    conversationGroupId String null 会话分组 ID,null 表示不按照会话 ID 过滤。
    ignoreMuted Bool false 是否过滤具有免打扰属性(mutetrue)的会话对象:
  • true:过滤免打扰的会话
  • false:不过滤免打扰的会话
  • V2NIMConversationOperationResult

    单条会话操作结果。

    Andoroid
    javapublic interface V2NIMConversationOperationResult {
        String getConversationId();
        V2NIMError getError();
    }
    
    macOS/Windows
    cppstruct V2NIMConversationOperationResult {
        nstd::string conversationId;
        V2NIMError error;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMConversationOperationResult = {
      conversationId: string
      error: V2NIMError
    }
    
    Harmony
    typescriptexport interface V2NIMConversationOperationResult {
      conversationId: string
      error: V2NIMError
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    conversationId String 操作失败的会话 ID。如果操作成功则为空。组成方式: 用户账号(accountId)|会话类型(V2NIMConversationType)|聊天对象账号(accountId)或群组 ID。
    error V2NIMError 操作失败的错误码和错误信息,如果操作成功,则为空。

    V2NIMConversationUpdate

    会话更新对象。

    Andoroid
    javapublic class V2NIMConversationUpdate {
        private String serverExtension;
    
        public V2NIMConversationUpdate() {
        }
    
        public V2NIMConversationUpdate(String serverExtension) {
            this.serverExtension = serverExtension;
        }
    
        public String getServerExtension() {
            return serverExtension;
        }
    
        public void setServerExtension(String serverExtension) {
            this.serverExtension = serverExtension;
        }
    }
    
    iOS
    objective-c@interface V2NIMConversationUpdate : NSObject
    
    @property(nullable,nonatomic,copy,readwrite) NSString *serverExtension;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMConversationUpdate {
        nstd::optional<nstd::string> serverExtension;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMConversationUpdate = {
      serverExtension?: string
    }
    
    Harmony
    typescriptexport interface V2NIMConversationUpdate {
      serverExtension?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    serverExtension String "" 服务端扩展字段,多端同步。长度上限为 1024 字节。

    V2NIMConversationListener

    会话相关监听器。

    调用 addConversationListener 注册会话监听后,当会话相关事件发生时,会返回对应回调。

    Andoroid
    javapublic interface V2NIMConversationListener {
        void onSyncStarted();
        void onSyncFinished();
        void onSyncFailed(V2NIMError error);
        void onConversationCreated(V2NIMConversation conversation);
        void onConversationDeleted(List<String> conversationIds);
        void onConversationChanged(List<V2NIMConversation> conversationList);
        void onTotalUnreadCountChanged(int unreadCount);
        void onUnreadCountChangedByFilter(V2NIMConversationFilter filter, int unreadCount);
    }
    
    iOS
    objective-c@protocol V2NIMConversationListener
    
    @optional
    
    - (void)onSyncStarted;
    
    - (void)onSyncFinished;
    
    - (void)onSyncFailed:(V2NIMError *)error;
    
    - (void)onConversationCreated:(V2NIMConversation *)conversation;
    
    - (void)onConversationDeleted:(NSArray<NSString *> *)conversationIds;
    
    - (void)onConversationChanged:(NSArray<V2NIMConversation *> *)conversations;
    
    - (void)onTotalUnreadCountChanged:(NSInteger)unreadCount;
    
    - (void)onUnreadCountChangedByFilter:(V2NIMConversationFilter *)filter
                             unreadCount:(NSInteger)unreadCount;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMConversationListener {
        nstd::function<void()> onSyncStarted;
        nstd::function<void()> onSyncFinished;
        nstd::function<void(V2NIMError error)> onSyncFailed;
        nstd::function<void(V2NIMConversation conversation)> onConversationCreated;
        nstd::function<void(nstd::string conversationId)> onConversationDeleted;
        nstd::function<void(V2NIMConversationList conversationList)> onConversationChanged;
        nstd::function<void(uint32_t unreadCount)> onTotalUnreadCountChanged;
        nstd::function<void(V2NIMConversationFilter filter, uint32_t unreadCount)> onUnreadCountChangedByFilter;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMConversationListener = {
      onSyncStarted: []
      onSyncFinished: []
      onSyncFailed: [error: V2NIMError]
      onConversationCreated: [conversation: V2NIMConversation]
      onConversationDeleted: [conversationIds: string[]]
      onConversationChanged: [conversationList: V2NIMConversation[]]
      onTotalUnreadCountChanged: [unreadCount: number]
      onUnreadCountChangedByFilter: [
        filter: V2NIMConversationFilter & {
          equals: (filter: V2NIMConversationFilter) => boolean
        },
        unreadCount: number
      ]
    }
    
    Harmony
    typescriptexport interface V2NIMConversationListener extends NIMEBaseListener {
      onSyncStarted: []
      onSyncFinished: []
      onSyncFailed: [error: V2NIMError]
      onConversationCreated: [conversation: V2NIMConversation]
      onConversationDeleted: [conversationIds: string[]]
      onConversationChanged: [conversationList: V2NIMConversation[]]
      onTotalUnreadCountChanged: [unreadCount: number]
      onUnreadCountChangedByFilter: [
        filter: V2NIMConversationUnreadCountChangedFilter,
        unreadCount: number
      ]
    }
    

    成员函数

    • onSyncStarted

      会话数据同步开始回调。

    • onSyncFinished

      会话数据同步结束回调。

      请在收到该回调之后进行会话相关操作,否则可能导致会话数据不完整。

    • onSyncFailed

      会话数据同步失败回调。

      如果在收到该回调之后进行会话相关操作,会话数据可能不完整。

      参数名称 类型 描述
      error V2NIMError 会话数据同步失败错误码及错误信息
    • onConversationCreated

      会话成功创建回调。
      当本地端或多端同步创建会话成功时会触发该回调。

      参数名称 类型 描述
      conversation V2NIMConversation 创建的会话对象。
    • onConversationDeleted

      主动删除会话回调。
      当本地端或多端同步删除会话成功时会触发该回调。

      参数名称 类型 描述
      conversation V2NIMConversation 删除的会话对象。
    • onConversationChanged

      会话变更回调。
      当本地端或多端同步置顶会话、设置会话免打扰、会话有新消息、主动更新会话成功时会触发该回调。

      参数名称 类型 描述
      conversationList List<V2NIMConversation> 变更的会话对象列表
    • onTotalUnreadCountChanged

      会话消息总未读数变更回调。

      参数名称 类型 描述
      unreadCount int 变更后的会话消息总未读数
    • onUnreadCountChangedByFilter

      会话过滤后的未读数变更回调。
      调用 subscribeUnreadCountByFilter 订阅监听后,当会话过滤后的未读数变化时会返回该回调。

      参数名称 类型 描述
      filter V2NIMConversationFilter 会话过滤对象
      unreadCount int 会话过滤后的消息未读数

    V2NIMConversationGroup

    会话分组对象。

    Andoroid
    javapublic interface V2NIMConversationGroup extends Serializable {
    
        String getGroupId();
    
        String getName();
    
        String getServerExtension();
    
        long getCreateTime();
    
        long getUpdateTime();
    
    }
    
    iOS
    objective-c@interface V2NIMConversationGroup : NSObject <NSCopying>
    
    @property(nullable,nonatomic,copy,readonly) NSString *groupId;
    
    @property(nullable,nonatomic,copy,readonly) NSString *name;
    
    @property(nullable,nonatomic,copy,readonly) NSString *serverExtension;
    
    @property(nonatomic,assign,readonly) NSTimeInterval createTime;
    
    @property(nonatomic,assign,readonly) NSTimeInterval updateTime;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMConversationGroup {
        nstd::string groupId;
        nstd::string name;
        nstd::optional<nstd::string> serverExtension;
        uint64_t createTime{0};
        uint64_t updateTime{0};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMConversationGroup = {
      groupId: string
      name: string
      serverExtension: string
      createTime: number
      updateTime: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    groupId String 会话分组 ID
    name String 会话分组名称
    serverExtension String 会话服务端扩展字段。必须为 JSON 格式封装,长度上限为 1024 字节,多端同步。
    createTime long 会话分组创建时间戳(毫秒)
    updateTime long 会话分组更新时间戳(毫秒)

    V2NIMConversationGroupResult

    会话分组操作结果对象。

    Andoroid
    javapublic interface V2NIMConversationGroupResult {
    
        V2NIMConversationGroup getGroup();
    
        List<V2NIMConversationOperationResult> getFailedList();
    }
    
    iOS
    objective-c@interface V2NIMConversationGroupResult : NSObject
    
    @property(nullable,nonatomic,copy,readonly) V2NIMConversationGroup *group;
    
    @property(nullable,nonatomic,copy,readonly) NSArray<V2NIMConversationOperationResult *> *failedList;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMConversationGroupResult {
        V2NIMConversationGroup group;
        nstd::vector<V2NIMConversationOperationResult> failedList;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMConversationGroupResult = {
      group: V2NIMConversationGroup
      failedList: V2NIMConversationOperationResult[]
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    group V2NIMConversationGroup 会话分组
    failedList List<V2NIMConversationOperationResult> 失败结果列表,包含操作失败的会话分组列表和错误信息。

    V2NIMConversationGroupListener

    会话分组相关监听器。

    调用 addConversationGroupListener 注册会话分组监听后,当会话分组相关事件发生时,会返回对应回调。

    Andoroid
    javapublic interface V2NIMConversationGroupListener {
        void onConversationGroupCreated(V2NIMConversationGroup conversationGroup, List<V2NIMConversation> conversations);
        void onConversationGroupDeleted(String groupId);
        void onConversationGroupChanged(V2NIMConversationGroup group);
        void onConversationsAddedToGroup(String groupId, List<V2NIMConversation> conversations);
        void onConversationsRemovedFromGroup(String groupId, List<String> conversationIds);
    }
    
    iOS
    objective-c@protocol V2NIMConversationGroupListener
    
    @optional
    
    - (void)onConversationGroupCreated:(V2NIMConversationGroup *)conversationGroup;
    
    - (void)onConversationGroupDeleted:(NSString *)groupId;
    
    - (void)onConversationGroupChanged:(V2NIMConversationGroup *)conversationGroup;
    
    - (void)onConversationsAddedToGroup:(NSString *)groupId
                          conversations:(NSArray<V2NIMConversation *> *)conversations;
    
    - (void)onConversationsRemovedFromGroup:(NSString *)groupId
                            conversationIds:(NSArray<NSString *> *)conversationIds;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMConversationGroupListener {
        nstd::function<void(V2NIMConversationGroup conversationGroup)> onConversationGroupCreated;
        nstd::function<void(nstd::string groupId)> onConversationGroupDeleted;
        nstd::function<void(V2NIMConversationGroup conversationGroup)> onConversationGroupChanged;
        nstd::function<void(nstd::string groupId, V2NIMConversationList conversationList)> onConversationsAddedToGroup;
        nstd::function<void(nstd::string groupId, nstd::vector<nstd::string> conversationIds)> onConversationsRemovedFromGroup;
    };
    

    成员函数

    • onConversationGroupCreated

      会话分组成功创建回调。 当本地端或多端同步创建会话分组成功时会触发该回调。

      参数名称 类型 描述
      conversationGroup V2NIMConversationGroup 创建的会话分组对象
    • onConversationGroupDeleted

      主动删除会话分组回调。 当本地端或多端同步删除会话分组成功时会触发该回调。

      参数名称 类型 描述
      groupId String 删除的会话分组 ID
    • onConversationGroupChanged

      会话分组变更回调。 当本地端或多端同步更新会话分组成功时会触发该回调。

      参数名称 类型 描述
      conversationGroup V2NIMConversationGroup 变更的会话分组对象
    • onConversationsAddedToGroup

      添加会话到会话分组回调。 当本地端或多端同步添加会话到分组成功时会触发该回调。

      参数名称 类型 描述
      groupId String 会话分组 ID
      conversations List<V2NIMConversation> 添加到分组的会话对象列表。
    • onConversationsRemovedFromGroup

      会话从分组移除回调。 当本地端或多端同步移除会话成功时会触发该回调。

      参数名称 类型 描述
      groupId String 会话分组 ID
      conversationIds List 移除的会话 ID 列表

    V2NIMConversationIdUtil

    会话 ID 构建工具。

    成员函数

    • p2pConversationId

      构造单聊会话 ID。

      参数名称 类型 描述
      accountId String 聊天对象账号
    • teamConversationId

      构造群聊(高级群)会话 ID。

      参数名称 类型 描述
      teamId String 高级群的群组 ID
    • superTeamConversationId

      构造群聊(超大群)会话 ID。

      参数名称 类型 描述
      superTeamId String 超大群的群组 ID
    • parseConversationType

      解析会话类型。提取拼接的中间段。

      参数名称 类型 描述
      conversationId String 会话 ID
    • parseConversationType

      解析会话类型。提取拼接的中间段。

      参数名称 类型 描述
      conversationId String 会话 ID

      返回值:V2NIMConversationType

    • parseConversationType

      解析会话目标账号。提取拼接的最后一段。

      参数名称 类型 描述
      conversationId String 会话 ID

      返回值:String targetId

    示例代码

    Andoroid
    javapublic final class V2NIMConversationIdUtil {
    
     /**
      * 生成会话id
      * @param targetId 目标id
      * @param type 会话类型
      * @return 会话id
      */
     public static String conversationId(String targetId, V2NIMConversationType type) {
      if(!SDKCache.isV2Api())
      {
       return null;
      }
      if (TextUtils.isEmpty(targetId) || type == null) {
       return null;
      }
      String account = SDKCacheUI.getAccount();
      if(TextUtils.isEmpty(account))
      {
       return null;
      }
      return String.format(Locale.ENGLISH,CONVERSATION_ID_FORMAT, account, type.getValue(), targetId);
     }
    
     public static String conversationId(String sessionId, SessionTypeEnum type) {
      switch (type){
       case P2P:
        return p2pConversationId(sessionId);
       case Team:
        return teamConversationId(sessionId);
       case SUPER_TEAM:
        return superTeamConversationId(sessionId);
       default:
        return null;
      }
     }
    
     /**
      * 生成p2p会话id
      * @param accountId 对方账号id
      * @return 会话id
      */
     public static String p2pConversationId(String accountId){
      return conversationId(accountId, V2NIMConversationType.V2NIM_CONVERSATION_TYPE_P2P);
     }
    
     /**
      * 生成team会话id
      * @param teamId 群id
      * @return 会话id
      */
     public static String teamConversationId(String teamId){
      return conversationId(teamId, V2NIMConversationType.V2NIM_CONVERSATION_TYPE_TEAM);
     }
    
     /**
      * 生成superTeam会话id
      * @param superTeamId 超大群id
      * @return 会话id
      */
     public static String superTeamConversationId(String superTeamId){
      return conversationId(superTeamId, V2NIMConversationType.V2NIM_CONVERSATION_TYPE_SUPER_TEAM);
     }
    
     /**
      * 根据会话id返回会话类型
      * @param conversationId 会话id
      * @return 会话类型
      */
     public static V2NIMConversationType conversationType(String conversationId) {
      if (TextUtils.isEmpty(conversationId)) {
       return V2NIMConversationType.V2NIM_CONVERSATION_TYPE_UNKNOWN;
      }
      String[] components = conversationId.split(CONVERSATION_ID_SPLIT);
      // 3 parts
      if (components.length != 3) {
       return V2NIMConversationType.V2NIM_CONVERSATION_TYPE_UNKNOWN;
      }
      // account and target
    
      if (TextUtils.isEmpty(components[0]) || TextUtils.isEmpty(components[2])) {
       return V2NIMConversationType.V2NIM_CONVERSATION_TYPE_UNKNOWN;
      }
      try {
       int type = Integer.parseInt(components[1]);
    
       return V2NIMConversationType.typeOfValue(type);
      }
      catch (Throwable e) {
       NimLog.e(TAG, "conversationType error, conversationId=" + conversationId + ", e=" + e.getMessage());
       return V2NIMConversationType.V2NIM_CONVERSATION_TYPE_UNKNOWN;
      }
     }
    
     /**
      * 根据会话id返回会话对应目标 ID(accountId、teamId、superTeamId)
      * @param conversationId 会话id
      * @return 会话目标id
      */
     public static String conversationTargetId(String conversationId) {
      if (TextUtils.isEmpty(conversationId)) {
       return null;
      }
      String[] components = conversationId.split(CONVERSATION_ID_SPLIT);
      // 3 parts
      if (components.length != 3) {
       return null;
      }
      // account and target
    
      if (TextUtils.isEmpty(components[0]) || TextUtils.isEmpty(components[2])) {
       return null;
      }
    
      return components[2];
     }
    
     /**
      * 会话id是否合法
      * @param conversationId 会话id
      * @return 是否合法 true:合法 false:不合法
      */
     public static boolean isConversationIdValid(String conversationId){
      if (TextUtils.isEmpty(conversationId)) {
       return false;
      }
      String[] components = conversationId.split(CONVERSATION_ID_SPLIT);
      // 3 parts
      if (components.length != 3) {
       return false;
      }
    
      String account = SDKCacheUI.getAccount();
      if(account != null && !account.equals(components[0]))
      {
       return false;
      }
    
      if(TextUtils.isEmpty(components[0]))
      {
       return false;
      }
    
      V2NIMConversationType type;
      try {
       int typeInt = Integer.parseInt(components[1]);
       type = V2NIMConversationType.typeOfValue(typeInt);
      }
      catch (NumberFormatException e) {
       return false;
      }
      if(type == V2NIMConversationType.V2NIM_CONVERSATION_TYPE_UNKNOWN)
      {
       return false;
      }
    
      if(TextUtils.isEmpty(components[2]))
      {
       return false;
      }
    
      return true;
    
     }
    
     @Nullable
     public static SessionTypeEnum sessionTypeV1(@Nullable V2NIMConversationType conversationType) {
      if (conversationType == null) {
       return null;
      }
      switch (conversationType) {
       case V2NIM_CONVERSATION_TYPE_P2P:
        return SessionTypeEnum.P2P;
       case V2NIM_CONVERSATION_TYPE_TEAM:
        return SessionTypeEnum.Team;
       case V2NIM_CONVERSATION_TYPE_SUPER_TEAM:
        return SessionTypeEnum.SUPER_TEAM;
       default:
        return SessionTypeEnum.None;
      }
     }
    }
    
    iOS
    objective-c@interface V2NIMConversationIdUtil : NSObject
    
    /**
     *  使用账号Id构造会话id
     *
     *  @param accountId 账号Id
     *  @return 返回会话id
     *  @discussion
     */
    + (nullable NSString *)p2pConversationId:(NSString *)accountId;
    /**
     *  使用群Id构造会话id
     *
     *  @param teamId 群Id
     *  @return 返回会话id
     *  @discussion
     */
    + (nullable NSString *)teamConversationId:(NSString *)teamId;
    /**
     *  使用群Id构造会话id(超大群)
     *
     *  @param teamId 群Id
     *  @return 返回会话id
     *  @discussion
     */
    + (nullable NSString *)superTeamConversationId:(NSString *)teamId;
    
    /**
     *  从会话id中获取会话类型
     *
     *  @param conversationId 会话id
     *  @return 返回会话类型
     *  @discussion
     */
    + (V2NIMConversationType)conversationType:(NSString *)conversationId;
    /**
     *  从会话id中获取会话对象id
     *
     *  @param conversationId 会话id
     *  @return 返回会话对象id
     *  @discussion
     */
    + (nullable NSString *)conversationTargetId:(NSString *)conversationId;
    
    @end
    
    macOS/Windows
    cppclass V2NIMConversationIdUtil {
    public:
        /// @brief 获取点对点会话ID
        /// @param accountId 账号ID
        /// @return nstd::string
        /// @par 示例代码
        /// @code
        /// auto conversationId = V2NIMConversationIdUtil::p2pConversationId("target_account_id");
        /// @endcode
        static nstd::string p2pConversationId(const nstd::string& accountId);
    
        /// @brief 获取群组会话ID
        /// @param teamId 群组ID
        /// @return nstd::string
        /// @par 示例代码
        /// @code
        /// auto conversationId = V2NIMConversationIdUtil::teamConversationId("team_id");
        /// @endcode
        static nstd::string teamConversationId(const nstd::string& teamId);
    
        /// @brief 获取超级群会话ID
        /// @param superTeamId 超级群ID
        /// @return nstd::string
        /// @par 示例代码
        /// @code
        /// auto conversationId = V2NIMConversationIdUtil::superTeamConversationId("super_team_id");
        /// @endcode
        static nstd::string superTeamConversationId(const nstd::string& superTeamId);
    
        /// @brief 获取会话ID对应的会话类型
        /// @param conversationId 会话ID
        /// @return V2NIMConversationType
        /// @par 示例代码
        /// @code
        /// auto conversationType = V2NIMConversationIdUtil::parseConversationType("conversation_id");
        /// @endcode
        static V2NIMConversationType parseConversationType(const nstd::string& conversationId);
    
        /// @brief 获取会话ID对应的目标ID
        /// @param conversationId 会话ID
        /// @return nstd::string
        /// @par 示例代码
        /// @code
        /// auto targetId = V2NIMConversationIdUtil::parseConversationTargetId("conversation_id");
        /// @endcode
        static nstd::string parseConversationTargetId(const nstd::string& conversationId);
    };
    
    Web/uni-app/小程序
    typescriptconst p2pConversationId = nim.V2NIMConversationIdUtil.p2pConversationId('ACCOUND_ID')
    const teamConversationId = nim.V2NIMConversationIdUtil.teamConversationId('TEAM_ID')
    const superTeamConversationId = nim.V2NIMConversationIdUtil.superTeamConversationId('SUPER_TEAM_ID')
    const conversationType = nim.V2NIMConversationIdUtil.parseConversationType('CONVERSATION_ID')
    const targetId = nim.V2NIMConversationIdUtil.parseConversationTargetId('CONVERSATION_ID')
    
    Harmony
    typescriptconst p2pConversationId = nim.conversationIdUtil.p2pConversationId('ACCOUND_ID')
    const teamConversationId = nim.conversationIdUtil.teamConversationId('TEAM_ID')
    const superTeamConversationId = nim.conversationIdUtil.superTeamConversationId('SUPER_TEAM_ID')
    const conversationType = nim.conversationIdUtil.parseConversationType('CONVERSATION_ID')
    const targetId = nim.conversationIdUtil.parseConversationTargetId('CONVERSATION_ID')
    

    V2NIMMessageListener

    消息相关监听器。

    Andoroid
    javapublic interface V2NIMMessageListener {
    
        void onSendMessage(V2NIMMessage message);
    
        void onReceiveMessages(List<V2NIMMessage> messages);
    
        void onReceiveP2PMessageReadReceipts(List<V2NIMP2PMessageReadReceipt> readReceipts);
    
        void onReceiveTeamMessageReadReceipts(List<V2NIMTeamMessageReadReceipt> readReceipts);
    
        void onMessageRevokeNotifications(List<V2NIMMessageRevokeNotification> revokeNotifications);
    
        void onMessagePinNotification(V2NIMMessagePinNotification pinNotification);
    
        void onMessageQuickCommentNotification(V2NIMMessageQuickCommentNotification quickCommentNotification);
    
        void onMessageDeletedNotifications(List<V2NIMMessageDeletedNotification> messageDeletedNotifications);
    
        void onClearHistoryNotifications(List<V2NIMClearHistoryNotification> clearHistoryNotifications);
    
    }
    
    iOS
    objective-c@protocol V2NIMMessageListener <NSObject>
    
    - (void)onSendMessage:(V2NIMMessage *)message;
    
    - (void)onReceiveMessages:(NSArray <V2NIMMessage *> *)messages;
    
    - (void)onReceiveP2PMessageReadReceipts:(NSArray <V2NIMP2PMessageReadReceipt *>*)readReceipts;
    
    - (void)onReceiveTeamMessageReadReceipts:(NSArray <V2NIMTeamMessageReadReceipt *>*)readReceipts;
    
    - (void)onMessageRevokeNotifications:(V2NIMMessageRevokeNotification *)revokeNotification;
    
    - (void)onMessagePinNotification:(V2NIMMessagePinNotification *)pinNotification;
    
    - (void)onMessageQuickCommentNotification:(V2NIMMessageQuickCommentNotification *)notification;
    
    - (void)onMessageDeletedNotifications:(NSArray<V2NIMMessageDeletedNotification *> *)messageDeletedNotification;
    
    - (void)onClearHistoryNotifications:(NSArray<V2NIMClearHistoryNotification *> *)clearHistoryNotification;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageListener {
        nstd::function<void(nstd::vector<V2NIMMessage> messages)> onReceiveMessages;
        nstd::function<void(nstd::vector<V2NIMP2PMessageReadReceipt> readReceipts)> onReceiveP2PMessageReadReceipts;
        nstd::function<void(nstd::vector<V2NIMTeamMessageReadReceipt> readReceipts)> onReceiveTeamMessageReadReceipts;
        nstd::function<void(nstd::vector<V2NIMMessageRevokeNotification> revokeNotifications)> onMessageRevokeNotifications;
        nstd::function<void(V2NIMMessagePinNotification pinNotification)> onMessagePinNotification;
        nstd::function<void(V2NIMMessageQuickCommentNotification quickCommentNotification)> onMessageQuickCommentNotification;
        nstd::function<void(nstd::vector<V2NIMMessageDeletedNotification> messageDeletedNotification)> onMessageDeletedNotifications;
        nstd::function<void(nstd::vector<V2NIMClearHistoryNotification> clearHistoryNotification)> onClearHistoryNotifications;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMMessageListener = {
    
      onSendMessage: [message: V2NIMMessage]
      onReceiveMessages: [messages: V2NIMMessage[]]
      onReceiveP2PMessageReadReceipts: [readReceipts: V2NIMP2PMessageReadReceipt[]]
      onReceiveTeamMessageReadReceipts: [readReceipts: V2NIMTeamMessageReadReceipt[]]
      onMessageRevokeNotifications: [notification: V2NIMMessageRevokeNotification[]]
      onMessageDeletedNotifications: [notification: V2NIMMessageDeletedNotification[]]
      onClearHistoryNotifications: [notification: V2NIMClearHistoryNotification[]]
      onMessagePinNotification: [notification: V2NIMMessagePinNotification]
      onMessageQuickCommentNotification: [notification: V2NIMMessageQuickCommentNotification]
    }
    
    Harmony
    typescriptexport type V2NIMMessageListener = {
      onReceiveMessages: [messages: V2NIMMessage[]]
      onReceiveP2PMessageReadReceipts: [readReceipts: V2NIMP2PMessageReadReceipt[]]
      onReceiveTeamMessageReadReceipts: [readReceipts: V2NIMTeamMessageReadReceipt[]]
      onMessageRevokeNotifications: [notification: V2NIMMessageRevokeNotification[]]
      onMessageDeletedNotifications: [notification: V2NIMMessageDeletedNotification[]]
      onClearHistoryNotifications: [notification: V2NIMClearHistoryNotification[]]
      onMessagePinNotification: [notification: V2NIMMessagePinNotification]
      onMessageQuickCommentNotification: [notification: V2NIMMessageQuickCommentNotification]
    }
    

    成员函数

    • onSendMessage

      本端发送消息状态回调,本端发送消息或插入消息成功后,SDK 会返回该回调。

      参数名称 类型 描述
      message V2NIMMessage 发送或插入的消息
    • onReceiveMessages

      消息接收回调,本端接收到发送方消息,或其他端同步的消息时会触发该回调。

      参数名称 类型 描述
      messages List<V2NIMMessage> 消息列表
    • onReceiveP2PMessageReadReceipts

      单聊消息已读回调。

      本端发送已读回执成功后,其他登录客户端和消息发送方均会收到该回调。

      参数名称 类型 描述
      readReceipts List<V2NIMP2PMessageReadReceipt> 单聊消息已读回执列表
    • onReceiveTeamMessageReadReceipts

      高级群消息已读回调。 本端发送已读回执成功后,其他登录客户端和消息发送方均会收到该回调。

      参数名称 类型 描述
      readReceipts List<V2NIMTeamMessageReadReceipt> 高级群消息已读回执列表
    • onMessageRevokeNotifications

      消息撤回通知回调。 本地端或多端同步撤回消息成功后,SDK 会返回该回调。

      参数名称 类型 描述
      readReceipts List<V2NIMMessageRevokeNotification> 消息撤回通知列表
    • onMessageQuickCommentNotification

      消息快捷评论操作通知回调。 本地端或多端同步添加或移除消息快捷评论成功后,消息发送方和消息接收方均会收到该回调。

      参数名称 类型 描述
      quickCommentNotification V2NIMMessageQuickCommentNotification 快捷评论通知列表
    • onMessagePinNotification

      Pin 消息状态变化通知回调。 本地端或多端同步 Pin 消息成功后,消息发送方和消息接收方均会收到该回调。

      参数名称 类型 描述
      pinNotification V2NIMMessagePinNotification Pin 消息状态变化通知列表
    • onMessageDeletedNotifications

      消息被删除回调。 本地端或多端同步删除消息成功后,SDK 会返回该回调。

      参数名称 类型 描述
      messageDeletedNotifications List<V2NIMMessageDeletedNotification> 消息删除通知列表
    • onClearHistoryNotifications

      会话历史消息清除回调。 本地端或多端同步清空会话内历史消息成功后,SDK 会返回该回调。

      参数名称 类型 描述
      clearHistoryNotifications List<V2NIMClearHistoryNotification> 会话历史消息清除通知列表

    V2NIMMessage

    单聊、群组会话内消息对象。

    Andoroid
    javapublic interface V2NIMMessage extends V2NIMMessageRefer, Serializable {
        String getMessageClientId();
    
        String getMessageServerId();
    
        long getCreateTime();
    
        String getSenderId();
    
        V2NIMConversationType getConversationType();
    
        String getReceiverId();
    
        V2NIMMessageType getMessageType();
    
        int getSubType();
    
        String getText();
    
        V2NIMMessageAttachment getAttachment();
    
        String getServerExtension();
    
        String getLocalExtension();
    
        String getCallbackExtension();
    
        V2NIMMessageConfig getMessageConfig();
    
        V2NIMMessagePushConfig getPushConfig();
    
        V2NIMMessageRouteConfig getRouteConfig();
    
        V2NIMMessageAntispamConfig getAntispamConfig();
    
        V2NIMMessageRobotConfig getRobotConfig();
    
        V2NIMMessageRefer getThreadRoot();
    
        V2NIMMessageRefer getThreadReply();
    
        String getConversationId();
    
        boolean isSelf();
    
        V2NIMMessageAttachmentUploadState getAttachmentUploadState();
    
        V2NIMMessageSendingState getSendingState();
    }
    
    iOS
    objective-c@interface V2NIMMessage : V2NIMMessageRefer <NSCopying>
    
    @property(nonatomic,assign,readonly) BOOL isSelf;
    
    @property(nonatomic,assign,readonly) V2NIMMessageAttachmentUploadState attachmentUploadState;
    
    @property(nonatomic,assign,readonly) V2NIMMessageSendingState sendingState;
    
    @property(nonatomic,assign) V2NIMMessageType messageType;
    
    @property(nonatomic,assign) NSInteger subType;
    
    @property(nullable,nonatomic,strong) NSString *text;
    
    @property(nullable,nonatomic,strong) V2NIMMessageAttachment *attachment;
    
    @property(nullable,nonatomic,strong) NSString *serverExtension;
    
    @property(nullable,nonatomic,strong) NSString *localExtension;
    
    @property(nullable,nonatomic,strong,readonly) V2NIMMessageConfig *messageConfig;
    
    @property(nullable,nonatomic,strong,readonly) V2NIMMessagePushConfig *pushConfig;
    
    @property(nullable,nonatomic,strong,readonly) V2NIMMessageRouteConfig *routeConfig;
    
    @property(nullable,nonatomic,strong,readonly) V2NIMMessageAntispamConfig *antispamConfig;
    
    @property(nullable,nonatomic,strong,readonly) V2NIMMessageRobotConfig *robotConfig;
    
    @property(nullable,nonatomic,strong,readwrite) V2NIMMessageRefer *threadRoot;
    
    @property(nullable,nonatomic,strong,readonly) V2NIMMessageRefer *threadReply;
    
    macOS/Windows
    cppstruct V2NIMMessage {
    
        nstd::string messageClientId;
    
        nstd::string messageServerId;
    
        uint64_t createTime{0};
    
        nstd::string senderId;
    
        nstd::string receiverId;
    
        V2NIMConversationType conversationType{V2NIM_CONVERSATION_TYPE_UNKNOWN};
    
        nstd::string conversationId;
    
        V2NIMMessageType messageType{V2NIM_MESSAGE_TYPE_TEXT};
    
        uint32_t subType{0};
    
        nstd::string text;
    
        nstd::shared_ptr<V2NIMMessageAttachment> attachment;
    
        nstd::optional<nstd::string> serverExtension;
    
        nstd::optional<nstd::string> localExtension;
    
        nstd::optional<nstd::string> callbackExtension;
    
        nstd::optional<V2NIMMessageSendingState> sendingState;
    
        nstd::optional<V2NIMMessageAttachmentUploadState> attachmentUploadState;
    
        V2NIMMessageConfig messageConfig;
    
        V2NIMMessagePushConfig pushConfig;
    
        V2NIMMessageRouteConfig routeConfig;
    
        V2NIMMessageAntispamConfig antispamConfig;
    
        V2NIMMessageRobotConfig robotConfig;
    
        nstd::optional<V2NIMMessageRefer> threadRoot;
    
        nstd::optional<V2NIMMessageRefer> threadReply;
    
        bool isSelf{false};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMMessage = {
    
      messageClientId: string  
      messageServerId: string
      createTime: number
      senderId: string
      receiverId: string
      conversationType: V2NIMConversationType
      conversationId: string
      isSelf: boolean
      sendingState: V2NIMMessageSendingState
      messageType: V2NIMMessageType
      subType?: number
      text?: string
      attachment?:
        | V2NIMMessageAttachment
        | Partial<V2NIMMessageFileAttachment>
        | Partial<V2NIMMessagImageAttachment>
        | Partial<V2NIMMessageAudioAttachment>
        | Partial<V2NIMMessageVideoAttachment>
        | Partial<V2NIMMessageLocationAttachment>
        | Partial<V2NIMMessageNotificationAttachment>
        | V2NIMMessageNotificationAttachment
      serverExtension?: string
      callbackExtension?: string
      messageConfig?: V2NIMMessageConfig
      pushConfig?: V2NIMMessagePushConfig
      routeConfig?: V2NIMMessageRouteConfig
      antispamConfig?: V2NIMMessageAntispamConfig
      robotConfig?: V2NIMMessageRobotConfig
      threadRoot?: V2NIMMessageRefer
      threadReply?: V2NIMMessageRefer
    }
    
    Harmony
    typescriptexport type V2NIMMessage = {
    
      messageClientId: string
      messageServerId: string
      createTime: number
      senderId: string
      receiverId: string
      conversationType: V2NIMConversationType
      conversationId: string
      isSelf: boolean
      sendingState: V2NIMMessageSendingState
      messageType: V2NIMMessageType
      subType?: number
      text?: string
      attachment?:
        | V2NIMMessageAttachment
        | Partial<V2NIMMessageFileAttachment>
        | Partial<V2NIMMessagImageAttachment>
        | Partial<V2NIMMessageAudioAttachment>
        | Partial<V2NIMMessageVideoAttachment>
        | Partial<V2NIMMessageLocationAttachment>
        | Partial<V2NIMMessageNotificationAttachment>
        | V2NIMMessageNotificationAttachment
      serverExtension?: string
      callbackExtension?: string
      messageConfig?: V2NIMMessageConfig
      pushConfig?: V2NIMMessagePushConfig
      routeConfig?: V2NIMMessageRouteConfig
      antispamConfig?: V2NIMMessageAntispamConfig
      robotConfig?: V2NIMMessageRobotConfig
      threadRoot?: V2NIMMessageRefer
      threadReply?: V2NIMMessageRefer
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    messageClientId String 客户端消息 ID,消息在客户端生成的 UUID。不会多端同步。
    messageServerId String 服务器消息 ID,消息发送成功后服务器生成的 UUID。会多端同步。
    消息发送成功前只存在 messageClientId
    createTime long 消息时间戳,单位毫秒。
  • 消息发送成功前,该字段为消息发送者本地时间。
  • 消息发送成功后,该字段为服务器时间。
  • senderId String 消息发送方账号(accountId)
    receiverId String 消息接收方账号
  • 如果消息所属会话类型为单聊,该字段为聊天对象账号 accountId。
  • 如果消息所属会话类型为群组,该字段为群组 ID。
  • conversationType V2NIMConversationType 消息所属会话类型:单聊/高级群/超大群
    conversationId String 会话 ID,通过调用 V2NIMConversationIdUtil 的对应函数创建。组成方式:用户账号(accountId)|会话类型(V2NIMConversationType)|聊天对象账号(accountId)或群组 ID。
    isSelf boolean 消息发送方是否为本人
    attachmentUploadState V2NIMMessageAttachmentUploadState 消息附件上传状态
    sendingState V2NIMMessageSendingState 消息发送状态
    messageType V2NIMMessageType 消息类型
    subType int 自定义消息子类型,0 表示无消息子类型。
    text String 消息文本内容,仅文本类型的消息有该字段。
    attachment V2NIMMessageAttachment 消息附件,仅图片、语音、视频、文件类型消息有该字段。长度上限为 4096 字节。
    serverExtension String 消息服务端扩展字段。必须为 JSON 格式封装,长度上限为 2048 字节,多端同步。
    localExtension String 消息本地扩展字段,必须为 JSON 格式封装,不可多端同步。长度上限为 2048 字节。默认为空("")。
    callbackExtension String 第三方回调透传的自定义扩展字段,长度上限为 2048 字节。
    第三方回调功能需要在云信控制台开通
    messageConfig V2NIMMessageConfig 消息相关配置
    pushConfig V2NIMMessagePushConfig 第三方推送相关配置。
    第三方推送功能需要在云信控制台配置
    routeConfig V2NIMMessageRouteConfig 消息事件抄送相关配置。
    消息抄送功能需要在云信控制台开通
    antispamConfig V2NIMMessageAntispamConfig 反垃圾相关配置。
    反垃圾功能包括客户端反垃圾和安全通,均需要在云信控制台开通
    robotConfig V2NIMMessageRobotConfig 机器人相关配置。
    机器人功能需要在云信控制台配置
    threadRoot V2NIMMessageRefer 消息回复的根消息参考信息。
    消息回复功能需要在云信控制台开通
    threadReply V2NIMMessageRefer 消息回复的父消息参考信息。
    消息回复功能需要在云信控制台开通

    V2NIMMessageConfig

    消息相关配置。

    Andoroid
    javapublic class V2NIMMessageConfig implements Serializable {
    
        public boolean isReadReceiptEnabled() {
            return readReceiptEnabled;
        }
    
        public boolean isConversationUpdateEnabled() {
            return conversationUpdateEnabled;
        }
    
        public boolean isHistoryEnabled() {
            return historyEnabled;
        }
    
        public boolean isRoamingEnabled() {
            return roamingEnabled;
        }
    
        public boolean isOnlineSyncEnabled() {
            return onlineSyncEnabled;
        }
    
        public boolean isOfflineEnabled() {
            return offlineEnabled;
        }
    
        public boolean isUnreadEnabled() {
            return unreadEnabled;
        }
    
        @Override
        public String toString() {
            return "V2NIMMessageConfig{" +
                    "readReceiptEnabled=" + readReceiptEnabled +
                    ", conversationUpdateEnabled=" + conversationUpdateEnabled +
                    ", historyEnabled=" + historyEnabled +
                    ", roamingEnabled=" + roamingEnabled +
                    ", onlineSyncEnabled=" + onlineSyncEnabled +
                    ", offlineEnabled=" + offlineEnabled +
                    ", unreadEnabled=" + unreadEnabled +
                    '}';
        }
    
        public static final boolean DEFAULT_READ_RECEIPT_ENABLED = false;
        public static final boolean DEFAULT_CONVERSATION_UPDATE_ENABLED = true;
        public static final boolean DEFAULT_HISTORY_ENABLED = true;
        public static final boolean DEFAULT_ROAMING_ENABLED = true;
        public static final boolean DEFAULT_ONLINE_SYNC_ENABLED = true;
        public static final boolean DEFAULT_OFFLINE_ENABLED = true;
        public static final boolean DEFAULT_UNREAD_ENABLED = true;
    
        public static final class V2NIMMessageConfigBuilder {
    
            public static V2NIMMessageConfigBuilder builder() {
                return new V2NIMMessageConfigBuilder();
            }
    
            public V2NIMMessageConfigBuilder withReadReceiptEnabled(boolean readReceiptEnabled) {
                this.readReceiptEnabled = readReceiptEnabled;
                return this;
            }
    
            public V2NIMMessageConfigBuilder withConversationUpdateEnabled(boolean conversationUpdateEnabled) {
                this.conversationUpdateEnabled = conversationUpdateEnabled;
                return this;
            }
    
            public V2NIMMessageConfigBuilder withHistoryEnabled(boolean historyEnabled) {
                this.historyEnabled = historyEnabled;
                return this;
            }
    
            public V2NIMMessageConfigBuilder withRoamingEnabled(boolean roamingEnabled) {
                this.roamingEnabled = roamingEnabled;
                return this;
            }
    
            public V2NIMMessageConfigBuilder withOnlineSyncEnabled(boolean onlineSyncEnabled) {
                this.onlineSyncEnabled = onlineSyncEnabled;
                return this;
            }
    
            public V2NIMMessageConfigBuilder withOfflineEnabled(boolean offlineEnabled) {
                this.offlineEnabled = offlineEnabled;
                return this;
            }
    
            public V2NIMMessageConfigBuilder withUnreadEnabled(boolean unreadEnabled) {
                this.unreadEnabled = unreadEnabled;
                return this;
            }
    
            public V2NIMMessageConfig build() {
                return new V2NIMMessageConfig(readReceiptEnabled, conversationUpdateEnabled, historyEnabled, roamingEnabled, onlineSyncEnabled, offlineEnabled, unreadEnabled);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMMessageConfig : NSObject <NSCopying>
    
    @property(nonatomic,assign,readwrite) BOOL readReceiptEnabled;
    
    @property(nonatomic,assign,readwrite) BOOL conversationUpdateEnabled;
    
    @property(nonatomic,assign,readwrite) BOOL historyEnabled;
    
    @property(nonatomic,assign,readwrite) BOOL roamingEnabled;
    
    @property(nonatomic,assign,readwrite) BOOL onlineSyncEnabled;
    
    @property(nonatomic,assign,readwrite) BOOL offlineEnabled;
    
    @property(nonatomic,assign,readwrite) BOOL unreadEnabled;
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageConfig {
    
        bool readReceiptEnabled{false};
    
        bool conversationUpdateEnabled{true};
    
        bool historyEnabled{true};
    
        bool roamingEnabled{true};
    
        bool onlineSyncEnabled{true};
    
        bool offlineEnabled{true};
    
        bool unreadEnabled{true};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMMessageConfig = {
    
      readReceiptEnabled?: boolean
    
      conversationUpdateEnabled?: boolean
    
      historyEnabled?: boolean
    
      roamingEnabled?: boolean
    
      onlineSyncEnabled?: boolean
    
      offlineEnabled?: boolean
    
      unreadEnabled?: boolean
    }
    
    Harmony
    typescriptexport type V2NIMMessageConfig = {
    
      readReceiptEnabled?: boolean
      conversationUpdateEnabled?: boolean
      historyEnabled?: boolean
      roamingEnabled?: boolean
      onlineSyncEnabled?: boolean
      offlineEnabled?: boolean
      unreadEnabled?: boolean
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    readReceiptEnabled boolean false 是否需要消息已读回执信息
    conversationUpdateEnabled boolean true 是否需要更新消息所属的会话信息
    historyEnabled boolean true 是否需要在服务端保存历史消息
    roamingEnabled boolean true 是否需要保存漫游消息
    onlineSyncEnabled boolean true 是否需要发送方消息多端同步
    offlineEnabled boolean true 是否需要保存离线消息
    unreadEnabled boolean true 是否需要计入未读数

    V2NIMMessagePushConfig

    消息第三方推送相关配置。

    Andoroid
    javapublic class V2NIMMessagePushConfig implements Serializable {
    
        public boolean isPushEnabled() {
            return pushEnabled;
        }
    
        public boolean isPushNickEnabled() {
            return pushNickEnabled;
        }
    
        public String getPushContent() {
            return pushContent;
        }
    
        public String getPushPayload() {
            return pushPayload;
        }
    
        public boolean isForcePush() {
            return forcePush;
        }
    
        public String getForcePushContent() {
            return forcePushContent;
        }
    
        public List<String> getForcePushAccountIds() {
            return forcePushAccountIds;
        }
    
        @Override
        public String toString() {
            return "V2NIMMessagePushConfig{" +
                    "pushEnabled=" + pushEnabled +
                    ", pushNickEnabled=" + pushNickEnabled +
                    ", content='" + pushContent + '\'' +
                    ", payload='" + pushPayload + '\'' +
                    ", forcePush=" + forcePush +
                    ", forcePushContent='" + forcePushContent + '\'' +
                    ", forcePushAccountIds=" + forcePushAccountIds +
                    '}';
        }
    
        public static final boolean DEFAULT_PUSH_ENABLE = true;
        public static final boolean DEFAULT_PUSH_NICK_ENABLE = true;
    
        public static final class V2NIMMessagePushConfigBuilder {
    
            public static V2NIMMessagePushConfigBuilder builder() {
                return new V2NIMMessagePushConfigBuilder();
            }
    
            public V2NIMMessagePushConfigBuilder withPushEnabled(boolean pushEnabled) {
                this.pushEnabled = pushEnabled;
                return this;
            }
    
            public V2NIMMessagePushConfigBuilder withPushNickEnabled(boolean pushNickEnabled) {
                this.pushNickEnabled = pushNickEnabled;
                return this;
            }
    
            public V2NIMMessagePushConfigBuilder withContent(String content) {
                this.content = content;
                return this;
            }
    
            public V2NIMMessagePushConfigBuilder withPayload(String payload) {
                this.payload = payload;
                return this;
            }
    
            public V2NIMMessagePushConfigBuilder withForcePush(boolean forcePush) {
                this.forcePush = forcePush;
                return this;
            }
    
            public V2NIMMessagePushConfigBuilder withForcePushContent(String forcePushContent) {
                this.forcePushContent = forcePushContent;
                return this;
            }
    
            public V2NIMMessagePushConfigBuilder withForcePushAccountIds(List<String> forcePushAccountIds) {
                this.forcePushAccountIds = forcePushAccountIds;
                return this;
            }
    
            public V2NIMMessagePushConfig build() {
                return new V2NIMMessagePushConfig(pushEnabled, pushNickEnabled, content, payload, forcePush, forcePushContent, forcePushAccountIds);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMMessagePushConfig : NSObject <NSCopying>
    
    @property(nonatomic,assign,readwrite) BOOL pushEnabled;
    
    @property(nonatomic,assign,readwrite) BOOL pushNickEnabled;
    
    @property(nullable,nonatomic,strong,readwrite) NSString *pushContent;
    
    @property(nullable,nonatomic,strong,readwrite) NSString *pushPayload;
    
    @property(nonatomic,assign,readwrite) BOOL forcePush;
    
    @property(nullable,nonatomic,strong,readwrite) NSString *forcePushContent;
    
    @property(nullable,nonatomic,strong,readwrite) NSArray<NSString *> *forcePushAccountIds;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMMessagePushConfig {
    
        bool pushEnabled{true};
    
        bool pushNickEnabled{true};
    
        nstd::string pushContent;
    
        nstd::string pushPayload;
    
        bool forcePush{false};
    
        nstd::string forcePushContent;
    
        nstd::vector<nstd::string> forcePushAccountIds;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessagePushConfig {
    
      pushEnabled?: boolean
    
      pushNickEnabled?: boolean
    
      pushContent?: string
    
      pushPayload?: string
    
      forcePush?: boolean
    
      forcePushContent?: string
    
      forcePushAccountIds?: string[]
    }
    
    Harmony
    typescriptexport interface V2NIMMessagePushConfig {
    
      pushEnabled?: boolean
      pushNickEnabled?: boolean
      pushContent?: string
      pushPayload?: string
      forcePush?: boolean
      forcePushContent?: string
      forcePushAccountIds?: string[]
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    pushEnabled boolean true 是否需要推送消息
    pushNickEnabled boolean true 是否需要推送消息发送方昵称
    pushContent String pushEnabled 为 true 则为必填 - 推送文案
    pushPayload String 如果 pushEnabled 为 true 则为必填 - 推送 Payload
    forcePush boolean false 是否忽略用户消息提醒相关设置,强制推送。该字段仅对群消息有效。
    forcePushContent String forcePush 为 true 则为必填 - 强制推送文案
    forcePushAccountIds List forcePush 为 true 则为必填 - 强制推送目标账号列表

    V2NIMMessageRouteConfig

    消息事件抄送相关配置。

    Andoroid
    javapublic class V2NIMMessageRouteConfig implements Serializable {
    
        public boolean isRouteEnabled() {
            return routeEnabled;
        }
    
        public String getRouteEnvironment() {
            return routeEnvironment;
        }
    
        @Override
        public String toString() {
            return "V2NIMMessageRouteConfig{" +
                    "routeEnabled=" + routeEnabled +
                    ", routeEnvironment='" + routeEnvironment + '\'' +
                    '}';
        }
    
        public static final boolean DEFAULT_ROUTE_ENABLE = true;
    
        public static final class V2NIMMessageRouteConfigBuilder {
    
            public static V2NIMMessageRouteConfigBuilder builder() {
                return new V2NIMMessageRouteConfigBuilder();
            }
    
            public V2NIMMessageRouteConfigBuilder withRouteEnabled(boolean routeEnabled) {
                this.routeEnabled = routeEnabled;
                return this;
            }
    
            public V2NIMMessageRouteConfigBuilder withRouteEnvironment(String routeEnvironment) {
                this.routeEnvironment = routeEnvironment;
                return this;
            }
    
            public V2NIMMessageRouteConfig build() {
                return new V2NIMMessageRouteConfig(routeEnabled, routeEnvironment);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMMessageRouteConfig : NSObject <NSCopying>
    
    @property(nonatomic,assign,readwrite) BOOL routeEnabled;
    
    @property(nullable,nonatomic,strong,readwrite) NSString *routeEnvironment;
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageRouteConfig {
    
        bool routeEnabled{true};
    
        nstd::optional<nstd::string> routeEnvironment;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageRouteConfig {
    
      routeEnabled?: boolean
    
      routeEnvironment?: string
    }
    
    Harmony
    typescriptexport interface V2NIMMessageRouteConfig {
    
      routeEnabled?: boolean
      routeEnvironment?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    routeEnabled boolean true 是否需要消息事件抄送
    routeEnvironment String routeEnabled 为 true 则为必填 - 环境变量,用于指向不同消息事件抄送、第三方回调等配置

    V2NIMMessageAntispamConfig

    消息反垃圾配置,包括客户端本地反垃圾和安全通的相关配置。

    Andoroid
    javapublic class V2NIMMessageAntispamConfig implements Serializable {
    
        public boolean isAntispamEnabled() {
            return antispamEnabled;
        }
    
        public String getAntispamBusinessId() {
            return antispamBusinessId;
        }
    
        public String getAntispamCustomMessage() {
            return antispamCustomMessage;
        }
    
        public String getAntispamCheating() {
            return antispamCheating;
        }
    
        public String getAntispamExtension() {
            return antispamExtension;
        }
    
        @Override
        public String toString() {
            return "V2NIMMessageAntispamConfig{" +
                    "antispamEnabled=" + antispamEnabled +
                    ", antispamBusinessId='" + antispamBusinessId + '\'' +
                    ", antispamCustomMessage='" + antispamCustomMessage + '\'' +
                    ", antispamCheating='" + antispamCheating + '\'' +
                    ", antispamExtension='" + antispamExtension + '\'' +
                    '}';
        }
    
    
        public static final class V2NIMMessageAntispamConfigBuilder {
            private boolean antispamEnabled = DEFAULT_ANTISPAM_ENABLED;
            private String antispamBusinessId;
            private String antispamCustomMessage;
            private String antispamCheating;
            private String antispamExtension;
    
            public static V2NIMMessageAntispamConfigBuilder builder() {
                return new V2NIMMessageAntispamConfigBuilder();
            }
    
            public V2NIMMessageAntispamConfigBuilder withAntispamEnabled(boolean antispamEnabled) {
                this.antispamEnabled = antispamEnabled;
                return this;
            }
    
            public V2NIMMessageAntispamConfigBuilder withAntispamBusinessId(String antispamBusinessId) {
                this.antispamBusinessId = antispamBusinessId;
                return this;
            }
    
            public V2NIMMessageAntispamConfigBuilder withAntispamCustomMessage(String antispamCustomMessage) {
                this.antispamCustomMessage = antispamCustomMessage;
                return this;
            }
    
            public V2NIMMessageAntispamConfigBuilder withAntispamCheating(String antispamCheating) {
                this.antispamCheating = antispamCheating;
                return this;
            }
    
            public V2NIMMessageAntispamConfigBuilder withAntispamExtension(String antispamExtension) {
                this.antispamExtension = antispamExtension;
                return this;
            }
    
            public V2NIMMessageAntispamConfig build() {
                return new V2NIMMessageAntispamConfig(antispamEnabled, antispamBusinessId, antispamCustomMessage, antispamCheating, antispamExtension);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMMessageAntispamConfig : NSObject <NSCopying>
    
    @property(nonatomic, assign, readwrite) BOOL antispamEnabled;
    
    @property(nullable,nonatomic,strong,readwrite) NSString *antispamBusinessId;
    
    @property(nullable,nonatomic,strong,readwrite) NSString *antispamCustomMessage;
    
    @property(nullable,nonatomic,strong,readwrite) NSString *antispamCheating;
    
    @property(nullable,nonatomic,strong,readwrite) NSString *antispamExtension;
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageAntispamConfig {
    
        nstd::optional<bool> antispamEnabled;
    
        nstd::optional<nstd::string> antispamBusinessId;
    
        nstd::optional<nstd::string> antispamCustomMessage;
    
        nstd::optional<nstd::string> antispamCheating;
    
        nstd::optional<nstd::string> antispamExtension;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageAntispamConfig {
    
      antispamEnabled?: boolean
    
      antispamBusinessId?: string
    
      antispamCustomMessage?: string
    
      antispamCheating?: string
    
      antispamExtension?: string
    }
    
    Harmony
    typescriptexport interface V2NIMMessageAntispamConfig {
    
      antispamEnabled?: boolean
      antispamBusinessId?: string
      antispamCustomMessage?: string
      antispamCheating?: string
      antispamExtension?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    clientAntispamEnabled boolean false 是否启用本地反垃圾。
  • 仅对文本消息生效
  • 如果开启本地发垃圾,发送消息时会进行本地反垃圾检测,完成后返回检测结果 V2NIMClientAntispamOperatorType
    • 0:检测通过,可以发送该消息。
    • 1:发送替换后的文本消息。
    • 2:检测不通过,消息发送失败,返回本地错误码。
    • 3:消息发送后,由服务端拦截
  • shield String clientAntispamEnabled 为 true,且检测结果为 1 时必填 - 本地反垃圾命中后替换的文本
    antispamEnabled boolean true 是否对该消息启用安全通检测。
    antispamBusinessId String antispamEnabled 为 true 时必填 - 易盾业务 ID
    antispamCustomMessage String antispamEnabled 为 true 时必填 - 自定义消息中需要反垃圾的内容,必须是 JSON 格式,长度不超过 5000 字节。格式如下 { "type": 1, //1:文本,2:图片,3视频 "data": "" //文本内容or图片地址or视频地址 }
    antispamCheating String antispamEnabled 为 true 时必填 - 易盾反作弊(辅助检测数据),必须为 JSON 格式,长度上限为 1024字节。
    antispamExtension String antispamEnabled 为 true 时必填 - 易盾反垃圾(增强检测数据),必须为 JSON 格式,长度上限为 1024字节。

    V2NIMMessageRobotConfig

    消息机器人相关配置

    Andoroid
    javapublic class V2NIMMessageRobotConfig implements Serializable {
    
        public String getAccountId() {
            return accountId;
        }
    
        public String getTopic() {
            return topic;
        }
    
        public String getFunction() {
            return function;
        }
    
        public String getCustomContent() {
            return customContent;
        }
    
        @Override
        public String toString() {
            return "V2NIMMessageRobotConfig{" +
                    "accountId='" + accountId + '\'' +
                    ", topic='" + topic + '\'' +
                    ", function='" + function + '\'' +
                    ", customContent='" + customContent + '\'' +
                    '}';
        }
    
        public static final class V2NIMMessageRobotConfigBuilder {
    
            public static V2NIMMessageRobotConfigBuilder builder() {
                return new V2NIMMessageRobotConfigBuilder();
            }
    
            public V2NIMMessageRobotConfigBuilder withAccountId(String accountId) {
                this.accountId = accountId;
                return this;
            }
    
            public V2NIMMessageRobotConfigBuilder withTopic(String topic) {
                this.topic = topic;
                return this;
            }
    
            public V2NIMMessageRobotConfigBuilder withFunction(String function) {
                this.function = function;
                return this;
            }
    
            public V2NIMMessageRobotConfigBuilder withCustomContent(String customContent) {
                this.customContent = customContent;
                return this;
            }
    
            public V2NIMMessageRobotConfig build() {
                return new V2NIMMessageRobotConfig(accountId, topic, function, customContent);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMMessageRobotConfig : NSObject<NSCopying>
    
    @property(nullable,nonatomic,strong,readwrite) NSString *accountId;
    
    @property(nullable,nonatomic,strong,readwrite) NSString *topic;
    
    @property(nullable,nonatomic,strong,readwrite) NSString *function;
    
    @property(nullable,nonatomic,strong,readwrite) NSString *customContent;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageRobotConfig {
    
        nstd::optional<nstd::string> accountId;
    
        nstd::optional<nstd::string> topic;
    
        nstd::optional<nstd::string> function;
    
        nstd::optional<nstd::string> customContent;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageRobotConfig {
    
      accountId?: string
    
      topic?: string
    
      function?: string
    
      customContent?: string
    }
    
    Harmony
    typescriptexport interface V2NIMMessageRobotConfig {
    
      accountId?: string
      topic?: string
      function?: string
      customContent?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    accountId String - 机器人账号,必须与在云信控制台配置的机器人 account 一致。
    该字段仅对群组消息有效。
    topic String - 机器人消息话题
    function String - 机器人具体功能
    customContent String - 机器人自定义内容

    V2NIMLastMessage

    会话最后一条消息。包含以下场景:

    • 发送的最后一条消息
    • 接受的最后一条消息
    • 插入的最后一条消息
    • 撤回消息的通知
    Andoroid
    javapublic interface V2NIMLastMessage extends Serializable {
    
        V2NIMLastMessageState getLastMessageState();
    
        V2NIMMessageRefer getMessageRefer();
    
        V2NIMMessageType getMessageType();
    
        int getSubType();
    
        V2NIMMessageSendingState getSendingState();
    
        String getText();
    
        V2NIMMessageAttachment getAttachment();
    
        String getRevokeAccountId();
    
        V2NIMMessageRevokeType getRevokeType();
    
        String getServerExtension();
    
        String getCallbackExtension();
    
        String getSenderName();
        
    }
    
    
    iOS
    objective-c@interface V2NIMLastMessage : NSObject <NSCopying>
    
    @property(nonatomic,assign,readonly) V2NIMLastMessageState lastMessageState;
    
    @property(nonatomic,strong,readonly) V2NIMMessageRefer *messageRefer;
    
    @property(nonatomic,assign,readonly) V2NIMMessageType messageType;
    
    @property(nonatomic,assign,readonly) NSInteger subType;
    
    @property(nonatomic,assign,readonly) V2NIMMessageSendingState sendingState;
    
    @property(nullable,nonatomic,strong,readonly) NSString *text;
    
    @property(nullable,nonatomic,strong,readonly) V2NIMMessageAttachment *attachment;
    
    @property(nullable,nonatomic,strong,readonly) NSString *revokeAccountId;
    
    @property(nonatomic,assign,readonly) V2NIMMessageRevokeType revokeType;
    
    @property(nullable,nonatomic,strong,readonly) NSString *serverExtension;
    
    @property(nullable,nonatomic,strong,readonly) NSString *callbackExtension;
    
    @property(nullable,nonatomic,strong,readonly) NSString *senderName;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMLastMessage {
    
        V2NIMLastMessageState lastMessageState{V2NIM_MESSAGE_STATE_DEFAULT};
    
        nstd::optional<V2NIMMessageRefer> messageRefer;
    
        nstd::optional<V2NIMMessageType> messageType;
    
        nstd::optional<uint32_t> subType;
    
        nstd::optional<V2NIMMessageSendingState> sendingState;
    
        nstd::string text;
    
        nstd::shared_ptr<V2NIMMessageAttachment> attachment;
    
        nstd::optional<nstd::string> revokeAccountId;
    
        nstd::optional<V2NIMMessageRevokeType> revokeType;
    
        nstd::optional<nstd::string> senderId;
        
        nstd::optional<nstd::string> senderName;
    
        nstd::optional<nstd::string> serverExtension;
    
        nstd::optional<nstd::string> callbackExtension;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMLastMessage = {
    
      lastMessageState: V2NIMLastMessageState
      messageRefer: V2NIMMessageRefer
      messageType?: V2NIMMessageType
      subType?: number
      sendingState?: V2NIMMessageSendingState
      text?: string
      attachment?: Partial<V2NIMMessageAttachment>
      revokeAccountId?: string
      revokeType?: V2NIMMessageRevokeType
      serverExtension?: string
      callbackExtension?: string
      senderName?: string
    }
    
    Harmony
    typescriptexport interface V2NIMLastMessage {
    
      lastMessageState: V2NIMLastMessageState
      messageRefer: V2NIMMessageRefer
      messageType?: V2NIMMessageType
      subType?: number
      sendingState?: V2NIMMessageSendingState
      text?: string
      attachment?: Partial<V2NIMMessageAttachment>
      revokeAccountId?: string
      revokeType?: V2NIMMessageRevokeType
      serverExtension?: string
      callbackExtension?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    lastMessageState V2NIMLastMessageState 最后一条消息状态
    messageRefer V2NIMMessageRefer 最后一条消息的参考信息
    messageType V2NIMMessageType 消息类型,消息状态为正常时该字段有效。
    subType int 自定义消息子类型,0 代表无消息子类型。消息状态为正常时该字段有效。
    sendingState V2NIMMessageSendingState 消息发送状态。消息状态为正常时该字段有效。
    text String 文本消息的内容或撤回消息时的附言。
    attachment V2NIMMessageAttachment 消息附件。消息状态为正常时该字段有效。
    revokeAccountId String 消息撤回者账号(accountId)。消息状态为撤回时该字段有效。
    revokeType V2NIMMessageRevokeType 消息撤回类型。消息状态为撤回时该字段有效。
    serverExtension String 服务端扩展字段,多端同步。
    callbackExtension String 第三方回调透传的自定义扩展字段。
    第三方回调功能需要在云信控制台开通
    senderName String 消息发送者名称(好友备注/群成员昵称/用户昵称)
  • 若最后一条消息被撤回,则为撤回者相关名称。
  • 若当前账号为发送者,则该字段不存在。
  • V2NIMMessageQuickComment

    消息快捷评论对象。

    Andoroid
    javapublic interface V2NIMMessageQuickComment {
    
        V2NIMMessageRefer getMessageRefer();
    
        String getOperatorId();
    
        long getIndex();
    
        long getCreateTime();
    
        String getServerExtension();
    }
    
    iOS
    objective-c@interface V2NIMMessageQuickComment : NSObject
    
    @property(nonatomic,strong,readwrite) V2NIMMessageRefer *messageRefer;
    
    @property(nonatomic,strong,readwrite) NSString *operatorId;
    
    @property(nonatomic,assign,readwrite) NSTimeInterval index;
    
    @property(nonatomic,assign,readwrite) NSTimeInterval createTime;
    
    @property(nonatomic,strong,readwrite) NSString *serverExtension;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageQuickComment {
    
        V2NIMMessageRefer messageRefer;
    
        nstd::string operatorId;
    
        uint64_t index{0};
    
        nstd::optional<nstd::string> serverExtension;
    
        nstd::optional<uint64_t> createTime;
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageQuickComment {
    
      messageRefer: V2NIMMessageRefer
      operatorId: string
      index: number
      serverExtension: string
      createTime: number
      pushConfig?: V2NIMMessageQuickCommentPushConfig
    }
    
    Harmony
    typescriptexport interface V2NIMMessageQuickComment {
    
      messageRefer: V2NIMMessageRefer
      operatorId: string
      index: number
      serverExtension: string
      createTime: number
      pushConfig?: V2NIMMessageQuickCommentPushConfig
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    messageRefer V2NIMMessageRefer 快捷评论的消息的参考信息
    operatorId String 评论操作人账号(accountId),默认为空。
    index long 快捷评论索引,默认为 0。
    createTime long 评论时间戳
    serverExtension String 服务端扩展字段,多端同步。

    V2NIMMessageQuickComment

    快捷评论推送配置。

    Andoroid
    javapublic class V2NIMMessageQuickCommentPushConfig {
    
        private final boolean pushEnabled;
        private final boolean needBadge;
        private final String pushTitle;
        private final String pushContent;
        private final String pushPayload;
    
        private V2NIMMessageQuickCommentPushConfig() {
            this(DEFAULT_PUSH_ENABLED, DEFAULT_NEED_BADGE, null, null, null);
        }
    
        private V2NIMMessageQuickCommentPushConfig(boolean pushEnabled, boolean needBadge, String pushTitle, String pushContent, String pushPayload) {
            this.pushEnabled = pushEnabled;
            this.needBadge = needBadge;
            this.pushTitle = pushTitle;
            this.pushContent = pushContent;
            this.pushPayload = pushPayload;
        }
    
        public boolean getPushEnabled() {
            return pushEnabled;
        }
    
        public boolean getNeedBadge() {
            return needBadge;
        }
    
        public String getPushTitle() {
            return pushTitle;
        }
    
        public String getPushContent() {
            return pushContent;
        }
    
        public String getPushPayload() {
            return pushPayload;
        }
    
        private static final boolean DEFAULT_PUSH_ENABLED = true;
        private static final boolean DEFAULT_NEED_BADGE = true;
    
        public static final class V2NIMMessageQuickCommentPushConfigBuilder {
            private boolean pushEnabled = DEFAULT_PUSH_ENABLED;
            private boolean needBadge = DEFAULT_NEED_BADGE;
            private String pushTitle;
            private String pushContent;
            private String pushPayload;
    
            private V2NIMMessageQuickCommentPushConfigBuilder() {
            }
    
            public static V2NIMMessageQuickCommentPushConfigBuilder builder() {
                return new V2NIMMessageQuickCommentPushConfigBuilder();
            }
    
            public V2NIMMessageQuickCommentPushConfigBuilder withPushEnabled(boolean pushEnabled) {
                this.pushEnabled = pushEnabled;
                return this;
            }
    
            public V2NIMMessageQuickCommentPushConfigBuilder withNeedBadge(boolean needBadge) {
                this.needBadge = needBadge;
                return this;
            }
    
            public V2NIMMessageQuickCommentPushConfigBuilder withPushTitle(String title) {
                this.pushTitle = title;
                return this;
            }
    
            public V2NIMMessageQuickCommentPushConfigBuilder withPushContent(String content) {
                this.pushContent = content;
                return this;
            }
    
            public V2NIMMessageQuickCommentPushConfigBuilder withPushPayload(String payload) {
                this.pushPayload = payload;
                return this;
            }
    
            public V2NIMMessageQuickCommentPushConfig build() {
                return new V2NIMMessageQuickCommentPushConfig(pushEnabled, needBadge, pushTitle, pushContent, pushPayload);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMMessageQuickCommentPushConfig : NSObject
    
    @property(nonatomic,assign,readwrite) BOOL pushEnabled;
    
    @property(nonatomic,assign,readwrite) BOOL needBadge;
    
    @property(nonatomic,strong,readwrite) NSString *title;
    
    @property(nonatomic,strong,readwrite) NSString *pushContent;
    
    @property(nonatomic,strong,readwrite) NSString *pushPayload;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageQuickCommentPushConfig {
    
        bool needPush{true};
        bool needBadge{true};
        nstd::string pushTitle;
        nstd::string pushContent;
        nstd::string pushPayload;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageQuickCommentPushConfig {
    
      pushEnabled?: boolean
      needBadge?: boolean
      title?: string
      pushContent?: string
      pushPayload?: string
    }
    
    Harmony
    typescriptexport interface V2NIMMessageQuickCommentPushConfig {
    
      pushEnabled?: boolean
      needBadge?: boolean
      title?: string
      pushContent?: string
      pushPayload?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    messageRefer V2NIMMessageRefer 快捷评论的消息的参考信息
    operatorId String 评论操作人账号(accountId),默认为空。
    index long 快捷评论索引,默认为 0。
    createTime long 评论时间戳
    serverExtension String 服务端扩展字段,多端同步。

    V2NIMMessagePin

    Pin 消息对象。

    Andoroid
    javapublic interface V2NIMMessagePin {
    
        V2NIMMessageRefer getMessageRefer();
    
        String getOperatorId();
    
        String getServerExtension();
    
        long getCreateTime();
    
        long getUpdateTime();
    }
    
    iOS
    objective-c@interface V2NIMMessagePin : NSObject
    
    @property (nullable,nonatomic,strong) V2NIMMessageRefer *messageRefer;
    
    @property (nonatomic,strong) NSString *operatorId;
    
    @property (nonatomic,strong) NSString *serverExtension;
    
    @property (nonatomic,assign) NSTimeInterval createTime;
    
    @property (nonatomic,assign) NSTimeInterval updateTime;
    @end
    
    macOS/Windows
    cppstruct V2NIMMessagePin {
    
        V2NIMMessageRefer messageRefer;
    
        nstd::string operatorId;
    
        nstd::optional<nstd::string> serverExtension;
    
        uint64_t createTime{0};
    
        uint64_t updateTime{0};
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessagePin {
    
      messageRefer: V2NIMMessageRefer
    
      opeartorId: string
    
      serverExtension?: string
    
      createTime: number
    
      updateTime: number
    }
    
    Harmony
    typescriptexport interface V2NIMMessagePin {
    
      messageRefer: V2NIMMessageRefer
      opeartorId: string
      serverExtension?: string
      createTime: number
      updateTime: number
    }
    
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    messageRefer V2NIMMessageRefer Pin 消息的参考信息
    operatorId String 操作人账号(accountId),默认为空。
    createTime long Pin 消息时间戳
    updateTime long 更新 Pin 消息时间戳
    serverExtension String 服务端扩展字段,多端同步。

    V2NIMCollection

    消息收藏对象。

    Andoroid
    javapublic interface V2NIMCollection {
    
        String getCollectionId();
    
        int getCollectionType();
    
        String getCollectionData();
    
        String getServerExtension();
    
        long getCreateTime();
    
        long getUpdateTime();
    
        String getUniqueId();
    }
    
    iOS
    objective-c@interface V2NIMCollection : NSObject
    
    @property (nullable,nonatomic,strong) NSString *collectionId;
    
    @property (nonatomic,assign) int collectionType;
    
    @property (nullable,nonatomic,strong,readonly) NSString *collectionData;
    
    @property (nullable,nonatomic,strong) NSString *serverExtension;
    
    @property (nonatomic,assign) NSTimeInterval createTime;
    
    @property (nonatomic,assign) NSTimeInterval updateTime;
    
    @property (nullable,nonatomic,strong) NSString *uniqueId;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMCollection {
    
        nstd::string collectionId;
    
        uint32_t collectionType{0};
    
        nstd::string collectionData;
    
        nstd::optional<nstd::string> serverExtension;
    
        uint64_t createTime{0};
    
        uint64_t updateTime{0};
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMCollection {
    
      collectionId: string
    
      collectionType: number
    
      collectionData: string
    
      serverExtension?: string
    
      createTime: number
    
      updateTime: number
    
      uniqueId?: string
    }
    
    Harmony
    typescriptexport interface V2NIMCollection {
    
      collectionId: string
      collectionType: number
      collectionData: string
      serverExtension?: string
      createTime: number
      updateTime: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    collectionId String 服务器消息收藏 ID
    collectionType int 自定义收藏类型,必须大于 0,默认为 0。
    collectionData String 收藏数据,上限为 20480 字节。
    createTime long 收藏时间戳
    updateTime long 更新收藏时间戳
    serverExtension String 服务端扩展字段,多端同步。长度上限为 1024 字节。
    uniqueId String 去重唯一ID,如果 ID 相同,则不会新增收藏,只更新之前的收藏内容。

    V2NIMAddCollectionParams

    消息收藏配置参数。

    Andoroid
    javapublic class V2NIMAddCollectionParams {
    
        public int getCollectionType() {
            return collectionType;
        }
    
        public String getCollectionData() {
            return collectionData;
        }
    
        public String getServerExtension() {
            return serverExtension;
        }
    
        @Override
        public String toString() {
            return "V2NIMAddCollectionParams{" +
                    "collectionType=" + collectionType +
                    ", collectionData='" + collectionData + '\'' +
                    ", serverExtension='" + serverExtension + '\'' +
                    '}';
        }
    
        public static final class V2NIMAddCollectionParamsBuilder {
    
            public static V2NIMAddCollectionParamsBuilder builder(int collectionType, String collectionData) {
                return new V2NIMAddCollectionParamsBuilder(collectionType, collectionData);
            }
    
            public V2NIMAddCollectionParamsBuilder withServerExtension(String serverExtension) {
                this.serverExtension = serverExtension;
                return this;
            }
    
            public V2NIMAddCollectionParams build() {
                return new V2NIMAddCollectionParams(collectionType, collectionData, serverExtension);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMAddCollectionParams : NSObject
    
    @property (nonatomic,assign) int collectionType;
    
    @property (nonnull,nonatomic,strong) NSString *collectionData;
    
    @property (nonnull,nonatomic,strong) NSString *serverExtension;
    
    @property (nullable,nonatomic,strong) NSString *uniqueId;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMAddCollectionParams {
    
        uint32_t collectionType{0};
    
        nstd::string collectionData;
    
        nstd::optional<nstd::string> serverExtension;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMAddCollectionParams {
    
      collectionType: number
    
      collectionData: string
    
      serverExtension?: string
    
      uniqueId?: string
    }
    
    Harmony
    typescriptexport interface V2NIMAddCollectionParams {
    
      collectionType: number
      collectionData: string
      serverExtension?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    collectionType int - 自定义收藏类型,必须大于 0,否则返回 191004 参数错误。
    collectionData String - 收藏数据,上限为 20480 字节。
    serverExtension String - 服务端扩展字段。必须为 JSON 格式封装,多端同步,长度上限为 1024字节。
    uniqueId String - 去重唯一ID,如果 ID 相同,则不会新增收藏,只更新之前的收藏内容。

    V2NIMCollectionOption

    分页查询消息收藏选项。

    Andoroid
    javapublic class V2NIMCollectionOption {
    
        public long getBeginTime() {
            return beginTime;
        }
    
        public long getEndTime() {
            return endTime;
        }
    
        public V2NIMCollection getAnchorCollection() {
            return anchorCollection;
        }
    
        public V2NIMQueryDirection getDirection() {
            if (direction == null) {
                return DEFAULT_DIRECTION;
            } else {
                return direction;
            }
        }
    
        public int getLimit() {
            return limit;
        }
    
        public int getCollectionType() {
            return collectionType;
        }
    
        @Override
        public String toString() {
            return "V2NIMCollectionOption{" +
                    "beginTime=" + beginTime +
                    ", endTime=" + endTime +
                    ", anchorCollection=" + anchorCollection +
                    ", direction=" + direction +
                    ", limit=" + limit +
                    ", collectionType=" + collectionType +
                    '}';
        }
    
            public static V2NIMCollectionOptionBuilder builder() {
                return new V2NIMCollectionOptionBuilder();
            }
    
            public V2NIMCollectionOptionBuilder withBeginTime(long beginTime) {
                this.beginTime = beginTime;
                return this;
            }
    
            public V2NIMCollectionOptionBuilder withEndTime(long endTime) {
                this.endTime = endTime;
                return this;
            }
    
            public V2NIMCollectionOptionBuilder withDirection(V2NIMQueryDirection direction) {
                this.direction = direction;
                return this;
            }
    
            public V2NIMCollectionOptionBuilder withAnchorCollection(V2NIMCollection anchorCollection) {
                this.anchorCollection = anchorCollection;
                return this;
            }
    
            public V2NIMCollectionOptionBuilder withLimit(int limit) {
                this.limit = limit;
                return this;
            }
    
            public V2NIMCollectionOptionBuilder withCollectionType(int collectionType) {
                this.collectionType = collectionType;
                return this;
            }
    
            public V2NIMCollectionOption build() {
                return new V2NIMCollectionOption(beginTime, endTime, anchorCollection, direction, limit, collectionType);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMCollectionOption : NSObject
    
    @property (nonatomic,assign) NSTimeInterval beginTime;
    
    @property (nonatomic,assign) NSTimeInterval endTime;
    
    @property (nonatomic,assign) V2NIMQueryDirection direction;
    
    @property (nonatomic,strong) V2NIMCollection *anchorCollection;
    
    @property (nonatomic,assign) int limit;
    
    @property (nonatomic,assign) int collectionType;
    
    @property (nonatomic,assign) NSInteger excludeId;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMCollectionOption {
    
        uint64_t beginTime{0};
    
        uint64_t endTime{0};
    
        nstd::optional<V2NIMCollection> anchorCollection;
    
        V2NIMQueryDirection direction{V2NIM_QUERY_DIRECTION_DESC};
    
        uint32_t limit{V2NIM_DEFAULT_COLLECTION_LIST_LIMIT};
    
        uint32_t collectionType{0};
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMCollectionOption {
    
      beginTime?: number
    
      endTime?: number
    
      anchorCollection?: V2NIMCollection
    
      direction?: V2NIMQueryDirection
    
      limit?: number
    
      collectionType?: number
    }
    
    Harmony
    typescriptexport interface V2NIMCollectionOption {
    
      beginTime?: number
      endTime?: number
      anchorCollection?: V2NIMCollection
      direction?: V2NIMQueryDirection
      limit?: number
      collectionType?: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    beginTime long 0 查询开始时间。该字段必须小于等于 endTime
    endTime long 0 查询结束时间。该字段必须大于等于 beginTime,默认为系统当前时间。
    anchorCollection Optional<V2NIMCollection> - 查询的消息锚点。查询结果不包含该锚点消息。
  • 该字段为空, 则以 [beginTime,endTime] 为查询范围。
  • 该字段不为空:
    • directionDESC,如果 endTime 为 0, 则以 anchorCollection 对应的时间戳为准;如果 endTime 不为 0,则必须与 anchorCollection 时间相同,否则返回 191004 参数错误。
    • directionASC,如果 beginTime 为 0, 则以 anchorCollection 的时间戳为准;如果 beiginTime 不为 0, 则必须与 anchorCollection 时间相同, 否则返回 191004 参数错误。
  • direction V2NIMQueryDirection V2NIM_QUERY_DIRECTION_DESC 查询方向:按照时间升序或降序
    limit int 100 本次查询条数上限,取值范围为 [0,200]。大于 200 则返回 191004 参数错误,小于 0 则默认为 100。
    collectionType int 0,即查询所有类型 收藏类型

    V2NIMSendMessageParams

    消息发送参数配置。

    Andoroid
    javapublic class V2NIMSendMessageParams {
    
        public V2NIMMessageConfig getMessageConfig() {
            return messageConfig;
        }
    
        public V2NIMMessageRouteConfig getRouteConfig() {
            return routeConfig;
        }
    
        public V2NIMMessagePushConfig getPushConfig() {
            return pushConfig;
        }
    
        public V2NIMMessageAntispamConfig getAntispamConfig() {
            return antispamConfig;
        }
    
        public V2NIMMessageRobotConfig getRobotConfig() {
            return robotConfig;
        }
    
        public boolean isClientAntispamEnabled() {
            return clientAntispamEnabled;
        }
    
        public String getClientAntispamReplace() {
            return clientAntispamReplace;
        }
    
        @Override
        public String toString() {
            return "V2NIMSendMessageParams{" +
                    "messageConfig=" + messageConfig +
                    ", routeConfig=" + routeConfig +
                    ", pushConfig=" + pushConfig +
                    ", antispamConfig=" + antispamConfig +
                    ", robotConfig=" + robotConfig +
                    ", clientAntispamEnabled=" + clientAntispamEnabled +
                    ", clientAntispamReplace='" + clientAntispamReplace + '\'' +
                    '}';
        }
    
        public static final class V2NIMSendMessageParamsBuilder {
    
            public static V2NIMSendMessageParamsBuilder builder() {
                return new V2NIMSendMessageParamsBuilder();
            }
    
            public V2NIMSendMessageParamsBuilder withMessageConfig(V2NIMMessageConfig messageConfig) {
                this.messageConfig = messageConfig;
                return this;
            }
    
            public V2NIMSendMessageParamsBuilder withRouteConfig(V2NIMMessageRouteConfig routeConfig) {
                this.routeConfig = routeConfig;
                return this;
            }
    
            public V2NIMSendMessageParamsBuilder withPushConfig(V2NIMMessagePushConfig pushConfig) {
                this.pushConfig = pushConfig;
                return this;
            }
    
            public V2NIMSendMessageParamsBuilder withAntispamConfig(V2NIMMessageAntispamConfig antispamConfig) {
                this.antispamConfig = antispamConfig;
                return this;
            }
    
            public V2NIMSendMessageParamsBuilder withRobotConfig(V2NIMMessageRobotConfig robotConfig) {
                this.robotConfig = robotConfig;
                return this;
            }
    
            public V2NIMSendMessageParamsBuilder withClientAntispamEnabled(boolean clientAntispamEnabled) {
                this.clientAntispamEnabled = clientAntispamEnabled;
                return this;
            }
    
            public V2NIMSendMessageParamsBuilder withClientAntispamReplace(String clientAntispamReplace) {
                this.clientAntispamReplace = clientAntispamReplace;
                return this;
            }
    
            public V2NIMSendMessageParams build() {
                return new V2NIMSendMessageParams(messageConfig, routeConfig, pushConfig, antispamConfig, robotConfig, clientAntispamEnabled, clientAntispamReplace);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMSendMessageParams : NSObject<NSCopying>
    
    @property(nonatomic,strong,readwrite) V2NIMMessageConfig *messageConfig;
    
    @property(nonatomic,strong,readwrite) V2NIMMessageRouteConfig *routeConfig;
    
    @property(nonatomic,strong,readwrite) V2NIMMessagePushConfig *pushConfig;
    
    @property(nonatomic,strong,readwrite) V2NIMMessageAntispamConfig *antispamConfig;
    
    @property(nonatomic,strong,readwrite) V2NIMMessageRobotConfig *robotConfig;
    
    @property(nonatomic, assign, readwrite) BOOL clientAntispamEnabled;
    
    @property(nullable,nonatomic,strong,readwrite) NSString *clientAntispamReplace;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMSendMessageParams {
    
        V2NIMMessageConfig messageConfig;
    
        V2NIMMessageRouteConfig routeConfig;
    
        V2NIMMessagePushConfig pushConfig;
    
        V2NIMMessageAntispamConfig antispamConfig;
    
        V2NIMMessageRobotConfig robotConfig;
    
        bool clientAntispamEnabled{false};
    
        nstd::string clientAntispamReplace;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMSendMessageParams {
      messageConfig?: V2NIMMessageConfig
      routeConfig?: V2NIMMessageRouteConfig
      pushConfig?: V2NIMMessagePushConfig
      antispamConfig?: V2NIMMessageAntispamConfig
      robotConfig?: V2NIMMessageRobotConfig
      clientAntispamEnabled?: boolean
      clientAntispamReplace?: string
    }
    
    Harmony
    typescriptexport interface V2NIMSendMessageParams {
      messageConfig?: V2NIMMessageConfig
      routeConfig?: V2NIMMessageRouteConfig
      pushConfig?: V2NIMMessagePushConfig
      antispamConfig?: V2NIMMessageAntispamConfig
      robotConfig?: V2NIMMessageRobotConfig
      clientAntispamEnabled?: boolean
      clientAntispamReplace?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    messageConfig V2NIMMessageConfig - 消息相关配置
    routeConfig V2NIMMessageRouteConfig - 消息事件抄送相关配置
    pushConfig V2NIMMessagePushConfig - 消息第三方推送相关配置。
    第三方推送功能需要在云信控制台配置
    antispamConfig V2NIMMessageAntispamConfig - 消息反垃圾相关配置,包括本地反垃圾或安全通配置,均需要在云信控制台开通
    robotConfig V2NIMMessageRobotConfig - 消息机器人相关配置。
    该参数信息需要与控制台机器人配置信息一致。
    clientAntispamEnabled boolean false 是否启用本地反垃圾。
  • 仅对文本消息生效
  • 如果开启本地发垃圾,发送消息时会进行本地反垃圾检测,完成后返回检测结果 V2NIMClientAntispamOperatorType
    • 0:检测通过,可以发送该消息。
    • 1:发送替换后的文本消息。
    • 2:检测不通过,消息发送失败,返回本地错误码。
    • 3:消息发送后,由服务端拦截
  • clientAntispamReplace String clientAntispamEnabled 为 true 则必填 "" 反垃圾命中后替换的文本

    V2NIMMessageRefer

    消息参考信息。

    Andoroid
    javapublic interface V2NIMMessageRefer extends Serializable {
    
        String getSenderId();
    
        String getReceiverId();
    
        String getMessageClientId();
    
        String getMessageServerId();
    
        V2NIMConversationType getConversationType();
    
        String getConversationId();
    
        long getCreateTime();
    }
    
    iOS
    objective-c@interface V2NIMMessageRefer : NSObject
    
    @property (nullable,nonatomic,strong) NSString *senderId;
    
    @property (nullable,nonatomic,strong) NSString *receiverId;
    
    @property (nullable,nonatomic,strong) NSString *messageClientId;
    
    @property (nullable,nonatomic,strong) NSString *messageServerId;
    
    @property (nonatomic,assign) V2NIMConversationType conversationType;
    
    @property (nullable,nonatomic,strong) NSString *conversationId;
    
    @property (nonatomic,assign) NSTimeInterval createTime;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageRefer {
    
        nstd::string senderId;
    
        nstd::string receiverId;
    
        nstd::string messageClientId;
    
        nstd::string messageServerId;
    
        V2NIMConversationType conversationType{V2NIM_CONVERSATION_TYPE_UNKNOWN};
    
        nstd::string conversationId;
    
        uint64_t createTime{0};
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageRefer {
    
      senderId: string
    
      receiverId: string
    
      messageClientId: string
    
      messageServerId: string
    
      createTime: number
    
      conversationType: V2NIMConversationType
    
      conversationId: string
    }
    
    Harmony
    typescriptexport interface V2NIMMessageRefer {
    
      senderId: string
      receiverId: string
      messageClientId: string
      messageServerId: string
      createTime: number
      conversationType: V2NIMConversationType
      conversationId: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    senderId String 消息发送方账号(accountId)
    receiverId String 消息接收方账号
  • 如果消息所属会话类型为单聊,该字段为聊天对象账号。
  • 如果消息所属会话类型为群组,该字段为群组 ID。
  • messageClientId String 客户端消息 ID,不多端同步。
    messageServerId String 服务端消息 ID,多端同步。
    conversationType V2NIMConversationType 会话类型
    conversationId String 会话 ID
    createTime long 消息时间戳,单位毫秒。

    V2NIMMessageAttachment

    消息附件对象。

    Andoroid
    javapublic interface V2NIMMessageAttachment extends Serializable {
        String getRaw();
    }
    
    iOS
    objective-c@interface V2NIMMessageAttachment: NSObject
    
    @property(nonnull,nonatomic,strong) NSString *raw;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageAttachment {
        nstd::string raw;
        virtual ~V2NIMMessageAttachment() = default;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageAttachment {
      raw: string
    }
    
    Harmony
    typescriptexport interface V2NIMMessageAttachment {
    
      raw: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    raw String - 消息附件,建议为 JSON 格式。

    V2NIMMessageFileAttachment

    文件类型消息的附件对象,继承自 V2NIMMessageAttachment

    Andoroid
    javapublic interface V2NIMMessageFileAttachment extends V2NIMMessageAttachment {
    
        String getPath();
    
        long getSize();
    
        String getMd5();
    
        String getUrl();
    
        String getExt();
    
        String getName();
    
        @NonNull
        String getSceneName();
    
        V2NIMMessageAttachmentUploadState getUploadState();
    
    }
    
    iOS
    objective-c@interface V2NIMMessageFileAttachment : V2NIMMessageAttachment
    
    @property(nullable,nonatomic,strong) NSString *path;
    
    @property(nonatomic,assign) NSUInteger size;
    
    @property(nonnull,nonatomic,strong) NSString *md5;
    
    @property(nullable,nonatomic,strong,readonly) NSString *url;
    
    @property(nullable,nonatomic,strong) NSString *ext;
    
    @property(nonnull,nonatomic,copy) NSString *name;
    
    @property(nullable,nonatomic,strong) NSString *sceneName;
    
    @property(nonatomic,assign) V2NIMMessageAttachmentUploadState uploadState;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageFileAttachment : public V2NIMMessageAttachment {
    
        uint64_t size{0};
    
        nstd::string md5;
    
        nstd::string url;
    
        nstd::string name;
    
        nstd::string path;
    
        nstd::string ext;
    
        nstd::string sceneName{V2NIM_STORAGE_SCENE_NAME_DEFAULT_IM};
    
        V2NIMMessageAttachmentUploadState uploadState{V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_UNKNOWN};
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageFileAttachment extends V2NIMMessageAttachment {
    
      file?: File
    
      path?: string
    
      size: number
    
      url: string
    
      md5?: string
    
      ext: string
    
      name: string
     
      sceneName: string
    
      uploadState: V2NIMMessageAttachmentUploadState
    }
    
    Harmony
    typescriptexport interface V2NIMMessageFileAttachment extends V2NIMMessageAttachment {
    
      path?: string
      size: number
      url: string
      md5?: string
      ext: string
      name: string
      sceneName: string
      uploadState: V2NIMMessageAttachmentUploadState
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    path String 除 Web 端外,其他端均为必填。 - 附件本地路径。
    请确保该路径存在且可用,SDK 会根据该字段判断附件是否存在。
    file Web File null Web File 对象。
  • Web 小程序不支持该字段。
  • 必须和 path 选其一设置。
  • size long - 文件大小
    md5 String - 文件内容 MD5 值
    url String - - 文件服务器路径
    ext String null 文件扩展名,例如:.png.txt 等。
    name String - 文件显示名。包含扩展名,例如:1.png2.txt 等。
    sceneName String - V2NIMStorageSceneConfig.DEFAULT_IM 对应的场景名 NOS 文件存储场景名。若使用自定义的存储场景,需要先调用 V2NIMStorageService.addCustomStorageScene 添加自定义存储场景。
    uploadState V2NIMMessageAttachmentUploadState - - 消息附件上传状态

    V2NIMMessageImageAttachment

    图片附件对象,继承自 V2NIMMessageFileAttachment

    Andoroid
    javapublic interface V2NIMMessageImageAttachment extends V2NIMMessageFileAttachment {
    
        int getWidth();
    
        int getHeight();
    }
    
    iOS
    objective-c@interface V2NIMMessageImageAttachment : V2NIMMessageFileAttachment
    
    @property(nonatomic,assign,readonly) int width;
    
    @property(nonatomic,assign,readonly) int height;
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageImageAttachment : public V2NIMMessageFileAttachment {
    
        uint32_t width{0};
    
        uint32_t height{0};
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessagImageAttachment extends V2NIMMessageFileAttachment {
    
      width: number
    
      height: number
    }
    
    Harmony
    typescriptexport interface V2NIMMessagImageAttachment extends V2NIMMessageFileAttachment {
    
      width: number
      height: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    width int - 图片宽度,单位像素。
    height int - 图片高度,单位像素。

    V2NIMMessageAudioAttachment

    语音附件对象,继承自 V2NIMMessageFileAttachment

    Andoroid
    javapublic interface V2NIMMessageAudioAttachment extends V2NIMMessageFileAttachment {
    
        int getDuration();
    }
    
    iOS
    objective-c@interface V2NIMMessageAudioAttachment : V2NIMMessageFileAttachment
    
    @property(nonatomic,assign,readwrite) NSUInteger duration;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageAudioAttachment : public V2NIMMessageFileAttachment {
    
        uint32_t duration{0};
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageAudioAttachment extends V2NIMMessageFileAttachment {
    
      duration: number
    }
    
    Harmony
    typescriptexport interface V2NIMMessageAudioAttachment extends V2NIMMessageFileAttachment {
    
      duration: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    duration int - 语音文件时长,单位为毫秒。

    V2NIMMessageVideoAttachment

    视频附件对象,继承自 V2NIMMessageFileAttachment

    Andoroid
    javapublic interface V2NIMMessageVideoAttachment extends V2NIMMessageFileAttachment {
    
        int getDuration();
    
        int getWidth();
    
        int getHeight();
    }
    
    iOS
    objective-c@interface V2NIMMessageVideoAttachment : V2NIMMessageFileAttachment
    
    @property(nonatomic,assign) NSUInteger duration;
    
    @property(nonatomic,assign) NSInteger width;
    
    @property(nonatomic,assign) NSInteger height;
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageVideoAttachment : public V2NIMMessageFileAttachment {
    
        uint32_t duration{0};
    
        uint32_t width{0};
    
        uint32_t height{0};
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageVideoAttachment extends V2NIMMessageFileAttachment {
    
      duration: number
    
      width: number
    
      height: number
    }
    
    Harmony
    typescriptexport interface V2NIMMessageVideoAttachment extends V2NIMMessageFileAttachment {
    
      duration: number
      width: number
      height: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    duration int - 视频文件时长,单位为毫秒。
    width int - 视频宽度,单位像素。
    height int - 视频高度,单位像素。

    V2NIMMessageCallAttachment

    话单消息附件对象,继承自 V2NIMMessageAttachment

    Andoroid
    javapublic interface V2NIMMessageCallAttachment extends V2NIMMessageAttachment {
    
        int getType();
    
        String getChannelId();
    
        int getStatus();
    
        List<V2NIMMessageCallDuration> getDurations();
    }
    
    iOS
    objective-c@interface V2NIMMessageCallAttachment : V2NIMMessageAttachment
    
    @property (nonatomic, assign) NSInteger type;
    
    @property (nonatomic, copy) NSString *channelId;
    
    @property (nonatomic, assign) NSInteger status;
    
    @property (nonatomic, copy) NSArray<V2NIMMessageCallDuration *>*durations;
    
    @end
    
    Web/uni-app/小程序
    typescriptinterface V2NIMMessageCallAttachment extends V2NIMMessageAttachment {
    
      type: number
    
      channelId: string
    
      status: number
    
      durations: V2NIMMessageCallDuration[]
    
      text: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    type Integer - 话单类型,业务侧可自定义,云信不校验内容。建议设置为:
  • 1:音频
  • 2:视频
  • channelId String - 话单频道 ID,云信不校验内容。
    status Integer - 通话状态,业务侧可自定义状态,云信不校验内容。建议设置为:
  • 1:通话完成
  • 2:通话取消
  • 3:通话拒绝
  • 4:超时未接听
  • 5:对方忙
  • duration List<V2NIMMessageCallDuration> - 通话成员时长列表,云信不校验内容。

    V2NIMMessageCallDuration

    话单消息单人通话时长数据结构。

    Andoroid
    javapublic class V2NIMMessageCallDuration implements Serializable {
    
        private String accountId;
    
        private int duration;
    
        public V2NIMMessageCallDuration() {
        }
    
        public V2NIMMessageCallDuration(String accountId, int duration) {
            this.accountId = accountId;
            this.duration = duration;
        }
    
        public void setAccountId(String accountId) {
            this.accountId = accountId;
        }
    
        public void setDuration(int duration) {
            this.duration = duration;
        }
    
        public String getAccountId() {
            return accountId;
        }
    
        public int getDuration() {
            return duration;
        }
    }
    
    iOS
    objective-c@interface V2NIMMessageCallDuration : NSObject
    
    @property(nullable,nonatomic,strong) NSString *accountId;
    
    @property(nonatomic,assign) NSInteger duration;
    
    @end
    
    Web/uni-app/小程序
    typescripttype V2NIMMessageCallDuration = {
      accountId: string 
      duration: number 
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    accountId string - 话单对应成员的账号 ID。
    duration Integer - 通话时长。

    V2NIMMessageLocationAttachment

    地理位置附件对象,继承自 V2NIMMessageAttachment

    Andoroid
    javapublic interface V2NIMMessageLocationAttachment extends V2NIMMessageAttachment {
    
        double getLatitude();
    
        double getLongitude();
    
        String getAddress();
    }
    
    iOS
    objective-c@interface V2NIMMessageLocationAttachment : V2NIMMessageAttachment
    
    @property(nonatomic,assign) double longitude;
    
    @property(nonatomic,assign) double latitude;
    
    @property(nonnull,nonatomic,strong) NSString *address;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageLocationAttachment : public V2NIMMessageAttachment {
    
        double latitude{0};
    
        double longitude{0};
    
        nstd::string address;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageLocationAttachment extends V2NIMMessageAttachment {
    
      latitude: number
    
      longitude: number
    
      address: string
    }
    
    Harmony
    typescriptexport interface V2NIMMessageLocationAttachment extends V2NIMMessageAttachment {
    
      latitude: number
      longitude: number
      address: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    latitude Double - 地理位置纬度。
    longitude Double - 地理位置经度。
    address String - 地理位置描述。

    V2NIMMessageNotificationAttachment

    通知附件对象,继承自 V2NIMMessageAttachment

    Andoroid
    javapublic interface V2NIMMessageNotificationAttachment extends V2NIMMessageAttachment {
    
        V2NIMMessageNotificationType getType();
    
        String getServerExtension();
    
        List<String> getTargetIds();
    
        boolean isChatBanned();
    
        V2NIMUpdatedTeamInfo getUpdatedTeamInfo();
    }
    
    iOS
    objective-c@interface V2NIMMessageNotificationAttachment : V2NIMMessageAttachment
    
    @property(nonatomic,assign) V2NIMMessageNotificationType type;
    
    @property(nullable,nonatomic,strong) NSString *serverExtension;
    
    @property(nullable,nonatomic,strong) NSArray<NSString *> *targetIds;
    
    @property(nonatomic,assign) BOOL chatBanned;
    
    @property(nullable,nonatomic,strong) V2NIMUpdatedTeamInfo *updatedTeamInfo;
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageTeamNotificationAttachment : public V2NIMMessageAttachment {
        V2NIMMessageTeamNotificationAttachment() { attachmentType = V2NIM_MESSAGE_ATTACHMENT_TYPE_TEAM_NOTIFICATION; }
        
        V2NIMMessageNotificationType type{V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_INVITE};
    
        nstd::optional<nstd::string> serverExtension;
    
        nstd::vector<nstd::string> targetIds;
    
        bool chatBanned{false};
    
        nstd::optional<V2NIMUpdatedTeamInfo> updatedTeamInfo;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageNotificationAttachment extends V2NIMMessageAttachment {
      type: V2NIMMessageNotificationType
      serverExtension?: string
      targetIds?: string[]
      chatBanned?: boolean
      updatedTeamInfo?: V2NIMUpdatedTeamInfo
    }
    
    Harmony
    typescriptexport interface V2NIMMessageNotificationAttachment extends V2NIMMessageAttachment {
    
      type: V2NIMMessageNotificationType
      serverExtension?: string
      targetIds?: string[]
      chatBanned?: boolean
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    type V2NIMMessageNotificationType - 通知类型
    serverExtension String null 服务端扩展字段。必须为 JSON 格式封装,多端同步。
    targetIds List null 被操作者用户账号(accountId)列表
    chatBanned Boolen null 群成员是否被禁言
    updatedTeamInfo V2NIMUpdatedTeamInfo null 群信息更新字段。
    如有字段信息,则表示对应字段被修改。

    V2NIMSendMessageResult

    消息发送成功结果回包。

    Andoroid
    javapublic interface V2NIMSendMessageResult {
    
        V2NIMMessage getMessage();
    
        String getAntispamResult();
    
        V2NIMClientAntispamResult getClientAntispamResult();
    }
    
    iOS
    objective-c@interface V2NIMSendMessageResult : NSObject
    
    @property(nullable,nonatomic,strong,readonly) V2NIMMessage *message;
    
    @property(nullable,nonatomic,strong,readonly) NSString *antispamResult;
    
    @property(nullable,nonatomic,strong,readonly) V2NIMClientAntispamResult *clientAntispamResult;
    @end
    
    macOS/Windows
    cppstruct V2NIMSendMessageResult {
    
        V2NIMMessage message;
    
        nstd::optional<nstd::string> antispamResult;
    
        nstd::optional<V2NIMClientAntispamResult> clientAntispamResult;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMSendMessageResult {
      message: V2NIMMessage
    
      callbackExtension?: string
    
      antispamResult?: string
    
      clientAntispamResult?: V2NIMClientAntispamResult
    }
    
    Harmony
    typescriptexport interface V2NIMSendMessageResult {
      message: V2NIMMessage
      callbackExtension?: string
      antispamResult?: string
      clientAntispamResult?: V2NIMClientAntispamResult
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    message V2NIMMessage 消息对象
    antispamResult String 安全通反垃圾检测结果
    clientAntispamResult V2NIMClientAntispamResult 本地反垃圾结果

    V2NIMMessageListOption

    消息分页查询选项。

    Andoroid
    javapublic class V2NIMMessageListOption {
    
        public String getConversationId() {
            return conversationId;
        }
        public List<V2NIMMessageType> getMessageTypes() {
            return messageTypes;
        }
        public long getBeginTime() {
            return beginTime;
        }
        public long getEndTime() {
            return endTime;
        }
        public int getLimit() {
            return limit;
        }
        public V2NIMMessage getAnchorMessage() {
            return anchorMessage;
        }
        public V2NIMMessageQueryDirection getDirection() {
            if (direction == null) {
                return DEFAULT_DIRECTION;
            } else {
                return direction;
            }
        }
        public boolean isStrictMode() {
            return strictMode;
        }
    
            public static V2NIMMessageListOptionBuilder builder(final String conversationId) {
                return new V2NIMMessageListOptionBuilder(conversationId);
            }
            public V2NIMMessageListOptionBuilder withMessageTypes(List<V2NIMMessageType> messageTypes) {
                this.messageTypes = messageTypes;
                return this;
            }
            public V2NIMMessageListOptionBuilder withBeginTime(long beginTime) {
                this.beginTime = beginTime;
                return this;
            }
            public V2NIMMessageListOptionBuilder withEndTime(long endTime) {
                this.endTime = endTime;
                return this;
            }
            public V2NIMMessageListOptionBuilder withLimit(int limit) {
                this.limit = limit;
                return this;
            }
            public V2NIMMessageListOptionBuilder withAnchorMessage(V2NIMMessage anchorMessage) {
                this.anchorMessage = anchorMessage;
                return this;
            }
            public V2NIMMessageListOptionBuilder withDirection(V2NIMMessageQueryDirection direction) {
                this.direction = direction;
                return this;
            }
            public V2NIMMessageListOptionBuilder withStrictMode(boolean strictMode) {
                this.strictMode = strictMode;
                return this;
            }
            public V2NIMMessageListOption build() {
                return new V2NIMMessageListOption(conversationId, messageTypes, beginTime, endTime, limit, anchorMessage, direction, strictMode);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMMessageListOption : NSObject<NSCopying>
    @property(nonatomic,strong) NSString *conversationId;
    @property(nullable,nonatomic,strong,readwrite) NSArray *messageTypes;
    @property(nonatomic,assign) NSTimeInterval beginTime;
    @property(nonatomic,assign) NSTimeInterval endTime;
    @property(nonatomic,assign) NSUInteger limit;
    @property(nullable,nonatomic,strong) V2NIMMessage *anchorMessage;
    @property(nonatomic,assign) V2NIMQueryDirection direction;
    @property (nonatomic, assign) BOOL strictMode;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageListOption {
        nstd::vector<V2NIMMessageType> messageTypes;
        nstd::string conversationId;
        uint64_t beginTime{0};
        uint64_t endTime{0};
        uint32_t limit{V2NIM_DEFAULT_MESSAGE_LIST_LIMIT};
        nstd::optional<V2NIMMessage> anchorMessage;
        bool reverse{false};
        V2NIMQueryDirection direction{V2NIM_QUERY_DIRECTION_DESC};
        bool strictMode{false};
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageListOption {
      conversationId: string
      messageTypes?: V2NIMMessageType[]
      beginTime?: number
      endTime?: number
      limit?: number
      anchorMessage?: V2NIMMessage
      reverse?: boolean
      direction?: V2NIMQueryDirection
    }
    
    Harmony
    typescriptexport interface V2NIMMessageListOption {
      conversationId: string
      messageTypes?: V2NIMMessageType[]
      beginTime?: number
      endTime?: number
      limit?: number
      anchorMessage?: V2NIMMessage
      reverse?: boolean
      direction?: V2NIMQueryDirection
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    conversationId String - 消息所属的会话 ID,通过调用 V2NIMConversationIdUtil 的对应函数创建。组成方式: 用户账号(accountId)|会话类型(V2NIMConversationType)|聊天对象账号(accountId)或群组 ID。
    messageTypes List<V2NIMMessageType> null 消息类型,为 null或空列表则表示查询所有消息类型。
    beginTime long 0 查询开始时间,该字段必须小于等于 endTime
    endTime long 0 查询结束时间,字段必须大于等于 beginTime,默认为系统当前时间。
    limit int 50 本次查询条数上限,取值范围为 [0,100]。传入小于 0 则默认为 50。
    anchorMessage V2NIMMessage - 查询的消息锚点。查询结果不包含该锚点消息。
  • 该字段为空, 则以 [beginTime,endTime] 为查询范围。
  • 该字段不为空:
    • directionDESC,如果 endTime 为 0, 则以 anchorMessage 对应的时间戳为准;如果 endTime 不为 0,则必须与 anchorMessage 时间相同,否则返回 191004 参数错误。
    • directionASC,如果 beginTime 为 0, 则以 anchorMessage 的时间戳为准;如果 beiginTime 不为 0, 则必须与 anchorMessage 时间相同, 否则返回 191004 参数错误。
  • direction V2NIMQueryDirection V2NIM_QUERY_DIRECTION_DESC 查询方向:按照时间升序或降序
    strictmode boolean false 严格模式
  • true:如果无法确定消息完整性,则查询失败返回错误码,错误码由失败原因决定。
  • false:如果无法确定消息完整性,则从本地数据库中查询。
  • V2NIMThreadMessageListOption

    Thread 消息分页查询选项。

    Andoroid
    javapublic class V2NIMThreadMessageListOption implements Serializable {
    
     private V2NIMMessageRefer messageRefer;
    
     private long beginTime = 0L;
    
     private long endTime = 0L;
    
     private String excludeMessageServerId = null;
    
     private Integer limit = 50;
    
     private V2NIMQueryDirection direction = V2NIMQueryDirection.V2NIM_QUERY_DIRECTION_DESC;
    
     public V2NIMMessageRefer getMessageRefer() {
      return messageRefer;
     }
    
     public void setMessageRefer(V2NIMMessageRefer messageRefer) {
      this.messageRefer = messageRefer;
     }
    
     public long getBeginTime() {
      return beginTime;
     }
    
     public void setBeginTime(long beginTime) {
      this.beginTime = beginTime;
     }
    
     public long getEndTime() {
      return endTime;
     }
    
     public void setEndTime(long endTime) {
      this.endTime = endTime;
     }
    
     public String getExcludeMessageServerId() {
      return excludeMessageServerId;
     }
    
     public void setExcludeMessageServerId(String excludeMessageServerId) {
      this.excludeMessageServerId = excludeMessageServerId;
     }
    
     public Integer getLimit() {
      return limit;
     }
    
     public void setLimit(Integer limit) {
      this.limit = limit;
     }
    
     public V2NIMQueryDirection getDirection() {
      return direction;
     }
    
     public void setDirection(V2NIMQueryDirection direction) {
      this.direction = direction;
     }
    
     public boolean isValid() {
      if(!V2NIMMessageReferImpl.isValid(messageRefer)) {
       return false;
      }
      if(limit <= 0) {
       return false;
      }
    
      if(beginTime != 0L && endTime != 0L && beginTime > endTime) {
       return false;
      }
      return true;
     }
    }
    
    iOS
    objective-c@interface V2NIMThreadMessageListOption: NSObject
    
    @property (nonnull,nonatomic,strong) V2NIMMessageRefer *messageRefer;
    
    @property(nonatomic,assign) NSTimeInterval beginTime;
    
    @property(nonatomic,assign) NSTimeInterval endTime;
    
    @property (nullable,nonatomic,copy) NSString *excludeMessageServerId;
    
    @property(nonatomic,assign) NSInteger limit;
    
    @property(nonatomic,assign) V2NIMQueryDirection direction;
    @end
    
    Web/uni-app/小程序
    typescriptinterface V2NIMThreadMessageListOption {
    
      messageRefer: V2NIMMessageRefer
    
      beginTime?: number
    
      endTime?: number
    
      limit?: number
    
      direction?: V2NIMQueryDirection
    
      excludeMessageServerId?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    messageRefer V2NIMMessageRefer> - Thread 消息参考信息,支持根据 Thread 根消息的参考信息查询本地子消息。
    beginTime long 0 查询开始时间,该字段必须小于等于 endTime
    endTime long 0 查询结束时间,字段必须大于等于 beginTime,默认为系统当前时间。
    limit Integer 50 本次查询条数上限,取值范围为 [0,100]。传入小于 0 则默认为 50。
    excludeMessageServerId String - 锚点消息的 ServerId。该消息必须处于端点,即消息时间必须等于 beginTimeendTime。如果是合法的消息 ID 则表示排除该消息,否则不排除。
    direction V2NIMQueryDirection V2NIM_QUERY_DIRECTION_DESC 消息查询方向:按照时间升序(ASC)或降序(DESC)。

    V2NIMThreadMessageListResult

    Thread 消息查询结果。

    Andoroid
    javapublic interface V2NIMThreadMessageListResult {
    
     V2NIMMessage getMessage();
    
     long getTimestamp();
    
     int getReplyCount();
    
     List<V2NIMMessage> getReplyList();
    }
    
    iOS
    objective-c@interface V2NIMThreadMessageListResult: NSObject
    
    @property (nonatomic,readonly,strong) V2NIMMessage *message;
    
    @property (nonatomic,readonly,assign) NSTimeInterval timestamp;
    
    @property (nonatomic,readonly,assign) NSInteger replyCount;
    
    @property (nonatomic,readonly,strong) NSArray<V2NIMMessage *> *replyList;
    
    @end
    
    Web/uni-app/小程序
    typescriptinterface V2NIMThreadMessageListResult {
    
      message: V2NIMMessage
    
      timestamp: number
    
      replyCount: number
    
      replyList: V2NIMMessage[]
    }
    
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 默认值 描述
    message V2NIMMessage - Thread 消息根消息。
    timestamp long - 获取 Thread 消息中最后一条消息的时间戳。
    replyCount Integer - 获取 Thread 消息中的总回复数,Thread 消息不计入总数。
    replyList List<V2NIMMessage> - 消息回复列表。

    V2NIMP2PMessageReadReceipt

    单聊消息已读回执对象。

    Andoroid
    javapublic interface V2NIMP2PMessageReadReceipt {
        String getConversationId();
        long getTimestamp();
    }
    
    iOS
    objective-c@interface V2NIMP2PMessageReadReceipt : NSObject
    @property(nullable,nonatomic,strong,readonly) NSString *conversationId;
    @property(nonatomic,assign,readonly) NSTimeInterval timestamp;
    @end
    
    macOS/Windows
    cppstruct V2NIMP2PMessageReadReceipt {
        nstd::string conversationId;
        uint64_t timestamp{0};
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMP2PMessageReadReceipt {
      conversationId: string
      timestamp: number
    }
    
    Harmony
    typescriptexport interface V2NIMP2PMessageReadReceipt {
    
      conversationId: string
      timestamp: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    conversationId String 消息所属的会话 ID,通过调用 V2NIMConversationIdUtil 的对应函数创建。组成方式: 用户账号(accountId)|会话类型(V2NIMConversationType)|聊天对象账号(accountId)或群组 ID。
    timestamp long 最后一条已读消息的时间戳,早于该消息都判定为已读消息。

    V2NIMTeamMessageReadReceipt

    群组消息已读回执对象。

    Andoroid
    javapublic interface V2NIMTeamMessageReadReceipt {
        String getConversationId();
        String getMessageClientId();
        String getMessageServerId();
        int getReadCount();
        int getUnreadCount();
        String getLatestReadAccount();
    }
    
    iOS
    objective-c@interface V2NIMTeamMessageReadReceipt : NSObject
    @property (nullable,nonatomic,strong,readonly) NSString *conversationId;
    @property (nullable,nonatomic,strong,readonly) NSString *messageServerId;
    @property (nullable,nonatomic,strong,readonly) NSString *messageClientId;
    @property (nonatomic,assign,readonly) NSInteger readCount;
    @property (nonatomic,assign,readonly) NSInteger unreadCount;
    @property (nonatomic,strong,readonly) NSString *latestReadAccount;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMTeamMessageReadReceipt {
        nstd::string conversationId;
        nstd::string messageServerId;
        nstd::string messageClientId;
        uint32_t readCount{0};
        uint32_t unreadCount{0};
        nstd::optional<nstd::string> latestReadAccount;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMTeamMessageReadReceipt {
      conversationId: string
      messageServerId: string
      messageClientId: string
      readCount: number
      unreadCount: number
      latestReadAccount?: string
    }
    
    Harmony
    typescriptexport interface V2NIMTeamMessageReadReceipt {
    
      conversationId: string
      messageServerId: string
      messageClientId: string
      readCount: number
      unreadCount: number
      latestReadAccount?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    conversationId String 消息所属的会话 ID,通过调用 V2NIMConversationIdUtil 的对应函数创建。组成方式: 用户账号(accountId)|会话类型(V2NIMConversationType)|聊天对象账号(accountId)或群组 ID。
    messageServerId String 已读的服务端消息 ID。
    messageClientId String 已读的客户端消息 ID。
    readCount int 该群组消息已读人数。
    unreadCount int 该群组消息未读人数。
    latestReadAccount String 该群消息最新已读账号(accountId)。

    V2NIMTeamMessageReadReceiptDetail

    群组消息已读回执详情。

    Andoroid
    javapublic interface V2NIMTeamMessageReadReceiptDetail {
        V2NIMTeamMessageReadReceipt getReadReceipt();
        List<String> getReadAccountList();
        List<String> getUnreadAccountList();
    }
    
    iOS
    objective-c@interface V2NIMTeamMessageReadReceiptDetail : NSObject
    @property (nonatomic,strong,readonly) V2NIMTeamMessageReadReceipt *readReceipt;
    @property (nonatomic,strong,readonly) NSArray<NSString *> *readAccountList;
    @property (nonatomic,strong,readonly) NSArray<NSString *> *unreadAccountList;
    @end
    
    macOS/Windows
    cppstruct V2NIMTeamMessageReadReceiptDetail {
        V2NIMTeamMessageReadReceipt readReceipt;
        nstd::vector<nstd::string> readAccountList;
        nstd::vector<nstd::string> unreadAccountList;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMTeamMessageReadReceiptDetail {
      readReceipt: V2NIMTeamMessageReadReceipt
      readAccountList: string[]
      unreadAccountList: string[]
    }
    
    Harmony
    typescriptexport interface V2NIMTeamMessageReadReceiptDetail {
    
      readReceipt: V2NIMTeamMessageReadReceipt
      readAccountList: string[]
      unreadAccountList: string[]
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    readReceipt V2NIMTeamMessageReadReceipt 群组消息已读回执对象
    readAccountList List 群组消息已读账号列表
    unreadAccountList List 群组消息未读账号列表

    V2NIMMessageRevokeParams

    消息撤回配置参数。

    Andoroid
    javapublic class V2NIMMessageRevokeParams {
    
        public String getPostscript() {
            return postscript;
        }
        public String getServerExtension() {
            return serverExtension;
        }
        public String getPushContent() {
            return pushContent;
        }
        public String getPushPayload() {
            return pushPayload;
        }
        public String getEnv() {
            return env;
        }
        public static final class V2NIMMessageRevokeParamsBuilder {
    
            public static V2NIMMessageRevokeParamsBuilder builder() {
                return new V2NIMMessageRevokeParamsBuilder();
            }
            public V2NIMMessageRevokeParamsBuilder withPostscript(String postscript) {
                this.postscript = postscript;
                return this;
            }
            public V2NIMMessageRevokeParamsBuilder withExtension(String extension) {
                this.extension = extension;
                return this;
            }
            public V2NIMMessageRevokeParamsBuilder withPushContent(String pushContent) {
                this.pushContent = pushContent;
                return this;
            }
            public V2NIMMessageRevokeParamsBuilder withPushPayload(String pushPayload) {
                this.pushPayload = pushPayload;
                return this;
            }
            public V2NIMMessageRevokeParamsBuilder withEnv(String env) {
                this.env = env;
                return this;
            }
            public V2NIMMessageRevokeParams build() {
                return new V2NIMMessageRevokeParams(postscript, extension, pushContent, pushPayload, env);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMMessageRevokeParams : NSObject
    @property(nullable, nonatomic, strong) NSString *postscript;
    @property(nullable, nonatomic, strong) NSString *serverExtension;
    @property (nullable, nonatomic, strong) NSString *pushContent;
    @property (nullable, nonatomic, strong) NSString *pushPayload;
    @property (nullable, nonatomic, strong) NSString *env;
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageRevokeParams {
        nstd::optional<nstd::string> postscript;
        nstd::optional<nstd::string> serverExtension;
        nstd::optional<nstd::string> pushContent;
        nstd::optional<nstd::string> pushPayload;
        nstd::optional<nstd::string> env;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageRevokeParams {
      postscript?: string
      serverExtension?: string
      pushContent?: string
      pushPayload?: string
      env?: string
    }
    
    Harmony
    typescriptexport interface V2NIMMessageRevokeParams {
    
      postscript?: string
      serverExtension?: string
      pushContent?: string
      pushPayload?: string
      env?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    postscript String null 附言
    serverExtension String null 服务端扩展字段。必须为 JSON 格式封装,多端同步,长度上限为 1024 字节。
    pushContent String null 推送文案
    pushPayload String null 推送 Payload
    env String null 消息抄送地址,必须与云信控制台开通配置的消息抄送地址一致。

    V2NIMMessageRevokeNotification

    消息撤回通知。

    Andoroid
    javapublic interface V2NIMMessageRevokeNotification extends Serializable {
    
        V2NIMMessageRefer getMessageRefer();
        String getServerExtension();
        String getRevokeAccountId();
        String getPostscript();
        V2NIMMessageRevokeType getRevokeType();
        String getCallbackExtension();
    }
    
    iOS
    @interface V2NIMMessageRevokeNotification : NSObject
    
    @property (nullable,nonatomic,strong,readonly) V2NIMMessageRefer *messageRefer;
    
    @property (nullable,nonatomic,strong,readonly) NSString *serverExtension;
    
    @property (nullable,nonatomic,strong,readonly) NSString *revokeAccountId;
    
    @property (nullable,nonatomic,strong,readonly) NSString *postscript;
    
    @property (nonatomic,assign,readonly) V2NIMMessageRevokeType revokeType;
    
    @property (nonatomic,strong,readonly) NSString *callbackExtension;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageRevokeNotification {
        V2NIMMessageRefer messageRefer;
        nstd::optional<nstd::string> serverExtension;
        nstd::optional<nstd::string> postscript;
        nstd::string revokeAccountId;
        V2NIMMessageRevokeType revokeType{V2NIM_MESSAGE_REOKE_TYPE_UNDEFINED};
        nstd::optional<nstd::string> callbackExtension;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageRevokeNotification {
      messageRefer: V2NIMMessageRefer
      serverExtension?: string
      revokeAccountId: string
      postscript?: string
      revokeType: V2NIMMessageRevokeType
      callbackExtension?: string
    }
    
    Harmony
    typescriptexport interface V2NIMMessageRevokeNotification {
    
      messageRefer: V2NIMMessageRefer
      serverExtension?: string
      revokeAccountId: string
      postscript?: string
      revokeType: V2NIMMessageRevokeType
      callbackExtension?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    messageRefer V2NIMMessageRefer 撤回消息的参考信息
    serverExtension String 服务端扩展字段,多端同步。
    revokeAccountId String 推送文案
    postscript String 附言
    revokeType V2NIMMessageRevokeType 消息撤回类型
    callbackExtension String 第三方回调透传的自定义扩展字段。
    第三方回调功能需要在云信控制台开通

    V2NIMMessageDeletedNotification

    消息删除通知。

    Andoroid
    javapublic interface V2NIMMessageDeletedNotification {
    
        V2NIMMessageRefer getMessageRefer();
    
        long getDeleteTime();
    
        String getServerExtension();
    }
    
    iOS
    objective-c@interface V2NIMMessageDeletedNotification : NSObject
    
    @property(nonatomic,strong,readonly) V2NIMMessageRefer *messageRefer;
    
    @property(nonatomic,assign,readonly) NSTimeInterval deleteTime;
    
    @property(nonatomic,strong,readonly) NSString *serverExtension;
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageDeletedNotification {
    
        V2NIMMessageRefer messageRefer;
    
        uint64_t deleteTime{0};
    
        nstd::optional<nstd::string> serverExtension;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageDeletedNotification {
    
      messageRefer: V2NIMMessageRefer
    
      deleteTime: number
    
      serverExtension?: string
    }
    
    Harmony
    typescriptexport interface V2NIMMessageDeletedNotification {
    
      messageRefer: V2NIMMessageRefer
      deleteTime: number
      serverExtension?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    messageRefer V2NIMMessageRefer 被删除消息的参考信息
    deleteTime long 删除时间戳
    serverExtension String 删除时传入的服务端扩展字段,多端同步。

    V2NIMMessageQuickCommentNotification

    消息快捷评论操作通知。

    Andoroid
    javapublic interface V2NIMMessageQuickCommentNotification {
        V2NIMMessageQuickCommentType getOperationType();
    
        V2NIMMessageQuickComment getQuickComment();
    }
    
    iOS
    objective-c@interface V2NIMMessageQuickCommentNotification : NSObject
    
    @property(nonatomic,assign) V2NIMMessageQuickCommentType operationType;
    
    @property(nonatomic,strong) V2NIMMessageQuickComment *quickComment;
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageQuickCommentNotification {
    
        V2NIMMessageQuickCommentType operationType{V2NIM_MESSAGE_QUICK_COMMENT_TYPE_ADD};
    
        V2NIMMessageQuickComment quickComment;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageQuickCommentNotification {
    
      operationType: V2NIMMessageQuickCommentType
    
      quickComment: V2NIMMessageQuickComment
    }
    
    Harmony
    typescriptexport interface V2NIMMessageQuickCommentNotification {
    
      operationType: V2NIMMessageQuickCommentType
      quickComment: V2NIMMessageQuickComment
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    operatorType V2NIMMessageQuickCommentType 快捷评论操作类型
    quickComment V2NIMMessageQuickComment 消息快捷评论信息

    V2NIMMessagePinNotification

    Pin 消息通知。

    Andoroid
    javapublic interface V2NIMMessagePinNotification {
        V2NIMMessagePinState getPinState();
    
        V2NIMMessagePin getPin();
    }
    
    iOS
    objective-c@interface V2NIMMessagePinNotification : NSObject
    
    @property (nullable,nonatomic,strong, readonly) V2NIMMessagePin *pin;
    
    @property (nonatomic,assign, readonly) V2NIMMessagePinState pinState;
    @end
    
    macOS/Windows
    cppstruct V2NIMMessagePinNotification {
    
        V2NIMMessagePinState pinState{V2NIM_MESSAGE_PIN_STEATE_NOT_PINNED};
    
        V2NIMMessagePin pin;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessagePinNotification {
      pinState: V2NIMMessagePinState
      pin: {
    
        messageRefer: V2NIMMessageRefer
    
        operatorId: string
    
        serverExtension: string
    
        createTime?: number
    
        updateTime: number
      }
    }
    
    Harmony
    typescriptexport interface V2NIMMessagePinNotification {
      pinState: V2NIMMessagePinState
      pin: {
        messageRefer: V2NIMMessageRefer
        operatorId: string
        serverExtension: string
        createTime?: number
        updateTime: number
      }
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    pinState V2NIMMessagePinState Pin 消息状态
    pin V2NIMMessagePin Pin 消息信息

    V2NIMClearHistoryMessageOption

    历史消息清空选项。

    Andoroid
    javapublic class V2NIMClearHistoryMessageOption {
        @NonNull
        public String getConversationId() {
            return conversationId;
        }
        public boolean isDeleteRoam() {
            return deleteRoam;
        }
        public boolean isOnlineSync() {
            return onlineSync;
        }
        public String getServerExtension() {
            return serverExtension;
        }
        public static final class V2NIMClearHistoryMessageOptionBuilder {
    
            public static V2NIMClearHistoryMessageOptionBuilder builder(@NonNull String conversationId) {
                return new V2NIMClearHistoryMessageOptionBuilder(conversationId);
            }
            public V2NIMClearHistoryMessageOptionBuilder withDeleteRoam(boolean deleteRoam) {
                this.deleteRoam = deleteRoam;
                return this;
            }
            public V2NIMClearHistoryMessageOptionBuilder withOnlineSync(boolean onlineSync) {
                this.onlineSync = onlineSync;
                return this;
            }
            public V2NIMClearHistoryMessageOptionBuilder withExtension(String extension) {
                this.extension = extension;
                return this;
            }
            public V2NIMClearHistoryMessageOption build() {
                return new V2NIMClearHistoryMessageOption(conversationId, deleteRoam, onlineSync, extension);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMClearHistoryMessageOption : NSObject<NSCopying>
    @property(nonatomic,strong,readwrite) NSString *conversationId;
    @property(nonatomic,assign,readwrite) BOOL deleteRoam;
    @property(nonatomic,assign,readwrite) BOOL onlineSync;
    @property(nonatomic,strong,readwrite) NSString *serverExtension;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMClearHistoryMessageOption {
        nstd::string conversationId;
        bool deleteRoam{true};
        bool onlineSync{false};
        nstd::optional<nstd::string> serverExtension;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMClearHistoryMessageOption {
      conversationId: string
      deleteRoam?: boolean
      onlineSync?: boolean
      serverExtension?: string
    }
    
    Harmony
    typescriptexport interface V2NIMClearHistoryMessageOption {
      conversationId: string
      deleteRoam?: boolean
      onlineSync?: boolean
      serverExtension?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    conversationId String - 历史消息所属的会话 ID,通过调用 V2NIMConversationIdUtil 的对应函数创建。组成方式: 用户账号(accountId)|会话类型(V2NIMConversationType)|聊天对象账号(accountId)或群组 ID。
    deleteRoam boolean true 是否同步删除漫游消息:
  • true:删除漫游消息
  • false:保留漫游消息
  • onlineSync boolean false 是否多端同步
    serverExtension String null 服务端扩展字段。必须为 JSON 格式封装,多端同步。

    V2NIMClearHistoryNotification

    会话历史消息清空通知。

    Andoroid
    javapublic interface V2NIMClearHistoryNotification {
        String getConversationId();
    
        long getDeleteTime();
    
        String getServerExtension();
    }
    
    iOS
    objective-c@interface V2NIMClearHistoryNotification : NSObject
    
    @property(nonatomic,strong,readonly) NSString *conversationId;
    
    @property(nonatomic,assign,readonly) NSTimeInterval deleteTime;
    
    @property(nonatomic,strong,readonly) NSString *serverExtension;
    @end
    
    macOS/Windows
    cppstruct V2NIMClearHistoryNotification {
    
        nstd::string conversationId;
    
        uint64_t deleteTime{0};
    
        nstd::optional<nstd::string> serverExtension;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMClearHistoryNotification {
      conversationId: string
      deleteTime: number
      serverExtension?: string
    }
    
    Harmony
    typescriptexport interface V2NIMClearHistoryNotification {
      conversationId: string
      deleteTime: number
      serverExtension?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    conversationId String 会话 ID
    deleteTime long 清空的时间戳
    serverExtension String 清空时传入的服务端扩展字段,多端同步。

    V2NIMMessageSearchParams

    历史消息全文检索查询参数。

    超大群不支持历史消息全文检索功能。

    Andoroid
    javapublic class V2NIMMessageSearchParams {
        public String getKeyword() {
            return keyword;
        }
        public long getBeginTime() {
            return beginTime;
        }
        public long getEndTime() {
            return endTime;
        }
        public int getConversationLimit() {
            return conversationLimit;
        }
        public int getMessageLimit() {
            return messageLimit;
        }
        public V2NIMSortOrder getSortOrder() {
            if (sortOrder == null) {
                return V2NIMSortOrder.V2NIM_SORT_ORDER_DESC;
            } else {
                return sortOrder;
            }
        }
        public List<String> getP2pAccountIds() {
            return p2pAccountIds;
        }
        public List<String> getTeamIds() {
            return teamIds;
        }
        public List<String> getSenderAccountIds() {
            return senderAccountIds;
        }
        public List<V2NIMMessageType> getMessageTypes() {
            return messageTypes;
        }
        public List<Integer> getMessageSubtypes() {
            return messageSubtypes;
        }
        @Override
        public String toString() {
            return "V2NIMMessageSearchParams{" +
                    "keyword='" + keyword + '\'' +
                    ", beginTime=" + beginTime +
                    ", endTime=" + endTime +
                    ", conversationLimit=" + conversationLimit +
                    ", messageLimit=" + messageLimit +
                    ", sortOrder=" + sortOrder +
                    ", p2pAccountIds=" + p2pAccountIds +
                    ", teamIds=" + teamIds +
                    ", senderAccountIds=" + senderAccountIds +
                    ", messageTypes=" + messageTypes +
                    ", messageSubtypes=" + messageSubtypes +
                    '}';
        }
    
        public static final class V2NIMMessageSearchParamsBuilder {
            public static V2NIMMessageSearchParamsBuilder builder(String keyword) {
                return new V2NIMMessageSearchParamsBuilder(keyword);
            }
            public V2NIMMessageSearchParamsBuilder withBeginTime(long beginTime) {
                this.beginTime = beginTime;
                return this;
            }
            public V2NIMMessageSearchParamsBuilder withEndTime(long endTime) {
                this.endTime = endTime;
                return this;
            }
            public V2NIMMessageSearchParamsBuilder withConversationLimit(int conversationLimit) {
                this.conversationLimit = conversationLimit;
                return this;
            }
            public V2NIMMessageSearchParamsBuilder withMessageLimit(int messageLimit) {
                this.messageLimit = messageLimit;
                return this;
            }
            public V2NIMMessageSearchParamsBuilder withSortOrder(V2NIMSortOrder sortOrder) {
                this.sortOrder = sortOrder;
                return this;
            }
            public V2NIMMessageSearchParamsBuilder withP2pAccountIds(List<String> p2pAccountIds) {
                this.p2pAccountIds = p2pAccountIds;
                return this;
            }
            public V2NIMMessageSearchParamsBuilder withTeamIds(List<String> teamIds) {
                this.teamIds = teamIds;
                return this;
            }
            public V2NIMMessageSearchParamsBuilder withSenderAccountIds(List<String> senderAccountIds) {
                this.senderAccountIds = senderAccountIds;
                return this;
            }
            public V2NIMMessageSearchParamsBuilder withMessageTypes(List<V2NIMMessageType> messageTypes) {
                this.messageTypes = messageTypes;
                return this;
            }
            public V2NIMMessageSearchParamsBuilder withMessageSubtypes(List<Integer> messageSubtypes) {
                this.messageSubtypes = messageSubtypes;
                return this;
            }
            public V2NIMMessageSearchParams build() {
                return new V2NIMMessageSearchParams(keyword, beginTime, endTime, conversationLimit, messageLimit, sortOrder, p2pAccountIds, teamIds, senderAccountIds, messageTypes, messageSubtypes);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMMessageSearchParams : NSObject
    @property (nonatomic,strong) NSString *keyword;
    @property (nonatomic,assign) NSTimeInterval beginTime;
    @property (nonatomic,assign) NSTimeInterval endTime;
    @property (nonatomic,assign) NSUInteger conversationLimit;
    @property (nonatomic,assign) NSUInteger messageLimit;
    @property (nonatomic,assign) V2NIMSortOrder sortOrder;
    @property (nonatomic,strong) NSArray <NSString *> *p2pAccountIds;
    @property (nonatomic,strong) NSArray <NSString *> *teamIds;
    @property (nonatomic,strong) NSArray <NSString *> *senderAccountIds;
    @property (nonatomic,strong) NSArray *messageTypes;
    @property (nonatomic,strong) NSArray *messageSubtypes;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMMessageSearchParams {
        nstd::string keyword;
        uint64_t beginTime{0};
        uint64_t endTime{0};
        uint32_t conversationLimit{0};
        uint32_t messageLimit{V2NIM_DEFAULT_SEARCH_MESSAGE_LIST_LIMIT};
        V2NIMSortOrder sortOrder{V2NIM_SORT_ORDER_DESC};
        nstd::vector<nstd::string> p2pAccountIds;
        nstd::vector<nstd::string> teamIds;
        nstd::vector<nstd::string> senderAccountIds;
        nstd::vector<V2NIMMessageType> messageTypes;
        nstd::vector<uint32_t> messageSubTypes;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMMessageSearchParams {
      keyword: string
      beginTime?: number
      endTime?: number
      conversationLimit?: number
      messageLimit?: number
      sortOrder?: V2NIMSortOrder
      p2pAccountIds?: string[]
      teamIds?: string[]
      senderAccountIds: string[]
      messageTypes?: V2NIMMessageType[]
      messageSubtypes?: number[]
    }
    
    Harmony
    typescriptexport interface V2NIMMessageSearchParams {
    
      keyword: string
      beginTime?: number
      endTime?: number
      conversationLimit?: number
      messageLimit?: number
      sortOrder?: V2NIMSortOrder
      p2pAccountIds?: string[]
      teamIds?: string[]
      senderAccountIds: string[]
      messageTypes?: V2NIMMessageType[]
      messageSubtypes?: number[]
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    keyword String - 检索关键字
    beginTime long 0 查询开始时间。该字段必须小于等于 endTime
    endTime long 0,即系统当前时间。 查询结束时间。该字段必须大于等于 beginTime
    conversationLimit int 0 本次检索的会话条数上限:
  • 设置为大于 0:查询结果按照会话分组显示。
  • 设置为小于或等于 0:查询结果按照时间排序。
  • messageLimit int 10 本次检索返回的消息条数上限,0 表示无限制。
    sortOrder V2NIMSortOrder V2NIM_SORT_ORDER_DESC 检索结果的排序规则,按照消息时间戳升序或降序排序。
    p2pAccountIds List null 单聊账号列表。最多传入 20 个账号,否则返回 191004 参数错误。
    teamIds List null 高级群账号列表。最多传入 20 个账号,否则返回 191004 参数错误。
    senderAccountIds List null 发送方账号列表。最多传入 20 个账号,否则返回 191004 参数错误。
    messageTypes List<V2NIMMessageType> null 或空,即查询所有消息类型。 消息类型
    messageSubtypes List null 或空,即查询所有消息子类型。 自定义消息子类型

    V2NIMClientAntispamResult

    文本消息客户端本地反垃圾结果。

    Andoroid
    javapublic interface V2NIMClientAntispamResult {
        V2NIMClientAntispamOperateType getOperateType();
        String getReplacedText();
    }
    
    iOS
    objective-c@interface V2NIMClientAntispamResult : NSObject
    @property (nonatomic, assign) V2NIMClientAntispamOperateType operateType;
    @property (nonatomic, copy) NSString *replacedText;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMClientAntispamResult {
        V2NIMClientAntispamOperateType operateType{V2NIM_CLIENT_ANTISPAM_OPERATE_NONE};
        nstd::string replacedText;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMClientAntispamResult {
      operateType: V2NIMClientAntispamOperatorType
      replacedText: string
    }
    
    Harmony
    typescriptexport interface V2NIMClientAntispamResult {
    
      operateType: V2NIMClientAntispamOperatorType
      replacedText: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    operateType V2NIMClientAntispamOperateType 反垃圾命中后的操作类型
    replacedText String 替换处理后的文本内容

    V2NIMVoiceToTextParams

    语音转文字配置参数。

    Andoroid
    javapublic class V2NIMVoiceToTextParams {
    
        public String getVoicePath() {
            return voicePath;
        }
    
        public String getVoiceUrl() {
            return voiceUrl;
        }
    
        public String getMimeType() {
            return mimeType;
        }
    
        public String getSampleRate() {
            return sampleRate;
        }
    
        public long getDuration() {
            return duration;
        }
    
        public String getSceneName() {
            if (TextUtils.isEmpty(sceneName)) {
                return V2NIMStorageSceneConfig.DEFAULT_IM.getSceneName();
            } else {
                return sceneName;
            }
        }
    
        @Override
        public String toString() {
            return "V2NIMVoiceToTextParams{" +
                    "voicePath='" + voicePath + '\'' +
                    ", voiceUrl='" + voiceUrl + '\'' +
                    ", mimeType='" + mimeType + '\'' +
                    ", sampleRate='" + sampleRate + '\'' +
                    ", duration=" + duration +
                    ", sceneName='" + sceneName + '\'' +
                    '}';
        }
    
    
        public static final class V2NIMVoiceToTextParamsBuilder {
    
            public static V2NIMVoiceToTextParamsBuilder builder(final long duration) {
                return new V2NIMVoiceToTextParamsBuilder(duration);
            }
    
            public V2NIMVoiceToTextParamsBuilder withVoicePath(String voicePath) {
                this.voicePath = voicePath;
                return this;
            }
    
            public V2NIMVoiceToTextParamsBuilder withVoiceUrl(String voiceUrl) {
                this.voiceUrl = voiceUrl;
                return this;
            }
    
            public V2NIMVoiceToTextParamsBuilder withMimeType(String mimeType) {
                this.mimeType = mimeType;
                return this;
            }
    
            public V2NIMVoiceToTextParamsBuilder withSampleRate(String sampleRate) {
                this.sampleRate = sampleRate;
                return this;
            }
    
            public V2NIMVoiceToTextParamsBuilder withSceneName(String sceneName) {
                this.sceneName = sceneName;
                return this;
            }
    
            public V2NIMVoiceToTextParams build() {
                return new V2NIMVoiceToTextParams(voicePath, voiceUrl, mimeType, sampleRate, duration, sceneName);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMVoiceToTextParams : NSObject
    
    @property (nonatomic, strong) NSString *voicePath;
    
    @property (nonatomic, strong) NSString *voiceUrl;
    
    @property (nonatomic, strong) NSString *mimeType;
    
    @property (nonatomic, strong) NSString *sampleRate;
    
    @property (nonatomic, assign) NSTimeInterval duration;
    
    @property (nonatomic, strong) NSString *sceneName;
    @end
    
    macOS/Windows
    cppstruct V2NIMVoiceToTextParams {
    
        nstd::string voicePath;
    
        nstd::string voiceUrl;
    
        nstd::string mimeType;
    
        nstd::string sampleRate;
    
        uint64_t duration{0};
    
        nstd::string sceneName;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMVoiceToTextParams {
    
      voicePath?: string
    
      file?: File
    
      voiceUrl?: string
    
      duration: number
    
      mimeType?: string
    
      sampleRate?: string
    
      sceneName?: string
    }
    
    
    Harmony
    typescriptexport interface V2NIMVoiceToTextParams {
    
      voicePath?: string
      voiceUrl?: string
      duration: number
      mimeType?: string
      sampleRate?: string
      sceneName?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    voicePath String voiceUrl 必须设置其一 - 语音文件本地路径。
    请确保该路径存在且可用。
    file Web File
  • Web 端(除小程序):与 voicePath/voiceUrl 必须设置其一
  • 其他端不设置该字段
  • - Web File 对象。
    voiceUrl String voicePath 必须设置其一 - 语音文件 URL 地址
    mimeType String null 音频类型,例如 aac, wav, mp3, amr 等。
    sampleRate String null 音频采样率,单位为 kHz。
    duration long - 语音文件时长,单位为毫秒。
    sceneName String V2NIMStorageSceneConfig.DEFAULT_IM 对应的场景名 NOS 文件存储场景名。若使用自定义的存储场景,需要先调用 V2NIMStorageService.addCustomStorageScene 添加自定义存储场景。

    V2NIMStorageScene

    NOS 文件存储场景信息。

    Andoroid
    javapublic interface V2NIMStorageScene {
    
        String getSceneName();
    
        long getExpireTime();
    
    }
    
    iOS
    objective-c@interface V2NIMStorageScene : NSObject
    @property (nullable,nonatomic,strong) NSString *sceneName;
    @property (nonatomic,assign) NSUInteger expireTime;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMStorageScene {
        nstd::string sceneName;
        uint64_t expireTime{0};
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMStorageScene {
      sceneName: string
      expireTime?: number
    }
    
    Harmony
    typescriptexport interface V2NIMStorageScene {
    
      sceneName: string
      expireTime?: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    sceneName String NOS 文件存储场景名称
    expireTime long 该场景下文件资源的过期时间,单位秒。必须大于等于 0,0 表示永不过期。

    V2NIMStorageSceneConfig

    NOS 文件存储场景配置。

    Andoroid
    javapublic interface V2NIMStorageSceneConfig {
    
        V2NIMStorageScene DEFAULT_PROFILE = new V2NIMStorageSceneImpl("nim_default_profile_icon", 0);
        
        V2NIMStorageScene DEFAULT_IM = new V2NIMStorageSceneImpl("nim_default_im", 0);
        
        V2NIMStorageScene DEFAULT_SYSTEM = new V2NIMStorageSceneImpl("nim_system_nos_scene", 0);
        
        V2NIMStorageScene SECURITY_LINK = new V2NIMStorageSceneImpl("nim_security", 0);
    
    }
    
    iOS
    objective-c@interface V2NIMStorageSceneConfig : NSObject
    
    + (V2NIMStorageScene *)DEFAULT_PROFILE;
    + (V2NIMStorageScene *)DEFAULT_IM;
    + (V2NIMStorageScene *)DEFAULT_SYSTEM;
    + (V2NIMStorageScene *)SECURITY_LINK;
    @end
    
    macOS/Windows
    cppstatic const char* V2NIM_STORAGE_SCENE_NAME_DEFAULT_PROFILE{"nim_default_profile_icon"};
    static const char* V2NIM_STORAGE_SCENE_NAME_DEFAULT_IM{"nim_default_im"};
    static const char* V2NIM_STORAGE_SCENE_NAME_DEFAULT_SYSTEM{"nim_system_nos_scene"};
    static const char* V2NIM_STORAGE_SCENE_NAME_SECURITY_LINK{"nim_security"};
    
    Web/uni-app/小程序
    typescriptexport class V2NIMStorageSceneConfig {
    
      static DEFAULT_PROFILE(): V2NIMStorageScene {
        return {
          sceneName: 'nim_default_profile_icon',
          expireTime: 0
        }
      }
    
      static DEFAULT_IM(): V2NIMStorageScene {
        return {
          sceneName: 'nim_default_im',
          expireTime: 0
        }
      }
    
      static DEFAULT_SYSTEM():V2NIMStorageScene {
        return {
          sceneName: 'nim_system_nos_scene',
          expireTime: 0
        }
      }
    
      static SECURITY_LINK():V2NIMStorageScene {
        return {
          sceneName: 'nim_security',
          expireTime: 0
        }
      }
    }
    
    Harmony
    typescriptexport class V2NIMStorageSceneConfig {
    
      static DEFAULT_PROFILE(): V2NIMStorageScene {
        return {
          sceneName: 'nim_default_profile_icon',
          expireTime: 0
        }
      }
    
      static DEFAULT_IM(): V2NIMStorageScene {
        return {
          sceneName: 'nim_default_im',
          expireTime: 0
        }
      }
    
      static DEFAULT_SYSTEM():V2NIMStorageScene {
        return {
          sceneName: 'nim_system_nos_scene',
          expireTime: 0
        }
      }
    
      static SECURITY_LINK():V2NIMStorageScene {
        return {
          sceneName: 'nim_security',
          expireTime: 0
        }
      }
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 默认值 描述
    DEFAULT_PROFILE V2NIMStorageScene
  • sceneName:nim_default_profile_icon
  • expireTime:0
  • 默认场景,用于用户、群组资料的上传场景。
    DEFAULT_IM V2NIMStorageScene
  • nim_default_im
  • expireTime:0
  • IM 场景,用于文件的上传场景。
    DEFAULT_SYSTEM V2NIMStorageScene
  • nim_system_nos_scene
  • expireTime:0
  • 系统场景,用于 SDK 内部文件的上传场景。
    SECURITY_LINK V2NIMStorageScene
  • nim_security
  • expireTime:0
  • 安全链接场景,查看该场景的上传文件需要密钥。

    V2NIMCustomNotification

    自定义通知。

    Andoroid
    javapublic interface V2NIMCustomNotification {
        String getSenderId();
    
        String getReceiverId();
    
        V2NIMConversationType getConversationType();
    
        long getTimestamp();
    
        String getContent();
    
        V2NIMNotificationConfig getNotificationConfig();
    
        V2NIMNotificationPushConfig getPushConfig();
    
        V2NIMNotificationAntispamConfig getAntispamConfig();
    
        V2NIMNotificationRouteConfig getRouteConfig();
    }
    
    iOS
    objective-c@interface V2NIMCustomNotification : NSObject
    
    @property(nullable,nonatomic,strong,readonly) NSString *senderId;
    
    @property(nullable,nonatomic,strong,readonly) NSString *receiverId;
    
    @property(nonatomic,assign,readonly) V2NIMConversationType conversationType;
    
    @property(nonatomic,assign,readonly) NSTimeInterval timestamp;
    
    @property(nullable,nonatomic,strong,readonly) NSString *content;
    
    @property(nullable,nonatomic,strong,readonly) V2NIMNotificationConfig *notificationConfig;
    
    @property(nullable,nonatomic,strong,readonly) V2NIMNotificationPushConfig *pushConfig;
    
    @property(nullable,nonatomic,strong,readonly) V2NIMNotificationAntispamConfig *antispamConfig;
    
    @property(nullable,nonatomic,strong,readonly) V2NIMNotificationRouteConfig *routeConfig;
    @end
    
    macOS/Windows
    cppstruct V2NIMCustomNotification {
    
        nstd::string senderId;
    
        nstd::string receiverId;
    
        V2NIMConversationType conversationType{V2NIM_CONVERSATION_TYPE_UNKNOWN};
    
        uint64_t timestamp{0};
    
        nstd::string content;
    
        V2NIMNotificationConfig notificationConfig;
    
        V2NIMNotificationPushConfig pushConfig;
    
        V2NIMNotificationAntispamConfig antispamConfig;
    
        V2NIMNotificationRouteConfig routeConfig;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMCustomNotification {
    
      senderId: string
    
      receiverId: string
    
      conversationType: V2NIMConversationType
    
      timestamp: number
    
      content: string
    
      notificationConfig?: V2NIMNotificationConfig
    
      pushConfig?: V2NIMNotificationPushConfig
    
      antispamConfig?: V2NIMNotificationAntispamConfig
    
      routeConfig?: V2NIMNotificationRouteConfig
    }
    
    Harmony
    typescriptexport interface V2NIMCustomNotification {
    
      senderId: string
      receiverId: string
      conversationType: V2NIMConversationType
      timestamp: number
      content: string
      notificationConfig?: V2NIMNotificationConfig
      pushConfig?: V2NIMNotificationPushConfig
      antispamConfig?: V2NIMNotificationAntispamConfig
      routeConfig?: V2NIMNotificationRouteConfig
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    senderId String 自定义通知发送方账号(accountId)
    receiverId String 自定义通知发送方账号(accountId)
  • 如果会话类型为单聊,该字段为聊天对象账号 accountId。
  • 如果会话类型为群组,该字段为群组 ID。
  • conversationType V2NIMConversationType 消息所属会话类型:单聊/高级群/超大群
    timestamp long 自定义通知时间戳
    content String 自定义通知内容,必须封装为 JSON 格式,长度上限为 4096 字节。
    notificationConfig V2NIMNotificationConfig 通知相关配置
    pushConfig V2NIMNotificationPushConfig 第三方推送相关配置。
    第三方推送功能需要在云信控制台配置
    antispamConfig V2NIMNotificationAntispamConfig 反垃圾相关配置。
    反垃圾功能包括客户端反垃圾和安全通,均需要在云信控制台开通
    routeConfig V2NIMNotificationRouteConfig 系统通知事件抄送相关配置。
    消息抄送功能需要在云信控制台开通

    V2NIMNotificationConfig

    系统通知相关配置。

    Andoroid
    javapublic class V2NIMNotificationConfig {
    
        public boolean isOfflineEnabled() {
            return offlineEnabled;
        }
    
        public boolean isUnreadEnabled() {
            return unreadEnabled;
        }
    
        public static final boolean DEFAULT_OFFLINE_ENABLED = true;
        public static final boolean DEFAULT_UNREAD_ENABLED = true;
    
        public static final class V2NIMNotificationConfigBuilder {
    
            public static V2NIMNotificationConfigBuilder builder() {
                return new V2NIMNotificationConfigBuilder();
            }
    
            public V2NIMNotificationConfigBuilder withOfflineEnabled(boolean offlineEnabled) {
                this.offlineEnabled = offlineEnabled;
                return this;
            }
    
            public V2NIMNotificationConfigBuilder withUnreadEnabled(boolean unreadEnabled) {
                this.unreadEnabled = unreadEnabled;
                return this;
            }
    
            public V2NIMNotificationConfig build() {
                return new V2NIMNotificationConfig(offlineEnabled, unreadEnabled);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMNotificationConfig : NSObject
    
    @property(nonatomic,assign,readwrite) BOOL offlineEnabled;
    
    @property(nonatomic,assign,readwrite) BOOL unreadEnabled;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMNotificationConfig {
    
        bool offlineEnabled{true};
    
        bool unreadEnabled{true};
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMNotificationConfig {
    
      offlineEnabled: boolean
    
      unreadEnabled: boolean
    }
    
    Harmony
    typescriptexport interface V2NIMNotificationConfig {
    
      offlineEnabled: boolean
      unreadEnabled: boolean
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    offlineEnabled boolean true 是否需要保存离线通知:
  • true:需要保存。
  • false:不需要保存,仅在线用户接收通知。
  • unreadEnabled boolean true 是否需要计入通知未读数

    V2NIMNotificationPushConfig

    系统通知第三方推送相关配置。

    Andoroid
    javapublic class V2NIMNotificationPushConfig {
        
            public boolean isPushEnabled() {
                return pushEnabled;
            }
        
            public boolean isPushNickEnabled() {
                return pushNickEnabled;
            }
        
            public String getPushContent() {
                return pushContent;
            }
        
            public String getPushPayload() {
                return pushPayload;
            }
        
            public boolean isForcePush() {
                return forcePush;
            }
        
            public String getForcePushContent() {
                return forcePushContent;
            }
        
            public List<String> getForcePushAccountIds() {
                return forcePushAccountIds;
            }
        
            public static final boolean DEFAULT_PUSH_ENABLE = V2NIMMessagePushConfig.DEFAULT_PUSH_ENABLE;
            public static final boolean DEFAULT_PUSH_NICK_ENABLE = V2NIMMessagePushConfig.DEFAULT_PUSH_NICK_ENABLE;
        
            public static final class V2NIMNotificationPushConfigBuilder {
        
                public static V2NIMNotificationPushConfigBuilder builder() {
                    return new V2NIMNotificationPushConfigBuilder();
                }
        
                public V2NIMNotificationPushConfigBuilder withPushEnabled(boolean pushEnabled) {
                    this.pushEnabled = pushEnabled;
                    return this;
                }
        
                public V2NIMNotificationPushConfigBuilder withPushNickEnabled(boolean pushNickEnabled) {
                    this.pushNickEnabled = pushNickEnabled;
                    return this;
                }
        
                public V2NIMNotificationPushConfigBuilder withPushContent(String pushContent) {
                    this.pushContent = pushContent;
                    return this;
                }
        
                public V2NIMNotificationPushConfigBuilder withPushPayload(String pushPayload) {
                    this.pushPayload = pushPayload;
                    return this;
                }
        
                public V2NIMNotificationPushConfigBuilder withForcePush(boolean forcePush) {
                    this.forcePush = forcePush;
                    return this;
                }
        
                public V2NIMNotificationPushConfigBuilder withForcePushContent(String forcePushContent) {
                    this.forcePushContent = forcePushContent;
                    return this;
                }
        
                public V2NIMNotificationPushConfigBuilder withForcePushAccountIds(List<String> forcePushAccountIds) {
                    this.forcePushAccountIds = forcePushAccountIds;
                    return this;
                }
        
                public V2NIMNotificationPushConfig build() {
                    return new V2NIMNotificationPushConfig(pushEnabled, pushNickEnabled, pushContent, pushPayload, forcePush, forcePushContent, forcePushAccountIds);
                }
            }
        }
    
    iOS
    objective-c@interface V2NIMNotificationPushConfig : NSObject
    
    @property(nonatomic,assign,readwrite) BOOL pushEnabled;
    
    @property(nonatomic,assign,readwrite) BOOL pushNickEnabled;
    
    @property(nonatomic,strong,readwrite) NSString *pushContent;
    
    @property(nonatomic,strong,readwrite) NSString *pushPayload;
    
    @property(nonatomic,assign,readwrite) BOOL forcePush;
    
    @property(nonatomic,strong,readwrite) NSString *forcePushContent;
    
    @property(nonatomic,strong,readwrite) NSArray *forcePushAccountIds;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMNotificationPushConfig {
    
        bool pushEnabled{true};
    
        bool pushNickEnabled{true};
    
        nstd::string pushContent;
    
        nstd::string pushPayload;
    
        bool forcePush{false};
    
        nstd::string forcePushContent;
    
        nstd::vector<nstd::string> forcePushAccountIds;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMNotificationPushConfig {
    
      pushEnabled: boolean
    
      pushNickEnabled: boolean
    
      pushContent: string
    
      pushPayload: string
    
      forcePush: boolean
    
      forcePushContent: string
    
      forcePushAccounts: string[]
    }
    
    Harmony
    typescriptexport interface V2NIMNotificationPushConfig {
    
      pushEnabled: boolean
      pushNickEnabled: boolean
      pushContent: string
      pushPayload: string
      forcePush: boolean
      forcePushContent: string
      forcePushAccounts: string[]
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    pushEnabled boolean true 是否需要推送通知
    pushNickEnabled boolean true 是否需要推送通知发送方昵称
    pushContent String pushEnabled 为 true 则为必填 - 推送文案
    pushPayload String 如果 pushEnabled 为 true 则为必填 - 推送 Payload
    forcePush boolean false 是否忽略用户通知提醒相关设置,强制推送。
    forcePushContent String forcePush 为 true 则为必填 - 强制推送文案
    forcePushAccountIds List forcePush 为 true 则为必填 - 强制推送目标账号列表

    V2NIMNotificationRouteConfig

    系统通知事件抄送相关配置。

    Andoroid
    javapublic class V2NIMNotificationRouteConfig implements Serializable {
        
            public boolean isRouteEnabled() {
                return routeEnabled;
            }
        
            public String getRouteEnvironment() {
                return routeEnvironment;
            }
        
            @Override
            public String toString() {
                return "V2NIMMessageRouteConfig{" +
                        "routeEnabled=" + routeEnabled +
                        ", routeEnvironment='" + routeEnvironment + '\'' +
                        '}';
            }
        
            public static final boolean DEFAULT_ROUTE_ENABLE = true;
        
            public static final class V2NIMNotificationRouteConfigBuilder {
        
                public static V2NIMNotificationRouteConfigBuilder builder() {
                    return new V2NIMNotificationRouteConfigBuilder();
                }
        
                public V2NIMNotificationRouteConfigBuilder withRouteEnabled(boolean routeEnabled) {
                    this.routeEnabled = routeEnabled;
                    return this;
                }
        
                public V2NIMNotificationRouteConfigBuilder withRouteEnvironment(String routeEnvironment) {
                    this.routeEnvironment = routeEnvironment;
                    return this;
                }
        
                public V2NIMNotificationRouteConfig build() {
                    return new V2NIMNotificationRouteConfig(routeEnabled, routeEnvironment);
                }
            }
        }
    
    iOS
    objective-c@interface V2NIMNotificationRouteConfig : NSObject
    
    @property(nonatomic,assign,readwrite) BOOL routeEnabled;
    
    @property(nonatomic,strong,readwrite) NSString *routeEnvironment;
    @end
    
    macOS/Windows
    cppstruct V2NIMNotificationRouteConfig {
    
        bool routeEnabled{true};
    
        nstd::optional<nstd::string> routeEnvironment;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMNotificationRouteConfig {
    
      routeEnabled: boolean
    
      routeEnvironment: string
    }
    
    Harmony
    typescriptexport interface V2NIMNotificationRouteConfig {
    
      routeEnabled: boolean
      routeEnvironment: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    routeEnabled boolean true 是否需要系统通知事件抄送
    routeEnvironment String routeEnabled 为 true 则为必填 - 环境变量,用于指向不同系统通知事件抄送、第三方回调等配置。

    V2NIMNotificationAntispamConfig

    系统通知反垃圾配置,包括本地反垃圾和安全通的相关配置。

    Andoroid
    javapublic class V2NIMNotificationAntispamConfig {
        
            public V2NIMNotificationAntispamConfig() {
                this(DEFAULT_ANTISPAM_ENABLED, null);
            }
        
            public V2NIMNotificationAntispamConfig(boolean antispamEnabled, String antispamCustomNotification) {
                this.antispamEnabled = antispamEnabled;
                this.antispamCustomNotification = antispamCustomNotification;
            }
        
            public boolean isAntispamEnabled() {
                return antispamEnabled;
            }
        
            public String getAntispamCustomNotification() {
                return antispamCustomNotification;
            }
        
            public static final boolean DEFAULT_ANTISPAM_ENABLED = true;
        
            public static final class V2NIMNotificationAntispamConfigBuilder {
        
                public static V2NIMNotificationAntispamConfigBuilder builder() {
                    return new V2NIMNotificationAntispamConfigBuilder();
                }
        
                public V2NIMNotificationAntispamConfigBuilder withAntispamEnabled(boolean antispamEnabled) {
                    this.antispamEnabled = antispamEnabled;
                    return this;
                }
        
                public V2NIMNotificationAntispamConfigBuilder withAntispamCustomNotification(String antispamCustomNotification) {
                    this.antispamCustomNotification = antispamCustomNotification;
                    return this;
                }
        
                public V2NIMNotificationAntispamConfig build() {
                    return new V2NIMNotificationAntispamConfig(antispamEnabled, antispamCustomNotification);
                }
            }
        }
    
    iOS
    objective-c@interface V2NIMNotificationAntispamConfig : NSObject
    
    @property(nonatomic,assign,readwrite) BOOL antispamEnabled;
    
    @property(nonatomic,strong,readwrite) NSString *antispamCustomNotification;
    @end
    
    macOS/Windows
    cppstruct V2NIMNotificationAntispamConfig {
    
        nstd::optional<bool> antispamEnabled;
    
        nstd::optional<nstd::string> antispamCustomMessage;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMNotificationAntispamConfig {
    
      antispamEnabled: boolean
    
      antispamCustomNotification: string
    }
    
    Harmony
    typescriptexport interface V2NIMNotificationAntispamConfig {
    
      antispamEnabled: boolean
      antispamCustomNotification: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    antispamEnabled boolean true 是否对该系统通知启用安全通检测。
    antispamCustomNotification String antispamEnabled 为 true 时必填 - 系统通知中需要反垃圾的内容,必须是 JSON 格式,长度不超过 5000 字节。格式如下 { "type": 1, //1:文本,2:图片,3视频 "data": "" //文本内容or图片地址or视频地址 }

    V2NIMSendCustomNotificationParams

    自定义通知发送参数。

    Andoroid
    javapublic class V2NIMSendCustomNotificationParams {
        
            public V2NIMNotificationConfig getNotificationConfig() {
                return notificationConfig;
            }
        
            public V2NIMNotificationPushConfig getPushConfig() {
                return pushConfig;
            }
        
            public V2NIMNotificationAntispamConfig getAntispamConfig() {
                return antispamConfig;
            }
        
            public V2NIMNotificationRouteConfig getRouteConfig() {
                return routeConfig;
            }
        
        
            public static final class V2NIMSendCustomNotificationParamsBuilder {
        
                public static V2NIMSendCustomNotificationParamsBuilder builder() {
                    return new V2NIMSendCustomNotificationParamsBuilder();
                }
        
                public V2NIMSendCustomNotificationParamsBuilder withNotificationConfig(V2NIMNotificationConfig notificationConfig) {
                    this.notificationConfig = notificationConfig;
                    return this;
                }
        
                public V2NIMSendCustomNotificationParamsBuilder withPushConfig(V2NIMNotificationPushConfig pushConfig) {
                    this.pushConfig = pushConfig;
                    return this;
                }
        
                public V2NIMSendCustomNotificationParamsBuilder withAntispamConfig(V2NIMNotificationAntispamConfig antispamConfig) {
                    this.antispamConfig = antispamConfig;
                    return this;
                }
        
                public V2NIMSendCustomNotificationParamsBuilder withRouteConfig(V2NIMNotificationRouteConfig routeConfig) {
                    this.routeConfig = routeConfig;
                    return this;
                }
        
                public V2NIMSendCustomNotificationParams build() {
                    return new V2NIMSendCustomNotificationParams(notificationConfig, pushConfig, antispamConfig, routeConfig);
                }
            }
        }
    
    iOS
    objective-c@interface V2NIMSendCustomNotificationParams : NSObject
    
    @property(nonatomic,strong) V2NIMNotificationConfig *notificationConfig;
    
    @property(nonatomic,strong) V2NIMNotificationPushConfig *pushConfig;
    
    @property(nonatomic,strong) V2NIMNotificationAntispamConfig *antispamConfig;
    
    @property(nonatomic,strong) V2NIMNotificationRouteConfig *routeConfig;
    @end
    
    macOS/Windows
    cppstruct V2NIMSendCustomNotificationParams {
    
        V2NIMNotificationConfig notificationConfig;
    
        V2NIMNotificationPushConfig pushConfig;
    
        V2NIMNotificationAntispamConfig antispamConfig;
    
        V2NIMNotificationRouteConfig routeConfig;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMSendCustomNotificationParams {
    
      notificationConfig?: V2NIMNotificationConfig
    
      pushConfig?: V2NIMNotificationPushConfig
    
      antispamConfig?: V2NIMNotificationAntispamConfig
    
      routeConfig?: V2NIMNotificationRouteConfig
    }
    
    Harmony
    typescriptexport interface V2NIMSendCustomNotificationParams {
    
      notificationConfig?: V2NIMNotificationConfig
      pushConfig?: V2NIMNotificationPushConfig
      antispamConfig?: V2NIMNotificationAntispamConfig
      routeConfig?: V2NIMNotificationRouteConfig
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    notificationConfig V2NIMNotificationConfig 通知相关配置
    pushConfig V2NIMNotificationPushConfig 第三方推送相关配置。
    第三方推送功能需要在云信控制台配置
    antispamConfig V2NIMNotificationAntispamConfig 反垃圾相关配置。
    反垃圾功能包括客户端反垃圾和安全通,均需要在云信控制台开通
    routeConfig V2NIMNotificationRouteConfig 系统通知事件抄送相关配置。
    消息抄送功能需要在云信控制台开通

    V2NIMBroadcastNotification

    广播通知。

    Andoroid
    javapublic interface V2NIMBroadcastNotification {
            long getId();
        
            String getSenderId();
        
            long getTimestamp();
        
            String getContent();
    }
    
    iOS
    objective-c@interface V2NIMBroadcastNotification : NSObject
    
    @property(nonatomic,assign,readonly) NSUInteger id;
    
    @property(nonatomic,strong,readonly) NSString *senderId;
    
    @property(nonatomic,assign,readonly) NSTimeInterval timestamp;
    
    @property(nonatomic,strong,readonly) NSString *content;
    @end
    
    macOS/Windows
    cppstruct V2NIMBroadcastNotification {
    
        uint64_t id;
    
        nstd::string senderId;
    
        uint64_t timestamp;
    
        nstd::string content;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMBroadcastNotification {
    
      id: string
    
      senderId: string
    
      time: number
    
      content: string
    }
    
    Harmony
    typescriptexport interface V2NIMBroadcastNotification {
    
      id: string
      senderId: string
      time: number
      content: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    id String 广播通知 ID
    senderId String 广播通知发送方账号(accountId)
    timestamp long 广播通知时间戳
    content String 广播通知内容,必须为 JSON 格式

    V2NIMNotificationListener

    系统通知相关监听器。

    Andoroid
    javapublic interface V2NIMNotificationListener {
    
        void onReceiveCustomNotifications(List<V2NIMCustomNotification> customNotifications);
    
        void onReceiveBroadcastNotifications(List<V2NIMBroadcastNotification> broadcastNotifications);
    }
    
    iOS
    objective-c@protocol V2NIMNotificationListener <NSObject>
    
    - (void)onReceiveCustomNotifications:(NSArray <V2NIMCustomNotification *> *)customNotifications;
    
    - (void)onReceiveBroadcastNotifications:(NSArray <V2NIMBroadcastNotification *> *)boradcastNotifications;
    
    @end
    
    macOS/Windows
    cppcationListener {
    
        nstd::function<void(nstd::vector<V2NIMCustomNotification> customNotification)> onReceiveCustomNotifications;
    
        nstd::function<void(nstd::vector<V2NIMBroadcastNotification> broadcastNotification)> onReceiveBroadcastNotifications;
    };
    

    成员函数

    • onReceiveCustomNotifications

      自定义通知接收回调,本端接收到发送方自定义通知,或其他端同步的自定义通知时会触发该回调。

      参数名称 类型 描述
      customNotifications List<V2NIMCustomNotification> 自定义通知列表
    • onReceiveBroadcastNotifications

      广播通知接收回调。

      本端接收到服务端下发的广播通知时会触发该回调。

      参数名称 类型 描述
      boradcastNotifications List<V2NIMBroadcastNotification> 广播通知列表

    V2NIMTeam

    群组对象。

    Andoroid
    javapublic interface V2NIMTeam extends Serializable {
        String getTeamId();
    
        V2NIMTeamType getTeamType();
    
        String getName();
    
        String getOwnerAccountId();
    
        int getMemberLimit();
    
        int getMemberCount();
    
        long getCreateTime();
    
        long getUpdateTime();
    
        String getIntro();
    
        String getAnnouncement();
    
        String getAvatar();
    
        String getServerExtension();
    
        String getCustomerExtension();
    
        V2NIMTeamJoinMode getJoinMode();
    
        V2NIMTeamAgreeMode getAgreeMode();
    
        V2NIMTeamInviteMode getInviteMode();
    
        V2NIMTeamUpdateInfoMode getUpdateInfoMode();
    
        V2NIMTeamUpdateExtensionMode getUpdateExtensionMode();
    
        V2NIMTeamChatBannedMode getChatBannedMode();
    
        boolean isValidTeam();
    }
    
    iOS
    objective-c@interface V2NIMTeam : NSObject <NSCopying>
    
    @property(nonatomic,copy,readonly) NSString *teamId;
    
    @property(nonatomic,assign,readonly) V2NIMTeamType teamType;
    
    @property(nonatomic,copy,readonly) NSString *name;
    
    @property(nonatomic,copy,readonly) NSString *ownerAccountId;
    
    @property(nonatomic,assign,readonly) NSInteger memberLimit;
    
    @property(nonatomic,assign,readonly) NSInteger memberCount;
    
    @property(nonatomic,assign,readonly) NSTimeInterval createTime;
    
    @property(nonatomic,assign,readonly) NSTimeInterval updateTime;
    
    @property(nullable,nonatomic,copy,readonly) NSString *intro;
    
    @property(nullable,nonatomic,copy,readonly) NSString *announcement;
    
    @property(nullable,nonatomic,copy,readonly) NSString *avatar;
    
    @property(nullable,nonatomic,copy,readonly) NSString *serverExtension;
    
    @property(nullable,nonatomic,copy,readonly) NSString *customerExtension;
    
    @property(nonatomic,assign,readonly) V2NIMTeamJoinMode joinMode;
    
    @property(nonatomic,assign,readonly) V2NIMTeamAgreeMode agreeMode;
    
    @property(nonatomic,assign,readonly) V2NIMTeamInviteMode inviteMode;
    
    @property(nonatomic,assign,readonly) V2NIMTeamUpdateInfoMode updateInfoMode;
    
    @property(nonatomic,assign,readonly) V2NIMTeamUpdateExtensionMode updateExtensionMode;
    
    @property(nonatomic,assign,readonly) V2NIMTeamChatBannedMode chatBannedMode;
    
    @property(nonatomic,assign,readonly) BOOL isValidTeam;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMTeam {
        nstd::string teamId;
        V2NIMTeamType teamType{V2NIM_TEAM_TYPE_NORMAL};
        nstd::string name;
        nstd::string ownerAccountId;
        uint32_t memberLimit{0};
        uint32_t memberCount{0};
        uint64_t createTime{0};
        uint64_t updateTime{0};
        nstd::optional<nstd::string> intro;
        nstd::optional<nstd::string> announcement;
        nstd::optional<nstd::string> avatar;
        nstd::optional<nstd::string> serverExtension;
        nstd::optional<nstd::string> customerExtension;
        V2NIMTeamJoinMode joinMode{V2NIM_TEAM_JOIN_MODE_APPLY};
        V2NIMTeamAgreeMode agreeMode{V2NIM_TEAM_AGREE_MODE_AUTH};
        V2NIMTeamInviteMode inviteMode{V2NIM_TEAM_INVITE_MODE_MANAGER};
        V2NIMTeamUpdateInfoMode updateInfoMode{V2NIM_TEAM_UPDATE_INFO_MODE_MANAGER};
        V2NIMTeamUpdateExtensionMode updateExtensionMode{V2NIM_TEAM_UPDATE_EXTENSION_MODE_MANAGER};
        V2NIMTeamChatBannedMode chatBannedMode{V2NIM_TEAM_CHAT_BANNED_MODE_NONE};
        bool isValidTeam{true};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMTeam = {
      teamId: string
      teamType: V2NIMTeamType
      name: string
      ownerAccountId: string
      memberLimit: number
      memberCount: number
      createTime: number
      updateTime: number
      intro: string
      announcement: string
      avatar: string
      serverExtension?: string
      customerExtension?: string
      joinMode: V2NIMTeamJoinMode
      agreeMode: V2NIMTeamAgreeMode
      inviteMode: V2NIMTeamInviteMode
      updateInfoMode: V2NIMTeamUpdateInfoMode
      updateExtensionMode: V2NIMTeamUpdateExtensionMode
      chatBannedMode: V2NIMTeamChatBannedMode
      isValidTeam: boolean
    
      messageNotifyMode: V2NIMTeamMessageNotifyMode
    }
    
    Harmony
    typescriptexport type V2NIMTeam = {
    
      teamId: string
      teamType: V2NIMTeamType
      name: string
      ownerAccountId: string
      memberLimit: number
      memberCount: number
      createTime: number
      updateTime: number
      intro: string
      announcement: string
      avatar: string
      serverExtension?: string
      customerExtension?: string
      joinMode: V2NIMTeamJoinMode
      agreeMode: V2NIMTeamAgreeMode
      inviteMode: V2NIMTeamInviteMode
      updateInfoMode: V2NIMTeamUpdateInfoMode
      updateExtensionMode: V2NIMTeamUpdateExtensionMode
      chatBannedMode: V2NIMTeamChatBannedMode
      isValidTeam: boolean
      messageNotifyMode: V2NIMTeamMessageNotifyMode
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 默认值 描述
    teamId String - 群组 ID
    teamType V2NIMTeamType V2NIM_TEAM_TYPE_NORMAL 群组类型
    name String - 群组名称
    ownerAccountId String - 群主账号
    memberLimit int - 群组人数上限。必须大于 0,否则返回参数错误。
  • 高级群:默认 200 人/群(免费),可通过云信控制台配置为 500/1000/2000 人/群(计费),最大可扩展至 5000 人/群(联系商务经理或技术支持)。
  • 超大群:默认 2000 人/群,可通过云信控制台配置为 2000-10000 人/群。
  • 2000 人以上的群必须由服务端 API 发起创建。
  • memberCount int - 群组当前人数
    createTime long - 群组创建时间戳
    updateTime long - 群组更新时间戳
    intro String - 群组介绍,最大为 255 个字符。
    announcement String - 群组公告,最大为 5000 个字符。
    avatar String - 群组头像
    serverExtension String - 群组服务端扩展字段。必须为 JSON 格式封装,长度上限为 2048 字节,多端同步。
    customerExtension String - 客户自定义扩展字段,仅服务器 API 可以设置,SDK 仅负责透传,不解析内容。
    joinMode V2NIMTeamJoinMode V2NIMTeamJoinMode.V2NIM_TEAM_JOIN_MODE_FREE 无需验证 入群验证模式
    agreeMode V2NIMTeamAgreeMode V2NIMTeamAgreeMode.V2NIM_TEAM_AGREE_MODE_AUTH 需要被邀请人同意 被邀请人同意模式
    inviteMode V2NIMTeamInviteMode V2NIMTeamInviteMode.V2NIM_TEAM_INVITE_MODE_MANAGER 仅群主或管理员可以邀请其他人入群 群组邀请模式,即群主/管理员或普通成员可以邀请入群
    updateInfoMode V2NIMTeamUpdateInfoMode V2NIMTeamUpdateInfoMode.V2NIM_TEAM_UPDATE_INFO_MODE_MANAGER 仅群主或管理员可以修改群组资料 群组资料修改模式
    updateExtensionMode V2NIMTeamUpdateExtensionMode V2NIMTeamUpdateExtensionMode.V2NIM_TEAM_UPDATE_EXTENSION_MODE_MANAGER 仅群主或管理员可以修改群组资料 群组扩展字段修改模式
    chatBannedMode V2NIMTeamChatBannedMode V2NIM_TEAM_CHAT_BANNED_MODE_NONE 不禁言 群组禁言状态
    isValidTeam boolean true 是否为自己所在且有效的群组

    V2NIMTeamMember

    群成员对象。

    Andoroid
    javapublic interface V2NIMTeamMember extends Serializable {
        String getTeamId();
        
        V2NIMTeamType getTeamType();
        
        String getAccountId();
        
        V2NIMTeamMemberRole getMemberRole();
        
        String getTeamNick();
        
        String getServerExtension();
        
        long getJoinTime();
        
        long getUpdateTime();
    
        String getInvitorAccountId();
        
        boolean isInTeam();
        
        boolean isChatBanned();
    }
    
    iOS
    objective-c@interface V2NIMTeamMember : NSObject <NSCopying>
    
    @property(nonatomic,copy,readonly) NSString *teamId;
    
    @property(nonatomic,assign,readonly) V2NIMTeamType teamType;
    
    @property(nonatomic,copy,readonly) NSString *accountId;
    
    @property(nonatomic,assign,readonly) V2NIMTeamMemberRole memberRole;
    
    @property(nullable,nonatomic,copy,readonly) NSString *teamNick;
    
    @property(nullable,nonatomic,copy,readonly) NSString *serverExtension;
    
    @property(nonatomic,assign,readonly) NSTimeInterval joinTime;
    
    @property(nonatomic,assign,readonly) NSTimeInterval updateTime;
    
    @property(nonatomic,assign,readonly) BOOL inTeam;
    
    @property(nonatomic,assign,readonly) BOOL chatBanned;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMTeamMember {
        nstd::string teamId;
        V2NIMTeamType teamType{V2NIM_TEAM_TYPE_NORMAL};
        nstd::string accountId;
        nstd::optional<V2NIMTeamMemberRole> memberRole;
        nstd::optional<nstd::string> teamNick;
        nstd::optional<nstd::string> serverExtension;
        nstd::optional<uint64_t> joinTime;
        nstd::optional<uint64_t> updateTime;
        nstd::optional<nstd::string> invitorAccountId;
        nstd::optional<bool> inTeam;
        nstd::optional<bool> chatBanned;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMTeamMember = {
      teamId: string
      teamType: V2NIMTeamType
      accountId: string
      memberRole: V2NIMTeamMemberRole
      teamNick?: string
      serverExtension?: string
      joinTime: number
      updateTime?: number
      // invitorAccountId: string
      inTeam: boolean
      chatBanned?: boolean
    }
    
    Harmony
    typescriptexport class V2NIMTeamMember {
    
      teamId: string
      teamType: V2NIMTeamType
      accountId: string
      memberRole: V2NIMTeamMemberRole
      teamNick?: string
      serverExtension?: string
      joinTime: number
      updateTime?: number
      invitorAccountId?: string
      inTeam: boolean
      chatBanned?: boolean
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 是否只读 描述
    teamId String 所属群组 ID
    teamType V2NIMTeamType 群组类型
    accountId String 群成员账号
    memberRole V2NIMTeamMemberRole 群成员类型
    teamNick String 群组内昵称
    serverExtension String 群组服务端扩展字段。必须为 JSON 格式封装,长度上限为 2048 字节,多端同步。
    joinTime long 加入群组时间戳
    updateTime long 群成员信息更新时间戳
    invitorAccountId String 入群邀请人,主动加入群则该字段为空。
    chatBanned boolean 是否被禁言
    inTeam boolean 是否在群组中

    V2NIMCreateTeamParams

    群组创建参数。

    Andoroid
    javapublic class V2NIMCreateTeamParams {
    
        public V2NIMTeamType getTeamType() {
            return this.teamType;
        }
    
        public String getName() {
            return this.name;
        }
    
        public Integer getMemberLimit() {
            return this.memberLimit;
        }
    
        public String getIntro() {
            return this.intro;
        }
    
        public String getAnnouncement() {
            return this.announcement;
        }
    
        public String getAvatar() {
            return this.avatar;
        }
    
        public String getServerExtension() {
            return this.serverExtension;
        }
    
        public V2NIMTeamJoinMode getJoinMode() {
            return this.joinMode;
        }
    
        public V2NIMTeamAgreeMode getAgreeMode() {
            return this.agreeMode;
        }
    
        public V2NIMTeamInviteMode getInviteMode() {
            return this.inviteMode;
        }
    
        public V2NIMTeamUpdateInfoMode getUpdateInfoMode() {
            return this.updateInfoMode;
        }
    
        public V2NIMTeamUpdateExtensionMode getUpdateExtensionMode() {
            return this.updateExtensionMode;
        }
    
        public V2NIMTeamChatBannedMode getChatBannedMode() {
            return this.chatBannedMode;
        }
    
        public void setName(String name) {
            this.name = name;
        }
    
        public void setTeamType(V2NIMTeamType teamType) {
            this.teamType = teamType;
        }
    
        public void setMemberLimit(int memberLimit) {
            this.memberLimit = memberLimit;
        }
    
        public void setIntro(String intro) {
            this.intro = intro;
        }
    
        public void setAnnouncement(String announcement) {
            this.announcement = announcement;
        }
    
        public void setAvatar(String avatar) {
            this.avatar = avatar;
        }
    
        public void setServerExtension(String serverExtension) {
            this.serverExtension = serverExtension;
        }
    
        public void setJoinMode(V2NIMTeamJoinMode joinMode) {
            this.joinMode = joinMode;
        }
    
        public void setAgreeMode(V2NIMTeamAgreeMode agreeMode) {
            this.agreeMode = agreeMode;
        }
    
        public void setInviteMode(V2NIMTeamInviteMode inviteMode) {
            this.inviteMode = inviteMode;
        }
    
        public void setUpdateInfoMode(V2NIMTeamUpdateInfoMode updateInfoMode) {
            this.updateInfoMode = updateInfoMode;
        }
    
        public void setUpdateExtensionMode(V2NIMTeamUpdateExtensionMode updateExtensionMode) {
            this.updateExtensionMode = updateExtensionMode;
        }
    
        public void setChatBannedMode(V2NIMTeamChatBannedMode chatBannedMode) {
            this.chatBannedMode = chatBannedMode;
        }
    
        public boolean isValid() {
            if (teamType == null || teamType == V2NIMTeamType.V2NIM_TEAM_TYPE_INVALID) {
                return false;
            }
            if (memberLimit != null && memberLimit <= 0) {
                return false;
            }
            if (TextUtils.isEmpty(name)) {
                return false;
            }
            return true;
        }
    }
    
    iOS
    objective-c@interface V2NIMCreateTeamParams : NSObject
    
    @property(nonatomic,copy) NSString *name;
    
    @property(nonatomic,assign) V2NIMTeamType teamType;
    
    @property(nonatomic,assign) NSInteger memberLimit;
    
    @property(nullable,nonatomic,copy) NSString *intro;
    
    @property(nullable,nonatomic,copy) NSString *announcement;
    
    @property(nullable,nonatomic,copy) NSString *avatar;
    
    @property(nullable,nonatomic,copy) NSString *serverExtension;
    
    @property(nonatomic,assign) V2NIMTeamJoinMode joinMode;
    
    @property(nonatomic,assign) V2NIMTeamAgreeMode agreeMode;
    
    @property(nonatomic,assign) V2NIMTeamInviteMode inviteMode;
    
    @property(nonatomic,assign) V2NIMTeamUpdateInfoMode updateInfoMode;
    
    @property(nonatomic,assign) V2NIMTeamUpdateExtensionMode updateExtensionMode;
    
    @property(nonatomic,assign) V2NIMTeamChatBannedMode chatBannedMode;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMCreateTeamParams {
        nstd::string name;
        V2NIMTeamType teamType{V2NIM_TEAM_TYPE_NORMAL};
        nstd::optional<uint32_t> memberLimit;
        nstd::optional<nstd::string> intro;
        nstd::optional<nstd::string> announcement;
        nstd::optional<nstd::string> avatar;
        nstd::optional<nstd::string> serverExtension;
        V2NIMTeamJoinMode joinMode{V2NIM_TEAM_JOIN_MODE_APPLY};
        V2NIMTeamAgreeMode agreeMode{V2NIM_TEAM_AGREE_MODE_AUTH};
        V2NIMTeamInviteMode inviteMode{V2NIM_TEAM_INVITE_MODE_MANAGER};
        V2NIMTeamUpdateInfoMode updateInfoMode{V2NIM_TEAM_UPDATE_INFO_MODE_MANAGER};
        V2NIMTeamUpdateExtensionMode updateExtensionMode{V2NIM_TEAM_UPDATE_EXTENSION_MODE_MANAGER};
        V2NIMTeamChatBannedMode chatBannedMode{V2NIM_TEAM_CHAT_BANNED_MODE_NONE};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMCreateTeamParams = {
      name: string
      teamType: V2NIMTeamType
      memberLimit?: number
      intro?: string
      announcement?: string
      avatar?: string
      serverExtension?: string
      joinMode?: V2NIMTeamJoinMode
      agreeMode?: V2NIMTeamAgreeMode
      inviteMode?: V2NIMTeamInviteMode
      updateInfoMode?: V2NIMTeamUpdateInfoMode
      updateExtensionMode?: V2NIMTeamUpdateExtensionMode
      chatBannedMode?: V2NIMTeamChatBannedMode
    }
    
    Harmony
    typescriptexport type V2NIMCreateTeamParams = {
    
      name: string
      teamType: V2NIMTeamType
      memberLimit?: number
      intro?: string
      announcement?: string
      avatar?: string
      serverExtension?: string
      joinMode?: V2NIMTeamJoinMode
      agreeMode?: V2NIMTeamAgreeMode
      inviteMode?: V2NIMTeamInviteMode
      updateInfoMode?: V2NIMTeamUpdateInfoMode
      updateExtensionMode?: V2NIMTeamUpdateExtensionMode
      chatBannedMode?: V2NIMTeamChatBannedMode
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    name String - 群组名称
    teamType V2NIMTeamType V2NIM_TEAM_TYPE_NORMAL 群组类型。
    必须为高级群或超大群,否则返回参数错误。
    memberLimit int
  • 高级群:200
  • 超大群:2000
  • 群组人数上限。必须大于 0,否则返回参数错误。
  • 高级群:默认 200 人/群(免费),可通过云信控制台配置为 500/1000/2000 人/群(计费),最大可扩展至 5000 人/群(联系商务经理或技术支持)。
  • 超大群:默认 2000 人/群,可通过云信控制台配置为 2000-10000 人/群。
  • 2000 人以上的群必须由服务端 API 发起创建。
  • intro String null 群组介绍,长度上限为 255 个字符。
    announcement String null 群组公告,长度上限为 1024 个字符。最大可扩展至 5000 个字符(联系技术支持申请)。
    avatar String null 群组头像
    serverExtension String null 群组服务端扩展字段。必须为 JSON 格式封装,长度上限为 2048 字节,多端同步。
    joinMode V2NIMTeamJoinMode V2NIMTeamJoinMode.V2NIM_TEAM_JOIN_MODE_FREE 无需验证 入群验证模式
    agreeMode V2NIMTeamAgreeMode V2NIMTeamAgreeMode.V2NIM_TEAM_AGREE_MODE_AUTH 需要被邀请人同意 被邀请人同意模式
    inviteMode V2NIMTeamInviteMode V2NIMTeamInviteMode.V2NIM_TEAM_INVITE_MODE_MANAGER 仅群主或管理员可以邀请其他人入群 群组邀请模式,即群主/管理员或普通成员可以邀请入群
    updateInfoMode V2NIMTeamUpdateInfoMode V2NIMTeamUpdateInfoMode.V2NIM_TEAM_UPDATE_INFO_MODE_MANAGER 仅群主或管理员可以修改群组资料 群组资料修改模式
    updateExtensionMode V2NIMTeamUpdateExtensionMode V2NIMTeamUpdateExtensionMode.V2NIM_TEAM_UPDATE_EXTENSION_MODE_MANAGER 仅群主或管理员可以修改群组资料 群组扩展字段修改模式
    chatBannedMode V2NIMTeamChatBannedMode V2NIM_TEAM_CHAT_BANNED_MODE_NONE 不禁言 群组禁言状态

    V2NIMTeamMemberQueryOption

    群成员分页查询选项。

    Andoroid
    javapublic class V2NIMTeamMemberQueryOption {
    
        public V2NIMTeamMemberQueryOption() {
        }
    
        public V2NIMTeamMemberQueryOption(V2NIMTeamMemberRoleQueryType roleQueryType, boolean onlyChatBanned, V2NIMQueryDirection direction, String nextToken, int limit) {
            this.roleQueryType = roleQueryType;
            this.onlyChatBanned = onlyChatBanned;
            this.direction = direction;
            this.nextToken = nextToken;
            this.limit = limit;
        }
    
        public V2NIMTeamMemberRoleQueryType getRoleQueryType() {
            return roleQueryType;
        }
    
        public void setRoleQueryType(V2NIMTeamMemberRoleQueryType roleQueryType) {
            this.roleQueryType = roleQueryType;
        }
    
        public boolean isOnlyChatBanned() {
            return onlyChatBanned;
        }
    
        public void setOnlyChatBanned(boolean onlyChatBanned) {
            this.onlyChatBanned = onlyChatBanned;
        }
    
        public V2NIMQueryDirection getDirection() {
            return direction;
        }
    
        public void setDirection(V2NIMQueryDirection direction) {
            this.direction = direction;
        }
    
        public String getNextToken() {
            return nextToken;
        }
    
        public void setNextToken(String nextToken) {
            this.nextToken = nextToken;
        }
    
        public Integer getLimit() {
            return limit;
        }
    
        public void setLimit(int limit) {
            this.limit = limit;
        }
    
        public boolean isValid() {
            if (roleQueryType == null) {
                return false;
            }
            if (limit != null && limit <= 0) {
                return false;
            }
            return true;
        }
    }
    
    iOS
    objective-c@interface V2NIMTeamMemberQueryOption : NSObject
    
    @property(nonatomic,assign) V2NIMTeamMemberRoleQueryType roleQueryType;
    
    @property(nonatomic,assign) BOOL onlyChatBanned;
    
    @property(nonatomic,assign) V2NIMQueryDirection direction;
    
    @property(nullable,nonatomic,copy) NSString *nextToken;
    
    @property(nonatomic,assign) NSInteger limit;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMTeamMemberQueryOption {
        nstd::optional<V2NIMTeamMemberRoleQueryType> roleQueryType;
        bool onlyChatBanned{false};
        V2NIMQueryDirection direction{V2NIM_QUERY_DIRECTION_DESC};
        nstd::string nextToken;
        uint32_t limit{V2NIM_DEFAULT_TEAM_MEMBER_LIST_LIMIT};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMTeamMemberQueryOption = {
      roleQueryType?: V2NIMTeamMemberRoleQueryType
      onlyChatBanned?: boolean
      direction?: V2NIMQueryDirection
      limit?: number
      nextToken?: string
    }
    
    Harmony
    typescriptexport type V2NIMTeamMemberQueryOption = {
    
      roleQueryType?: V2NIMTeamMemberRoleQueryType
      onlyChatBanned?: boolean
      direction?: V2NIMQueryDirection
      limit?: number
      nextToken?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    roleQueryType V2NIMTeamMemberRoleQueryType - 群成员查询类型
    onlyChatBanned boolean false 是否只返回聊天禁言成员列表
  • true:仅聊天禁言成员列表
  • false:全部群成员列表
  • direction V2NIMQueryDirection V2NIM_QUERY_DIRECTION_DESC 消息查询方向(同时也是查询结果的排序方向):
  • DESC:按时间从大到小(倒序)
  • ASC:按时间从小到大查询(正序)
  • nextToken String "" 分页偏移,首次查询传空,下一次查询传入上一次查询返回值中的 nextToken
    limit int 100 单次查询群成员最大数量。不建议超过 100,设置小于等于 0 则默认为 100。

    V2NIMUpdateTeamInfoParams

    群组信息更新参数。

    Andoroid
    javapublic class V2NIMUpdateTeamInfoParams {
    
        public String getName() {
            return this.name;
        }
    
        public Integer getMemberLimit() {
            return this.memberLimit;
        }
    
        public String getIntro() {
            return this.intro;
        }
    
        public String getAnnouncement() {
            return this.announcement;
        }
    
        public String getAvatar() {
            return this.avatar;
        }
    
        public String getServerExtension() {
            return this.serverExtension;
        }
    
        public V2NIMTeamJoinMode getJoinMode() {
            return this.joinMode;
        }
    
        public V2NIMTeamAgreeMode getAgreeMode() {
            return this.agreeMode;
        }
    
        public V2NIMTeamInviteMode getInviteMode() {
            return this.inviteMode;
        }
    
        public V2NIMTeamUpdateInfoMode getUpdateInfoMode() {
            return this.updateInfoMode;
        }
    
        public V2NIMTeamUpdateExtensionMode getUpdateExtensionMode() {
            return this.updateExtensionMode;
        }
    
        public void setName(String name) {
            this.name = name;
        }
    
        public void setMemberLimit(int memberLimit) {
            this.memberLimit = memberLimit;
        }
    
        public void setIntro(String intro) {
            this.intro = intro;
        }
    
        public void setAnnouncement(String announcement) {
            this.announcement = announcement;
        }
    
        public void setAvatar(String avatar) {
            this.avatar = avatar;
        }
    
        public void setServerExtension(String serverExtension) {
            this.serverExtension = serverExtension;
        }
    
        public void setJoinMode(V2NIMTeamJoinMode joinMode) {
            this.joinMode = joinMode;
        }
    
        public void setAgreeMode(V2NIMTeamAgreeMode agreeMode) {
            this.agreeMode = agreeMode;
        }
        
        public void setInviteMode(V2NIMTeamInviteMode inviteMode) {
            this.inviteMode = inviteMode;
        }
        
        public void setUpdateInfoMode(V2NIMTeamUpdateInfoMode updateInfoMode) {
            this.updateInfoMode = updateInfoMode;
        }
    
        public void setUpdateExtensionMode(V2NIMTeamUpdateExtensionMode updateExtensionMode) {
            this.updateExtensionMode = updateExtensionMode;
        }
    
        public boolean isValid() {
            if (this.name != null && this.name.isEmpty()) {
                return false;
            }
            if (this.memberLimit != null && this.memberLimit <= 0) {
                return false;
            }
            return true;
        }
    }
    
    iOS
    objective-c@interface V2NIMUpdateTeamInfoParams : NSObject
    
    @property(nullable,nonatomic,copy) NSString *name;
    
    @property(nonatomic,assign) NSInteger memberLimit;
    
    @property(nullable,nonatomic,copy) NSString *intro;
    
    @property(nullable,nonatomic,copy) NSString *announcement;
    
    @property(nullable,nonatomic,copy) NSString *avatar;
    
    @property(nullable,nonatomic,copy) NSString *serverExtension;
    
    @property(nonatomic,assign) V2NIMTeamJoinMode joinMode;
    
    @property(nonatomic,assign) V2NIMTeamAgreeMode agreeMode;
    
    @property(nonatomic,assign) V2NIMTeamInviteMode inviteMode;
    
    @property(nonatomic,assign) V2NIMTeamUpdateInfoMode updateInfoMode;
    
    @property(nonatomic,assign) V2NIMTeamUpdateExtensionMode updateExtensionMode;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMUpdateTeamInfoParams {
        nstd::optional<nstd::string> name;
        nstd::optional<uint32_t> memberLimit;
        nstd::optional<nstd::string> intro;
        nstd::optional<nstd::string> announcement;
        nstd::optional<nstd::string> avatar;
        nstd::optional<nstd::string> serverExtension;
        nstd::optional<V2NIMTeamJoinMode> joinMode;
        nstd::optional<V2NIMTeamAgreeMode> agreeMode;
        nstd::optional<V2NIMTeamInviteMode> inviteMode;
        nstd::optional<V2NIMTeamUpdateInfoMode> updateInfoMode;
        nstd::optional<V2NIMTeamUpdateExtensionMode> updateExtensionMode;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMUpdateTeamInfoParams = {
      name?: string
      memberLimit?: number
      intro?: string
      announcement?: string
      avatar?: string
      serverExtension?: string
      joinMode?: V2NIMTeamJoinMode
      agreeMode?: V2NIMTeamAgreeMode
      inviteMode?: V2NIMTeamInviteMode
      updateInfoMode?: V2NIMTeamUpdateInfoMode
      updateExtensionMode?: V2NIMTeamUpdateExtensionMode
    }
    
    Harmony
    typescriptexport type V2NIMUpdateTeamInfoParams = {
    
      name?: string
      memberLimit?: number
      intro?: string
      announcement?: string
      avatar?: string
      serverExtension?: string
      joinMode?: V2NIMTeamJoinMode
      agreeMode?: V2NIMTeamAgreeMode
      inviteMode?: V2NIMTeamInviteMode
      updateInfoMode?: V2NIMTeamUpdateInfoMode
      updateExtensionMode?: V2NIMTeamUpdateExtensionMode
    }
    

    成员参数

    • 如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。
    • 若参数均未传入,则返回参数错误。
    名称 类型 是否必填 默认值 描述
    name String null 群组名称。
    设置为 null,表示不修改该字段;设置为 "",则返回参数错误。
    memberLimit int
  • 高级群:200
  • 超大群:2000
  • 群组人数上限。
    必须大于 0,否则返回参数错误;设置为 null,表示不修改该字段。
    intro String null 群组介绍,长度上限为 255 个字符。
    设置为 null,表示不修改该字段。
    announcement String null 群组公告,长度上限为 1024 个字符。最大可扩展至 5000 个字符(联系技术支持申请)。
    设置为 null,表示不修改该字段。
    avatar String null 群组头像。
    设置为 null,表示不修改该字段。
    serverExtension String null 群组服务端扩展字段。必须为 JSON 格式封装,长度上限为 2048 字节,多端同步。
    设置为 null,表示不修改该字段。
    joinMode V2NIMTeamJoinMode V2NIMTeamJoinMode.V2NIM_TEAM_JOIN_MODE_FREE 无需验证 入群验证模式
    agreeMode V2NIMTeamAgreeMode V2NIMTeamAgreeMode.V2NIM_TEAM_AGREE_MODE_AUTH 需要被邀请人同意 被邀请人同意模式
    inviteMode V2NIMTeamInviteMode V2NIMTeamInviteMode.V2NIM_TEAM_INVITE_MODE_MANAGER 仅群主或管理员可以邀请其他人入群 群组邀请模式,即群主/管理员或普通成员可以邀请入群
    updateInfoMode V2NIMTeamUpdateInfoMode V2NIMTeamUpdateInfoMode.V2NIM_TEAM_UPDATE_INFO_MODE_MANAGER 仅群主或管理员可以修改群组资料 群组资料修改模式
    updateExtensionMode V2NIMTeamUpdateExtensionMode V2NIMTeamUpdateExtensionMode.V2NIM_TEAM_UPDATE_EXTENSION_MODE_MANAGER 仅群主或管理员可以修改群组资料 群组扩展字段修改模式

    V2NIMCreateTeamResult

    创建群组返回结果。

    Andoroid
    javapublic interface V2NIMCreateTeamResult {
    
        V2NIMTeam getTeam();
    
        List<String> getFailedList();
    }
    
    iOS
    objective-c@interface V2NIMCreateTeamResult : NSObject
    
    @property(nullable,nonatomic,copy,readonly) V2NIMTeam *team;
    
    @property(nullable,nonatomic,copy,readonly) NSArray<NSString *> *failedList;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMCreateTeamResult {
        V2NIMTeam team;
        nstd::vector<nstd::string> failedList;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMCreateTeamResult = {
      team: V2NIMTeam
      failedList: string[]
    }
    
    Harmony
    typescriptexport type V2NIMCreateTeamResult = {
    
      team: V2NIMTeam
      failedList: string[]
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    team V2NIMTeam 已创建的群组对象
    failedList List 被邀请入群失败的成员列表

    V2NIMUpdateSelfMemberInfoParams

    修改本人群成员信息参数。

    Andoroid
    javapublic class V2NIMUpdateSelfMemberInfoParams {
    
        public V2NIMUpdateSelfMemberInfoParams() {
        }
    
        public V2NIMUpdateSelfMemberInfoParams(String teamNick, String serverExtension) {
            this.teamNick = teamNick;
            this.serverExtension = serverExtension;
        }
    
        public String getTeamNick() {
            return teamNick;
        }
    
        public void setTeamNick(String teamNick) {
            this.teamNick = teamNick;
        }
    
        public String getServerExtension() {
            return serverExtension;
        }
    
        public void setServerExtension(String serverExtension) {
            this.serverExtension = serverExtension;
        }
    
        public boolean isValid() {
            return teamNick != null || serverExtension != null;
        }
    }
    
    iOS
    objective-c@interface V2NIMUpdateSelfMemberInfoParams : NSObject
    
    @property(nullable,nonatomic,copy) NSString *teamNick;
    
    @property(nullable,nonatomic,copy) NSString *serverExtension;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMUpdateSelfMemberInfoParams {
        nstd::optional<nstd::string> teamNick;
        nstd::optional<nstd::string> serverExtension;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMUpdateSelfMemberInfoParams = {
      teamNick?: string
      serverExtension?: string
    }
    
    Harmony
    typescriptexport type V2NIMUpdateSelfMemberInfoParams = {
    
      teamNick?: string
      serverExtension?: string
    }
    

    成员参数

    • 如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。
    • 若参数均未传入,则返回参数错误。
    名称 类型 是否必填 默认值 描述
    teamNick String null 群组内昵称。
    设置为 null,表示不修改该字段。
    serverExtension String null 群成员服务端扩展字段。必须为 JSON 格式封装,长度上限为 2048 字节,多端同步。
    设置为 null,表示不修改该字段。

    V2NIMTeamMemberListResult

    分页获取群成员列表返回结果。

    Andoroid
    javapublic interface V2NIMTeamMemberListResult {
    
        String getNextToken();
    
        boolean isFinished();
    
        List<V2NIMTeamMember> getMemberList();
    }
    
    iOS
    objective-c@interface V2NIMTeamMemberListResult : NSObject
    
    @property(nonatomic,assign,readonly) BOOL finished;
    
    @property(nullable,nonatomic,copy,readonly) NSString *nextToken;
    
    @property(nullable,nonatomic,copy,readonly) NSArray<V2NIMTeamMember *> *memberList;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMTeamMemberListResult {
        bool finished{false};
        nstd::string nextToken;
        nstd::vector<V2NIMTeamMember> memberList;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMTeamMemberListResult = {
      finished: boolean
      nextToken: string
      memberList: V2NIMTeamMember[]
    }
    
    Harmony
    typescriptexport type V2NIMTeamMemberListResult = {
    
      finished: boolean
      nextToken: string
      memberList: V2NIMTeamMember[]
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    nextToken String 分页偏移。
    finished boolean 群成员是否全部获取:
  • true:已全部获取
  • false:未全部获取,可以继续获取。
  • memberList List<V2NIMTeamMember> 分页获取的群成员列表

    V2NIMTeamJoinActionInfo

    入群操作信息。

    Andoroid
    javapublic interface V2NIMTeamJoinActionInfo {
        V2NIMTeamJoinActionType getActionType();
        String getTeamId();
        V2NIMTeamType getTeamType();
        String getOperatorAccountId();
        String getPostscript();
        long getTimestamp();
        V2NIMTeamJoinActionStatus getActionStatus();
    }
    
    iOS
    objective-c@interface V2NIMTeamJoinActionInfo : NSObject
    
    @property(nonatomic,assign,readonly) V2NIMTeamJoinActionType actionType;
    
    @property(nonatomic,copy,readonly) NSString *teamId;
    
    @property(nonatomic,assign,readonly) V2NIMTeamType teamType;
    
    @property(nonatomic,copy,readonly) NSString *operatorAccountId;
    
    @property(nonatomic,copy,readonly) NSString *postscript;
    
    @property(nonatomic,assign,readonly) NSTimeInterval timestamp;
    
    @property(nonatomic,assign,readonly) V2NIMTeamJoinActionStatus actionStatus;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMTeamJoinActionInfo {
        V2NIMTeamJoinActionType actionType{V2NIM_TEAM_JOIN_ACTION_TYPE_APPLICATION};
        nstd::string teamId;
        V2NIMTeamType teamType{V2NIM_TEAM_TYPE_NORMAL};
        nstd::string operatorAccountId;
        nstd::optional<nstd::string> postscript;
        uint64_t timestamp{0};
        V2NIMTeamJoinActionStatus actionStatus{V2NIM_TEAM_JOIN_ACTION_STATUS_INIT};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMTeamJoinActionInfo = {
      actionType: V2NIMTeamJoinActionType
      teamId: string
      teamType: V2NIMTeamType
      operatorAccountId: string
      postscript?: string
      timestamp: number
      actionStatus: V2NIMTeamJoinActionStatus
    }
    
    Harmony
    typescriptexport type V2NIMTeamJoinActionInfo = {
    
      actionType: V2NIMTeamJoinActionType
      teamId: string
      teamType: V2NIMTeamType
      operatorAccountId: string
      postscript?: string
      timestamp: number
      actionStatus: V2NIMTeamJoinActionStatus
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    actionType V2NIMTeamJoinActionType 入群操作类型
    teamId String 群组 ID
    teamType V2NIMTeamType 群组类型
    operatorAccountId String 入群操作者账号
    postscript String 操作附言
    timestamp long 操作时间戳
    actionStatus V2NIMTeamJoinActionStatus 操作处理状态

    V2NIMTeamJoinActionInfoQueryOption

    入群操作信息分页查询选项。

    Andoroid
    javapublic class V2NIMTeamJoinActionInfoQueryOption {
    
        public V2NIMTeamJoinActionInfoQueryOption() {
        }
    
        public List<V2NIMTeamJoinActionType> getTypes() {
            return types;
        }
    
        public void setTypes(List<V2NIMTeamJoinActionType> types) {
            this.types = types;
        }
    
        public long getOffset() {
            if (offset == null) {
                return 0;
            }
            return offset;
        }
    
        public void setOffset(Long offset) {
            this.offset = offset;
        }
    
        public int getLimit() {
            if (limit == null) {
                return 50;
            }
            return limit;
        }
    
        public void setLimit(int limit) {
            this.limit = limit;
        }
    
        public List<V2NIMTeamJoinActionStatus> getStatus() {
            return status;
        }
    
        public void setStatus(List<V2NIMTeamJoinActionStatus> status) {
            this.status = status;
        }
    
        public boolean isValid() {
            if (limit != null && limit <= 0) {
                return false;
            }
            return true;
        }
    }
    
    iOS
    objective-c@interface V2NIMTeamJoinActionInfoQueryOption : NSObject
    
    @property(nullable,nonatomic,copy) NSArray<NSNumber *> *types;
    
    @property(nonatomic,assign) NSInteger offset;
    
    @property(nonatomic,assign) NSInteger limit;
    
    @property(nullable,nonatomic,copy) NSArray<NSNumber *> *status;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMTeamJoinActionInfoQueryOption {
        nstd::vector<V2NIMTeamJoinActionType> types;
        uint64_t offset;
        uint32_t limit{V2NIM_DEFAULT_JOIN_ACTION_QUERY_LIMIT};
        nstd::vector<V2NIMTeamJoinActionStatus> status;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMTeamJoinActionInfoQueryOption = {
      types?: V2NIMTeamJoinActionType[]
      status?: V2NIMTeamJoinActionStatus[]
      offset?: number
      limit?: number
    }
    
    Harmony
    typescriptexport type V2NIMTeamJoinActionInfoQueryOption = {
    
      types?: V2NIMTeamJoinActionType[]
      status?: V2NIMTeamJoinActionStatus[]
      offset?: number
      limit?: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    types List<V2NIMTeamJoinActionType> - 入群操作类型列表。如果列表为空或 size 为 0 则表示查询所有入群操作类型。
    offset long - 分页查询偏移。
    首次查询传 0,下一次查询传入上一次查询返回值中的 offset
    limit int 50 单次查询最大数量
    status List<V2NIMTeamJoinActionStatus> - 入群操作处理状态类型列表。如果列表为空或 size 为 0 则表示查询所有入群操作处理状态类型。

    V2NIMTeamJoinActionInfoResult

    入群操作信息分页查询结果。

    Andoroid
    javapublic interface V2NIMTeamJoinActionInfoResult {
        List<V2NIMTeamJoinActionInfo> getInfos();
        long getOffset();
        boolean isFinished();
    }
    
    iOS
    objective-c@interface V2NIMTeamJoinActionInfoResult : NSObject
    
    @property(nullable,nonatomic,copy,readonly) NSArray<V2NIMTeamJoinActionInfo *> *infos;
    
    @property(nonatomic,assign,readonly) NSInteger offset;
    
    @property(nonatomic,assign,readonly) BOOL finished;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMTeamJoinActionInfoResult {
        nstd::vector<V2NIMTeamJoinActionInfo> infos;
        uint64_t offset{0};
        bool finished{false};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMTeamJoinActionInfoResult = {
      infos: V2NIMTeamJoinActionInfo[]
      offset: number
      finished: boolean
    }
    
    Harmony
    typescriptexport type V2NIMTeamJoinActionInfoResult = {
    
      infos: V2NIMTeamJoinActionInfo[]
      offset: number
      finished: boolean
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    infos List<V2NIMTeamJoinActionType> 入群操作信息列表
    offset long 分页查询偏移。
    下一次查询传入上一次查询返回值中的 offset
    finished bool 数据是否全部获取:
  • true:已全部获取
  • false:未全部获取,可以继续获取
  • V2NIMTeamListener

    群组相关监听器。

    调用 addTeamListener 注册群组监听后,当群组相关事件发生时,会返回对应回调。

    Andoroid
    javapublic interface V2NIMTeamListener {
        void onSyncStarted();
        void onSyncFinished();
        void onSyncFailed(V2NIMError error);
        void onTeamCreated(V2NIMTeam team);
        void onTeamDismissed(V2NIMTeam team);
        void onTeamJoined(V2NIMTeam team);
        void onTeamLeft(V2NIMTeam team, boolean isKicked);
        void onTeamInfoUpdated(V2NIMTeam team);
    
        void onTeamMemberJoined(List<V2NIMTeamMember> teamMembers);
    
        void onTeamMemberKicked(String operatorAccountId, List<V2NIMTeamMember> teamMembers);
    
        void onTeamMemberLeft(List<V2NIMTeamMember> teamMembers);
    
        void onTeamMemberInfoUpdated(List<V2NIMTeamMember> teamMembers);
    
        void onReceiveTeamJoinActionInfo(V2NIMTeamJoinActionInfo joinActionInfo);
    }
    
    iOS
    objective-c@protocol V2NIMTeamListener <NSObject>
    
    @optional
    
    - (void)onSyncStarted;
    
    - (void)onSyncFinished;
    
    - (void)onSyncFailed:(V2NIMError *)error;
    
    - (void)onTeamCreated:(V2NIMTeam *)team;
    
    - (void)onTeamDismissed:(V2NIMTeam *)team;
    
    - (void)onTeamJoined:(V2NIMTeam *)team;
    
    - (void)onTeamLeft:(V2NIMTeam *)team
              isKicked:(BOOL)isKicked;
    
    - (void)onTeamInfoUpdated:(V2NIMTeam *)team;
    
    - (void)onTeamMemberJoined:(NSArray<V2NIMTeamMember *> *)teamMembers;
    
    - (void)onTeamMemberKicked:(NSString *)operatorAccountId
                   teamMembers:(NSArray<V2NIMTeamMember *> *)teamMembers;
    
    - (void)onTeamMemberLeft:(NSArray<V2NIMTeamMember *> *)teamMembers;
    
    - (void)onTeamMemberInfoUpdated:(NSArray<V2NIMTeamMember *> *)teamMembers;
    
    - (void)onReceiveTeamJoinActionInfo:(V2NIMTeamJoinActionInfo *)joinActionInfo;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMTeamListener {
        nstd::function<void()> onSyncStarted;
        nstd::function<void()> onSyncFinished;
        nstd::function<void(V2NIMError error)> onSyncFailed;
        nstd::function<void(V2NIMTeam team)> onTeamCreated;
        nstd::function<void(nstd::vector<V2NIMTeam> teams)> onTeamDismissed;
        nstd::function<void(V2NIMTeam team)> onTeamJoined;
        nstd::function<void(V2NIMTeam team, bool isKicked)> onTeamLeft;
        nstd::function<void(V2NIMTeam team)> onTeamInfoUpdated;
        nstd::function<void(nstd::vector<V2NIMTeamMember> teamMembers)> onTeamMemberJoined;
        nstd::function<void(nstd::string operateAccountId, nstd::vector<V2NIMTeamMember> teamMembers)> onTeamMemberKicked;
        nstd::function<void(nstd::vector<V2NIMTeamMember> teamMembers)> onTeamMemberLeft;
        nstd::function<void(nstd::vector<V2NIMTeamMember> teamMembers)> onTeamMemberInfoUpdated;
        nstd::function<void(V2NIMTeamJoinActionInfo joinActionInfo)> onReceiveTeamJoinActionInfo;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMTeamListener = {
      onSyncStarted: []
      onSyncFinished: []
      onSyncFailed: [error: V2NIMError]
      onTeamCreated: [team: V2NIMTeam]
      onTeamDismissed: [team: V2NIMTeam]
      onTeamJoined: [team: V2NIMTeam]
      onTeamLeft: [team: V2NIMTeam, isKicked: boolean]
      onTeamInfoUpdated: [team: V2NIMTeam]
      onTeamMemberJoined: [teamMembers: V2NIMTeamMember[]]
      onTeamMemberKicked: [operateAccountId: string, teamMembers: V2NIMTeamMember[]]
      onTeamMemberLeft: [teamMembers: V2NIMTeamMember[]]
      onTeamMemberInfoUpdated: [teamMembers: V2NIMTeamMember[]]
      onReceiveTeamJoinActionInfo: [joinActionInfo: V2NIMTeamJoinActionInfo]
    }
    
    Harmony
    typescriptexport type V2NIMTeamListener = {
    
      onSyncStarted: []
      onSyncFinished: []
      onSyncFailed: [error: V2NIMError]
      onTeamCreated: [team: V2NIMTeam]
      onTeamDismissed: [team: V2NIMTeam]
      onTeamJoined: [team: V2NIMTeam]
      onTeamLeft: [team: V2NIMTeam, isKicked: boolean]
      onTeamInfoUpdated: [team: V2NIMTeam]
      onTeamMemberJoined: [teamMembers: V2NIMTeamMember[]]
      onTeamMemberKicked: [operateAccountId: string, teamMembers: V2NIMTeamMember[]]
      onTeamMemberLeft: [teamMembers: V2NIMTeamMember[]]
      onTeamMemberInfoUpdated: [teamMembers: V2NIMTeamMember[]]
      onReceiveTeamJoinActionInfo: [joinActionInfo: V2NIMTeamJoinActionInfo]
    }
    

    成员函数

    • onSyncStarted

      群组数据同步开始回调。

    • onSyncFinished

      群组数据同步结束回调。

      请在收到该回调之后进行群组相关操作,否则可能导致数据不完整。

    • onSyncFailed

      群组数据同步失败回调。

      如果在收到该回调之后进行群组相关操作,群组数据可能不完整。相关错误恢复后,会逐步按需重建数据。

      参数名称 类型 描述
      error V2NIMError 群组数据同步失败错误码及错误信息
    • onTeamCreated

      群组成功创建回调。
      当本地端或多端同步创建群组成功时会触发该回调。

      参数名称 类型 描述
      team V2NIMTeam 创建的群组对象
    • onTeamDismissed

      群组解散回调。
      当本地端或多端同步解散群组成功时会触发该回调。群组内所有成员均会收到该回调。

      参数名称 类型 描述
      team V2NIMTeam 解散的群组对象
    • onTeamJoined

      加入群组回调。
      当本地端或多端同步加入群组时会触发该回调。

      参数名称 类型 描述
      team V2NIMTeam 加入的群组对象
    • onTeamLeft

      离开群组回调。
      当本地端或多端主动离开群组或被踢出群组时会触发该回调。

      参数名称 类型 描述
      team V2NIMTeam 离开的群组对象
    • onTeamInfoUpdated

      群组信息更新回调。群组内所有成员均会收到该回调。

      参数名称 类型 描述
      team V2NIMTeam 更新后的群组对象
    • onTeamMemberJoined

      成员加入群组回调。群组内所有成员均会收到该回调。

      参数名称 类型 描述
      teamMembers List<V2NIMTeamMember> 加入群的群组成员列表
    • onTeamMemberKicked

      群成员被踢出群组回调。群组内所有成员均会收到该回调。

      参数名称 类型 描述
      operatorAccountId String 操作者账号
      teamMembers List<V2NIMTeamMember> 被踢出的群组成员列表
    • onTeamMemberLeft

      群成员离开群组回调。群组内所有成员均会收到该回调。

      参数名称 类型 描述
      teamMembers List<V2NIMTeamMember> 离开群组的成员列表
    • onTeamMemberInfoUpdated

      群成员信息变更回调。群组内所有成员均会收到该回调。

      参数名称 类型 描述
      teamMembers List<V2NIMTeamMember> 变更后的群成员列表
    • onReceiveTeamJoinActionInfo

      收到入群操作信息回调。包含以下场景:

      • 群主或管理员收到入群申请回调,回调类型:V2NIM_TEAM_JOIN_ACTION_TYPE_APPLICATION 管理员后续操作: - acceptJoinApplication:接受成员的入群申请,成员入群 - rejectJoinApplication:拒绝成员的入群申请,申请方收到对应回调
      • 申请人收到入群申请被群主或管理员拒绝回调,回调类型:V2NIM_TEAM_JOIN_ACTION_TYPE_REJECT_INVITATION
      • 收到入群邀请回调,回调类型:V2NIM_TEAM_JOIN_ACTION_TYPE_INVITATION 成员后续操作: - acceptInvitation:接受邀请入群, 调用后进入群组 - rejectInvitation:拒绝接受邀请,管理员收到对应回调
      • 收到入群邀请被拒绝回调,回调类型:V2NIM_TEAM_JOIN_ACTION_TYPE_REJECT_INVITATION
      参数名称 类型 描述
      joinActionInfo V2NIMTeamJoinActionInfo 入群操作信息

    V2NIMDndConfig

    APNs 推送全局免打扰配置信息。

    objective-c@interface V2NIMDndConfig : NSObject
    @property (nonatomic,assign) BOOL showDetail;
    @property (nonatomic,assign) BOOL dndOn;
    @property (nonatomic,assign) NSInteger fromH;
    @property (nonatomic,assign) NSInteger fromM;
    @property (nonatomic,assign) NSInteger toH;
    @property (nonatomic,assign) NSInteger toM;
    @end
    

    成员参数

    名称 类型 是否必填 默认值 描述
    showDetail boolean false 是否显示推送详情
    dndOn boolean false APNs 推送全局免打扰是否开启
    fromH int 如果 dndOntrue(开启免打扰)则必填 - 免打扰开始时间(小时数)
    fromM int 如果 dndOntrue(开启免打扰)则必填 - 免打扰开始时间(分钟数)
    toH int 如果 dndOntrue(开启免打扰)则必填 - 免打扰结束时间(小时数)
    toM int 如果 dndOntrue(开启免打扰)则必填 - 免打扰结束时间(分钟数)

    V2NIMOfflinePushConfig(仅 Web)

    离线推送配置信息。

    typescriptexport interface V2NIMOfflinePushConfig {
      apns?: V2NIMManufacturerPushConfig
      hwPush?: V2NIMManufacturerPushConfig
      miPush?: V2NIMManufacturerPushConfig
      vivoPush?: V2NIMManufacturerPushConfig
      oppoPush?: V2NIMManufacturerPushConfig
      honorPush?: V2NIMManufacturerPushConfig
      fcmPush?: V2NIMManufacturerPushConfig
      mzPush?: V2NIMManufacturerPushConfig
    }
    

    成员参数

    名称 类型 是否必填 默认值 描述
    miPush V2NIMManufacturerPushConfig - 小米推送:appIdappKeycertificateName
    vivoPush V2NIMManufacturerPushConfig - vivo 推送:appIdappKeycertificateName
    oppoPush V2NIMManufacturerPushConfig - OPPO 推送:appIdappKeycertificateNamesecret
    hwPush V2NIMManufacturerPushConfig - 华为推送:appIdappKey
    fcmPush V2NIMManufacturerPushConfig - FCM 推送:certificateName
    honorPush V2NIMManufacturerPushConfig - 荣耀推送:
  • appId: 在 AndroidManifest.xml 中配置。
  • certificateName
  • mzPush V2NIMManufacturerPushConfig - 魅族推送:appIdappKeycertificateName
    apns V2NIMManufacturerPushConfig - APNs 推送:certificateName

    V2NIMManufacturerPushConfig(仅 Web)

    离线推送第三方厂商配置信息。

    typescriptexport interface V2NIMManufacturerPushConfig {
      appId?: string
      appKey?: string
      certificateName: string
      secret?: string
    }
    

    成员参数

    以下参数需要在云信控制台应用管理 > 应用配置 > 证书管理添加证书时配置完成,具体含义请参见各厂商集成文档

    名称 类型 描述
    appId string 应用 ID
    appKey string 应用 Key
    certificateName string 应用证书名称
    secret string 应用密钥

    V2NIMSettingListener

    系统设置相关监听器。

    调用 addSettingListener 注册系统设置监听后,当系统设置相关事件发生时,会返回对应回调。

    Andoroid
    javapublic interface V2NIMSettingListener {
    
        void onTeamMessageMuteModeChanged(String teamId, V2NIMTeamType teamType, V2NIMTeamMessageMuteMode muteMode);
    
        void onP2PMessageMuteModeChanged(String accountId, V2NIMP2PMessageMuteMode muteMode);
    }
    
    iOS
    objective-c- (void)onTeamMessageMuteModeChanged:(NSString *)teamId
                                teamType:(V2NIMTeamType)teamType
                                muteMode:(V2NIMTeamMessageMuteMode)muteMode;
    
    - (void)onP2PMessageMuteModeChanged:(NSString *)accountId
                               muteMode:(V2NIMP2PMessageMuteMode)muteMode;
    
    macOS/Windows
    cppstruct V2NIMSettingListener {
        nstd::function<void(nstd::string teamId, V2NIMTeamType teamType, V2NIMTeamMessageMuteMode muteMode)> onTeamMessageMuteModeChanged;
        nstd::function<void(nstd::string accountId, V2NIMP2PMessageMuteMode muteMode)> onP2PMessageMuteModeChanged;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMSettingListener = {
      onTeamMessageMuteModeChanged: [teamId: string, teamType: V2NIMTeamType, muteMode: V2NIMTeamMessageMuteMode]
      onP2PMessageMuteModeChanged: [accountId: string, muteMode: V2NIMP2PMessageMuteMode]
    }
    
    Harmony
    typescriptexport type V2NIMSettingListener = {
    
      onTeamMessageMuteModeChanged: [teamId: string, teamType: V2NIMTeamType, muteMode: V2NIMTeamMessageMuteMode]
      onP2PMessageMuteModeChanged: [accountId: string, muteMode: V2NIMP2PMessageMuteMode]
    }
    

    成员函数

    • onTeamMessageMuteModeChanged

      群组消息免打扰模式变更回调。

      参数名称 类型 描述
      teamId String 群组 ID
      teamType V2NIMTeamType 群组类型,包括高级群和超大群。
      muteMode V2NIMTeamMessageMuteMode 群消息免打扰模式:免打扰开启或免打扰关闭
    • onP2PMessageMuteModeChanged

      单聊(点对点)消息免打扰模式变更回调。

      参数名称 类型 描述
      accountId String 聊天对象用户账号
      muteMode V2NIMP2PMessageMuteMode 单聊消息免打扰模式:免打扰开启或免打扰关闭

    V2NIMUser

    用户资料对象。

    Andoroid
    javapublic interface V2NIMUser {
    
        String getAccountId();
    
        String getName();
    
        String getAvatar();
    
        String getSign();
    
        String getEmail();
    
        String getBirthday();
    
        String getMobile();
    
        int getGender();
    
        String getServerExtension();
    
        long getCreateTime();
    
        long getUpdateTime();
    }
    
    iOS
    objective-c@interface V2NIMUser : NSObject
    
    @property (nullable,nonatomic,strong) NSString *accountId;
    
    @property (nullable,nonatomic,strong) NSString *name;
    
    @property (nullable,nonatomic,strong)   NSString  *avatar;
    
    @property (nullable,nonatomic,strong)   NSString  *sign;
    
    @property (nullable,nonatomic,strong)   NSString  *email;
    
    @property (nullable,nonatomic,strong)   NSString  *birthday;
    
    @property (nullable,nonatomic,strong)   NSString  *mobile;
    
    @property (nonatomic, assign)   NSInteger gender;
    
    @property (nullable,nonatomic,strong) NSString  *serverExtension;
    
    @property (nonatomic, assign)   NSTimeInterval createTime;
    
    @property (nonatomic, assign)   NSTimeInterval updateTime;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMUser {
    
        std::string accountId;
    
        std::optional<std::string> name;
    
        std::optional<std::string> avatar;
    
        std::optional<std::string> sign;
    
        std::optional<std::string> email;
    
        std::optional<std::string> birthday;
    
        std::optional<std::string> mobile;
    
        std::optional<uint32_t> gender;
    
        std::optional<std::string> serverExtension;
    
        uint64_t createTime{0};
    
        uint64_t updateTime{0};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMUser = {
    
      accountId: string;
    
      name: string;
    
      avatar?: string;
    
      sign?: string;
    
      email?: string;
    
      birthday?: string;
    
      mobile?: string;
    
      gender?: number;
    
      serverExtension?: string;
    
      createTime: number;
    
      updateTime?: number;
    };
    
    Harmony
    typescriptexport type V2NIMUser = {
    
      accountId: string
      name: string
      avatar?: string
      sign?: string
      email?: string
      birthday?: string
      mobile?: string
      gender?: number
      serverExtension?: string
      createTime: number
      updateTime?: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    accountId String - 用户账号 ID
    name String - 用户昵称,长度上限 64 字符
    avatar String "" 用户头像的 URL 地址,例如 "https://netease/xxx.png",长度上限 1024 字符,可设置为空字符串
    sign String "" 用户签名,长度上限 256 字符,可设置为空字符串
    email String "" 用户邮箱地址,需符合邮箱字符规则,例如 "zhangsan@xx.com",长度上限 64 字符,可设置为空字符串
    birthday String "" 用户生日,例如 "xxxx-xx-xx" ,长度上限 16 字符,可设置为空字符串
    mobile String "" 用户手机号,长度上限 32 字符,可设置为空字符串
    非中国大陆手机号码需要填写国家代码(如美国:+1-xxxxxxxxxx)或地区代码(如香港:+852-xxxxxxxx)
    gender Integer 0 用户性别,0:未知;1:男;2:女
    serverExtension String - 用户资料扩展字段,建议使用 JSON 格式,长度上限为 1024 字符
    createTime long - 用户资料创建时间
    updateTime long 0 用户资料更新时间

    V2NIMUserUpdateParams

    用户资料更新参数。

    Andoroid
    javapublic class V2NIMUserUpdateParams {
    
        public String getName() {
            return name;
        }
    
        public String getAvatar() {
            return avatar;
        }
    
        public String getSign() {
            return sign;
        }
    
        public String getEmail() {
            return email;
        }
    
        public String getBirthday() {
            return birthday;
        }
    
        public String getMobile() {
            return mobile;
        }
    
        public Integer getGender() {
            return gender;
        }
    
        public String getServerExtension() {
            return serverExtension;
        }
    
        @Override
        public String toString() {
            return "V2NIMUserUpdateParams{" +
                    "name='" + name + '\'' +
                    ", avatar='" + avatar + '\'' +
                    ", sign='" + sign + '\'' +
                    ", email='" + email + '\'' +
                    ", birthday='" + birthday + '\'' +
                    ", mobile='" + mobile + '\'' +
                    ", gender=" + gender +
                    ", serverExtension='" + serverExtension + '\'' +
                    '}';
        }
    
        public static final class V2NIMUserUpdateParamsBuilder {
            private String name;
            private String avatar;
            private String sign;
            private String email;
            private String birthday;
            private String mobile;
            private Integer gender;
            private String serverExtension;
    
            private V2NIMUserUpdateParamsBuilder() {
            }
    
            public static V2NIMUserUpdateParamsBuilder builder() {
                return new V2NIMUserUpdateParamsBuilder();
            }
    
            public V2NIMUserUpdateParamsBuilder withName(String name) {
                this.name = name;
                return this;
            }
    
            public V2NIMUserUpdateParamsBuilder withAvatar(String avatar) {
                this.avatar = avatar;
                return this;
            }
    
            public V2NIMUserUpdateParamsBuilder withSign(String sign) {
                this.sign = sign;
                return this;
            }
    
            public V2NIMUserUpdateParamsBuilder withEmail(String email) {
                this.email = email;
                return this;
            }
    
            public V2NIMUserUpdateParamsBuilder withBirthday(String birthday) {
                this.birthday = birthday;
                return this;
            }
    
            public V2NIMUserUpdateParamsBuilder withMobile(String mobile) {
                this.mobile = mobile;
                return this;
            }
    
            public V2NIMUserUpdateParamsBuilder withGender(Integer gender) {
                this.gender = gender;
                return this;
            }
    
            public V2NIMUserUpdateParamsBuilder withServerExtension(String serverExtension) {
                this.serverExtension = serverExtension;
                return this;
            }
    
            public V2NIMUserUpdateParams build() {
                return new V2NIMUserUpdateParams(name, avatar, sign, email, birthday, mobile, gender, serverExtension);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMUserUpdateParams : NSObject
    
    @property (nullable,nonatomic,strong) NSString *name;
    
    @property (nullable,nonatomic,strong) NSString *avatar;
    
    @property (nullable,nonatomic,strong) NSString *sign;
    
    @property (nullable,nonatomic,strong) NSString *email;
    
    @property (nullable,nonatomic,strong) NSString *birthday;
    
    @property (nullable,nonatomic,strong) NSString *mobile;
    
    @property (nonatomic,assign) V2NIMGender gender;
    
    @property (nullable,nonatomic,strong) NSString *serverExtension;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMUserUpdateParams {
    
        nstd::optional<nstd::string> name;
    
        nstd::optional<nstd::string> avatar;
    
        nstd::optional<nstd::string> sign;
    
        nstd::optional<nstd::string> email;
    
        nstd::optional<nstd::string> birthday;
    
        nstd::optional<nstd::string> mobile;
    
        nstd::optional<uint32_t> gender;
    
        nstd::optional<nstd::string> serverExtension;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMUserUpdateParams = {
    
      name?: string;
    
      avatar?: string;
    
      sign?: string;
    
      email?: string;
    
      birthday?: string;
    
      mobile?: string;
    
      gender?: number;
    
      serverExtension?: string;
    };
    
    Harmony
    typescriptexport type V2NIMUserUpdateParams = {
    
      name?: string
      avatar?: string
      sign?: string
      email?: string
      birthday?: string
      mobile?: string
      gender?: number
      serverExtension?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 描述
    name String 用户昵称,长度上限 64 字符
  • 为空(null)表示不修改该字段
  • 为空字符串("")则返回参数错误
  • avatar String 用户头像的 URL 地址,例如 "https://netease/xxx.png",长度上限 1024 字符
  • 为空(null)表示不修改该字段
  • 可设置为空字符串("")
  • sign String 用户签名,长度上限 256 字符
  • 为空(null)表示不修改该字段
  • 可设置为空字符串("")
  • email String 用户邮箱地址,需符合邮箱字符规则,例如 "zhangsan@xx.com",长度上限 64 字符
  • 为空(null)表示不修改该字段
  • 可设置为空字符串("")串
  • birthday String 用户生日,例如 "xxxx-xx-xx" ,长度上限 16 字符
  • 为空(null)表示不修改该字段
  • 可设置为空字符串("")
  • mobile String 用户手机号,长度上限 32 字符
    非中国大陆手机号码需要填写国家代码(如美国:+1-xxxxxxxxxx)或地区代码(如香港:+852-xxxxxxxx)
  • 为空(null)表示不修改该字段
  • 可设置为空字符串("")
  • gender Integer 用户性别,0:未知;1:男;2:女
    设置为其它值会返回参数错误
    serverExtension String 用户资料扩展字段,建议使用 JSON 格式,长度上限为 1024 字符
  • 为空(null)表示不修改该字段
  • 可设置为空字符串("")
  • V2NIMUserSearchOption

    根据关键字搜索用户信息的配置参数。

    Andoroid
    javapublic class V2NIMUserSearchOption {
    
        public String getKeyword() {
            return keyword;
        }
    
        public boolean isSearchName() {
            return searchName;
        }
    
        public boolean isSearchAccountId() {
            return searchAccountId;
        }
    
        public boolean isSearchMobile() {
            return searchMobile;
        }
    
        @Override    public String toString() {
            return "V2NIMUserSearchOption{" +
                    "keyword='" + keyword + '\'' +
                    ", searchName=" + searchName +
                    ", searchAccountId=" + searchAccountId +
                    ", searchMobile=" + searchMobile +
                    '}';
        }
    
    
        public static final class V2NIMUserSearchOptionBuilder {
            private final String keyword;
            private boolean searchName = SEARCH_NAME;
            private boolean searchAccountId = SEARCH_ACCOUNT_ID;
            private boolean searchMobile = SEARCH_MOBILE;
    
            private V2NIMUserSearchOptionBuilder(String keyword) {
                this.keyword = keyword;
            }
    
            public static V2NIMUserSearchOptionBuilder builder(String keyword) {
                return new V2NIMUserSearchOptionBuilder(keyword);
            }
    
            public V2NIMUserSearchOptionBuilder withSearchName(boolean searchName) {
                this.searchName = searchName;
                return this;
            }
    
            public V2NIMUserSearchOptionBuilder withSearchAccountId(boolean searchAccountId) {
                this.searchAccountId = searchAccountId;
                return this;
            }
    
            public V2NIMUserSearchOptionBuilder withSearchMobile(boolean searchMobile) {
                this.searchMobile = searchMobile;
                return this;
            }
    
            public V2NIMUserSearchOption build() {
                return new V2NIMUserSearchOption(keyword, searchName, searchAccountId, searchMobile);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMUserSearchOption : NSObject
    
    @property (nonatomic,copy) NSString *keyword;
    
    @property (nonatomic,assign) BOOL searchName;
    
    @property (nonatomic,assign) BOOL searchAccountId;
    
    @property (nonatomic,assign) BOOL searchMobile;
    
    + (instancetype)optionWithKeyword:(NSString *)keyword;
    
    @end
    
    Web/uni-app/小程序
    typescriptexport type V2NIMUserSearchOption = {
    
      keyword: string
    
      searchName?: boolean
    
      searchAccountId?: boolean
    
      searchMobile?: boolean
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    keyword String - 搜索关键字,默认搜索用户的昵称,可以指定是否同时搜索用户账号或手机号
    searchName Boolean true 是否搜索用户的昵称
    searchAccountId Boolen false 是否搜索用户账号
    searchMobile Boolean false 是否搜索用户的手机号

    V2NIMUserListener

    用户资料相关监听器。

    Andoroid
    javapublic interface V2NIMUserListener {
    
        void onUserProfileChanged(List<V2NIMUser> users);
    
        void onBlockListAdded(V2NIMUser user);
    
        void onBlockListRemoved(String accountId);
    }
    
    iOS
    objective-c@protocol V2NIMUserListener <NSObject>
    
    - (void)onUserProfileChanged:(NSArray <V2NIMUser *> *)users;
    
    - (void)onBlockListAdded:(V2NIMUser*)user;
    
    - (void)onBlockListRemoved:(NSString *)accountId;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMUserListener {
    
        std::function<void(std::vector<V2NIMUser> users)> onUserProfileChanged;
    
        std::function<void(V2NIMUser user)> onBlockListAdded;
    
        std::function<void(std::string accountId)> onBlockListRemoved;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMUserListener = {
    
      onUserProfileChanged: [users: V2NIMUser[]]
    
      onBlockListAdded: [user: V2NIMUser]
    
      onBlockListRemoved: [accountId: string]
    }
    
    Harmony
    typescriptexport type V2NIMUserListener = {
    
      onUserProfileChanged: [users: V2NIMUser[]]
    
      onBlockListAdded: [user: V2NIMUser]
    
      onBlockListRemoved: [accountId: string]
    }
    

    成员函数

    • onUserProfileChanged

      用户资料变更回调。

      参数名称 类型 描述
      users List<V2NIMUser> 用户资料
    • onBlockListAdded

      黑名单新增用户回调。

      当客户端本端添加用户到黑名单,或者其他端同步添加用户到黑名单时触发该回调。

      参数名称 类型 描述
      user V2NIMUser 添加进黑名单的用户资料
    • onBlockListRemoved

      黑名单移除用户回调。

      当客户端本端从黑名单移除用户,或者其他端同步从黑名单移除用户时触发该回调。

      参数名称 类型 描述
      accountId String 移出黑名单的用户账号 ID

    V2NIMFriend

    好友信息对象。

    Andoroid
    javapublic interface V2NIMFriend {
    
        String getAccountId();
    
        String getAlias();
    
        String getServerExtension();
    
        String getCustomerExtension();
    
        long getCreateTime();
    
        long getUpdateTime();
    
        V2NIMUser getUserProfile();
    }
    
    iOS
    objective-c@interface V2NIMFriend : NSObject
    
    @property (nullable,nonatomic,strong) NSString *accountId;
    
    @property (nullable,nonatomic,strong) NSString *alias;
    
    @property (nullable,nonatomic,strong) NSString *serverExtension;
    
    @property (nullable,nonatomic,strong) NSString *customerExtension;
    
    @property (nonatomic,assign) NSTimeInterval createTime;
    
    @property (nonatomic,assign) NSTimeInterval updateTime;
    
    @property (nullable,nonatomic,strong,readonly) V2NIMUser *userProfile;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMFriend {
    
        nstd::string accountId;
    
        nstd::optional<nstd::string> alias;
    
        nstd::optional<nstd::string> serverExtension;
    
        nstd::optional<nstd::string> customerExtension;
    
        nstd::optional<uint64_t> createTime;
    
        nstd::optional<uint64_t> updateTime;
    
        V2NIMUser userProfile;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMFriend = {
    
      accountId: string;
    
      alias?: string;
    
      serverExtension: string;
    
      customerExtension: string;
    
      createTime?: number;
    
      updateTime?: number;
    };
    
    Harmony
    typescriptexport type V2NIMFriend = {
    
      accountId: string
      alias?: string
      serverExtension: string
      customerExtension: string
      createTime?: number
      updateTime?: number
      source?: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 是否只读 描述
    accountId String - - 好友账号 ID
    alias String - - 好友备注,长度上限 128 字符
    serverExtension String - - 好友信息扩展字段,建议使用 JSON 格式,长度上限为 256 字符
    客户端和服务端都可修改该字段
    customerExtension String - - 好友信息客户端扩展字段,建议使用 JSON 格式,长度上限为 256 字符
    仅服务端可修改该字段
    createTime long - - 好友信息创建时间
    updateTime long 0 - 好友信息更新时间
    userProfile V2NIMUser - - 好友的用户信息

    V2NIMFriendAddParams

    添加好友的配置参数。

    Andoroid
    javapublic class V2NIMFriendAddParams {
    
        public V2NIMFriendAddMode getAddMode() {
            return addMode;
        }
    
        public String getPostscript() {
            return postscript;
        }
    
        public static final class V2NIMFriendAddParamsBuilder {
            private final V2NIMFriendAddMode addMode;
            private String postscript;
    
            private V2NIMFriendAddParamsBuilder(V2NIMFriendAddMode addMode) {
                this.addMode = addMode;
            }
    
            public static V2NIMFriendAddParamsBuilder builder(V2NIMFriendAddMode addMode) {
                return new V2NIMFriendAddParamsBuilder(addMode);
            }
    
            public V2NIMFriendAddParamsBuilder withPostscript(String postscript) {
                this.postscript = postscript;
                return this;
            }
    
            public V2NIMFriendAddParams build() {
                return new V2NIMFriendAddParams(addMode, postscript);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMFriendAddParams : NSObject
    
    @property (nonatomic, assign) V2NIMFriendAddMode addMode;
    
    @property (nullable,nonatomic,strong) NSString *postscript;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMFriendAddParams {
    
        V2NIMFriendAddMode addMode{V2NIM_FRIEND_MODE_TYPE_ADD};
    
        nstd::optional<nstd::string> postscript;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMFriendAddParams = {
    
      addMode: V2NIMFriendAddMode
    
      postscript: string
    }
    
    Harmony
    typescriptexport type V2NIMFriendAddParams = {
    
      addMode: V2NIMFriendAddMode
      postscript: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    addMode V2NIMFriendAddMode V2NIMFriendAddMode.V2NIM_FRIEND_MODE_TYPE_ADD:直接添加为好友,无需验证 添加好友模式
    postscript String - 添加/申请添加好友的附言

    V2NIMFriendAddApplication

    申请添加好友相关操作信息。

    Andoroid
    javapublic interface V2NIMFriendAddApplication {
    
        String getApplicantAccountId();
    
        String getRecipientAccountId();
    
        String getOperatorAccountId();
    
        String getPostscript();
    
        V2NIMFriendAddApplicationStatus getStatus();
    
        long getTimestamp();
    
        boolean isRead();
    }
    
    iOS
    objective-c@interface V2NIMFriendAddApplication : NSObject
    
    @property (nullable,nonatomic,strong,readonly) NSString *applicantAccountId;
    
    @property (nullable,nonatomic,strong,readonly) NSString *recipientAccountId;
    
    @property (nullable,nonatomic,strong,readonly) NSString *operatorAccountId;
    
    @property (nullable,nonatomic,strong,readonly) NSString *postscript;
    
    @property (nonatomic, assign, readonly) V2NIMFriendAddApplicationStatus status;
    
    @property (nonatomic,assign) NSTimeInterval timestamp;
    
    @property (nonatomic,assign) BOOL read;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMFriendAddApplication {
    
        nstd::string operatorAccountId;
    
        nstd::optional<nstd::string> postscript;
    
        V2NIMFriendAddApplicationStatus status{V2NIM_FRIEND_ADD_APPLICATION_STATUS_INIT};
    
        uint64_t timestamp{0};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMFriendAddApplication = {
    
      applicantAccountId: string
    
      recipientAccountIdstring
    
      operatorAccountId: string
    
      postscript?: string
    
      status: V2NIMFriendAddApplicationStatus
    
      timestamp: number
    
      read: boolean
    }
    
    Harmony
    typescriptexport type V2NIMFriendAddApplication = {
    
      operatorAccountId: string
      postscript?: string
      status: V2NIMFriendAddApplicationStatus
      timestamp: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 是否只读 描述
    applicantAccountId String 好友申请者账号
    recipientAccountId String 被申请为好友的账号
    operatorAccountId String 操作者账号 ID
    postscript String 操作时添加的附言
    status V2NIMFriendAddApplicationStatus 操作的状态
    timestamp long 操作的时间
    read Boolean 是否已读

    V2NIMFriendDeleteParams

    删除好友的配置参数。

    Andoroid
    javapublic class V2NIMFriendDeleteParams {
    
        public boolean isDeleteAlias() {
            return deleteAlias;
        }
    
        @Override
        public String toString() {
            return "V2NIMFriendDeleteParams{" +
                    "deleteAlias=" + deleteAlias +
                    '}';
        }
    
        public static final class V2NIMFriendDeleteParamsBuilder {
            private boolean deleteAlias;
    
            private V2NIMFriendDeleteParamsBuilder() {
            }
    
            public static V2NIMFriendDeleteParamsBuilder builder() {
                return new V2NIMFriendDeleteParamsBuilder();
            }
    
            public V2NIMFriendDeleteParamsBuilder withDeleteAlias(boolean deleteAlias) {
                this.deleteAlias = deleteAlias;
                return this;
            }
    
            public V2NIMFriendDeleteParams build() {
                return new V2NIMFriendDeleteParams(deleteAlias);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMFriendDeleteParams : NSObject
    
    @property (nonatomic, assign) BOOL deleteAlias;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMFriendDeleteParams {
    
        bool deleteAlias{false};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMFriendDeleteParams = {
    
      deleteAlias: boolean;
    
    };
    
    Harmony
    typescriptexport type V2NIMFriendDeleteParams = {
    
      deleteAlias: boolean
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    deleteAlias boolean false 是否删除备注,false:不删除;true:删除

    V2NIMFriendSetParams

    设置好友信息的配置参数。

    可以设置别名和扩展字段,两字段都可选,但是不能都不传,都不传回返回参数错误。

    Andoroid
    javapublic class V2NIMFriendSetParams {
    
        public String getAlias() {
            return alias;
        }
    
        public String getServerExtension() {
            return serverExtension;
        }
    
        @Override
        public String toString() {
            return "V2NIMFriendSetParams{" +
                    "alias='" + alias + '\'' +
                    ", serverExtension='" + serverExtension + '\'' +
                    '}';
        }
    
        public static final class V2NIMFriendSetParamsBuilder {
            private String alias;
            private String serverExtension;
    
            private V2NIMFriendSetParamsBuilder() {
            }
    
            public static V2NIMFriendSetParamsBuilder builder() {
                return new V2NIMFriendSetParamsBuilder();
            }
    
            public V2NIMFriendSetParamsBuilder withAlias(String alias) {
                this.alias = alias;
                return this;
            }
    
            public V2NIMFriendSetParamsBuilder withServerExtension(String serverExtension) {
                this.serverExtension = serverExtension;
                return this;
            }
    
            public V2NIMFriendSetParams build() {
                return new V2NIMFriendSetParams(alias, serverExtension);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMFriendSetParams : NSObject
    
    @property (nullable,nonatomic,strong) NSString *alias;
    
    @property (nullable,nonatomic,strong) NSString *serverExtension;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMFriendSetParams {
    
        nstd::optional<nstd::string> alias;
    
        nstd::optional<nstd::string> serverExtension;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMFriendSetParams = {
    
      alias?: string;
    
      serverExtension?: string;
    
    };
    
    Harmony
    typescriptexport type V2NIMFriendSetParams = {
    
      alias?: string
      serverExtension?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    alias String - 别名
  • 不传表示不设置
  • 为空字符串表示清空别名
  • serverExtension String - 扩展字段
  • 不传表示不设置
  • 为空字符串表示清空扩展字段
  • V2NIMFriendAddApplicationQueryOption

    申请添加好友相关操作信息的查询参数。

    Andoroid
    javapublic class V2NIMFriendAddApplicationQueryOption {
    
        public long getOffset() {
            return offset;
        }
    
        public int getLimit() {
            if (limit <= 0) {
                return LIMIT_DEFAULT;
            } else {
                return limit;
            }
        }
    
        public List<V2NIMFriendAddApplicationStatus> getStatus() {
            return status;
        }
    
        private static final int LIMIT_DEFAULT = 50;
    
        public static final class V2NIMFriendAddApplicationQueryOptionBuilder {
            private long offset;
            private int limit = LIMIT_DEFAULT;
            private List<V2NIMFriendAddApplicationStatus> status;
    
            private V2NIMFriendAddApplicationQueryOptionBuilder() {
            }
    
            public static V2NIMFriendAddApplicationQueryOptionBuilder builder() {
                return new V2NIMFriendAddApplicationQueryOptionBuilder();
            }
    
            public V2NIMFriendAddApplicationQueryOptionBuilder withOffset(long offset) {
                this.offset = offset;
                return this;
            }
    
            public V2NIMFriendAddApplicationQueryOptionBuilder withLimit(int limit) {
                this.limit = limit;
                return this;
            }
    
            public V2NIMFriendAddApplicationQueryOptionBuilder withStatus(List<V2NIMFriendAddApplicationStatus> status) {
                this.status = status;
                return this;
            }
    
            public V2NIMFriendAddApplicationQueryOption build() {
                return new V2NIMFriendAddApplicationQueryOption(offset, limit, status);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMFriendAddApplicationQueryOption : NSObject
    
    @property (nonatomic,nonatomic,assign) NSUInteger offset;
    
    @property (nonatomic,nonatomic,assign) NSUInteger limit;
    
    @property (nonatomic, strong) NSArray <NSNumber *> *status;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMFriendAddApplicationQueryOption {
    
        uint64_t offset;
    
        uint32_t limit{V2NIM_DEFAULT_FRIEND_APPLICATION_QUERY_LIMIT};
    
        nstd::vector<V2NIMFriendAddApplicationStatus> status;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMFriendAddApplicationQueryOption = {
    
      offset?: number
    
      limit?: number
    
      status: Array<V2NIMFriendAddApplicationStatus>
    }
    
    Harmony
    typescriptexport type V2NIMFriendAddApplicationQueryOption = {
    
      offset?: number
    
      limit?: number
    
      status: Array<V2NIMFriendAddApplicationStatus>
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    offset long - 分页查询偏移。首次查询传 0,下一次查询传入上一次查询返回值中的 offset(不包含 offset)
    limit Integer 50 单次查询的最大数量
    status List<V2NIMFriendAddApplicationStatus> - 申请添加好友相关操作状态列表。如果列表为空或 size 为 0 则表示查询所有申请添加好友相关操作信息

    V2NIMFriendAddApplicationResult

    查询申请添加好友相关操作信息列表的返回结果。

    Andoroid
    javapublic interface V2NIMFriendAddApplicationResult {
    
        List<V2NIMFriendAddApplication> getInfos();
    
        long getOffset();
    
        boolean isFinished();
    }
    
    iOS
    objective-c@interface V2NIMFriendAddApplicationResult : NSObject
    
    @property (nullable,nonatomic,strong,readonly) NSArray <V2NIMFriendAddApplication*> *infos;
    
    @property (nonatomic, assign,readonly) NSUInteger offset;
    
    @property (nonatomic, assign,readonly) BOOL finished;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMFriendAddApplicationResult {
    
        nstd::vector<V2NIMFriendAddApplication> infos;
    
        uint64_t offset{0};
    
        bool finished{false};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMFriendAddApplicationResult = {
    
      infos: Array<V2NIMFriendAddApplication>;
    
      offset: number;
    
      finished: boolean;
      
    };
    
    Harmony
    typescriptexport type V2NIMFriendAddApplicationResult = {
      infos: Array<V2NIMFriendAddApplication>
      offset: number
      finished: boolean
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    infos List<V2NIMFriendAddApplication> 查询返回的申请添加好友相关操作信息列表
    offset long 下一下查询的偏移量
    finished boolean 是否分页结束

    V2NIMFriendSearchOption

    根据关键字搜索好友信息的配置参数。

    Andoroid
    javapublic class V2NIMFriendSearchOption {
    
        public String getKeyword() {
            return keyword;
        }
    
        public boolean isSearchAlias() {
            return searchAlias;
        }
    
        public boolean isSearchAccountId() {
            return searchAccountId;
        }
    
        @Override    public String toString() {
            return "V2NIMFriendSearchOption{" +
                    "keyword='" + keyword + '\'' +
                    ", searchAlias=" + searchAlias +
                    ", searchAccountId=" + searchAccountId +
                    '}';
        }
    
        public static final class V2NIMFriendSearchOptionBuilder {
            private final String keyword;
            private boolean searchAlias = SEARCH_ALIAS;
            private boolean searchAccountId = SEARCH_ACCOUNT_ID;
    
            private V2NIMFriendSearchOptionBuilder(String keyword) {
                this.keyword = keyword;
            }
    
            public static V2NIMFriendSearchOptionBuilder builder(String keyword) {
                return new V2NIMFriendSearchOptionBuilder(keyword);
            }
    
            public V2NIMFriendSearchOptionBuilder withSearchAlias(boolean searchAlias) {
                this.searchAlias = searchAlias;
                return this;
            }
    
            public V2NIMFriendSearchOptionBuilder withSearchAccountId(boolean searchAccountId) {
                this.searchAccountId = searchAccountId;
                return this;
            }
    
    
            public V2NIMFriendSearchOption build() {
                return new V2NIMFriendSearchOption(keyword, searchAlias, searchAccountId);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMFriendSearchOption : NSObject
    
    @property (nonatomic,copy) NSString *keyword;
    
    @property (nonatomic,assign) BOOL searchAlias;
    
    @property (nonatomic,assign) BOOL searchAccountId;
    
    + (instancetype)optionWithKeyword:(NSString *)keyword;
    
    @end
    
    Web/uni-app/小程序
    typescriptexport type V2NIMFriendSearchOption = {
    
      keyword: string
    
      searchAlias?: boolean
    
      searchAccountId?: boolean
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    keyword String - 搜索关键字,默认搜索好友的备注,可以指定是否同时搜索用户账号
    searchAlias Boolean true 是否搜索好友的备注
    searchAccountId Boolen false 是否搜索用户账号

    V2NIMFriendListener

    好友信息相关监听器。

    Andoroid
    javapublic interface V2NIMFriendListener {
    
        void onFriendAdded(V2NIMFriend friendInfo);
    
        void onFriendDeleted(String accountId, V2NIMFriendDeletionType deletionType);
    
        void onFriendAddApplication(V2NIMFriendAddApplication applicationInfo);
    
        void onFriendAddRejected(V2NIMFriendAddApplication rejectionInfo);
    
        void onFriendInfoChanged(V2NIMFriend friendInfo);
    }
    
    iOS
    objective-c@protocol V2NIMFriendListener <NSObject>
    
    - (void)onFriendAdded:(V2NIMFriend *)friendInfo;
    
    - (void)onFriendDeleted:(NSString *)accountId deletionType:(V2NIMFriendDeletionType)deletionType;
    
    - (void)onFriendAddApplication:(V2NIMFriendAddApplication *)application;
    
    - (void)onFriendAddRejected:(V2NIMFriendAddApplication *)rejectionInfo;
    
    - (void)onFriendInfoChanged:(V2NIMFriend *)friendInfo;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMFriendListener {
    
        nstd::function<void(V2NIMFriend friendInfo)> onFriendAdded;
    
        nstd::function<void(nstd::string accountId, V2NIMFriendDeletionType deletionType)> onFriendDeleted;
    
        nstd::function<void(V2NIMFriendAddApplication applicationInfo)> onFriendAddApplication;
    
        nstd::function<void(V2NIMFriendAddRejection rejectionInfo)> onFriendAddRejected;
    
        nstd::function<void(V2NIMFriend friendInfo)> onFriendInfoChanged;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMFriendListener = {
    
      onFriendAdded: [friend: V2NIMFriend]
    
      onFriendDeleted: [accountId: string, deletionType: V2NIMFriendDeletionType]
    
      onFriendAddApplication: [application: V2NIMFriendAddApplication]
    
      onFriendAddRejected: [rejection: V2NIMFriendAddApplication]
    
      onFriendInfoChanged: [friend: V2NIMFriend]
    }
    
    Harmony
    typescriptexport type V2NIMFriendListener = {
    
      onFriendAdded: [friend: V2NIMFriend]
    
      onFriendDeleted: [accountId: string, deletionType: V2NIMFriendDeletionType]
    
      onFriendAddApplication: [application: V2NIMFriendAddApplication]
    
      onFriendAddRejected: [rejection: V2NIMFriendAddRejection]
    
      onFriendInfoChanged: [friend: V2NIMFriend]
    }
    
    

    成员函数

    • onFriendAdded

      添加好友成功的回调。

      当客户端本端或其他端同步添加好友成功时会触发该回调。

      参数名称 类型 是否必填 是否只读 描述
      friendInfo V2NIMFriend 添加成功的好友信息
    • onFriendDeleted

      删除好友回调。

      • 当客户端本端或其他端同步删除好友时会触发该回调。
      • 被对方删除好友时会触发该回调。
      参数名称 类型 是否必填 是否只读 描述
      deletionType V2NIMFriendDeletionType 删除好友的类型
      accountId String 账号 ID
    • deletionType=1(本端或其他端同步删除好友),则该字段为被删除的好友账号 ID
    • deletionType=2(被对方删除好友),则该字段为删除你的好友账号 ID
    • onFriendAddApplication

      请求好友添加申请的回调。

      参数名称 类型 是否必填 是否只读 描述
      application V2NIMFriendAddApplication 申请添加好友的信息
    • onFriendAddRejected

      被对方拒绝好友添加申请的回调。

      参数名称 类型 是否必填 是否只读 描述
      rejection V2NIMFriendAddApplication 被对方拒绝好友添加申请的信息
    • onFriendInfoChanged

      好友信息变更回调。

      当客户端本端或其他端同步更新好友信息时会触发该回调。

      参数名称 类型 是否必填 是否只读 描述
      friendInfo V2NIMFriend 变更的好友信息

    V2NIMChatroomClient

    聊天室实例入口类。

    成员参数

    参数名称 类型 描述
    instanceId int 实例 ID

    成员函数

    V2NIMChatroomInitParams(仅 Web)

    创建聊天室实例时的初始化参数。

    typescriptexport interface V2NIMChatroomInitParams {
      appkey: string
      customClientType?: number
      debugLevel?: DebugLevel
      isFixedDeviceId?: boolean
    }
    

    成员参数

    参数名称 类型 是否必填 默认值 描述
    appkey string - 应用 appkey
    customClientType int null 自定义设备类型

    V2NIMChatroomEnterParams

    进入聊天室相关参数。

    Andoroid
    javapublic class V2NIMChatroomEnterParams {
    
        public V2NIMChatroomEnterParams(boolean anonymousMode, String accountId, String token, String roomNick, String roomAvatar, int timeout, V2NIMChatroomLoginOption loginOption, V2NIMChatroomLinkProvider linkProvider, String serverExtension, String notificationExtension, V2NIMChatroomTagConfig tagConfig, V2NIMChatroomLocationConfig locationConfig, V2NIMAntispamConfig antispamConfig) {
            this.anonymousMode = anonymousMode;
            this.accountId = accountId;
            this.token = token;
            this.roomNick = roomNick;
            this.roomAvatar = roomAvatar;
            this.timeout = timeout;
            this.loginOption = loginOption;
            this.linkProvider = linkProvider;
            this.serverExtension = serverExtension;
            this.notificationExtension = notificationExtension;
            this.tagConfig = tagConfig;
            this.locationConfig = locationConfig;
            this.antispamConfig = antispamConfig;
        }
    
        public boolean isAnonymousMode() {
            return anonymousMode;
        }
    
        public String getAccountId() {
            return accountId;
        }
    
        public String getToken() {
            return token;
        }
    
        public String getRoomNick() {
            return roomNick;
        }
    
        public String getRoomAvatar() {
            return roomAvatar;
        }
    
        public int getTimeout() {
            return timeout;
        }
    
        public V2NIMChatroomLoginOption getLoginOption() {
            if (loginOption == null) {
                return V2NIMChatroomLoginOption.V2NIMChatroomLoginOptionBuilder.builder().build();
            } else {
                return loginOption;
            }
        }
    
        public V2NIMChatroomLinkProvider getLinkProvider() {
            return linkProvider;
        }
    
        public String getServerExtension() {
            return serverExtension;
        }
    
        public String getNotificationExtension() {
            return notificationExtension;
        }
    
        public V2NIMChatroomTagConfig getTagConfig() {
            return tagConfig;
        }
    
        public V2NIMChatroomLocationConfig getLocationConfig() {
            return locationConfig;
        }
    
        public V2NIMAntispamConfig getAntispamConfig() {
            return antispamConfig;
        }
    
        @Override
        public String toString() {
            return "V2NIMChatroomEnterParams{" +
                    "anonymousMode=" + anonymousMode +
                    ", accountId='" + accountId + '\'' +
                    ", token='" + token + '\'' +
                    ", roomNick='" + roomNick + '\'' +
                    ", roomAvatar='" + roomAvatar + '\'' +
                    ", timeout=" + timeout +
                    ", loginOption=" + loginOption +
                    ", linkProvider=" + linkProvider +
                    ", serverExtension='" + serverExtension + '\'' +
                    ", notificationExtension='" + notificationExtension + '\'' +
                    ", tagConfig=" + tagConfig +
                    ", locationConfig=" + locationConfig +
                    ", antispamConfig=" + antispamConfig +
                    '}';
        }
    
        public static final class V2NIMChatroomEnterParamsBuilder {
    
            public static V2NIMChatroomEnterParamsBuilder builder(V2NIMChatroomLoginOption loginOption, V2NIMChatroomLinkProvider linkProvider) {
                return new V2NIMChatroomEnterParamsBuilder(loginOption, linkProvider);
            }
    
            public V2NIMChatroomEnterParamsBuilder withAnonymousMode(boolean anonymousMode) {
                this.anonymousMode = anonymousMode;
                return this;
            }
    
            public V2NIMChatroomEnterParamsBuilder withAccountId(String accountId) {
                this.accountId = accountId;
                return this;
            }
    
            public V2NIMChatroomEnterParamsBuilder withToken(String token) {
                this.token = token;
                return this;
            }
    
            public V2NIMChatroomEnterParamsBuilder withRoomNick(String roomNick) {
                this.roomNick = roomNick;
                return this;
            }
    
            public V2NIMChatroomEnterParamsBuilder withRoomAvatar(String roomAvatar) {
                this.roomAvatar = roomAvatar;
                return this;
            }
    
            public V2NIMChatroomEnterParamsBuilder withTimeout(int timeout) {
                this.timeout = timeout;
                return this;
            }
    
            public V2NIMChatroomEnterParamsBuilder withServerExtension(String serverExtension) {
                this.serverExtension = serverExtension;
                return this;
            }
    
            public V2NIMChatroomEnterParamsBuilder withNotificationExtension(String notificationExtension) {
                this.notificationExtension = notificationExtension;
                return this;
            }
    
            public V2NIMChatroomEnterParamsBuilder withTagConfig(V2NIMChatroomTagConfig tagConfig) {
                this.tagConfig = tagConfig;
                return this;
            }
    
            public V2NIMChatroomEnterParamsBuilder withLocationConfig(V2NIMChatroomLocationConfig locationConfig) {
                this.locationConfig = locationConfig;
                return this;
            }
    
            public V2NIMChatroomEnterParamsBuilder withAntispamConfig(V2NIMAntispamConfig antispamConfig) {
                this.antispamConfig = antispamConfig;
                return this;
            }
    
            public V2NIMChatroomEnterParams build() {
                return new V2NIMChatroomEnterParams(anonymousMode, accountId, token, roomNick, roomAvatar, timeout, loginOption, linkProvider, serverExtension, notificationExtension, tagConfig, locationConfig, antispamConfig);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMChatroomEnterParams : NSObject
    
    @property(nonatomic,assign,readwrite) BOOL anonymousMode;
    @property(nullable,nonatomic,copy,readwrite) NSString *accountId;
    @property(nullable,nonatomic,copy,readwrite) NSString *token;
    @property(nullable,nonatomic,copy,readwrite) NSString *roomNick;
    @property(nullable,nonatomic,copy,readwrite) NSString *roomAvatar;
    @property(nonatomic,assign,readwrite) NSInteger timeout;
    @property(nonatomic,copy,readwrite) V2NIMChatroomLoginOption *loginOption;
    @property(nonatomic,strong,readwrite) id<V2NIMChatroomLinkProvider> linkProvider;
    @property(nullable,nonatomic,copy,readwrite) NSString *serverExtension;
    @property(nullable,nonatomic,copy,readwrite) NSString *notificationExtension;
    @property(nullable,nonatomic,strong,readwrite) V2NIMChatroomTagConfig *tagConfig;
    @property(nullable,nonatomic,strong,readwrite) V2NIMChatroomLocationConfig *locationConfig;
    @property(nullable,nonatomic,strong,readwrite) V2NIMAntispamConfig *antispamConfig;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomEnterParams {
        nstd::string accountId;
        nstd::string token;
        nstd::optional<nstd::string> roomNick;
        nstd::optional<nstd::string> roomAvatar;
        uint64_t timeout{V2NIM_DEFAULT_LOGIN_TIMEOUT};
        V2NIMChatroomLoginOption loginOption;
        bool anonymousMode{false};
        V2NIMChatroomLinkProvider linkProvider{nullptr};
        nstd::optional<nstd::string> serverExtension;
        nstd::optional<nstd::string> notificationExtension;
        V2NIMChatroomTagConfig tagConfig;
        nstd::optional<V2NIMChatroomLocationConfig> locationConfig;
        V2NIMAntispamConfig antispamConfig;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMChatroomEnterParams {
      anonymousMode?: boolean
      accountId?: string
      token?: string
      roomNick?: string
      roomAvatar?: string
      timeout?: number
      loginOption?: V2NIMChatroomLoginOption
      linkProvider: (roomId: string, accountId: string) => Promise<Array<string>>
      serverExtension?: string
      notificationExtension?: string
      tagConfig?: V2NIMChatroomTagConfig
      locationConfig?: V2NIMChatroomLocationConfig
      antispamConfig?: V2NIMAntispamConfig
    }
    

    成员参数

    参数名称 类型 是否必填 默认值 描述
    anonymousMode boolean false 是否为匿名模式。
    在匿名模式下不能发消息,只能收消息。
    accountId String null 用户账号。
  • 若为匿名模式,则可以不填,SDK 内部会生成账号。规则:nimanon_ UUID.randomUUID().toString(),建议全局缓存。
  • 如果为非匿名模式,则必须为合法账号。
  • token String null 静态 token,可以不填。
    roomNick String 账号对应信息 进入聊天室后显示的昵称。
    可以不填,默认显示账号对应相关信息,例如:匿名模式则默认昵称为账号名称。
    roomAvatar String 账号对应信息 进入聊天室后显示的头像,可通过 V2NIMStorageService.uploadFile 方法上传头像。
    可以不填,默认显示账号对应相关信息,例如:匿名模式则默认头像为空。
    timeout int 60 调用 enter 方法进入聊天室超时时间。
    若超过该时间未成功进入聊天室,则返回失败回调。
    loginOption V2NIMChatroomLoginOption null 聊天室登录配置
    linkProvider V2NIMChatroomLinkProvider - 获取聊天室连接链接地址回调,SDK 通过两种方式获取:
  • 若已登录 IM 且在线,则调用 V2NIMLoginService.getChatroomLinkAddress 方法获取聊天室连接地址。
  • 若未登录 IM,则请求业务服务器,通过服务端 API 获取聊天室地址
  • serverExtension String null 服务端扩展字段,建议使用 JSON 格式,多端同步。长度上限为 4096。
    notificationExtension String null 进入聊天室通知的扩展字段,长度上限为 2048。
    tagConfig V2NIMChatroomTagConfig null 进入聊天室的标签信息配置
    locationConfig V2NIMChatroomLocationConfig null 进入聊天室的空间位置信息配置
    antispamConfig V2NIMAntispamConfig null 易盾反垃圾检测。
  • 若不需要反垃圾检测,或已开启安全通,则不需要配置。
  • 若不使用安全通默认配置,需要定制审核规则,则配置该字段。
  • V2NIMChatroomLoginOption

    聊天室登录配置。

    Andoroid
    javapublic class V2NIMChatroomLoginOption {
    
        public V2NIMChatroomLoginOption(V2NIMLoginAuthType authType, V2NIMChatroomTokenProvider tokenProvider, V2NIMChatroomLoginExtensionProvider loginExtensionProvider) {
            this.authType = authType;
            this.tokenProvider = tokenProvider;
            this.loginExtensionProvider = loginExtensionProvider;
        }
    
        public V2NIMLoginAuthType getAuthType() {
            return authType;
        }
    
        public V2NIMChatroomTokenProvider getTokenProvider() {
            return tokenProvider;
        }
    
        public V2NIMChatroomLoginExtensionProvider getLoginExtensionProvider() {
            return loginExtensionProvider;
        }
    
        @Override
        public String toString() {
            return "V2NIMChatroomLoginOption{" +
                    "authType=" + authType +
                    ", tokenProvider=" + tokenProvider +
                    ", loginExtensionProvider=" + loginExtensionProvider +
                    '}';
        }
    
        public static final class V2NIMChatroomLoginOptionBuilder {
    
            public static V2NIMChatroomLoginOptionBuilder builder() {
                return new V2NIMChatroomLoginOptionBuilder();
            }
    
            public V2NIMChatroomLoginOptionBuilder withAuthType(V2NIMLoginAuthType authType) {
                this.authType = authType;
                return this;
            }
    
            public V2NIMChatroomLoginOptionBuilder withTokenProvider(V2NIMChatroomTokenProvider tokenProvider) {
                this.tokenProvider = tokenProvider;
                return this;
            }
    
            public V2NIMChatroomLoginOptionBuilder withLoginExtensionProvider(V2NIMChatroomLoginExtensionProvider loginExtensionProvider) {
                this.loginExtensionProvider = loginExtensionProvider;
                return this;
            }
    
            public V2NIMChatroomLoginOption build() {
                return new V2NIMChatroomLoginOption(authType, tokenProvider, loginExtensionProvider);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMChatroomLoginOption : NSObject
    
    @property(nonatomic,assign,readwrite) V2NIMLoginAuthType authType;
    
    @property(nullable,nonatomic,strong,readwrite) id<V2NIMChatroomTokenProvider> tokenProvider;
    
    @property(nullable,nonatomic,strong,readwrite) id<V2NIMChatroomLoginExtensionProvider> loginExtensionProvider;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomLoginOption {
        V2NIMLoginAuthType authType{V2NIM_LOGIN_AUTH_TYPE_DEFAULT};
        V2NIMChatroomTokenProvider tokenProvider{nullptr};
        V2NIMChatroomLoginExtensionProvider loginExtensionProvider{nullptr};
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMChatroomLoginOption {
      authType?: V2NIMLoginAuthType
      tokenProvider?: (appkey: string, roomId: string, accountId: string) => Promise<string>
      loginExtensionProvider?: (appkey: string, roomId: string, accountId: string) => Promise<string>
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    authType V2NIMLoginAuthType 0 鉴权方式,包括静态 Token 鉴权(默认)、动态 Token 鉴权、通过第三方回调鉴权。
    tokenProvider V2NIMChatroomTokenProvider 否,若使用动态 Token 鉴权则为必填 - 获取动态 Token 回调,用于动态 Token 登录鉴权。该回调在登录连接完成、登录鉴权校验前触发。若函数执行有异常或返回非预期内容(非法字符串),则登录中止并报错。
    loginExtensionProvider V2NIMChatroomLoginExtensionProvider 否,若使用第三方回调鉴权则为必填 - 获取用户登录业务扩展数据回调,用于第三方登录鉴权。该回调在登录连接完成、登录鉴权校验前触发。若函数执行有异常或返回非预期内容(非法字符串),则登录中止并报错。

    V2NIMChatroomTokenProvider

    聊天室获取动态 Token 回调。

    Andoroid
    javapublic interface V2NIMChatroomTokenProvider {
        String getToken(String roomId, String  accountId);
    }
    
    iOS
    objective-c@protocol V2NIMChatroomTokenProvider <NSObject>
    
    - (nullable NSString *)getToken:(NSString *)roomId
                          accountId:(NSString *)accountId;
    
    @end
    
    macOS/Windows
    cppusing V2NIMChatroomTokenProvider = nstd::function<nstd::optional<nstd::string>(nstd::string roomId, nstd::string account)>;
    
    Web/uni-app/小程序
    typescript(appkey: string, roomId: string, accountId: string) => Promise<string>
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 描述
    roomId String 聊天室 ID
    accountId String 用户登录账号

    V2NIMChatroomLoginExtensionProvider

    聊天室用户登录业务扩展数据回调。

    Andoroid
    javapublic interface V2NIMLoginExtensionProvider {
        String getLoginExtension(String accountId);
    }
    
    iOS
    objective-c@protocol V2NIMLoginExtensionProvider <NSObject>
    
    - (nullable NSString *)getLoginExtension:(NSString *)accountId;
    
    @end
    
    macOS/Windows
    cppusing V2NIMLoginExtensionProvider = nstd::function<nstd::optional<nstd::string>(nstd::string accountId)>;
    
    Web/uni-app/小程序
    typescriptexport type V2NIMLoginExtensionProvider = (accountId: string) => Promise<string> | string
    

    成员参数

    如果您的应用平台为 Android 或 iOS,则需要调用对应的成员函数获取对应参数。

    名称 类型 描述
    roomId String 聊天室 ID
    accountId String 用户登录账号

    V2NIMChatroomLinkProvider

    聊天室连接链接地址回调。

    Andoroid
    javapublic interface V2NIMChatroomLinkProvider {
    
        List<String> getLinkAddress(String roomId, String accountId);
    }
    
    iOS
    objective-c@protocol V2NIMChatroomLinkProvider <NSObject>
    
    - (nullable NSArray<NSString *> *)getLinkAddress:(NSString *)roomId
                                           accountId:(NSString *)accountId;
    
    @end
    
    macOS/Windows
    cppusing V2NIMChatroomLinkProvider = nstd::function<nstd::vector<nstd::string>(nstd::string roomId, nstd::string account)>;
    
    Web/uni-app/小程序
    typescript(roomId: string, accountId: string) => Promise<Array<string>>
    

    成员参数

    如果您的应用平台为 Android 或 iOS,则需要调用对应的成员函数获取对应参数。

    名称 类型 描述
    roomId String 聊天室 ID
    accountId String 用户登录账号

    V2NIMChatroomTagConfig

    进入聊天室标签信息配置。

    Andoroid
    javapublic class V2NIMChatroomTagConfig implements Serializable {
    
        public V2NIMChatroomTagConfig(List<String> tags, String notifyTargetTags) {
            this.tags = tags;
            this.notifyTargetTags = notifyTargetTags;
        }
    
        public List<String> getTags() {
            return tags;
        }
    
        public String getNotifyTargetTags() {
            return notifyTargetTags;
        }
    
        @Override
        public String toString() {
            return "V2NIMChatroomTagConfig{" +
                    "tags=" + tags +
                    ", notifyTargetTags='" + notifyTargetTags + '\'' +
                    '}';
        }
    
        public static final class V2NIMChatroomTagConfigBuilder {
    
            public static V2NIMChatroomTagConfigBuilder builder() {
                return new V2NIMChatroomTagConfigBuilder();
            }
    
            public V2NIMChatroomTagConfigBuilder withTags(List<String> tags) {
                this.tags = tags;
                return this;
            }
    
            public V2NIMChatroomTagConfigBuilder withNotifyTargetTags(String notifyTargetTags) {
                this.notifyTargetTags = notifyTargetTags;
                return this;
            }
    
            public V2NIMChatroomTagConfig build() {
                return new V2NIMChatroomTagConfig(tags, notifyTargetTags);
            }
        }
    }
    
    iOS
    objective-c@interface V2NIMChatroomTagConfig : NSObject
    
    @property(nullable,nonatomic,copy,readwrite) NSArray<NSString *> *tags;
    @property(nullable,nonatomic,copy,readwrite) NSString *notifyTargetTags;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomTagConfig {
    
        nstd::vector<nstd::string> tags;
    
        nstd::string notifyTargetTags;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMChatroomTagConfig {
    
      notifyTargetTags: string
    
      tags: string[]
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    tags List null 进入聊天室标签列表
    notifyTargetTags String null 进入/退出聊天室通知标签信息,标签表达式请参见聊天室标签管理

    V2NIMChatroomLocationConfig

    聊天室空间坐标信息及订阅范围配置。

    Andoroid
    javapublic class V2NIMChatroomLocationConfig implements Serializable {
    
        public V2NIMChatroomLocationConfig() {
        }
    
        public V2NIMChatroomLocationConfig(V2NIMLocationInfo locationInfo, double distance) {
            this.locationInfo = locationInfo;
            this.distance = distance;
        }
    
        public V2NIMLocationInfo getLocationInfo() {
            return locationInfo;
        }
    
        public void setLocationInfo(V2NIMLocationInfo locationInfo) {
            this.locationInfo = locationInfo;
        }
    
        public Double getDistance() {
            return distance;
        }
    
        public void setDistance(double distance) {
            this.distance = distance;
        }
    
        public boolean isValid() {
            return locationInfo != null && locationInfo.isValid() && distance != null;
        }
    }
    
    iOS
    objective-c@interface V2NIMChatroomLocationConfig : NSObject
    
    @property(nullable,nonatomic,copy,readwrite) V2NIMLocationInfo *locationInfo;
    @property(nonatomic,assign,readwrite) double distance;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomLocationConfig {
        V2NIMLocationInfo locationInfo;
        nstd::optional<double> distance;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMChatroomLocationConfig {
      locationInfo?: V2NIMLocationInfo
      distance: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    locationInfo V2NIMLocationInfo - 聊天室空间位置坐标信息
    distance double - 基于空间位置订阅聊天室消息的距离

    V2NIMLocationInfo

    聊天室空间坐标信息。

    Andoroid
    javapublic class V2NIMLocationInfo implements Serializable {
    
        public V2NIMLocationInfo() {
        }
    
        public V2NIMLocationInfo(double x, double y, double z) {
            this.x = x;
            this.y = y;
            this.z = z;
        }
    
        public Double getX() {
            return x;
        }
    
        public void setX(double x) {
            this.x = x;
        }
    
        public Double getY() {
            return y;
        }
    
        public void setY(double y) {
            this.y = y;
        }
    
        public Double getZ() {
            return z;
        }
    
        public void setZ(double z) {
            this.z = z;
        }
    
        public boolean isValid() {
            return x != null && y != null && z != null;
        }
    }
    
    iOS
    objective-c@interface V2NIMLocationInfo : NSObject <NSCopying>
    
    @property(nonatomic,assign,readwrite) double x;
    @property(nonatomic,assign,readwrite) double y;
    @property(nonatomic,assign,readwrite) double z;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMLocationInfo {
        nstd::optional<double> x;
        nstd::optional<double> y;
        nstd::optional<double> z;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMLocationInfo {
      x?: number
      y?: number
      z?: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    x double - 聊天室空间 x 坐标
    y double - 聊天室空间 y 坐标
    z double - 聊天室空间 z 坐标

    V2NIMChatroomEnterResult

    进入聊天室结果回包。

    Andoroid
    javapublic interface V2NIMChatroomEnterResult {
    
        V2NIMChatroomInfo getChatroom();
        V2NIMChatroomMember getSelfMember();
    }
    
    iOS
    objective-c@interface V2NIMChatroomEnterResult : NSObject
    
    @property(nonatomic,copy,readonly) V2NIMChatroomInfo *chatroom;
    
    @property(nonatomic,copy,readonly) V2NIMChatroomMember *selfMember;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomEnterResult {
        V2NIMChatroomInfo chatroom;
        V2NIMChatroomMember selfMember;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMChatroomEnterResult {
      chatroom: V2NIMChatroomInfo
      selfMember: V2NIMChatroomMember
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    chatroom V2NIMChatroomInfo 聊天室信息
    selfMember V2NIMChatroomMember 聊天室成员用户信息:
  • 必返回字段:roomId、accountId、memberRole、enterTime
  • 根据入参是否设置决定是否返回:roomNick、roomAvatar、serverExtension、tags、notifyTargetTags
  • 根据历史状态决定是否返回:chantBanned、tempChatBanned、tempChatBannedDuration
  • 以是否修改过决定是否返回:isOnline:true、blocked:false、memberLevel
  • updateTime:返回 0
  • V2NIMChatroomInfo

    聊天室信息。

    Andoroid
    javapublic interface V2NIMChatroomInfo extends Serializable {
        String getRoomId();
        String getRoomName();
        String getAnnouncement();
        String getLiveUrl();
        boolean isValidRoom();
        String getServerExtension();
        V2NIMChatroomQueueLevelMode getQueueLevelMode();
        String getCreatorAccountId();
        int getOnlineUserCount();
        boolean isChatBanned();
    }
    
    iOS
    objective-c@interface V2NIMChatroomInfo : NSObject <NSCopying>
    @property (nonatomic, strong, readonly) NSString *roomId;
    @property (nonatomic, strong, readonly) NSString *roomName;
    @property (nonatomic, strong, readonly) NSString *announcement;
    @property (nonatomic, strong, readonly) NSString *liveUrl;
    @property (nonatomic, assign, readonly) BOOL isValidRoom;
    @property (nonatomic, strong, readonly) NSString *serverExtension;
    @property (nonatomic, assign, readonly) V2NIMChatroomQueueLevelMode queueLevelMode;
    @property (nonatomic, strong, readonly) NSString *creatorAccountId;
    @property (nonatomic, assign, readonly) NSInteger onlineUserCount;
    @property (nonatomic, assign, readonly) BOOL chatBanned;
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomInfo {
        nstd::string roomId;
        nstd::string roomName;
        nstd::string announcement;
        nstd::string liveUrl;
        bool isValidRoom{true};
        nstd::string serverExtension;
        V2NIMChatroomQueueLevelMode queueLevelMode{V2NIM_CHATROOM_QUEUE_LEVEL_MODE_ANY};
        nstd::string creatorAccountId;
        uint32_t onlineUserCount{0};
        bool chatBanned{false};
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMChatroomInfo {
      roomId: string
      roomName: string
      announcement: string
      liveUrl: string
      isValidRoom: boolean
      serverExtension: string
      queueLevelMode: V2NIMChatroomQueueLevelMode
      creatorAccountId: string
      createTime: number
      onlineUserCount: number
      chatBanned: boolean
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    roomId String 聊天室 ID
    roomName String 聊天室名称
    announcement String 聊天室公告
    liveUrl String 视频直播拉流地址
    isValidRoom boolean 聊天室是否有效
    serverExtension String 聊天室服务端扩展字段。必须为 JSON 格式封装,长度上限为 2048 字节,多端同步。
    queueLevelMode V2NIMChatroomQueueLevelMode 聊天室队列操作权限模式
    creatorAccountId String 聊天室创建者用户账号
    onlineUserCount int 聊天室当前在线用户数量
    chatBanned boolean 聊天室是否处于禁言状态:
  • true:禁言
  • false:非禁言
  • tempChatBanned boolean 聊天室是否处于临时禁言状态:
  • true:禁言
  • false:非禁言
  • V2NIMChatroomMember

    聊天室成员信息。

    Andoroid
    javapublic interface V2NIMChatroomMember extends Serializable {
        String getRoomId();
        String getAccountId();
        V2NIMChatroomMemberRole getMemberRole();
        Integer getMemberLevel();
        String getRoomNick();
        String getRoomAvatar();
        String getServerExtension();
        boolean isOnline();
        boolean isBlocked();
        boolean isChatBanned();
        boolean isTempChatBanned();
        long getTempChatBannedDuration();
        List<String> getTags();
        String getNotifyTargetTags();
        long getEnterTime();
        long getUpdateTime();
        boolean isValid();
        List<V2NIMChatroomEnterInfo> getMultiEnterInfo();
    }
    
    iOS
    objective-c@interface V2NIMChatroomMember : NSObject <NSCopying>
    @property (nullable,nonatomic,strong,readonly) NSString *roomId;
    @property (nullable,nonatomic,strong,readonly) NSString *accountId;
    @property (nonatomic,assign,readonly) V2NIMChatroomMemberRole memberRole; 
    @property (nonatomic,assign,readonly) NSInteger memberLevel;
    @property (nullable,nonatomic,strong,readonly) NSString *roomNick;
    @property (nullable,nonatomic,strong,readonly) NSString *roomAvatar;
    @property (nullable,nonatomic,strong,readonly) NSString *serverExtension;
    @property (nonatomic,assign,readonly) BOOL isOnline;
    @property (nonatomic,assign,readonly) BOOL blocked;
    @property (nonatomic,assign,readonly) BOOL chatBanned;
    @property (nonatomic,assign,readonly) BOOL tempChatBanned;
    @property (nonatomic,assign,readonly) NSInteger tempChatBannedDuration;
    @property (nullable,nonatomic,strong,readonly) NSArray<NSString *> *tags;
    @property (nullable,nonatomic,strong,readonly) NSString *notifyTargetTags;
    @property (nonatomic,assign,readonly) NSTimeInterval enterTime;
    @property (nonatomic,assign,readonly) NSTimeInterval updateTime;
    @property (nonatomic,assign,readonly) BOOL valid;
    @property (nullable,nonatomic,strong,readonly) NSArray *multiEnterInfo;
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomMember {
        nstd::string roomId;
        nstd::string accountId;
        V2NIMChatroomMemberRole memberRole{V2NIM_CHATROOM_MEMBER_ROLE_NORMAL};
        nstd::optional<uint32_t> memberLevel;
        nstd::optional<nstd::string> roomNick;
        nstd::optional<nstd::string> roomAvatar;
        nstd::optional<nstd::string> serverExtension;
        bool isOnline{true};
        bool blocked{false};
        bool chatBanned{false};
        bool tempChatBanned{false};
        uint64_t tempChatBannedDuration{0};
        nstd::vector<nstd::string> tags;
        nstd::string notifyTargetTags;
        uint64_t enterTime{0};
        uint64_t updateTime{0};
        bool valid{true};
        nstd::vector<V2NIMChatroomEnterInfo> multiEnterInfo;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMChatroomMember = {
      roomId: string
      accountId: string
      memberRole: V2NIMChatroomMemberRole
      memberLevel?: number
      roomNick?: string
      roomAvatar?: string
      serverExtension?: string
      isOnline: boolean
      blocked: boolean
      chatBanned: boolean
      tempChatBanned: boolean
      tempChatBannedDuration: number
      tags?: string
      notifyTargetTags?: string
      enterTime?: number
      updateTime: number
      valid: boolean
      multiEnterInfo: V2NIMChatroomEnterInfo[]
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 默认值 描述
    roomId String - 聊天室 ID
    accountId String - 聊天室成员用户账号
    memberRole V2NIMChatroomMemberRole - 聊天室成员角色类型
    memberLevel int 0,表示未设置 聊天室成员等级,大于或等于 0 的整数。
    roomNick String - 聊天室中显示昵称
    roomAvatar String - 聊天室中显示头像
    serverExtension String - 聊天室成员服务端扩展字段,多端同步。建议 JSON 格式,长度上限为 2048。
    isOnline boolean - 聊天室用户是否在线
    blocked boolean - 聊天室用户是否在黑名单列表中
    chatBanned boolean - 聊天室用户是否处于禁言状态
    tempChatBanned boolean - 聊天室用户是否处于临时禁言状态
    tempChatBannedDuration long 0 聊天室临时禁言时长(秒)
    tags List - 聊天室登录终端标签
    notifyTargetTags String - 聊天室登录登出通知标签,请参见标签表达式
    enterTime long 0 用户进入聊天室时间戳。
    固定成员离线后该字段为 0。
    updateTime long - 固定成员(创建者、管理员、普通成员)更新时间戳
    valid boolean - 预留字段
    multiEnterInfo List<V2NIMChatroomEnterInfo> - 聊天室多端登录信息。
    同一个账号可以登录多个终端,多个终端同时在线。

    V2NIMChatroomEnterInfo

    进入聊天室信息。

    Andoroid
    javapublic interface V2NIMChatroomEnterInfo extends Serializable {
        String getRoomNick();
        String getRoomAvatar();
    
        long getEnterTime();
    
        int getClientType();
    }
    
    iOS
    objective-c@interface V2NIMChatroomEnterInfo: NSObject <NSCopying>
    @property (nullable,nonatomic,strong,readonly) NSString *roomNick;
    @property (nullable,nonatomic,strong,readonly) NSString *roomAvatar;
    @property (nonatomic,assign,readonly) NSTimeInterval enterTime;
    @property (nonatomic,assign,readonly) NSInteger clientType;
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomEnterInfo {
        nstd::string roomNick;
        nstd::string roomAvatar;
        uint64_t enterTime{0};
        uint32_t clientType{0};
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMChatroomEnterInfo {
      roomNick: string
      roomAvatar: string
      enterTime: number
      clientType: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 默认值 描述
    roomNick String - 进入聊天室后显示的昵称
    roomAvatar String - 进入聊天室后显示的头像
    enterTime long 0 用户进入聊天室时间戳。离线成员该字段为 0。
    clientType int 0,表示未设置 进入聊天室终端类型

    V2NIMChatroomKickedInfo

    被踢出聊天室信息。

    Andoroid
    javapublic interface V2NIMChatroomKickedInfo extends Serializable {
    
        V2NIMChatroomKickedReason getKickedReason();
    
        String getServerExtension();
    }
    
    iOS
    objective-c@interface V2NIMChatroomKickedInfo : NSObject
    
    @property(nonatomic,assign,readonly) V2NIMChatroomKickedReason kickedReason;
    @property(nullable,nonatomic,copy,readonly) NSString *serverExtension;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomKickedInfo {
        V2NIMChatroomKickedReason kickedReason{V2NIM_CHATROOM_KICKED_REASON_UNKNOWN};
        nstd::string serverExtension;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMChatroomKickedInfo {
      kickedReason: V2NIMChatroomKickedReason
      serverExtension: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 是否必填 描述
    kickedReason V2NIMChatroomKickedReason 被踢原因
    serverExtension String 被踢信息的服务端扩展字段,多端同步。

    V2NIMUserInfoConfig

    消息发送方的用户信息配置。

    Andoroid
    javapublic class V2NIMUserInfoConfig implements Serializable {
        public Long getUserInfoTimestamp() {
            return userInfoTimestamp;
        }
    
        public void setUserInfoTimestamp(Long userInfoTimestamp) {
            this.userInfoTimestamp = userInfoTimestamp;
        }
    
        public String getSenderNick() {
            return senderNick;
        }
    
        public void setSenderNick(String senderNick) {
            this.senderNick = senderNick;
        }
    
        public String getSenderAvatar() {
            return senderAvatar;
        }
    
        public void setSenderAvatar(String senderAvatar) {
            this.senderAvatar = senderAvatar;
        }
    
        public String getSenderExtension() {
            return senderExtension;
        }
    
        public void setSenderExtension(String senderExtension) {
            this.senderExtension = senderExtension;
        }
    }
    
    iOS
    objective-c@interface V2NIMUserInfoConfig : NSObject <NSCopying>
    
    @property(nonatomic, assign, readwrite) NSTimeInterval userInfoTimestamp;
    
    @property(nullable, nonatomic, strong, readwrite) NSString *senderNick;
    
    @property(nullable, nonatomic, strong, readwrite) NSString *senderAvatar;
    
    @property(nullable, nonatomic, strong, readwrite) NSString *senderExtension;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMUserInfoConfig {
        uint64_t userInfoTimestamp{0};
        nstd::string senderNick;
        nstd::string senderAvatar;
        nstd::string senderExtension;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMUserInfoConfig = {
      userInfoTimestamp?: number
      senderNick?: string
      senderAvatar?: string
      senderExtension?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    userInfoTimestamp long null 消息发送方用户信息的最后更新时间
    senderNick String null 消息发送方的昵称
    senderAvatar String null 消息发送方的头像
    senderExtension String null 消息发送方的服务端扩展字段,多端同步。

    V2NIMChatroomMessageConfig

    聊天室消息配置。

    Andoroid
    javapublic class V2NIMChatroomMessageConfig implements Serializable {
    
        public V2NIMChatroomMessageConfig() {
        }
    
        public V2NIMChatroomMessageConfig(Boolean historyEnabled) {
            this.historyEnabled = historyEnabled;
        }
    
        public boolean isHighPriority() {
            if (highPriority == null) {
                return false;
            }
            return highPriority;
        }
    
        public void setHighPriority(Boolean highPriority) {
            this.highPriority = highPriority;
        }
    
        public boolean isHistoryEnabled() {
            if (historyEnabled == null) {
                return true;
            }
            return historyEnabled;
        }
    
        public void setHistoryEnabled(boolean historyEnabled) {
            this.historyEnabled = historyEnabled;
        }
    }
    
    iOS
    objective-c@interface V2NIMChatroomMessageConfig : NSObject <NSCopying>
    @property(nonatomic,assign,readwrite) BOOL historyEnabled;
    @property(nonatomic,assign,readwrite) BOOL highPriority;
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomMessageConfig {
        bool historyEnabled{true};
        bool highPriority{false};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMChatroomMessageConfig = {
      historyEnabled?: boolean
      highPriority?: boolean
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    historyEnabled boolean true 是否需要在服务端保存历史消息
    highPriority boolean false 是否是高优先级消息。
    在超频情况下, 默认先流控低优先级消息。

    V2NIMChatroomMessage

    聊天室消息。

    Andoroid
    javapublic interface V2NIMChatroomMessage extends Serializable {
    
        String getMessageClientId();
    
        int getSenderClientType();
    
        long getCreateTime();
    
        String getSenderId();
    
        String getRoomId();
    
        boolean isSelf();
    
        V2NIMMessageAttachmentUploadState getAttachmentUploadState();
    
        V2NIMMessageSendingState getSendingState();
    
        // 消息类型
        V2NIMMessageType getMessageType();
    
        Integer getSubType();
    
        String getText();
    
        // 消息附属附件,根据消息类型继承实现
        V2NIMMessageAttachment getAttachment();
    
        String getServerExtension();
    
        String getCallbackExtension();
    
        V2NIMMessageRouteConfig getRouteConfig();
    
        V2NIMMessageAntispamConfig getAntispamConfig();
    
        String getNotifyTargetTags();
    
        V2NIMChatroomMessageConfig getMessageConfig();
    
        V2NIMUserInfoConfig getUserInfoConfig();
    
        V2NIMLocationInfo getLocationInfo();
    
    iOS
    objective-c@interface V2NIMChatroomMessage : NSObject<NSCopying>
    @property(nullable,nonatomic,strong,readonly) NSString *messageClientId;
    @property(nonatomic,assign,readonly) NSInteger senderClientType;
    @property(nonatomic,assign,readonly) NSTimeInterval createTime;
    @property(nullable,nonatomic,strong,readonly) NSString *senderId;
    @property(nullable,nonatomic,strong,readonly) NSString *roomId;
    @property(nonatomic,assign,readonly) BOOL isSelf;
    @property(nonatomic,assign,readonly) V2NIMMessageAttachmentUploadState attachmentUploadState;
    @property(nonatomic,assign,readonly) V2NIMMessageSendingState sendingState;
    @property(nonatomic,assign,readonly) V2NIMMessageType messageType;
    @property(nonatomic,assign) NSInteger subType;
    @property(nullable,nonatomic,strong) NSString *text;
    @property(nullable,nonatomic,strong) V2NIMMessageAttachment *attachment;
    @property(nullable,nonatomic,strong) NSString *serverExtension;
    @property(nullable,nonatomic,strong,readonly) NSString *callbackExtension;
    @property(nullable,nonatomic,strong,readonly) V2NIMMessageRouteConfig *routeConfig;
    @property(nullable,nonatomic,strong,readonly) V2NIMMessageAntispamConfig *antispamConfig;
    @property(nullable,nonatomic,strong) NSString *notifyTargetTags;
    @property(nullable,nonatomic,strong,readonly) V2NIMChatroomMessageConfig *messageConfig;
    @property(nullable,nonatomic,strong) V2NIMUserInfoConfig *userInfoConfig;
    @property(nullable,nonatomic,strong) V2NIMLocationInfo *locationInfo;
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomMessage {
        nstd::string messageClientId;
        V2NIMLoginClientType senderClientType{V2NIM_LOGIN_CLIENT_TYPE_UNKNOWN};
        uint64_t createTime{0};
        nstd::string senderId;
        nstd::string roomId;
        bool isSelf{false};
        V2NIMMessageAttachmentUploadState attachmentUploadState{V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_UNKNOWN};
        V2NIMMessageSendingState sendingState{V2NIM_MESSAGE_SENDING_STATE_UNKNOWN};
        V2NIMMessageType messageType{V2NIM_MESSAGE_TYPE_TEXT};
        uint32_t subType{0};
        nstd::string text;
        nstd::shared_ptr<V2NIMMessageAttachment> attachment;
        nstd::optional<nstd::string> serverExtension;
        nstd::optional<nstd::string> callbackExtension;
        V2NIMMessageRouteConfig routeConfig;
        V2NIMMessageAntispamConfig antispamConfig;
        nstd::string notifyTargetTags;
        V2NIMChatroomMessageConfig messageConfig;
        V2NIMUserInfoConfig userInfoConfig;
        nstd::optional<V2NIMLocationInfo> locationInfo;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMChatroomMessage = {
      messageClientId: string
      senderClientType: number
      createTime: number
      senderId: string
      roomId: string
      isSelf: boolean
      // attachmentUploadState: V2NIMMessageAttachmentUploadState
      sendingState: V2NIMMessageSendingState
      messageType: V2NIMMessageType
      subType?: number
      text?: string
      serverExtension?: string
      callbackExtension?: string
      messageConfig?: V2NIMChatroomMessageConfig
      routeConfig?: V2NIMMessageRouteConfig
      antispamConfig?: V2NIMMessageAntispamConfig
      notifyTargetTags?: string
      userInfoConfig?: V2NIMUserInfoConfig
      locationInfo?: V2NIMLocationInfo
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 是否只读 描述
    messageClientId String 消息客户端 ID。
    客户端生成的 UUID,不多端同步。
    senderClientType V2NIMLoginClientType 消息发送方的登录客户端类型,服务端返回。
    createTime long 消息创建时间戳(毫秒),服务端返回。
    在消息发送成功前,该字段为发送者本地时间。
    senderId String 消息发送方账号
    roomId String 聊天室 ID
    isSelf boolean 消息发送方是否为本人
    attachmentUploadState V2NIMMessageAttachmentUploadState 消息附件上传状态
    sendingState V2NIMMessageSendingState 消息发送状态
    messageType V2NIMMessageType 消息类型
    subType int - 消息子类型
    text String - 消息文本内容,仅文本类型的消息有该字段。不超过 5000 字符。
    attachment V2NIMMessageAttachment - 消息附件,仅图片、语音、视频、文件类型消息有该字段。
    serverExtension String - 消息服务端扩展字段,多端同步。不超过 2048 字节。
    callbackExtension String 第三方回调透传的自定义扩展字段,不超过 2048 字节。
    routeConfig V2NIMMessageRouteConfig 消息事件抄送相关配置。
    消息抄送功能需要在云信控制台开通
    antispamConfig V2NIMMessageAntispamConfig 反垃圾相关配置。
    反垃圾功能包括客户端反垃圾和安全通,均需要在云信控制台开通
    notifyTargetTags String - 消息通知标签信息,标签表达式请参见聊天室标签管理
    messsageConfig V2NIMChatroomMessageConfig 聊天室消息配置
    userInfoConfig V2NIMUserInfoConfig - 消息发送方用户信息配置

    V2NIMChatroomNotificationAttachment

    聊天室通知消息附件对象,继承自 V2NIMMessageAttachment

    Andoroid
    javapublic interface V2NIMChatroomNotificationAttachment extends V2NIMMessageAttachment {
        V2NIMChatroomMessageNotificationType getType();
        List<String> getTargetIds();
        List<String> getTargetNicks();
        String getTargetTag();
        String getOperatorId();
        String getOperatorNick();
        String getNotificationExtension();
        List<String> getTags();
    }
    
    iOS
    objective-c@interface V2NIMChatroomNotificationAttachment : V2NIMMessageAttachment
    @property(nonatomic, assign, readonly) V2NIMChatroomMessageNotificationType type;
    @property(nonatomic, strong, readonly) NSArray<NSString *> *targetIds;
    @property(nonatomic, strong, readonly) NSArray<NSString *> *targetNicks;
    @property(nonatomic, strong, readonly) NSString *targetTag;
    @property(nonatomic, strong, readonly) NSString *operatorId;
    @property(nonatomic, strong, readonly) NSString *operatorNick;
    @property(nonatomic, strong, readonly) NSString *notificationExtension;
    @property(nonatomic, strong, readonly) NSArray<NSString *> *tags;
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomNotificationAttachment : public V2NIMMessageAttachment {
        V2NIMChatroomNotificationAttachment() { attachmentType = V2NIM_MESSAGE_ATTACHMENT_TYPE_CHATROOM_NOTIFICATION; }
        V2NIMChatroomMessageNotificationType type{V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_ENTER};
        nstd::vector<nstd::string> targetIds;
        nstd::vector<nstd::string> targetNicks;
        nstd::optional<nstd::string> targetTag;
        nstd::string operatorId;
        nstd::string operatorNick;
        nstd::optional<nstd::string> notificationExtension;
        nstd::vector<nstd::string> tags;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMChatroomNotificationAttachment extends V2NIMMessageAttachment {
      type: V2NIMChatroomMessageNotificationType
      targetIds?: string[]
      targetNicks?: string
      targetTag?: string
      operatorId?: string
      operatorNick?: string
      notificationExtension?: string
      tags?: string[]
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    type V2NIMChatroomMessageNotificationType - 通知类型
    targetIds List null 被操作者账号(accountId)列表
    targetNicks List null 被操作者的昵称列表
    targetTag String null 被操作者的标签
    operatorId String null 操作者账号(accountId)
    operatorNick String null 操作者的昵称
    notificationExtension String null 操作后通知的扩展字段
    tags List null 操作后通知的通知的标签列表

    V2NIMChatroomMessageRevokeNotificationAttachment

    聊天室撤回消息通知附件对象,继承自 V2NIMMessageAttachment

    Andoroid
    java
    
    iOS
    objective-c
    
    macOS/Windows
    cpp
    
    Web/uni-app/小程序
    typescript
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 描述
    messageClientId String 撤回的消息客户端 ID。
    客户端生成的 UUID,不多端同步。
    messageTime long 消息撤回时间戳

    V2NIMChatroomChatBannedNotificationAttachment

    聊天室禁言通知附件对象,继承自 V2NIMMessageAttachment

    Andoroid
    java
    
    iOS
    objective-c
    
    macOS/Windows
    cpp
    
    Web/uni-app/小程序
    typescript
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 描述
    chatBanned boolean 聊天室成员是否被禁言
    tempChatBanned boolean 聊天室成员是否被临时禁言
    tempChatBannedDuration long 聊天室成员被临时禁言时长(毫秒)。0 表示已解除禁言。

    V2NIMChatroomMemberEnterNotificationAttachment

    成员进出聊天室通知附件对象,继承自 V2NIMMessageAttachment

    Andoroid
    java
    
    iOS
    objective-c
    
    macOS/Windows
    cpp
    
    Web/uni-app/小程序
    typescript
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 描述
    chatBanned boolean 聊天室成员是否被禁言。
    管理员、普通成员、普通游客离开后再次进入聊天室时,保持之前设置的状态不变。
    tempChatBanned boolean 聊天室成员是否被临时禁言。
    管理员、普通成员、普通游客离开后再次进入聊天室时,保持之前设置的状态不变。
    tempChatBannedDuration long 聊天室成员被禁言时长(毫秒)。
    成员离开后再次进入聊天室时,禁言时长不会重新计算。

    V2NIMChatroomMemberRoleUpdateAttachment

    聊天室成员角色变更通知附件对象,继承自 V2NIMMessageAttachment

    Andoroid
    java
    
    iOS
    objective-c
    
    macOS/Windows
    cpp
    
    Web/uni-app/小程序
    typescript
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 描述
    previousRole V2NIMChatroomMemberRole 变更前的角色类型
    currentMember V2NIMChatroomMember 变更后的成员信息

    V2NIMSendChatroomMessageParams

    聊天室消息发送参数配置。

    Andoroid
    javapublic class V2NIMSendChatroomMessageParams {
    
        public V2NIMSendChatroomMessageParams() {
        }
    
        public V2NIMChatroomMessageConfig getMessageConfig() {
            return messageConfig;
        }
        public void setMessageConfig(V2NIMChatroomMessageConfig messageConfig) {
        this.messageConfig = messageConfig;
        }
        public V2NIMMessageRouteConfig getRouteConfig() {
            return routeConfig;
        }
    
        public void setRouteConfig(V2NIMMessageRouteConfig routeConfig) {
            this.routeConfig = routeConfig;
        }
    
        public V2NIMMessageAntispamConfig getAntispamConfig() {
            return antispamConfig;
        }
    
        public void setAntispamConfig(V2NIMMessageAntispamConfig antispamConfig) {
            this.antispamConfig = antispamConfig;
        }
    
        public boolean isClientAntispamEnabled() {
            if (clientAntispamEnabled == null) {
            return false;
        }
            return clientAntispamEnabled;
        }
    
        public void setClientAntispamEnabled(Boolean clientAntispamEnabled) {
            this.clientAntispamEnabled = clientAntispamEnabled;
        }
    
        public String getClientAntispamReplace() {
            if(clientAntispamReplace == null) {
            return "";
        }
            return clientAntispamReplace;
        }
    
        public void setClientAntispamReplace(String clientAntispamReplace) {
            this.clientAntispamReplace = clientAntispamReplace;
        }
    
        public List<String> getReceiverIds() {
            return receiverIds;
        }
    
        public void setReceiverIds(List<String> receiverIds) {
            this.receiverIds = receiverIds;
        }
    
        public String getNotifyTargetTags() {
            return notifyTargetTags;
        }
    
        public void setNotifyTargetTags(String notifyTargetTags) {
            this.notifyTargetTags = notifyTargetTags;
        }
    
        public V2NIMLocationInfo getLocationInfo() {
            return locationInfo;
        }
    
        public void setLocationInfo(V2NIMLocationInfo locationInfo) {
            this.locationInfo = locationInfo;
        }
    }
    
    iOS
    objective-c@interface V2NIMSendChatroomMessageParams : NSObject
    @property(nullable, nonatomic, strong, readwrite) V2NIMChatroomMessageConfig *messageConfig;
    @property(nullable, nonatomic, strong, readwrite) V2NIMMessageRouteConfig *routeConfig;
    @property(nullable, nonatomic, strong, readwrite) V2NIMMessageAntispamConfig *antispamConfig;
    V2NIMClientAntispamOperateType,
    @property(nonatomic, assign, readwrite) BOOL clientAntispamEnabled;
    @property(nullable, nonatomic, strong, readwrite) NSString *clientAntispamReplace;
    @property(nullable, nonatomic, strong, readwrite) NSArray *receiverIds;
    @property(nullable, nonatomic, strong, readwrite) NSString *notifyTargetTags;
    @property(nullable, nonatomic, strong, readwrite) V2NIMLocationInfo *locationInfo;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMSendChatroomMessageParams {
        V2NIMChatroomMessageConfig messageConfig;
        V2NIMMessageRouteConfig routeConfig;
        V2NIMMessageAntispamConfig antispamConfig;
        bool clientAntispamEnabled{false};
        nstd::string clientAntispamReplace;
        nstd::vector<nstd::string> receiverIds;
        nstd::string notifyTargetTags;
        nstd::optional<V2NIMLocationInfo> locationInfo;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMSendChatroomMessageParams = {
      messageConfig?: V2NIMChatroomMessageConfig
      routeConfig?: V2NIMMessageRouteConfig
      antispamConfig?: V2NIMMessageAntispamConfig
      clientAntispamEnabled?: boolean
      clientAntispamReplace?: string
      receiverIds?: string[]
      notifyTargetTags?: string
      locationInfo?: V2NIMLocationInfo
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    messageConfig V2NIMChatroomMessageConfig - 聊天室消息相关配置
    routeConfig V2NIMMessageRouteConfig - 消息事件抄送相关配置
    antispamConfig V2NIMMessageAntispamConfig - 消息反垃圾相关配置,包括本地反垃圾或安全通配置,均需要在云信控制台开通
    clientAntispamEnabled boolean false 是否启用本地反垃圾。
  • 仅对文本消息生效
  • 如果开启本地发垃圾,发送消息时会进行本地反垃圾检测,完成后返回检测结果 V2NIMClientAntispamOperatorType
    • 0:检测通过,可以发送该消息。
    • 1:发送替换后的文本消息。
    • 2:检测不通过,消息发送失败,返回本地错误码。
    • 3:消息发送后,由服务端拦截
  • clientAntispamReplace String clientAntispamEnabled 为 true 则必填 "" 反垃圾命中后替换的文本
    receiverIds List null 定向消息接收者账号列表,最多支持指定 100 个接收者。
    若该字段不为空,则表示该消息为聊天室定向消息,不在服务端进行存储
    notifyTargetTags String null 消息接收通知的标签,请参见标签表达式
    locationInfo V2NIMLocationInfo null 消息空间位置信息配置

    V2NIMSendChatroomMessageResult

    聊天室消息发送成功结果回包。

    Andoroid
    javapublic interface V2NIMSendChatroomMessageResult {
    
        V2NIMChatroomMessage getMessage();
    
        String getAntispamResult();
    
        V2NIMClientAntispamResult getClientAntispamResult();
    }
    
    iOS
    objective-c@interface V2NIMSendChatroomMessageResult: NSObject <NSCopying>
    @property(nullable,nonatomic,strong,readonly) V2NIMChatroomMessage *message;
    @property(nullable,nonatomic,strong,readonly) NSString *antispamResult;
    @property(nullable,nonatomic,strong,readonly) V2NIMClientAntispamResult *clientAntispamResult;
    @end
    
    macOS/Windows
    cppstruct V2NIMSendChatroomMessageResult {
        V2NIMChatroomMessage message;
        nstd::string antispamResult;
        nstd::optional<V2NIMClientAntispamResult> clientAntispamResult;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMSendChatroomMessageResult = {
      message: V2NIMChatroomMessage
      antispamResult?: string
      clientAntispamResult?: V2NIMClientAntispamResult
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    message V2NIMChatroomMessage 聊天室消息对象
    antispamResult String 安全通反垃圾检测结果
    clientAntispamResult V2NIMClientAntispamResult 本地反垃圾结果

    V2NIMChatroomMemberQueryOption

    聊天室成员分页查询选项。

    Andoroid
    javapublic class V2NIMChatroomMemberQueryOption {
    
        public List<V2NIMChatroomMemberRole> getMemberRoles() {
            return memberRoles;
        }
    
        public boolean isOnlyBlocked() {
            return Boolean.TRUE.equals(onlyBlocked);
        }
    
        public boolean isOnlyChatBanned() {
            return Boolean.TRUE.equals(onlyChatBanned);
        }
    
        public boolean isOnlyOnline() {
            return Boolean.TRUE.equals(onlyOnline);
        }
    
        public String getPageToken() {
            if(pageToken == null){
                return "";
            }
            return pageToken;
        }
    
        public int getLimit() {
            if(limit == null){
                return 100;
            }
            return limit;
        }
    
        public void setMemberRoles(List<V2NIMChatroomMemberRole> memberRoles) {
            this.memberRoles = memberRoles;
        }
    
        public void setOnlyBlocked(boolean onlyBlocked) {
            this.onlyBlocked = onlyBlocked;
        }
    
        public void setOnlyChatBanned(boolean onlyChatBanned) {
            this.onlyChatBanned = onlyChatBanned;
        }
    
        public void setOnlyOnline(boolean onlyOnline) {
            this.onlyOnline = onlyOnline;
        }
    
        public void setPageToken(String pageToken) {
            this.pageToken = pageToken;
        }
    
        public void setLimit(int limit) {
            this.limit = limit;
        }
    
        public boolean isValid() {
            if (getLimit() <= 0) {
                return false;
            }
            if (memberRoles != null && memberRoles.contains(null)) {
                return false;
            }
            return true;
        }
    }
    
    iOS
    objective-c@interface V2NIMChatroomMemberQueryOption: NSObject <NSCopying>
    @property (nullable, nonatomic, strong) NSArray *memberRoles;
    @property (nonatomic, assign) BOOL onlyBlocked;
    @property (nonatomic, assign) BOOL onlyChatBanned;
    @property (nonatomic, assign) BOOL onlyOnline;
    @property (nullable, nonatomic, copy) NSString *pageToken;
    @property (nonatomic, assign) NSInteger limit;
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomMemberQueryOption {
        nstd::vector<V2NIMChatroomMemberRole> memberRoles;
        bool onlyBlocked{false};
        bool onlyChatBanned{false};
        bool onlyOnline{false};
        nstd::string pageToken;
        uint32_t limit{V2NIM_DEFAULT_CHATROOM_QUERY_LIMIT};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMChatroomMemberQueryOption = {
      memberRoles?: V2NIMChatroomMemberRole[]
      onlyBlocked?: boolean
      onlyChatBanned?: boolean
      onlyOnline?: boolean
      pageToken: string
      limit: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    memberRoles List<V2NIMChatroomMemberRole> - 聊天室成员类型。如果不设置或为空则表示查询所有类型的成员。
    onlyBlocked boolean false 是否只返回黑名单成员:
  • true:仅黑名单成员
  • false:全部成员
  • onlyChatBanned boolean false 是否只返回聊天禁言成员列表:
  • true:仅聊天禁言成员
  • false:全部成员
  • onlyOnline boolean false 是否只返回在线的固定成员(创建者、管理员、普通成员):
  • true:仅在线的固定成员
  • false:全部成员
  • pageToken String "" 分页偏移,首次查询传空,下一次查询传入上一次查询返回值中的 nextToken
    limit int 100 单次查询聊天室成员最大数量。不建议超过 200,设置小于等于 0 则默认为 200。

    V2NIMChatroomMemberListResult

    分页获取聊天室成员列表返回结果。

    Andoroid
    javapublic interface V2NIMChatroomMemberListResult {
        String getPageToken();
      
        boolean isFinished();
      
        List<V2NIMChatroomMember> getMemberList();
    }
    
    iOS
    objective-c@interface V2NIMChatroomMemberListResult: NSObject<NSCopying>
    @property (nonnull, nonatomic, copy, readonly) NSString *pageToken;
    @property (nonatomic, assign, readonly) BOOL finished;
    @property (nonnull, nonatomic, copy, readonly) NSArray *memberList;
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomMemberListResult {
        nstd::string pageToken;
        bool finished{false};
        nstd::vector<V2NIMChatroomMember> memberList;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMChatroomMemberListResult = {
      pageToken: string
      finished: boolean
      memberList: V2NIMChatroomMember
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 描述
    pageToken String 分页偏移。
    finished boolean 群成员是否全部获取:
  • true:已全部获取
  • false:未全部获取,可以继续获取。
  • memberList List<V2NIMChatroomMember> 分页获取的聊天室成员列表

    V2NIMChatroomMessageListOption

    聊天室历史消息分页查询选项。

    Andoroid
    javapublic class V2NIMChatroomMessageListOption {
        public V2NIMChatroomMessageListOption() {
        }
    
        public V2NIMChatroomMessageListOption(V2NIMMessageQueryDirection direction, List<V2NIMMessageType> messageTypes, long beginTime, int limit) {
            this.direction = direction;
            this.messageTypes = messageTypes;
            this.beginTime = beginTime;
            this.limit = limit;
        }
    
        public V2NIMMessageQueryDirection getDirection() {
            if (direction == null) {
                return V2NIMMessageQueryDirection.V2NIM_QUERY_DIRECTION_DESC;
            } else {
                return direction;
            }
        }
    
        public List<V2NIMMessageType> getMessageTypes() {
            return messageTypes;
        }
    
        public long getBeginTime() {
            if (beginTime == null) {
                return 0;
            }
            return beginTime;
        }
    
        public int getLimit() {
            if (limit == null) {
            return 100;
            }
            return limit;
        }
    
        public void setDirection(V2NIMMessageQueryDirection direction) {
            this.direction = direction;
        }
    
        public void setMessageTypes(List<V2NIMMessageType> messageTypes) {
            this.messageTypes = messageTypes;
        }
    
        public void setBeginTime(long beginTime) {
            this.beginTime = beginTime;
        }
    
        public void setLimit(int limit) {
            this.limit = limit;
        }
    
        public boolean isValid() {
            if (messageTypes != null && messageTypes.contains(null)) {
                return false;
            }
            if (getLimit() <= 0) {
                return false;
            }
            return true;
        }
    }
    
    iOS
    objective-c@interface V2NIMChatroomMessageListOption: NSObject
    @property (nonatomic, assign) V2NIMQueryDirection direction;
    @property (nullable, nonatomic, strong) NSArray *messageTypes;
    @property (nonatomic, assign) NSTimeInterval beginTime;
    @property (nonatomic, assign) NSInteger limit;
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomMessageListOption {
        V2NIMQueryDirection direction{V2NIM_QUERY_DIRECTION_DESC};
        nstd::vector<V2NIMMessageType> messageTypes;
        uint64_t beginTime{0};
        uint32_t limit{V2NIM_DEFAULT_CHATROOM_QUERY_LIMIT};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMChatroomMessageListOption = {
      direction?: V2NIMQueryDirection
      messageTypes?: V2NIMMessageType[]
      beginTime?: number
      limit?: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    messageTypes List<V2NIMMessageType> null 消息类型,为 null 或空列表则表示查询所有消息类型。
    仅支持 0:文本,1:图片,2:语音,3:视频,4:地理位置,5:通知,6:文件,10:提示,11:Robot,100:自定义,其它为非法参数。
    beginTime long 0 查询开始时间(毫秒)。首次查询传 0,下一次查询传入上一次查询返回值中的 beginTime
    limit int 100 本次查询条数上限,取值范围为 [0,200]。传入小于 0 则默认为 100。
    direction V2NIMQueryDirection V2NIM_QUERY_DIRECTION_DESC 时间降序 查询方向(查询结果方向):按照时间升序或降序

    V2NIMChatroomMemberRoleUpdateParams

    聊天室成员角色更新参数。

    Andoroid
    javapublic class V2NIMChatroomMemberRoleUpdateParams {
        public V2NIMChatroomMemberRoleUpdateParams() {
        }
        
        public V2NIMChatroomMemberRoleUpdateParams(V2NIMChatroomMemberRole memberRole, Integer memberLevel, String notificationExtension) {
            this.memberRole = memberRole;
            this.memberLevel = memberLevel;
            this.notificationExtension = notificationExtension;
        }
        
        public V2NIMChatroomMemberRole getMemberRole() {
            return memberRole;
        }
        
        public Integer getMemberLevel() {
            return memberLevel;
        }
        
        public String getNotificationExtension() {
            return notificationExtension;
        }
        
        public void setMemberRole(V2NIMChatroomMemberRole memberRole) {
            this.memberRole = memberRole;
        }
        
        public void setMemberLevel(int memberLevel) {
            this.memberLevel = memberLevel;
        }
    
        public void setNotificationExtension(String notificationExtension) {
            this.notificationExtension = notificationExtension;
        }
    
        public boolean isValid() {
            if (memberRole == null ||
                    memberRole == V2NIMChatroomMemberRole.V2NIM_CHATROOM_MEMBER_ROLE_CREATOR ||
                    memberRole == V2NIMChatroomMemberRole.V2NIM_CHATROOM_MEMBER_ROLE_ANONYMOUS_GUEST ||
                    memberRole == V2NIMChatroomMemberRole.V2NIM_CHATROOM_MEMBER_ROLE_VIRTUAL) {
                return false;
            }
            if (memberLevel != null && memberLevel < 0) {
                return false;
            }
            return true;
        }
    }
    
    iOS
    objective-c@interface V2NIMChatroomMemberRoleUpdateParams: NSObject
    @property (nonatomic, assign) V2NIMChatroomMemberRole memberRole;
    @property (nonatomic, assign) NSInteger memberLevel;
    @property (nullable, nonatomic, copy) NSString *notificationExtension;
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomMemberRoleUpdateParams {
        V2NIMChatroomMemberRole memberRole{V2NIM_CHATROOM_MEMBER_ROLE_NORMAL};
        nstd::optional<uint32_t> memberLevel;
        nstd::optional<nstd::string> notificationExtension;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMChatroomMemberRoleUpdateParams = {
      memberRole: V2NIMChatroomMemberRole
      memberLevel?: number
      notificationExtension?: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    memberRole V2NIMChatroomMemberRole - 聊天室成员角色类型:
  • 仅聊天室创建者有操作权限:将普通游客、普通成员设置为管理员或反之。
  • 聊天室管理员和创建者均有操作权限:将普通成员设置为普通游客或反之。
  • 不允许操作虚构用户和匿名游客,否则产生报错。
  • memberLevel int 0,表示未设置 聊天室成员等级,大于或等于 0 的整数。
    notificationExtension String null 聊天室成员角色变更通知的扩展字段

    V2NIMChatroomUpdateParams

    聊天室信息更新参数。

    Andoroid
    javapublic class V2NIMChatroomUpdateParams {
    
        public V2NIMChatroomUpdateParams() {
        }
    
        public String getRoomName() {
            return roomName;
        }
    
        public String getAnnouncement() {
            return announcement;
        }
    
        public String getLiveUrl() {
            return liveUrl;
        }
    
        public String getServerExtension() {
            return serverExtension;
        }
    
        public boolean isNotificationEnabled() {
            if (notificationEnabled == null) {
                return true;
            } else {
                return notificationEnabled;
            }
        }
    
        public String getNotificationExtension() {
            return notificationExtension;
        }
    }
    
        public void setRoomName(String roomName) {
         this.roomName = roomName;
        }
    
        public void setAnnouncement(String announcement) {
         this.announcement = announcement;
        }
    
        public void setLiveUrl(String liveUrl) {
            this.liveUrl = liveUrl;
        }
    
        public void setServerExtension(String serverExtension) {
            this.serverExtension = serverExtension;
        }
    
        public void setNotificationEnabled(boolean notificationEnabled) {
            this.notificationEnabled = notificationEnabled;
        }
    
        public void setNotificationExtension(String notificationExtension) {
            this.notificationExtension = notificationExtension;
        }
    
        public boolean isValid() {
            if(roomName != null && roomName.isEmpty()){
                return false;
            }
            if(roomName != null){
                return true;
            }
            if(announcement != null){
                return true;
            }
            if(liveUrl != null){
                return true;
            }
            if(serverExtension != null){
                return true;
            }
            return false;
            }
        }
    
    iOS
    objective-c@interface V2NIMChatroomUpdateParams: NSObject
    @property (nullable, nonatomic, copy) NSString *roomName;
    @property (nullable, nonatomic, copy) NSString *announcement;
    @property (nullable, nonatomic, copy) NSString *liveUrl;
    @property (nullable, nonatomic, copy) NSString *serverExtension;
    @property (nonatomic, assign) BOOL notificationEnabled;
    @property (nullable, nonatomic, copy) NSString *notificationExtension;
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomUpdateParams {
        nstd::optional<nstd::string> roomName;
        nstd::optional<nstd::string> announcement;
        nstd::optional<nstd::string> liveUrl;
        nstd::optional<nstd::string> serverExtension;
        bool notificationEnabled{true};
        nstd::string notificationExtension;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMChatroomUpdateParams {
      roomName?: string;
      announcement?: string;
      liveUrl?: string;
      serverExtension?: string;
      notificationEnabled?: boolean;
      notificationExtension?: string;
    }
    

    成员参数

    • 以下参数必须设置其一,否则返回参数错误。
    • 如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。
    名称 类型 是否必填 描述
    roomName String 聊天室名称。设置为空表示不更新该字段,不可设置为 "",否则返回参数错误。
    announcement String 聊天室公告。设置为空表示不更新该字段。
    liveUrl String 视频直播拉流地址。设置为空表示不更新该字段。
    serverExtension String 聊天室服务端扩展字段。必须为 JSON 格式封装,长度上限为 4096 字节,多端同步。
    设置为空表示不更新该字段。
    notificationEnabled boolean 否,默认 true 操作后是否需要通知
    notificationExtension String 聊天室信息变更通知的扩展字段

    V2NIMChatroomSelfMemberUpdateParams

    聊天室成员更新本人信息参数。

    Andoroid
    javapublic class V2NIMChatroomSelfMemberUpdateParams {
    
        public V2NIMChatroomSelfMemberUpdateParams() {
        }
    
        public String getRoomNick() {
            return roomNick;
        }
    
        public String getRoomAvatar() {
            return roomAvatar;
        }
    
        public String getServerExtension() {
            return serverExtension;
        }
    
        public boolean isNotificationEnabled() {
            if (notificationEnabled == null) {
                return true;
            }
            return notificationEnabled;
        }
    
        public String getNotificationExtension() {
            return notificationExtension;
        }
    
        public boolean isPersistence() {
            if (persistence == null) {
                return false;
            }
            return persistence;
        }
    
        public void setRoomNick(String roomNick) {
            this.roomNick = roomNick;
        }
    
        public void setRoomAvatar(String roomAvatar) {
            this.roomAvatar = roomAvatar;
        }
    
        public void setServerExtension(String serverExtension) {
            this.serverExtension = serverExtension;
        }
    
        public void setNotificationEnabled(boolean notificationEnabled) {
            this.notificationEnabled = notificationEnabled;
        }
    
        public void setNotificationExtension(String notificationExtension) {
            this.notificationExtension = notificationExtension;
        }
    
        public void setPersistence(boolean persistence) {
            this.persistence = persistence;
        }
    
        public boolean isValid() {
            if (roomNick != null && roomNick.isEmpty()) {
                return false;
            }
            if (roomNick != null) {
                return true;
            }
            if (roomAvatar != null) {
                return true;
            }
            if (serverExtension != null) {
                return true;
            }
            return false;
        }
    }
    
    iOS
    objective-c@interface V2NIMChatroomSelfMemberUpdateParams: NSObject
    @property (nullable, nonatomic, copy) NSString *roomNick;
    @property (nullable, nonatomic, copy) NSString *roomAvatar;
    @property (nullable, nonatomic, copy) NSString *serverExtension;
    @property (nonatomic, assign) BOOL notificationEnabled;
    @property (nullable, nonatomic, copy) NSString *notificationExtension;
    @property (nonatomic, assign) BOOL persistence;
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomSelfMemberUpdateParams {
        nstd::optional<nstd::string> roomNick;
        nstd::optional<nstd::string> roomAvatar;
        nstd::optional<nstd::string> serverExtension;
        bool notificationEnabled{true};
        nstd::string notificationExtension;
        bool persistence{false};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMChatroomSelfMemberUpdateParams = {
      roomNick?: string
      roomAvatar?: string
      serverExtension?: string
      notificationEnabled?: boolean
      notificationExtension?: string
      persistence?: boolean
    }
    

    成员参数

    • 以下参数必须设置其一,否则返回参数错误。
    • 如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。
    名称 类型 是否只读 默认值 描述
    roomNick String - 聊天室中显示昵称。设置为空表示不更新该字段,不可设置为 "",否则返回参数错误。
    roomAvatar String - 聊天室中显示头像。设置为空表示不更新该字段。
    serverExtension String - 聊天室成员服务端扩展字段,多端同步。建议 JSON 格式,长度上限为 2048。
    设置为空表示不更新该字段。
    notificationEnabled boolean true 操作后是否需要通知
    notificationExtension String - 操作后通知的扩展字段
    persistence String false 更新信息是否持久化,即是否将数据保存在本地数据库中。

    V2NIMChatroomTagTempChatBannedParams

    聊天室标签用户临时禁言参数。

    Andoroid
    javapublic class V2NIMChatroomTagTempChatBannedParams {
        
        public V2NIMChatroomTagTempChatBannedParams() {
        }
        
        public String getTargetTag() {
            return targetTag;
        }
        
        public String getNotifyTargetTags() {
            return notifyTargetTags;
        }
        
        public int getDuration() {
            if (duration == null) {
                return 0;
            }
            return duration;
        }
        
        public boolean isNotificationEnabled() {
            if (notificationEnabled == null) {
                return true;
            }
            return notificationEnabled;
        }
        
        public String getNotificationExtension() {
            return notificationExtension;
        }
        
        public void setTargetTag(String targetTag) {
            this.targetTag = targetTag;
        }
        
        public void setNotifyTargetTags(String notifyTargetTags) {
            this.notifyTargetTags = notifyTargetTags;
        }
    
        public void setDuration(int duration) {
            this.duration = duration;
        }
    
        public void setNotificationEnabled(boolean notificationEnabled) {
            this.notificationEnabled = notificationEnabled;
        }
    
        public void setNotificationExtension(String notificationExtension) {
            this.notificationExtension = notificationExtension;
        }
    
        public boolean isValid() {
            if (TextUtils.isEmpty(targetTag)) {
                return false;
            }
            if (duration != null && duration < 0) {
                return false;
            }
            return true;
        }
    }
    
    iOS
    objective-c@interface V2NIMChatroomTagTempChatBannedParams: NSObject
    @property (nonnull, nonatomic, copy) NSString *targetTag;
    @property (nonnull, nonatomic, copy) NSString *notifyTargetTags;
    @property (nonatomic, assign) NSUInteger duration;
    @property (nonatomic, assign) BOOL notificationEnabled;
    @property (nullable, nonatomic, copy) NSString *notificationExtension;
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomTagTempChatBannedParams {
        nstd::string targetTag;
        nstd::string notifyTargetTags;
        uint64_t duration{0};
        bool notificationEnabled{true};
        nstd::string notificationExtension;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMChatroomTagTempChatBannedParams {
      targetTag: string
    
      notifyTargetTags: string
    
      duration: number
    
      notificationEnabled: boolean
    
      notificationExtension: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    targetTag String - 被操作者标签
    notifyTargetTags String - 操作后通知的标签,请参见标签表达式
    duration long 0,表示取消临时禁言 临时禁言时长(秒)
    notificationEnabled boolean true 操作后是否需要通知
    notificationExtension String - 操作后通知的扩展字段

    V2NIMChatroomTagsUpdateParams

    聊天室标签信息更新参数。

    Andoroid
    javapublic class V2NIMChatroomTagsUpdateParams {
    
        public V2NIMChatroomTagsUpdateParams() {
        }
    
        public List<String> getTags() {
            return tags;
        }
    
        public String getNotifyTargetTags() {
            return notifyTargetTags;
        }
    
        public boolean isNotificationEnabled() {
            if (notificationEnabled == null) {
                return true;
            }
            return notificationEnabled;
        }
    
        public String getNotificationExtension() {
            return notificationExtension;
        }
    
        public void setTags(List<String> tags) {
            this.tags = tags;
        }
    
        public void setNotifyTargetTags(String notifyTargetTags) {
            this.notifyTargetTags = notifyTargetTags;
        }
    
        public void setNotificationEnabled(boolean notificationEnabled) {
            this.notificationEnabled = notificationEnabled;
        }
    
        public void setNotificationExtension(String notificationExtension) {
            this.notificationExtension = notificationExtension;
        }
    
        public boolean isValid(){
            if (tags == null && notifyTargetTags == null) {
                return false;
            }
            return true;
        }
    }
    
    iOS
    objective-c@interface V2NIMChatroomTagsUpdateParams: NSObject
    @property (nullable, nonatomic, copy) NSArray<NSString *> *tags;
    @property (nullable, nonatomic, copy) NSString *notifyTargetTags;
    @property (nonatomic, assign) BOOL notificationEnabled;
    @property (nullable, nonatomic, copy) NSString *notificationExtension;
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomTagsUpdateParams {
        nstd::optional<nstd::vector<nstd::string>> tags;
        nstd::optional<nstd::string> notifyTargetTags;
        bool notificationEnabled{true};
        nstd::string notificationExtension;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMChatroomtagsUpdateParams {
      tags?: string[]
      notifyTargetTags?: string
      notificationEnabled?: boolean
      notificationExtension?: string
    }
    

    成员参数

    • tagsnotifyTargetTags 必须设置其一,否则返回参数错误。
    • 如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。
    名称 类型 是否必填 描述
    tags List 聊天室标签信息。
    设置为空表示不更新,设置为 [] 表示清空原有标签。
    notifyTargetTags String 操作后通知的标签信息,标签表达式请参见聊天室标签管理
    设置为空表示不更新,设置为 "" 表示清空原有通知标签信息。
    notificationEnabled boolean 否,默认 true 操作后是否需要通知
    notificationExtension String 操作后通知的扩展字段

    V2NIMChatroomTagMemberOption

    聊天室标签成员查询选项。

    Andoroid
    javapublic class V2NIMChatroomTagMemberOption {
    
        public V2NIMChatroomTagMemberOption() {
        }
    
        public V2NIMChatroomTagMemberOption(String tag, String pageToken, Integer limit) {
            this.tag = tag;
            this.pageToken = pageToken;
            this.limit = limit;
        }
    
        public String getTag() {
            return tag;
        }
    
        public String getPageToken() {
            if(pageToken == null){
                return "";
            }
            return pageToken;
        }
    
        public int getLimit() {
            if (limit == null) {
                return 100;
            }
            return limit;
        }
    
        public void setTag(String tag) {
            this.tag = tag;
        }
    
        public void setPageToken(String pageToken) {
            this.pageToken = pageToken;
        }
    
        public void setLimit(int limit) {
            this.limit = limit;
        }
    
        public boolean isValid(){
            if (TextUtils.isEmpty(tag)) {
                return false;
            }
            if (limit != null && limit <= 0) {
                return false;
            }
            return true;
        }
    }
    
    iOS
    objective-c@interface V2NIMChatroomTagMemberOption: NSObject
    @property (nonnull, nonatomic, copy) NSString *tag;
    @property (nonatomic, copy) NSString *pageToken;
    @property (nonatomic, assign) NSInteger limit;
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomTagMemberOption {
        nstd::string tag;
        nstd::string pageToken;
        uint32_t limit{V2NIM_DEFAULT_CHATROOM_QUERY_LIMIT};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMChatroomTagMemberOption = {
      tag: string
      pageToken?: number
      limit?: number
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    tag String - 聊天室标签信息
    pageToken String "" 分页偏移,首次查询传空,下一次查询传入上一次查询返回值中的 nextToken
    limit int 100 单次查询最大数量。必须大于 0,否则返回参数错误。

    V2NIMChatroomTagMessageOption

    按标签分页查询聊天室消息选项。

    Andoroid
    javapublic class V2NIMChatroomTagMessageOption {
    
        public List<String> getTags() {
            return tags;
        }
    
        public List<V2NIMMessageType> getMessageTypes() {
            return messageTypes;
        }
    
        public long getBeginTime() {
            if (beginTime == null) {
                return 0;
            }
            return beginTime;
        }
    
        public long getEndTime() {
            if (endTime == null) {
                return 0;
            }
            return endTime;
        }
    
        public Integer getLimit() {
            if (limit == null) {
                return 100;
            }
            return limit;
        }
    
        public V2NIMMessageQueryDirection getDirection() {
            if(direction == null){
                return V2NIMMessageQueryDirection.V2NIM_QUERY_DIRECTION_DESC;
            }
            return direction;
        }
    
        public void setTags(List<String> tags) {
            this.tags = tags;
        }
    
        public void setMessageTypes(List<V2NIMMessageType> messageTypes) {
            this.messageTypes = messageTypes;
        }
    
        public void setBeginTime(Long beginTime) {
            this.beginTime = beginTime;
        }
    
        public void setEndTime(Long endTime) {
            this.endTime = endTime;
        }
    
        public void setLimit(Integer limit) {
            this.limit = limit;
        }
    
        public void setDirection(V2NIMMessageQueryDirection direction) {
            this.direction = direction;
        }
    
        public boolean isValid() {
            if(CollectionUtil.isEmpty(tags)){
                return false;
            }
            if(getLimit() <= 0){
                return false;
            }
            if(getEndTime() > 0 && getBeginTime() > getEndTime()){
                return false;
            }
            if(messageTypes != null && messageTypes.contains(null)){
                return false;
            }
            return true;
        }
    }
    
    iOS
    objective-c@interface V2NIMChatroomTagMessageOption: NSObject
    @property (nonnull, nonatomic, strong) NSArray *tags;
    @property (nullable, nonatomic, strong) NSArray *messageTypes;
    @property (nonatomic, assign) NSTimeInterval beginTime;
    @property (nonatomic, assign) NSTimeInterval endTime;
    @property (nonatomic, assign) NSInteger limit;
    @property (nonatomic, assign) V2NIMQueryDirection direction;
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomTagMessageOption {
        nstd::vector<nstd::string> tags;
        nstd::vector<V2NIMMessageType> messageTypes;
        uint64_t beginTime{0};
        uint64_t endTime{0};
        uint32_t limit{V2NIM_DEFAULT_CHATROOM_QUERY_LIMIT};
        V2NIMQueryDirection direction{V2NIM_QUERY_DIRECTION_DESC};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMChatroomTagMessageOption = {
      tags?: string[]
      messageTypes?: V2NIMMessageType[]
      beginTime?: number
      endTime?: number
      limit?: number
      direction?: V2NIMQueryDirection
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    tags List - 聊天室标签信息。如果为空或 size 为 0,则返回参数错误。
    messageTypes List<V2NIMMessageType> null 消息类型,为 null 或空列表则表示查询所有消息类型。
    beginTime long 0 查询开始时间。该字段必须小于等于 endTime
    endTime long 0 查询结束时间。该字段必须大于等于 beginTime,默认为系统当前时间。
    direction V2NIMQueryDirection V2NIM_QUERY_DIRECTION_DESC 查询方向(查询结果方向):按照时间升序或降序
    limit int 100 本次查询条数上限。必须大于 0,否则返回 191004 参数错误。

    V2NIMChatroomClientListener

    聊天室实例监听器。

    调用 addChatroomClientListener 注册聊天室实例监听后,当相关事件发生时,会返回对应回调。

    Andoroid
    javapublic interface V2NIMChatroomClientListener {
    
        void onChatroomStatus(V2NIMChatroomStatus status,V2NIMError error);
        void onChatroomEntered();
        void onChatroomExited(V2NIMError error);
        void onChatroomKicked(V2NIMChatroomKickedInfo kickedInfo);
    }
    
    iOS
    objective-c@protocol V2NIMChatroomClientListener <NSObject>
    
    @optional
    
    - (void)onChatroomStatus:(V2NIMChatroomStatus)status
                       error:(nullable V2NIMError *)error;
    
    - (void)onChatroomEntered;
    
    - (void)onChatroomExited:(nullable V2NIMError *)error;
    
    - (void)onChatroomKicked:(V2NIMChatroomKickedInfo *)kickedInfo;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomClientListener {
        nstd::function<void(V2NIMChatroomStatus status, nstd::optional<V2NIMError> error)> onChatroomStatus;
        nstd::function<void()> onChatroomEntered;
        nstd::function<void(nstd::optional<V2NIMError> error)> onChatroomExited;
        nstd::function<void(V2NIMChatroomKickedInfo kickedInfo)> onChatroomKicked;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMChatroomClientListener = {
      onChatroomStatus: [status: V2NIMChatroomStatus, error?: V2NIMError]
      onChatroomEntered: []
      onChatroomExited: [error?: V2NIMError]
      onChatroomKicked: [kickedInfo: V2NIMChatroomKickedInfo]
    }
    

    成员函数

    • onChatroomStatus

      聊天室状态变更回调。聊天室内所有成员均会收到该回调。

      参数名称 类型 描述
      status V2NIMChatroomStatus 聊天室状态信息
      error V2NIMError 错误信息
    • onChatroomEntered

      进入聊天室回调。

    • onChatroomExited

      退出聊天室回调。退出聊天室后,不会继续重连。
      退出聊天室包括以下场景:

      • 账号变更后登录失败导致退出聊天室。
      • 被加入聊天室黑名单导致退出聊天室。
      • 由于账号被封禁导致退出聊天室。
      • 由于聊天室被关闭导致退出聊天室。
      参数名称 类型 描述
      error V2NIMError 错误信息
    • onChatroomKicked

      被踢出聊天室回调。
      被踢出聊天室后,会同时触发 onChatroomExited 回调。

      参数名称 类型 描述
      kickedInfo V2NIMChatroomKickedInfo 被踢详细信息

    V2NIMChatroomListener

    聊天室监听器。

    调用 addChatroomListener 注册聊天室监听后,当相关事件发生时,会返回对应回调。

    Andoroid
    javapublic interface V2NIMChatroomListener extends Serializable {
    
        void onSendMessage(V2NIMChatroomMessage message);
        void onReceiveMessages(List<V2NIMChatroomMessage> messages);
        void onChatroomMemberEnter(V2NIMChatroomMember member);
        void onChatroomMemberExit(String accountId);
        void onChatroomMemberRoleUpdated(V2NIMChatroomMemberRole previousRole, V2NIMChatroomMember member);
        void onChatroomMemberInfoUpdated(V2NIMChatroomMember member);
        void onSelfChatBannedUpdated(boolean chatBanned);
        void onSelfTempChatBannedUpdated(boolean tempChatBanned, long tempChatBannedDuration);
        void onChatroomInfoUpdated(V2NIMChatroomInfo chatroom);
        void onChatroomChatBannedUpdated(boolean chatBanned);
        void onMessageRevokedNotification(String messageClientId, long messageTime);
        void onChatroomTagsUpdated(List<String> tags);
    }
    
    iOS
    objective-c@protocol V2NIMChatroomListener <NSObject>
    
    @optional
    - (void)onSendMessage:(V2NIMChatroomMessage *)message;
    - (void)onReceiveMessages:(NSArray *)messages;
    - (void)onChatroomMemberEnter:(V2NIMChatroomMember *)member;
    - (void)onChatroomMemberExit:(NSString *)accountId;
    - (void)onChatroomMemberRoleUpdated:(V2NIMChatroomMemberRole)previousRole
                                 member:(V2NIMChatroomMember *)member;
    - (void)onChatroomMemberInfoUpdated:(V2NIMChatroomMember *)member;
    - (void)onSelfChatBannedUpdated:(BOOL)chatBanned;
    - (void)onSelfTempChatBannedUpdated:(BOOL)tempChatBanned
                 tempChatBannedDuration:(NSInteger)tempChatBannedDuration;
    - (void)onChatroomInfoUpdated:(V2NIMChatroomInfo *)chatroomInfo;
    - (void)onChatroomChatBannedUpdated:(BOOL)chatBanned;
    - (void)onMessageRevokedNotification:(NSString *)messageClientId
                             messageTime:(NSTimeInterval)messageTime;
    - (void)onChatroomTagsUpdated:(NSArray<NSString *> *)tags;
    @end
    
    macOS/Windows
    cppstruct V2NIMChatroomListener {
        nstd::function<void(nstd::vector<V2NIMChatroomMessage> messages)> onReceiveMessages;
        nstd::function<void(V2NIMChatroomMember member)> onChatroomMemberEnter;
        nstd::function<void(nstd::string accountId)> onChatroomMemberExit;
        nstd::function<void(V2NIMChatroomMemberRole previousRole, V2NIMChatroomMember member)> onChatroomMemberRoleUpdated;
        nstd::function<void(V2NIMChatroomMember member)> onChatroomMemberInfoUpdated;
        nstd::function<void(bool chatBanned)> onSelfChatBannedUpdated;
        nstd::function<void(bool tempChatBanned, uint64_t tempChatBannedDuration)> onSelfTempChatBannedUpdated;
        nstd::function<void(V2NIMChatroomInfo chatroomInfo)> onChatroomInfoUpdated;
        nstd::function<void(bool chatBanned)> onChatroomChatBannedUpdated;
        nstd::function<void(nstd::string messageClientId, uint64_t messageTime)> onMessageRevokedNotification;
        nstd::function<void(nstd::vector<nstd::string> tags)> onChatroomTagsUpdated;
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMChatroomListener = {
    
      onSendMessage: [message: V2NIMChatroomMessage]
    
      onReceiveMessages: [messages: V2NIMChatroomMessage[]]
    
      onMessageRevokedNotification: [messageClientId: string, messageTime: number]
    
      onChatroomMemberEnter: [member: V2NIMChatroomMember]
    
      onChatroomMemberExit: [member: V2NIMChatroomMember]
    
      onChatroomMemberRoleUpdated: [previousRole: V2NIMChatroomMemberRole, currentMember: V2NIMChatroomMember]
    
      onChatroomMemberInfoUpdated: [member: V2NIMChatroomMember]
    
      onSelfChatBannedUpdated: [chatBanned: boolean]
    
      onSelfTempChatBannedUpdated: [tempChatBanned: boolean, tempChatBannedDuration: number]
    
      onChatroomInfoUpdated: [chatroomInfo: V2NIMChatroomInfo]
    
      onChatroomChatBannedUpdated: [chatBanned: boolean]
    
      onChatroomTagsUpdated: [tags: Array<string>]
    }
    

    成员函数

    • onSendMessage

      本端发送聊天室消息状态回调,本端发送聊天室消息或插入聊天室消息成功后,SDK 会返回该回调。

      参数名称 类型 描述
      message V2NIMChatroomMessage 发送或插入的聊天室消息
    • onReceiveMessages

      聊天室消息接收回调,本端接收到消息,或其他端同步的消息时会触发该回调。

      参数名称 类型 描述
      messages List<V2NIMChatroomMessage> 聊天室消息列表
    • onChatroomInfoUpdated

      聊天室资料信息更新回调。聊天室内所有成员均会收到该回调。

      参数名称 类型 描述
      chatroomInfo V2NIMChatroomInfo 更新后的聊天室信息
    • onChatroomMemberEnter

      成员进入聊天室回调。聊天室内所有成员均会收到该回调。

      参数名称 类型 描述
      member V2NIMChatroomMember 聊天室成员信息,只包含账号、昵称、禁言状态信息。
    • onChatroomMemberExit

      成员退出聊天室回调。聊天室内所有成员均会收到该回调。

      参数名称 类型 描述
      accountId String 退出的聊天室成员账号
    • onChatroomMemberRoleUpdated

      聊天室成员角色类型变更回调。聊天室内所有成员均会收到该回调。

      参数名称 类型 描述
      previousRole V2NIMChatroomMemberRole 变更前的角色类型信息
      member V2NIMChatroomMember 聊天室成员信息
    • onChatroomMemberInfoUpdated

      聊天室成员信息变更回调。聊天室内所有成员均会收到该回调。

      参数名称 类型 描述
      member V2NIMChatroomMember 聊天室成员信息,只包含昵称、头像、扩展字段
    • onSelfChatBannedUpdated

      聊天室成员本人禁言状态变更回调。

      参数名称 类型 描述
      chatBanned boolean 是否处于禁言状态
    • onSelfTempChatBannedUpdated

      聊天室成员本人临时禁言状态变更回调。

      参数名称 类型 描述
      tempChatBanned boolean 是否处于临时禁言状态
      tempChatBannedDuration long 临时禁言时长(秒)
    • onChatroomChatBannedUpdated

      聊天室整体禁言状态变更回调。

      参数名称 类型 描述
      chatBanned boolean 聊天室是否处于禁言状态:
    • true:处于禁言状态,仅创建者和管理员能发言
    • false:非禁言状态,聊天室全员都可以发言
    • onMessageRevokedNotification

      聊天室消息撤回回调。

      参数名称 类型 描述
      messageClientId String 被撤回消息的客户端 ID
      messageTime long 被撤回消息的时间戳
    • onChatroomTagsUpdated

      聊天室标签信息变更回调。

      参数名称 类型 描述
      tags List 更新后的标签信息

    V2NIMUploadFileTask

    文件上传任务。

    Andoroid
    javapublic interface V2NIMUploadFileTask {
    
        String getTaskId();
    
        V2NIMUploadFileParams getUploadFileParams();
    }
    
    iOS
    objective-c@interface V2NIMUploadFileTask : NSObject
    @property (nonatomic,strong) NSString *taskId;
    @property (nonatomic,strong) V2NIMUploadFileParams *uploadParams;
    @end
    
    macOS/Windows
    cppstruct V2NIMUploadFileTask {
        nstd::string taskId;
        V2NIMUploadFileParams uploadParams;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMUploadFileTask {
      taskId: string
      uploadParams: V2NIMUploadFileParams
    }
    
    Harmony
    typescriptexport interface V2NIMUploadFileTask {
    
      taskId: string
      uploadParams: V2NIMUploadFileParams
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    taskId String - 任务 ID
    uploadParams V2NIMUploadFileParams - 文件上传参数

    V2NIMUploadFileParams

    文件上传任务。

    Andoroid
    javapublic class V2NIMUploadFileParams {
    
        public V2NIMUploadFileParams() {
            this.filePath = null;
            this.sceneName = null;
        }
    
        public V2NIMUploadFileParams(String filePath) {
            this.filePath = filePath;
            this.sceneName = null;
        }
    
        public V2NIMUploadFileParams(String filePath, String sceneName) {
            this.filePath = filePath;
            this.sceneName = sceneName;
        }
    
        public String getFilePath() {
            return filePath;
        }
    
        public String getSceneName() {
            if (TextUtils.isEmpty(sceneName)) {
                return V2NIMStorageSceneConfig.DEFAULT_PROFILE.getSceneName();
            }
            return sceneName;
        }
    
        public boolean isValid() {
            return filePath != null && !filePath.isEmpty();
        }
    
    }
    
    iOS
    objective-c@interface V2NIMUploadFileParams : NSObject
    @property (nonatomic,strong) NSString *filePath;
    @property (nonatomic,strong) NSString *sceneName;
    
    @end
    
    macOS/Windows
    cppstruct V2NIMUploadFileParams {
        nstd::string filePath;
        nstd::string sceneName;
    };
    
    Web/uni-app/小程序
    typescriptexport interface V2NIMUploadFileParams {
      fileObj: File | string
    
      sceneName: string
    }
    
    Harmony
    typescriptexport interface V2NIMUploadFileParams {
    
      filePath: string
      sceneName: string
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    filePath String 非 Web 端必填 - 文件地址
    fileObj String/File 仅 Web 端必填 -
  • 非小程序:File 对象
  • 小程序:File 对象或文件地址
  • sceneName String DEFAULT_PROFILE 对应场景名,默认为 nim_default_profile_icon 场景名。
    使用自定义场景前,需要先调用 V2NIMStorageService.addCustomStorageScene 新增自定义场景名。

    V2NIMClientAntispamUtil

    客户端本地反垃圾工具。

    成员函数

    • checkTextAntispam

      对输入的文本进行本地反垃圾检查,根据反垃圾配置规则返回不同的内容。

      • 请在登录 IM 后调用该函数。
      • 本地有缓存数据(除 Web),支持以当前状态进行检测。
      • 参数说明
      Android
      javapublic static V2NIMClientAntispamResult checkTextAntispam(String text, String replace)
      
      参数名称 类型 是否必填 默认值 描述
      text String - 待本地反垃圾检测的文本。
      replace String null 检测到的敏感内容替换词。
      iOS
      objective-c+ (V2NIMClientAntispamUtil *)checkTextAntispam:(NSString *)text
                                        replace:(nullable NSString *)replace;
      
      参数名称 类型 是否必填 默认值 描述
      text NSString * - 待本地反垃圾检测的文本。
      replace NSString * null 检测到的敏感内容替换词。
      macOS/Windows
      cppstatic V2NIMClientAntispamResult checkTextAntispam(nstd::string text, nstd::string replace);
      
      参数名称 类型 是否必填 默认值 描述
      text nstd::string - 待本地反垃圾检测的文本。
      replace nstd::string null 检测到的敏感内容替换词。
      Web/uni-app/小程序
      typescriptcheckTextAntispam(text: string, replace?: string): V2NIMClientAntispamResult
      
      参数名称 类型 是否必填 默认值 描述
      text string - 待本地反垃圾检测的文本。
      replace string null 检测到的敏感内容替换词。
      • 示例代码
      Andoroid
      javaV2NIMClientAntispamResult res = V2NIMClientAntispamUtil.checkTextAntispam('bad sentense', '***')
      
      iOS
      objective-cV2NIMClientAntispamResult *res = [V2NIMClientAntispamUtil checkTextAntispam:@"bad sentense" replace:@"***"];
      
      macOS/Windows
      cppauto result = V2NIMClientAntispamUtil::checkTextAntispam("spam text", "*");
      
      Web/uni-app/小程序
      typescriptconst res = nim.V2NIMClientAntispamUtil.checkTextAntispam('bad sentense', '***')
      

      返回值:V2NIMClientAntispamResult

    V2NIMAntispamConfig

    若需要使用反垃圾检测,但不使用云信安全通默认配置,则需要通过该类定制审核规则。

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否必填 默认值 描述
    antispamBusinessId String - 指定易盾业务 ID。样例:JSON 格式 {"textbid":"","picbid":""}

    NIMSDKOption(仅 iOS)

    初始化配置选项。

    objective-c@interface NIMSDKOption : NSObject
    @property (nonatomic,copy)          NSString    *appKey;
    @property (nullable,nonatomic,copy)  NSString    *apnsCername;
    @property (nullable,nonatomic,copy)  NSString    *pkCername;
    + (instancetype)optionWithAppKey:(NSString *)appKey;
    @end
    

    类方法

    注册云信应用 AppKey。

    + (instancetype)optionWithAppKey:(NSString *)appKey;
    

    成员参数

    名称 类型 是否必填 描述
    appKey NSString 云信控制台获取到的 App Key。
    apnsCername NSString APNs 推送证书名,如不需要实现离线推送可不配置。
    pkCername NSString PushKit 推送证书名,如不需要实现离线推送可不配置。

    V2NIMSDKOption(仅 iOS)

    V10 初始化配置选项。

    objective-c@interface V2NIMSDKOption : NSObject
    @property(nonatomic,assign,readwrite) BOOL useV1Login;
    @end
    

    成员参数

    名称 类型 是否必填 描述
    useV1Login BOOL 是否在开启 V10 API 后,仍使用 V9 的登录 API 登录 IM。
  • 默认 NO,即开启 V10 API 后需要使用 V10 的登录 API 登录 IM。
  • 设置为 YES,则开启V10 API 后仍需要使用 V9 的登录 API 登录 IM。V9 和 V10 版本的登录 API 无法同时使用,只能选择其一。
  • V2NIMInitOption(仅 Windows/macOS)

    V10 初始化配置选项。

    cppstruct V2NIMInitOption {
        nstd::string appkey;
        nstd::string appDataPath;
        V2NIMBasicOption basicOption;
        V2NIMLinkOption linkOption;
        V2NIMDatabaseOption databaseOption;
        V2NIMFCSOption fcsOption;
        nstd::optional<V2NIMPrivateServerOption> privateServerOption;
    };
    

    成员参数

    名称 类型 是否必填 描述
    appkey nstd::string 云信应用的 AppKey。
    appDataPath nstd::string 应用的数据目录,为空则使用默认目录。
    默认数据:
  • Windows:%localappdata%/NIM
  • macOS:~/Library/Application Support/NIM
  • Linux:~/.local/share/NIM
  • basicOption V2NIMBasicOption 基础配置。
    linkOption V2NIMLinkOption 连接相关配置。
    databaseOption V2NIMDatabaseOption 数据库配置。
    attachmentOption V2NIMAttachmentOption 附件配置。
    fcsOption V2NIMFCSOption 融合存储配置。
    privateServerOption nstd::optional<V2NIMPrivateServerOption> 私有化配置。

    V2NIMUpdatedTeamInfo

    群信息更新。

    Andoroid
    javapublic interface V2NIMUpdatedTeamInfo extends Serializable {
    
        String getName();
    
        Integer getMemberLimit();
    
        String getIntro();
    
        String getAnnouncement();
    
        String getAvatar();
    
        String getServerExtension();
    
        V2NIMTeamJoinMode getJoinMode();
    
        V2NIMTeamAgreeMode getAgreeMode();
    
        V2NIMTeamInviteMode getInviteMode();
    
        V2NIMTeamUpdateInfoMode getUpdateInfoMode();
    
        V2NIMTeamUpdateExtensionMode getUpdateExtensionMode();
    
        V2NIMTeamChatBannedMode getChatBannedMode();
    }
    
    iOS
    objective-c@interface V2NIMUpdatedTeamInfo : NSObject
    
    /// 群组名称,nil表示未更新
    @property(nullable,nonatomic,copy,readonly) NSString *name;
    
    /// 群组人数上限,0表示未更新
    @property(nonatomic,assign,readonly) NSInteger memberLimit;
    
    /// 群组介绍,nil表示未更新
    @property(nullable,nonatomic,copy,readonly) NSString *intro;
    
    /// 群组公告,nil表示未更新
    @property(nullable,nonatomic,copy,readonly) NSString *announcement;
    
    /// 群组头像,nil表示未更新
    @property(nullable,nonatomic,copy,readonly) NSString *avatar;
    
    /// 服务端扩展字段,nil表示未更新
    @property(nullable,nonatomic,copy,readonly) NSString *serverExtension;
    
    /// 申请入群模式,-1表示未更新
    @property(nonatomic,assign,readonly) V2NIMTeamJoinMode joinMode;
    
    /// 被邀请人同意入群模式,-1表示未更新
    @property(nonatomic,assign,readonly) V2NIMTeamAgreeMode agreeMode;
    
    /// 邀请入群模式,-1表示未更新
    @property(nonatomic,assign,readonly) V2NIMTeamInviteMode inviteMode;
    
    /// 群组资料修改模式,-1表示未更新
    @property(nonatomic,assign,readonly) V2NIMTeamUpdateInfoMode updateInfoMode;
    
    /// 群组扩展字段修改模式,-1表示未更新
    @property(nonatomic,assign,readonly) V2NIMTeamUpdateExtensionMode updateExtensionMode;
    
    /// 群组禁言状态,-1表示未更新
    @property(nonatomic,assign,readonly) V2NIMTeamChatBannedMode chatBannedMode;
    
    @end
    
    Windows/macOS
    cppstruct V2NIMUpdatedTeamInfo {
        nstd::optional<nstd::string> name;
        nstd::optional<uint32_t> memberLimit;
        nstd::optional<nstd::string> intro;
        nstd::optional<nstd::string> announcement;
        nstd::optional<nstd::string> avatar;
        nstd::optional<nstd::string> serverExtension;
        nstd::optional<V2NIMTeamJoinMode> joinMode;
        nstd::optional<V2NIMTeamAgreeMode> agreeMode;
        nstd::optional<V2NIMTeamInviteMode> inviteMode;
        nstd::optional<V2NIMTeamUpdateInfoMode> updateInfoMode;
        nstd::optional<V2NIMTeamUpdateExtensionMode> updateExtensionMode;
        V2NIMTeamChatBannedMode chatBannedMode{V2NIM_TEAM_CHAT_BANNED_MODE_NONE};
    };
    
    Web/uni-app/小程序
    typescriptexport type V2NIMUpdatedTeamInfo = {
      name?: string
      memberLimit?: number
      intro?: string
      announcement?: string
      avatar?: string
      serverExtension?: string
      joinMode?: V2NIMTeamJoinMode
      agreeMode?: V2NIMTeamAgreeMode
      inviteMode?: V2NIMTeamInviteMode
      updateInfoMode?: V2NIMTeamUpdateInfoMode
      updateExtensionMode?: V2NIMTeamUpdateExtensionMode
      chatBannedMode?: V2NIMTeamChatBannedMode
    }
    

    成员参数

    如果您的应用平台为 Android,则需要调用对应的成员函数获取对应参数。

    名称 类型 是否只读 默认值 描述
    name String - 群组名称
  • 若为空,则表示不修改该字段
  • 若为空串,返回参数错误
  • memberLimit int - 群组人数上限。若为空,则表示不修改。
  • 高级群:默认 200 人/群(免费),可通过云信控制台配置为 500/1000/2000 人/群(计费),最大可扩展至 5000 人/群(联系商务经理或技术支持)。
  • 超大群:默认 2000 人/群,可通过云信控制台配置为 2000-10000 人/群。
  • 2000 人以上的群必须由服务端 API 发起创建。
  • intro String - 群组介绍,最大为 255 个字符。
    若为空,则表示不修改该字段。
    announcement String - 群组公告,最大为 5000 个字符。
    若为空,则表示不修改该字段。
    avatar String - 群组头像
    若为空,则表示不修改该字段。
    serverExtension String - 群组服务端扩展字段。必须为 JSON 格式封装,长度上限为 2048 字节,多端同步。
    若为空,则表示不修改该字段。
    joinMode V2NIMTeamJoinMode V2NIMTeamJoinMode.V2NIM_TEAM_JOIN_MODE_FREE 无需验证 入群验证模式
    agreeMode V2NIMTeamAgreeMode V2NIMTeamAgreeMode.V2NIM_TEAM_AGREE_MODE_AUTH 需要被邀请人同意 被邀请人同意模式
    inviteMode V2NIMTeamInviteMode V2NIMTeamInviteMode.V2NIM_TEAM_INVITE_MODE_MANAGER 仅群主或管理员可以邀请其他人入群 群组邀请模式,即群主/管理员或普通成员可以邀请入群
    updateInfoMode V2NIMTeamUpdateInfoMode V2NIMTeamUpdateInfoMode.V2NIM_TEAM_UPDATE_INFO_MODE_MANAGER 仅群主或管理员可以修改群组资料 群组资料修改模式
    updateExtensionMode V2NIMTeamUpdateExtensionMode V2NIMTeamUpdateExtensionMode.V2NIM_TEAM_UPDATE_EXTENSION_MODE_MANAGER 仅群主或管理员可以修改群组资料 群组扩展字段修改模式
    chatBannedMode V2NIMTeamChatBannedMode V2NIM_TEAM_CHAT_BANNED_MODE_NONE 不禁言 群组禁言状态

    枚举

    V2NIMLoginStatus

    登录状态。

    枚举类型 枚举值 描述
    V2NIM_LOGIN_STATUS_LOGOUT 0 已登出
    V2NIM_LOGIN_STATUS_LOGINED 1 已登录
    V2NIM_LOGIN_STATUS_LOGINING 2 正在登录
    V2NIM_LOGIN_STATUS_UNLOGIN 3 未登录

    V2NIMLoginAuthType

    登录认证类型。详见登录方式概览

    枚举类型 枚举值 描述
    V2NIM_LOGIN_AUTH_TYPE_DEFAULT 0 静态 Token 登录
    V2NIM_LOGIN_AUTH_TYPE_DYNAMIC_TOKEN 1 动态 Token 登录
    V2NIM_LOGIN_AUTH_TYPE_THIRD_PARTY 2 通过第三方回调登录

    V2NIMDataSyncLevel

    数据同步模式。

    Web 端仅支持完全同步。

    枚举类型 枚举值 描述
    V2NIM_DATA_SYNC_TYPE_LEVEL_FULL 0 全量同步。耗时较长,占用流量大,但数据展示时无需拉取。
    V2NIM_DATA_SYNC_TYPE_LEVEL_BASIC 1 基础数据同步。耗时较短,占用流量小,但数据展示时需要先拉取数据。

    V2NIMLoginClientType

    当前处于登录状态的客户端类型。

    枚举类型 枚举值 描述
    V2NIM_LOGIN_CLIENT_TYPE_UNKNOWN 0 未知类型
    V2NIM_LOGIN_CLIENT_TYPE_ANDROID 1 Android
    V2NIM_LOGIN_CLIENT_TYPE_IOS 2 iOS
    V2NIM_LOGIN_CLIENT_TYPE_PC 4 PC
    V2NIM_LOGIN_CLIENT_TYPE_WINPHONE 8 Windows Phone
    V2NIM_LOGIN_CLIENT_TYPE_WEB 16 Web
    V2NIM_LOGIN_CLIENT_TYPE_RESTFUL 32 服务端
    V2NIM_LOGIN_CLIENT_TYPE_HARMONY_OS 65 鸿蒙

    V2NIMLoginClientChange

    客户端登录状态变更原因。

    枚举类型 枚举值 描述
    V2NIM_LOGIN_CLIENT_CHANGE_LIST 1 已登录客户端列表刷新
    V2NIM_LOGIN_CLIENT_CHANGE_LOGIN 2 客户端登录
    V2NIM_LOGIN_CLIENT_CHANGE_LOGOUT 3 客户端登出

    V2NIMKickedOfflineReason

    当前登录的客户端被踢下线的原因类型。

    枚举类型 枚举值 描述
    V2NIM_KICKED_OFFLINE_REASON_CLIENT_EXCLUSIVE 1 被互斥的客户端踢下线
    V2NIM_KICKED_OFFLINE_REASON_SERVER 2 被服务端踢下线
    V2NIM_KICKED_OFFLINE_REASON_CLIENT 3 被其他客户端手动踢下线

    V2NIMConnectStatus

    SDK 连接状态。您可以根据不同的状态进行界面提示相应的业务操作。

    枚举类型 枚举值 描述
    V2NIM_CONNECT_STATUS_DISCONNECTED 0 SDK 未连接服务端
    V2NIM_CONNECT_STATUS_CONNECTED 1 SDK 已连接服务端
    V2NIM_CONNECT_STATUS_CONNECTING 2 SDK 正在与服务端连接
    V2NIM_CONNECT_STATUS_WAITING 3 SDK 正在等待与服务端重连

    V2NIMDataSyncType

    数据同步类型:

    • 主数据:离线消息,漫游消息,用户信息,群信息,超大群信息等
    • 群成员:高级群群成员
    • 超大群成员:超大群群成员
    枚举类型 枚举值 描述
    V2NIM_DATA_SYNC_MAIN 1 同步主数据
    V2NIM_DATA_SYNC_TEAM_MEMBER 2 同步群成员
    V2NIM_DATA_SYNC_SUPER_TEAM_MEMBER 3 同步超大群成员

    V2NIMDataSyncState

    数据同步状态

    枚举类型 枚举值 描述
    V2NIM_DATA_SYNC_STATE_WAITING 1 等待数据同步
    V2NIM_DATA_SYNC_STATE_SYNCING 2 开始数据同步
    V2NIM_DATA_SYNC_STATE_COMPLETED 3 数据同步完成

    V2NIMConversationType

    会话类型

    枚举类型 枚举值 描述
    V2NIM_CONVERSATION_TYPE_UNKNOWN 0 未知类型
    V2NIM_CONVERSATION_TYPE_P2P 1 单聊(点对点)会话
    V2NIM_CONVERSATION_TYPE_TEAM 2 高级群会话
    V2NIM_CONVERSATION_TYPE_SUPER_TEAM 3 超大群会话

    V2NIMMessageType

    消息类型

    枚举类型 枚举值 描述
    V2NIM_MESSAGE_TYPE_INVALID -1 未知/不合法类型
    V2NIM_MESSAGE_TYPE_TEXT 0 文本
    V2NIM_MESSAGE_TYPE_IMAGE 1 图片
    V2NIM_MESSAGE_TYPE_AUDIO 2 语音
    V2NIM_MESSAGE_TYPE_VIDEO 3 视频
    V2NIM_MESSAGE_TYPE_LOCATION 4 地理位置
    V2NIM_MESSAGE_TYPE_NOTIFICATION 5 通知
    V2NIM_MESSAGE_TYPE_FILE 6 文件
    V2NIM_MESSAGE_TYPE_AVCHAT 7 音视频通话
    V2NIM_MESSAGE_TYPE_TIPS 10 提示
    V2NIM_MESSAGE_TYPE_ROBOT 11 机器人
    V2NIM_MESSAGE_TYPE_CALL 12 话单
    V2NIM_MESSAGE_TYPE_CUSTOM 100 自定义

    V2NIMMessageAttachmentUploadState

    消息附件上传状态

    枚举类型 枚举值 描述
    V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_UNKNOWN 0 未知/不存在不需要上传
    V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_SUCCEEDED 1 上传成功
    V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_FAILED 2 上传失败
    V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_UPLOADING 3 正在上传

    V2NIMMessageNotificationType

    通知消息类型

    枚举类型 枚举值 描述
    V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_INVITE 0 邀请成员入高级群
    V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_KICK 1 高级群成员被踢出
    V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_LAVE 2 高级群成员退群
    V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_UPDATE_TINFO 3 高级群信息更新
    V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_DISMISS 4 高级群被解散
    V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_APPLY_PASS 5 进高级群申请通过
    V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_OWNER_TRANSFER 6 高级群主身份转移
    V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_ADD_MANAGER 7 添加高级群管理员
    V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_REMOVE_MANAGER 8 移除高级群管理员
    V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_INVITE_ACCEPT 9 接受邀请进高级群
    V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_BANNED_TEAM_MEMBER 10 禁言高级群成员
    V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_INVITE 401 超大群拉人
    V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_KICK 402 超大群踢人
    V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_LAVE 403 退出超大群
    V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_UPDATE_TINFO 404 更新超大群信息
    V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_DISMISS 405 超大群解散
    V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_APPLY_PASS 410 超大群申请加入通过
    V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_OWNER_TRANSFER 406 移交超大群主
    V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_ADD_MANAGER 407 添加超大群管理员
    V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_REMOVE_MANAGER 408 移除超大群管理员
    V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_INVITE_ACCEPT 411 接受邀请进超大群
    V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_BANNED_TEAM_MEMBER 409 禁言超大群成员

    V2NIMMessageSendingState

    消息发送状态

    枚举类型 枚举值 描述
    V2NIM_MESSAGE_SENDING_STATE_UNKNOWN 0 未知状态
    V2NIM_MESSAGE_SENDING_STATE_SUCCEEDED 1 消息发送成功
    V2NIM_MESSAGE_SENDING_STATE_FAILED 2 消息发送失败
    V2NIM_MESSAGE_SENDING_STATE_SENDING 3 消息正在发送

    V2NIMClientAntispamOperateType

    客户端本地反垃圾命中后的操作类型

    枚举类型 枚举值 描述
    V2NIM_CLIENT_ANTISPAM_OPERATE_NONE 0 无操作
    V2NIM_CLIENT_ANTISPAM_OPERATE_REPLACE 1 本地替换
    V2NIM_CLIENT_ANTISPAM_OPERATE_CLIENT_SHIELD 2 本地屏蔽。该文本消息无法发送。
    V2NIM_CLIENT_ANTISPAM_OPERATE_SERVER_SHIELD 3 服务端屏蔽。该文本消息发送后由服务器屏蔽。

    V2NIMQueryDirection

    消息查询方向

    枚举类型 枚举值 描述
    V2NIM_QUERY_DIRECTION_DESC 0 按时间戳降序查询
    V2NIM_QUERY_DIRECTION_ASC 1 按时间戳升序查询

    V2NIMMessageRevokeType

    消息撤回类型

    枚举类型 枚举值 描述
    V2NIM_MESSAGE_REVOKE_TYPE_UNDEFINED 0 未定义
    V2NIM_MESSAGE_REVOKE_TYPE_P2P_BOTHWAY 1 单聊消息双向撤回,消息双方均收到撤回通知并清除消息。
    V2NIM_MESSAGE_REVOKE_TYPE_TEAM_BOTHWAY 2 群消息双向撤回,消息双方均收到撤回通知并清除消息。
    V2NIM_MESSAGE_REVOKE_TYPE_SUPER_TEAM_BOTHWAY 3 超大群消息双向撤回,消息双方均收到撤回通知并清除消息。
    V2NIM_MESSAGE_REVOKE_TYPE_P2P_ONEWAY 4 单聊消息单向撤回,发送方无感知,接收方收到撤回通知并清除消息。
    V2NIM_MESSAGE_REVOKE_TYPE_TEAM_ONEWAY 5 群消息单向撤回,发送方无感知,接收方收到撤回通知并清除消息。

    V2NIMMesssagePinState

    Pin 消息的状态

    枚举类型 枚举值 描述
    V2NIM_MESSAGE_PIN_STEATE_NOT_PINNED 0 未 Pin
    V2NIM_MESSAGE_PIN_STEATE_PINNED 1 已 Pin
    V2NIM_MESSAGE_PIN_STEATE_UPDATED 2 已 Pin 状态更新

    V2NIMMessagePinState

    Pin 消息的状态

    枚举类型 枚举值 描述
    V2NIM_MESSAGE_PIN_STEATE_NOT_PINNED 0 未被 Pin
    V2NIM_MESSAGE_PIN_STEATE_PINNED 1 已被 Pin
    V2NIM_MESSAGE_PIN_STEATE_UPDATED 2 状态更新

    V2NIMMessageQuickCommentType

    快捷评论操作类型

    枚举类型 枚举值 描述
    V2NIM_MESSAGE_QUICK_COMMENT_TYPE_ADD 1 添加快捷评论
    V2NIM_MESSAGE_QUICK_COMMENT_TYPE_REMOVE 2 移除快捷评论

    V2NIMSortOrder

    排序规则

    枚举类型 枚举值 描述
    V2NIM_SORT_ORDER_DESC 0 按时间戳降序排序
    V2NIM_SORT_ORDER_ASC 1 按时间戳升序排序

    V2NIMTeamType

    群组类型

    枚举类型 枚举值 描述
    V2NIM_TEAM_TYPE_INVALID 0 无效类型
    V2NIM_TEAM_TYPE_NORMAL 1 高级群
    V2NIM_TEAM_TYPE_SUPER 2 超大群

    V2NIMTeamJoinMode

    入群验证模式

    枚举类型 枚举值 描述
    V2NIM_TEAM_JOIN_MODE_FREE 0 自由加入群组,无须验证
    V2NIM_TEAM_JOIN_MODE_APPLY 1 需群主或管理员同意后加入群组
    V2NIM_TEAM_JOIN_MODE_INVITE 2 私有群,不接受申请,仅能通过邀请方式入群

    V2NIMTeamAgreeMode

    被邀请人同意模式

    枚举类型 枚举值 描述
    V2NIM_TEAM_AGREE_MODE_AUTH 0 需要被邀请人同意
    V2NIM_TEAM_AGREE_MODE_NO_AUTH 1 不需要被邀请人同意

    V2NIMTeamInviteMode

    被邀请人同意模式

    枚举类型 枚举值 描述
    V2NIM_TEAM_INVITE_MODE_MANAGER 0 仅群主或管理员可以邀请其他人入群
    V2NIM_TEAM_INVITE_MODE_ALL 1 不需要被邀请人同意

    V2NIMTeamUpdateInfoMode

    群组资料修改模式

    枚举类型 枚举值 描述
    V2NIM_TEAM_UPDATE_INFO_MODE_MANAGER 0 仅群主或管理员可以修改群组资料
    V2NIM_TEAM_UPDATE_INFO_MODE_ALL 1 所有群成员均可以修改群组资料

    V2NIMTeamChatBannedMode

    群组禁言状态

    枚举类型 枚举值 描述
    V2NIM_TEAM_CHAT_BANNED_MODE_NONE 0 不禁言
    V2NIM_TEAM_CHAT_BANNED_MODE_BANNED_NORMAL 1 普通成员禁言,不包括群主和管理员
    V2NIM_TEAM_CHAT_BANNED_MODE_BANNED_ALL 2 全员禁言,包括群主和管理员。
    全员禁言仅能由服务端 API 发起。

    V2NIMTeamUpdateExtensionMode

    群组扩展字段修改模式

    枚举类型 枚举值 描述
    V2NIM_TEAM_UPDATE_EXTENSION_MODE_MANAGER 0 仅群主或管理员可以修改群组扩展字段
    V2NIM_TEAM_UPDATE_EXTENSION_MODE_ALL 1 所有群成员均可以修改群组扩展字段

    V2NIMTeamMemberRole

    群成员角色类型

    枚举类型 枚举值 描述
    V2NIM_TEAM_MEMBER_ROLE_NORMAL 0 普通成员
    V2NIM_TEAM_MEMBER_ROLE_OWNER 1 群主
    V2NIM_TEAM_MEMBER_ROLE_MANAGER 2 群管理员

    V2NIMTeamMemberRoleQueryType

    群成员角色查询类型

    枚举类型 枚举值 描述
    V2NIM_TEAM_MEMBER_ROLE_QUERY_TYPE_ALL 0 所有成员
    V2NIM_TEAM_MEMBER_ROLE_QUERY_TYPE_MANAGER 1 群主和群管理员
    V2NIM_TEAM_MEMBER_ROLE_QUERY_TYPE_NORMAL 2 普通成员

    V2NIMTeamJoinActionType

    群成员入群操作类型

    枚举类型 枚举值 描述
    V2NIM_TEAM_JOIN_ACTION_TYPE_APPLICATION 0 (管理员身份)收到其他成员入群申请
    V2NIM_TEAM_JOIN_ACTION_TYPE_REJECT_APPLICATION 1 收到管理员拒绝入群申请
    V2NIM_TEAM_JOIN_ACTION_TYPE_INVITATION 2 收到入群邀请
    V2NIM_TEAM_JOIN_ACTION_TYPE_REJECT_INVITATION 3 (邀请人)收到被邀请人拒绝入群邀请

    V2NIMTeamJoinActionStatus

    群成员入群操作处理状态

    枚举类型 枚举值 描述
    V2NIM_TEAM_JOIN_ACTION_STATUS_INIT 0 未处理
    V2NIM_TEAM_JOIN_ACTION_STATUS_AGREED 1 已同意
    V2NIM_TEAM_JOIN_ACTION_STATUS_REJECTED 2 已拒绝
    V2NIM_TEAM_JOIN_ACTION_STATUS_EXPIRED 3 已过期

    V2NIMP2PMessageMuteMode

    单聊(点对点)消息免打扰模式

    枚举类型 枚举值 描述
    V2NIM_P2P_MESSAGE_MUTE_MODE_OFF 0 单聊消息免打扰关闭
    V2NIM_P2P_MESSAGE_MUTE_MODE_ON 1 单聊消息免打扰开启

    V2NIMTeamMessageMuteMode

    群消息免打扰模式

    枚举类型 枚举值 描述
    V2NIM_TEAM_MESSAGE_MUTE_MODE_OFF 0 群消息免打扰关闭
    V2NIM_TEAM_MESSAGE_MUTE_MODE_ON 1 群消息免打扰开启
    V2NIM_TEAM_MESSAGE_MUTE_MODE_NORMAL_ON 2 普通成员群消息免打扰开启

    V2NIMFriendAddMode

    添加好友模式

    枚举类型 枚举值 描述
    V2NIM_FRIEND_MODE_TYPE_ADD 1 直接添加对方为好友,无需对方验证
    V2NIM_FRIEND_MODE_TYPE_APPLY 2 请求添加对方为好友,需要对方验证通过

    V2NIMFriendAddApplicationStatus

    申请添加好友相关操作状态

    枚举类型 枚举值 描述
    V2NIM_FRIEND_ADD_APPLICATION_STATUS_INIT 0 未处理
    V2NIM_FRIEND_ADD_APPLICATION_STATUS_AGREED 1 已同意
    V2NIM_FRIEND_ADD_APPLICATION_STATUS_REJECED 2 已拒绝
    V2NIM_FRIEND_ADD_APPLICATION_STATUS_EXPIRED 3 已过期
    V2NIM_FRIEND_ADD_APPLICATION_STATUS_DIRECT_ADD 4 直接添加为好友

    V2NIMFriendDeletionType

    好友删除的类型

    枚举类型 枚举值 描述
    V2NIM_FRIEND_DELETION_TYPE_BY_SELF 1 自己删除好友
    V2NIM_FRIEND_DELETION_TYPE_BY_PEER 2 对方删除好友

    V2NIMChatroomQueueLevelMode

    聊天室队列操作权限

    枚举类型 枚举值 描述
    V2NIM_CHATROOM_QUEUE_LEVEL_MODE_ANY 0 聊天室所有用户均有操作权限
    V2NIM_CHATROOM_QUEUE_LEVEL_MODE_MANAGER 1 仅聊天室创建者/管理员有操作权限

    V2NIMChatroomMemberRole

    聊天室成员角色类型:

    • 固定成员:创建者、管理员、普通成员。总计上限 1000 人。
    • 游客:普通游客、匿名游客。无人数上限。
    • 虚构成员:虚构用户。仅支持通过服务端 API 添加聊天室虚构用户
    枚举类型 枚举值 描述
    V2NIM_CHATROOM_MEMBER_ROLE_NORMAL 0 普通成员
    V2NIM_CHATROOM_MEMBER_ROLE_CREATOR 1 创建者
    V2NIM_CHATROOM_MEMBER_ROLE_MANAGER 2 管理员
    V2NIM_CHATROOM_MEMBER_ROLE_NORMAL_GUEST 3 普通游客
    V2NIM_CHATROOM_MEMBER_ROLE_ANONYMOUS_GUEST 4 匿名游客
    V2NIM_CHATROOM_MEMBER_ROLE_VIRTUAL 5 虚构用户

    V2NIMChatroomMessageNotificationType

    聊天室通知类消息类型

    枚举类型 枚举值 描述
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_ENTER 0 成员进入聊天室
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_EXIT 1 成员退出聊天室
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_BLOCK_ADDED 2 聊天室成员被加入黑名单
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_BLOCK_REMOVED 3 聊天室成员被移除黑名单
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_CHAT_BANNED_ADDED 4 聊天室成员被禁言
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_CHAT_BANNED_REMOVED 5 聊天室成员被取消禁言
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_ROOM_INFO_UPDATED 6 聊天室信息更新
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_KICKED 7 聊天室成员被踢
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_TEMP_CHAT_BANNED_ADDED 8 聊天室成员被临时禁言
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_TEMP_CHAT_BANNED_REMOVED 9 聊天室成员被解除临时禁言
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_INFO_UPDATED 10 聊天室成员信息更新(nick/avatar/extension)
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_QUEUE_CHANGE 11 聊天室队列变更
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_CHAT_BANNED 12 聊天室处于禁言状态
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_CHAT_BANNED_REMOVED 13 聊天室处于非禁言状态
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_TAG_TEMP_CHAT_BANNED_ADDED 14 聊天室标签成员被临时禁言
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_TAG_TEMP_CHAT_BANNED_REMOVED 15 聊天室标签成员被解除临时禁言
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MESSAGE_REVOKE 16 聊天室消息撤回
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_TAGS_UPDATE 17 聊天室标签更新
    V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_ROLE_UPDATE 18 聊天室成员角色更新

    V2NIMChatroomStatus

    聊天室状态

    枚举类型 枚举值 描述
    V2NIM_CHATROOM_STATUS_DISCONNECTED 0 聊天室断开连接
    V2NIM_CHATROOM_STATUS_WAITING 1 聊天室等待重连
    V2NIM_CHATROOM_STATUS_CONNECTING 2 聊天室连接过程中
    V2NIM_CHATROOM_STATUS_CONNECTED 3 聊天室已连接
    V2NIM_CHATROOM_STATUS_ENTERING 4 正在进入聊天室
    V2NIM_CHATROOM_STATUS_ENTERED 5 已进入聊天室
    V2NIM_CHATROOM_STATUS_EXITED 6 已退出聊天室
    此文档是否对你有帮助?
    有帮助
    去反馈
    • 支持平台
    • V2NIMSuccessCallback
    • 成员函数
    • V2NIMFailureCallback
    • 成员函数
    • V2NIMProgressCallback
    • 成员函数
    • V2NIMError
    • V2NIMLoginOption
    • 成员参数
    • V2NIMTokenProvider
    • 成员参数
    • V2NIMLoginExtensionProvider
    • 成员参数
    • V2NIMLoginClient
    • 成员参数
    • V2NIMReconnectDelayProvider
    • 成员参数
    • 返回值
    • V2NIMKickedOfflineDetail
    • 成员参数
    • V2NIMDataSyncDetail
    • 成员参数
    • V2NIMLoginListener
    • 成员函数
    • V2NIMLoginDetailListener
    • 成员函数
    • V2NIMConversationOption
    • 成员参数
    • V2NIMConversationResult
    • 成员参数
    • V2NIMConversation
    • 成员参数
    • V2NIMConversationFilter
    • 成员参数
    • V2NIMConversationOperationResult
    • 成员参数
    • V2NIMConversationUpdate
    • 成员参数
    • V2NIMConversationListener
    • 成员函数
    • V2NIMConversationGroup
    • 成员参数
    • V2NIMConversationGroupResult
    • 成员参数
    • V2NIMConversationGroupListener
    • 成员函数
    • V2NIMConversationIdUtil
    • 成员函数
    • 示例代码
    • V2NIMMessageListener
    • 成员函数
    • V2NIMMessage
    • 成员参数
    • V2NIMMessageConfig
    • 成员参数
    • V2NIMMessagePushConfig
    • 成员参数
    • V2NIMMessageRouteConfig
    • 成员参数
    • V2NIMMessageAntispamConfig
    • 成员参数
    • V2NIMMessageRobotConfig
    • 成员参数
    • V2NIMLastMessage
    • 成员参数
    • V2NIMMessageQuickComment
    • 成员参数
    • V2NIMMessageQuickComment
    • 成员参数
    • V2NIMMessagePin
    • 成员参数
    • V2NIMCollection
    • 成员参数
    • V2NIMAddCollectionParams
    • 成员参数
    • V2NIMCollectionOption
    • 成员参数
    • V2NIMSendMessageParams
    • 成员参数
    • V2NIMMessageRefer
    • 成员参数
    • V2NIMMessageAttachment
    • 成员参数
    • V2NIMMessageFileAttachment
    • 成员参数
    • V2NIMMessageImageAttachment
    • 成员参数
    • V2NIMMessageAudioAttachment
    • 成员参数
    • V2NIMMessageVideoAttachment
    • 成员参数
    • V2NIMMessageCallAttachment
    • 成员参数
    • V2NIMMessageCallDuration
    • 成员参数
    • V2NIMMessageLocationAttachment
    • 成员参数
    • V2NIMMessageNotificationAttachment
    • 成员参数
    • V2NIMSendMessageResult
    • 成员参数
    • V2NIMMessageListOption
    • 成员参数
    • V2NIMThreadMessageListOption
    • 成员参数
    • V2NIMThreadMessageListResult
    • 成员参数
    • V2NIMP2PMessageReadReceipt
    • 成员参数
    • V2NIMTeamMessageReadReceipt
    • 成员参数
    • V2NIMTeamMessageReadReceiptDetail
    • 成员参数
    • V2NIMMessageRevokeParams
    • 成员参数
    • V2NIMMessageRevokeNotification
    • 成员参数
    • V2NIMMessageDeletedNotification
    • 成员参数
    • V2NIMMessageQuickCommentNotification
    • 成员参数
    • V2NIMMessagePinNotification
    • 成员参数
    • V2NIMClearHistoryMessageOption
    • 成员参数
    • V2NIMClearHistoryNotification
    • 成员参数
    • V2NIMMessageSearchParams
    • 成员参数
    • V2NIMClientAntispamResult
    • 成员参数
    • V2NIMVoiceToTextParams
    • 成员参数
    • V2NIMStorageScene
    • 成员参数
    • V2NIMStorageSceneConfig
    • 成员参数
    • V2NIMCustomNotification
    • 成员参数
    • V2NIMNotificationConfig
    • 成员参数
    • V2NIMNotificationPushConfig
    • 成员参数
    • V2NIMNotificationRouteConfig
    • 成员参数
    • V2NIMNotificationAntispamConfig
    • 成员参数
    • V2NIMSendCustomNotificationParams
    • 成员参数
    • V2NIMBroadcastNotification
    • 成员参数
    • V2NIMNotificationListener
    • 成员函数
    • V2NIMTeam
    • 成员参数
    • V2NIMTeamMember
    • 成员参数
    • V2NIMCreateTeamParams
    • 成员参数
    • V2NIMTeamMemberQueryOption
    • 成员参数
    • V2NIMUpdateTeamInfoParams
    • 成员参数
    • V2NIMCreateTeamResult
    • 成员参数
    • V2NIMUpdateSelfMemberInfoParams
    • 成员参数
    • V2NIMTeamMemberListResult
    • 成员参数
    • V2NIMTeamJoinActionInfo
    • 成员参数
    • V2NIMTeamJoinActionInfoQueryOption
    • 成员参数
    • V2NIMTeamJoinActionInfoResult
    • 成员参数
    • V2NIMTeamListener
    • 成员函数
    • V2NIMDndConfig
    • 成员参数
    • V2NIMOfflinePushConfig(仅 Web)
    • 成员参数
    • V2NIMManufacturerPushConfig(仅 Web)
    • 成员参数
    • V2NIMSettingListener
    • 成员函数
    • V2NIMUser
    • 成员参数
    • V2NIMUserUpdateParams
    • 成员参数
    • V2NIMUserSearchOption
    • 成员参数
    • V2NIMUserListener
    • 成员函数
    • V2NIMFriend
    • 成员参数
    • V2NIMFriendAddParams
    • 成员参数
    • V2NIMFriendAddApplication
    • 成员参数
    • V2NIMFriendDeleteParams
    • 成员参数
    • V2NIMFriendSetParams
    • 成员参数
    • V2NIMFriendAddApplicationQueryOption
    • 成员参数
    • V2NIMFriendAddApplicationResult
    • 成员参数
    • V2NIMFriendSearchOption
    • 成员参数
    • V2NIMFriendListener
    • 成员函数
    • V2NIMChatroomClient
    • 成员参数
    • 成员函数
    • V2NIMChatroomInitParams(仅 Web)
    • 成员参数
    • V2NIMChatroomEnterParams
    • 成员参数
    • V2NIMChatroomLoginOption
    • 成员参数
    • V2NIMChatroomTokenProvider
    • 成员参数
    • V2NIMChatroomLoginExtensionProvider
    • 成员参数
    • V2NIMChatroomLinkProvider
    • 成员参数
    • V2NIMChatroomTagConfig
    • 成员参数
    • V2NIMChatroomLocationConfig
    • 成员参数
    • V2NIMLocationInfo
    • 成员参数
    • V2NIMChatroomEnterResult
    • 成员参数
    • V2NIMChatroomInfo
    • 成员参数
    • V2NIMChatroomMember
    • 成员参数
    • V2NIMChatroomEnterInfo
    • 成员参数
    • V2NIMChatroomKickedInfo
    • 成员参数
    • V2NIMUserInfoConfig
    • 成员参数
    • V2NIMChatroomMessageConfig
    • 成员参数
    • V2NIMChatroomMessage
    • 成员参数
    • V2NIMChatroomNotificationAttachment
    • 成员参数
    • V2NIMChatroomMessageRevokeNotificationAttachment
    • 成员参数
    • V2NIMChatroomChatBannedNotificationAttachment
    • 成员参数
    • V2NIMChatroomMemberEnterNotificationAttachment
    • 成员参数
    • V2NIMChatroomMemberRoleUpdateAttachment
    • 成员参数
    • V2NIMSendChatroomMessageParams
    • 成员参数
    • V2NIMSendChatroomMessageResult
    • 成员参数
    • V2NIMChatroomMemberQueryOption
    • 成员参数
    • V2NIMChatroomMemberListResult
    • 成员参数
    • V2NIMChatroomMessageListOption
    • 成员参数
    • V2NIMChatroomMemberRoleUpdateParams
    • 成员参数
    • V2NIMChatroomUpdateParams
    • 成员参数
    • V2NIMChatroomSelfMemberUpdateParams
    • 成员参数
    • V2NIMChatroomTagTempChatBannedParams
    • 成员参数
    • V2NIMChatroomTagsUpdateParams
    • 成员参数
    • V2NIMChatroomTagMemberOption
    • 成员参数
    • V2NIMChatroomTagMessageOption
    • 成员参数
    • V2NIMChatroomClientListener
    • 成员函数
    • V2NIMChatroomListener
    • 成员函数
    • V2NIMUploadFileTask
    • 成员参数
    • V2NIMUploadFileParams
    • 成员参数
    • V2NIMClientAntispamUtil
    • 成员函数
    • V2NIMAntispamConfig
    • 成员参数
    • NIMSDKOption(仅 iOS)
    • 类方法
    • 成员参数
    • V2NIMSDKOption(仅 iOS)
    • 成员参数
    • V2NIMInitOption(仅 Windows/macOS)
    • 成员参数
    • V2NIMUpdatedTeamInfo
    • 成员参数
    • 枚举
    • V2NIMLoginStatus
    • V2NIMLoginAuthType
    • V2NIMDataSyncLevel
    • V2NIMLoginClientType
    • V2NIMLoginClientChange
    • V2NIMKickedOfflineReason
    • V2NIMConnectStatus
    • V2NIMDataSyncType
    • V2NIMDataSyncState
    • V2NIMConversationType
    • V2NIMMessageType
    • V2NIMMessageAttachmentUploadState
    • V2NIMMessageNotificationType
    • V2NIMMessageSendingState
    • V2NIMClientAntispamOperateType
    • V2NIMQueryDirection
    • V2NIMMessageRevokeType
    • V2NIMMesssagePinState
    • V2NIMMessagePinState
    • V2NIMMessageQuickCommentType
    • V2NIMSortOrder
    • V2NIMTeamType
    • V2NIMTeamJoinMode
    • V2NIMTeamAgreeMode
    • V2NIMTeamInviteMode
    • V2NIMTeamUpdateInfoMode
    • V2NIMTeamChatBannedMode
    • V2NIMTeamUpdateExtensionMode
    • V2NIMTeamMemberRole
    • V2NIMTeamMemberRoleQueryType
    • V2NIMTeamJoinActionType
    • V2NIMTeamJoinActionStatus
    • V2NIMP2PMessageMuteMode
    • V2NIMTeamMessageMuteMode
    • V2NIMFriendAddMode
    • V2NIMFriendAddApplicationStatus
    • V2NIMFriendDeletionType
    • V2NIMChatroomQueueLevelMode
    • V2NIMChatroomMemberRole
    • V2NIMChatroomMessageNotificationType
    • V2NIMChatroomStatus