Skip to content

Commit

Permalink
Merge pull request #397 from Spencer17x/sms-typing
Browse files Browse the repository at this point in the history
fix: 添加sms typing
  • Loading branch information
longbai authored May 27, 2022
2 parents b01cf4c + 55ec974 commit c6e5ca6
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ package-lock.json

coverage/
.nyc_output/
.idea
yarn.lock
74 changes: 74 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* @date 2017-06-27
* @author xialeistudio<xialeistudio@gmail.com>
*/
import { Callback } from 'urllib';

export declare type callback = (e?: Error, respBody?: any, respInfo?: any) => void;

export declare namespace auth {
Expand Down Expand Up @@ -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<string, string>
},
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<string, string>
},
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<string, string>
},
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;
}
}

0 comments on commit c6e5ca6

Please sign in to comment.