bytedance

package
v0.0.0-...-9e28022 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FeiShuAppPostMessageText  = "text"
	FeiShuAppPostMessageHref  = "a"
	FeiShuAppPostMessageAt    = "at"
	FeiShuAppPostMessageImage = "img"
)
View Source
const (
	FeiShuAppMessageTypeText  = "text"
	FeiShuAppMessageTypeImage = "image"
	FeiShuAppMessageTypePost  = "post"
)
View Source
const (
	FeiShuAppI18nChinese  = "zh_cn"
	FeiShuAppI18nJapanese = "ja_jp"
	FeiShuAppI18nEnglish  = "en_us"
)
View Source
const FeiShuAppCreateGroupAPI = "https://open.feishu.cn/open-apis/chat/v4/create/"

FeiShuAppCreateGroupAPI is the api to create group

View Source
const FeiShuAppSendMessageAPI = "https://open.feishu.cn/open-apis/message/v4/send/"

FeiShuAppSendMessageAPI is the api to send message to user or group

View Source
const FeiShuAppStatusOK = 0

FeiShuAppStatusOK is the ok status of api call

View Source
const FeiShuAppTenantAccessTokenAPI = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal/"

FeiShuAppTenantAccessTokenAPI is the api to get access token

View Source
const FeiShuAppTimeout = time.Second * 10

FeiShuAppTimeout is the default timeout to api call

View Source
const FeiShuRobotMessageAPI = "https://www.feishu.cn/flow/api/trigger-webhook/"

FeiShuRobotMessageAPI is the api to send the shortcut messages

View Source
const FeiShuRobotStatusOK = 0
View Source
const FeiShuRobotTimeout = time.Second * 10

FeiShuRobotTimeout is the feishu shortcut default timeout

View Source
const FeishuCodeAccessTokenExpired = 99991663

See doc https://open.feishu.cn/document/ukTMukTMukTM/ugjM14COyUjL4ITN

Variables

This section is empty.

Functions

This section is empty.

Types

type FeiShuApp

type FeiShuApp struct {
	// contains filtered or unexported fields
}

func NewFeiShuApp

func NewFeiShuApp(appID, appSecret string) *FeiShuApp

NewFeiShuApp create a new feishu app

func NewFeiShuAppWithClient

func NewFeiShuAppWithClient(appID, appSecret string, client *http.Client) *FeiShuApp

NewFeiShuAppWithClient create a new feishu app with http.Client

func NewFeiShuAppWithTimeout

func NewFeiShuAppWithTimeout(appID, appSecret string, timeout time.Duration) *FeiShuApp

NewFeiShuAppWithTimeout create a new feishu app with timeout

func (*FeiShuApp) CreateGroupChat

func (r *FeiShuApp) CreateGroupChat(name, description string, userIDList []string, options *FeiShuAppCreateGroupOptions) (newChatID string, err error)

func (*FeiShuApp) IsAccessTokenExpired

func (r *FeiShuApp) IsAccessTokenExpired() bool

func (*FeiShuApp) SendImageMessage

func (r *FeiShuApp) SendImageMessage(target *FeiShuAppMessageSendTarget, imageKey string, options map[string]string) (messageResp FeiShuAppMessageSendResp, err error)

func (*FeiShuApp) SendPostMessage

func (r *FeiShuApp) SendPostMessage(target *FeiShuAppMessageSendTarget, title, i18nKey string, messageLines [][]FeishuAppPostMessageContentItem,
	options map[string]string) (messageResp FeiShuAppMessageSendResp, err error)

func (*FeiShuApp) SendTextMessage

func (r *FeiShuApp) SendTextMessage(target *FeiShuAppMessageSendTarget, content string, options map[string]string) (messageResp FeiShuAppMessageSendResp, err error)

See doc https://open.feishu.cn/document/ukTMukTMukTM/uUjNz4SN2MjL1YzM options only support root_id now if you want to replay a specified message

type FeiShuAppCreateGroupOptions

