From 55ec97450a96141006616bda90ef341c9a7c5a66 Mon Sep 17 00:00:00 2001 From: Spencer17x <1253478653@qq.com> Date: Mon, 23 May 2022 15:51:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0sms=20typing,=20fix=20?= =?UTF-8?q?#382?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ index.d.ts | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/.gitignore b/.gitignore index 73b9a049..022d82dc 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ package-lock.json coverage/ .nyc_output/ +.idea +yarn.lock diff --git a/index.d.ts b/index.d.ts index c9547ec7..c11a9160 100644 --- a/index.d.ts +++ b/index.d.ts @@ -3,6 +3,8 @@ * @date 2017-06-27 * @author xialeistudio */ +import { Callback } from 'urllib'; + export declare type callback = (e?: Error, respBody?: any, respInfo?: any) => void; export declare namespace auth { @@ -918,3 +920,75 @@ export declare namespace rs { uploadToken(mac?: auth.digest.Mac): string; } } + +export declare namespace sms { + namespace message { + /** + * 发送短信 (POST Message) + * @link https://developer.qiniu.com/sms/5897/sms-api-send-message#1 + * @param reqBody + * @param mac + * @param callback + */ + function sendMessage( + reqBody: { + "template_id": string, + "mobiles": string[], + "parameters"?: Record + }, + mac: auth.digest.Mac, + callback: Callback<{ job_id: string }> + ): void; + + /** + * 发送单条短信 (POST Single Message) + * @link https://developer.qiniu.com/sms/5897/sms-api-send-message#2 + * @param reqBody + * @param mac + * @param callback + */ + function sendSingleMessage( + reqBody: { + "template_id": string, + "mobile": string, + "parameters"?: Record + }, + mac: auth.digest.Mac, + callback: Callback<{ message_id: string }> + ): void; + + /** + * 发送国际/港澳台短信 (POST Oversea Message) + * @link https://developer.qiniu.com/sms/5897/sms-api-send-message#3 + * @param reqBody + * @param mac + * @param callback + */ + function sendOverseaMessage( + reqBody: { + "template_id": string, + "mobile": string, + "parameters"?: Record + }, + mac: auth.digest.Mac, + callback: Callback<{ message_id: string }> + ): void; + + /** + * 发送全文本短信(不需要传模版 ID) (POST Fulltext Message) + * @link https://developer.qiniu.com/sms/5897/sms-api-send-message#4 + * @param reqBody + * @param mac + * @param callback + */ + function sendFulltextMessage( + reqBody: { + "mobiles": string[], + "content": string, + "template_type": string + }, + mac: auth.digest.Mac, + callback: Callback<{ job_id: string }> + ): void; + } +}