com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request Maven / Gradle / Ivy
The newest version!
package com.dingtalk.api.request;
import java.util.List;
import com.taobao.api.internal.mapping.ApiField;
import com.taobao.api.internal.util.RequestCheckUtils;
import com.taobao.api.internal.mapping.ApiListField;
import com.taobao.api.TaobaoObject;
import java.util.Map;
import java.util.List;
import com.taobao.api.ApiRuleException;
import com.taobao.api.BaseTaobaoRequest;
import com.dingtalk.api.DingTalkConstants;
import com.taobao.api.Constants;
import com.taobao.api.internal.util.TaobaoHashMap;
import com.taobao.api.internal.util.TaobaoUtils;
import com.taobao.api.internal.util.json.JSONWriter;
import com.dingtalk.api.response.OapiMessageCorpconversationAsyncsendV2Response;
/**
* TOP DingTalk-API: dingtalk.oapi.message.corpconversation.asyncsend_v2 request
*
* @author top auto create
* @since 1.0, 2021.06.03
*/
public class OapiMessageCorpconversationAsyncsendV2Request extends BaseTaobaoRequest {
/**
* 微应用的id
*/
private Long agentId;
/**
* 接收者的部门id列表
*/
private String deptIdList;
/**
* 是否开启id转译,默认false。仅第三方应用需要用到,企业内部应用可以忽略
*/
private Boolean enableIdTrans;
/**
* 消息体,具体见文档
*/
private String msg;
/**
* 是否发送给企业全部用户
*/
private Boolean toAllUser;
/**
* 接收者的用户userid列表
*/
private String useridList;
public void setAgentId(Long agentId) {
this.agentId = agentId;
}
public Long getAgentId() {
return this.agentId;
}
public void setDeptIdList(String deptIdList) {
this.deptIdList = deptIdList;
}
public String getDeptIdList() {
return this.deptIdList;
}
public void setEnableIdTrans(Boolean enableIdTrans) {
this.enableIdTrans = enableIdTrans;
}
public Boolean getEnableIdTrans() {
return this.enableIdTrans;
}
public void setMsg(String msg) {
this.msg = msg;
}
public void setMsg(Msg msg) {
this.msg = new JSONWriter(false,false,true).write(msg);
}
public String getMsg() {
return this.msg;
}
public void setToAllUser(Boolean toAllUser) {
this.toAllUser = toAllUser;
}
public Boolean getToAllUser() {
return this.toAllUser;
}
public void setUseridList(String useridList) {
this.useridList = useridList;
}
public String getUseridList() {
return this.useridList;
}
public String getApiMethodName() {
return "dingtalk.oapi.message.corpconversation.asyncsend_v2";
}
private String topResponseType = Constants.RESPONSE_TYPE_DINGTALK_OAPI;
public String getTopResponseType() {
return this.topResponseType;
}
public void setTopResponseType(String topResponseType) {
this.topResponseType = topResponseType;
}
public String getTopApiCallType() {
return DingTalkConstants.CALL_TYPE_OAPI;
}
private String topHttpMethod = DingTalkConstants.HTTP_METHOD_POST;
public String getTopHttpMethod() {
return this.topHttpMethod;
}
public void setTopHttpMethod(String topHttpMethod) {
this.topHttpMethod = topHttpMethod;
}
public void setHttpMethod(String httpMethod) {
this.setTopHttpMethod(httpMethod);
}
public Map getTextParams() {
TaobaoHashMap txtParams = new TaobaoHashMap();
txtParams.put("agent_id", this.agentId);
txtParams.put("dept_id_list", this.deptIdList);
txtParams.put("enable_id_trans", this.enableIdTrans);
txtParams.put("msg", this.msg);
txtParams.put("to_all_user", this.toAllUser);
txtParams.put("userid_list", this.useridList);
if(this.udfParams != null) {
txtParams.putAll(this.udfParams);
}
return txtParams;
}
public Class getResponseClass() {
return OapiMessageCorpconversationAsyncsendV2Response.class;
}
public void check() throws ApiRuleException {
RequestCheckUtils.checkNotEmpty(agentId, "agentId");
RequestCheckUtils.checkMaxListSize(deptIdList, 500, "deptIdList");
RequestCheckUtils.checkMaxListSize(useridList, 5000, "useridList");
}
/**
* 文本消息
*
* @author top auto create
* @since 1.0, null
*/
public static class Text extends TaobaoObject {
private static final long serialVersionUID = 7136822967334988419L;
/**
* 文本消息
*/
@ApiField("content")
private String content;
public String getContent() {
return this.content;
}
public void setContent(String content) {
this.content = content;
}
}
/**
* 图片消息
*
* @author top auto create
* @since 1.0, null
*/
public static class Image extends TaobaoObject {
private static final long serialVersionUID = 5111316984979551457L;
/**
* 图片消息
*/
@ApiField("media_id")
private String mediaId;
public String getMediaId() {
return this.mediaId;
}
public void setMediaId(String mediaId) {
this.mediaId = mediaId;
}
}
/**
* 链接消息
*
* @author top auto create
* @since 1.0, null
*/
public static class Link extends TaobaoObject {
private static final long serialVersionUID = 2757883691527167563L;
/**
* 消息点击链接地址
*/
@ApiField("messageUrl")
private String messageUrl;
/**
* 图片地址
*/
@ApiField("picUrl")
private String picUrl;
/**
* 消息标题,建议100字符以内
*/
@ApiField("text")
private String text;
/**
* 消息描述,建议500字符以内
*/
@ApiField("title")
private String title;
public String getMessageUrl() {
return this.messageUrl;
}
public void setMessageUrl(String messageUrl) {
this.messageUrl = messageUrl;
}
public String getPicUrl() {
return this.picUrl;
}
public void setPicUrl(String picUrl) {
this.picUrl = picUrl;
}
public String getText() {
return this.text;
}
public void setText(String text) {
this.text = text;
}
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
}
/**
* 文件消息
*
* @author top auto create
* @since 1.0, null
*/
public static class File extends TaobaoObject {
private static final long serialVersionUID = 8133117921592134818L;
/**
* 媒体文件id。引用的媒体文件最大10MB
*/
@ApiField("media_id")
private String mediaId;
public String getMediaId() {
return this.mediaId;
}
public void setMediaId(String mediaId) {
this.mediaId = mediaId;
}
}
/**
* 语音消息
*
* @author top auto create
* @since 1.0, null
*/
public static class Voice extends TaobaoObject {
private static final long serialVersionUID = 8116843149852161251L;
/**
* 正整数,小于60,表示音频时长
*/
@ApiField("duration")
private String duration;
/**
* 媒体文件id。2MB,播放长度不超过60s,AMR格式
*/
@ApiField("media_id")
private String mediaId;
public String getDuration() {
return this.duration;
}
public void setDuration(String duration) {
this.duration = duration;
}
public String getMediaId() {
return this.mediaId;
}
public void setMediaId(String mediaId) {
this.mediaId = mediaId;
}
}
/**
* 单行富文本信息
*
* @author top auto create
* @since 1.0, null
*/
public static class Rich extends TaobaoObject {
private static final long serialVersionUID = 4322925993384868721L;
/**
* 单行富文本信息的数目
*/
@ApiField("num")
private String num;
/**
* 单行富文本信息的单位
*/
@ApiField("unit")
private String unit;
public String getNum() {
return this.num;
}
public void setNum(String num) {
this.num = num;
}
public String getUnit() {
return this.unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
}
/**
* 消息体的表单,最多显示6个,超过会被隐藏
*
* @author top auto create
* @since 1.0, null
*/
public static class Form extends TaobaoObject {
private static final long serialVersionUID = 5497629143915434225L;
/**
* 消息体的关键字
*/
@ApiField("key")
private String key;
/**
* 消息体的关键字对应的值
*/
@ApiField("value")
private String value;
public String getKey() {
return this.key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return this.value;
}
public void setValue(String value) {
this.value = value;
}
}
/**
* 消息体
*
* @author top auto create
* @since 1.0, null
*/
public static class Body extends TaobaoObject {
private static final long serialVersionUID = 7236545756276272138L;
/**
* 自定义的作者名字
*/
@ApiField("author")
private String author;
/**
* 消息体的内容,最多显示3行
*/
@ApiField("content")
private String content;
/**
* 自定义的附件数目。此数字仅供显示,钉钉不作验证
*/
@ApiField("file_count")
private String fileCount;
/**
* 消息体的表单,最多显示6个,超过会被隐藏
*/
@ApiListField("form")
@ApiField("form")
private List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy