feishu

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Package feishu @Author arthur 09:51:00

Package feishu @Author arthur 09:47:00

Package feishu @Author arthur 09:49:00

Index

Constants

View Source
const (
	WARNING = "red"
	PASS    = "green"
)

Variables

This section is empty.

Functions

func GenSign

func GenSign(secret, timestamp string) string

GenSign 生成消息摘要 generates message digest

func SendMsg

func SendMsg(webhook string, v interface{}) (response interface{}, isErrResponse bool, err error)

Types

type Actions

type Actions struct {
	Actions []ActionsItem `json:"actions"`
}

type ActionsItem

type ActionsItem struct {
	Tag  string `json:"tag"`
	Text struct {
		Content string `json:"content"`
		Tag     string `json:"tag"`
	} `json:"text"`
	URL   string `json:"url"`
	Type  string `json:"type"`
	Value struct {
	} `json:"value"`
}

type Body

type Body struct {
	Content string `json:"content,omitempty"`
	Tag     string `json:"tag,omitempty"`
}

type Card

type Card struct {
	Config   Config    `json:"config,omitempty"`
	Elements []Element `json:"elements,omitempty"`
	Header   Header    `json:"header,omitempty"`
}

type CardMsg

type CardMsg struct {
	*Sign
	MsgType string `json:"msg_type,omitempty"`
	Card    Card   `json:"card,omitempty"`
}

func NewCardMsg

func NewCardMsg(title, template string) *CardMsg

func NewCardMsgWithSign

func NewCardMsgWithSign(secret, template, title string) *CardMsg

func (*CardMsg) AddAtAll

func (c *CardMsg) AddAtAll()

AddAtAll 增加一个@全体的功能 Add an @All function

func (*CardMsg) AddElement

func (c *CardMsg) AddElement(content string)

AddElement 添加一个内容,内容的格式为markdown形式 Add a content in markdown format

func (*CardMsg) AddUrl

func (c *CardMsg) AddUrl(url string)

AddUrl 增加一个url的内容 Add the content of url

type Config

type Config struct {
	WideScreenMode bool `json:"wide_screen_mode,omitempty"`
	EnableForward  bool `json:"enable_forward,omitempty"`
}

type Element

type Element struct {
	Tag   string `json:"tag,omitempty"`
	*Body `json:"text"`
	*Actions
}

type ErrResponse

type ErrResponse struct {
	Code int    `json:"code,omitempty"`
	Msg  string `json:"msg,omitempty"`
}

ErrResponse 返回的错误信息 error message returned

type Header struct {
	Title    Body   `json:"title,omitempty"`
	Template string `json:"template"`
}

type Response

type Response struct {
	Extra         json.RawMessage
	StatusCode    int
	StatusMessage string
}

Response 成功发送之后的消息 Message after successfully sent

type Sign

type Sign struct {
	Timestamp string `json:"timestamp,omitempty"`
	Sign      string `json:"sign,omitempty"`
}

Sign 签名

func NewSign

func NewSign(secret string) *Sign

NewSign 创建一个新的签名 Create a new signature

Jump to

Keyboard shortcuts

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