dingtalk

package
v0.0.0-...-bd9fdc3 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionCard

type ActionCard struct {
	Title          string `json:"title"`
	Text           string `json:"text"`
	SingleTitle    string `json:"singleTitle"`
	SingleURL      string `json:"singleURL"`
	Btns           []Btn  `json:"btns"`
	BtnOrientation string `json:"btnOrientation"`
	HideAvatar     string `json:"hideAvatar"`
}

ActionCard actionCard struct

type ActionCardMessage

type ActionCardMessage struct {
	MsgType    MsgType    `json:"msgtype"`
	ActionCard ActionCard `json:"actionCard"`
}

ActionCardMessage struct

func NewActionCardMessage

func NewActionCardMessage() *ActionCardMessage

NewActionCardMessage new message

func (*ActionCardMessage) SetIndependentJump

func (m *ActionCardMessage) SetIndependentJump(
	title string,
	text string,
	btns []Btn,
	btnOrientation string,
	hideAvatar string) *ActionCardMessage

SetIndependentJump set independent jump actionCard

func (*ActionCardMessage) SetOverallJump

func (m *ActionCardMessage) SetOverallJump(
	title string,
	text string,
	singleTitle string,
	singleURL string,
	btnOrientation string,
	hideAvatar string) *ActionCardMessage

SetOverallJump set overall jump actionCard

func (*ActionCardMessage) ToByte

func (m *ActionCardMessage) ToByte() ([]byte, error)

ToByte to byte

type At

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

At at struct

type Btn

type Btn struct {
	Title     string `json:"title"`
	ActionURL string `json:"actionURL"`
}

Btn struct

type Client

type Client struct {
	AccessToken string
	Secret      string
}

Client dingtalk client

func NewClient

func NewClient(accessToken, secret string) *Client

NewClient new dingtalk client

func (*Client) Send

func (d *Client) Send(message Message) (string, *Response, error)

Send message

type FeedCard

type FeedCard struct {
	Links []FeedCardLink `json:"links"`
}

FeedCard feedCard struct

type FeedCardLink struct {
	Title      string `json:"title"`
	PicURL     string `json:"picURL"`
	MessageURL string `json:"messageURL"`
}

FeedCardLink struct

type FeedCardMessage

type FeedCardMessage struct {
	MsgType  MsgType  `json:"msgtype"`
	FeedCard FeedCard `json:"feedCard"`
}

FeedCardMessage feed message struct

func NewFeedCardMessage

func NewFeedCardMessage() *FeedCardMessage

NewFeedCardMessage new message

func (m *FeedCardMessage) AppendLink(
	title string,
	messageURL string,
	picURL string) *FeedCardMessage

AppendLink append link

func (*FeedCardMessage) ToByte

func (m *FeedCardMessage) ToByte() ([]byte, error)

ToByte to byte

type Link struct {
	Title      string `json:"title"`
	Text       string `json:"text"`
	PicURL     string `json:"picUrl"`
	MessageURL string `json:"messageUrl"`
}

Link link struct

type LinkMessage

type LinkMessage struct {
	MsgType MsgType `json:"msgtype"`
	Link    Link    `json:"link"`
}

LinkMessage link message struct

func NewLinkMessage

func NewLinkMessage() *LinkMessage

NewLinkMessage new message

func (m *LinkMessage) SetLink(
	title string,
	text string,
	picURL string,
	messageURL string) *LinkMessage

SetLink set link

func (*LinkMessage) ToByte

func (m *LinkMessage) ToByte() ([]byte, error)

ToByte to byte

type Markdown

type Markdown struct {
	Title string `json:"title"`
	Text  string `json:"text"`
}

Markdown markdown struct

type MarkdownMessage

type MarkdownMessage struct {
	MsgType  MsgType  `json:"msgtype"`
	Markdown Markdown `json:"markdown"`
	At       At       `json:"at"`
}

MarkdownMessage markdown message struct

func NewMarkdownMessage

func NewMarkdownMessage() *MarkdownMessage

NewMarkdownMessage new message

func (*MarkdownMessage) SetAt

func (m *MarkdownMessage) SetAt(atMobiles []string, isAtAll bool) *MarkdownMessage

SetAt set at

func (*MarkdownMessage) SetMarkdown

func (m *MarkdownMessage) SetMarkdown(title string, text string) *MarkdownMessage

SetMarkdown set markdown

func (*MarkdownMessage) ToByte

func (m *MarkdownMessage) ToByte() ([]byte, error)

ToByte to byte

type Message

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

Message interface

type MsgType

type MsgType string

MsgType message type enum

const (
	// MsgTypeText text
	MsgTypeText MsgType = "text"
	// MsgTypeMarkdown markdown
	MsgTypeMarkdown MsgType = "markdown"
	// MsgTypeLink link
	MsgTypeLink MsgType = "link"
	// MsgTypeActionCard actionCard
	MsgTypeActionCard MsgType = "actionCard"
	// MsgTypeFeedCard feedCard
	MsgTypeFeedCard MsgType = "feedCard"
)

type Response

type Response struct {
	ErrMsg  string `json:"errmsg"`
	ErrCode int64  `json:"errcode"`
}

Response response struct

type Text

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

Text text struct

type TextMessage

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

TextMessage text message struct

func NewTextMessage

func NewTextMessage() *TextMessage

NewTextMessage new message

func (*TextMessage) SetAt

func (m *TextMessage) SetAt(atMobiles []string, isAtAll bool) *TextMessage

SetAt set at

func (*TextMessage) SetContent

func (m *TextMessage) SetContent(content string) *TextMessage

SetContent set content

func (*TextMessage) ToByte

func (m *TextMessage) ToByte() ([]byte, error)

ToByte to byte

Jump to

Keyboard shortcuts

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