dingtalk

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

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

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

Documentation

Index

Constants

View Source
const (
	DingDingOptionYes = 1
	DingDingOptionNo  = 0
)
View Source
const (
	DingDingAppMessageTypeText       = "text"
	DingDingAppMessageTypeImage      = "image"
	DingDingAppMessageTypeVoice      = "voice"
	DingDingAppMessageTypeFile       = "file"
	DingDingAppMessageTypeLink       = "link"
	DingDingAppMessageTypeOA         = "oa"
	DingDingAppMessageTypeMarkdown   = "markdown"
	DingDingAppMessageTypeActionCard = "action_card"
)
View Source
const (
	DingDingRobotMessageTypeText       = "text"
	DingDingRobotMessageTypeLink       = "link"
	DingDingRobotMessageTypeMarkdown   = "markdown"
	DingDingRobotMessageTypeActionCard = "actionCard"
	DingDingRobotMessageTypeFeedCard   = "feedCard"
)
View Source
const (
	DingDingActionCardMessageButtonOrientationVertical   = "0"
	DingDingActionCardMessageButtonOrientationHorizontal = "1"
)
View Source
const DingDingAppCreateGroupAPI = "https://oapi.dingtalk.com/chat/create"

DingDingAppCreateGroupAPI is the api to create dingding group

View Source
const DingDingAppGetGroupAPI = "https://oapi.dingtalk.com/chat/get"

DingDingAppGetGroupAPI is the api to get dingding group

View Source
const DingDingAppGetMessageSendProgressAPI = "https://oapi.dingtalk.com/topapi/message/corpconversation/getsendprogress"

DingDingAppGetMessageSendProgressAPI is the api to get the message send progress

View Source
const DingDingAppGetMessageSendResultAPI = "https://oapi.dingtalk.com/topapi/message/corpconversation/getsendresult"

DingDingAppGetMessageSendResultAPI is the api to get the message send result

View Source
const DingDingAppRecallMessageAPI = "https://oapi.dingtalk.com/topapi/message/corpconversation/recall"

DingDingAppRecallMessageAPI is the api to recall the message

View Source
const DingDingAppSendGroupMessageAPI = "https://oapi.dingtalk.com/chat/send"

DingDingAppSendGroupMessageAPI is the api to send message to group

View Source
const DingDingAppSendMessageAPI = "https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2"

DingDingAppSendMessageAPI is the api to send message to end users

View Source
const DingDingAppStatusOK = 0

DingDingAppStatusOK is the ok status of api call

View Source
const DingDingAppTimeout = time.Second * 10

DingDingAppTimeout is the dingding app default timeout

View Source
const DingDingAppTokenAPI = "https://oapi.dingtalk.com/gettoken"

DingDingAppTokenAPI is the api to get app access token

View Source
const DingDingAppUpdateGroupAPI = "https://oapi.dingtalk.com/chat/update"

DingDingAppUpdateGroupAPI is the api to update dingding group

View Source
const DingDingCodeAccessTokenExpired = 42001

See doc https://ding-doc.dingtalk.com/doc#/faquestions/rftpfg

View Source
const DingDingRobotMessageAPI = "https://oapi.dingtalk.com/robot/send"

DingDingRobotMessageAPI is the api to send the robot messages

View Source
const DingDingRobotStatusOK = 0

DingDingRobotStatusOK is the ok status of api call

View Source
const DingDingRobotTimeout = time.Second * 10

DingDingRobotTimeout is the dingding robot default timeout

Variables

This section is empty.

Functions

func HmacSha256

func HmacSha256(data []byte, secret []byte) (output []byte)

HmacSha256 hash the data using algorithm hmac-sha1

Types

type DingDingApp

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

func NewDingDingApp

func NewDingDingApp(appKey, appSecret, agentID string) *DingDingApp

NewDingDingApp create a new dingding app

func NewDingDingAppWithClient

func NewDingDingAppWithClient(appKey, appSecret, agentID string, client *http.Client) *DingDingApp

NewDingDingAppWithClient create a new dingding app with http.Client

func NewDingDingAppWithTimeout

func NewDingDingAppWithTimeout(appKey, appSecret, agentID string, timeout time.Duration) *DingDingApp

NewDingDingAppWithTimeout create a new dingding app with timeout

func (*DingDingApp) CreateGroupChat

