|
| 1 | +package me.chanjar.weixin.cp.bean.oa.mail; |
| 2 | + |
| 3 | +import com.google.gson.annotations.SerializedName; |
| 4 | +import lombok.*; |
| 5 | +import lombok.experimental.Accessors; |
| 6 | +import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; |
| 7 | + |
| 8 | +import java.io.Serializable; |
| 9 | +import java.util.List; |
| 10 | + |
| 11 | +/** |
| 12 | + * 发送普通邮件请求. |
| 13 | + * |
| 14 | + * @author Hugo |
| 15 | + */ |
| 16 | +@Data |
| 17 | +@Builder |
| 18 | +@NoArgsConstructor |
| 19 | +@AllArgsConstructor |
| 20 | +@Accessors(chain = true) |
| 21 | +public class WxCpMailCommonSendRequest implements Serializable { |
| 22 | + private static final long serialVersionUID = -4961239393895454138L; |
| 23 | + |
| 24 | + /** |
| 25 | + * 收件人,to.emails 和 to.userids 至少传一个 |
| 26 | + */ |
| 27 | + @SerializedName("to") |
| 28 | + private TO to; |
| 29 | + |
| 30 | + /** |
| 31 | + * 抄送 |
| 32 | + */ |
| 33 | + @SerializedName("cc") |
| 34 | + private CC cc; |
| 35 | + |
| 36 | + /** |
| 37 | + * 文档类型, 3:文档 4:表格 |
| 38 | + */ |
| 39 | + @SerializedName("bcc") |
| 40 | + private BCC bcc; |
| 41 | + |
| 42 | + /** |
| 43 | + * 标题 |
| 44 | + */ |
| 45 | + @SerializedName("subject") |
| 46 | + private String subject; |
| 47 | + |
| 48 | + /** |
| 49 | + * 内容 |
| 50 | + */ |
| 51 | + @SerializedName("content") |
| 52 | + private String content; |
| 53 | + |
| 54 | + /** |
| 55 | + * 附件相关 |
| 56 | + */ |
| 57 | + @SerializedName("attachment_list") |
| 58 | + private List<Attachment> attachmentList; |
| 59 | + |
| 60 | + /** |
| 61 | + * 内容类型 html,text(默认是html) |
| 62 | + */ |
| 63 | + @SerializedName("content_type") |
| 64 | + private String contentType; |
| 65 | + |
| 66 | + /** |
| 67 | + * 表示是否开启id转译,0表示否,1表示是,默认0。仅第三方应用需要用到,企业自建应用可以忽略。 |
| 68 | + * 目前仅subject、content、attachment_list[].file_name字段支持转译。 |
| 69 | + */ |
| 70 | + @SerializedName("enable_id_trans") |
| 71 | + private Integer enableIdTrans; |
| 72 | + |
| 73 | + @Getter |
| 74 | + @Setter |
| 75 | + public static class TO implements Serializable { |
| 76 | + private static final long serialVersionUID = -4860239393895754598L; |
| 77 | + |
| 78 | + /** |
| 79 | + * 收件人,邮箱地址 |
| 80 | + */ |
| 81 | + @SerializedName("emails") |
| 82 | + private List<String> emails; |
| 83 | + |
| 84 | + /** |
| 85 | + * 收件人,企业内成员的userid |
| 86 | + */ |
| 87 | + @SerializedName("userids") |
| 88 | + private List<String> userIds; |
| 89 | + |
| 90 | + /** |
| 91 | + * From json space info. |
| 92 | + * |
| 93 | + * @param json the json |
| 94 | + * @return the space info |
| 95 | + */ |
| 96 | + public static WxCpMailCommonSendRequest.TO fromJson(String json) { |
| 97 | + return WxCpGsonBuilder.create().fromJson(json, WxCpMailCommonSendRequest.TO.class); |
| 98 | + } |
| 99 | + |
| 100 | + /** |
| 101 | + * To json string. |
| 102 | + * |
| 103 | + * @return the string |
| 104 | + */ |
| 105 | + public String toJson() { |
| 106 | + return WxCpGsonBuilder.create().toJson(this); |
| 107 | + } |
| 108 | + |
| 109 | + } |
| 110 | + |
| 111 | + @Getter |
| 112 | + @Setter |
| 113 | + public static class CC implements Serializable { |
| 114 | + private static final long serialVersionUID = -4863239393895754598L; |
| 115 | + |
| 116 | + /** |
| 117 | + * 抄送人,邮箱地址 |
| 118 | + */ |
| 119 | + @SerializedName("emails") |
| 120 | + private List<String> emails; |
| 121 | + |
| 122 | + /** |
| 123 | + * 抄送人,企业内成员的userid |
| 124 | + */ |
| 125 | + @SerializedName("userids") |
| 126 | + private List<String> userIds; |
| 127 | + |
| 128 | + /** |
| 129 | + * From json space info. |
| 130 | + * |
| 131 | + * @param json the json |
| 132 | + * @return the space info |
| 133 | + */ |
| 134 | + public static WxCpMailCommonSendRequest.CC fromJson(String json) { |
| 135 | + return WxCpGsonBuilder.create().fromJson(json, WxCpMailCommonSendRequest.CC.class); |
| 136 | + } |
| 137 | + |
| 138 | + /** |
| 139 | + * To json string. |
| 140 | + * |
| 141 | + * @return the string |
| 142 | + */ |
| 143 | + public String toJson() { |
| 144 | + return WxCpGsonBuilder.create().toJson(this); |
| 145 | + } |
| 146 | + |
| 147 | + } |
| 148 | + |
| 149 | + @Getter |
| 150 | + @Setter |
| 151 | + public static class BCC implements Serializable { |
| 152 | + private static final long serialVersionUID = -4860239393885754598L; |
| 153 | + |
| 154 | + /** |
| 155 | + * 密送人,邮箱地址 |
| 156 | + */ |
| 157 | + @SerializedName("emails") |
| 158 | + private List<String> emails; |
| 159 | + |
| 160 | + /** |
| 161 | + * 密送人,企业内成员的userid |
| 162 | + */ |
| 163 | + @SerializedName("userids") |
| 164 | + private List<String> userIds; |
| 165 | + |
| 166 | + /** |
| 167 | + * From json space info. |
| 168 | + * |
| 169 | + * @param json the json |
| 170 | + * @return the space info |
| 171 | + */ |
| 172 | + public static WxCpMailCommonSendRequest.BCC fromJson(String json) { |
| 173 | + return WxCpGsonBuilder.create().fromJson(json, WxCpMailCommonSendRequest.BCC.class); |
| 174 | + } |
| 175 | + |
| 176 | + /** |
| 177 | + * To json string. |
| 178 | + * |
| 179 | + * @return the string |
| 180 | + */ |
| 181 | + public String toJson() { |
| 182 | + return WxCpGsonBuilder.create().toJson(this); |
| 183 | + } |
| 184 | + |
| 185 | + } |
| 186 | + |
| 187 | + @Getter |
| 188 | + @Setter |
| 189 | + public static class Attachment implements Serializable { |
| 190 | + private static final long serialVersionUID = -4860230393895754598L; |
| 191 | + |
| 192 | + /** |
| 193 | + * 文件名 |
| 194 | + */ |
| 195 | + @SerializedName("file_name") |
| 196 | + private String fileName; |
| 197 | + |
| 198 | + /** |
| 199 | + * 文件内容(base64编码),所有附件加正文的大小不允许超过50M, 且附件个数不能超过200个 |
| 200 | + */ |
| 201 | + @SerializedName("content") |
| 202 | + private String content; |
| 203 | + |
| 204 | + /** |
| 205 | + * From json space info. |
| 206 | + * |
| 207 | + * @param json the json |
| 208 | + * @return the space info |
| 209 | + */ |
| 210 | + public static WxCpMailCommonSendRequest.Attachment fromJson(String json) { |
| 211 | + return WxCpGsonBuilder.create().fromJson(json, WxCpMailCommonSendRequest.Attachment.class); |
| 212 | + } |
| 213 | + |
| 214 | + /** |
| 215 | + * To json string. |
| 216 | + * |
| 217 | + * @return the string |
| 218 | + */ |
| 219 | + public String toJson() { |
| 220 | + return WxCpGsonBuilder.create().toJson(this); |
| 221 | + } |
| 222 | + |
| 223 | + } |
| 224 | + |
| 225 | + /** |
| 226 | + * From json wx cp space create request. |
| 227 | + * |
| 228 | + * @param json the json |
| 229 | + * @return the wx cp space create request |
| 230 | + */ |
| 231 | + public static WxCpMailCommonSendRequest fromJson(String json) { |
| 232 | + return WxCpGsonBuilder.create().fromJson(json, WxCpMailCommonSendRequest.class); |
| 233 | + } |
| 234 | + |
| 235 | + /** |
| 236 | + * To json string. |
| 237 | + * |
| 238 | + * @return the string |
| 239 | + */ |
| 240 | + public String toJson() { |
| 241 | + return WxCpGsonBuilder.create().toJson(this); |
| 242 | + } |
| 243 | + |
| 244 | +} |
0 commit comments