protocol

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: 4 Imported by: 4

Documentation

Index

Constants

View Source
const (
	GrantTypeAuthCode     = "authorization_code"
	GrantTypeRefreshToken = "refresh_token"
)
View Source
const (
	ISVApp      = "isv"
	InternalApp = "internal"
)
View Source
const (
	CmdDefault  = "default"
	DescDefault = "defalut cmd"
)
View Source
const (
	IMG_E            = "img"
	BUTTON_E         = "button"
	SELECT_STATIC_E  = "select_static"
	SELECT_PERSON_E  = "select_person"
	OVERFLOW_E       = "overflow"
	PICKERDATE_E     = "picker_date"
	PICKERTIME_E     = "picker_time"
	PICKERDATETIME_E = "picker_datetime"

	PLAIN_TEXT_E = "plain_text"
	LARK_MD_E    = "lark_md"
)

card element

View Source
const (
	DIV_BLOCK    = "div"
	HR_BLOCK     = "hr" //halving line
	IMG_BLOCK    = "img"
	ACTION_BLOCK = "action"
	NOTE_BLOCK   = "note"
)

card block

View Source
const (
	// notification-type
	EventChallenge = "url_verification"
	EventCallback  = "event_callback"
)
View Source
const (
	// notification-subtype
	EventTypeApproval             = "approval"                                                         // notification--approval
	EventTypeLeaveApproval        = "leave_approval"                                                   // notification--leave_approval
	EventTypeWorkApproval         = "work_approval"                                                    // notification--work_approval
	EventTypeShiftApproval        = "shift_approval"                                                   // notification--shift_approval
	EventTypeRemedyApproval       = "remedy_approval"                                                  // notification--remedy_approval
	EventTypeTripApproval         = "trip_approval"                                                    // notification--trip_approval
	EventTypeAppOpen              = "app_open"                                                         // notification--app_open
	EventTypeContactUser          = "user_add,user_update,user_leave"                                  // notification--contact_user
	EventTypeContactDept          = "dept_add,dept_update,dept_delete"                                 // notification--contact_Department
	EventTypeContactScope         = "contact_scope_change"                                             // notification--contact_scope
	EventTypeMessage              = "message"                                                          // notification--message
	EventTypeRemoveBot            = "remove_bot"                                                       // notification--remove_bot
	EventTypeAddBot               = "add_bot"                                                          // notification--add_bot
	EventTypeP2PChatCreate        = "p2p_chat_create"                                                  // notification--p2p_chat_create
	EventTypeAppTicket            = "app_ticket"                                                       // notification--app_ticket
	EventTypeAppStatusChange      = "app_status_change"                                                // notification--app_status
	EventTypeUserToChat           = "add_user_to_chat,remove_user_from_chat,revoke_add_user_from_chat" // notification--add_user_to_chat
	EventTypeChatDisband          = "chat_disband"                                                     // notification--chat_disband
	EventTypeGroupSettingUpdate   = "group_setting_update"                                             // notification--group_setting_update
	EventTypeOrderPaid            = "order_paid"                                                       // notification--order_paid
	EventTypeCreateWidgetInstance = "create_widget_instance"                                           // notification--create_widget_instance
	EventTypeDeleteWidgetInstance = "delete_widget_instance"                                           // notification--delete_widget_instance
	EventTypeMessageRead          = "message_read"                                                     // notification--message_read
	EventTypeApprovalInstance     = "approval_instance"                                                // notification--approval_instance
	EventTypeAppUninstall         = "app_uninstalled"                                                  // notification--app_uninstalled
)
View Source
const (
	// message-type
	EventMsgTypeText         = "text"          // text
	EventMsgTypePost         = "post"          // rich_text/post
	EventMsgTypeImage        = "image"         // image
	EventMsgTypeMergeForward = "merge_forward" // merge forward
)
View Source
const (
	StartByTenant  = "start_by_tenant"
	StopByTenant   = "stop_by_tenant"
	StopByPlatform = "stop_by_platform"
)
View Source
const (
	ErrAppTicketNil              = 10003
	ErrAppTicketInvalid          = 10012
	ErrTenantAccessTokenInvalid  = 99991663
	ErrAppAccessTokenInvalid     = 99991664
	ErrMinaAppAccessTokenInvalid = 10202
)
View Source
const (
	VER = "1.0.0"
)

card meta

Variables

This section is empty.

Functions

func GenGetGroupInfoRequest

func GenGetGroupInfoRequest(chatID string) map[string]string

func GenGetGroupListRequest

func GenGetGroupListRequest(pageSize int, pageToken string) map[string]string

func GenMiniProgramLoginByIDSecretRequest

func GenMiniProgramLoginByIDSecretRequest(code, appID, appSecret string) map[string]string

func GetUUIDFromContext

func GetUUIDFromContext(ctx context.Context) string

func SetUUIDToContext

func SetUUIDToContext(ctx context.Context, uuid string) context.Context

Types

type ActionBlockForm

type ActionBlockForm struct {
	Tag     string          `json:"tag,omitempty" validate:"omitempty"`
	Actions []ActionElement `json:"actions,omitempty" validate:"omitempty"`
}

card block - action

type ActionElement

type ActionElement interface {
	BaseElement
	SetAction(method string, meta Meta)
	SetSession(session string)
}

interface - <button>, <datepicker>, <select>, <overflow>

type AddBotEvent

type AddBotEvent struct {
	BaseEvent

	ChatI18nNames       I18nNames `json:"chat_i18n_names"`
	ChatName            string    `json:"chat_name"`
	ChatOwnerEmployeeID string    `json:"chat_owner_employee_id"`
	ChatOwnerName       string    `json:"chat_owner_name"`
	ChatOwnerOpenID     string    `json:"chat_owner_open_id"`
	OpenChatID          string    `json:"open_chat_id"`
	OperatorEmployeeID  string    `json:"operator_employee_id"`
	OperatorName        string    `json:"operator_name"`
	OperatorOpenID      string    `json:"operator_open_id"`
	OwnerIsBot          bool      `json:"owner_is_bot"`
}

type AddUserToChatRequest

type AddUserToChatRequest struct {
	ChatID  string   `json:"chat_id,omitempty" validate:"omitempty"`
	UserIDs []string `json:"user_ids,omitempty" validate:"omitempty"`
	OpenIDs []string `json:"open_ids,omitempty" validate:"omitempty"`
}

type AddUserToChatResponse

type AddUserToChatResponse struct {
	BaseResponse
	Data struct {
		InvalidOpenIDs []string `json:"invalid_open_ids,omitempty" validate:"omitempty"`
		InvalidUserIDs []string `json:"invalid_user_ids,omitempty" validate:"omitempty"`
	} `json:"data,omitempty" validate:"omitempty"`
}

type AppOpenEvent

type AppOpenEvent struct {
	BaseEvent

	Applications      []UserIDInfo `json:"applicants"`
	Installer         UserIDInfo   `json:"installer"`
	InstallerEmployee UserIDInfo   `json:"installer_employee"`
}

notification--app open

type AppStatusChangeEvent

type AppStatusChangeEvent struct {
	BaseEvent

	Status string `json:"status"` // StartByTenant/StopByTenant/StopByPlatform
}

type AppTicketEvent

type AppTicketEvent struct {
	Type      string `json:"type"`
	AppID     string `json:"app_id"`
	AppTicket string `json:"app_ticket"`
}

notification--app_ticket

type AppTicketReq

type AppTicketReq struct {
	AppID     string `json:"app_id"`
	AppSecret string `json:"app_secret"`
}

AppTicketReq request

type AppTicketResp

type AppTicketResp struct {
	BaseResponse
}

AppTicketResp response

type AppUninstallEvent

type AppUninstallEvent struct {
	BaseEvent
}

AppUninstallEvent when company no longer uses the application

type ApprovalEvent

type ApprovalEvent struct {
	BaseEvent

	DefinitionCode string `json:"definition_code"`
	DefinitionName string `json:"definition_name"`
	InstanceCode   string `json:"instance_code"`
	StartTime      int64  `json:"start_time"`
	EndTime        int64  `json:"end_time"`
	Event          string `json:"event"` // result: approve/reject/cancel
}

type ApprovalInstanceEvent

type ApprovalInstanceEvent struct {
	BaseEvent

	ApprovalCode string `json:"approval_code"`
	InstanceCode string `json:"instance_code"`
	Status       string `json:"status"`
	OperateTime  string `json:"operate_time"`
}

type BaseElement

type BaseElement interface {
	// 获取基本组件的元素类型
	GetTag() string
}

interface - <img>, <lark_md>, <plain_text>

type BaseEvent

type BaseEvent struct {
	Type      string `json:"type"`
	AppID     string `json:"app_id"`
	TenantKey string `json:"tenant_key"`
}

type BaseInfo

type BaseInfo struct {

	// Send message to the user
	OpenID string `json:"open_id,omitempty" validate:"omitempty"`
	UserID string `json:"user_id,omitempty" validate:"omitempty"`
	Email  string `json:"email,omitempty" validate:"omitempty"`

	// send group message
	ChatID string `json:"chat_id,omitempty" validate:"omitempty"`

	// replay message
	RootID string `json:"root_id,omitempty" validate:"omitempty"`
}

message base info

func (*BaseInfo) SetBaseInfo

func (b *BaseInfo) SetBaseInfo(userInfo *UserInfo, rootID string)

type BaseResponse

type BaseResponse struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

type BatchBaseInfo

type BatchBaseInfo struct {
	DepartmentIDs []string `json:"department_ids,omitempty" validate:"omitempty"`
	OpenIDs       []string `json:"open_ids,omitempty" validate:"omitempty"`
	UserIDs       []string `json:"user_ids,omitempty" validate:"omitempty"`
}

message batch base info

type BotRecvMsg

type BotRecvMsg struct {
	AppID         string
	TenantKey     string
	MsgType       string
	TextParam     string
	RootID        string
	ParentID      string
	OpenChatID    string
	ChatType      string
	OpenID        string
	OpenMessageID string
	OriData       interface{}
}

type ButtonForm

type ButtonForm struct {
	Tag      string            `json:"tag,omitempty" validate:"omitempty"`
	Text     TextForm          `json:"text,omitempty" validate:"omitempty"`
	URL      *string           `json:"url,omitempty" validate:"omitempty"`
	MultiURL *URLForm          `json:"multi_url,omitempty" validate:"omitempty"`
	Params   map[string]string `json:"value,omitempty" validate:"omitempty"`
	Type     string            `json:"type,omitempty" validate:"omitempty"`
	Confirm  *ConfirmForm      `json:"confirm,omitempty" validate:"omitempty"`
	Webhook  *string           `json:"webhook,omitempty" validate:"omitempty"`
}

func (*ButtonForm) GetTag

func (form *ButtonForm) GetTag() string

func (*ButtonForm) SetAction

func (form *ButtonForm) SetAction(method string, meta Meta)

func (*ButtonForm) SetSession

func (form *ButtonForm) SetSession(session string)

type ButtonStyle

type ButtonStyle int
const (
	DEFAULT ButtonStyle = iota
	PRIMARY
	DANGER
	UNKNOWN
)

func (ButtonStyle) String

func (t ButtonStyle) String() string

type CallbackBase

type CallbackBase struct {
	Challenge string `json:"challenge"`
	Token     string `json:"token"`
	Type      string `json:"type"`
	Ts        string `json:"ts"`
	Uuid      string `json:"uuid"`
}

common field

type CardCallBackAction

type CardCallBackAction struct {
	Value    map[string]string `json:"value,omitempty" validate:"omitempty"`
	Tag      *string           `json:"tag,omitempty" validate:"omitempty"`
	Option   *string           `json:"option,omitempty" validate:"omitempty"`
	Timezone *string           `json:"timezone,omitempty" validate:"omitempty"`
}

type CardCallbackBase

type CardCallbackBase struct {
	OpenID        string  `json:"open_id,omitempty" validate:"omitempty"`
	UserID        string  `json:"user_id,omitempty" validate:"omitempty"`
	OpenMessageID string  `json:"open_message_id,omitempty" validate:"omitempty"`
	TenantKey     string  `json:"tenant_key,omitempty" validate:"omitempty"`
	Token         *string `json:"token,omitempty" validate:"omitempty"`
	Timezone      *string `json:"timezone,omitempty" validate:"omitempty"`
}

type CardCallbackForm

type CardCallbackForm struct {
	CardCallbackBase
	Action CardCallBackAction `json:"action,omitempty" validate:"omitempty"`
}

type CardChallenge

type CardChallenge struct {
	AppID     string `json:"appid,omitempty" validate:"omitempty"`
	Challenge string `json:"challenge,omitempty" validate:"omitempty"`
	Token     string `json:"token,omitempty" validate:"omitempty"`
	Type      string `json:"type,omitempty" validate:"omitempty"`
}

card callback

type CardForm

type CardForm struct {
	OpenIDs      []string                 `json:"open_ids,omitempty" validate:"omitempty"`
	Config       *ConfigForm              `json:"config,omitempty" validate:"omitempty"`
	CardLink     *URLForm                 `json:"card_link,omitempty" validate:"omitempty"`
	Header       *CardHeaderForm          `json:"header,omitempty" validate:"omitempty"`
	Elements     []interface{}            `json:"elements,omitempty" validate:"omitempty"`
	I18NElements map[string][]interface{} `json:"i18n_elements,omitempty" validate:"omitempty"`
}

type CardHeaderForm

type CardHeaderForm struct {
	Title    TextForm `json:"title,omitempty" validate:"omitempty"`
	Template string   `json:"template,omitempty" validate:"omitempty"`
}

type ChallengeResponse

type ChallengeResponse struct {
	Challenge string `json:"challenge"`
}

url challenge

type ChatDisbandEvent

type ChatDisbandEvent struct {
	BaseEvent

	ChatID   string     `json:"chat_id"`
	Operator UserIDInfo `json:"operator"`
}

type ConfigForm

type ConfigForm struct {
	MinVersion     VersionForm `json:"min_version,omitempty" validate:"omitempty"`
	Debug          bool        `json:"debug,omitempty" validate:"omitempty"`
	WideScreenMode bool        `json:"wide_screen_mode"`
	EnableForward  bool        `json:"enable_forward,omitempty" validate:"omitempty"`
}

card form

type ConfirmForm

type ConfirmForm struct {
	Title   TextForm `json:"title,omitempty" validate:"omitempty"`
	Text    TextForm `json:"text,omitempty" validate:"omitempty"`
	Confirm TextForm `json:"confirm,omitempty" validate:"omitempty"`
	Deny    TextForm `json:"deny,omitempty" validate:"omitempty"`
}

toast

type ContactDeptEvent

type ContactDeptEvent struct {
	BaseEvent

	OpenDepartmentID string `json:"open_department_id"`
}

type ContactScopeEvent

type ContactScopeEvent struct {
	BaseEvent
}

type ContactUserEvent

type ContactUserEvent struct {
	BaseEvent

	OpenID     string `json:"open_id"`
	EmployeeID string `json:"employee_id"`
}

notification--contact user

type CreateChatRequest

type CreateChatRequest struct {
	Name          string     `json:"name,omitempty" validate:"omitempty"`
	Description   string     `json:"description,omitempty" validate:"omitempty"`
	UserIDs       []string   `json:"user_ids,omitempty" validate:"omitempty"`
	OpenIDs       []string   `json:"open_ids,omitempty" validate:"omitempty"`
	ChatI18nNames *I18nNames `json:"i18n_names,omitempty" validate:"omitempty"`
}

type CreateChatResponse

type CreateChatResponse struct {
	BaseResponse
	Data struct {
		ChatID         string   `json:"chat_id,omitempty" validate:"omitempty"`
		InvalidOpenIDs []string `json:"invalid_open_ids,omitempty" validate:"omitempty"`
		InvalidUserIDs []string `json:"invalid_user_ids,omitempty" validate:"omitempty"`
	} `json:"data,omitempty" validate:"omitempty"`
}

type CreateWidgetInstanceEvent

type CreateWidgetInstanceEvent struct {
	BaseEvent

	InstanceId []string `json:"instance_id"`
}

type DIVBlockForm

type DIVBlockForm struct {
	Tag   string      `json:"tag,omitempty" validate:"omitempty"`
	Text  *TextForm   `json:"text,omitempty" validate:"omitempty"`
	Field []FieldForm `json:"fields,omitempty" validate:"omitempty"`
	Extra interface{} `json:"extra,omitempty" validate:"omitempty"`
}

card block - div

type DeleteUserFromChatRequest

type DeleteUserFromChatRequest struct {
	ChatID  string   `json:"chat_id,omitempty" validate:"omitempty"`
	UserIDs []string `json:"user_ids,omitempty" validate:"omitempty"`
	OpenIDs []string `json:"open_ids,omitempty" validate:"omitempty"`
}

type DeleteUserFromChatResponse

type DeleteUserFromChatResponse struct {
	BaseResponse
	Data struct {
		InvalidOpenIDs []string `json:"invalid_open_ids,omitempty" validate:"omitempty"`
		InvalidUserIDs []string `json:"invalid_user_ids,omitempty" validate:"omitempty"`
	} `json:"data,omitempty" validate:"omitempty"`
}

type DeleteWidgetInstanceEvent

type DeleteWidgetInstanceEvent struct {
	BaseEvent

	InstanceId []string `json:"instance_id"`
}

type DisbandChatRequest

type DisbandChatRequest struct {
	ChatID string `json:"chat_id,omitempty" validate:"omitempty"`
}

type DisbandChatResponse

type DisbandChatResponse struct {
	BaseResponse
}

type FieldForm

type FieldForm struct {
	Short bool     `json:"is_short,omitempty" validate:"omitempty"`
	Text  TextForm `json:"text,omitempty" validate:"omitempty"`
}

Field

type GetAppAccessTokenInternalReq

type GetAppAccessTokenInternalReq struct {
	AppID     string `json:"app_id"`
	AppSecret string `json:"app_secret"`
}

GetAppAccessToken Internal request

type GetAppAccessTokenInternalResp

type GetAppAccessTokenInternalResp struct {
	BaseResponse
	Expire            int    `json:"expire"`
	AppAccessToken    string `json:"app_access_token"`
	TenantAccessToken string `json:"tenant_access_token"`
}

GetAppAccessToken Internal response

type GetAppAccessTokenIsvReq

type GetAppAccessTokenIsvReq struct {
	AppID     string `json:"app_id"`
	AppSecret string `json:"app_secret"`
	AppTicket string `json:"app_ticket"`
}

GetAppAccessToken ISV request

