cn.woodwhales.common.webhook.executor.DingTalkWebhookExecutor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of woodwhales-common Show documentation
Show all versions of woodwhales-common Show documentation
https://github.com/woodwhales
package cn.woodwhales.common.webhook.executor;
import cn.woodwhales.common.webhook.enums.WebhookProductEnum;
import cn.woodwhales.common.webhook.model.request.BaseWebhookRequestBody;
import cn.woodwhales.common.webhook.model.request.DingTalkRequestBody;
import cn.woodwhales.common.webhook.model.response.DingTalkResponse;
import cn.woodwhales.common.webhook.model.response.ExecuteResponse;
import lombok.extern.slf4j.Slf4j;
import java.util.Objects;
/**
* 钉钉webhook请求执行器
* @author woodwhales on 2021-07-19 9:34
*
* 正常响应报文:
* {
* "errcode": 0,
* "errmsg": "ok"
* }
*
*/
@Slf4j
public class DingTalkWebhookExecutor extends BaseWebhookExecutor {
private static final int ERR_CODE_SUCCESS = 0;
@Override
protected WebhookProductEnum webhookProductEnum() {
return WebhookProductEnum.DING_TALK;
}
@Override
protected boolean checkResponseObjectHandler(ExecuteResponse executeResponse) {
DingTalkResponse dingTalkResponse = executeResponse.parsedResponseObject;
return Objects.equals(ERR_CODE_SUCCESS, dingTalkResponse.getErrcode());
}
public static DingTalkWebhookExecutor newInstance() {
return new DingTalkWebhookExecutor();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy