wechat

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWechatNotify

func NewWechatNotify(corpId, corpSecret string, opts ...Option) (notify.Notifier[map[string]any], error)

Types

type Builder

type Builder interface {
	Build() Receivers
	SetToUser(toUser []string) Builder
	SetToParty(toParty string) Builder
	SetToTag(toTag string) Builder
	SetAgentId(agentId int) Builder
}

func NewReceiversBuilder

func NewReceiversBuilder() Builder

type CardMessage

type CardMessage struct {
	Receivers
	TemplateCard
}

func NewCardMessage

func NewCardMessage(builder Receivers, card TemplateCard) *CardMessage

func (*CardMessage) Message

func (m *CardMessage) Message() (map[string]interface{}, error)

type CustomMessage

type CustomMessage struct {
	Custom map[string]interface{}
}

func NewCustomMessage

func NewCustomMessage(custom map[string]any) *CustomMessage

func (*CustomMessage) Message

func (m *CustomMessage) Message() (map[string]any, error)

type MarkdownMessage

type MarkdownMessage struct {
	Receivers
	MsgType string `json:"msgtype"`
	Content string `json:"content"`
}

func NewMarkdownMessage

func NewMarkdownMessage(builder Receivers, content string) *MarkdownMessage

func (*MarkdownMessage) Message

func (m *MarkdownMessage) Message() (map[string]any, error)

type Notifier

type Notifier struct {
	// contains filtered or unexported fields
}

func (*Notifier) CopyUrl

func (n *Notifier) CopyUrl() *url.URL

func (*Notifier) Send

type Option

type Option func(*Notifier)

func WithAgentId

func WithAgentId(agentId string) Option

WithAgentId 选项函数,用于自定义 AgentId

func WithUrl

func WithUrl(wxUrl *url.URL) Option

WithUrl 选项函数,用于自定义 URL

type Receivers

type Receivers struct {
	ToUser  string `json:"touser"`
	ToParty string `json:"toparty"`
	ToTag   string `json:"totag"`
	AgentId int    `json:"agentid"`
	MsgType string `json:"msgtype"`
}

type TemplateCard

type TemplateCard interface {
	Message() (map[string]any, error)
}

type TextMessage

type TextMessage struct {
	Receivers
	MsgType string `json:"msgtype"`
	Content string `json:"content"`
}

func NewTextMessage

func NewTextMessage(builder Receivers, content string) *TextMessage

func (*TextMessage) Message

func (m *TextMessage) Message() (map[string]any, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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