ding

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TEXT        msgTypeType = "text"
	LINK        msgTypeType = "link"
	MARKDOWN    msgTypeType = "markdown"
	ACTION_CARD msgTypeType = "actionCard"
	FEED_CARD   msgTypeType = "feedCard"
)

Variables

This section is empty.

Functions

func AddBlue

func AddBlue(text string) string

func AddGold

func AddGold(text string) string

func AddGreen

func AddGreen(text string) string

func AddH1

func AddH1(text string) string

func AddH2

func AddH2(text string) string

func AddH3

func AddH3(text string) string

func AddH4

func AddH4(text string) string

func AddH5

func AddH5(text string) string

func AddH6

func AddH6(text string) string

func AddRed

func AddRed(text string) string

func DingMap

func DingMap() *dingMap

func NewActionCardMsg

func NewActionCardMsg(title, text string, opts ...ActionCardOption) *actionCardMsg

func NewDTMDMsg

func NewDTMDMsg(title string, dtmdMap *dingMap, opts ...AtOption) *markDownMsg

func NewFeedCardMsg

func NewFeedCardMsg(feedCard []FeedCardLinkModel) *feedCardMsg

func NewLinkMsg

func NewLinkMsg(title, text, picUrl, msgUrl string) *linkMsg

func NewMarkDownMsg

func NewMarkDownMsg(title string, text interface{}, opts ...AtOption) *markDownMsg

func NewTextMsg

func NewTextMsg(content string, opts ...AtOption) *textMsg

Types

type ActionCardMultiBtnModel

type ActionCardMultiBtnModel struct {
	Title     string `json:"title,omitempty"`
	ActionURL string `json:"actionURL,omitempty"`
}

type ActionCardOption

type ActionCardOption interface {
	// contains filtered or unexported methods
}

func WithCardBtnVertical

func WithCardBtnVertical() ActionCardOption

func WithCardBtns

func WithCardBtns(btns []ActionCardMultiBtnModel) ActionCardOption

func WithCardSingleTitle

func WithCardSingleTitle(title string) ActionCardOption

func WithCardSingleURL

func WithCardSingleURL(url string) ActionCardOption

type AtOption

type AtOption interface {
	// contains filtered or unexported methods
}

func WithAtAll

func WithAtAll() AtOption

func WithAtMobiles

func WithAtMobiles(mobiles []string) AtOption

type DingTalk

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

func InitDingTalk

func InitDingTalk(token string) *DingTalk

func InitDingTalkWithSecret

func InitDingTalkWithSecret(token string, secret string) *DingTalk

func (*DingTalk) OutGoing

func (d *DingTalk) OutGoing(r io.Reader) (outGoingMsg OutGoingModel, err error)

func (*DingTalk) SendActionCardMessage

func (d *DingTalk) SendActionCardMessage(title, text string, opts ...ActionCardOption) error

func (*DingTalk) SendActionCardMessageBySlice

func (d *DingTalk) SendActionCardMessageBySlice(title string, textList []string, opts ...ActionCardOption) error

func (*DingTalk) SendDTMDMessage

func (d *DingTalk) SendDTMDMessage(title string, dtmdMap *dingMap, opt ...AtOption) error

利用dtmd发送点击消息

func (*DingTalk) SendFeedCardMessage

func (d *DingTalk) SendFeedCardMessage(feedCard []FeedCardLinkModel) error

func (*DingTalk) SendLinkMessage

func (d *DingTalk) SendLinkMessage(title, text, picUrl, msgUrl string) error

func (*DingTalk) SendMarkDownMessage

func (d *DingTalk) SendMarkDownMessage(title string, text Format, opts ...AtOption) error

func (DingTalk) SendMarkDownMessageBySlice

func (d DingTalk) SendMarkDownMessageBySlice(title string, textList []string, opts ...AtOption) error

func (*DingTalk) SendTextMessage

func (d *DingTalk) SendTextMessage(content string, opt ...AtOption) error

type FeedCardLinkModel

type FeedCardLinkModel struct {
	Title      string `json:"title,omitempty"`
	MessageURL string `json:"messageURL,omitempty"`
	PicURL     string `json:"picURL,omitempty"`
}

type Format

type Format interface {
	//添加一行
	AddText(text string, color ...interface{})
	//添加图片
	AddImage(url string)
	//一次性加多个图片
	AddImages(urls []string)
	//获取处理好的数据格式
	GetContext() string
	//以key:value的数据格式
	AddKeyValue(title string, value interface{})
	//链接
	AddTextUrl(text string, hrefs map[string]string)
}

func NewConText

func NewConText() Format

type MarkType

type MarkType string
const (
	H1    MarkType = "h1"
	H2    MarkType = "h2"
	H3    MarkType = "h3"
	H4    MarkType = "h4"
	H5    MarkType = "h5"
	H6    MarkType = "h6"
	RED   MarkType = "red"
	BLUE  MarkType = "blue"
	GREEN MarkType = "green"
	GOLD  MarkType = "gold"
	N     MarkType = ""
)

type OutGoingModel

type OutGoingModel struct {
	AtUsers []struct {
		DingtalkID string `json:"dingtalkId"`
	} `json:"atUsers"`
	ChatbotUserID             string `json:"chatbotUserId"`
	ConversationID            string `json:"conversationId"`
	ConversationTitle         string `json:"conversationTitle"`
	ConversationType          string `json:"conversationType"`
	CreateAt                  int64  `json:"createAt"`
	IsAdmin                   bool   `json:"isAdmin"`
	IsInAtList                bool   `json:"isInAtList"`
	MsgID                     string `json:"msgId"`
	Msgtype                   string `json:"msgtype"`
	SceneGroupCode            string `json:"sceneGroupCode"`
	SenderID                  string `json:"senderId"`
	SenderNick                string `json:"senderNick"`
	SessionWebhook            string `json:"sessionWebhook"`
	SessionWebhookExpiredTime int64  `json:"sessionWebhookExpiredTime"`
	Text                      struct {
		Content string `json:"content"`
	} `json:"text"`
}

Jump to

Keyboard shortcuts

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