From ff2c1d99c64d01526893cf57dc54925bc1618eac Mon Sep 17 00:00:00 2001 From: yanrui Date: Tue, 14 Jun 2022 11:41:23 +0800 Subject: [PATCH] feat: #20220614 smsService --- .../codeages/escloud/service/SmsService.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/main/java/com/codeages/escloud/service/SmsService.java diff --git a/src/main/java/com/codeages/escloud/service/SmsService.java b/src/main/java/com/codeages/escloud/service/SmsService.java new file mode 100644 index 0000000..4d9b85d --- /dev/null +++ b/src/main/java/com/codeages/escloud/service/SmsService.java @@ -0,0 +1,35 @@ +package com.codeages.escloud.service; + +import com.codeages.escloud.Auth; + +import java.io.UnsupportedEncodingException; +import java.net.URISyntaxException; +import java.util.HashMap; +import java.util.Map; + +public class SmsService extends BaseService { + protected String host = "sms-service.qiqiuyun.net"; + + protected String[] leafHost = new String[]{"sms-service-leaf1.qiqiuyun.net", "sms-service-leaf2.qiqiuyun.net"}; + + public SmsService(Auth auth, Map options) { + String host = options.put("host", this.host); + init(auth, options); + } + + public String sendToOne(Map params) throws UnsupportedEncodingException, URISyntaxException { + return this.request("POST", "/messages", params, new HashMap<>(), "root"); + } + + public String sendToMany(Map params) throws UnsupportedEncodingException, URISyntaxException { + return this.request("POST", "/messages/batch_messages", params, new HashMap<>(), "root"); + } + + public String addSign(Map params) throws UnsupportedEncodingException, URISyntaxException { + return this.request("POST", "/signs", params, new HashMap<>(), "root"); + } + + public String addTemplate(Map params) throws UnsupportedEncodingException, URISyntaxException { + return this.request("POST", "/templates", params, new HashMap<>(), "root"); + } +} \ No newline at end of file