feishuRobotGo

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

README

go-feishu-robot

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenSign

func GenSign(secret string, timestamp int64) (string, error)

GenSign 签名算法,来自于官方文档:https://open.feishu.cn/document/ukTMukTMukTM/ucTM5YjL3ETO24yNxkjN

Types

type Robot

type Robot struct {
	Secret string
	Hook   string
}

func (*Robot) SendPost

func (c *Robot) SendPost(ctx context.Context, content *RobotContent) error

SendPost 发送富文本消息 https://open.feishu.cn/document/ukTMukTMukTM/ucTM5YjL3ETO24yNxkjN#f62e72d5

type RobotContent

type RobotContent struct {
	Post RobotPostContent `json:"post"`
}

type RobotPostContent

type RobotPostContent struct {
	ZhCn RobotPostContentGroup `json:"zh_cn"`
}

type RobotPostContentGroup

type RobotPostContentGroup struct {
	Title   string                           `json:"title"`
	Content [][]RobotPostContentGroupContent `json:"content"`
}

type RobotPostContentGroupContent

type RobotPostContentGroupContent struct {
	Tag string `json:"tag"`

	Text      string `json:"text,omitempty"`
	Unescape  bool   `json:"un_escape,omitempty"`
	Href      string `json:"href,omitempty"`
	UserId    string `json:"user_id,omitempty"`
	UserName  string `json:"user_name,omitempty"`
	ImageKey  string `json:"image_key,omitempty"`
	FileKey   string `json:"file_key,omitempty"`
	EmojiType string `json:"emoji_type,omitempty"`
}

RobotPostContentGroupContent 富文本标签,文档见:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/im-v1/message/create_json#45e0953e

type RobotRequest

type RobotRequest struct {
	Timestamp string        `json:"timestamp"` // "1599360473"
	Sign      string        `json:"sign"`
	MsgType   string        `json:"msg_type"` // "post"
	Content   *RobotContent `json:"content"`
}

type RobotResponse

type RobotResponse struct {
	RobotResponseSuccess
	RobotResponseError
}

type RobotResponseError

type RobotResponseError struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

func (*RobotResponseError) Error

func (r *RobotResponseError) Error() string

type RobotResponseSuccess

type RobotResponseSuccess struct {
	Extra         interface{} `json:"Extra"`
	StatusCode    int         `json:"StatusCode"`
	StatusMessage string      `json:"StatusMessage"`
}

Jump to

Keyboard shortcuts

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