type GetAppAccessTokenIsvResp

type GetAppAccessTokenIsvResp struct {
	BaseResponse
	Expire         int    `json:"expire"`
	AppAccessToken string `json:"app_access_token"`
}

GetAppAccessToken ISV response

type GetGroupInfoResponse

type GetGroupInfoResponse struct {
	BaseResponse

	Data struct {
		Group

		ChatI18nNames I18nNames    `json:"i18n_names,omitempty" validate:"omitempty"`
		Members       []UserIDInfo `json:"members,omitempty" validate:"omitempty"`
	} `json:"data,omitempty" validate:"omitempty"`
}

type GetGroupListResponse

type GetGroupListResponse struct {
	BaseResponse
	Data struct {
		Groups    []*Group `json:"groups,omitempty" validate:"omitempty"`
		HasMore   bool     `json:"has_more,omitempty" validate:"omitempty"`
		PageToken string   `json:"page_token,omitempty" validate:"omitempty"`
	} `json:"data,omitempty" validate:"omitempty"`
}

type GetTenantAccessTokenISVReq

type GetTenantAccessTokenISVReq struct {
	AppAccessToken string `json:"app_access_token"`
	TenantKey      string `json:"tenant_key"`
}

GetTenantAccessToken ISV App request

type GetTenantAccessTokenInternalReq

type GetTenantAccessTokenInternalReq struct {
	AppID     string `json:"app_id"`
	AppSecret string `json:"app_secret"`
}

GetTenantAccessToken Internal App request

type GetTenantAccessTokenResp

type GetTenantAccessTokenResp struct {
	BaseResponse
	Expire            int    `json:"expire"`
	TenantAccessToken string `json:"tenant_access_token"`
}

GetTenantAccessToken Internal/ISV response

type Group

type Group struct {
	Avatar      string `json:"avatar,omitempty" validate:"omitempty"`
	ChatID      string `json:"chat_id,omitempty" validate:"omitempty"`
	Description string `json:"description,omitempty" validate:"omitempty"`
	Name        string `json:"name,omitempty" validate:"omitempty"`
	OwnerOpenID string `json:"owner_open_id,omitempty" validate:"omitempty"`
	OwnerUserID string `json:"owner_user_id,omitempty" validate:"omitempty"`
}

type GroupSettingUpdateEvent

type GroupSettingUpdateEvent struct {
	BaseEvent

	ChatID   string     `json:"chat_id"`
	Operator UserIDInfo `json:"operator"`

	AfterChange struct {
		MessageNotification bool   `json:"message_notification"`  // case: change message notification
		AddMemberPermission string `json:"add_member_permission"` // case: change add-member permission
		OwnerOpenId         string `json:"owner_open_id"`         // case: change group owner
		OwnerUserId         string `json:"owner_user_id"`         // case: change group owner
	} `json:"after_change"`

	BeforeChange struct {
		MessageNotification bool   `json:"message_notification"`  // case: change message notification
		AddMemberPermission string `json:"add_member_permission"` // case: change add-member permission
		OwnerOpenId         string `json:"owner_open_id"`         // case: change group owner
		OwnerUserId         string `json:"owner_user_id"`         // case: change group owner
	} `json:"before_change"`
}

type HRBlockForm

type HRBlockForm struct {
	Tag string `json:"tag,omitempty" validate:"omitempty"`
}

card block - hr

type I18NForm

type I18NForm map[string]string

type I18nNames

type I18nNames struct {
	EnUs string `json:"en_us"`
	JaJp string `json:"ja_jp"`
	ZhCn string `json:"zh_cn"`
}

type ImageBlockForm

type ImageBlockForm struct {
	Tag      string    `json:"tag,omitempty" validate:"omitempty"`
	ImageKey string    `json:"img_key,omitempty" validate:"omitempty"`
	Title    *TextForm `json:"title,omitempty" validate:"omitempty"`
	Alt      TextForm  `json:"alt,omitempty" validate:"omitempty"`
}

card block - image

type ImageForm

type ImageForm struct {
	Tag      string   `json:"tag,omitempty" validate:"omitempty"`
	ImageKey string   `json:"img_key,omitempty" validate:"omitempty"`
	ALT      TextForm `json:"alt,omitempty" validate:"omitempty"`
}

func (*ImageForm) GetTag

func (form *ImageForm) GetTag() string

type ImageMsgEvent

type ImageMsgEvent struct {
	BaseEvent

	MsgType       string `json:"msg_type"`
	RootID        string `json:"root_id"`
	ParentID      string `json:"parent_id"`
	OpenChatID    string `json:"open_chat_id"`
	ChatType      string `json:"chat_type"`
	ImageHeight   string `json:"image_height"`
	ImageWidth    string `json:"image_width"`
	OpenID        string `json:"open_id"`
	OpenMessageID string `json:"open_message_id"`
	IsMention     bool   `json:"is_mention"`
	ImageKey      string `json:"image_key"`
	ImageUrl      string `json:"image_url"`
}

notification--message-image

type ImageType

type ImageType string
const (
	MessageImageType ImageType = "message"
	AvatarImageType  ImageType = "avatar"
)

type Language

type Language int64
const (
	LanguageUnknown Language = iota
	ZhCN
	EnUS
	JaJP
)

func (Language) String

func (i Language) String() string

type LeaveApprovalEvent

type LeaveApprovalEvent struct {
	BaseEvent

	InstanceCode   string `json:"instance_code"`
	EmployeeID     string `json:"employee_id"`
	StartTime      int64  `json:"start_time"`
	EndTime        int64  `json:"end_time"`
	LeaveType      string `json:"leave_type"`
	LeaveUnit      int    `json:"leave_unit"`       // unit 1: harf day, 2: one day
	LeaveStartTime string `json:"leave_start_time"` // YYYY-MM-DD HH:MM:ss
	LeaveEndTime   string `json:"leave_end_time"`   // YYYY-MM-DD HH:MM:ss
	LeaveInterval  int    `json:"leave_interval"`   // unit seconds, 7200: 2 hours
	LeaveReason    string `json:"leave_reason"`
}

type MergeForwardMsgEvent

type MergeForwardMsgEvent struct {
	BaseEvent

	MsgType       string        `json:"msg_type"`
	RootID        string        `json:"root_id"`
	ParentID      string        `json:"parent_id"`
	OpenChatID    string        `json:"open_chat_id"`
	OpenID        string        `json:"open_id"`
	OpenMessageID string        `json:"open_message_id"`
	IsMention     bool          `json:"is_mention"`
	ChatType      string        `json:"chat_type"`
	ChartID       string        `json:"chat_id"`
	User          string        `json:"user"`
	MsgList       []interface{} `json:"msg_list"` // TextMsgEvent/PostMsgEvent/ImageMsgEvent
}

notification--message-merge_forward

type MessageContent

type MessageContent struct {
	Text            string                   `json:"text,omitempty" validate:"omitempty"`
	Title           string                   `json:"title,omitempty" validate:"omitempty"`
	ImageKey        string                   `json:"image_key,omitempty" validate:"omitempty"`
	Post            map[string]*RichTextForm `json:"post,omitempty" validate:"omitempty"`
	ShareOpenChatID string                   `json:"share_open_chat_id,omitempty" validate:"omitempty"`
}

type MessageReadEvent

type MessageReadEvent struct {
	BaseEvent

	OpenChatID     string   `json:"open_chat_id"`
	OpenID         string   `json:"open_id"`
	OpenMessageIDs []string `json:"open_message_ids"`
}

type MessageType

type MessageType string
const (
	TextMsgType      MessageType = "text"
	ImageMsgType     MessageType = "image"
	PostMsgType      MessageType = "post"
	ShareChatMsgType MessageType = "share_chat"
	CardMsgType      MessageType = "interactive"
)

type Meta

type Meta struct {
	SDKVersion string `json:"sdk_version,omitempty" validate:"omitempty"`
}

card meta info

func NewMeta

func NewMeta() *Meta

type MiniProgramLoginByAppTokenRequest

type MiniProgramLoginByAppTokenRequest struct {
	Code string `json:"code"`
}

type MiniProgramLoginByAppTokenResponse

