Documentation
¶
Overview ¶
Package lark is an easy-to-use SDK for Feishu and Lark Open Platform, which implements messaging APIs, with full-fledged supports on building Chat Bot and Notification Bot.
Index ¶
- Constants
- Variables
- func APIError(url string, resp BaseResponse) error
- func Decrypt(encryptedKey []byte, data string) ([]byte, error)
- func DownloadFile(path, url string) error
- func EncryptKey(key string) []byte
- func GenSign(secret string, timestamp int64) (string, error)
- type AddChatMemberRequest
- type AddChatMemberResponse
- type AudioContent
- type BaseError
- type BaseResponse
- type BatchGetUserInfoResponse
- type Bot
- func (bot *Bot) AddChatMember(ctx context.Context, chatID string, idList []string) (*AddChatMemberResponse, error)
- func (bot *Bot) AddReaction(ctx context.Context, messageID string, emojiType EmojiType) (*ReactionResponse, error)
- func (bot *Bot) AppID() string
- func (bot *Bot) BatchGetUserInfo(ctx context.Context, userIDType string, userIDs ...string) (*BatchGetUserInfoResponse, error)
- func (bot *Bot) BotType() int
- func (bot *Bot) BuzzMessage(ctx context.Context, buzzType string, messageID string, userIDList ...string) (*BuzzMessageResponse, error)
- func (bot *Bot) CreateChat(ctx context.Context, req CreateChatRequest) (*CreateChatResponse, error)
- func (bot *Bot) DeleteAPIRequest(ctx context.Context, prefix, urlPath string, auth bool, params interface{}, ...) error
- func (bot *Bot) DeleteChat(ctx context.Context, chatID string) (*DeleteChatResponse, error)
- func (bot *Bot) DeleteEphemeralMessage(ctx context.Context, messageID string) (*DeleteEphemeralMessageResponse, error)
- func (bot *Bot) DeleteReaction(ctx context.Context, messageID string, reactionID string) (*ReactionResponse, error)
- func (bot *Bot) DeleteTopNotice(ctx context.Context, chatID string) (*DeleteChatResponse, error)
- func (bot *Bot) Domain() string
- func (bot *Bot) ExpandURL(urlPath string) string
- func (bot *Bot) ForwardMessage(ctx context.Context, messageID string, receiveID *OptionalUserID) (*ForwardMessageResponse, error)
- func (bot *Bot) GetAPIRequest(ctx context.Context, prefix, urlPath string, auth bool, params interface{}, ...) error
- func (bot *Bot) GetBotInfo(ctx context.Context) (*GetBotInfoResponse, error)
- func (bot *Bot) GetChat(ctx context.Context, chatID string) (*GetChatResponse, error)
- func (bot *Bot) GetChatMembers(ctx context.Context, chatID string, pageToken string, pageSize int) (*GetChatMembersResponse, error)
- func (bot *Bot) GetMessage(ctx context.Context, messageID string) (*GetMessageResponse, error)
- func (bot *Bot) GetTenantAccessTokenInternal(ctx context.Context) (*TenantAccessTokenInternalResponse, error)
- func (bot *Bot) GetUserInfo(ctx context.Context, userID *OptionalUserID) (*GetUserInfoResponse, error)
- func (bot *Bot) IsInChat(ctx context.Context, chatID string) (*IsInChatResponse, error)
- func (bot *Bot) JoinChat(ctx context.Context, chatID string) (*JoinChatResponse, error)
- func (bot *Bot) ListChat(ctx context.Context, sortType string, pageToken string, pageSize int) (*ListChatResponse, error)
- func (bot *Bot) Logger() LogWrapper
- func (bot *Bot) MessageReadReceipt(ctx context.Context, messageID string, pageToken string, pageSize int) (*MessageReceiptResponse, error)
- func (bot *Bot) PatchAPIRequest(ctx context.Context, prefix, urlPath string, auth bool, params interface{}, ...) error
- func (bot *Bot) PerformAPIRequest(ctx context.Context, method string, prefix, urlPath string, header http.Header, ...) error
- func (bot *Bot) PinMessage(ctx context.Context, messageID string) (*PinMessageResponse, error)
- func (bot *Bot) PostAPIRequest(ctx context.Context, prefix, urlPath string, auth bool, params interface{}, ...) error
- func (bot *Bot) PostEphemeralMessage(ctx context.Context, om OutcomingMessage) (*PostEphemeralMessageResponse, error)
- func (bot *Bot) PostImage(ctx context.Context, imageKey string, userID *OptionalUserID) (*PostMessageResponse, error)
- func (bot *Bot) PostMessage(ctx context.Context, om OutcomingMessage) (*PostMessageResponse, error)
- func (bot *Bot) PostNotification(ctx context.Context, om OutcomingMessage) (*PostNotificationResp, error)
- func (bot *Bot) PostRichText(ctx context.Context, postContent *PostContent, userID *OptionalUserID) (*PostMessageResponse, error)
- func (bot *Bot) PostShareChat(ctx context.Context, chatID string, userID *OptionalUserID) (*PostMessageResponse, error)
- func (bot *Bot) PostShareUser(ctx context.Context, openID string, userID *OptionalUserID) (*PostMessageResponse, error)
- func (bot *Bot) PostText(ctx context.Context, text string, userID *OptionalUserID) (*PostMessageResponse, error)
- func (bot *Bot) PostTextMention(ctx context.Context, text string, atUserID string, userID *OptionalUserID) (*PostMessageResponse, error)
- func (bot *Bot) PostTextMentionAll(ctx context.Context, text string, userID *OptionalUserID) (*PostMessageResponse, error)
- func (bot *Bot) PostTextMentionAndReply(ctx context.Context, text string, atUserID string, userID *OptionalUserID, ...) (*PostMessageResponse, error)
- func (bot *Bot) PutAPIRequest(ctx context.Context, prefix, urlPath string, auth bool, params interface{}, ...) error
- func (bot *Bot) RecallMessage(ctx context.Context, messageID string) (*RecallMessageResponse, error)
- func (bot *Bot) RemoveChatMember(ctx context.Context, chatID string, idList []string) (*RemoveChatMemberResponse, error)
- func (bot *Bot) ReplyMessage(ctx context.Context, om OutcomingMessage) (*PostMessageResponse, error)
- func (bot *Bot) SearchChat(ctx context.Context, query string, pageToken string, pageSize int) (*ListChatResponse, error)
- func (bot *Bot) SetAutoRenew(onOff bool)
- func (bot *Bot) SetClient(c HTTPClient)
- func (bot *Bot) SetDomain(domain string)
- func (bot *Bot) SetLogger(logger LogWrapper)
- func (bot *Bot) SetTenantAccessToken(t TenantAccessToken)
- func (bot *Bot) SetTopNotice(ctx context.Context, chatID, actionType, messageID string) (*SetTopNoticeResponse, error)
- func (bot *Bot) SetWebhook(url string)
- func (bot *Bot) TenantAccessToken() string
- func (bot *Bot) UnpinMessage(ctx context.Context, messageID string) (*UnpinMessageResponse, error)
- func (bot *Bot) UpdateChat(ctx context.Context, chatID string, req UpdateChatRequest) (*UpdateChatResponse, error)
- func (bot *Bot) UpdateMessage(ctx context.Context, messageID string, om OutcomingMessage) (*UpdateMessageResponse, error)
- func (bot *Bot) UploadFile(ctx context.Context, req UploadFileRequest) (*UploadFileResponse, error)
- func (bot *Bot) UploadImage(ctx context.Context, path string) (*UploadImageResponse, error)
- func (bot *Bot) UploadImageObject(ctx context.Context, img image.Image) (*UploadImageResponse, error)
- func (bot *Bot) WithUserIDType(userIDType string) *Bot
- type BuzzMessageResponse
- type CardBuilder
- func (CardBuilder) Action(actions ...card.Element) *card.ActionBlock
- func (CardBuilder) Button(text *card.TextBlock) *card.ButtonBlock
- func (CardBuilder) Card(elements ...card.Element) *card.Block
- func (CardBuilder) Column(elements ...card.Element) *card.ColumnBlock
- func (CardBuilder) ColumnSet(columns ...*card.ColumnBlock) *card.ColumnSetBlock
- func (CardBuilder) ColumnSetAction(url *card.URLBlock) *card.ColumnSetActionBlock
- func (CardBuilder) Confirm(title, text string) *card.ConfirmBlock
- func (CardBuilder) DatePicker() *card.DatePickerBlock
- func (CardBuilder) DatetimePicker() *card.DatetimePickerBlock
- func (CardBuilder) Div(fields ...*card.FieldBlock) *card.DivBlock
- func (CardBuilder) Field(text *card.TextBlock) *card.FieldBlock
- func (CardBuilder) Hr() *card.HrBlock
- func (CardBuilder) Img(key string) *card.ImgBlock
- func (CardBuilder) Markdown(s string) *card.MarkdownBlock
- func (CardBuilder) Note() *card.NoteBlock
- func (CardBuilder) Option(value string) *card.OptionBlock
- func (CardBuilder) Overflow(options ...*card.OptionBlock) *card.OverflowBlock
- func (CardBuilder) SelectMenu(options ...*card.OptionBlock) *card.SelectMenuBlock
- func (CardBuilder) Text(s string) *card.TextBlock
- func (CardBuilder) TimePicker() *card.TimePickerBlock
- func (CardBuilder) URL() *card.URLBlock
- type CardContent
- type ChatInfo
- type ChatListInfo
- type ChatMember
- type ChatTopNoticeAction
- type CreateChatRequest
- type CreateChatResponse
- type DeleteChatResponse
- type DeleteEphemeralMessageResponse
- type DeleteTopNoticeResponse
- type DummyResponse
- type EmojiType
- type EncryptedReq
- type Event
- func (e Event) GetBotAdded() (*EventBotAdded, error)
- func (e Event) GetBotDeleted() (*EventBotDeleted, error)
- func (e Event) GetChatDisbanded() (*EventChatDisbanded, error)
- func (e Event) GetEvent(eventType string, body interface{}) error
- func (e Event) GetMessageReactionCreated() (*EventMessageReactionCreated, error)
- func (e Event) GetMessageReactionDeleted() (*EventMessageReactionDeleted, error)
- func (e Event) GetMessageRead() (*EventMessageRead, error)
- func (e Event) GetMessageRecalled() (*EventMessageRecalled, error)
- func (e Event) GetMessageReceived() (*EventMessageReceived, error)
- func (e Event) GetUserAdded() (*EventUserAdded, error)
- func (e Event) GetUserDeleted() (*EventUserDeleted, error)
- func (e Event) PostEvent(client *http.Client, hookURL string) (*http.Response, error)
- type EventBody
- type EventBotAdded
- type EventBotDeleted
- type EventCardAction
- type EventCardCallback
- type EventChallenge
- type EventChatDisbanded
- type EventHeader
- type EventMessageReactionCreated
- type EventMessageReactionDeleted
- type EventMessageRead
- type EventMessageRecalled
- type EventMessageReceived
- type EventUserAdded
- type EventUserDeleted
- type EventUserID
- type FileContent
- type ForwardMessageResponse
- type GetBotInfoResponse
- type GetChatMembersResponse
- type GetChatResponse
- type GetMessageResponse
- type GetUserInfoResponse
- type HTTPClient
- type I18NNames
- type IMBody
- type IMMention
- type IMMessage
- type IMMessageRequest
- type IMSender
- type ImageContent
- type IsInChatResponse
- type JoinChatResponse
- type ListChatResponse
- type LogLevel
- type LogWrapper
- type MediaContent
- type MessageContent
- type MessageReceiptResponse
- type MsgBuffer
- func (m *MsgBuffer) Audio(fileKey string) *MsgBuffer
- func (m *MsgBuffer) BindChatID(chatID string) *MsgBuffer
- func (m *MsgBuffer) BindEmail(email string) *MsgBuffer
- func (m *MsgBuffer) BindOpenChatID(openChatID string) *MsgBuffer
- func (m *MsgBuffer) BindOpenID(openID string) *MsgBuffer
- func (m *MsgBuffer) BindReply(rootID string) *MsgBuffer
- func (m *MsgBuffer) BindUnionID(unionID string) *MsgBuffer
- func (m *MsgBuffer) BindUserID(userID string) *MsgBuffer
- func (m *MsgBuffer) Build() OutcomingMessage
- func (m *MsgBuffer) Card(cardContent string) *MsgBuffer
- func (m *MsgBuffer) Clear() *MsgBuffer
- func (m *MsgBuffer) Error() error
- func (m *MsgBuffer) File(fileKey string) *MsgBuffer
- func (m *MsgBuffer) Image(imageKey string) *MsgBuffer
- func (m *MsgBuffer) Media(fileKey, imageKey string) *MsgBuffer
- func (m *MsgBuffer) Post(postContent *PostContent) *MsgBuffer
- func (m *MsgBuffer) ReplyInThread(replyInThread bool) *MsgBuffer
- func (m *MsgBuffer) ShareChat(chatID string) *MsgBuffer
- func (m *MsgBuffer) ShareUser(userID string) *MsgBuffer
- func (m *MsgBuffer) Sticker(fileKey string) *MsgBuffer
- func (m *MsgBuffer) Template(tempateContent *TemplateContent) *MsgBuffer
- func (m *MsgBuffer) Text(text string) *MsgBuffer
- func (m *MsgBuffer) WithSign(secret string, ts int64) *MsgBuffer
- func (m *MsgBuffer) WithUUID(uuid string) *MsgBuffer
- type MsgPostBuilder
- func (pb *MsgPostBuilder) AtTag(text, userID string) *MsgPostBuilder
- func (pb *MsgPostBuilder) Clear()
- func (pb *MsgPostBuilder) CurLocale() *PostBuf
- func (pb *MsgPostBuilder) ImageTag(imageKey string, imageWidth, imageHeight int) *MsgPostBuilder
- func (pb MsgPostBuilder) Len() int
- func (pb *MsgPostBuilder) LinkTag(text, href string) *MsgPostBuilder
- func (pb *MsgPostBuilder) Render() *PostContent
- func (pb *MsgPostBuilder) TextTag(text string, lines int, unescape bool) *MsgPostBuilder
- func (pb *MsgPostBuilder) Title(title string) *MsgPostBuilder
- func (pb *MsgPostBuilder) WithLocale(locale string) *MsgPostBuilder
- type MsgTemplateBuilder
- type MsgTextBuilder
- func (tb *MsgTextBuilder) Clear()
- func (tb MsgTextBuilder) Len() int
- func (tb *MsgTextBuilder) Mention(userID string) *MsgTextBuilder
- func (tb *MsgTextBuilder) MentionAll() *MsgTextBuilder
- func (tb *MsgTextBuilder) Render() string
- func (tb *MsgTextBuilder) Text(text ...interface{}) *MsgTextBuilder
- func (tb *MsgTextBuilder) Textf(textFmt string, text ...interface{}) *MsgTextBuilder
- func (tb *MsgTextBuilder) Textln(text ...interface{}) *MsgTextBuilder
- type OptionalUserID
- type OutcomingMessage
- type PinMessageResponse
- type PostBody
- type PostBuf
- type PostContent
- type PostElem
- type PostEphemeralMessageResponse
- type PostMessageResponse
- type PostNotificationResp
- type ReactionResponse
- type RecallMessageResponse
- type RemoveChatMemberRequest
- type RemoveChatMemberResponse
- type SetTopNoticeRequest
- type SetTopNoticeResponse
- type ShareChatContent
- type ShareUserContent
- type StickerContent
- type TemplateContent
- type TenantAccessToken
- type TenantAccessTokenInternalResponse
- type TextContent
- type UnpinMessageResponse
- type UpdateChatRequest
- type UpdateChatResponse
- type UpdateMessageResponse
- type UploadFileRequest
- type UploadFileResponse
- type UploadImageResponse
- type UserAvatar
- type UserInfo
- type UserStatus
Constants ¶
const ( BuzzTypeInApp = "buzz_inapp" BuzzTypeSMS = "buzz_sms" BuzzTypePhone = "buzz_phone" )
Buzz types
const ( EventTypeMessageReceived = "im.message.receive_v1" EventTypeMessageRead = "im.message.message_read_v1" EventTypeMessageRecalled = "im.message.recalled_v1" EventTypeMessageReactionCreated = "im.message.reaction.created_v1" EventTypeMessageReactionDeleted = "im.message.reaction.deleted_v1" EventTypeChatDisbanded = "im.chat.disbanded_v1" EventTypeUserAdded = "im.chat.member.user.added_v1" EventTypeUserDeleted = "im.chat.member.user.deleted_v1" EventTypeBotAdded = "im.chat.member.bot.added_v1" EventTypeBotDeleted = "im.chat.member.bot.deleted_v1" // not supported yet EventTypeChatUpdated = "im.chat.updated_v1" EventTypeUserWithdrawn = "im.chat.member.user.withdrawn_v1" )
EventType definitions
const ( // ChatBot should be created with NewChatBot // Create from https://open.feishu.cn/ or https://open.larksuite.com/ ChatBot = iota // NotificationBot for webhook, behave as a simpler notification bot // Create from Lark group NotificationBot )
const ( DomainFeishu = "https://open.feishu.cn" DomainLark = "https://open.larksuite.com" )
Domains
const ( LocaleZhCN = "zh_cn" LocaleZhHK = "zh_hk" LocaleZhTW = "zh_tw" LocaleEnUS = "en_us" LocaleJaJP = "ja_jp" )
Supported Lark locales
const ( LogLevelTrace = iota + 1 LogLevelDebug LogLevelInfo LogLevelWarn LogLevelError )
LogLevels
const ( MsgText = "text" MsgPost = "post" MsgInteractive = "interactive" MsgImage = "image" MsgAudio = "audio" MsgMedia = "media" MsgFile = "file" MsgSticker = "sticker" )
Msg Types
const ( UIDEmail = "email" UIDUserID = "user_id" UIDOpenID = "open_id" UIDChatID = "chat_id" UIDUnionID = "union_id" )
UID types
Variables ¶
var ( ErrBotTypeError = errors.New("Bot type error") ErrParamUserID = errors.New("Param error: UserID") ErrParamMessageID = errors.New("Param error: Message ID") ErrParamExceedInputLimit = errors.New("Param error: Exceed input limit") ErrMessageTypeNotSuppored = errors.New("Message type not supported") ErrEncryptionNotEnabled = errors.New("Encryption is not enabled") ErrMessageNotBuild = errors.New("Message not build") ErrUnsupportedUIDType = errors.New("Unsupported UID type") ErrInvalidReceiveID = errors.New("Invalid receive ID") ErrEventTypeNotMatch = errors.New("Event type not match") ErrMessageType = errors.New("Message type error") )
Errors
Functions ¶
func APIError ¶
func APIError(url string, resp BaseResponse) error
APIError constructs an error with given response
func DownloadFile ¶
DownloadFile downloads from a URL to local path
Types ¶
type AddChatMemberRequest ¶
type AddChatMemberRequest struct {
IDList []string `json:"id_list"`
}
AddChatMemberRequest .
type AddChatMemberResponse ¶
type AddChatMemberResponse struct {
BaseResponse
Data struct {
InvalidIDList []string `json:"invalid_id_list"`
NotExistedIDList []string `json:"not_existed_id_list"`
} `json:"data"`
}
AddChatMemberResponse .
type BaseError ¶
type BaseError struct {
LogID string `json:"log_id,omitempty"`
}
BaseError is returned by the platform
type BaseResponse ¶
type BaseResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Error BaseError `json:"error"`
}
BaseResponse of an API
type BatchGetUserInfoResponse ¶
type BatchGetUserInfoResponse struct {
BaseResponse
Data struct {
Items []UserInfo
}
}
BatchGetUserInfoResponse .
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
Bot definition
func (*Bot) AddChatMember ¶
func (bot *Bot) AddChatMember(ctx context.Context, chatID string, idList []string) (*AddChatMemberResponse, error)
AddChatMember .
func (*Bot) AddReaction ¶
func (bot *Bot) AddReaction(ctx context.Context, messageID string, emojiType EmojiType) (*ReactionResponse, error)
AddReaction adds reaction to a message
func (*Bot) BatchGetUserInfo ¶
func (bot *Bot) BatchGetUserInfo(ctx context.Context, userIDType string, userIDs ...string) (*BatchGetUserInfoResponse, error)
BatchGetUserInfo gets contact info in batch
func (*Bot) BuzzMessage ¶
func (bot *Bot) BuzzMessage(ctx context.Context, buzzType string, messageID string, userIDList ...string) (*BuzzMessageResponse, error)
BuzzMessage .
func (*Bot) CreateChat ¶
func (bot *Bot) CreateChat(ctx context.Context, req CreateChatRequest) (*CreateChatResponse, error)
CreateChat .
func (*Bot) DeleteAPIRequest ¶
func (bot *Bot) DeleteAPIRequest(ctx context.Context, prefix, urlPath string, auth bool, params interface{}, output interface{}) error
DeleteAPIRequest DELETEs Lark API
func (*Bot) DeleteChat ¶
DeleteChat .
func (*Bot) DeleteEphemeralMessage ¶
func (bot *Bot) DeleteEphemeralMessage(ctx context.Context, messageID string) (*DeleteEphemeralMessageResponse, error)
DeleteEphemeralMessage deletes an ephemeral message
func (*Bot) DeleteReaction ¶
func (bot *Bot) DeleteReaction(ctx context.Context, messageID string, reactionID string) (*ReactionResponse, error)
DeleteReaction deletes reaction of a message
func (*Bot) DeleteTopNotice ¶
DeleteTopNotice .
func (*Bot) ForwardMessage ¶
func (bot *Bot) ForwardMessage(ctx context.Context, messageID string, receiveID *OptionalUserID) (*ForwardMessageResponse, error)
ForwardMessage forwards a message
func (*Bot) GetAPIRequest ¶
func (bot *Bot) GetAPIRequest(ctx context.Context, prefix, urlPath string, auth bool, params interface{}, output interface{}) error
GetAPIRequest GETs Lark API
func (*Bot) GetBotInfo ¶
func (bot *Bot) GetBotInfo(ctx context.Context) (*GetBotInfoResponse, error)
GetBotInfo returns bot info
func (*Bot) GetChatMembers ¶
func (bot *Bot) GetChatMembers(ctx context.Context, chatID string, pageToken string, pageSize int) (*GetChatMembersResponse, error)
GetChatMembers . NOTICE: pageSize must be larger than 10, e.g. if you present pageSize=1, it returns the same pageToken as pageSize=10. So we recommend you just pass pageSize=10.
func (*Bot) GetMessage ¶
GetMessage gets a message with im/v1
func (*Bot) GetTenantAccessTokenInternal ¶
func (bot *Bot) GetTenantAccessTokenInternal(ctx context.Context) (*TenantAccessTokenInternalResponse, error)
GetTenantAccessTokenInternal gets AppAccessToken for internal use
func (*Bot) GetUserInfo ¶
func (bot *Bot) GetUserInfo(ctx context.Context, userID *OptionalUserID) (*GetUserInfoResponse, error)
GetUserInfo gets contact info
func (*Bot) ListChat ¶
func (bot *Bot) ListChat(ctx context.Context, sortType string, pageToken string, pageSize int) (*ListChatResponse, error)
ListChat lists chats sortType: ByCreateTimeAsc/ByActiveTimeDesc
func (*Bot) MessageReadReceipt ¶
func (bot *Bot) MessageReadReceipt(ctx context.Context, messageID string, pageToken string, pageSize int) (*MessageReceiptResponse, error)
MessageReadReceipt queries message read receipt
func (*Bot) PatchAPIRequest ¶
func (bot *Bot) PatchAPIRequest(ctx context.Context, prefix, urlPath string, auth bool, params interface{}, output interface{}) error
PatchAPIRequest PATCHes Lark API
func (*Bot) PerformAPIRequest ¶
func (bot *Bot) PerformAPIRequest( ctx context.Context, method string, prefix, urlPath string, header http.Header, auth bool, body io.Reader, output interface{}, ) error
PerformAPIRequest performs API request
func (*Bot) PinMessage ¶
PinMessage pins a message
func (*Bot) PostAPIRequest ¶
func (bot *Bot) PostAPIRequest(ctx context.Context, prefix, urlPath string, auth bool, params interface{}, output interface{}) error
PostAPIRequest POSTs Lark API
func (*Bot) PostEphemeralMessage ¶
func (bot *Bot) PostEphemeralMessage(ctx context.Context, om OutcomingMessage) (*PostEphemeralMessageResponse, error)
PostEphemeralMessage posts an ephemeral message
func (*Bot) PostImage ¶
func (bot *Bot) PostImage(ctx context.Context, imageKey string, userID *OptionalUserID) (*PostMessageResponse, error)
PostImage is a simple way to send image
func (*Bot) PostMessage ¶
func (bot *Bot) PostMessage(ctx context.Context, om OutcomingMessage) (*PostMessageResponse, error)
PostMessage posts a message
func (*Bot) PostNotification ¶
func (bot *Bot) PostNotification(ctx context.Context, om OutcomingMessage) (*PostNotificationResp, error)
PostNotification posts nofication to a given webhook
func (*Bot) PostRichText ¶
func (bot *Bot) PostRichText(ctx context.Context, postContent *PostContent, userID *OptionalUserID) (*PostMessageResponse, error)
PostRichText is a simple way to send rich text messages
func (*Bot) PostShareChat ¶
func (bot *Bot) PostShareChat(ctx context.Context, chatID string, userID *OptionalUserID) (*PostMessageResponse, error)
PostShareChat is a simple way to share chat
func (*Bot) PostShareUser ¶
func (bot *Bot) PostShareUser(ctx context.Context, openID string, userID *OptionalUserID) (*PostMessageResponse, error)
PostShareUser is a simple way to share user
func (*Bot) PostText ¶
func (bot *Bot) PostText(ctx context.Context, text string, userID *OptionalUserID) (*PostMessageResponse, error)
PostText is a simple way to send text messages
func (*Bot) PostTextMention ¶
func (bot *Bot) PostTextMention(ctx context.Context, text string, atUserID string, userID *OptionalUserID) (*PostMessageResponse, error)
PostTextMention is a simple way to send text messages with @user
func (*Bot) PostTextMentionAll ¶
func (bot *Bot) PostTextMentionAll(ctx context.Context, text string, userID *OptionalUserID) (*PostMessageResponse, error)
PostTextMentionAll is a simple way to send text messages with @all
func (*Bot) PostTextMentionAndReply ¶
func (bot *Bot) PostTextMentionAndReply(ctx context.Context, text string, atUserID string, userID *OptionalUserID, replyID string) (*PostMessageResponse, error)
PostTextMentionAndReply is a simple way to send text messages with @user and reply a message
func (*Bot) PutAPIRequest ¶
func (bot *Bot) PutAPIRequest(ctx context.Context, prefix, urlPath string, auth bool, params interface{}, output interface{}) error
PutAPIRequest PUTs Lark API
func (*Bot) RecallMessage ¶
func (bot *Bot) RecallMessage(ctx context.Context, messageID string) (*RecallMessageResponse, error)
RecallMessage recalls a message with ID
func (*Bot) RemoveChatMember ¶
func (bot *Bot) RemoveChatMember(ctx context.Context, chatID string, idList []string) (*RemoveChatMemberResponse, error)
RemoveChatMember .
func (*Bot) ReplyMessage ¶
func (bot *Bot) ReplyMessage(ctx context.Context, om OutcomingMessage) (*PostMessageResponse, error)
ReplyMessage replies a message
func (*Bot) SearchChat ¶
func (bot *Bot) SearchChat(ctx context.Context, query string, pageToken string, pageSize int) (*ListChatResponse, error)
SearchChat searches chat
func (*Bot) SetClient ¶
func (bot *Bot) SetClient(c HTTPClient)
SetClient assigns a new client to bot.client
func (*Bot) SetDomain ¶
SetDomain sets domain of endpoint, so we could call Feishu/Lark go-lark does not check your host, just use the right one or fail.
func (*Bot) SetTenantAccessToken ¶
func (bot *Bot) SetTenantAccessToken(t TenantAccessToken)
SetTenantAccessToken sets tenant access token
func (*Bot) SetTopNotice ¶
func (bot *Bot) SetTopNotice(ctx context.Context, chatID, actionType, messageID string) (*SetTopNoticeResponse, error)
SetTopNotice .
func (*Bot) TenantAccessToken ¶
TenantAccessToken returns tenant access token for external use
func (*Bot) UnpinMessage ¶
UnpinMessage unpins a message
func (*Bot) UpdateChat ¶
func (bot *Bot) UpdateChat(ctx context.Context, chatID string, req UpdateChatRequest) (*UpdateChatResponse, error)
UpdateChat .
func (*Bot) UpdateMessage ¶
func (bot *Bot) UpdateMessage(ctx context.Context, messageID string, om OutcomingMessage) (*UpdateMessageResponse, error)
UpdateMessage updates a message
func (*Bot) UploadFile ¶
func (bot *Bot) UploadFile(ctx context.Context, req UploadFileRequest) (*UploadFileResponse, error)
UploadFile uploads file to Lark server
func (*Bot) UploadImage ¶
UploadImage uploads image file
func (*Bot) UploadImageObject ¶
func (bot *Bot) UploadImageObject(ctx context.Context, img image.Image) (*UploadImageResponse, error)
UploadImageObject uploads image object
func (*Bot) WithUserIDType ¶
WithUserIDType assigns user ID type
type BuzzMessageResponse ¶
type BuzzMessageResponse struct {
BaseResponse
Data struct {
InvalidUserIDList []string `json:"invalid_user_id_list,omitempty"`
} `json:"data,omitempty"`
}
BuzzMessageResponse .
type CardBuilder ¶
type CardBuilder struct {
I18N *i18nCardBuilder
}
CardBuilder .
func (CardBuilder) Action ¶
func (CardBuilder) Action(actions ...card.Element) *card.ActionBlock
Action elements including Button, SelectMenu, Overflow, DatePicker, TimePicker, DatetimePicker
func (CardBuilder) Button ¶
func (CardBuilder) Button(text *card.TextBlock) *card.ButtonBlock
Button .
func (CardBuilder) Card ¶
func (CardBuilder) Card(elements ...card.Element) *card.Block
Card assigns elements
func (CardBuilder) Column ¶
func (CardBuilder) Column(elements ...card.Element) *card.ColumnBlock
Column column module
func (CardBuilder) ColumnSet ¶
func (CardBuilder) ColumnSet(columns ...*card.ColumnBlock) *card.ColumnSetBlock
ColumnSet column set module
func (CardBuilder) ColumnSetAction ¶
func (CardBuilder) ColumnSetAction(url *card.URLBlock) *card.ColumnSetActionBlock
ColumnSetAction column action module
func (CardBuilder) Confirm ¶
func (CardBuilder) Confirm(title, text string) *card.ConfirmBlock
Confirm .
func (CardBuilder) DatetimePicker ¶
func (CardBuilder) DatetimePicker() *card.DatetimePickerBlock
DatetimePicker .
func (CardBuilder) Overflow ¶
func (CardBuilder) Overflow(options ...*card.OptionBlock) *card.OverflowBlock
Overflow .
func (CardBuilder) SelectMenu ¶
func (CardBuilder) SelectMenu(options ...*card.OptionBlock) *card.SelectMenuBlock
SelectMenu .
type ChatInfo ¶
type ChatInfo struct {
ChatID string `json:"chat_id,omitempty"`
Name string `json:"name,omitempty"`
Avatar string `json:"avatar,omitempty"`
Description string `json:"description,omitempty"`
I18NNames I18NNames `json:"i18n_names,omitempty"`
AddMemberPermission string `json:"add_member_permission,omitempty"`
AtAllPermission string `json:"at_all_permission,omitempty"`
EditPermission string `json:"edit_permission,omitempty"`
OwnerIDType string `json:"owner_id_type,omitempty"`
OwnerID string `json:"owner_id,omitempty"`
ChatMode string `json:"chat_mode,omitempty"`
ChatType string `json:"chat_type,omitempty"`
ChatTag string `json:"chat_tag,omitempty"`
JoinMessageVisibility string `json:"join_message_visibility,omitempty"`
LeaveMessageVisibility string `json:"leave_message_visibility,omitempty"`
MembershipApproval string `json:"membership_approval,omitempty"`
ModerationPermission string `json:"moderation_permission,omitempty"`
External bool `json:"external,omitempty"`
}
ChatInfo is entity of a chat, not every field is available for every API.
type ChatListInfo ¶
type ChatListInfo struct {
ChatID string `json:"chat_id,omitempty"`
Name string `json:"name,omitempty"`
Avatar string `json:"avatar,omitempty"`
Description string `json:"description,omitempty"`
OwnerIDType string `json:"owner_id_type,omitempty"`
OwnerID string `json:"owner_id,omitempty"`
External bool `json:"external,omitempty"`
TenantKey string `json:"tenant_key"`
}
ChatListInfo .
type ChatMember ¶
type ChatMember struct {
MemberIDType string `json:"member_id_type"`
MemberID string `json:"member_id"`
Name string `json:"name"`
TenantKey string `json:"tenant_key"`
}
ChatMember .
type ChatTopNoticeAction ¶
type ChatTopNoticeAction struct {
ActionType string `json:"action_type"`
MessageID string `json:"message_id"`
}
ChatTopNoticeAction .
type CreateChatRequest ¶
type CreateChatRequest struct {
Name string `json:"name,omitempty"`
Avatar string `json:"avatar,omitempty"`
Description string `json:"description,omitempty"`
I18NNames I18NNames `json:"i18n_names,omitempty"`
OwnerID string `json:"owner_id,omitempty"`
ChatMode string `json:"chat_mode,omitempty"`
ChatType string `json:"chat_type,omitempty"`
JoinMessageVisibility string `json:"join_message_visibility,omitempty"`
LeaveMessageVisibility string `json:"leave_message_visibility,omitempty"`
MembershipApproval string `json:"membership_approval,omitempty"`
External bool `json:"external,omitempty"`
}
CreateChatRequest .
type CreateChatResponse ¶
type CreateChatResponse struct {
BaseResponse
Data ChatInfo `json:"data"`
}
CreateChatResponse .
type DeleteEphemeralMessageResponse ¶
type DeleteEphemeralMessageResponse = BaseResponse
DeleteEphemeralMessageResponse .
type DeleteTopNoticeResponse ¶
type DeleteTopNoticeResponse = BaseResponse
DeleteTopNoticeResponse .
type DummyResponse ¶
type DummyResponse struct {
BaseResponse
}
DummyResponse is used to unmarshal from a complete JSON response but only to retrieve error
type EmojiType ¶
type EmojiType string
EmojiType .
const ( EmojiTypeOK EmojiType = "OK" EmojiTypeTHUMBSUP EmojiType = "THUMBSUP" EmojiTypeTHANKS EmojiType = "THANKS" EmojiTypeMUSCLE EmojiType = "MUSCLE" EmojiTypeFINGERHEART EmojiType = "FINGERHEART" EmojiTypeAPPLAUSE EmojiType = "APPLAUSE" EmojiTypeFISTBUMP EmojiType = "FISTBUMP" EmojiTypeJIAYI EmojiType = "JIAYI" EmojiTypeDONE EmojiType = "DONE" EmojiTypeSMILE EmojiType = "SMILE" EmojiTypeBLUSH EmojiType = "BLUSH" EmojiTypeLAUGH EmojiType = "LAUGH" EmojiTypeSMIRK EmojiType = "SMIRK" EmojiTypeLOL EmojiType = "LOL" EmojiTypeFACEPALM EmojiType = "FACEPALM" EmojiTypeLOVE EmojiType = "LOVE" EmojiTypeWINK EmojiType = "WINK" EmojiTypePROUD EmojiType = "PROUD" EmojiTypeWITTY EmojiType = "WITTY" EmojiTypeSMART EmojiType = "SMART" EmojiTypeSCOWL EmojiType = "SCOWL" EmojiTypeTHINKING EmojiType = "THINKING" EmojiTypeSOB EmojiType = "SOB" EmojiTypeCRY EmojiType = "CRY" EmojiTypeERROR EmojiType = "ERROR" EmojiTypeNOSEPICK EmojiType = "NOSEPICK" EmojiTypeHAUGHTY EmojiType = "HAUGHTY" EmojiTypeSLAP EmojiType = "SLAP" EmojiTypeSPITBLOOD EmojiType = "SPITBLOOD" EmojiTypeTOASTED EmojiType = "TOASTED" EmojiTypeGLANCE EmojiType = "GLANCE" EmojiTypeDULL EmojiType = "DULL" EmojiTypeINNOCENTSMILE EmojiType = "INNOCENTSMILE" EmojiTypeJOYFUL EmojiType = "JOYFUL" EmojiTypeWOW EmojiType = "WOW" EmojiTypeTRICK EmojiType = "TRICK" EmojiTypeYEAH EmojiType = "YEAH" EmojiTypeENOUGH EmojiType = "ENOUGH" EmojiTypeTEARS EmojiType = "TEARS" EmojiTypeEMBARRASSED EmojiType = "EMBARRASSED" EmojiTypeKISS EmojiType = "KISS" EmojiTypeSMOOCH EmojiType = "SMOOCH" EmojiTypeDROOL EmojiType = "DROOL" EmojiTypeOBSESSED EmojiType = "OBSESSED" EmojiTypeMONEY EmojiType = "MONEY" EmojiTypeTEASE EmojiType = "TEASE" EmojiTypeSHOWOFF EmojiType = "SHOWOFF" EmojiTypeCOMFORT EmojiType = "COMFORT" EmojiTypeCLAP EmojiType = "CLAP" EmojiTypePRAISE EmojiType = "PRAISE" EmojiTypeSTRIVE EmojiType = "STRIVE" EmojiTypeXBLUSH EmojiType = "XBLUSH" EmojiTypeSILENT EmojiType = "SILENT" EmojiTypeWAVE EmojiType = "WAVE" EmojiTypeWHAT EmojiType = "WHAT" EmojiTypeFROWN EmojiType = "FROWN" EmojiTypeSHY EmojiType = "SHY" EmojiTypeDIZZY EmojiType = "DIZZY" EmojiTypeLOOKDOWN EmojiType = "LOOKDOWN" EmojiTypeCHUCKLE EmojiType = "CHUCKLE" EmojiTypeWAIL EmojiType = "WAIL" EmojiTypeCRAZY EmojiType = "CRAZY" EmojiTypeWHIMPER EmojiType = "WHIMPER" EmojiTypeHUG EmojiType = "HUG" EmojiTypeBLUBBER EmojiType = "BLUBBER" EmojiTypeWRONGED EmojiType = "WRONGED" EmojiTypeHUSKY EmojiType = "HUSKY" EmojiTypeSHHH EmojiType = "SHHH" EmojiTypeSMUG EmojiType = "SMUG" EmojiTypeANGRY EmojiType = "ANGRY" EmojiTypeHAMMER EmojiType = "HAMMER" EmojiTypeSHOCKED EmojiType = "SHOCKED" EmojiTypeTERROR EmojiType = "TERROR" EmojiTypePETRIFIED EmojiType = "PETRIFIED" EmojiTypeSKULL EmojiType = "SKULL" EmojiTypeSWEAT EmojiType = "SWEAT" EmojiTypeSPEECHLESS EmojiType = "SPEECHLESS" EmojiTypeSLEEP EmojiType = "SLEEP" EmojiTypeDROWSY EmojiType = "DROWSY" EmojiTypeYAWN EmojiType = "YAWN" EmojiTypeSICK EmojiType = "SICK" EmojiTypePUKE EmojiType = "PUKE" EmojiTypeBETRAYED EmojiType = "BETRAYED" EmojiTypeHEADSET EmojiType = "HEADSET" EmojiTypeEatingFood EmojiType = "EatingFood" EmojiTypeMeMeMe EmojiType = "MeMeMe" EmojiTypeSigh EmojiType = "Sigh" EmojiTypeTyping EmojiType = "Typing" EmojiTypeLemon EmojiType = "Lemon" EmojiTypeGet EmojiType = "Get" EmojiTypeLGTM EmojiType = "LGTM" EmojiTypeOnIt EmojiType = "OnIt" EmojiTypeOneSecond EmojiType = "OneSecond" EmojiTypeVRHeadset EmojiType = "VRHeadset" EmojiTypeYouAreTheBest EmojiType = "YouAreTheBest" EmojiTypeSALUTE EmojiType = "SALUTE" EmojiTypeSHAKE EmojiType = "SHAKE" EmojiTypeHIGHFIVE EmojiType = "HIGHFIVE" EmojiTypeUPPERLEFT EmojiType = "UPPERLEFT" EmojiTypeThumbsDown EmojiType = "ThumbsDown" EmojiTypeSLIGHT EmojiType = "SLIGHT" EmojiTypeTONGUE EmojiType = "TONGUE" EmojiTypeEYESCLOSED EmojiType = "EYESCLOSED" EmojiTypeRoarForYou EmojiType = "RoarForYou" EmojiTypeCALF EmojiType = "CALF" EmojiTypeBEAR EmojiType = "BEAR" EmojiTypeBULL EmojiType = "BULL" EmojiTypeRAINBOWPUKE EmojiType = "RAINBOWPUKE" EmojiTypeROSE EmojiType = "ROSE" EmojiTypeHEART EmojiType = "HEART" EmojiTypePARTY EmojiType = "PARTY" EmojiTypeLIPS EmojiType = "LIPS" EmojiTypeBEER EmojiType = "BEER" EmojiTypeCAKE EmojiType = "CAKE" EmojiTypeGIFT EmojiType = "GIFT" EmojiTypeCUCUMBER EmojiType = "CUCUMBER" EmojiTypeDrumstick EmojiType = "Drumstick" EmojiTypePepper EmojiType = "Pepper" EmojiTypeCANDIEDHAWS EmojiType = "CANDIEDHAWS" EmojiTypeBubbleTea EmojiType = "BubbleTea" EmojiTypeCoffee EmojiType = "Coffee" EmojiTypeYes EmojiType = "Yes" EmojiTypeNo EmojiType = "No" EmojiTypeOKR EmojiType = "OKR" EmojiTypeCheckMark EmojiType = "CheckMark" EmojiTypeCrossMark EmojiType = "CrossMark" EmojiTypeMinusOne EmojiType = "MinusOne" EmojiTypeHundred EmojiType = "Hundred" EmojiTypeAWESOMEN EmojiType = "AWESOMEN" EmojiTypePin EmojiType = "Pin" EmojiTypeAlarm EmojiType = "Alarm" EmojiTypeLoudspeaker EmojiType = "Loudspeaker" EmojiTypeTrophy EmojiType = "Trophy" EmojiTypeFire EmojiType = "Fire" EmojiTypeBOMB EmojiType = "BOMB" EmojiTypeMusic EmojiType = "Music" EmojiTypeXmasTree EmojiType = "XmasTree" EmojiTypeSnowman EmojiType = "Snowman" EmojiTypeXmasHat EmojiType = "XmasHat" EmojiTypeFIREWORKS EmojiType = "FIREWORKS" EmojiType2022 EmojiType = "2022" EmojiTypeREDPACKET EmojiType = "REDPACKET" EmojiTypeFORTUNE EmojiType = "FORTUNE" EmojiTypeLUCK EmojiType = "LUCK" EmojiTypeFIRECRACKER EmojiType = "FIRECRACKER" EmojiTypeStickyRiceBalls EmojiType = "StickyRiceBalls" EmojiTypeHEARTBROKEN EmojiType = "HEARTBROKEN" EmojiTypePOOP EmojiType = "POOP" EmojiTypeStatusFlashOfInspiration EmojiType = "StatusFlashOfInspiration" EmojiType18X EmojiType = "18X" EmojiTypeCLEAVER EmojiType = "CLEAVER" EmojiTypeSoccer EmojiType = "Soccer" EmojiTypeBasketball EmojiType = "Basketball" EmojiTypeGeneralDoNotDisturb EmojiType = "GeneralDoNotDisturb" EmojiTypeStatusPrivateMessage EmojiType = "Status_PrivateMessage" EmojiTypeGeneralInMeetingBusy EmojiType = "GeneralInMeetingBusy" EmojiTypeStatusReading EmojiType = "StatusReading" EmojiTypeStatusInFlight EmojiType = "StatusInFlight" EmojiTypeGeneralBusinessTrip EmojiType = "GeneralBusinessTrip" EmojiTypeGeneralWorkFromHome EmojiType = "GeneralWorkFromHome" EmojiTypeStatusEnjoyLife EmojiType = "StatusEnjoyLife" EmojiTypeGeneralTravellingCar EmojiType = "GeneralTravellingCar" EmojiTypeStatusBus EmojiType = "StatusBus" EmojiTypeGeneralSun EmojiType = "GeneralSun" EmojiTypeGeneralMoonRest EmojiType = "GeneralMoonRest" EmojiTypePursueUltimate EmojiType = "PursueUltimate" EmojiTypePatient EmojiType = "Patient" EmojiTypeAmbitious EmojiType = "Ambitious" EmojiTypeCustomerSuccess EmojiType = "CustomerSuccess" EmojiTypeResponsible EmojiType = "Responsible" EmojiTypeReliable EmojiType = "Reliable" )
Emoji types
type EncryptedReq ¶
type EncryptedReq struct {
Encrypt string `json:"encrypt,omitempty"`
}
EncryptedReq is request of encrypted challenge
type Event ¶
type Event struct {
Schema string `json:"schema,omitempty"`
Header EventHeader `json:"header,omitempty"`
EventRaw json.RawMessage `json:"event,omitempty"`
Event interface{} `json:"-"`
}
Event handles events with v2 schema
func (Event) GetBotDeleted ¶
func (e Event) GetBotDeleted() (*EventBotDeleted, error)
GetBotDeleted .
func (Event) GetChatDisbanded ¶
func (e Event) GetChatDisbanded() (*EventChatDisbanded, error)
GetChatDisbanded .
func (Event) GetMessageReactionCreated ¶
func (e Event) GetMessageReactionCreated() (*EventMessageReactionCreated, error)
GetMessageReactionCreated .
func (Event) GetMessageReactionDeleted ¶
func (e Event) GetMessageReactionDeleted() (*EventMessageReactionDeleted, error)
GetMessageReactionDeleted .
func (Event) GetMessageRead ¶
func (e Event) GetMessageRead() (*EventMessageRead, error)
GetMessageRead .
func (Event) GetMessageRecalled ¶
func (e Event) GetMessageRecalled() (*EventMessageRecalled, error)
GetMessageRecalled .
func (Event) GetMessageReceived ¶
func (e Event) GetMessageReceived() (*EventMessageReceived, error)
GetMessageReceived .
func (Event) GetUserDeleted ¶
func (e Event) GetUserDeleted() (*EventUserDeleted, error)
GetUserDeleted .
type EventBody ¶
type EventBody struct {
Type string `json:"type"`
AppID string `json:"app_id"`
TenantKey string `json:"tenant_key"`
ChatType string `json:"chat_type"`
MsgType string `json:"msg_type"`
RootID string `json:"root_id,omitempty"`
ParentID string `json:"parent_id,omitempty"`
OpenID string `json:"open_id,omitempty"`
OpenChatID string `json:"open_chat_id,omitempty"`
OpenMessageID string `json:"open_message_id,omitempty"`
IsMention bool `json:"is_mention,omitempty"`
Title string `json:"title,omitempty"`
Text string `json:"text,omitempty"`
RealText string `json:"text_without_at_bot,omitempty"`
ImageKey string `json:"image_key,omitempty"`
ImageURL string `json:"image_url,omitempty"`
FileKey string `json:"file_key,omitempty"`
}
EventBody .
type EventBotAdded ¶
type EventBotAdded struct {
ChatID string `json:"chat_id,omitempty"`
OperatorID EventUserID `json:"operator_id,omitempty"`
External bool `json:"external,omitempty"`
OperatorTenantKey string `json:"operator_tenant_key,omitempty"`
}
EventBotAdded .
type EventCardAction ¶
type EventCardAction struct {
Tag string `json:"tag,omitempty"` // button, overflow, select_static, select_person, &datepicker
Option string `json:"option,omitempty"` // only for Overflow and SelectMenu
Timezone string `json:"timezone,omitempty"` // only for DatePicker
Value json.RawMessage `json:"value,omitempty"` // for any elements with value
}
EventCardAction .
type EventCardCallback ¶
type EventCardCallback struct {
AppID string `json:"app_id,omitempty"`
TenantKey string `json:"tenant_key,omitempty"`
Token string `json:"token,omitempty"`
OpenID string `json:"open_id,omitempty"`
UserID string `json:"user_id,omitempty"`
MessageID string `json:"open_message_id,omitempty"`
ChatID string `json:"open_chat_id,omitempty"`
Action EventCardAction `json:"action,omitempty"`
}
EventCardCallback is request of card
type EventChallenge ¶
type EventChallenge struct {
Token string `json:"token,omitempty"`
Challenge string `json:"challenge,omitempty"`
Type string `json:"type,omitempty"`
}
EventChallenge is request of add event hook
type EventChatDisbanded ¶
type EventChatDisbanded struct {
ChatID string `json:"chat_id,omitempty"`
OperatorID EventUserID `json:"operator_id,omitempty"`
External bool `json:"external,omitempty"`
OperatorTenantKey string `json:"operator_tenant_key,omitempty"`
}
EventChatDisbanded .
type EventHeader ¶
type EventHeader struct {
EventID string `json:"event_id,omitempty"`
EventType string `json:"event_type,omitempty"`
CreateTime string `json:"create_time,omitempty"`
Token string `json:"token,omitempty"`
AppID string `json:"app_id,omitempty"`
TenantKey string `json:"tenant_key,omitempty"`
}
EventHeader .
type EventMessageReactionCreated ¶
type EventMessageReactionCreated struct {
MessageID string `json:"message_id,omitempty"`
OperatorType string `json:"operator_type,omitempty"`
UserID EventUserID `json:"user_id,omitempty"`
AppID string `json:"app_id,omitempty"`
ActionTime string `json:"action_time,omitempty"`
ReactionType struct {
EmojiType string `json:"emoji_type,omitempty"`
} `json:"reaction_type,omitempty"`
}
EventMessageReactionCreated .
type EventMessageReactionDeleted ¶
type EventMessageReactionDeleted struct {
MessageID string `json:"message_id,omitempty"`
OperatorType string `json:"operator_type,omitempty"`
UserID EventUserID `json:"user_id,omitempty"`
AppID string `json:"app_id,omitempty"`
ActionTime string `json:"action_time,omitempty"`
ReactionType struct {
EmojiType string `json:"emoji_type,omitempty"`
} `json:"reaction_type,omitempty"`
}
EventMessageReactionDeleted .
type EventMessageRead ¶
type EventMessageRead struct {
Reader struct {
ReaderID EventUserID `json:"reader_id,omitempty"`
ReadTime string `json:"read_time,omitempty"`
TenantKey string `json:"tenant_key,omitempty"`
} `json:"reader,omitempty"`
MessageIDList []string `json:"message_id_list,omitempty"`
}
EventMessageRead .
type EventMessageRecalled ¶
type EventMessageRecalled struct {
MessageID string `json:"message_id,omitempty"`
ChatID string `json:"chat_id,omitempty"`
RecallTime string `json:"recall_time,omitempty"`
RecallType string `json:"recall_type,omitempty"`
}
EventMessageRecalled .
type EventMessageReceived ¶
type EventMessageReceived struct {
Sender struct {
SenderID EventUserID `json:"sender_id,omitempty"`
SenderType string `json:"sender_type,omitempty"`
TenantKey string `json:"tenant_key,omitempty"`
} `json:"sender,omitempty"`
Message struct {
MessageID string `json:"message_id,omitempty"`
RootID string `json:"root_id,omitempty"`
ParentID string `json:"parent_id,omitempty"`
CreateTime string `json:"create_time,omitempty"`
UpdateTime string `json:"update_time,omitempty"`
ChatID string `json:"chat_id,omitempty"`
ChatType string `json:"chat_type,omitempty"`
ThreadID string `json:"thread_id,omitempty"`
MessageType string `json:"message_type,omitempty"`
Content string `json:"content,omitempty"`
Mentions []struct {
Key string `json:"key,omitempty"`
ID EventUserID `json:"id,omitempty"`
Name string `json:"name,omitempty"`
TenantKey string `json:"tenant_key,omitempty"`
} `json:"mentions,omitempty"`
UserAgent string `json:"user_agent,omitempty"`
} `json:"message,omitempty"`
}
EventMessageReceived .
type EventUserAdded ¶
type EventUserAdded struct {
ChatID string `json:"chat_id,omitempty"`
OperatorID EventUserID `json:"operator_id,omitempty"`
External bool `json:"external,omitempty"`
OperatorTenantKey string `json:"operator_tenant_key,omitempty"`
Users []struct {
Name string `json:"name,omitempty"`
TenantKey string `json:"tenant_key,omitempty"`
UserID EventUserID `json:"user_id,omitempty"`
} `json:"users,omitempty"`
}
EventUserAdded .
type EventUserID ¶
type EventUserID struct {
UnionID string `json:"union_id,omitempty"`
UserID string `json:"user_id,omitempty"`
OpenID string `json:"open_id,omitempty"`
}
EventUserID .
type FileContent ¶
type FileContent struct {
FileName string `json:"file_name,omitempty"`
FileKey string `json:"file_key"`
}
FileContent .
type ForwardMessageResponse ¶
type ForwardMessageResponse = PostMessageResponse
ForwardMessageResponse .
type GetBotInfoResponse ¶
type GetBotInfoResponse struct {
BaseResponse
Bot struct {
ActivateStatus int `json:"activate_status"`
AppName string `json:"app_name"`
AvatarURL string `json:"avatar_url"`
IPWhiteList []string `json:"ip_white_list"`
OpenID string `json:"open_id"`
} `json:"bot"`
}
GetBotInfoResponse .
type GetChatMembersResponse ¶
type GetChatMembersResponse struct {
BaseResponse
Data struct {
Items []ChatMember `json:"items"`
PageToken string `json:"page_token"`
HasMore bool `json:"has_more"`
MemberTotal int `json:"member_total"`
} `json:"data"`
}
GetChatMembersResponse .
type GetChatResponse ¶
type GetChatResponse struct {
BaseResponse
Data ChatInfo `json:"data"`
}
GetChatResponse .
type GetMessageResponse ¶
type GetMessageResponse struct {
BaseResponse
Data struct {
Items []IMMessage `json:"items"`
} `json:"data"`
}
GetMessageResponse .
type GetUserInfoResponse ¶
type GetUserInfoResponse struct {
BaseResponse
Data struct {
User UserInfo
}
}
GetUserInfoResponse .
type HTTPClient ¶
HTTPClient is an interface handling http requests
type I18NNames ¶
type I18NNames struct {
ZhCN string `json:"zh_cn,omitempty"`
EnUS string `json:"en_us,omitempty"`
JaJP string `json:"ja_jp,omitempty"`
}
I18NNames structure of names in multiple locales
type IMMention ¶
type IMMention struct {
ID string `json:"id"`
IDType string `json:"id_type"`
Key string `json:"key"`
Name string `json:"name"`
}
IMMention .
type IMMessage ¶
type IMMessage struct {
MessageID string `json:"message_id"`
UpperMessageID string `json:"upper_message_id"`
RootID string `json:"root_id"`
ParentID string `json:"parent_id"`
ThreadID string `json:"thread_id"`
ChatID string `json:"chat_id"`
MsgType string `json:"msg_type"`
CreateTime string `json:"create_time"`
UpdateTime string `json:"update_time"`
Deleted bool `json:"deleted"`
Updated bool `json:"updated"`
Sender IMSender `json:"sender"`
Mentions []IMMention `json:"mentions"`
Body IMBody `json:"body"`
}
IMMessage .
type IMMessageRequest ¶
type IMMessageRequest struct {
Content string `json:"content"`
MsgType string `json:"msg_type,omitempty"`
ReceiveID string `json:"receive_id,omitempty"`
UUID string `json:"uuid,omitempty"`
ReplyInThread bool `json:"reply_in_thread,omitempty"`
}
IMMessageRequest .
func BuildMessage ¶
func BuildMessage(om OutcomingMessage) (*IMMessageRequest, error)
BuildMessage .
type IMSender ¶
type IMSender struct {
ID string `json:"id"`
IDType string `json:"id_type"`
SenderType string `json:"sender_type"`
TenantKey string `json:"tenant_key"`
}
IMSender .
type IsInChatResponse ¶
type IsInChatResponse struct {
BaseResponse
Data struct {
IsInChat bool `json:"is_in_chat"`
} `json:"data"`
}
IsInChatResponse .
type ListChatResponse ¶
type ListChatResponse struct {
BaseResponse
Data struct {
Items []ChatListInfo `json:"items"`
PageToken string `json:"page_token"`
HasMore bool `json:"has_more"`
} `json:"data"`
}
ListChatResponse .
type LogWrapper ¶
type LogWrapper interface {
// for log print
Log(context.Context, LogLevel, string)
// for test redirection
SetOutput(io.Writer)
}
LogWrapper interface
type MediaContent ¶
type MediaContent struct {
FileName string `json:"file_name,omitempty"`
FileKey string `json:"file_key"`
ImageKey string `json:"image_key"`
Duration int `json:"duration,omitempty"`
}
MediaContent .
type MessageContent ¶
type MessageContent struct {
Text *TextContent `json:"text,omitempty"`
Image *ImageContent `json:"image,omitempty"`
Post *PostContent `json:"post,omitempty"`
Card *CardContent `json:"card,omitempty"`
Audio *AudioContent `json:"audio,omitempty"`
Media *MediaContent `json:"media,omitempty"`
File *FileContent `json:"file,omitempty"`
Sticker *StickerContent `json:"sticker,omitempty"`
Template *TemplateContent `json:"template,omitempty"`
}
MessageContent struct of message content
type MessageReceiptResponse ¶
type MessageReceiptResponse struct {
BaseResponse
Data struct {
ReadUsers []struct {
OpenID string `json:"open_id"`
UserID string `json:"user_id"`
Timestamp string `json:"timestamp"`
} `json:"read_users"`
} `json:"data"`
}
MessageReceiptResponse .
type MsgBuffer ¶
type MsgBuffer struct {
// contains filtered or unexported fields
}
MsgBuffer stores all the messages attached You can call every function, but some of which is only available for specific condition
func NewMsgBuffer ¶
NewMsgBuffer creates a message buffer
func (*MsgBuffer) BindChatID ¶
BindChatID binds chat_id
func (*MsgBuffer) BindOpenChatID ¶
BindOpenChatID binds open_chat_id
func (*MsgBuffer) BindOpenID ¶
BindOpenID binds open_id
func (*MsgBuffer) BindReply ¶
BindReply binds root id for reply rootID is OpenMessageID of the message you reply
func (*MsgBuffer) BindUnionID ¶
BindUnionID binds union_id
func (*MsgBuffer) BindUserID ¶
BindUserID binds open_id
func (*MsgBuffer) Build ¶
func (m *MsgBuffer) Build() OutcomingMessage
Build message and return message body
func (*MsgBuffer) Post ¶
func (m *MsgBuffer) Post(postContent *PostContent) *MsgBuffer
Post sets raw post content
func (*MsgBuffer) ReplyInThread ¶
ReplyInThread replies message in thread
func (*MsgBuffer) Template ¶
func (m *MsgBuffer) Template(tempateContent *TemplateContent) *MsgBuffer
Template sets raw template content
type MsgPostBuilder ¶
type MsgPostBuilder struct {
// contains filtered or unexported fields
}
MsgPostBuilder for build text buf
func (*MsgPostBuilder) AtTag ¶
func (pb *MsgPostBuilder) AtTag(text, userID string) *MsgPostBuilder
AtTag creates an at tag
func (*MsgPostBuilder) CurLocale ¶
func (pb *MsgPostBuilder) CurLocale() *PostBuf
CurLocale switches to locale and returns the buffer of that locale
func (*MsgPostBuilder) ImageTag ¶
func (pb *MsgPostBuilder) ImageTag(imageKey string, imageWidth, imageHeight int) *MsgPostBuilder
ImageTag creates an image tag
func (*MsgPostBuilder) LinkTag ¶
func (pb *MsgPostBuilder) LinkTag(text, href string) *MsgPostBuilder
LinkTag creates a link tag
func (*MsgPostBuilder) TextTag ¶
func (pb *MsgPostBuilder) TextTag(text string, lines int, unescape bool) *MsgPostBuilder
TextTag creates a text tag
func (*MsgPostBuilder) Title ¶
func (pb *MsgPostBuilder) Title(title string) *MsgPostBuilder
Title sets title
func (*MsgPostBuilder) WithLocale ¶
func (pb *MsgPostBuilder) WithLocale(locale string) *MsgPostBuilder
WithLocale switches to locale and returns self
type MsgTemplateBuilder ¶
type MsgTemplateBuilder struct {
// contains filtered or unexported fields
}
MsgTemplateBuilder for build template
func NewTemplateBuilder ¶
func NewTemplateBuilder() *MsgTemplateBuilder
NewTemplateBuilder creates a text builder
func (*MsgTemplateBuilder) BindTemplate ¶
func (tb *MsgTemplateBuilder) BindTemplate(id, versionName string, data map[string]interface{}) *TemplateContent
BindTemplate .
type MsgTextBuilder ¶
type MsgTextBuilder struct {
// contains filtered or unexported fields
}
MsgTextBuilder for build text buf
func (*MsgTextBuilder) Mention ¶
func (tb *MsgTextBuilder) Mention(userID string) *MsgTextBuilder
Mention @somebody
func (*MsgTextBuilder) MentionAll ¶
func (tb *MsgTextBuilder) MentionAll() *MsgTextBuilder
MentionAll @all
func (*MsgTextBuilder) Text ¶
func (tb *MsgTextBuilder) Text(text ...interface{}) *MsgTextBuilder
Text adds simple texts
func (*MsgTextBuilder) Textf ¶
func (tb *MsgTextBuilder) Textf(textFmt string, text ...interface{}) *MsgTextBuilder
Textf adds texts with format
func (*MsgTextBuilder) Textln ¶
func (tb *MsgTextBuilder) Textln(text ...interface{}) *MsgTextBuilder
Textln adds simple texts with a newline
type OptionalUserID ¶
OptionalUserID contains either openID, chatID, userID, or email
func WithUnionID ¶
func WithUnionID(unionID string) *OptionalUserID
WithUnionID uses chatID as userID
type OutcomingMessage ¶
type OutcomingMessage struct {
MsgType string `json:"msg_type"`
Content MessageContent `json:"content"`
Card CardContent `json:"card"`
// ID for user
UIDType string `json:"-"`
OpenID string `json:"open_id,omitempty"`
Email string `json:"email,omitempty"`
UserID string `json:"user_id,omitempty"`
ChatID string `json:"chat_id,omitempty"`
UnionID string `json:"-"`
// For reply
RootID string `json:"root_id,omitempty"`
ReplyInThread bool `json:"reply_in_thread,omitempty"`
// Sign for notification bot
Sign string `json:"sign"`
// Timestamp for sign
Timestamp int64 `json:"timestamp"`
// UUID for idempotency
UUID string `json:"uuid"`
}
OutcomingMessage struct of an outcoming message
type PinMessageResponse ¶
type PinMessageResponse struct {
BaseResponse
Data struct {
Pin struct {
MessageID string `json:"message_id"`
ChatID string `json:"chat_id"`
OperatorID string `json:"operator_id"`
OperatorIDType string `json:"operator_id_type"`
CreateTime string `json:"create_time"`
} `json:"pin"`
} `json:"data"`
}
PinMessageResponse .
type PostElem ¶
type PostElem struct {
Tag string `json:"tag"`
// For Text
UnEscape *bool `json:"un_escape,omitempty"`
Text *string `json:"text,omitempty"`
Lines *int `json:"lines,omitempty"`
// For Link
Href *string `json:"href,omitempty"`
// For At
UserID *string `json:"user_id,omitempty"`
// For Image
ImageKey *string `json:"image_key,omitempty"`
ImageWidth *int `json:"width,omitempty"`
ImageHeight *int `json:"height,omitempty"`
}
PostElem .
type PostEphemeralMessageResponse ¶
type PostEphemeralMessageResponse struct {
BaseResponse
Data struct {
MessageID string `json:"message_id"`
} `json:"data"`
}
PostEphemeralMessageResponse .
type PostMessageResponse ¶
type PostMessageResponse struct {
BaseResponse
Data IMMessage `json:"data"`
}
PostMessageResponse .
type PostNotificationResp ¶
type PostNotificationResp struct {
Code int `json:"code"`
Msg string `json:"msg"`
StatusCode int `json:"StatusCode"`
StatusMessage string `json:"StatusMessage"`
}
PostNotificationResp .
type ReactionResponse ¶
type ReactionResponse struct {
BaseResponse
Data struct {
ReactionID string `json:"reaction_id"`
Operator struct {
OperatorID string `json:"operator_id"`
OperatorType string `json:"operator_type"`
ActionTime string `json:"action_time"`
} `json:"operator"`
ReactionType struct {
EmojiType EmojiType `json:"emoji_type"`
} `json:"reaction_type"`
} `json:"data"`
}
ReactionResponse .
type RemoveChatMemberRequest ¶
type RemoveChatMemberRequest struct {
IDList []string `json:"id_list"`
}
RemoveChatMemberRequest .
type RemoveChatMemberResponse ¶
type RemoveChatMemberResponse struct {
BaseResponse
Data struct {
InvalidIDList []string `json:"invalid_id_list"`
} `json:"data"`
}
RemoveChatMemberResponse .
type SetTopNoticeRequest ¶
type SetTopNoticeRequest struct {
ChatTopNotice []ChatTopNoticeAction `json:"chat_top_notice"`
}
SetTopNoticeRequest .
type StickerContent ¶
type StickerContent struct {
FileKey string `json:"file_key"`
}
StickerContent .
type TemplateContent ¶
type TemplateContent struct {
Type string `json:"type"`
Data templateData `json:"data,omitempty"`
}
TemplateContent .
type TenantAccessToken ¶
type TenantAccessToken struct {
TenantAccessToken string
Expire time.Duration
LastUpdatedAt *time.Time
EstimatedExpireAt *time.Time
}
TenantAccessToken .
type TenantAccessTokenInternalResponse ¶
type TenantAccessTokenInternalResponse struct {
BaseResponse
TenantAccessToken string `json:"tenant_access_token"`
Expire int `json:"expire"`
}
TenantAccessTokenInternalResponse .
type UpdateChatRequest ¶
type UpdateChatRequest struct {
Name string `json:"name,omitempty"`
Avatar string `json:"avatar,omitempty"`
Description string `json:"description,omitempty"`
I18NNames I18NNames `json:"i18n_names,omitempty"`
AddMemberPermission string `json:"add_member_permission,omitempty"`
AtAllPermission string `json:"at_all_permission,omitempty"`
EditPermission string `json:"edit_permission,omitempty"`
OwnerID string `json:"owner_id,omitempty"`
JoinMessageVisibility string `json:"join_message_visibility,omitempty"`
LeaveMessageVisibility string `json:"leave_message_visibility,omitempty"`
MembershipApproval string `json:"membership_approval,omitempty"`
}
UpdateChatRequest .
type UploadFileRequest ¶
type UploadFileRequest struct {
FileType string `json:"-"`
FileName string `json:"-"`
Duration int `json:"-"`
Path string `json:"-"`
Reader io.Reader `json:"-"`
}
UploadFileRequest .
type UploadFileResponse ¶
type UploadFileResponse struct {
BaseResponse
Data struct {
FileKey string `json:"file_key"`
} `json:"data"`
}
UploadFileResponse .
type UploadImageResponse ¶
type UploadImageResponse struct {
BaseResponse
Data struct {
ImageKey string `json:"image_key"`
} `json:"data"`
}
UploadImageResponse .
type UserAvatar ¶
type UserAvatar struct {
Avatar72 string `json:"avatar_72,omitempty"`
Avatar240 string `json:"avatar_240,omitempty"`
Avatar640 string `json:"avatar_640,omitempty"`
AvatarOrigin string `json:"avatar_origin,omitempty"`
}
UserAvatar .
type UserInfo ¶
type UserInfo struct {
OpenID string `json:"open_id,omitempty"`
Email string `json:"email,omitempty"`
UserID string `json:"user_id,omitempty"`
ChatID string `json:"chat_id,omitempty"`
UnionID string `json:"union_id,omitempty"`
Name string `json:"name,omitempty"`
EnglishName string `json:"en_name,omitempty"`
NickName string `json:"nickname,omitempty"`
Mobile string `json:"mobile,omitempty"`
MobileVisible bool `json:"mobile_visible,omitempty"`
Gender int `json:"gender,omitempty"`
Avatar UserAvatar `json:"avatar,omitempty"`
Status UserStatus `json:"status,omitempty"`
City string `json:"city,omitempty"`
Country string `json:"country,omitempty"`
WorkStation string `json:"work_station,omitempty"`
JoinTime int `json:"join_time,omitempty"`
EmployeeNo string `json:"employee_no,omitempty"`
EmployeeType int `json:"employee_type,omitempty"`
EnterpriseEmail string `json:"enterprise_email,omitempty"`
Geo string `json:"geo,omitempty"`
JobTitle string `json:"job_title,omitempty"`
JobLevelID string `json:"job_level_id,omitempty"`
JobFamilyID string `json:"job_family_id,omitempty"`
DepartmentIDs []string `json:"department_ids,omitempty"`
LeaderUserID string `json:"leader_user_id,omitempty"`
IsTenantManager bool `json:"is_tenant_manager,omitempty"`
}
UserInfo .
Source Files
¶
- api.go
- api_auth.go
- api_bot.go
- api_buzz_message.go
- api_chat.go
- api_contact.go
- api_message.go
- api_notification.go
- api_upload.go
- crypto.go
- emoji.go
- error.go
- event.go
- event_bot_added.go
- event_bot_deleted.go
- event_challenge.go
- event_chat_disbanded.go
- event_message_reaction_created.go
- event_message_reaction_deleted.go
- event_message_read.go
- event_message_recalled.go
- event_message_received.go
- event_user_added.go
- event_user_deleted.go
- http.go
- http_client.go
- lark.go
- locale.go
- logger.go
- message.go
- message_builder.go
- msg_buf.go
- msg_card_builder.go
- msg_post_builder.go
- msg_template_builder.go
- msg_text_builder.go
- user.go
- util.go