message

package
v0.0.0-...-ff14b99 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LruCache *lru.Cache
)

Functions

func GenBinaryImageByPath

func GenBinaryImageByPath(path string, imageType protocol.ImageType) (*bytes.Buffer, string, error)

func GenBinaryImageByUrl

func GenBinaryImageByUrl(url string, imageType protocol.ImageType) (*bytes.Buffer, string, error)

func GetImageBinData

func GetImageBinData(ctx context.Context, tenantKey, appID, imageKey string) ([]byte, error)

func GetImageKey

func GetImageKey(ctx context.Context, tenantKey, appID, url, path string) (string, error)

GetImageKey: get imagekey, image_type = message

func NewATag

func NewATag(text string, unURLEncode bool, href string) *protocol.RichTextElementForm

func NewActionButton

func NewActionButton(text *protocol.TextForm, params map[string]string,
	category protocol.ButtonStyle, confirm *protocol.ConfirmForm, method string) *protocol.ButtonForm

new element button

func NewAtTag

func NewAtTag(text, userID string) *protocol.RichTextElementForm

func NewButton

func NewButton(text *protocol.TextForm, url *string, multiURL *protocol.URLForm, params map[string]string,
	category protocol.ButtonStyle, confirm *protocol.ConfirmForm, method string) *protocol.ButtonForm

new element button

func NewField

func NewField(short bool, text *protocol.TextForm) *protocol.FieldForm

func NewImage

func NewImage(alt *protocol.TextForm, imageKey string) *protocol.ImageForm

new element img

func NewImageTag

func NewImageTag(imageKey string, height int32, width int32) *protocol.RichTextElementForm

go can get imageKey by call the function "GetImageKey"

func NewJumpButton

func NewJumpButton(text *protocol.TextForm, url *string, multiURL *protocol.URLForm,
	category protocol.ButtonStyle) *protocol.ButtonForm

new element button

func NewJumpOption

func NewJumpOption(text protocol.TextForm, url *string, multiURL *protocol.URLForm) protocol.OptionForm

only be used for overflow elements

func NewMDText

func NewMDText(content string, lines *int, i18n *protocol.I18NForm, href map[string]protocol.URLForm) *protocol.TextForm

new element lark_md

func NewMultiPlatformURL

func NewMultiPlatformURL(Url *string, AndroidUrl *string, IOSUrl *string, PCUrl *string) *protocol.URLForm

func NewOption

func NewOption(text protocol.TextForm, value string) protocol.OptionForm

func NewOverflowMenu

func NewOverflowMenu(params map[string]string, options []protocol.OptionForm, confirm *protocol.ConfirmForm,
	method string) *protocol.OverflowForm

func NewPickerDate

func NewPickerDate(placeHolder *protocol.TextForm, params map[string]string,
	confirm *protocol.ConfirmForm, initialDate *string, method string) *protocol.PickerDateForm

new element picker date

func NewPickerDatetime

func NewPickerDatetime(placeHolder *protocol.TextForm, params map[string]string,
	confirm *protocol.ConfirmForm, initialDatetime *string, method string) *protocol.PickerDatetimeForm

new element picker datetime

func NewPickerTime

func NewPickerTime(placeHolder *protocol.TextForm, params map[string]string,
	confirm *protocol.ConfirmForm, initialTime *string, method string) *protocol.PickerTimeForm

new element picker time

func NewPlainText

func NewPlainText(content *string, i18n *protocol.I18NForm, lines *int) *protocol.TextForm

new element plain_text

func NewRichTextContent

func NewRichTextContent() *protocol.RichTextContent

func NewRichTextElementForm

func NewRichTextElementForm() *protocol.RichTextElementForm

func NewRichTextForm

func NewRichTextForm(title *string, content *protocol.RichTextContent) *protocol.RichTextForm

func NewSelectPersonMenu

func NewSelectPersonMenu(placeHolder *protocol.TextForm, params map[string]string,
	options []protocol.OptionForm, initOption *string, confirm *protocol.ConfirmForm, method string) *protocol.SelectorForm

func NewSelectStaticMenu

func NewSelectStaticMenu(placeHolder *protocol.TextForm, params map[string]string,
	options []protocol.OptionForm, initOption *string, confirm *protocol.ConfirmForm, method string) *protocol.SelectorForm

func NewTextTag

func NewTextTag(text string, unURLEncode bool, lines int32) *protocol.RichTextElementForm

func SendCardMessage

func SendCardMessage(ctx context.Context, tenantKey, appID string,
	user *protocol.UserInfo, rootID string,
	card protocol.CardForm, updateMulti bool) (*protocol.SendCardMsgResponse, error)

SendCardMessage: send card message @param ctx: context @param tenantKey: tenant key. If you don't know it, ask your tenant administrator @param appID: your app ID @param user: the user who you will send message to @param rootID: The open_message_id of the message that needs to be replied. If do not reply to the message, fill in empty string @param card: the cardForm that you will send. You can view the demo code in file card_builder_test.go @param updateMulti: Controls whether the card is a shared card (all users share the same message card), the default is false

func SendCardMessageBatch

func SendCardMessageBatch(ctx context.Context, tenantKey, appID string,
	info *protocol.BatchBaseInfo, rootID string,
	card protocol.CardForm, updateMulti bool) (*protocol.SendCardMsgBatchResponse, error)

SendCardMessageBatch: batch send card message @param ctx: context @param tenantKey: tenant key. If you don't know it, ask your tenant administrator @param appID: your app ID @param info: Department id list / user id list, you will send message to @param rootID: The open_message_id of the message that needs to be replied. If do not reply to the message, fill in empty string @param card: the cardForm that you will send. You can view the demo code in file card_builder_test.go @param updateMulti: Controls whether the card is a shared card (all users share the same message card), the default is false

func SendImageMessage

func SendImageMessage(ctx context.Context, tenantKey, appID string,
	user *protocol.UserInfo, rootID string,
	url, path, imageKey string) (*protocol.SendMsgResponse, error)

SendImageMessage: send image message @param ctx: context @param tenantKey: tenant key. If you don't know it, ask your tenant administrator @param appID: your app ID @param user: the user who you will send message to @param rootID: The open_message_id of the message that needs to be replied. If do not reply to the message, fill in empty string @param url, path, imageKey: the image that you will send. imageKey > path(The local path name of the image) > url(The URL of the image)

func SendImageMessageBatch

func SendImageMessageBatch(ctx context.Context, tenantKey, appID string,
	info *protocol.BatchBaseInfo, rootID string,
	url, path, imageKey string) (*protocol.SendMsgBatchResponse, error)

SendImageMessageBatch: batch send image message @param ctx: context @param tenantKey: tenant key. If you don't know it, ask your tenant administrator @param appID: your app ID @param info: Department id list / user id list, you will send message to @param rootID: The open_message_id of the message that needs to be replied. If do not reply to the message, fill in empty string @param url, path, imageKey: the image that you will send. imageKey > path(The local path name of the image) > url(The URL of the image)

func SendRichTextMessage

func SendRichTextMessage(ctx context.Context, tenantKey, appID string,
	user *protocol.UserInfo, rootID string,
	postForm map[protocol.Language]*protocol.RichTextForm) (*protocol.SendMsgResponse, error)

SendRichTextMessage: send richtext message @param ctx: context @param tenantKey: tenant key. If you don't know it, ask your tenant administrator @param appID: your app ID @param user: the user who you will send message to @param rootID: The open_message_id of the message that needs to be replied. If do not reply to the message, fill in empty string @param postForm: the postForm that you will send. You can view the demo code in file richtext_builder_test.go

func SendRichTextMessageBatch

func SendRichTextMessageBatch(ctx context.Context, tenantKey, appID string,
	info *protocol.BatchBaseInfo, rootID string,
	postForm map[protocol.Language]*protocol.RichTextForm) (*protocol.SendMsgBatchResponse, error)

SendRichTextMessageBatch: batch send richtext message @param ctx: context @param tenantKey: tenant key. If you don't know it, ask your tenant administrator @param appID: your app ID @param info: Department id list / user id list, you will send message to @param rootID: The open_message_id of the message that needs to be replied. If do not reply to the message, fill in empty string @param postForm: the postForm that you will send. You can view the demo code in file richtext_builder_test.go

func SendShareChatMessage

func SendShareChatMessage(ctx context.Context, tenantKey, appID string,
	user *protocol.UserInfo, rootID string,
	shareChatID string) (*protocol.SendMsgResponse, error)

