godingtalk

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2020 License: MIT Imports: 21 Imported by: 0

README

DingTalk Open API golang SDK

image

Check out DingTalk Open API document at: https://ding-doc.dingtalk.com/

Usage

Fetch the SDK

export GOPATH=`pwd`
go get github.com/go-codes/godingtalk
Example code to send a micro app message
package main

import (
    "github.com/go-codes/godingtalk"
    "log"
    "os"
)

func main() {
    c := godingtalk.NewDingTalkClient(os.Getenv("corpid"), os.Getenv("corpsecret"))
    c.RefreshAccessToken()
    err := c.SendAppMessage(os.Args[1], os.Args[2], os.Args[3])
    if err != nil {
        log.Println(err)
    }
}

Guide

Step-by-step Guide to use this SDK

http://hugozhu.myalert.info/2016/05/02/66-use-dingtalk-golang-sdk-to-send-message-on-pi.html

Tools

ding_alert : Command line tool to send app/text/oa ... messages

export GOPATH=`pwd`
go get github.com/go-codes/godingtalk/demo/ding_alert

export corpid=<组织的corpid 通过 https://oa.dingtalk.com 获取>
export corpsecret=<组织的corpsecret 通过 https://oa.dingtalk.com 获取>

./bin/ding_alert
Usage of ./bin/ding_alert:
  -agent string
    	agent Id (default "22194403")
  -chat string
    	chat id (default "chat6a93bc1ee3b7d660d372b1b877a9de62")
  -file string
    	file path for media message
  -link string
    	link url (default "http://hugozhu.myalert.info/dingtalk")
  -sender string
    	sender id (default "011217462940")
  -text string
    	text for link message (default "This is link text")
  -title string
    	title for link message (default "This is link title")
  -touser string
    	touser id (default "0420506555")
  -type string
    	message type (app, text, image, voice, link, oa) (default "app")

github: Deliver Github webhook events to DingTalk, which can be deployed on Google AppEngine.

more info at: http://hugozhu.myalert.info/2016/05/15/67-use-free-google-cloud-service-to-deliver-github-webhook-events-to-dingtalk.html

export GOPATH=`pwd`
go get github.com/go-codes/godingtalk/demo/github/appengine

Modify app.yaml

cd src/github.com/go-codes/godingtalk/demo/github/appengine
cat app.yaml
application: github-alert-<random_number>
version: 1
runtime: go
api_version: go1
env_variables:
  CORP_ID: '<从 http://oa.dingtalk.com 获取>'
  CORP_SECRET: '<从 http://oa.dingtalk.com 获取>'
  GITHUB_WEBHOOK_SECRET: '<从 http://github.com/ 获取>'
  SENDER_ID: '<从 http://open.dingtalk.com 调用api获取>'
  CHAT_ID: '<从 http://open.dingtalk.com 调用api获取>'
handlers:
- url: /.*
  script: _go_app

Documentation

Overview

普通钉钉用户账号开放相关接口

Index

Constants

View Source
const (
	AES_ENCODE_KEY_LENGTH = 43
)
View Source
const (
	//VERSION is SDK version
	VERSION = "0.2"
)

Variables

This section is empty.

Functions

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blockSize int) []byte

func PKCS7UnPadding

func PKCS7UnPadding(plantText []byte) []byte

func Sign

func Sign(ticket string, nonceStr string, timeStamp string, url string) string

Sign is 签名

Types

type AccessTokenResponse

type AccessTokenResponse struct {
	OAPIResponse
	AccessToken string `json:"access_token"`
	Expires     int    `json:"expires_in"`
	Created     int64
}

AccessTokenResponse is

func (*AccessTokenResponse) CreatedAt

func (e *AccessTokenResponse) CreatedAt() int64

CreatedAt is when the access token is generated

func (*AccessTokenResponse) ExpiresIn

func (e *AccessTokenResponse) ExpiresIn() int

ExpiresIn is how soon the access token is expired

type Attendance

