godingtalk

package module
v0.0.0-...-5813a26 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2019 License: MIT Imports: 22 Imported by: 0

README

DingTalk Open API golang SDK

image

Check out DingTalk Open API document at: http://open.dingtalk.com

Usage

Fetch the SDK

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

import (
    "github.com/hugozhu/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/hugozhu/godingtalk/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/hugozhu/godingtalk/demo/github/appengine

Modify app.yaml

cd src/github.com/hugozhu/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
	SourceIdentifier      string `json:"sourceIdentifier"` //	部门标识字段,开发者可用该字段来唯一标识一个部门,并与钉钉外部通讯录里的部门做映射
}

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
	//钉钉应用 app
	AppKey    string
	AppSecret string
	//社交相关的属性
	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 NewDingTalkClientAppKey

func NewDingTalkClientAppKey(appKey string, appSecret string) *DingTalkClient

NewDingTalkClientAppKey create a DingTalkClient instance by appkey and appsecret

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

func (c *DingTalkClient) DeptMember(id int) ([]string, error)

DeptMember is 获取部门人员列表id

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

func (c *DingTalkClient) SendRobotTextAtMessage(accessToken string, msg string, at *RobotAtList) 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) UserDeptPath

func (c *DingTalkClient) UserDeptPath(userID string) ([][]int, error)

UserDeptPath 获取用户部门树path

func (*DingTalkClient) UserDetail

func (c *DingTalkClient) UserDetail(userId string) (User, error)

UserDetail is 获取人员详细信息

func (*DingTalkClient) UserInfoByCode

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

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

func (*DingTalkClient) UserList

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

UserList is 获取部门成员

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 Role

type Role struct {
	ID        string `json:"id"`        //角色id
	Name      string `json:"name"`      //角色名称
	GroupName string `json:"groupName"` //角色组名称
}

Role 角色

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
	IsSys           bool `json:"is_sys"`
	SysLevel        int  `json:"sys_level"`
	Order           int
	IsLeader        bool
	Unionid         string      `json:"unionid"`         // 员工在当前开发者企业账号范围内的唯一标识,系统生成,固定值,不会改变
	Name            string      `json:"name"`            // 员工名字
	TEL             string      `json:"tel"`             // 分机号(仅限企业内部开发调用)
	WorkPlace       string      `json:"workPlace"`       // workPlace 办公地点
	Remark          string      `json:"remark"`          // remark 备注
	Mobile          string      `json:"mobile"`          // mobile 手机号码
	Email           string      `json:"email"`           // email 员工的电子邮箱
	OrgEmail        string      `json:"orgEmail"`        // orgEmail 员工的企业邮箱,如果员工已经开通了企业邮箱,接口会返回,否则不会返回
	Active          bool        `json:"active"`          // active 是否已经激活,true表示已激活,false表示未激活
	OrderInDepts    string      `json:"orderInDepts"`    // orderInDepts 在对应的部门中的排序,Map结构的json字符串,key是部门的Id,value是人员在这个部门的排序值
	IsAdmin         bool        `json:"isAdmin"`         // isAdmin 是否为企业的管理员,true表示是,false表示不是
	IsBoss          bool        `json:"isBoss"`          // isBoss 是否为企业的老板,true表示是,false表示不是
	IsLeaderInDepts string      `json:"isLeaderInDepts"` // isLeaderInDepts 在对应的部门中是否为主管:Map结构的json字符串,key是部门的Id,value是人员在这个部门中是否为主管,true表示是,false表示不是
	IsHide          string      `json:"isHide"`          // isHide 是否号码隐藏,true表示隐藏,false表示不隐藏
	Department      []int       `json:"department"`      // department 成员所属部门id列表
	Position        string      `json:"position"`        // position 职位信息
	Avatar          string      `json:"avatar"`          // avatar 头像url
	HiredDate       string      `json:"hiredDate"`       // hiredDate 入职时间。Unix时间戳 (在OA后台通讯录中的员工基础信息中维护过入职时间才会返回)
	Jobnumber       string      `json:"jobnumber"`       // jobnumber 员工工号
	Extattr         interface{} `json:"extattr"`         // extattr 扩展属性,可以设置多种属性(但手机上最多只能显示10个扩展属性,具体显示哪些属性,请到OA管理后台->设置->通讯录信息设置和OA管理后台->设置->手机端显示信息设置)
	IsSenior        bool        `json:"isSenior"`        // isSenior 是否是高管
	StateCode       string      `json:"stateCode"`       // stateCode 国家地区码
	Roles           []Role      `json:"roles"`           // roles 用户所在角色列表
}

type UserList

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

Directories

Path Synopsis
demo

Jump to

Keyboard shortcuts

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