SendShareChatMessage: send shared chat message @param ctx: context @param tenantKey: tenant key. If you don't know it, ask your tenant administrator @param appID: your app ID @param user: the user who you will send message to @param rootID: The open_message_id of the message that needs to be replied. If do not reply to the message, fill in empty string @param shareChatID: shared chat id

func SendShareChatMessageBatch

func SendShareChatMessageBatch(ctx context.Context, tenantKey, appID string,
	info *protocol.BatchBaseInfo, rootID string,
	shareChatID string) (*protocol.SendMsgBatchResponse, error)

SendShareChatMessageBatch: batch send shared chat message @param ctx: context @param tenantKey: tenant key. If you don't know it, ask your tenant administrator @param appID: your app ID @param info: Department id list / user id list, you will send message to @param rootID: The open_message_id of the message that needs to be replied. If do not reply to the message, fill in empty string @param shareChatID: shared chat id

func SendTextMessage

func SendTextMessage(ctx context.Context, tenantKey, appID string,
	user *protocol.UserInfo, rootID string,
	text string) (*protocol.SendMsgResponse, error)

SendTextMessage: send text message @param ctx: context @param tenantKey: tenant key. If you don't know it, ask your tenant administrator @param appID: your app ID @param user: the user who you will send message to @param rootID: The open_message_id of the message that needs to be replied. If do not reply to the message, fill in empty string @param text: the text that you will send

func SendTextMessageBatch

func SendTextMessageBatch(ctx context.Context, tenantKey, appID string,
	info *protocol.BatchBaseInfo, rootID string,
	text string) (*protocol.SendMsgBatchResponse, error)

SendTextMessageBatch: batch send text message @param ctx: context @param tenantKey: tenant key. If you don't know it, ask your tenant administrator @param appID: your app ID @param info: Department id list / user id list, you will send message to @param rootID: The open_message_id of the message that needs to be replied. If do not reply to the message, fill in empty string @param text: the text that you will send

func UpdateCard

func UpdateCard(ctx context.Context, tenantKey, appID string, token string, card protocol.CardForm) (*protocol.UpdateCardResponse, error)

UpdateCard: update card

func UploadImage

func UploadImage(ctx context.Context, tenantKey, appID string, body *bytes.Buffer, contentType string) (*protocol.UpLoadImageResponse, error)

Types

type CardBuilder

type CardBuilder struct {
	Header  *protocol.CardHeaderForm
	Conf    *protocol.ConfigForm
	OpenIDs []string
	Session *string
	// contains filtered or unexported fields
}

func (*CardBuilder) AddActionBlock

func (builder *CardBuilder) AddActionBlock(actions []protocol.ActionElement) *CardBuilder

add action block

func (*CardBuilder) AddDIVBlock

func (builder *CardBuilder) AddDIVBlock(text *protocol.TextForm, field []protocol.FieldForm, extra interface{}) *CardBuilder

add div block

func (*CardBuilder) AddHRBlock

func (builder *CardBuilder) AddHRBlock() *CardBuilder

add hr block

func (*CardBuilder) AddHeader

func (builder *CardBuilder) AddHeader(title protocol.TextForm, template string) *CardBuilder

add header @param title : TextForm, tag must be "plain_text". Can call the NewPlainText function to get it @param template : Reserved field. Fill in the empty string

func (*CardBuilder) AddImageBlock

func (builder *CardBuilder) AddImageBlock(title *protocol.TextForm, alt protocol.TextForm, imageKey string) *CardBuilder

add image block

func (*CardBuilder) AddNoteBlock

func (builder *CardBuilder) AddNoteBlock(elements []protocol.BaseElement) *CardBuilder

add note block

func (*CardBuilder) Build

func (builder *CardBuilder) Build() (data []byte, err error)

build card

func (*CardBuilder) BuildForm

func (builder *CardBuilder) BuildForm() (card *protocol.CardForm, err error)

build card

func (*CardBuilder) SetConfig

func (builder *CardBuilder) SetConfig(config protocol.ConfigForm) *CardBuilder

set ConfigForm

func (*CardBuilder) SetUpdatingUserGroup

func (builder *CardBuilder) SetUpdatingUserGroup(users []string) *CardBuilder

set updating user group

func (*CardBuilder) SwitchLocale

func (builder *CardBuilder) SwitchLocale(locale protocol.Language) *CardBuilder

switch to the i18n locale

Jump to

Keyboard shortcuts

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