func (r *DingDingApp) CreateGroupChat(name, ownerID string, userIDList []string, options *DingDingAppCreateGroupOptions) (newChatID string, err error)

CreateGroupChat create a new group chat

func (*DingDingApp) GetGroupChat

func (r *DingDingApp) GetGroupChat(chatID string) (group DingDingAppGroup, err error)

func (*DingDingApp) GetMessageSendProgress

func (r *DingDingApp) GetMessageSendProgress(taskID int) (sendProgressResp DingDingAppMessageSendProgressResp, err error)

func (*DingDingApp) GetMessageSendResult

func (r *DingDingApp) GetMessageSendResult(taskID int) (sendResultResp DingDingAppMessageSendResultResp, err error)

func (*DingDingApp) IsAccessTokenExpired

func (r *DingDingApp) IsAccessTokenExpired() bool

func (*DingDingApp) RecallMessage

func (r *DingDingApp) RecallMessage(taskID int) (revokeResp DingDingAppMessageRecallResp, err error)

func (*DingDingApp) SendActionCardMessage

func (r *DingDingApp) SendActionCardMessage(userIDList []string, departmentIDList []string, toAllUser bool, actionCardMessage *DingDingAppActionCardMessage) (
	resp DingDingAppMessageSendResp, err error)

func (*DingDingApp) SendFileMessage

func (r *DingDingApp) SendFileMessage(userIDList []string, departmentIDList []string, toAllUser bool, mediaID string) (
	resp DingDingAppMessageSendResp, err error)

func (*DingDingApp) SendGroupActionCardMessage

func (r *DingDingApp) SendGroupActionCardMessage(chatID string, actionCardMessage *DingDingAppActionCardMessage) (
	resp DingDingAppGroupMessageSendResp, err error)

func (*DingDingApp) SendGroupFileMessage

func (r *DingDingApp) SendGroupFileMessage(chatID, mediaID string) (
	resp DingDingAppGroupMessageSendResp, err error)

func (*DingDingApp) SendGroupImageMessage

func (r *DingDingApp) SendGroupImageMessage(chatID, mediaID string) (
	resp DingDingAppGroupMessageSendResp, err error)

func (*DingDingApp) SendGroupLinkMessage

func (r *DingDingApp) SendGroupLinkMessage(chatID string, linkMessage *DingDingAppLinkMessage) (
	resp DingDingAppGroupMessageSendResp, err error)

func (*DingDingApp) SendGroupMarkdownMessage

func (r *DingDingApp) SendGroupMarkdownMessage(chatID, title, content string) (
	resp DingDingAppGroupMessageSendResp, err error)

func (*DingDingApp) SendGroupTextMessage

func (r *DingDingApp) SendGroupTextMessage(chatID string, content string) (
	resp DingDingAppGroupMessageSendResp, err error)

func (*DingDingApp) SendGroupVoiceMessage

func (r *DingDingApp) SendGroupVoiceMessage(chatID, mediaID string, duration int) (
	resp DingDingAppGroupMessageSendResp, err error)

func (*DingDingApp) SendImageMessage

func (r *DingDingApp) SendImageMessage(userIDList []string, departmentIDList []string, toAllUser bool, mediaID string) (
	resp DingDingAppMessageSendResp, err error)

func (*DingDingApp) SendLinkMessage

func (r *DingDingApp) SendLinkMessage(userIDList []string, departmentIDList []string, toAllUser bool, linkMessage *DingDingAppLinkMessage) (
	resp DingDingAppMessageSendResp, err error)

func (*DingDingApp) SendMarkdownMessage

func (r *DingDingApp) SendMarkdownMessage(userIDList []string, departmentIDList []string, toAllUser bool, title, content string) (
	resp DingDingAppMessageSendResp, err error)

func (*DingDingApp) SendTextMessage

func (r *DingDingApp) SendTextMessage(userIDList []string, departmentIDList []string, toAllUser bool, content string) (
	resp DingDingAppMessageSendResp, err error)

func (*DingDingApp) SendVoiceMessage

func (r *DingDingApp) SendVoiceMessage(userIDList []string, departmentIDList []string, toAllUser bool, mediaID string, duration int) (
	resp DingDingAppMessageSendResp, err error)

func (*DingDingApp) UpdateGroupChat

func (r *DingDingApp) UpdateGroupChat(chatID string, options *DingDingAppUpdateGroupOptions) (err error)

type DingDingAppActionCardButton