type Attendance struct {
	GmtModifed      int64   `json:"gmtModified"`    //: 1492594486000,
	IsLegal         string  `json:"isLegal"`        //: "N",
	BaseCheckTime   int64   `json:"baseCheckTime"`  //: 1492568460000,
	ID              int64   `json:"id"`             //: 933202551,
	UserAddress     string  `json:"userAddress"`    //: "北京市朝阳区崔各庄镇阿里中心.望京A座阿里巴巴绿地中心",
	UID             string  `json:"userId"`         //: "manager7078",
	CheckType       string  `json:"checkType"`      //: "OnDuty",
	TimeResult      string  `json:"timeResult"`     //: "Normal",
	DeviceID        string  `json:"deviceId"`       // :"cb7ace07d52fe9be14f4d8bec5e1ba79"
	CorpID          string  `json:"corpId"`         //: "ding7536bfee6fb1fa5a35c2f4657eb6378f",
	SourceType      string  `json:"sourceType"`     //: "USER",
	WorkDate        int64   `json:"workDate"`       //: 1492531200000,
	PlanCheckTime   int64   `json:"planCheckTime"`  //: 1492568497000,
	GmtCreate       int64   `json:"gmtCreate"`      //: 1492594486000,
	LocaltionMethod string  `json:"locationMethod"` //: "MAP",
	LocationResult  string  `json:"locationResult"` //: "Outside",
	UserLongitude   float64 `json:"userLongitude"`  //: 116.486888,
	PlanID          int     `json:"planId"`         //: 4550269081,
	GroupID         int     `json:"groupId"`        //: 121325603,
	UserAccuracy    int     `json:"userAccuracy"`   //: 65,
	UserCheckTime   int64   `json:"userCheckTime"`  //: 1492568497000,
	UserLatitude    float64 `json:"userLatitude"`   //: 39.999946,
	ProcInstID      string  `json:"procInstId"`     //: "cb992267-9b70"
	ApproveID       int     `json:"approveId"`      //         string, `json:""`//关联的审批id
	ClassId         int     `json:"classId"`        //考勤班次id,没有的话表示该次打卡不在排班内
	UserSsid        string  `json:"userSsid"`       //用户打卡wifi SSID
	UserMacAddr     string  `json:"userMacAddr"`    //用户打卡wifi Mac地址
	BaseAddress     string  `json:"baseAddress"`    //基准地址
	BaseLongitude   float32 `json:"baseLongitude"`  //    基准经度
	BaseLatitude    float32 `json:"baseLatitude"`   //   基准纬度
	BaseAccuracy    int     `json:"baseAccuracy"`   //  基准定位精度
	BaseSsid        string  `json:"baseSsid"`       //基准wifi ssid
	BaseMacAddr     string  `json:"baseMacAddr"`    //基准 Mac 地址
	OutsideRemark   string  `json:"outsideRemark"`  //打卡备注
}

type Cache

type Cache interface {
	Set(data Expirable) error
	Get(data Expirable) error
}

type CalendarRequest

type CalendarRequest struct {
	TimeMax CalendarTime `json:"time_max"`
	TimeMin CalendarTime `json:"time_min"`
	StaffId string       `json:"user_id"`
}

type CalendarTime

type CalendarTime struct {
	TimeZone string `json:"time_zone"`
	Date     string `json:"date_time"`
}

type Callback

type Callback struct {
	OAPIResponse
	Token     string
	AES_KEY   string `json:"aes_key"`
	URL       string
	Callbacks []string `json:"call_back_tag"`
}

type Crypto

type Crypto struct {
	Token    string
	AesKey   string
	SuiteKey string
	// contains filtered or unexported fields
}
var DefaultDingtalkCrypto *Crypto

func NewCrypto

func NewCrypto(token, aesKey, suiteKey string) (c *Crypto)