type MiniProgramLoginByAppTokenResponse struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`

	Data struct {
		MiniProgramUserToken
	} `json:"data"`
}

type MiniProgramLoginByIDSecretResponse

type MiniProgramLoginByIDSecretResponse struct {
	Code int    `json:"error"`
	Msg  string `json:"message"`

	MiniProgramUserToken
}

type MiniProgramUserToken

type MiniProgramUserToken struct {
	AccessToken  string `json:"access_token"` // user_access_token
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	TenantKey    string `json:"tenant_key"`
	OpenID       string `json:"open_id"`
	UnionID      string `json:"union_id"`
	SessionKey   string `json:"session_key"`
}

type NoteBlockForm

type NoteBlockForm struct {
	Tag      string        `json:"tag,omitempty" validate:"omitempty"`
	Elements []BaseElement `json:"elements,omitempty" validate:"omitempty"`
}

card block - note

type OpenApiPath

type OpenApiPath string
const (
	GetAppAccessTokenInternalPath    OpenApiPath = "/open-apis/auth/v3/app_access_token/internal/"
	GetAppAccessTokenIsvPath         OpenApiPath = "/open-apis/auth/v3/app_access_token/"
	GetTenantAccessTokenInternalPath OpenApiPath = "/open-apis/auth/v3/tenant_access_token/internal/"
	GetTenantAccessTokenIsvPath      OpenApiPath = "/open-apis/auth/v3/tenant_access_token/"
	ResendAppTicketPath              OpenApiPath = "/open-apis/auth/v3/app_ticket/resend"
	SendMessagePath                  OpenApiPath = "/open-apis/message/v4/send/"
	SendMessageBatchPath             OpenApiPath = "/open-apis/message/v4/batch_send/"
	UploadImagePath                  OpenApiPath = "/open-apis/image/v4/put/"
	GetImagePath                     OpenApiPath = "/open-apis/image/v4/get"
	GetChatInfoPath                  OpenApiPath = "/open-apis/chat/v4/info/"
	GetChatListPath                  OpenApiPath = "/open-apis/chat/v4/list/"
	UpdateChatInfoPath               OpenApiPath = "/open-apis/chat/v4/update/"
	CreateChatPath                   OpenApiPath = "/open-apis/chat/v4/create/"
	AddUserToChatPath                OpenApiPath = "/open-apis/chat/v4/chatter/add/"
	DeleteUserFromChatPath           OpenApiPath = "/open-apis/chat/v4/chatter/delete/"
	DisbandChatPath                  OpenApiPath = "/open-apis/chat/v4/disband/"
	CardUpdatePath                   OpenApiPath = "/open-apis/interactive/v1/card/update"
	MPValidateByAppTokenPath         OpenApiPath = "/open-apis/mina/v2/tokenLoginValidate"   //mini programe login validate, ExchangeToken
	MPValidateByIDSecretPath         OpenApiPath = "/open-apis/mina/loginValidate"           //mini programe login validate, ExchangeToken
	OpenSSOValidatePath              OpenApiPath = "/connect/qrconnect/oauth2/access_token/" //open sso login validate, ExchangeToken/RefreshToken
	OpenSSOGetCodePath               OpenApiPath = "/connect/qrconnect/page/sso/"            //open sso, GetCode
)

type OpenSSOTokenRequest

type OpenSSOTokenRequest struct {
	//(app_id + app_secret)/app_access_token, two ways to choose one. app_access_token is recommended
	AppID          string `json:"app_id"`
	AppSecret      string `json:"app_secret"`
	AppAccessToken string `json:"app_access_token"`
	GrantType      string `json:"grant_type"`    // authorization_code / refresh_token
	Code           string `json:"code"`          // required when GrantType=authorization_code
	RefreshToken   string `json:"refresh_token"` // required when GrantType=refresh_token
}

type OpenSSOTokenResponse

type OpenSSOTokenResponse struct {
	Code int    `json:"code"`
	Msg  string `json:"message"`

	UserTokenInfo
}

type OptionForm

type OptionForm struct {
	Text     TextForm `json:"text,omitempty" validate:"omitempty"`
	Value    string   `json:"value,omitempty" validate:"omitempty"`
	URL      *string  `json:"url,omitempty" validate:"omitempty"`
	MultiURL *URLForm `json:"multi_url,omitempty" validate:"omitempty"`
}

select menu

type OrderPaidEvent

type OrderPaidEvent struct {
	BaseEvent

	OrderID       string `json:"order_id"`
	PricePlanID   string `json:"price_plan_id"`
	PricePlanType string `json:"price_plan_type"`
	Seats         int    `json:"seats"`
	BuyCount      int    `json:"buy_count"`
	CreateTime    string `json:"create_time"`
	PayTime       string `json:"pay_time"`
	BuyType       string `json:"buy_type"`
	SrcOrderID    string `json:"src_order_id"`
	OrderPayPrice int    `json:"order_pay_price"`
}

type OverflowForm

type OverflowForm struct {
	Tag     string            `json:"tag,omitempty" validate:"omitempty"`
	Options []OptionForm      `json:"options,omitempty" validate:"omitempty"`
	Params  map[string]string `json:"value,omitempty" validate:"omitempty"`
	Confirm *ConfirmForm      `json:"confirm,omitempty" validate:"omitempty"`
}

overflow

func (*OverflowForm) GetTag

func (form *OverflowForm) GetTag() string

func (*OverflowForm) SetAction

func (form *OverflowForm) SetAction(method string, meta Meta)

func (*OverflowForm) SetSession

func (form *OverflowForm) SetSession(session string)

type P2PChatCreateEvent

type P2PChatCreateEvent struct {
	BaseEvent

	ChatID   string     `json:"chat_id"`
	Operator UserIDInfo `json:"operator"`
	User     struct {
		Name string `json:"name"`
		UserIDInfo
	} `json:"user"`
}

type PickerDateForm

type PickerDateForm struct {
	Tag         string            `json:"tag,omitempty" validate:"omitempty"`
	Placeholder *TextForm         `json:"placeholder,omitempty" validate:"omitempty"`
	Params      map[string]string `json:"value,omitempty" validate:"omitempty"`
	Confirm     *ConfirmForm      `json:"confirm,omitempty" validate:"omitempty"`
	InitialDate *string           `json:"initial_date,omitempty" validate:"omitempty"`
}

Picker Date

func (*PickerDateForm) GetTag

func (form *PickerDateForm) GetTag() string

func (*PickerDateForm) SetAction

func (form *PickerDateForm) SetAction(method string, meta Meta)

func (*PickerDateForm) SetSession

func (form *PickerDateForm) SetSession(session string)

type PickerDatetimeForm

type PickerDatetimeForm struct {
	Tag             string            `json:"tag,omitempty" validate:"omitempty"`
	Placeholder     *TextForm         `json:"placeholder,omitempty" validate:"omitempty"`
	Params          map[string]string `json:"value,omitempty" validate:"omitempty"`
	Confirm         *ConfirmForm      `json:"confirm,omitempty" validate:"omitempty"`
	InitialDatetime *string           `json:"initial_datetime,omitempty" validate:"omitempty"`
}

PickerDatetime控件

func (*PickerDatetimeForm) GetTag

func (form *PickerDatetimeForm) GetTag() string

func (*PickerDatetimeForm) SetAction

func (form *PickerDatetimeForm) SetAction(method string, meta Meta)

func (*PickerDatetimeForm) SetSession

func (form *PickerDatetimeForm) SetSession(session string)

type PickerTimeForm

type PickerTimeForm struct {
	Tag         string            `json:"tag,omitempty" validate:"omitempty"`
	Placeholder *TextForm         `json:"placeholder,omitempty" validate:"omitempty"`
	Params      map[string]string `json:"value,omitempty" validate:"omitempty"`
	Confirm     *ConfirmForm      `json:"confirm,omitempty" validate:"omitempty"`
	InitialTime *string           `json:"initial_time,omitempty" validate:"omitempty"`
}

Picker Time

func (*PickerTimeForm) GetTag

func (form *PickerTimeForm) GetTag() string

func (*PickerTimeForm) SetAction

func (form *PickerTimeForm) SetAction(method string, meta Meta)

func (*PickerTimeForm) SetSession

func (form *PickerTimeForm) SetSession(session string)

type PostMsgEvent

type PostMsgEvent struct {
	BaseEvent

	MsgType          string   `json:"msg_type"`
	RootID           string   `json:"root_id"`
	ParentID         string   `json:"parent_id"`
	OpenChatID       string   `json:"open_chat_id"`
	ChatType         string   `json:"chat_type"`
	OpenID           string   `json:"open_id"`
	OpenMessageID    string   `json:"open_message_id"`
	IsMention        bool     `json:"is_mention"`
	Text             string   `json:"text"`
	TextWithoutAtBot string   `json:"text_without_at_bot"`
	Title            string   `json:"title"`
	ImageKeys        []string `json:"image_keys"`
}

notification--message-richtext/post

type RemedyApprovalEvent

type RemedyApprovalEvent struct {
	BaseEvent

	InstanceCode string `json:"instance_code"`
	EmployeeID   string `json:"employee_id"`
	StartTime    int64  `json:"start_time"`
	EndTime      int64  `json:"end_time"`
	RemedyTime   string `json:"remedy_time"`
	RemedyReason string `json:"remedy_reason"`
}

type RemoveBotEvent

type RemoveBotEvent struct {
	BaseEvent

	ChatI18nNames       I18nNames `json:"chat_i18n_names"`
	ChatName            string    `json:"chat_name"`
	ChatOwnerEmployeeID string    `json:"chat_owner_employee_id"`
	ChatOwnerName       string    `json:"chat_owner_name"`
	ChatOwnerOpenID     string    `json:"chat_owner_open_id"`
	OpenChatID          string    `json:"open_chat_id"`
	OperatorEmployeeID  string    `json:"operator_employee_id"`
	OperatorName        string    `json:"operator_name"`
	OperatorOpenID      string    `json:"operator_open_id"`
	OwnerIsBot          bool      `json:"owner_is_bot"`
}

type RichTextContent

type RichTextContent [][]RichTextElementForm

func (*RichTextContent) AddElementBlock

func (r *RichTextContent) AddElementBlock(elements ...*RichTextElementForm) *RichTextContent

type RichTextElementForm

type RichTextElementForm struct {
	Tag      string  `json:"tag,omitempty" validate:"omitempty"`
	Text     *string `json:"text,omitempty" validate:"omitempty"`
	Lines    *int32  `json:"lines,omitempty" validate:"omitempty,min=1,max=100"`
	UnEscape bool    `json:"un_escape,omitempty" validate:"omitempty"`
	//--------------------A-----------------------
	Href string `json:"href,omitempty" validate:"omitempty"`
	//--------------------Image-----------------------
	ImageKey string `json:"image_key,omitempty" validate:"omitempty"`
	Height   int32  `json:"height,omitempty" validate:"omitempty"`
	Width    int32  `json:"width,omitempty" validate:"omitempty"`
	//--------------------At------------------------
	UserID string `json:"user_id,omitempty" validate:"omitempty"`
}

type RichTextForm

type RichTextForm struct {
	Title   string           `json:"title" validate:"omitempty"`
	Content *RichTextContent `json:"content" validate:"omitempty"`
}

type Schedule

type Schedule struct {
	TripStartTime  string `json:"trip_start_time"` // YYYY-MM-DD HH:MM:ss
	TripEndTime    string `json:"trip_end_time"`   // YYYY-MM-DD HH:MM:ss
	TripInterval   int    `json:"trip_interval"`   // unit seconds
	Departure      string `json:"departure"`
	Destination    string `json:"destination"`
	Transportation string `json:"transportation"`
	TripType       string `json:"trip_type"`
	Remark         string `json:"remark"`
}

type SelectorForm

type SelectorForm struct {
	Tag           string            `json:"tag,omitempty" validate:"omitempty"`
	Placeholder   *TextForm         `json:"placeholder,omitempty" validate:"omitempty"`
	Options       []OptionForm      `json:"options,omitempty" validate:"omitempty"`
	InitialOption *string           `json:"initial_option,omitempty" validate:"omitempty"`
	Params        map[string]string `json:"value,omitempty" validate:"omitempty"`
	Confirm       *ConfirmForm      `json:"confirm,omitempty" validate:"omitempty"`
}

selector

func (*SelectorForm) GetTag

func (form *SelectorForm) GetTag() string

func (*SelectorForm) SetAction

func (form *SelectorForm) SetAction(method string, meta Meta)

func (*SelectorForm) SetSession

func (form *SelectorForm) SetSession(session string)

type SendCardMsgBatchRequest

type SendCardMsgBatchRequest struct {
	BatchBaseInfo

	MsgType     string   `json:"msg_type,omitempty" validate:"required"`
	Card        CardForm `json:"card,omitempty" validate:"omitempty"`
	UpdateMulti bool     `json:"update_multi" validate:"omitempty"`
}

func NewBatchCardMsgReq

func NewBatchCardMsgReq(info *BatchBaseInfo, rootID string, card CardForm, updateMulti bool) *SendCardMsgBatchRequest

type SendCardMsgBatchResponse

type SendCardMsgBatchResponse struct {
	BaseResponse

	Data struct {
		MessageID            string   `json:"message_id,omitempty" validate:"omitempty"`
		InvalidDepartmentIDs []string `json:"invalid_department_ids,omitempty" validate:"omitempty"`
		InvalidOpenIDs       []string `json:"invalid_open_ids,omitempty" validate:"omitempty"`
		InvalidUserIDs       []string `json:"invalid_user_ids,omitempty" validate:"omitempty"`
	} `json:"data,omitempty" validate:"omitempty"`
}

type SendCardMsgRequest

type SendCardMsgRequest struct {
	BaseInfo

	UUID        *string  `json:"uuid,omitempty" validate:"omitempty"` // use it by call func SetUUIDToContext
	MsgType     string   `json:"msg_type,omitempty" validate:"required"`
	Card        CardForm `json:"card,omitempty" validate:"omitempty"`
	UpdateMulti bool     `json:"update_multi" validate:"omitempty"`
}

func NewCardMsgReq

func NewCardMsgReq(user *UserInfo, rootID string, card CardForm, updateMulti bool) *SendCardMsgRequest

type SendCardMsgResponse

type SendCardMsgResponse struct {
	BaseResponse

	Data struct {
		MessageID string `json:"message_id,omitempty" validate:"omitempty"`
	} `json:"data,omitempty" validate:"omitempty"`
}

type SendMsgBatchRequest

type SendMsgBatchRequest struct {
	BatchBaseInfo

	MsgType string         `json:"msg_type,omitempty" validate:"required"`
	Content MessageContent `json:"content,omitempty" validate:"required"`
}

func NewBatchImageMsgReq

func NewBatchImageMsgReq(info *BatchBaseInfo, rootID string, imageKey string) *SendMsgBatchRequest

func NewBatchPostMsgReq

func NewBatchPostMsgReq(info *BatchBaseInfo, rootID string, post map[string]*RichTextForm) *SendMsgBatchRequest

func NewBatchShareChatMsgReq

func NewBatchShareChatMsgReq(info *BatchBaseInfo, rootID string, shareChatID string) *SendMsgBatchRequest

func NewBatchTextMsgReq

func NewBatchTextMsgReq(info *BatchBaseInfo, rootID string, text string) *SendMsgBatchRequest

type SendMsgBatchResponse

type SendMsgBatchResponse struct {
	BaseResponse

	Data struct {
		MessageID            string   `json:"message_id,omitempty" validate:"omitempty"`
		InvalidDepartmentIDs []string `json:"invalid_department_ids,omitempty" validate:"omitempty"`
		InvalidOpenIDs       []string `json:"invalid_open_ids,omitempty" validate:"omitempty"`
		InvalidUserIDs       []string `json:"invalid_user_ids,omitempty" validate:"omitempty"`
	} `json:"data,omitempty" validate:"omitempty"`
}

type SendMsgRequest

type SendMsgRequest struct {
	BaseInfo

	UUID    *string        `json:"uuid,omitempty" validate:"omitempty"` // use it by call func SetUUIDToContext
	MsgType string         `json:"msg_type,omitempty" validate:"required"`
	Content MessageContent `json:"content,omitempty" validate:"required"`
}

func NewImageMsgReq

func NewImageMsgReq(user *UserInfo, rootID string, imageKey string) *SendMsgRequest

func NewPostMsgReq

func NewPostMsgReq(user *UserInfo, rootID string, post map[string]*RichTextForm) *SendMsgRequest

func NewShareChatMsgReq

func NewShareChatMsgReq(user *UserInfo, rootID string, shareChatID string) *SendMsgRequest

func NewTextMsgReq

func NewTextMsgReq(user *UserInfo, rootID string, text string) *SendMsgRequest

type SendMsgResponse

type SendMsgResponse struct {
	BaseResponse

	Data struct {
		MessageID string `json:"message_id,omitempty" validate:"omitempty"`
	} `json:"data,omitempty" validate:"omitempty"`
}

type ShiftApprovalEvent

type ShiftApprovalEvent struct {
	BaseEvent

	InstanceCode string `json:"instance_code"`
	EmployeeID   string `json:"employee_id"`
	StartTime    int64  `json:"start_time"`
	EndTime      int64  `json:"end_time"`
	ShiftTime    string `json:"shift_time"`
	ReturnTime   string `json:"return_time"`
	ShiftReason  string `json:"shift_reason"`
}

type TextForm

type TextForm struct {
	Tag     string             `json:"tag,omitempty" validate:"omitempty"`
	Content *string            `json:"content,omitempty" validate:"omitempty"`
	Lines   *int               `json:"lines,omitempty" validate:"omitempty"`
	I18N    *I18NForm          `json:"i18n,omitempty" validate:"omitempty"`
	Href    map[string]URLForm `json:"href,omitempty" validate:"omitempty"`
}

func (*TextForm) GetTag

func (form *TextForm) GetTag() string

type TextMsgEvent

type TextMsgEvent struct {
	BaseEvent

	MsgType          string `json:"msg_type"`
	RootID           string `json:"root_id"`
	ParentID         string `json:"parent_id"`
	OpenChatID       string `json:"open_chat_id"`
	ChatType         string `json:"chat_type"`
	OpenID           string `json:"open_id"`
	OpenMessageID    string `json:"open_message_id"`
	IsMention        bool   `json:"is_mention"`
	Text             string `json:"text"`
	TextWithoutAtBot string `json:"text_without_at_bot"`
}

notification--message-text

type ToastTips

type ToastTips struct {
	Content string            `json:"content,omitempty" validate:"omitempty"`
	I18N    map[string]string `json:"i18n,omitempty" validate:"omitempty"`
}

type TripApprovalEvent

type TripApprovalEvent struct {
	BaseEvent

	InstanceCode string     `json:"instance_code"`
	EmployeeID   string     `json:"employee_id"`
	StartTime    int64      `json:"start_time"`
	EndTime      int64      `json:"end_time"`
	Schedules    []Schedule `json:"schedules"`
	TripInterval int        `json:"trip_interval"` // total duration, unit seconds
	TripReason   string     `json:"trip_reason"`
	TripPeers    []string   `json:"trip_peers"`
}

type URLForm

type URLForm struct {
	Url        *string `json:"url,omitempty" validate:"omitempty"`
	AndroidUrl *string `json:"android_url,omitempty" validate:"omitempty"`
	IOSUrl     *string `json:"ios_url,omitempty" validate:"omitempty"`
	PCUrl      *string `json:"pc_url,omitempty" validate:"omitempty"`
}

type UpLoadImageResponse

type UpLoadImageResponse struct {
	BaseResponse
	Data struct {
		ImageKey string `json:"image_key,omitempty" validate:"omitempty"`
	} `json:"data,omitempty" validate:"omitempty"`
}

type UpdateCardRequest

type UpdateCardRequest struct {
	Token string   `json:"token" validate:"omitempty"`
	Card  CardForm `json:"card" validate:"omitempty"`
}

type UpdateCardResponse

type UpdateCardResponse struct {
	BaseResponse
}

type UpdateChatInfoRequest

type UpdateChatInfoRequest struct {
	ChatID        string     `json:"chat_id,omitempty" validate:"omitempty"`
	OwnerUserID   *string    `json:"owner_user_id,omitempty" validate:"omitempty"`
	OwnerOpenID   *string    `json:"owner_open_id,omitempty" validate:"omitempty"`
	Name          *string    `json:"name,omitempty" validate:"omitempty"`
	ChatI18nNames *I18nNames `json:"i18n_names,omitempty" validate:"omitempty"`
}

type UpdateChatInfoResponse

type UpdateChatInfoResponse struct {
	BaseResponse
	Data struct {
		ChatID string `json:"chat_id,omitempty" validate:"omitempty"`
	} `json:"data,omitempty" validate:"omitempty"`
}

type UserIDInfo

type UserIDInfo struct {
	OpenID string `json:"open_id"`
	UserID string `json:"user_id"`
}

type UserInfo

type UserInfo struct {
	ID   string
	Type UserType
}

type UserToChatEvent

type UserToChatEvent struct {
	BaseEvent

	ChatID   string     `json:"chat_id"`
	Operator UserIDInfo `json:"operator"`
	Users    []struct {
		Name string `json:"name"`
		UserIDInfo
	} `json:"users"`
}

type UserTokenInfo

type UserTokenInfo struct {
	AccessToken  string `json:"access_token"` // user_access_token
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	TenantKey    string `json:"tenant_key"`
	OpenID       string `json:"open_id"`
	EmployeeID   string `json:"employee_id"`
	Name         string `json:"name"`
	ENName       string `json:"en_name"`
	AvatarURL    string `json:"avatar_url"`
}

type UserType

type UserType int64
const (
	UserTypeUnknown UserType = iota
	UserTypeOpenID
	UserTypeUserID
	UserTypeEmail
	UserTypeChatID
)

type VersionForm

type VersionForm struct {
	Version        string `json:"version,omitempty" validate:"omitempty"`
	AndroidVersion string `json:"android_version,omitempty" validate:"omitempty"`
	IOSVersion     string `json:"ios_version,omitempty" validate:"omitempty"`
	PCVersion      string `json:"pc_version,omitempty" validate:"omitempty"`
}

type WorkApprovalEvent

type WorkApprovalEvent struct {
	BaseEvent

	InstanceCode  string `json:"instance_code"`
	EmployeeID    string `json:"employee_id"`
	StartTime     int64  `json:"start_time"`
	EndTime       int64  `json:"end_time"`
	WorkType      string `json:"work_type"`
	WorkStartTime string `json:"work_start_time"`
	WorkEndTime   string `json:"work_end_time"`
	WorkInterval  int    `json:"work_interval"` // unit seconds, 7200: 2 hours
	WorkReason    string `json:"work_reason"`
}

Jump to

Keyboard shortcuts

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