@perk-net/pushplus-mcp-server
Version:
PushPlus MCP Server - 通过 Model Context Protocol 提供 PushPlus 推送消息功能,支持微信、邮箱等多渠道推送
155 lines • 5.13 kB
TypeScript
/**
* PushPlus API 客户端模块
* 提供 PushPlus 推送服务的 TypeScript 接口
*/
import { z } from 'zod';
export declare const PushPlusResponseSchema: z.ZodObject<{
code: z.ZodNumber;
msg: z.ZodString;
data: z.ZodOptional<z.ZodString>;
count: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
code: number;
msg: string;
data?: string | undefined;
count?: number | undefined;
}, {
code: number;
msg: string;
data?: string | undefined;
count?: number | undefined;
}>;
export type PushPlusResponse = z.infer<typeof PushPlusResponseSchema>;
export declare const PushMessageSchema: z.ZodObject<{
token: z.ZodString;
title: z.ZodString;
content: z.ZodString;
topic: z.ZodOptional<z.ZodString>;
template: z.ZodDefault<z.ZodEnum<["html", "txt", "json", "markdown", "cloudMonitor", "jenkins", "route", "pay"]>>;
channel: z.ZodDefault<z.ZodEnum<["wechat", "webhook", "cp", "mail", "sms"]>>;
to: z.ZodOptional<z.ZodString>;
pre: z.ZodOptional<z.ZodString>;
webhook: z.ZodOptional<z.ZodString>;
callbackUrl: z.ZodOptional<z.ZodString>;
timestamp: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
token: string;
title: string;
content: string;
template: "html" | "txt" | "json" | "markdown" | "cloudMonitor" | "jenkins" | "route" | "pay";
channel: "wechat" | "webhook" | "cp" | "mail" | "sms";
webhook?: string | undefined;
topic?: string | undefined;
to?: string | undefined;
pre?: string | undefined;
callbackUrl?: string | undefined;
timestamp?: number | undefined;
}, {
token: string;
title: string;
content: string;
webhook?: string | undefined;
topic?: string | undefined;
template?: "html" | "txt" | "json" | "markdown" | "cloudMonitor" | "jenkins" | "route" | "pay" | undefined;
channel?: "wechat" | "webhook" | "cp" | "mail" | "sms" | undefined;
to?: string | undefined;
pre?: string | undefined;
callbackUrl?: string | undefined;
timestamp?: number | undefined;
}>;
export type PushMessage = z.infer<typeof PushMessageSchema>;
export declare const MessageStatusQuerySchema: z.ZodObject<{
token: z.ZodString;
messageId: z.ZodString;
}, "strip", z.ZodTypeAny, {
token: string;
messageId: string;
}, {
token: string;
messageId: string;
}>;
export type MessageStatusQuery = z.infer<typeof MessageStatusQuerySchema>;
/**
* PushPlus API 客户端类
*/
export declare class PushPlusClient {
private defaultToken?;
private readonly baseUrl;
private readonly queryUrl;
constructor(defaultToken?: string | undefined);
/**
* 发送推送消息
* @param message 消息参数
* @returns 推送结果
*/
sendMessage(message: Partial<Omit<PushMessage, 'token'>> & {
title: string;
content: string;
token?: string;
}): Promise<PushPlusResponse>;
/**
* 查询消息发送状态
* @param query 查询参数
* @returns 消息状态
*/
queryMessageStatus(query: Omit<MessageStatusQuery, 'token'> & {
token?: string;
}): Promise<PushPlusResponse>;
/**
* 快速发送文本消息
* @param title 消息标题
* @param content 消息内容
* @param options 可选参数
* @returns 推送结果
*/
sendTextMessage(title: string, content: string, options?: Partial<Omit<PushMessage, 'title' | 'content' | 'token' | 'template'>> & {
token?: string;
}): Promise<PushPlusResponse>;
/**
* 快速发送HTML消息
* @param title 消息标题
* @param content HTML内容
* @param options 可选参数
* @returns 推送结果
*/
sendHtmlMessage(title: string, content: string, options?: Partial<Omit<PushMessage, 'title' | 'content' | 'token' | 'template'>> & {
token?: string;
}): Promise<PushPlusResponse>;
/**
* 快速发送Markdown消息
* @param title 消息标题
* @param content Markdown内容
* @param options 可选参数
* @returns 推送结果
*/
sendMarkdownMessage(title: string, content: string, options?: Partial<Omit<PushMessage, 'title' | 'content' | 'token' | 'template'>> & {
token?: string;
}): Promise<PushPlusResponse>;
/**
* 快速发送JSON消息
* @param title 消息标题
* @param content JSON内容
* @param options 可选参数
* @returns 推送结果
*/
sendJsonMessage(title: string, content: string, options?: Partial<Omit<PushMessage, 'title' | 'content' | 'token' | 'template'>> & {
token?: string;
}): Promise<PushPlusResponse>;
/**
* 设置默认token
* @param token PushPlus token
*/
setDefaultToken(token: string): void;
/**
* 获取当前默认token(脱敏显示)
* @returns 脱敏的token字符串
*/
getDefaultTokenMasked(): string;
/**
* 验证token格式
* @param token 待验证的token
* @returns 是否有效
*/
static isValidToken(token: string): boolean;
}
//# sourceMappingURL=pushplus.d.ts.map