token 数据签名需要用到的token,ISV(服务提供商)推荐使用注册套件时填写的token,普通企业可以随机填写 aesKey 数据加密密钥。用于回调数据的加密,长度固定为43个字符,从a-z, A-Z, 0-9共62个字符中选取,您可以随机生成,ISV(服务提供商)推荐使用注册套件时填写的EncodingAESKey suiteKey 一般使用corpID

func (*Crypto) DecryptMsg

func (c *Crypto) DecryptMsg(signature, timeStamp, nonce, secretStr string) (string, error)

signature: 签名字符串 timeStamp: 时间戳 nonce: 随机字符串 secretStr: 密文 返回: 解密后的明文

func (*Crypto) EncryptMsg

func (c *Crypto) EncryptMsg(replyMsg, timeStamp, nonce string) (string, string, error)

replyMsg: 明文字符串 timeStamp: 时间戳 nonce: 随机字符串 返回: 密文,签名字符串

func (*Crypto) GenerateSignature

func (c *Crypto) GenerateSignature(token, timeStamp, nonce, secretStr string) string

数据签名

func (*Crypto) RandomString

func (c *Crypto) RandomString(n int, alphabets ...byte) string

func (*Crypto) VerifySignature

func (c *Crypto) VerifySignature(token, timeStamp, nonce, secretStr, sigture string) bool

校验数据签名

type DataMessage

type DataMessage struct {
	OAPIResponse
	Data string
}

DataMessage 服务端加密、解密消息

type Department

type Department struct {
	OAPIResponse
	Id                    int
	Name                  string
	ParentId              int
	Order                 int
	DeptPerimits          string
	UserPerimits          string
	OuterDept             bool
	OuterPermitDepts      string
	OuterPermitUsers      string
	OrgDeptOwner          string
	DeptManagerUseridList string
}

type DepartmentList

type DepartmentList struct {
	OAPIResponse
	Departments []Department `json:"department"`
}

type DingTalkClient

type DingTalkClient struct {
	CorpID      string
	CorpSecret  string
	AgentID     string
	PartnerID   string
	AccessToken string
	HTTPClient  *http.Client
	Cache       Cache

	//社交相关的属性
	SnsAppID       string
	SnsAppSecret   string
	SnsAccessToken string
}

DingTalkClient is the Client to access DingTalk Open API

func NewDingTalkClient

func NewDingTalkClient(corpID string, corpSecret string) *DingTalkClient

NewDingTalkClient creates a DingTalkClient instance

func (*DingTalkClient) CreateChat

func (c *DingTalkClient) CreateChat(name string, owner string, useridlist []string) (string, error)

CreateChat is

func (*DingTalkClient) CreateFile

func (c *DingTalkClient) CreateFile(size int64) (file FileResponse, err error)

CreateFile is to create a new file in Ding Space

func (*DingTalkClient) Decrypt

func (c *DingTalkClient) Decrypt(str string) (string, error)

Decrypt is 服务端解密

func (*DingTalkClient) DeleteCallback

func (c *DingTalkClient) DeleteCallback() error

DeleteCallback is 删除事件回调接口

func (*DingTalkClient) DepartmentDetail

func (c *DingTalkClient) DepartmentDetail(id int) (Department, error)

DepartmentDetail is 获取部门详情

func (*DingTalkClient) DepartmentList

func (c *DingTalkClient) DepartmentList() (DepartmentList, error)

DepartmentList is 获取部门列表

func (*DingTalkClient) DownloadMedia

func (c *DingTalkClient) DownloadMedia(mediaID string, write io.Writer) error

DownloadMedia is to download a media file from DingTalk

func (*DingTalkClient) Encrypt

func (c *DingTalkClient) Encrypt(str string) (string, error)

Encrypt is 服务端加密

func (*DingTalkClient) GetConfig

func (c *DingTalkClient) GetConfig(nonceStr string, timestamp string, url string) string

GetConfig is to return config in json

func (*DingTalkClient) GetJsAPITicket

func (c *DingTalkClient) GetJsAPITicket() (ticket string, err error)

GetJsAPITicket is to get a valid ticket for JS API

func (*DingTalkClient) GetMessageReadList

