|
| 1 | +package io.github.doocs.im.model.request; |
| 2 | + |
| 3 | +import com.fasterxml.jackson.annotation.JsonInclude; |
| 4 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 5 | +import io.github.doocs.im.model.message.TIMMsgElement; |
| 6 | + |
| 7 | +import java.io.Serializable; |
| 8 | +import java.util.List; |
| 9 | + |
| 10 | +/** |
| 11 | + * 公众号用户发送广播消息-请求参数 |
| 12 | + * |
| 13 | + * @author hyh |
| 14 | + * @since 2024/01/09 16:22 |
| 15 | + */ |
| 16 | +@JsonInclude(JsonInclude.Include.NON_NULL) |
| 17 | +public class SendOfficialAccountMsgRequest extends GenericRequest implements Serializable { |
| 18 | + private static final long serialVersionUID = -511076816330563359L; |
| 19 | + |
| 20 | + |
| 21 | + /** |
| 22 | + * 发送消息的公众号用户。 |
| 23 | + */ |
| 24 | + @JsonProperty("Official_Account") |
| 25 | + private String officialAccount; |
| 26 | + |
| 27 | + /** |
| 28 | + * 无符号32位整数(取值范围:0 - 4294967295)。 |
| 29 | + * 如果5分钟内两条消息的内容和 Random 随机值都相同的情况下,后一条消息将被当做重复消息而丢弃。 |
| 30 | + */ |
| 31 | + @JsonProperty("Random") |
| 32 | + private Integer random; |
| 33 | + |
| 34 | + /** |
| 35 | + * 消息体,详细可参阅 消息格式描述。 |
| 36 | + */ |
| 37 | + @JsonProperty("MsgBody") |
| 38 | + private List<TIMMsgElement> msgBody; |
| 39 | + |
| 40 | + /** |
| 41 | + * 离线推送信息配置,详细可参见 消息格式描述。 |
| 42 | + */ |
| 43 | + @JsonProperty("OfflinePushInfo") |
| 44 | + private OfflinePushInfo offlinePushInfo; |
| 45 | + |
| 46 | + /** |
| 47 | + * 消息回调禁止开关,只对单条消息有效 |
| 48 | + * ForbidBeforeSendMsgCallback 表示禁止发消息前回调 |
| 49 | + * ForbidAfterSendMsgCallback 表示禁止发消息后回调 |
| 50 | + */ |
| 51 | + @JsonProperty("ForbidCallbackControl") |
| 52 | + private List<String> forbidCallbackControl; |
| 53 | + |
| 54 | + /** |
| 55 | + * 1表示消息仅发送在线订阅者,默认0表示发送所有订阅者 |
| 56 | + */ |
| 57 | + @JsonProperty("OnlineOnlyFlag") |
| 58 | + private Integer onlineOnlyFlag; |
| 59 | + |
| 60 | + /** |
| 61 | + * 消息发送权限,NoLastMsg 只对单条消息有效,表示不更新最近联系人会话 |
| 62 | + * (如果该消息 OnlineOnlyFlag 设置为1,则不允许使用该字段。) |
| 63 | + */ |
| 64 | + @JsonProperty("SendMsgControl") |
| 65 | + private List<String> sendMsgControl; |
| 66 | + |
| 67 | + /** |
| 68 | + * 消息自定义数据(云端保存,会发送到对端,程序卸载重装后还能拉取到) |
| 69 | + */ |
| 70 | + @JsonProperty("CloudCustomData") |
| 71 | + private String cloudCustomData; |
| 72 | + |
| 73 | + |
| 74 | + public SendOfficialAccountMsgRequest() { |
| 75 | + } |
| 76 | + |
| 77 | + public SendOfficialAccountMsgRequest(String officialAccount, Integer random, List<TIMMsgElement> msgBody) { |
| 78 | + this.officialAccount = officialAccount; |
| 79 | + this.random = random; |
| 80 | + this.msgBody = msgBody; |
| 81 | + } |
| 82 | + |
| 83 | + public SendOfficialAccountMsgRequest(String officialAccount, Integer random, List<TIMMsgElement> msgBody, OfflinePushInfo offlinePushInfo, List<String> forbidCallbackControl, Integer onlineOnlyFlag, List<String> sendMsgControl, String cloudCustomData) { |
| 84 | + this.officialAccount = officialAccount; |
| 85 | + this.random = random; |
| 86 | + this.msgBody = msgBody; |
| 87 | + this.offlinePushInfo = offlinePushInfo; |
| 88 | + this.forbidCallbackControl = forbidCallbackControl; |
| 89 | + this.onlineOnlyFlag = onlineOnlyFlag; |
| 90 | + this.sendMsgControl = sendMsgControl; |
| 91 | + this.cloudCustomData = cloudCustomData; |
| 92 | + } |
| 93 | + |
| 94 | + private SendOfficialAccountMsgRequest(Builder builder) { |
| 95 | + this.officialAccount = builder.officialAccount; |
| 96 | + this.random = builder.random; |
| 97 | + this.msgBody = builder.msgBody; |
| 98 | + this.offlinePushInfo = builder.offlinePushInfo; |
| 99 | + this.forbidCallbackControl = builder.forbidCallbackControl; |
| 100 | + this.onlineOnlyFlag = builder.onlineOnlyFlag; |
| 101 | + this.sendMsgControl = builder.sendMsgControl; |
| 102 | + this.cloudCustomData = builder.cloudCustomData; |
| 103 | + } |
| 104 | + |
| 105 | + public static Builder builder() { |
| 106 | + return new Builder(); |
| 107 | + } |
| 108 | + |
| 109 | + |
| 110 | + public static final class Builder { |
| 111 | + private String officialAccount; |
| 112 | + private Integer random; |
| 113 | + private List<TIMMsgElement> msgBody; |
| 114 | + private OfflinePushInfo offlinePushInfo; |
| 115 | + private List<String> forbidCallbackControl; |
| 116 | + private Integer onlineOnlyFlag; |
| 117 | + private List<String> sendMsgControl; |
| 118 | + private String cloudCustomData; |
| 119 | + |
| 120 | + private Builder() { |
| 121 | + } |
| 122 | + |
| 123 | + public SendOfficialAccountMsgRequest build() { |
| 124 | + return new SendOfficialAccountMsgRequest(this); |
| 125 | + } |
| 126 | + |
| 127 | + public Builder officialAccount(String officialAccount) { |
| 128 | + this.officialAccount = officialAccount; |
| 129 | + return this; |
| 130 | + } |
| 131 | + |
| 132 | + public Builder random(Integer random) { |
| 133 | + this.random = random; |
| 134 | + return this; |
| 135 | + } |
| 136 | + |
| 137 | + public Builder msgBody(List<TIMMsgElement> msgBody) { |
| 138 | + this.msgBody = msgBody; |
| 139 | + return this; |
| 140 | + } |
| 141 | + |
| 142 | + public Builder offlinePushInfo(OfflinePushInfo offlinePushInfo) { |
| 143 | + this.offlinePushInfo = offlinePushInfo; |
| 144 | + return this; |
| 145 | + } |
| 146 | + |
| 147 | + public Builder forbidCallbackControl(List<String> forbidCallbackControl) { |
| 148 | + this.forbidCallbackControl = forbidCallbackControl; |
| 149 | + return this; |
| 150 | + } |
| 151 | + |
| 152 | + public Builder onlineOnlyFlag(Integer onlineOnlyFlag) { |
| 153 | + this.onlineOnlyFlag = onlineOnlyFlag; |
| 154 | + return this; |
| 155 | + } |
| 156 | + |
| 157 | + public Builder sendMsgControl(List<String> sendMsgControl) { |
| 158 | + this.sendMsgControl = sendMsgControl; |
| 159 | + return this; |
| 160 | + } |
| 161 | + |
| 162 | + public Builder cloudCustomData(String cloudCustomData) { |
| 163 | + this.cloudCustomData = cloudCustomData; |
| 164 | + return this; |
| 165 | + } |
| 166 | + } |
| 167 | + |
| 168 | + public String getOfficialAccount() { |
| 169 | + return officialAccount; |
| 170 | + } |
| 171 | + |
| 172 | + public void setOfficialAccount(String officialAccount) { |
| 173 | + this.officialAccount = officialAccount; |
| 174 | + } |
| 175 | + |
| 176 | + public Integer getRandom() { |
| 177 | + return random; |
| 178 | + } |
| 179 | + |
| 180 | + public void setRandom(Integer random) { |
| 181 | + this.random = random; |
| 182 | + } |
| 183 | + |
| 184 | + public List<TIMMsgElement> getMsgBody() { |
| 185 | + return msgBody; |
| 186 | + } |
| 187 | + |
| 188 | + public void setMsgBody(List<TIMMsgElement> msgBody) { |
| 189 | + this.msgBody = msgBody; |
| 190 | + } |
| 191 | + |
| 192 | + public OfflinePushInfo getOfflinePushInfo() { |
| 193 | + return offlinePushInfo; |
| 194 | + } |
| 195 | + |
| 196 | + public void setOfflinePushInfo(OfflinePushInfo offlinePushInfo) { |
| 197 | + this.offlinePushInfo = offlinePushInfo; |
| 198 | + } |
| 199 | + |
| 200 | + public List<String> getForbidCallbackControl() { |
| 201 | + return forbidCallbackControl; |
| 202 | + } |
| 203 | + |
| 204 | + public void setForbidCallbackControl(List<String> forbidCallbackControl) { |
| 205 | + this.forbidCallbackControl = forbidCallbackControl; |
| 206 | + } |
| 207 | + |
| 208 | + public Integer getOnlineOnlyFlag() { |
| 209 | + return onlineOnlyFlag; |
| 210 | + } |
| 211 | + |
| 212 | + public void setOnlineOnlyFlag(Integer onlineOnlyFlag) { |
| 213 | + this.onlineOnlyFlag = onlineOnlyFlag; |
| 214 | + } |
| 215 | + |
| 216 | + public List<String> getSendMsgControl() { |
| 217 | + return sendMsgControl; |
| 218 | + } |
| 219 | + |
| 220 | + public void setSendMsgControl(List<String> sendMsgControl) { |
| 221 | + this.sendMsgControl = sendMsgControl; |
| 222 | + } |
| 223 | + |
| 224 | + public String getCloudCustomData() { |
| 225 | + return cloudCustomData; |
| 226 | + } |
| 227 | + |
| 228 | + public void setCloudCustomData(String cloudCustomData) { |
| 229 | + this.cloudCustomData = cloudCustomData; |
| 230 | + } |
| 231 | +} |
0 commit comments