dingding

package
v0.0.0-...-c229084 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractAtSomeones

func ExtractAtSomeones(body string) []string

Types

type Dingding

type Dingding struct {
	Endpoint string
	Token    string
	Secret   string
}

func NewDingding

func NewDingding(token string, secret string) *Dingding

func (*Dingding) Send

func (ding *Dingding) Send(msg Message) error

type DingdingMessage

type DingdingMessage struct {
	Message MarkdownMessage `json:"message"`
	Token   string          `json:"token"`
}

DingdingMessage is a message holds all informations for a dingding sender

func (*DingdingMessage) Decode

func (dm *DingdingMessage) Decode(data []byte) error

func (*DingdingMessage) Encode

func (dm *DingdingMessage) Encode() []byte

type MarkdownMessage

type MarkdownMessage struct {
	Type     string              `json:"msgtype,omitempty"`
	Markdown MarkdownMessageBody `json:"markdown,omitempty"`
	At       MessageAtSomebody   `json:"at,omitempty"`
}

MarkdownMessage is a markdown message for dingding

func NewMarkdownMessage

func NewMarkdownMessage(title string, body string, mobiles []string) MarkdownMessage

NewMarkdownMessage create a new MarkdownMessage

func (MarkdownMessage) Encode

func (m MarkdownMessage) Encode() ([]byte, error)

Encode encode markdown message to json bytes

type MarkdownMessageBody

type MarkdownMessageBody struct {
	Title      string `json:"title,omitempty"`
	Text       string `json:"text,omitempty"`
	MessageURL string `json:"messageUrl,omitempty"`
}

MarkdownMessageBody is markdown body

type Message

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

type MessageAtSomebody

type MessageAtSomebody struct {
	Mobiles []string `json:"atMobiles"`
	ToAll   bool     `json:"isAtAll"`
}

MessageAtSomebody @ someone

Jump to

Keyboard shortcuts

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