func (c *DingTalkClient) GetMessageReadList(messageID string, cursor int, size int) (data MessageReadListResponse, err error)

GetMessageReadList is 获取已读列表

func (*DingTalkClient) GetSnsPersistentCode

func (c *DingTalkClient) GetSnsPersistentCode(tmpAuthCode string) (string, string, string, error)

获取用户授权的持久授权码

func (*DingTalkClient) GetSnsToken

func (c *DingTalkClient) GetSnsToken(openid, persistentCode string) (string, error)

获取用户授权的SNS_TOKEN

func (*DingTalkClient) GetSnsUserInfo

func (c *DingTalkClient) GetSnsUserInfo(snsToken string) (SnsUserInfoResponse, error)

获取用户授权的个人信息

func (*DingTalkClient) ListAttendanceRecord

func (c *DingTalkClient) ListAttendanceRecord(ulist []string, dateFrom time.Time, dateTo time.Time) ([]Attendance, error)

获取所有的打卡记录,该员工当天如果打卡10条,那么10条都将返回

func (*DingTalkClient) ListAttendanceResult

func (c *DingTalkClient) ListAttendanceResult(ulist []string, dateFrom, dateTo time.Time, offset, lmt int64) (listAttendanceResultResp, error)

即使员工在这期间打了多次,该接口也只会返回两条记录,包括上午的打卡结果和下午的打卡结果 用户如果为空则获取所有用户

func (*DingTalkClient) ListCallback

func (c *DingTalkClient) ListCallback() (Callback, error)

ListCallback is 查询事件回调接口

func (*DingTalkClient) ListEvents

func (c *DingTalkClient) ListEvents(staffid string, from time.Time, to time.Time) (events []Event, err error)

func (*DingTalkClient) RefreshAccessToken

func (c *DingTalkClient) RefreshAccessToken() error

RefreshAccessToken is to get a valid access token

func (*DingTalkClient) RefreshSnsAccessToken

func (c *DingTalkClient) RefreshSnsAccessToken() error

获取钉钉开放应用ACCESS_TOKEN TODO:

根据和赤司(钉钉开发者)的沟通,ACCESS_TOKEN只有两个小时的有效期
但是目前接口貌似没有返回过期时间相关的信息,因此所有相关的调用都需要强制刷新

func (*DingTalkClient) RegisterCallback

func (c *DingTalkClient) RegisterCallback(callbacks []string, token string, aes_key string, callbackURL string) error

RegisterCallback is 注册事件回调接口

func (*DingTalkClient) SendAppLinkMessage

func (c *DingTalkClient) SendAppLinkMessage(agentID, touser string, title, text string, picUrl, url string) error

SendAppLinkMessage is 发送企业会话链接消息

func (*DingTalkClient) SendAppMessage

func (c *DingTalkClient) SendAppMessage(agentID string, touser string, msg string) error

SendAppMessage is 发送企业会话消息

func (*DingTalkClient) SendAppOAMessage

func (c *DingTalkClient) SendAppOAMessage(agentID string, touser string, msg OAMessage) error

SendAppOAMessage is 发送OA消息

func (*DingTalkClient) SendFileMessage

func (c *DingTalkClient) SendFileMessage(sender string, cid string, mediaID string) (data MessageResponse, err error)

SendFileMessage is 发送文件消息

func (*DingTalkClient) SendImageMessage

func (c *DingTalkClient) SendImageMessage(sender string, cid string, mediaID string) (data MessageResponse, err error)

SendImageMessage is 发送图片消息

func (*DingTalkClient) SendLinkMessage

func (c *DingTalkClient) SendLinkMessage(sender string, cid string, mediaID string, url string, title string, text string) (data MessageResponse, err error)

SendLinkMessage is 发送链接消息

func (*DingTalkClient) SendOAMessage

func (c *DingTalkClient) SendOAMessage(sender string, cid string, msg OAMessage) (data MessageResponse, err error)

SendOAMessage is 发送OA消息

