base

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceIM = "im"

	IMGoEasy = "goeasy"
)
View Source
const (
	Aliyun    = "aliyun"
	Twilio    = "twilio"
	RongCloud = "rongcloud"
	Huawei    = "huawei"
)
View Source
const (
	BotMsgTypeText     = "text"
	BotMsgTypeMarkdown = "markdown"
)
View Source
const (
	ErrReqNotify = "ErrReqNotify"
	ErrMsgNotify = "ErrMsgNotify"
)
View Source
const (
	ServiceEmail = "email"
)
View Source
const (
	ServiceSMS = "sms"
)
View Source
const (
	ServiceWechatNotify = "wechat-notify"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseIMProvider

type BaseIMProvider struct {
	IIMProvider
	// contains filtered or unexported fields
}

func (*BaseIMProvider) GetEndpoint

func (s *BaseIMProvider) GetEndpoint() *IMEndpoint

func (*BaseIMProvider) GetHostByRegion

func (s *BaseIMProvider) GetHostByRegion(code string) string

func (*BaseIMProvider) Init

func (s *BaseIMProvider) Init(endpoint *IMEndpoint) error

func (*BaseIMProvider) PostMessage

func (s *BaseIMProvider) PostMessage(msg *IMMessage) error

type BaseSMSProvider

type BaseSMSProvider struct {
	Endpoints map[string]Endpoint
}

func (*BaseSMSProvider) AddEndpoint

func (s *BaseSMSProvider) AddEndpoint(name string, endpoint Endpoint)

func (*BaseSMSProvider) GetEndpoint

func (s *BaseSMSProvider) GetEndpoint(name string) (*Endpoint, error)

func (*BaseSMSProvider) Init

func (s *BaseSMSProvider) Init()

type BotMsgContent added in v0.1.7

type BotMsgContent struct {
	MsgType  string   `json:"msgtype"`
	Text     *Content `json:"text,omitempty"`
	Markdown *Content `json:"markdown,omitempty"`
}

type Content added in v0.1.7

type Content struct {
	Content string `json:"content"`
}

type CustomerImage added in v0.1.7

type CustomerImage struct {
	Endpoint string `json:"endpoint"`
	Path     string `json:"path"`
}

type CustomerImageResp added in v0.1.7

type CustomerImageResp struct {
	MediaID string `json:"media_id"`
}

type CustomerMsg added in v0.1.7

type CustomerMsg struct {
	ToUser  string `json:"touser"`
	MsgType string `json:"msgtype"`
}

type CustomerMsgImage added in v0.1.7

type CustomerMsgImage struct {
	CustomerMsg
	Image MsgImage `json:"image"`
}
type CustomerMsgLink struct {
	CustomerMsg
	Link MsgLink `json:"link"`
}

type CustomerMsgText added in v0.1.7

type CustomerMsgText struct {
	CustomerMsg
	Text Content `json:"text"`
}

type Endpoint

type Endpoint struct {
	Provider     string `yaml:"provider"`
	AppKey       string `yaml:"app_key"`
	AppSecret    string `yaml:"app_secret"`
	Region       string `yaml:"region"`
	SignName     string `yaml:"sign_name"`
	TemplateCode string `yaml:"template_code"`
	HostNum      string `yaml:"host_num"`
}

type EnterpriseGroupMsg added in v0.1.7

type EnterpriseGroupMsg struct {
	ChatID  string  `json:"chatid"`
	MsgType string  `json:"msgtype"`
	Safe    int     `json:"safe"`
	Text    Content `json:"text"`
}

type EnterpriseMsg added in v0.1.7

type EnterpriseMsg struct {
	Endpoint string `json:"endpoint"`
	EnterpriseGroupMsg
}

type IIMProvider

type IIMProvider interface {
	GetHostByRegion(code string) string
	Init(endpoint *IMEndpoint) error
	PostMessage(msg *IMMessage) error
	GetEndpoint() *IMEndpoint
}

type IMEndpoint

type IMEndpoint struct {
	Provider string   `yaml:"provider"`
	AppKey   string   `yaml:"app_key"`
	Hosts    []string `yaml:"hosts"`
}

type IMMessage

type IMMessage struct {
	Channel string
	Content string
	Host    string
}

type ISMSProvider

type ISMSProvider interface {
	Send(req *ReqSMS) error
	Init()
	GetEndpoint(name string) (*Endpoint, error)
	AddEndpoint(name string, endpoint Endpoint)
}

type IServiceEmail

type IServiceEmail interface {
	Send(req *ReqEmail) error
}

type IServiceIM

type IServiceIM interface {
	PostMessage(providerName string, msg *IMMessage) error
	GetHostByRegion(providerName string, code string) (string, error)
}

type IServiceSMS

type IServiceSMS interface {
	Send(req *ReqSMS) error
}

type IServiceWechatNotify added in v0.1.7

type IServiceWechatNotify interface {
	PostGroupBotMsg(req *ReqBotMsg) error
}

type MPMsgTemplate added in v0.1.7

type MPMsgTemplate struct {
	Touser     string `json:"touser"`
	TemplateID string `json:"template_id"`
	//Url             string      `json:"url"`
	//MiniProgram     MiniProgram `json:"miniprogram"`
	FormID string      `json:"form_id"`
	Data   interface{} `json:"data"`
}

type MPSubscribeMsg added in v0.1.7

type MPSubscribeMsg struct {
	Endpoint string `json:"endpoint"`
}

type MiniProgram added in v0.1.7

type MiniProgram struct {
	AppID string `json:"appid"`
	Page  string `json:"page"`
}

type MsgCustomer added in v0.1.7

type MsgCustomer struct {
	Touser  string `json:"touser"`
	Msgtype string `json:"msgtype"`
	Text    string `json:"text"`
}

type MsgImage added in v0.1.7

type MsgImage struct {
	MediaID string `json:"media_id"`
}
type MsgLink struct {
	Title    string `json:"title"`
	Desc     string `json:"description"`
	Url      string `json:"url"`
	ThumbUrl string `json:"thumb_url"`
}

type MsgResp added in v0.1.7

type MsgResp struct {
	Errcode int    `json:"errcode"`
	Errmsg  string `json:"errmsg"`
}

type MsgRespImage added in v0.1.7

type MsgRespImage struct {
	MsgResp
	MediaID string `json:"media_id"`
}

type MsgTemplate added in v0.1.7

type MsgTemplate struct {
	Touser          string      `json:"touser"`
	TemplateID      string      `json:"template_id"`
	Url             string      `json:"url"`
	MiniProgram     MiniProgram `json:"miniprogram"`
	FormID          string      `json:"form_id"`
	Data            interface{} `json:"data"`
	EmphasisKeyword string      `json:"emphasis_keyword"`
}

type ReqBotMsg added in v0.1.7

type ReqBotMsg struct {
	BotKey string
	BotMsgContent
}

type ReqCustomerMsg added in v0.1.7

type ReqCustomerMsg struct {
	Endpoint string      `json:"endpoint"`
	Body     interface{} `json:"body"`
}

type ReqEmail

type ReqEmail struct {
	Endpoint string   `json:"endpoint"`
	MailTo   []string `json:"mail_to"`
	Subject  string   `json:"subject"`
	Body     string   `json:"body"`
}

type ReqSMS

type ReqSMS struct {
	Provider string            `json:"provider"`
	Endpoint string            `json:"endpoint"`
	Mobile   string            `json:"mobile"`
	Content  map[string]string `json:"content"`
}

type TemplateMsg added in v0.1.7

type TemplateMsg struct {
	Endpoint string `json:"endpoint"`
	MsgTemplate
}

type TemplateValue added in v0.1.7

type TemplateValue struct {
	Value string `json:"value"`
}

type TokenResp added in v0.1.7

type TokenResp struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
	Errcode     int    `json:"errcode"`
	Errmsg      string `json:"errmsg"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL