lark

package
v0.0.0-...-5db72db Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const CustomBotHost = "https://open.feishu.cn/open-apis"

Variables

View Source
var (
	LarkClient = NewHttpClient(maxConnsPerhost, defaultTimeout)
)

Functions

This section is empty.

Types

type BotResponse

type BotResponse struct {
	Code    int    `json:"code"`
	Message string `json:"msg"`
}

type Card

type Card struct {
	Config   CardConfig     `json:"config"`
	Elements []*CardElement `json:"elements"`
	Header   CardHeader     `json:"header"`
}

type CardConfig

type CardConfig struct {
	WideScreenMode bool `json:"wide_screen_mode"`
	EnableForward  bool `json:"enable_forward"`
}

type CardElement

type CardElement struct {
	Tag    string            `json:"tag"`
	Text   CardElementText   `json:"text"`
	Action CardElementAction `json:"actions"`
}

type CardElementAction

type CardElementAction struct {
	Tag  string          `json:"tag"`
	Text CardElementText `json:"text"`
	Url  string          `json:"url"`
	Type string          `json:"type"`
}

type CardElementText

type CardElementText struct {
	Content string `json:"content"`
	Tag     string `json:"tag"`
}

type CardHeader

type CardHeader struct {
	Title CardElementText `json:"title"`
}

type CardMessage

type CardMessage struct {
	MessageType string `json:"msg_type"`
	Card        Card   `json:"card"`
}

CardMessage 卡片消息

type Client

type Client struct {
	HttpClient *fasthttp.Client
}

func NewHttpClient

func NewHttpClient(maxConns, defaultTimeout int) *Client

func (*Client) BotHook

func (c *Client) BotHook(ctx context.Context, hookId string, text *TextMessage, post *PostMessage, card *CardMessage) (*BotResponse, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, url string, queryParams urllib.Values, timeout time.Duration) (*fasthttp.Response, error)

func (*Client) Post

func (c *Client) Post(ctx context.Context, url string, body []byte, timeout time.Duration) (*fasthttp.Response, error)

type PostContent

type PostContent struct {
	Post *ZhCnPostContentData `json:"post"`
}

type PostContentData

type PostContentData struct {
	Title   string               `json:"title"`
	Content [][]*PostContentItem `json:"content"`
}

type PostContentItem

type PostContentItem struct {
	Tag  string `json:"tag"`
	Text string `json:"text"`
	Href string `json:"href,omitempty"`
}

type PostMessage

type PostMessage struct {
	MessageType string       `json:"msg_type"`
	Content     *PostContent `json:"content"`
}

PostMessage 富文本消息

type TextContent

type TextContent struct {
	Text string `json:"text"`
}

type TextMessage

type TextMessage struct {
	MessageType string       `json:"msg_type"`
	Content     *TextContent `json:"content"`
}

TextMessage 文本消息

type ZhCnPostContentData

type ZhCnPostContentData struct {
	ZhCn PostContentData `json:"zh_cn"`
}

Jump to

Keyboard shortcuts

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