1 package com.netease.nimlib.sdk.qchat.param;
3 import androidx.annotation.NonNull;
14 import java.util.List;
22 private static final String TAG =
"QChatSendMessageParam";
27 private final Long serverId;
32 private final Long channelId;
45 private String attach;
49 private Map<String, Object> extension;
53 private Map<String, Object> pushPayload;
57 private String pushContent;
61 private List<String> mentionedAccidList;
65 private List<Long> mentionedRoleIdList;
69 private boolean mentionedAll =
false;
73 private boolean historyEnable =
true;
77 private boolean pushEnable =
true;
81 private boolean needBadge =
true;
85 private boolean needPushNick =
true;
97 private final String uuid;
102 private Integer serverStatus;
115 private Integer subType;
124 this.serverId = serverId;
125 this.channelId = channelId;
128 this.uuid = StringUtil.get32UUID();
144 this.attach = attach;
152 this.attach = attachment.
toJson(
false);
160 this.extension = extension;
168 this.pushPayload = pushPayload;
176 this.pushContent = pushContent;
184 this.mentionedAccidList = mentionedAccidList;
192 this.mentionedRoleIdList = mentionedRoleIdList;
200 this.mentionedAll = mentionedAll;
208 this.historyEnable = historyEnable;
216 this.pushEnable = pushEnable;
224 this.needBadge = needBadge;
232 this.needPushNick = needPushNick;
307 return mentionedAccidList;
315 return mentionedRoleIdList;
331 return historyEnable;
378 this.serverStatus = serverStatus;
386 return antiSpamOption;
394 this.antiSpamOption = antiSpamOption;
410 isRouteEnable = routeEnable;
446 this.subType = subType;
449 private QChatMessageImpl qChatMessage;
456 if (qChatMessage == null) {
457 qChatMessage = QChatMessageImpl.fromParam(
this);
458 QChatLoginParam loginData = QChatAuthCache.getInstance().getLoginData();
459 if(loginData != null)
461 qChatMessage.setFromAccount(loginData.
getAccount());
466 QChatMessageImpl.fromParam(
this,qChatMessage);
boolean isRouteEnable()
是否需要抄送,默认true
void setPushEnable(boolean pushEnable)
设置是否需要推送
String getAccount()
获取用户账号
List< Long > getMentionedRoleIdList()
设置@身份组的RoleId列表
boolean isNeedBadge()
是否需要消息计数,默认true
Map< String, Object > getPushPayload()
获取推送payload
String getEnv()
获取环境变量 用户可以根据不同的env配置不同的抄送和回调地址
void setBody(String body)
设置消息内容
Integer getServerStatus()
获取消息服务器状态
void setSubType(Integer subType)
设置消息子类型
Long getChannelId()
获取频道id
boolean isPushEnable()
是否需要推送,默认true
void setPushPayload(Map< String, Object > pushPayload)
设置推送payload
void setEnv(String env)
设置环境变量 用户可以根据不同的env配置不同的抄送和回调地址
boolean isMentionedAll()
是否@所有人
void setAttachment(MsgAttachment attachment)
设置消息附件
void setNeedPushNick(boolean needPushNick)
设置是否需要推送昵称
QChatSendMessageParam(long serverId, long channelId, @NonNull MsgTypeEnum type)
void setAttach(String attach)
设置消息附件,通过MsgAttachment::toJson(false)获得
Long getServerId()
获取服务器id
Integer getSubType()
获取消息子类型
List< String > getMentionedAccidList()
获取@账号列表
void setMentionedRoleIdList(List< Long > mentionedRoleIdList)
设置@身份组的RoleId列表
synchronized QChatMessage toQChatMessage()
将QChatSendMessageParam转换成QChatMessage
Map< String, Object > getExtension()
获取扩展字段
MsgTypeEnum getType()
获取消息类型
void setServerStatus(Integer serverStatus)
如果设置状态,状态只能设置成自定义的状态(status>= 10000),否则提示414参数错误
void setRouteEnable(boolean routeEnable)
设置是否需要抄送
QChatMessageAntiSpamOption getAntiSpamOption()
获取消息反垃圾配置选项
String getPushContent()
获取推送文案
boolean isNeedPushNick()
是否需要推送昵称,默认true
void setAntiSpamOption(QChatMessageAntiSpamOption antiSpamOption)
设置消息反垃圾配置选项
void setExtension(Map< String, Object > extension)
设置扩展字段
String toJson(boolean send)
将消息附件序列化为字符串,存储到消息数据库或发送到服务器。
void setHistoryEnable(boolean historyEnable)
设置是否消息是否存储云端历史
String getAttach()
获取消息附件字符串
void setNeedBadge(boolean needBadge)
设置是否需要消息计数
boolean isHistoryEnable()
是否消息在云端存储,默认true
void setPushContent(String pushContent)
设置推送文案
void setMentionedAccidList(List< String > mentionedAccidList)
设置@账号列表
void setMentionedAll(boolean mentionedAll)
设置是否@所有人