Documentation ¶
Index ¶
- type MessageMarkdown
- type MessageMarkdownSub
- type MessageText
- type MessageTextAt
- type MessageTextSub
- type TAccessToken
- type TAdmin
- type TAdmins
- type TDDUser
- type TDDUserAttr
- type TDeptInfo
- type TDingTalkApp
- func (Self *TDingTalkApp) GetAccessToken() (string, error)
- func (Self *TDingTalkApp) GetAdmins() (*TAdmins, error)
- func (Self *TDingTalkApp) GetDepartment(depid int) (*TDeptInfo, error)
- func (Self *TDingTalkApp) GetFullDepartmentName(depid int) (string, error)
- func (Self *TDingTalkApp) GetJobName(depids []int) (string, error)
- func (Self *TDingTalkApp) GetLoginInfo(authcode string) (string, error)
- func (Self *TDingTalkApp) GetOrgName(depids []int) (string, error)
- func (Self *TDingTalkApp) GetUserInfo(userid string) (*TDDUser, error)
- func (Self *TDingTalkApp) GetUserInfoByPhone(phone string) (string, error)
- func (Self *TDingTalkApp) GetUserInfoByUnionId(unionid string) (*TDDUser, error)
- func (Self *TDingTalkApp) SendWorkNotify(user_id string, msg_text string) (int, error)
- func (Self *TDingTalkApp) SetAgentId(agent_id string)
- type TDingTalkOAuth2
- type TDingTalkRobot
- func (w *TDingTalkRobot) Init(access_token string, secret string)
- func (w *TDingTalkRobot) Inits()
- func (w *TDingTalkRobot) SendMDMessage(title, text string) bool
- func (w *TDingTalkRobot) SendMessage(msg interface{}) bool
- func (w *TDingTalkRobot) SendTextMessage(text string, all bool) bool
- func (w *TDingTalkRobot) SendTextMessages(text string, all bool) int
- type TDingTalkSDK
- type TDingTalkSns
- type TReSnsUser
- type TResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageMarkdown ¶
type MessageMarkdown struct { Type string `json:"msgtype"` Message MessageMarkdownSub `json:"markdown"` }
func (*MessageMarkdown) String ¶
func (Self *MessageMarkdown) String() string
type MessageMarkdownSub ¶
type MessageText ¶
type MessageText struct { At MessageTextAt `json:"at"` Type string `json:"msgtype"` Message MessageTextSub `json:"text"` }
func (*MessageText) String ¶
func (Self *MessageText) String() string
type MessageTextAt ¶
type MessageTextSub ¶
type MessageTextSub struct {
Text string `json:"content"`
}
type TAccessToken ¶
type TAccessToken struct { TResult AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` CreateDate time.Time }
func (*TAccessToken) IsValid ¶
func (Self *TAccessToken) IsValid() bool
func (*TAccessToken) String ¶
func (Self *TAccessToken) String() string
type TDDUser ¶
type TDDUser struct { TResult UserId string `json:"userid"` StaffCode string `json:"jobnumber"` StaffName string `json:"name"` Email string `json:"email"` Phone string `json:"mobile"` Remark string `json:"remark"` Avatar string `json:"avatar"` Attrs TDDUserAttr `json:"extattr"` }
func (*TDDUser) DisplayName ¶
type TDDUserAttr ¶
type TDDUserAttr struct { JoinDate string `json:"joinDate"` //"2006-07-05", Gender string `json:"gender"` //"M/F", BirthDate string `json:"birthDate"` //"1984-09-10", Age string `json:"age"` //"36" Station string `json:"station"` //"地点", Belong string `json:"belong"` //"公司", Org string `json:"org"` //"组织", Dept string `json:"dept"` //"部门", Job string `json:"job"` //"岗位", OrgId int `json:"org_id"` //"组织ID", DeptId int `json:"dept_id"` //"部门ID", JobId int `json:"job_id"` //"岗位ID", }
type TDeptInfo ¶
type TDingTalkApp ¶
type TDingTalkApp struct {
// contains filtered or unexported fields
}
func GetDingTalkApp ¶
func GetDingTalkApp(appkey, appsecret string, agent_id string) *TDingTalkApp
func (*TDingTalkApp) GetAccessToken ¶
func (Self *TDingTalkApp) GetAccessToken() (string, error)
https://oapi.dingtalk.com/gettoken?appkey=key&appsecret=secret {"errorCode":503,"success":false,"errorMsg":"不合法的access_token"}
func (*TDingTalkApp) GetAdmins ¶
func (Self *TDingTalkApp) GetAdmins() (*TAdmins, error)
{"sys_level":2,"userid":"userid2"}, https://oapi.dingtalk.com/user/get_admin?access_token=ACCESS_TOKEN
func (*TDingTalkApp) GetDepartment ¶
func (Self *TDingTalkApp) GetDepartment(depid int) (*TDeptInfo, error)
https://oapi.dingtalk.com/department/get?access_token=ACCESS_TOKEN&id=123 获取部门详情
func (*TDingTalkApp) GetFullDepartmentName ¶
func (Self *TDingTalkApp) GetFullDepartmentName(depid int) (string, error)
func (*TDingTalkApp) GetJobName ¶
func (Self *TDingTalkApp) GetJobName(depids []int) (string, error)
func (*TDingTalkApp) GetLoginInfo ¶
func (Self *TDingTalkApp) GetLoginInfo(authcode string) (string, error)
https://oapi.dingtalk.com/user/getuserinfo?access_token=access_token&code=code
func (*TDingTalkApp) GetOrgName ¶
func (Self *TDingTalkApp) GetOrgName(depids []int) (string, error)
func (*TDingTalkApp) GetUserInfo ¶
func (Self *TDingTalkApp) GetUserInfo(userid string) (*TDDUser, error)
https://oapi.dingtalk.com/user/get?access_token=ACCESS_TOKEN&userid=zhangsan
func (*TDingTalkApp) GetUserInfoByPhone ¶
func (Self *TDingTalkApp) GetUserInfoByPhone(phone string) (string, error)
https://oapi.dingtalk.com/user/get_by_mobile?access_token=ACCESS_TOKEN&mobile=1xxxxxxxxxx
func (*TDingTalkApp) GetUserInfoByUnionId ¶
func (Self *TDingTalkApp) GetUserInfoByUnionId(unionid string) (*TDDUser, error)
https://oapi.dingtalk.com/user/get?access_token=ACCESS_TOKEN&userid=zhangsan
func (*TDingTalkApp) SendWorkNotify ¶
func (Self *TDingTalkApp) SendWorkNotify(user_id string, msg_text string) (int, error)
func (*TDingTalkApp) SetAgentId ¶
func (Self *TDingTalkApp) SetAgentId(agent_id string)
type TDingTalkOAuth2 ¶
type TDingTalkOAuth2 struct { TDingTalkSDK // contains filtered or unexported fields }
func GetDingTalkOAuth2 ¶
func GetDingTalkOAuth2(appkey, appsecret string) *TDingTalkOAuth2
func (*TDingTalkOAuth2) GetAccessToken ¶
func (Self *TDingTalkOAuth2) GetAccessToken() (string, error)
https://oapi.dingtalk.com/gettoken?appkey=key&appsecret=secret {"errorCode":503,"success":false,"errorMsg":"不合法的access_token"}
func (*TDingTalkOAuth2) GetAppKey ¶
func (Self *TDingTalkOAuth2) GetAppKey() string
func (*TDingTalkOAuth2) GetUserByUnionId ¶
func (Self *TDingTalkOAuth2) GetUserByUnionId(code string) (bool, string, error)
根据临时授权码获取用户信息 https://open.dingtalk.com/document/orgapp/obtain-user-token
type TDingTalkRobot ¶
type TDingTalkRobot struct { TDingTalkSDK // contains filtered or unexported fields }
func (*TDingTalkRobot) Init ¶
func (w *TDingTalkRobot) Init(access_token string, secret string)
func (*TDingTalkRobot) Inits ¶
func (w *TDingTalkRobot) Inits()
func (*TDingTalkRobot) SendMDMessage ¶
func (w *TDingTalkRobot) SendMDMessage(title, text string) bool
func (*TDingTalkRobot) SendMessage ¶
func (w *TDingTalkRobot) SendMessage(msg interface{}) bool
func (*TDingTalkRobot) SendTextMessage ¶
func (w *TDingTalkRobot) SendTextMessage(text string, all bool) bool
func (*TDingTalkRobot) SendTextMessages ¶
func (w *TDingTalkRobot) SendTextMessages(text string, all bool) int
type TDingTalkSns ¶
type TDingTalkSns struct { TDingTalkSDK // contains filtered or unexported fields }
func GetDingTalkSns ¶
func GetDingTalkSns(appkey, appsecret string) *TDingTalkSns
func (*TDingTalkSns) GetAccessToken ¶
func (Self *TDingTalkSns) GetAccessToken() (string, error)
https://oapi.dingtalk.com/gettoken?appkey=key&appsecret=secret {"errorCode":503,"success":false,"errorMsg":"不合法的access_token"}
func (*TDingTalkSns) GetAppKey ¶
func (Self *TDingTalkSns) GetAppKey() string
func (*TDingTalkSns) GetUserByUnionId ¶
func (Self *TDingTalkSns) GetUserByUnionId(code string) (bool, string, error)
根据sns临时授权码获取用户信息 https://developers.dingtalk.com/document/app/obtain-the-user-information-based-on-the-sns-temporary-authorization
func (*TDingTalkSns) Init ¶
func (w *TDingTalkSns) Init(appId string, appSecret string)