type FeiShuAppCreateGroupOptions struct {
	OpenIDs        []string          `json:"open_ids"`
	I18nNames      map[string]string `json:"i18n_names"`
	OnlyOwnerAdd   bool              `json:"only_owner_add"`
	OnlyOwnerAtAll bool              `json:"only_owner_at_all"`
	OnlyOwnerEdit  bool              `json:"only_owner_edit"`
	ShareAllowed   bool              `json:"share_allowed"`
}

type FeiShuAppCreateGroupResp

type FeiShuAppCreateGroupResp struct {
	Code    int                          `json:"code"`
	Message string                       `json:"msg"`
	Data    FeiShuAppCreateGroupRespData `json:"data"`
}

type FeiShuAppCreateGroupRespData

type FeiShuAppCreateGroupRespData struct {
	ChatID         string   `json:"chat_id"`
	InvalidOpenIDs []string `json:"invalid_open_ids"`
	InvalidUserIDs []string `json:"invalid_user_ids"`
}

type FeiShuAppGetTokenResp

type FeiShuAppGetTokenResp struct {
	Code              int    `json:"code"`
	Message           string `json:"msg"`
	TenantAccessToken string `json:"tenant_access_token"`
	Expire            int    `json:"expire"`
}

type FeiShuAppMessageSendReq

type FeiShuAppMessageSendReq struct {
	OpenID      string      `json:"open_id,omitempty"`
	UserID      string      `json:"user_id,omitempty"`
	Email       string      `json:"email,omitempty"`
	ChatID      string      `json:"chat_id,omitempty"`
	AppID       string      `json:"robot_id,omitempty"`
	MessageType string      `json:"msg_type"`
	Content     interface{} `json:"content"`
}

See doc https://open.feishu.cn/document/ukTMukTMukTM/uMDMxEjLzATMx4yMwETM

type FeiShuAppMessageSendResp

type FeiShuAppMessageSendResp struct {
	Code    int                          `json:"code"`
	Message string                       `json:"msg"`
	Data    FeiShuAppMessageSendRespData `json:"data"`
}

type FeiShuAppMessageSendRespData

type FeiShuAppMessageSendRespData struct {
	MessageID string `json:"message_id"`
}

type FeiShuAppMessageSendTarget

type FeiShuAppMessageSendTarget struct {
	OpenID string `json:"open_id,omitempty"`
	UserID string `json:"user_id,omitempty"`
	Email  string `json:"email,omitempty"`
	ChatID string `json:"chat_id,omitempty"`
}

type FeiShuRobot

type FeiShuRobot struct {
	// contains filtered or unexported fields
}

FeiShuRobot is a robot to send feishu shortcut messages

func NewFeiShuRobot

func NewFeiShuRobot() *FeiShuRobot

NewFeiShuRobot create a new feishu shortcut robot

func NewFeiShuRobotWithClient

func NewFeiShuRobotWithClient(client *http.Client) *FeiShuRobot

NewFeiShuRobotWithClient create a new feishu shortcut robot with http.Client

func NewFeiShuRobotWithTimeout

func NewFeiShuRobotWithTimeout(timeout time.Duration) *FeiShuRobot

NewFeiShuRobotWithTimeout create a new feishu shortcut robot with timeout

func (*FeiShuRobot) SendTextMessage

func (r *FeiShuRobot) SendTextMessage(key, title, content string) (err error)

SendTextMessage send the text message

type FeiShuRobotMessageResp

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

type FeishuAppPostMessageContent

type FeishuAppPostMessageContent struct {
	Title   string                              `json:"title"`
	Content [][]FeishuAppPostMessageContentItem `json:"content"`
}

type FeishuAppPostMessageContentItem

type FeishuAppPostMessageContentItem struct {
	Tag      string `json:"tag"`
	UnEscape bool   `json:"un_escape,omitempty"`
	Text     string `json:"text,omitempty"`
	Lines    int    `json:"lines,omitempty"`
	Href     string `json:"href,omitempty"`
	UserID   string `json:"user_id,omitempty"`
	ImageKey string `json:"image_key,omitempty"`
	Height   int    `json:"height,omitempty"`
	Width    int    `json:"width,omitempty"`
}

Jump to

Keyboard shortcuts

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