type DingDingAppActionCardButton struct {
	Title     string `json:"title"`
	ActionURL string `json:"action_url"`
}

type DingDingAppActionCardMessage

type DingDingAppActionCardMessage struct {
	Title             string                        `json:"title"`
	Markdown          string                        `json:"markdown"`
	SingleTitle       string                        `json:"single_title,omitempty"` // single jump action card fields
	SingleURL         string                        `json:"single_url,omitempty"`
	ButtonOrientation string                        `json:"btn_orientation"` // standalone jump action card fields
	Buttons           []DingDingAppActionCardButton `json:"btn_json_list,omitempty"`
}

type DingDingAppCreateGroupOptions

type DingDingAppCreateGroupOptions struct {
	ShowHistoryType     int
	Searchable          int
	ValidationType      int
	MentionAllAuthority int
	ChatBannedType      int
	ManagementType      int
}

type DingDingAppCreateGroupResp

type DingDingAppCreateGroupResp struct {
	ErrCode         int    `json:"errcode"`
	ErrMessage      string `json:"errmsg"`
	ChatID          string `json:"chatid"`
	ConversationTag int    `json:"conversationTag"`
}

type DingDingAppGetGroupResp

type DingDingAppGetGroupResp struct {
	ErrCode    int              `json:"errcode"`
	ErrMessage string           `json:"errmsg"`
	ChatInfo   DingDingAppGroup `json:"chat_info"`
}

type DingDingAppGroup

type DingDingAppGroup struct {
	ChatID              string   `json:"chatid"`
	Name                string   `json:"name"`
	Owner               string   `json:"owner"`
	UserIDList          []string `json:"useridlist"`
	Icon                string   `json:"icon"`
	ShowHistoryType     int      `json:"showHistoryType"`
	Searchable          int      `json:"searchable"`
	ValidationType      int      `json:"validationType"`
	MentionAllAuthority int      `json:"mentionAllAuthority"`
	ChatBannedType      int      `json:"chatBannedType"`
	ManagementType      int      `json:"managementType"`
}

type DingDingAppGroupMessageSendResp

type DingDingAppGroupMessageSendResp struct {
	ErrCode    int    `json:"errcode"`
	ErrMessage string `json:"errmsg"`
	MessageID  string `json:"messageId"`
}

type DingDingAppLinkMessage

type DingDingAppLinkMessage struct {
	Text       string `json:"text"`
	Title      string `json:"title"`
	PicURL     string `json:"picUrl"`
	MessageURL string `json:"messageUrl"`
}

type DingDingAppMessageRecallResp

type DingDingAppMessageRecallResp struct {
	ErrCode    int    `json:"errcode"`
	ErrMessage string `json:"errmsg"`
}

type DingDingAppMessageSendProgress

type DingDingAppMessageSendProgress struct {
	ProgressInPercent int `json:"progress_in_percent"`
	Status            int `json:"status"`
}

type DingDingAppMessageSendProgressResp

type DingDingAppMessageSendProgressResp struct {
	ErrCode    int                            `json:"errcode"`
	ErrMessage string                         `json:"errmsg"`
	Progress   DingDingAppMessageSendProgress `json:"progress"`
}

type DingDingAppMessageSendResp

type DingDingAppMessageSendResp struct {
	ErrCode    int    `json:"errcode"`
	ErrMessage string `json:"errmsg"`
	TaskID     int    `json:"task_id"`
}

type DingDingAppMessageSendResult

type DingDingAppMessageSendResult struct {
	InvalidUserIDList   []string `json:"invalid_user_id_list"`
	ForbiddenUserIDList []string `json:"forbidden_user_id_list"`
	FailedUserIDList    []string `json:"failed_user_id_list"`
	ReadUserIDList      []string `json:"read_user_id_list"`
	UnReadUserIDList    []string `json:"unread_user_id_list"`
	InvalidDeptIDList   []string `json:"invalid_dept_id_list"`
}

type DingDingAppMessageSendResultResp

type DingDingAppMessageSendResultResp struct {
	ErrCode    int                          `json:"errcode"`
	ErrMessage string                       `json:"errmsg"`
	SendResult DingDingAppMessageSendResult `json:"send_result"`
}

type DingDingAppTokenResp

type DingDingAppTokenResp struct {
	ErrCode     int    `json:"errcode"`
	ErrMessage  string `json:"errmsg"`
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
}