func (*DingTalkClient) SendRobotMarkdownMessage

func (c *DingTalkClient) SendRobotMarkdownMessage(accessToken string, title string, msg string) (data MessageResponse, err error)

SendRobotMarkdownMessage can send a text message to a group chat

func (*DingTalkClient) SendRobotTextAtMessage

func (c *DingTalkClient) SendRobotTextAtMessage(accessToken string, msg string, at *RobotAtList) (data OAPIResponse, err error)

SendRobotTextAtMessage can send a text message and at user to a group chat

func (*DingTalkClient) SendRobotTextMessage

func (c *DingTalkClient) SendRobotTextMessage(accessToken string, msg string) (data MessageResponse, err error)

SendRobotTextMessage can send a text message to a group chat

func (*DingTalkClient) SendTextMessage

func (c *DingTalkClient) SendTextMessage(sender string, cid string, msg string) (data MessageResponse, err error)

SendTextMessage is 发送普通文本消息

func (*DingTalkClient) SendVoiceMessage

func (c *DingTalkClient) SendVoiceMessage(sender string, cid string, mediaID string, duration string) (data MessageResponse, err error)

SendVoiceMessage is 发送语音消息

func (*DingTalkClient) TopAPICreateProcInst

func (c *DingTalkClient) TopAPICreateProcInst(data TopAPICreateProcInst) (string, error)

发起审批

func (*DingTalkClient) TopAPIGetProcInst

func (c *DingTalkClient) TopAPIGetProcInst(pid string) (ProcInst, error)

根据审批实例id获取单条审批实例详情

func (*DingTalkClient) TopAPIListProcInst

func (c *DingTalkClient) TopAPIListProcInst(processCode string, startTime, endTime time.Time, size, cursor int, useridList []string) (TopAPIListProcInstResp, error)

获取审批实例列表 Note: processCode 官方不会检查错误,请保证processCode正确

func (*DingTalkClient) TopAPIMsgGetSendProgress

func (c *DingTalkClient) TopAPIMsgGetSendProgress(taskID int) (TopAPIMsgGetSendProgress, error)

func (*DingTalkClient) TopAPIMsgGetSendResult

func (c *DingTalkClient) TopAPIMsgGetSendResult(taskID int) (TopAPIMsgGetSendResult, error)

func (*DingTalkClient) TopAPIMsgSend

func (c *DingTalkClient) TopAPIMsgSend(msgType string, userList []string, deptList []int, toAll bool, msgContent interface{}) (int, error)

mgType 消息类型:text;iamge;voice;file;link;oa;markdown;action_card userList 接收推送的UID 列表 deptList 接收推送的部门ID列表 toAll 是否发送给所有用户 msgContent 消息内容 If success return task_id, or is error is not nil when errored

func (*DingTalkClient) UpdateCallback

func (c *DingTalkClient) UpdateCallback(callbacks []string, token string, aes_key string, callbackURL string) error

UpdateCallback is 更新事件回调接口

func (*DingTalkClient) UploadMedia

func (c *DingTalkClient) UploadMedia(mediaType string, filename string, reader io.Reader) (media MediaResponse, err error)

UploadMedia is to upload media file to DingTalk

func (*DingTalkClient) UserInfoByCode

func (c *DingTalkClient) UserInfoByCode(code string) (User, error)

UserInfoByCode 校验免登录码并换取用户身份

func (*DingTalkClient) UserInfoById

func (c *DingTalkClient) UserInfoById(userid string) (UserInfo, error)

获取用户详情

func (*DingTalkClient) UserList

func (c *DingTalkClient) UserList(departmentID, offset, size int) (UserList, error)

UserList is 获取部门成员

func (*DingTalkClient) UseridByMobile

func (c *DingTalkClient) UseridByMobile(mobile string) (string, error)

UseridByMobile 通过手机号获取Userid

func (*DingTalkClient) UseridByUnionId

func (c *DingTalkClient) UseridByUnionId(unionid string) (string, error)

UseridByUnionId 通过UnionId获取玩家Userid

