dingtalk

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const MsgTypeLink = "link"
View Source
const MsgTypeMarkdown = "markdown"
View Source
const MsgTypeText = "text"

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatRobot

type ChatRobot struct {
	//钉钉发送地址 格式如:https://oapi.dingtalk.com/robot/send?access_token=1122344
	Url string
	//地址密钥 安全设置中加签 加签
	Secret string
}

func NewDingDingTalkRobot

func NewDingDingTalkRobot(url string, secret string) (*ChatRobot, error)

func (*ChatRobot) Send

func (d *ChatRobot) Send(msg interface{}) (ResponseResult, error)

Send 发送ding talk。msg类型必须为TextMsg或者LinkMsg或者MarkdownMsg

type LinkMsg

type LinkMsg struct {
	MsgType string `json:"msgtype"`
	Link    struct {
		Text       string `json:"text"`
		Title      string `json:"title"`
		PicUrl     string `json:"picUrl"`
		MessageUrl string `json:"messageUrl"`
	} `json:"link"`
}

LinkMsg link类型

func NewLinkMsg

func NewLinkMsg() LinkMsg

type MarkdownMsg

type MarkdownMsg struct {
	MsgType  string `json:"msgtype"`
	Markdown struct {
		Title string `json:"title"`
		Text  string `json:"text"`
	} `json:"markdown"`
	At struct {
		AtMobiles []string `json:"atMobiles"`
		AtUserIds []string `json:"atUserIds"`
		IsAtAll   bool     `json:"isAtAll"`
	} `json:"at"`
}

MarkdownMsg markdown类型

func NewMarkdownMsg

func NewMarkdownMsg() MarkdownMsg

type ResponseResult

type ResponseResult struct {
	ErrCode int    `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
}

ResponseResult 返回结果

type TextMsg

type TextMsg struct {
	MsgType string `json:"msgtype"`
	Text    struct {
		Content string `json:"content"`
	} `json:"text"`
	At struct {
		AtMobiles []string `json:"atMobiles"`
		AtUserIds []string `json:"atUserIds"`
		IsAtAll   bool     `json:"isAtAll"`
	} `json:"at"`
}

TextMsg 类型文档类型

func NewTextMsg

func NewTextMsg() TextMsg

Jump to

Keyboard shortcuts

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