node-easysms
Version:
EasySMS is an SMS sender for Node.js
92 lines (91 loc) • 2.4 kB
TypeScript
import { Gateway } from "./Gateway";
/**
* 消息类
*/
export declare class Message {
/**
* 文本消息
*/
static TEXT_MESSAGE: string;
/**
* 语音消息
*/
static VOICE_MESSAGE: string;
protected gateways: string[];
protected type: string;
protected sign_name: string | MessagePropertyClosure<string>;
protected content: string | MessagePropertyClosure<string>;
protected template: string | MessagePropertyClosure<string>;
protected data: Record<string, string | number> | MessagePropertyClosure<Record<string, string | number>>;
constructor(attributes: MessageProperty, type?: string);
/**
* 设置消息所对应的网关
* @param gateways
* @returns
*/
setGateways(gateways: string[]): this;
/**
* 获取消息所对应的网关
* @returns
*/
getGateways(): string[];
/**
* 设置消息类型
* @param type
* @returns
*/
setType(type: string): this;
/**
* 获取消息类型
* @returns
*/
getType(): string;
/**
* 获取消息类型
* @returns
*/
getMessageType(): string;
/**
* 设置消息签名
* @param sign_name
* @returns
*/
setSignName(sign_name: string | MessagePropertyClosure<string>): this;
/**
* 获取消息签名
* @param gateway 当前网关
* @returns
*/
getSignName(gateway: Gateway): Promise<string>;
/**
* 设置消息内容
* @param content
* @returns
*/
setContent(content: string | MessagePropertyClosure<string>): this;
/**
* 获取消息内容
* @param gateway 当前网关
* @returns
*/
getContent(gateway: Gateway): Promise<string>;
/**
* 设置消息模版
* @param template
* @returns
*/
setTemplate(template: string | MessagePropertyClosure<string>): this;
/**
* 获取消息模版
* @param gateway 当前网关
* @returns
*/
getTemplate<T = GatewayConfig>(gateway: Gateway<T>): Promise<string>;
setData(data: Record<string, string | number> | MessagePropertyClosure<Record<string, string | number>>): this;
/**
* 获取消息模版参数
* @param gateway 当前网关
* @returns
*/
getData<T = GatewayConfig>(gateway: Gateway<T>): Promise<Record<string, string | number>>;
}