dingtalk

package
v0.0.0-...-e86f03a Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: MIT Imports: 14 Imported by: 0

README

DingTalk

官方网站

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNotifier

func NewNotifier(opts ...Option) notifier.Notifier

Types

type At

type At struct {
	AtMobiles []string `json:"atMobiles"`
	IsAtAll   bool     `json:"isAtAll"`
}

type Message

type Message interface {
	ToByte() ([]byte, error)
}

Message interface

type MsgType

type MsgType string
const (
	MsgTypeText       MsgType = "text"       // 文本消息
	MsgTypeMarkdown   MsgType = "markdown"   // markdown消息
	MsgTypeLink       MsgType = "link"       // 链接消息
	MsgTypeActionCard MsgType = "actionCard" // 卡片消息
	MsgTypeFeedCard   MsgType = "feedCard"   // 卡片消息
)

type Notifier

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

Notifier 钉钉客户端

func (*Notifier) Send

func (c *Notifier) Send(_ context.Context, _, content string) error

Send 发送聊天消息

type Option

type Option func(o *Notifier)

func AccessToken

func AccessToken(token string) Option

AccessToken 钉钉访问令牌

func Logger

func Logger(logger notifier.Logger) Option

Logger 日志记录器

func Secret

func Secret(secret string) Option

Secret 钉钉签名密钥

type Text

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

type TextMessage

type TextMessage struct {
	MsgType MsgType `json:"msgtype"`
	Text    Text    `json:"text"`
	At      At      `json:"at"`
}

func (*TextMessage) SetAt

func (m *TextMessage) SetAt(atMobiles []string, isAtAll bool) *TextMessage

SetAt set at

func (*TextMessage) SetContent

func (m *TextMessage) SetContent(content string) *TextMessage

SetContent set content

func (*TextMessage) ToByte

func (m *TextMessage) ToByte() ([]byte, error)

Jump to

Keyboard shortcuts

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