type DingDingAppUpdateGroupOptions

type DingDingAppUpdateGroupOptions struct {
	Name        string
	Owner       string
	Icon        string
	AddUserList []string
	DelUserList []string
	DingDingAppCreateGroupOptions
}

type DingDingAppUpdateGroupResp

type DingDingAppUpdateGroupResp struct {
	ErrCode    int    `json:"errcode"`
	ErrMessage string `json:"errmsg"`
}

type DingDingRobot

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

func NewDingDingRobot

func NewDingDingRobot() *DingDingRobot

NewDingDingRobot create a new dingding robot

func NewDingDingRobotWithClient

func NewDingDingRobotWithClient(client *http.Client) *DingDingRobot

NewDingDingRobotWithClient create a new dingding robot with http.Client

func NewDingDingRobotWithTimeout

func NewDingDingRobotWithTimeout(timeout time.Duration) *DingDingRobot

NewDingDingRobotWithTimeout create a new dingding robot with timeout

func (*DingDingRobot) SendActionCardMessage

func (r *DingDingRobot) SendActionCardMessage(securitySettings *DingDingSecuritySettings, actionCardMessage *DingDingRobotActionCardMessage) (err error)

func (*DingDingRobot) SendFeedCardMessage

func (r *DingDingRobot) SendFeedCardMessage(securitySettings *DingDingSecuritySettings, feedCardMessages []DingDingRobotFeedCardMessage) (err error)

func (*DingDingRobot) SendLinkMessage

func (r *DingDingRobot) SendLinkMessage(securitySettings *DingDingSecuritySettings, linkMessage *DingDingRobotLinkMessage) (err error)

func (*DingDingRobot) SendMarkdownMessage

func (r *DingDingRobot) SendMarkdownMessage(securitySettings *DingDingSecuritySettings, markdownMessage *DingDingRobotMarkdownMessage) (err error)

func (*DingDingRobot) SendMarkdownMessageWithMention

func (r *DingDingRobot) SendMarkdownMessageWithMention(securitySettings *DingDingSecuritySettings, markdownMessage *DingDingRobotMarkdownMessage,
	mentionedMobileList []string, atAll bool) (err error)

func (*DingDingRobot) SendTextMessage

func (r *DingDingRobot) SendTextMessage(securitySettings *DingDingSecuritySettings, content string) (err error)

func (*DingDingRobot) SendTextMessageWithMention

func (r *DingDingRobot) SendTextMessageWithMention(securitySettings *DingDingSecuritySettings, content string, mentionedMobileList []string, atAll bool) (err error)

type DingDingRobotActionCardButton

type DingDingRobotActionCardButton struct {
	Title     string `json:"title"`
	ActionURL string `json:"actionURL"`
}

type DingDingRobotActionCardMessage

type DingDingRobotActionCardMessage struct {
	Title string `json:"title"`
	Text  string `json:"text"`
	// single jump action card fields
	SingleTitle string `json:"singleTitle,omitempty"`
	SingleURL   string `json:"singleURL,omitempty"`
	// standalone jump action card fields
	ButtonOrientation string                          `json:"btnOrientation"`
	Buttons           []DingDingRobotActionCardButton `json:"btns,omitempty"`
}

type DingDingRobotFeedCardMessage

type DingDingRobotFeedCardMessage struct {
	Title      string `json:"title"`
	MessageURL string `json:"messageURL"`
	PicURL     string `json:"picURL"`
}

type DingDingRobotLinkMessage

type DingDingRobotLinkMessage struct {
	Text       string `json:"text"`
	Title      string `json:"title"`
	PicURL     string `json:"picUrl"`
	MessageURL string `json:"messageUrl"`
}

type DingDingRobotMarkdownMessage

type DingDingRobotMarkdownMessage struct {
	Title string `json:"title"`
	Text  string `json:"text"`
}

type DingDingRobotMentionAt

type DingDingRobotMentionAt struct {
	AtMobiles []string `json:"atMobiles"`
	IsAtAll   bool     `json:"isAtAll"`
}

type DingDingRobotMessageResp

type DingDingRobotMessageResp struct {
	ErrCode    int    `json:"errcode"`
	ErrMessage string `json:"errmsg"`
}

type DingDingSecuritySettings

type DingDingSecuritySettings struct {
	AccessToken string
	SecureToken string
}

Jump to

Keyboard shortcuts

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