type DownloadFile

type DownloadFile struct {
	MediaID  string
	FileName string
	Reader   io.Reader
}

DownloadFile is for downloading a single file from DingTalk

type Event

type Event struct {
	OAPIResponse
	Id          string
	Location    string
	Summary     string
	Description string
	Start       struct {
		DateTime string `json:"date_time"`
	}
	End struct {
		DateTime string `json:"date_time"`
	}
}

type Expirable

type Expirable interface {
	CreatedAt() int64
	ExpiresIn() int
}

type FileCache

type FileCache struct {
	Path string
}

func NewFileCache

func NewFileCache(path string) *FileCache

func (*FileCache) Get

func (c *FileCache) Get(data Expirable) error

func (*FileCache) Set

func (c *FileCache) Set(data Expirable) error

type FileResponse

type FileResponse struct {
	OAPIResponse
	Code     int
	Msg      string
	UploadID string `json:"uploadid"`
	Writer   io.Writer
}

FileResponse is

type InMemoryCache

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

func NewInMemoryCache

func NewInMemoryCache() *InMemoryCache

func (*InMemoryCache) Get

func (c *InMemoryCache) Get(data Expirable) error

func (*InMemoryCache) Set

func (c *InMemoryCache) Set(data Expirable) error

type JsAPITicketResponse

type JsAPITicketResponse struct {
	OAPIResponse
	Ticket  string
	Expires int `json:"expires_in"`
	Created int64
}

JsAPITicketResponse is

func (*JsAPITicketResponse) CreatedAt

func (e *JsAPITicketResponse) CreatedAt() int64

CreatedAt is when the ticket is generated

func (*JsAPITicketResponse) ExpiresIn

func (e *JsAPITicketResponse) ExpiresIn() int

ExpiresIn is how soon the ticket is expired

type ListEventsResponse

type ListEventsResponse struct {
	OAPIResponse
	Success bool `json:"success"`
	Result  struct {
		Events        []Event `json:"items"`
		Summary       string  `json:"summary"`
		NextPageToken string  `json:"next_page_token"`
	} `json:"result"`
}

type ListProcInst

type ListProcInst struct {
	ApproverUIDS     []string               `json:"approver_userid_list"`
	CCUIDS           []string               `json:"cc_userid_list"`
	FormCompntValues []ProcInstCompntValues `json:"form_component_values"`
	ProcInstID       string                 `json:"process_instance_id"`
	Title            string                 `json:"title"`
	CreateTime       string                 `json:"create_time"`
	FinishTime       string                 `json:"finish_time"`
	OriginatorUID    string                 `json:"originator_userid"`
	Status           string                 `json:"status"`
	BusinessID       string                 `json:"business_id"`
	OriginatorDeptID string                 `json:"originator_dept_id"`
	ProcInstResult   string                 `json:"process_instance_result"` // "agree",
}

type MediaResponse

type MediaResponse struct {
	OAPIResponse
	Type    string
	MediaID string `json:"media_id"`
	Writer  io.Writer
}

MediaResponse is

type MessageReadListResponse

type MessageReadListResponse struct {
	OAPIResponse
	NextCursor     int64    `json:"next_cursor"`
	ReadUserIdList []string `json:"readUserIdList"`
}

MessageResponse is

type MessageResponse

type MessageResponse struct {
	OAPIResponse
	MessageID string `json:"messageId"`
}

MessageResponse is

type OAMessage

type OAMessage struct {
	URL   string `json:"message_url"`
	PcURL string `json:"pc_message_url"`
	Head  struct {
		BgColor string `json:"bgcolor,omitempty"`
		Text    string `json:"text,omitempty"`
	} `json:"head,omitempty"`
	Body struct {
		Title     string          `json:"title,omitempty"`
		Form      []OAMessageForm `json:"form,omitempty"`
		Rich      OAMessageRich   `json:"rich,omitempty"`
		Content   string          `json:"content,omitempty"`
		Image     string          `json:"image,omitempty"`
		FileCount int             `json:"file_count,omitempty"`
		Author    string          `json:"author,omitempty"`
	} `json:"body,omitempty"`
}

