message

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

View Source
const ReplyAPI = "/open-apis/im/v1/messages/:message_id/reply"
View Source
const SendAPI = "/open-apis/im/v1/messages"

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message interface {
	Send(cfg *SendRequest) (resp *SendResponse, err error)
	SendByEmail(cfg *SendByEmailRequest) (resp *SendByEmailResponse, err error)
	SendByMobile(cfg *SendByMobileRequest) (resp *SendByMobileResponse, err error)
}

func New

func New(c client.Client) Message

type MessageEntity

type MessageEntity struct {
	// 消息 ID
	MessageID string `json:"message_id"`

	// 根消息 ID
	RootID string `json:"root_id"`

	// 父消息 ID
	ParentID string `json:"parent_id"`

	// 消息类型 包括:text、post、image、file、audio、media、sticker、interactive、share_chat、share_user等
	MsgType string `json:"msg_type"`

	// 消息生成的时间戳(毫秒)
	CreateTime string `json:"create_time"`

	// 消息更新的时间戳(毫秒)
	UpdateTime string `json:"update_time"`

	// 消息是否被撤回
	Deleted bool `json:"deleted"`

	// 消息是否被更新
	Updated bool `json:"updated"`

	// 所属的群
	ChatID string `json:"chat_id"`

	// 消息发送者
	Sender MessageEntitySender `json:"sender"`

	// 消息内容
	Body MessageEntityBody `json:"body"`

	// 被@的用户或机器人的id列表
	Mentions []MessageEntityMention `json:"mentions"`

	// 合并转发消息中,上一层级的消息id message_id
	UpperMessageID string `json:"upper_message_id"`
}

type MessageEntityBody

type MessageEntityBody struct {
	// 消息内容,json结构序列化后的字符串。不同msg_type对应不同内容。消息类型 包括:text、post、image、file、audio、media、sticker、interactive、share_chat、share_user等
	Content interface{} `json:"content"`
}

type MessageEntityMention

type MessageEntityMention struct {
	// 被@的用户或机器人的序号。例如,第3个被@到的成员,值为“@_user_3”
	Key string `json:"key"`

	// 被@的用户或者机器人的open_id
	ID string `json:"id"`

	// 该字段标识发送者的id类型
	IDType string `json:"id_type"`

	// 被@的用户或机器人的姓名
	Name string `json:"name"`

	// 为租户在飞书上的唯一标识,用来换取对应的tenant_access_token,也可以用作租户在应用里面的唯一标识
	TenantKey string `json:"tenant_key"`
}

type MessageEntitySender

type MessageEntitySender struct {
	// 该字段标识发送者的id
	ID string `json:"id"`

	// 该字段标识发送者的id类型
	IDType string `json:"id_type"`

	// 该字段标识发送者的类型
	SenderType string `json:"sender_type"`

	// 为租户在飞书上的唯一标识,用来换取对应的tenant_access_token,也可以用作租户在应用里面的唯一标识
	TenantID string `json:"tenant_id"`
}

type ReplyRequest

type ReplyRequest struct {
	// 待回复的消息的ID
	// 示例值:"om_dc13264520392913993dd051dba21dcf"
	MessageID string `json:"message_id"`

	// 消息内容,json结构序列化后的字符串。不同msg_type对应不同内容。消息类型 包括:text、post、image、file、audio、media、sticker、interactive、share_chat、share_user等
	// 具体格式说明参考:发送消息content说明(https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/im-v1/message/create_json
	Content string `json:"content"`

	// 消息类型 包括:text、post、image、file、audio、media、sticker、interactive、share_chat、share_user等
	// 类型定义请参考发送消息content说明(https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/im-v1/message/create_json
	// 示例值:"text"
	MsgType string `json:"msg_type"`
}

type ReplyResponse

type ReplyResponse struct {
	MessageEntity
}

func Reply

func Reply(client client.Client, cfg *ReplyRequest) (resp *ReplyResponse, err error)

type SendByEmailRequest

type SendByEmailRequest struct {
	// User Email
	Email string `json:"email"`

	// 消息类型 包括:text、post、image、file、audio、media、sticker、interactive、share_chat、share_user等
	// 类型定义请参考发送消息content说明(https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/im-v1/message/create_json
	// 示例值:"text"
	MsgType string `json:"msg_type"`

	// 消息内容,json结构序列化后的字符串。不同msg_type对应不同内容。消息类型 包括:text、post、image、file、audio、media、sticker、interactive、share_chat、share_user等
	// 具体格式说明参考:发送消息content说明(https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/im-v1/message/create_json
	Content string `json:"content"`
}

type SendByEmailResponse

type SendByEmailResponse = SendResponse

func SendByEmail

func SendByEmail(client client.Client, cfg *SendByEmailRequest) (*SendByEmailResponse, error)

type SendByMobileRequest

type SendByMobileRequest struct {
	// User Mobile
	Mobile string `json:"mobile"`

	// 消息类型 包括:text、post、image、file、audio、media、sticker、interactive、share_chat、share_user等
	// 类型定义请参考发送消息content说明(https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/im-v1/message/create_json
	// 示例值:"text"
	MsgType string `json:"msg_type"`

	// 消息内容,json结构序列化后的字符串。不同msg_type对应不同内容。消息类型 包括:text、post、image、file、audio、media、sticker、interactive、share_chat、share_user等
	// 具体格式说明参考:发送消息content说明(https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/im-v1/message/create_json
	Content string `json:"content"`
}

type SendByMobileResponse

type SendByMobileResponse = SendResponse

func SendByMobile

func SendByMobile(client client.Client, cfg *SendByMobileRequest) (*SendByMobileResponse, error)

type SendRequest

type SendRequest struct {
	// 依据receive_id_type的值,填写对应的消息接收者id
	// 示例值:"ou_7d8a6e6df7621556ce0d21922b676706ccs"
	ReceiveID string `json:"receive_id"`

	// 消息内容,json结构序列化后的字符串。不同msg_type对应不同内容。消息类型 包括:text、post、image、file、audio、media、sticker、interactive、share_chat、share_user等
	// 具体格式说明参考:发送消息content说明(https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/im-v1/message/create_json
	Content string `json:"content"`

	// 消息类型 包括:text、post、image、file、audio、media、sticker、interactive、share_chat、share_user等
	// 类型定义请参考发送消息content说明(https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/im-v1/message/create_json
	// 示例值:"text"
	MsgType string `json:"msg_type"`

	// 消息接收者id类型 open_id/user_id/union_id/email/chat_id
	// 示例值:"open_id"
	ReceiveIDType string `json:"receive_id_type"`
}

type SendResponse

type SendResponse struct {
	MessageEntity
}

func Send

func Send(client client.Client, cfg *SendRequest) (resp *SendResponse, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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