dingtalk

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	//VERSION is SDK version
	VERSION = "0.1"

	//ROOT is the root url
	ROOT = "https://oapi.dingtalk.com/"
)
View Source
const (
	MsgTypeTmpl = `{"msgtype":"%s",%s}`
)

Variables

This section is empty.

Functions

func Format

func Format(msg MessageType) string

func RobotSendMarkDownMessage

func RobotSendMarkDownMessage(token, title, content string, at *At) error

func RobotSendMarkDownMessageWithSecret

func RobotSendMarkDownMessageWithSecret(token, secret, title, content string, at *At) error

func RobotSendMessage

func RobotSendMessage(accessToken, secret string, msg MessageType) error

func RobotSendTextMessage

func RobotSendTextMessage(accessToken string, content string) error

RobotSendTextMessage can send a text message to a group chat

func RobotSendTextMessageWithSecret

func RobotSendTextMessageWithSecret(accessToken, secret, content string) error

func RobotUrl

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

func TextMessage

func TextMessage(text string) string

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"`
}

func (*ActionCard) MessageType

func (*ActionCard) MessageType() MsgType

type At

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

type FeedCard

type FeedCard struct {
	Links []struct {
		Title      string `json:"title"`
		MessageURL string `json:"messageURL"`
		PicURL     string `json:"picURL"`
	} `json:"links"`
}

func (*FeedCard) MessageType

func (*FeedCard) MessageType() MsgType
type Link struct {
	Text       string `json:"text"`
	Title      string `json:"title"`
	PicUrl     string `json:"picUrl"`
	MessageUrl string `json:"messageUrl"`
}

func (*Link) MessageType

func (*Link) MessageType() MsgType

type Markdown

type Markdown struct {
	Title string `json:"title"`
	Text  string `json:"text"`
	At    *At    `json:"at,omitempty"`
}

func (*Markdown) MessageType

func (*Markdown) MessageType() MsgType

type MessageType

type MessageType interface {
	MessageType() MsgType
}

type MsgType

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

func (MsgType) String

func (c MsgType) String() string

type Robot

type Robot struct {
	AccessToken string
	Secret      string
}

func (*Robot) SendMessage

func (r *Robot) SendMessage(msg MessageType) error

type RobotConfig

type RobotConfig struct {
	Token  string
	Secret string
}

type Text

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

func (Text) MessageType

func (Text) MessageType() MsgType

Jump to

Keyboard shortcuts

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