Documentation ¶
Index ¶
- Constants
- func UnmarshalAndParseError(v Response) requests.Interceptor
- type BasicResponse
- type Client
- func (ding *Client) AccessToken() string
- func (ding *Client) CreateProcessInstance(ctx context.Context, req *RequestCreateProcessInstance) (string, *http.Response, error)
- func (ding *Client) GetAccessToken(ctx context.Context) (string, *http.Response, error)
- func (ding *Client) GetDepartment(ctx context.Context, req *RequestDepartmentInfo) (*DepartmentInfo, *http.Response, error)
- func (ding *Client) GetDepartmentV2(ctx context.Context, deptID int) (*DepartmentInfoV2, *http.Response, error)
- func (ding *Client) GetOrganizationUserCount(ctx context.Context, onlyActive int) (int, *http.Response, error)
- func (ding *Client) GetProcessInstance(ctx context.Context, processInstanceID string) (*ProcessInstance, *http.Response, error)
- func (ding *Client) GetUserByUnionID(ctx context.Context, req *RequestGetByUnionID) (*UserGetByUnionId, *http.Response, error)
- func (ding *Client) GetUserInfoByCode(ctx context.Context, code *RequestGetUserInfoByCode) (*UserInfo, *http.Response, error)
- func (ding *Client) GetUserInfoByMobileV2(ctx context.Context, mobile string) (string, *http.Response, error)
- func (ding *Client) GetUserInfoV2(ctx context.Context, req *RequestUserGet) (*ResponseGetUserInfo, *http.Response, error)
- func (ding *Client) ListParentDeptByUserV2(ctx context.Context, userid string) (*DeptListParent, *http.Response, error)
- func (ding *Client) RetryOnAccessTokenExpired(ctx context.Context, retry int, fn func() error) (err error)
- func (ding *Client) SetAccessToken(token string)
- func (ding *Client) WithAppOption(opt Option) *Client
- type CompleteUserInfo
- type DepartmentInfo
- type DepartmentInfoV2
- type DepartmentLeader
- type DepartmentOrder
- type DeptLeader
- type DeptListParent
- type DeptOrder
- type DingTime
- type DingtalkErr
- type FormComponentValue
- type Lang
- type Option
- type ParentDeptIds
- type ProcessApprovers
- type ProcessAttachment
- type ProcessInstance
- type ProcessOperationRecord
- type ProcessTask
- type RequestCreateProcessInstance
- type RequestDepartmentInfo
- type RequestDepartmentInfoV2
- type RequestGetByUnionID
- type RequestGetUserInfoByCode
- type RequestUserGet
- type Response
- type ResponseCreateProcessInstance
- type ResponseDeptInfo
- type ResponseDeptInfoV2
- type ResponseGetAccessToken
- type ResponseGetByUnionID
- type ResponseGetProcessInstance
- type ResponseGetUserIdByUnionid
- type ResponseGetUserInfo
- type ResponseGetUserInfoByCode
- type ResponseOrganizationUserCount
- type ResponseUserByMobile
- type ResponseUserGet
- type UnixTimestamp
- type UserGetByUnionId
- type UserGetResponse
- type UserInfo
- type UserRole
Constants ¶
const ( // https://ding-doc.dingtalk.com/document#/org-dev-guide/server-api-error-codes // AuthenticationAbnormal 鉴权异常 AuthenticationAbnormal = 88 // InvalidAccessToken 获取access_token时Secret错误,或者access_token无效 InvalidAccessToken = "40001" EmptyAccessToken = "40000" IllegalAccessToken = "40014" )
Variables ¶
This section is empty.
Functions ¶
func UnmarshalAndParseError ¶
func UnmarshalAndParseError(v Response) requests.Interceptor
Types ¶
type BasicResponse ¶
type BasicResponse struct { RequestID string `json:"request_id,omitempty"` *DingtalkErr `json:",inline"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AccessToken ¶
func (*Client) CreateProcessInstance ¶
func (ding *Client) CreateProcessInstance(ctx context.Context, req *RequestCreateProcessInstance) (string, *http.Response, error)
发起审批实例 https://developers.dingtalk.com/document/app/initiate-approval
func (*Client) GetAccessToken ¶
GetAccessToken 获取access_token https://ding-doc.dingtalk.com/document#/org-dev-guide/obtain-access_token
func (*Client) GetDepartment ¶
func (ding *Client) GetDepartment(ctx context.Context, req *RequestDepartmentInfo) (*DepartmentInfo, *http.Response, error)
获取部门详情 https://ding-doc.dingtalk.com/document#/org-dev-guide/queries-department-details-v1
func (*Client) GetDepartmentV2 ¶
func (ding *Client) GetDepartmentV2(ctx context.Context, deptID int) (*DepartmentInfoV2, *http.Response, error)
获取部门详情,可以得到部门主管
func (*Client) GetOrganizationUserCount ¶
func (ding *Client) GetOrganizationUserCount(ctx context.Context, onlyActive int) (int, *http.Response, error)
GetOrganizationUserCount 获取组织人员数
func (*Client) GetProcessInstance ¶
func (ding *Client) GetProcessInstance(ctx context.Context, processInstanceID string) (*ProcessInstance, *http.Response, error)
获取审批实例详情 https://developers.dingtalk.com/document/app/obtains-the-details-of-a-single-approval-instance
func (*Client) GetUserByUnionID ¶
func (ding *Client) GetUserByUnionID(ctx context.Context, req *RequestGetByUnionID) (*UserGetByUnionId, *http.Response, error)
func (*Client) GetUserInfoByCode ¶
func (ding *Client) GetUserInfoByCode(ctx context.Context, code *RequestGetUserInfoByCode) (*UserInfo, *http.Response, error)
GetUserInfoByCode 根据sns临时授权码获取用户信息 https://ding-doc.dingtalk.com/document#/org-dev-guide/obtain-the-user-information-based-on-the-sns-temporary-authorization#topic-1995619
func (*Client) GetUserInfoByMobileV2 ¶
func (ding *Client) GetUserInfoByMobileV2(ctx context.Context, mobile string) (string, *http.Response, error)
根据手机号获取userid v2 https://ding-doc.dingtalk.com/document#/org-dev-guide/query-users-by-phone-number
func (*Client) GetUserInfoV2 ¶
func (ding *Client) GetUserInfoV2(ctx context.Context, req *RequestUserGet) (*ResponseGetUserInfo, *http.Response, error)
获取用户详情V2 https://ding-doc.dingtalk.com/document#/org-dev-guide/queries-user-details
func (*Client) ListParentDeptByUserV2 ¶
func (ding *Client) ListParentDeptByUserV2(ctx context.Context, userid string) (*DeptListParent, *http.Response, error)
获取指定用户的所有父部门列表 https://ding-doc.dingtalk.com/document#/org-dev-guide/obtains-the-list-of-all-parent-departments-of-a-user
func (*Client) RetryOnAccessTokenExpired ¶
func (*Client) SetAccessToken ¶
func (*Client) WithAppOption ¶
type CompleteUserInfo ¶
type CompleteUserInfo struct { UserID string `json:"userid"` UnionID string `json:"unionid"` Name string `json:"name"` Avatar string `json:"avatar"` StateCode string `json:"state_code"` Mobile string `json:"mobile"` HideMobile bool `json:"hide_mobile"` Telephone string `json:"telephone"` JobNumber string `json:"job_number"` Title string `json:"title"` Email string `json:"email"` WorkPlace string `json:"work_place"` Remark string `json:"remark"` DeptIdList []int `json:"dept_id_list"` DeptOrderList []DeptOrder `json:"dept_order_list"` Extension string `json:"extension"` HiredDate int `json:"hired_date"` Active bool `json:"active"` RealAuthed bool `json:"real_authed"` Senior bool `json:"senior"` Admin bool `json:"admin"` Boss bool `json:"boss"` LeaderInDept []DeptLeader `json:"leader_in_dept"` RoleList []UserRole `json:"role_list"` }
type DepartmentInfo ¶
type DepartmentInfo struct { Id int `json:"id"` Name string `json:"name"` Order int `json:"order"` ParentId int `json:"parentid"` SourceIdentifier string `json:"source_identifier"` CreateDeptGroup bool `json:"createDeptGroup"` AutoAddUser bool `json:"autoAddUser"` GroupContainSubDept bool `json:"groupContainSubDept"` OrgDeptOwner string `json:"orgDeptOwner"` DeptGroupChatId string `json:"deptGroupChatId"` DeptManagerUseridList string `json:"deptManagerUseridList"` OuterDept bool `json:"outerDept"` OuterPermitUsers string `json:"outerPermitUsers"` OuterPermitDepts string `json:"outerPermitDepts"` DeptHiding bool `json:"deptHiding"` DeptPermits string `json:"deptPermits"` UserPermits string `json:"userPermits"` }
type DepartmentInfoV2 ¶
type DepartmentInfoV2 struct { DeptID int `json:"dept_id"` Name string `json:"name,omitempty"` ParentID int `json:"parent_id,omitempty"` SourceIdentifier string `json:"source_identifier,omitempty"` CreateDeptGroup bool `json:"create_dept_group,omitempty"` AutoAddUser bool `json:"auto_add_user,omitempty"` FromUnionOrg bool `json:"from_union_org,omitempty"` Tags string `json:"tags,omitempty"` Order int `json:"order,omitempty"` DeptGroupChatID string `json:"dept_group_chat_id,omitempty"` GroupContainSubDept bool `json:"group_contain_sub_dept,omitempty"` OrgDeptOwner string `json:"org_dept_owner,omitempty"` DeptManagerUseridList []string `json:"dept_manager_userid_list,omitempty"` OuterDept bool `json:"outer_dept,omitempty"` OuterPermitDepts []int `json:"outer_permit_depts,omitempty"` OuterPermitUsers []string `json:"outer_permit_users,omitempty"` HideDept bool `json:"hide_dept,omitempty"` UserPermits []string `json:"user_permits,omitempty"` DeptPermits []int `json:"dept_permits,omitempty"` }
type DepartmentLeader ¶
type DepartmentOrder ¶
DepartmentOrder 部门排序
type DeptLeader ¶
type DeptListParent ¶
type DeptListParent struct {
ParentDeptList []ParentDeptIds `json:"parent_list"`
}
type DingtalkErr ¶
type DingtalkErr struct { ErrorMessage string `json:"errmsg,omitempty"` ErrorCode int `json:"errcode,omitempty"` SubCode string `json:"sub_code,omitempty"` SubMessage string `json:"sub_msg,omitempty"` }
DingtalkErr 钉钉错误信息
func (*DingtalkErr) IsAccessTokenExpired ¶
func (de *DingtalkErr) IsAccessTokenExpired() bool
IsAccessTokenExpired access_token是否过期
type FormComponentValue ¶
type Option ¶
type Option struct { AgentID string AppKey string AppSecret string LoginAppID string LoginAppSecret string LoginCallbackURI string }
Option 应用凭证
type ParentDeptIds ¶
type ParentDeptIds struct {
ParentDeptIdList []int `json:"parent_dept_id_list"`
}
type ProcessApprovers ¶
type ProcessAttachment ¶
type ProcessInstance ¶
type ProcessInstance struct { Title string `json:"title,omitempty"` CreateTime DingTime `json:"create_time,omitempty"` FinishTime DingTime `json:"finish_time,omitempty"` OriginatorUserID string `json:"originator_userid,omitempty"` OriginatorDeptID string `json:"originator_dept_id,omitempty"` Status string `json:"status,omitempty"` // RUNNING审批中COMPLETED完成 ApproverUserIDs []string `json:"approver_userids,omitempty"` CCUserIDs []string `json:"cc_userids,omitempty"` Result string `json:"result,omitempty"` // agree同意refuse拒绝 BusinessID string `json:"business_id,omitempty"` OperationRecords []*ProcessOperationRecord `json:"operation_records,omitempty"` Tasks []*ProcessTask `json:"tasks,omitempty"` OriginatorDeptName string `json:"originator_dept_name,omitempty"` BizAction string `json:"biz_action,omitempty"` AttachedProcessInstanceIDs []string `json:"attached_process_instance_ids,omitempty"` FormComponentValues []*FormComponentValue `json:"form_component_values,omitempty"` MainProcessInstanceID string `json:"main_process_instance_id,omitempty"` }
审批实例详情
type ProcessOperationRecord ¶
type ProcessOperationRecord struct { UserID string `json:"user_id,omitempty"` Date DingTime `json:"date,omitempty"` OperationType string `json:"operation_type,omitempty"` OperationResult string `json:"operation_result,omitempty"` Remark string `json:"remark,omitempty"` Attachments []*ProcessAttachment `json:"attachments,omitempty"` }
type ProcessTask ¶
type ProcessTask struct { UserID string `json:"userid,omitempty"` TaskStatus string `json:"task_status,omitempty"` TaskResult string `json:"task_result,omitempty"` CreateTime DingTime `json:"create_time,omitempty"` FinishTime DingTime `json:"finish_time,omitempty"` TaskID string `json:"taskid,omitempty"` URL string `json:"url,omitempty"` }
type RequestCreateProcessInstance ¶
type RequestCreateProcessInstance struct { FormComponentValues []*FormComponentValue `json:"form_component_values,omitempty"` AgentID string `json:"agent_id,omitempty"` DeptID string `json:"dept_id,omitempty"` ProcessCode string `json:"process_code,omitempty"` OriginatorUserID string `json:"originator_user_id,omitempty"` // 审批发起人ID ApproversV2 []ProcessApprovers `json:"approvers_v2,omitempty"` CCList string `json:"cc_list,omitempty"` // 抄送人userid列表 CCPosition string `json:"cc_position,omitempty"` // 抄送时间,分为(START, FINISH, START_FINISH) }
审批请求参数
type RequestDepartmentInfo ¶
type RequestDepartmentInfoV2 ¶
type RequestGetByUnionID ¶
type RequestGetByUnionID struct {
UnionID string `json:"unionid"`
}
RequestGetByUnionID https://oapi.dingtalk.com/topapi/user/getbyunionid
type RequestGetUserInfoByCode ¶
type RequestGetUserInfoByCode struct {
TempAuthCode string `json:"tmp_auth_code"`
}
RequestGetUserInfoByCode https://oapi.dingtalk.com/sns/getuserinfo_bycode
type RequestUserGet ¶
type RequestUserGet struct { UserID string `json:"userid"` Language string `json:"language,omitempty"` }
RequestUserGet https://oapi.dingtalk.com/topapi/v2/user/get
type ResponseCreateProcessInstance ¶
type ResponseCreateProcessInstance struct { BasicResponse `json:",inline"` ProcessInstanceID string `json:"process_instance_id,omitempty"` }
type ResponseDeptInfo ¶
type ResponseDeptInfo struct { BasicResponse `json:",inline"` *DepartmentInfo }
type ResponseDeptInfoV2 ¶
type ResponseDeptInfoV2 struct { BasicResponse `json:",inline"` Result *DepartmentInfoV2 `json:"result,omitempty"` }
type ResponseGetAccessToken ¶
type ResponseGetAccessToken struct { *DingtalkErr `json:",inline"` AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` }
type ResponseGetByUnionID ¶
type ResponseGetByUnionID struct { *BasicResponse `json:",inline"` Result *UserGetByUnionId `json:"result,omitempty"` }
ResponseGetByUnionID https://oapi.dingtalk.com/topapi/user/getbyunionid
type ResponseGetProcessInstance ¶
type ResponseGetProcessInstance struct { BasicResponse `json:",inline"` ProcessInstance *ProcessInstance `json:"process_instance,omitempty"` }
type ResponseGetUserIdByUnionid ¶
type ResponseGetUserIdByUnionid struct { BasicResponse `json:",inline"` Result *DeptListParent `json:"result"` }
type ResponseGetUserInfo ¶
type ResponseGetUserInfo struct { *DingtalkErr `json:",inline"` Result *CompleteUserInfo `json:"result"` }
type ResponseGetUserInfoByCode ¶
type ResponseGetUserInfoByCode struct { UserInfo *UserInfo `json:"user_info"` *DingtalkErr `json:",inline"` }
ResponseGetUserInfoByCode https://oapi.dingtalk.com/sns/getuserinfo_bycode
type ResponseOrganizationUserCount ¶
type ResponseOrganizationUserCount struct { *DingtalkErr `json:",inline"` Count int `json:"count"` }
type ResponseUserByMobile ¶
type ResponseUserByMobile struct { BasicResponse `json:",inline"` Result struct { Userid string `json:"userid"` } `json:"result"` }
type ResponseUserGet ¶
type ResponseUserGet struct { BasicResponse `json:",inline"` Result *UserGetResponse `json:"result"` }
ResponseUserGet https://oapi.dingtalk.com/topapi/v2/user/get
type UnixTimestamp ¶
type UnixTimestamp struct {
// contains filtered or unexported fields
}
func (*UnixTimestamp) MarshalJSON ¶
func (ts *UnixTimestamp) MarshalJSON() ([]byte, error)
func (*UnixTimestamp) Time ¶
func (ts *UnixTimestamp) Time() time.Time
func (*UnixTimestamp) UnmarshalJSON ¶
func (ts *UnixTimestamp) UnmarshalJSON(data []byte) error
type UserGetByUnionId ¶
type UserGetResponse ¶
type UserGetResponse struct { UserID string `json:"userid"` UnionID string `json:"unionid"` Name string `json:"name"` Avatar string `json:"avatar"` StateCode string `json:"state_code"` // 国际电话区号 Mobile string `json:"mobile"` HideMobile bool `json:"hide_mobile"` // 是否隐藏手机号码 Telephone string `json:"telephone"` // 分机号 JobNumber string `json:"job_number"` // 工号 Title string `json:"title"` // 职位 Email string `json:"email"` // 邮箱 WorkPlace string `json:"work_place"` // 办公地点 Remark string `json:"remark"` DepartmentIDs []int `json:"dept_id_list"` // 所属部门ID列表 DepartmentOrders []*DepartmentOrder `json:"dept_order_list"` // 员工在对应部门的排序 Extension string `json:"extension"` // 扩展属性 HiredDate *UnixTimestamp `json:"hired_date"` Active bool `json:"active"` RealAuthed bool `json:"real_authed"` // 是否完成了实名认证 Admin bool `json:"admin"` // 是否未企业管理员 Boss bool `json:"boss"` // 是否为企业老板 LeaderInDepartment []*DepartmentLeader `json:"leader_in_dept"` Roles []*UserRole `json:"role_list"` }