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

cn.woodwhales.common.webhook.model.request.WebhookRequestBodyFactory Maven / Gradle / Ivy

There is a newer version: 3.8.3
Show newest version
package cn.woodwhales.common.webhook.model.request;

import cn.woodwhales.common.webhook.enums.WebhookProductEnum;

import java.util.List;

/**
 * @author woodwhales on 2021-07-20 10:02
 */
public class WebhookRequestBodyFactory {

    public static BaseWebhookRequestBody newInstance(WebhookProductEnum webhookProductEnum,
                                                     String title) {
        return newInstance(webhookProductEnum, title, null, null);
    }

    public static BaseWebhookRequestBody newInstance(WebhookProductEnum webhookProductEnum,
                                                     String title,
                                                     List userIdList,
                                                     List userMobileList) {
        BaseWebhookRequestBody requestBody = null;
        switch (webhookProductEnum) {
            case WE_COM :
                requestBody = WeComRequestBody.newInstance(title);
                requestBody.addUserMobileList(userMobileList);
                requestBody.addUserIdList(userIdList);
                break;

            case DING_TALK :
                requestBody = DingTalkRequestBody.newInstance(title);
                requestBody.addUserMobileList(userMobileList);
                requestBody.addUserIdList(userIdList);
                break;

            case FEI_SHU :
                requestBody = FeiShuRequestBody.newInstance(title);
                requestBody.addUserIdList(userIdList);
                break;
        }
        requestBody.setWebhookProductEnum(webhookProductEnum);
        return requestBody;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy