dingding

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgTypeTextTmpl       = `{"msgtype":"text","text":{"content":"%s"}}`
	MsgTypeMarkdownTmpl   = `{"msgtype":"markdown","markdown":{"title":"%s","text":"%s"}}`
	MsgTypeMarkdownAtTmpl = `{"msgtype":"markdown","markdown":{"title":"%s","text":"%s"},"at":{"isAtAll": false, "atMobiles":[]}}`
)
View Source
const (
	//VERSION is SDK version
	VERSION = "0.1"

	//ROOT is the root url
	ROOT = "https://oapi.dingtalk.com/"
)

Variables

This section is empty.

Functions

func RobotUrl

func RobotUrl(accessToken, secret string) (string, error)

func SendRobotMarkDownMessage

func SendRobotMarkDownMessage(token, title, content string) error

func SendRobotMarkDownMessageWithSecret

func SendRobotMarkDownMessageWithSecret(token, secret, title, content string) error

func SendRobotMessage

func SendRobotMessage(accessToken, secret, title, content string, MsgType MsgType) error

func SendRobotTextMessage

func SendRobotTextMessage(accessToken string, content string) error

SendRobotTextMessage can send a text message to a group chat

func SendRobotTextMessageWithSecret

func SendRobotTextMessageWithSecret(accessToken, secret, content string) error

Types

type ActionCard

type ActionCard struct {
	Title          string `json:"title"`
	Text           string `json:"text"`
	BtnOrientation string `json:"btnOrientation"`
	SingleTitle    string `json:"singleTitle"`
	SingleURL      string `json:"singleURL"`
}

type At

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

type DingMsg

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

type DingRobotConfig

type DingRobotConfig struct {
	Token  string
	Secret string
}

type FeedCard

type FeedCard struct {
	Links []struct {
		Title      string `json:"title"`
		MessageURL string `json:"messageURL"`
		PicURL     string `json:"picURL"`
	} `json:"links"`
}
type Link struct {
	Text       string `json:"text"`
	Title      string `json:"title"`
	PicUrl     string `json:"picUrl"`
	MessageUrl string `json:"messageUrl"`
}

type MsgType

type MsgType int
const (
	MsgTypeText MsgType = iota
	MsgTypeMarkdown
	MsgTypeLink
	MsgTypeActionCard
	MsgTypeFeedCard
)

func (MsgType) Body

func (c MsgType) Body(title, content string) string

func (MsgType) String

func (c MsgType) String() string

func (MsgType) Tmpl

func (c MsgType) Tmpl() string

type Text

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

Jump to

Keyboard shortcuts

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