import { AxiosResponse } from 'axios' ; import debug from 'debug' ; import { Send } from '../interfaces/send' ; import { ajax } from '@/utils/ajax' ; const Debugger = debug ( 'push:push-plus' ) ; export type TemplateType = 'html' | 'txt' | 'json' | 'markdown' | 'cloudMonitor' | 'jenkins' | 'route' ; export type ChannelType = 'wechat' | 'webhook' | 'cp' | 'sms' | 'mail' ; author CaoMeiYouRen
 *  date export class export class PushPlus implements Send { private private PUSH_PLUS_TOKEN : string ; author CaoMeiYouRen
     *  date param PUSH_PLUS_TOKEN constructor ( PUSH_PLUS_TOKEN ) { this . PUSH_PLUS_TOKEN = PUSH_PLUS_TOKEN ; Debugger ( 'set PUSH_PLUS_TOKEN: "%s"' , PUSH_PLUS_TOKEN ) ; if ( ! this . PUSH_PLUS_TOKEN ) { throw new Error ( 'PUSH_PLUS_TOKEN 是必须的！' ) ; } } author CaoMeiYouRen
     *  date param title param content param template param channel returns send ( title , content ? , template = 'html' , channel = 'wechat' ) { Debugger ( 'title: "%s", content: "%s", template: "%s"' , title , content , template ) ; return ajax ( { url : 'http://www.pushplus.plus/send' , method : 'POST' , headers : { 'Content-Type' : 'application/json' , } , data : { token : this . PUSH_PLUS_TOKEN , title , content : content || title , template , channel , } , } ) ; } }