OAMessage is the Message for OA

func (*OAMessage) AppendFormItem

func (m *OAMessage) AppendFormItem(key string, value string)

type OAMessageForm

type OAMessageForm struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

type OAMessageRich

type OAMessageRich struct {
	Num  string `json:"num,omitempty"`
	Unit string `json:"body,omitempty"`
}

type OAPIResponse

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

OAPIResponse is

type ProcInst

type ProcInst struct {
	ProcInstID         string                      `json:"process_instance_id"`
	Title              string                      `json:"title"`
	CreateTime         string                      `json:"create_time"`
	FinishTime         string                      `json:"finish_time"`
	OriginatorUID      string                      `json:"originator_userid"`
	Status             string                      `json:"status"`
	ApproverUIDS       []string                    `json:"approver_userids"`
	CCUIDS             []string                    `json:"cc_userids"`
	Result             string                      `json:"result"`
	BusinessID         string                      `json:"business_id"`
	FormCompntValues   []ProcInstCompntValues      `json:"form_component_values"` // 表单详情列表
	Tasks              []_ProcInstTasks            `json:"tasks"`                 // 任务列表
	OperationRecords   []_ProcInstOperationRecords `json:"operation_records"`     // 操作记录列表
	OriginatorDeptID   string                      `json:"originator_dept_id"`
	OriginatorDeptName string                      `json:"originator_dept_name"`
}

type ProcInstCompntValues

type ProcInstCompntValues struct {
	Name     string `json:"name"`
	Value    string `json:"value"`
	ExtValue string `json:"ext_value"`
}

type RobotAtList

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

type RobotOutgoingMessage

type RobotOutgoingMessage struct {
	MessageType string `json:"msgtype"`
	Text        struct {
		Content string `json:"content,omitempty"`
	} `json:"text,omitempty"`
	MessageID         string `json:"msgId"`
	CreatedAt         int64  `json:"createAt"`
	ConversationID    string `json:"conversationId"`
	ConversationType  string `json:"conversationType"`
	ConversationTitle string `json:"conversationTitle"`
	SenderID          string `json:"senderId"`
	SenderNick        string `json:"senderNick"`
	SenderCorpID      string `json:"senderCorpId"`
	SenderStaffID     string `json:"senderStaffId"`
	ChatbotUserID     string `json:"chatbotUserId"`
	AtUsers           []struct {
		DingTalkID string `json:"dingtalkId,omitempty"`
		StaffID    string `json:"staffId,omitempty"`
	} `json:"atUsers,omitempty"`
}

type SnsPersistentCodeResponse

type SnsPersistentCodeResponse struct {
	OAPIResponse
	UnionID        string `json:"unionid"`
	OpenID         string `json:"openid"`
	PersistentCode string `json:"persistent_code"`
}

获取用户授权的持久授权码返回信息

type SnsTokenResponse

type SnsTokenResponse struct {
	OAPIResponse
	Expires  int    `json:"expires_in"`
	SnsToken string `json:"sns_token"`
}

type SnsUserInfoResponse

type SnsUserInfoResponse struct {
	OAPIResponse

	CorpInfo []struct {
		CorpName    string `json:"corp_name"`
		IsAuth      bool   `json:"is_auth"`
		IsManager   bool   `json:"is_manager"`
		RightsLevel int    `json:"rights_level"`
	} `json:"corp_info"`

	UserInfo struct {
		MaskedMobile string `json:"marskedMobile"`
		Nick         string `json:"nick"`
		OpenID       string `json:"openid"`
		UnionID      string `json:"unionid"`
		DingID       string `json:"dingId"`
	} `json:"user_info"`
}

type TopAPICreateProcInst

