All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.woodwhales.common.webhook.executor.DingTalkWebhookExecutor Maven / Gradle / Ivy

There is a newer version: 3.8.3
Show newest version
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