Documentation
¶
Index ¶
Constants ¶
View Source
const ( MediaTypeImage string = "image" MediaTypeVoice string = "voice" MediaTypeVideo string = "video" MediaTypeFile string = "file" )
OpenAPI doc: https://open.dingtalk.com/document/isvapp/upload-media-files
View Source
const (
MimeTypeImagePng string = "image/png"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type At ¶
type At struct {
AtUserIds []string `json:"atUserIds"`
AtMobiles []string `json:"atMobiles"`
IsAtAll bool `json:"isAtAll"`
}
at 内容
type DingTalkClient ¶ added in v1.0.20
type DingTalkClient struct {
Credential config.Credential
AccessToken string
// contains filtered or unexported fields
}
func NewDingTalkClient ¶ added in v1.0.20
func NewDingTalkClient(credential config.Credential) *DingTalkClient
func (*DingTalkClient) GetAccessToken ¶ added in v1.0.20
func (c *DingTalkClient) GetAccessToken() (string, error)
func (*DingTalkClient) UploadMedia ¶ added in v1.0.20
func (c *DingTalkClient) UploadMedia(content []byte, filename, mediaType, mimeType string) (*MediaUploadResult, error)
type DingTalkClientInterface ¶ added in v1.0.20
type DingTalkClientManager ¶ added in v1.0.20
type DingTalkClientManager struct {
Credentials []config.Credential
Clients map[string]*DingTalkClient
// contains filtered or unexported fields
}
func NewDingTalkClientManager ¶ added in v1.0.20
func NewDingTalkClientManager(conf *config.Configuration) *DingTalkClientManager
func (*DingTalkClientManager) GetClientByOAuthClientID ¶ added in v1.0.20
func (m *DingTalkClientManager) GetClientByOAuthClientID(clientId string) DingTalkClientInterface
type DingTalkClientManagerInterface ¶ added in v1.0.20
type DingTalkClientManagerInterface interface {
GetClientByOAuthClientID(clientId string) DingTalkClientInterface
}
type MarkDownMessage ¶
type MarkDownMessage struct {
MsgType MsgType `json:"msgtype"`
At *At `json:"at"`
MarkDown *MarkDown `json:"markdown"`
}
MarkDown 消息
type MediaUploadResult ¶ added in v1.0.20
type MsgType ¶
type MsgType string
消息类型
const MARKDOWN MsgType = "markdown"
const TEXT MsgType = "text"
type OAuthTokenResult ¶ added in v1.0.20
type ReceiveMsg ¶
type ReceiveMsg struct {
ConversationID string `json:"conversationId"`
AtUsers []struct {
DingtalkID string `json:"dingtalkId"`
} `json:"atUsers"`
ChatbotUserID string `json:"chatbotUserId"`
MsgID string `json:"msgId"`
SenderNick string `json:"senderNick"`
IsAdmin bool `json:"isAdmin"`
SenderStaffId string `json:"senderStaffId"`
SessionWebhookExpiredTime int64 `json:"sessionWebhookExpiredTime"`
CreateAt int64 `json:"createAt"`
ConversationType string `json:"conversationType"`
SenderID string `json:"senderId"`
ConversationTitle string `json:"conversationTitle"`
IsInAtList bool `json:"isInAtList"`
SessionWebhook string `json:"sessionWebhook"`
Text Text `json:"text"`
RobotCode string `json:"robotCode"`
Msgtype MsgType `json:"msgtype"`
}
接收的消息体
func (ReceiveMsg) GetChatTitle ¶ added in v1.0.7
func (r ReceiveMsg) GetChatTitle() (chatType string)
GetChatTitle 获取聊天的群名字,如果是私聊,则命名为 昵称_私聊
func (ReceiveMsg) GetSenderIdentifier ¶ added in v1.0.7
func (r ReceiveMsg) GetSenderIdentifier() (uid string)
获取用户标识,兼容当 SenderStaffId 字段为空的场景,此处提供给发送消息是艾特使用
func (ReceiveMsg) ReplyToDingtalk ¶
func (r ReceiveMsg) ReplyToDingtalk(msgType, msg string) (statuscode int, err error)
发消息给钉钉
type TextMessage ¶
type TextMessage struct {
MsgType MsgType `json:"msgtype"`
At *At `json:"at"`
Text *Text `json:"text"`
}
Text 消息
Click to show internal directories.
Click to hide internal directories.