feishu

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type A

type A struct {
	Tag      string `json:"tag"`
	Text     string `json:"text"`
	Href     string `json:"href"`
	UnEscape bool   `json:"un_escape,omitempty"`
}

func NewA

func NewA(text, href string) A

type AT

type AT struct {
	Tag    string `json:"tag"`
	UserID string `json:"user_id"`
}

func NewAT

func NewAT(userID string) AT

type Client

type Client struct {
	AccessToken string
	Secret      string
}

Client feishu client

func NewClient

func NewClient(accessToken, secret string) *Client

NewClient new client

func (*Client) Send

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

Send send message

type Content

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

type Image

type Image struct {
	Tag      string `json:"tag"`
	ImageKey string `json:"image_key"`
	Height   int    `json:"height"`
	Width    int    `json:"width"`
}

func NewImage

func NewImage(imageKey string, height, width int) Image

type ImageContent

type ImageContent struct {
	ImageKey string `json:"image_key"`
}

type ImageMessage

type ImageMessage struct {
	MsgType MsgType      `json:"msg_type"`
	Content ImageContent `json:"content"`
}

func NewImageMessage

func NewImageMessage() *ImageMessage

func (*ImageMessage) Body

func (m *ImageMessage) Body() map[string]interface{}

func (*ImageMessage) SetImageKey

func (m *ImageMessage) SetImageKey(key string) *ImageMessage

type InteractiveMessage

type InteractiveMessage struct {
	MsgType MsgType `json:"msg_type"`
	Card    string  `json:"card"`
}

func NewInteractiveMessage

func NewInteractiveMessage() *InteractiveMessage

func (*InteractiveMessage) Body

func (m *InteractiveMessage) Body() map[string]interface{}

func (*InteractiveMessage) SetCard

func (m *InteractiveMessage) SetCard(card string) *InteractiveMessage

SetCard set card with cardbuilder https://open.feishu.cn/tool/cardbuilder?from=custom_bot_doc

type Message

type Message interface {
	Body() map[string]interface{}
}

Message interface

type MsgType

type MsgType string
const (
	MsgTypeText        MsgType = "text"
	MsgTypePost        MsgType = "post"
	MsgTypeImage       MsgType = "image"
	MsgTypeShareChat   MsgType = "share_chat"
	MsgTypeInteractive MsgType = "interactive"
)

MsgType

type PostBody

type PostBody struct {
	ZH PostUnit `json:"zh_cn,omitempty"`
	JA PostUnit `json:"ja_jp,omitempty"`
	EN PostUnit `json:"en_us,omitempty"`
}

type PostCMDContent

type PostCMDContent struct {
	Post map[string]interface{} `json:"post"`
}

type PostCMDMessage

type PostCMDMessage struct {
	MsgType MsgType        `json:"msg_type"`
	Content PostCMDContent `json:"content"`
}

func NewPostCMDMessage

func NewPostCMDMessage() *PostCMDMessage

func (*PostCMDMessage) Body

func (m *PostCMDMessage) Body() map[string]interface{}

func (*PostCMDMessage) SetPost

func (m *PostCMDMessage) SetPost(post string) *PostCMDMessage

type PostContent

type PostContent struct {
	Post PostBody `json:"post"`
}

type PostItem

type PostItem interface{}

type PostMessage

type PostMessage struct {
	MsgType MsgType     `json:"msg_type"`
	Content PostContent `json:"content"`
}

func NewPostMessage

func NewPostMessage() *PostMessage

func (*PostMessage) AppendENContent

func (m *PostMessage) AppendENContent(i []PostItem) *PostMessage

func (*PostMessage) AppendJAContent

func (m *PostMessage) AppendJAContent(i []PostItem) *PostMessage

func (*PostMessage) AppendZHContent

func (m *PostMessage) AppendZHContent(i []PostItem) *PostMessage

func (*PostMessage) Body

func (m *PostMessage) Body() map[string]interface{}

func (*PostMessage) SetEN

func (m *PostMessage) SetEN(u PostUnit) *PostMessage

func (*PostMessage) SetENTitle

func (m *PostMessage) SetENTitle(t string) *PostMessage

func (*PostMessage) SetJA

func (m *PostMessage) SetJA(u PostUnit) *PostMessage

func (*PostMessage) SetJATitle

func (m *PostMessage) SetJATitle(t string) *PostMessage

func (*PostMessage) SetZH

func (m *PostMessage) SetZH(u PostUnit) *PostMessage

func (*PostMessage) SetZHTitle

func (m *PostMessage) SetZHTitle(t string) *PostMessage

type PostUnit

type PostUnit struct {
	Title   string       `json:"title,omitempty"`
	Content [][]PostItem `json:"content"`
}

type Response

type Response struct {
	Code int64  `json:"code"`
	Msg  string `json:"msg"`
	Data any    `json:"data"`

	Extra         any    `json:"Extra"`
	StatusCode    int64  `json:"StatusCode"`
	StatusMessage string `json:"StatusMessage"`
}

Response response struct

type ShareChatContent

type ShareChatContent struct {
	ShareChatID string `json:"share_chat_id"`
}

type ShareChatMessage

type ShareChatMessage struct {
	MsgType MsgType          `json:"msg_type"`
	Content ShareChatContent `json:"content"`
}

func NewShareChatMessage

func NewShareChatMessage() *ShareChatMessage

func (*ShareChatMessage) Body

func (m *ShareChatMessage) Body() map[string]interface{}

func (*ShareChatMessage) SetShareChatID

func (m *ShareChatMessage) SetShareChatID(ID string) *ShareChatMessage

type Text

type Text struct {
	Tag      string `json:"tag"`
	Text     string `json:"text"`
	UnEscape bool   `json:"un_escape,omitempty"`
}

func NewText

func NewText(text string) Text

type TextMessage

type TextMessage struct {
	MsgType MsgType `json:"msg_type"`
	Content Content `json:"content"`
}

func NewTextMessage

func NewTextMessage() *TextMessage

func (*TextMessage) Body

func (m *TextMessage) Body() map[string]interface{}

func (*TextMessage) SetText

func (m *TextMessage) SetText(text string) *TextMessage

Jump to

Keyboard shortcuts

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