dingtalk

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

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 MessageMarkdownSub struct {
	Title string `json:"title"`
	Text  string `json:"text"`
}

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 MessageTextAt struct {
	AtMobiles []string `json:"atMobiles"`
	IsAtAll   bool     `json:"isAtAll"`
}

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 TAdmin

type TAdmin struct {
	UserId   string `json:"userid"`
	SysLevel int    `json:"sys_level"`
}

func (*TAdmin) String

func (Self *TAdmin) String() string

type TAdmins

type TAdmins struct {
	TResult
	Admins []TAdmin `json:"adminList"`
}

func (*TAdmins) String

func (Self *TAdmins) 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

func (Self *TDDUser) DisplayName() string

func (*TDDUser) String

func (Self *TDDUser) String() string

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 TDeptInfo struct {
	TResult
	Id      int    `json:"id"`
	PId     int    `json:"parentid"`
	Name    string `json:"name"`
	MUserId string `json:"deptManagerUseridList"` //部门的主管列表,取值为由主管的userid组成的字符串,不同的userid使用“\|”符号进行分割
	IsSub   bool   `json:"groupContainSubDept"`   //部门群是否包含子部门
}

func (*TDeptInfo) String

func (Self *TDeptInfo) String() string

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) GetOrgName

func (Self *TDingTalkApp) GetOrgName(depids []int) (string, error)

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 TDingTalkSDK

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

已经不在使用

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)

type TReSnsUser

type TReSnsUser struct {
	TResult
	UserInfo struct {
		NickName string `json:"nick"`
		UnionId  string `json:"unionid"`
		DingId   string `json:"dingId"`
		OpenId   string `json:"openid"`
	} `json:"user_info"`
}

用户信息

type TResult

type TResult struct {
	ErrCode int    `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
}

Jump to

Keyboard shortcuts

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