type TopAPICreateProcInst struct {
	// 审批模板code
	ProcessCode string `json:"process_code"`
	// 发起人UID
	OriginatorUID string `json:"originator_user_id"`
	// 发起人所在部门
	DeptID int `json:"dept_id"`
	// 审批人列表
	Approvers []string `json:"approvers"`
	// 抄送人列表
	CCList []string `json:"cc_list"`
	//抄送时间,分为(START,FINISH,START_FINISH
	CCPosition string `json:"cc_position"`
	// 审批单内容, Name为审批模板中的列名, value 为该列的值
	FormCompntValues []ProcInstCompntValues `json:"form_component_values"`
}

type TopAPIListProcInstResp

type TopAPIListProcInstResp struct {
	OK struct {
		ErrCode int    `json:"ding_open_errcode"`
		ErrMsg  string `json:"error_msg"`
		Success bool   `json:"success"`
		Result  struct {
			List       []ListProcInst `json:"list"`
			NextCursor int            `json:"next_cursor"`
		} `json:"result"`
	} `json:"result"`
	RequestID string `json:"request_id"`
	// contains filtered or unexported fields
}

type TopAPIMsgGetSendProgress

type TopAPIMsgGetSendProgress struct {
	OK struct {
		ErrCode  int    `json:"ding_open_errcode"`
		ErrMsg   string `json:"error_msg"`
		Success  bool   `json:"success"`
		Progress struct {
			Percent int `json:"progress_in_percent"`
			Status  int `json:"status"`
		} `json:"progress"`
	} `json:"result"`
	// contains filtered or unexported fields
}

type TopAPIMsgGetSendResult

type TopAPIMsgGetSendResult struct {
	OK struct {
		ErrCode    int    `json:"ding_open_errcode"`
		ErrMsg     string `json:"error_msg"`
		Success    bool   `json:"success"`
		SendResult struct {
			InvalidUserIDList   []string `json:"invalid_user_id_list"`
			ForbiddenUserIDList []string `json:"forbidden_user_id_list"`
			FaildedUserIDList   []string `json:"failed_user_id_list"`
			ReadUserIDLIst      []string `json:"read_user_id_list"`
			UnreadUserIDList    []string `json:"unread_user_id_list"`
			InvalidDeptIDList   []int    `json:"invalid_dept_id_list"`
		} `json:"send_result"`
	} `json:"result"`
	// contains filtered or unexported fields
}

type TopAPIResponse

type TopAPIResponse interface {
	// contains filtered or unexported methods
}

type Unmarshallable

type Unmarshallable interface {
	// contains filtered or unexported methods
}

Unmarshallable is

type UploadFile

type UploadFile struct {
	FieldName string
	FileName  string
	Reader    io.Reader
}

UploadFile is for uploading a single file to DingTalk

type User

type User struct {
	OAPIResponse
	Userid     string
	Name       string
	Mobile     string
	Tel        string
	Remark     string
	Order      int
	IsAdmin    bool
	IsBoss     bool
	IsLeader   bool
	IsSys      bool `json:"is_sys"`
	SysLevel   int  `json:"sys_level"`
	Active     bool
	Department []int
	Position   string
	Email      string
	Avatar     string
	Extattr    interface{}
}

type UserInfo

type UserInfo struct {
	OAPIResponse
	Userid          string
	Unionid         string
	Name            string
	OrderInDepts    string
	Tel             string
	WorkPlace       string
	Remark          string
	Mobile          string
	Email           string
	OrgEmail        string
	Active          bool
	IsAdmin         bool
	IsBoss          bool
	IsLeaderInDepts string
	IsHide          bool
	Department      []int
	Position        string
	Avatar          string
	HireDate        int
	Jobnumber       string
	Extattr         interface{}
	IsSenior        bool
	StateCode       string
	Roles           []UserRole
	RealAuthed      bool
}

type UserList

type UserList struct {
	OAPIResponse
	HasMore  bool
	Userlist []User
}

type UserRole

type UserRole struct {
	Id        int
	Name      string
	GroupName string
}

Directories

Path Synopsis
demo

Jump to

Keyboard shortcuts

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