AliSmsPipeline.java 1.38 KB
package com.diligrp.assistant.sms.pipeline;

import com.diligrp.assistant.sms.client.AliSmsHttpClient;
import com.diligrp.assistant.sms.domain.SmsMessage;
import com.diligrp.assistant.sms.domain.SmsTemplate;
import com.diligrp.assistant.sms.type.PipelineType;
import com.diligrp.assistant.sms.type.TemplateState;

public class AliSmsPipeline extends SmsPipeline {
    private AliSmsHttpClient client;

    public AliSmsPipeline(int code, String name, String endPoint, String accessKeyId, String accessKeySecret) {
        super(code, name, PipelineType.SMS_ALI);
        this.client = new AliSmsHttpClient(endPoint, accessKeyId, accessKeySecret);
    }

    @Override
    public boolean templateSupported() {
        return true;
    }

    @Override
    public String createSmsTemplate(SmsTemplate template) {
        return this.client.createSmsTemplate(template);
    }

    @Override
    public void modifySmsTemplate(SmsTemplate template) {
        this.client.modifySmsTemplate(template);
    }

    @Override
    public TemplateState querySmsTemplateState(String templateId) {
        return this.client.querySmsTemplateState(templateId);
    }

    @Override
    public void deleteSmsTemplate(String templateId) {
        this.client.deleteSmsTemplate(templateId);
    }

    @Override
    public String sendSmsMessage(SmsMessage message) {
        return this.client.sendSmsMessage(message);
    }
}