Documentation ¶
Index ¶
- type ActionCardBody
- type AlertPerson
- type ApprovalResult
- type ApprovalStatus
- type ApprovalTask
- type AtBody
- type AttachmentFiled
- type BtnBody
- type CommentInput
- type CommentResp
- type CommonResponse
- type ContactClient
- type CreateProcessInstanceInput
- type CreateProcessInstanceResponse
- type Depart
- type Department
- type DingTalkClient
- func (d *DingTalkClient) CronSetAccessToken() error
- func (d *DingTalkClient) SetAccessToken() error
- func (d *DingTalkClient) WithDepartClient() *DingTalkClient
- func (d *DingTalkClient) WithMiniProgramClient(agentId int64) *DingTalkClient
- func (d *DingTalkClient) WithUserClient() *DingTalkClient
- func (d *DingTalkClient) WithWorkflowClient() *DingTalkClient
- func (d *DingTalkClient) WithWorkflowClientV2() *DingTalkClient
- func (d *DingTalkClient) WorkflowSvc() *WorkflowClient
- type DingTalkConfig
- type FeedCard
- type FormComponentValue
- type GetDepartmentDetailInput
- type GetDepartmentDetailResponse
- type GetDepartmentsIDInput
- type GetDepartmentsIDResponse
- type GetDepartmentsInput
- type GetDepartmentsResponse
- type GetUsersInput
- type GetUsersResponse
- type GrantProcessInstanceForDownloadFileInput
- type GrantProcessInstanceForDownloadFileResp
- type Json
- type LinkBody
- type ListWorkflowInput
- type LowApiError
- type MarkDownBody
- type MessageContent
- type MiniProgram
- type OperationRecord
- type ProcessInstance
- type ProcessInstanceResp
- func (r *ProcessInstanceResp) GetAttachmentFileIDs() ([]AttachmentFiled, error)
- func (r *ProcessInstanceResp) GetComment() ([]CommentResp, error)
- func (r *ProcessInstanceResp) GetResult() ApprovalResult
- func (r *ProcessInstanceResp) GetStatus() ApprovalStatus
- func (r *ProcessInstanceResp) IsAgree() bool
- type ProcessInstanceRespV2
- type ProcessInstanceResult
- type RobotClient
- type SendGroupNotificationRequest
- type SendMessageRequest
- type SendWorkNotificationRequest
- type TextBody
- type Thumbnail
- type TokenDetail
- type User
- type UserClient
- type UserInfo
- type Workflow
- type WorkflowClient
- func (c *WorkflowClient) AddProcessInstancedComment(ctx context.Context, input *CommentInput) error
- func (c *WorkflowClient) GetProcessInstance(ctx context.Context, processID string) (*ProcessInstanceResp, error)
- func (c *WorkflowClient) GrantProcessInstanceForDownloadFile(ctx context.Context, input *GrantProcessInstanceForDownloadFileInput) (*GrantProcessInstanceForDownloadFileResp, error)
- func (c *WorkflowClient) ListProcessInstanceIds(ctx context.Context, input *ListWorkflowInput) ([]string, error)
- func (c *WorkflowClient) TerminateProcessInstance(ctx context.Context, processID string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionCardBody ¶
type AlertPerson ¶
func (AlertPerson) Marshal ¶
func (p AlertPerson) Marshal() string
type ApprovalResult ¶
type ApprovalResult string
const ( Agree ApprovalResult = "agree" Refuse ApprovalResult = "refuse" Revoke ApprovalResult = "revoke" Approving ApprovalResult = "approving" )
type ApprovalStatus ¶
type ApprovalStatus string
const ( Running ApprovalStatus = "RUNNING" Completed ApprovalStatus = "COMPLETED" Terminated ApprovalStatus = "TERMINATED" New ApprovalStatus = "NEW" Canceled ApprovalStatus = "CANCELED" )
流程实例状态,未传值代表查询所有状态的实例ID列表。 NEW:新创建 RUNNING:审批中 TERMINATED:被终止 COMPLETED:完成 CANCELED:取消
type ApprovalTask ¶
type ApprovalTask struct { ActivityId *string `json:"activityId,omitempty" xml:"activityId,omitempty"` CreateTime *string `json:"createTime,omitempty" xml:"createTime,omitempty"` FinishTime *string `json:"finishTime,omitempty" xml:"finishTime,omitempty"` MobileUrl *string `json:"mobileUrl,omitempty" xml:"mobileUrl,omitempty"` PcUrl *string `json:"pcUrl,omitempty" xml:"pcUrl,omitempty"` ProcessInstanceId *string `json:"processInstanceId,omitempty" xml:"processInstanceId,omitempty"` Result *string `json:"result,omitempty" xml:"result,omitempty"` Status *string `json:"status,omitempty" xml:"status,omitempty"` TaskId *int64 `json:"taskId,omitempty" xml:"taskId,omitempty"` UserId *string `json:"userId,omitempty" xml:"userId,omitempty"` }
type AttachmentFiled ¶
type CommentInput ¶
type CommentInput struct { ProcessID string Comment string //评论内容 AlertPerson AlertPerson //通知@多人, "[周xx](2907024xxxx09257xxxx)[崔xx](303256xxxx8455xxxx)" CommentUserID string //指评论的人 }
type CommentResp ¶
type CommentResp struct { }
type CommonResponse ¶
type ContactClient ¶
type ContactClient struct {
// contains filtered or unexported fields
}
func NewContactClient ¶
func NewContactClient(client *contact.Client, token *TokenDetail) *ContactClient
func (*ContactClient) DepartmentList ¶
func (c *ContactClient) DepartmentList(ctx context.Context) ([]*int64, error)
DepartmentList 403 forbidden
type CreateProcessInstanceInput ¶
type CreateProcessInstanceInput struct { ProcessCode string `json:"processCode" binding:"required"` // 流程模板唯一标识,可在OA管理后台编辑审批表单部分查询 OriginatorUserID string `json:"originatorUserId" binding:"required"` // 审批实例发起人的userid FormComponentValues []FormComponentValue `json:"formComponentValues" binding:"required"` // 审批流表单参数 表单数据内容,控件列表,最大列表长度:150。 DeptId string `json:"deptId"` // 若approvers未传值时(即不直接指定审批人列表),则deptId需必填,若为根部门ID需填-1。 }
type CreateProcessInstanceResponse ¶
type CreateProcessInstanceResponse struct {
InstanceId string `json:"instanceId"`
}
type Depart ¶
type Depart interface { // 获取部门详情 GetDepartmentDetail(input *GetDepartmentDetailInput, accessToken string) (*Department, error) // 获取部门列表 GetDepartments(input *GetDepartmentsInput, accessToken string) ([]*Department, error) // 获取所有部门 GetAllDepartments(accessToken string) ([]*Department, error) // 获取子部门ID列表 GetDepartmentIDs(input *GetDepartmentsIDInput, accessToken string) ([]int64, error) // 获取所有部门 ID GetAllDepartmentIDs(accessToken string) ([]int64, error) }
type Department ¶
type DingTalkClient ¶
type DingTalkClient struct { OpenapiConfig *openapi.Config AuthClient *oauth.Client //AccessTokenCache AccessToken *TokenDetail Locker *sync.Mutex DingTalkConfig *DingTalkConfig // Needed Client WorkflowClient *WorkflowClient MiniProgram MiniProgram Workflow Workflow Depart Depart User User // contains filtered or unexported fields }
func NewDingTalkClient ¶
func NewDingTalkClient(appConfig *DingTalkConfig) (*DingTalkClient, error)
func (*DingTalkClient) CronSetAccessToken ¶
func (d *DingTalkClient) CronSetAccessToken() error
func (*DingTalkClient) SetAccessToken ¶
func (d *DingTalkClient) SetAccessToken() error
func (*DingTalkClient) WithDepartClient ¶
func (d *DingTalkClient) WithDepartClient() *DingTalkClient
func (*DingTalkClient) WithMiniProgramClient ¶
func (d *DingTalkClient) WithMiniProgramClient(agentId int64) *DingTalkClient
func (*DingTalkClient) WithUserClient ¶
func (d *DingTalkClient) WithUserClient() *DingTalkClient
func (*DingTalkClient) WithWorkflowClient ¶
func (d *DingTalkClient) WithWorkflowClient() *DingTalkClient
func (*DingTalkClient) WithWorkflowClientV2 ¶
func (d *DingTalkClient) WithWorkflowClientV2() *DingTalkClient
func (*DingTalkClient) WorkflowSvc ¶
func (d *DingTalkClient) WorkflowSvc() *WorkflowClient
type DingTalkConfig ¶
type FormComponentValue ¶
type GetDepartmentDetailInput ¶ added in v1.2.0
type GetDepartmentDetailResponse ¶ added in v1.2.0
type GetDepartmentDetailResponse struct { // request_id RequestId string `json:"request_id"` // errcode ErrCode int `json:"errcode"` // errmsg ErrMsg string `json:"errmsg"` // result Result Department `json:"result"` }
type GetDepartmentsIDInput ¶
type GetDepartmentsIDInput struct { // dept_id number DeptID int64 `json:"dept_id"` }
type GetDepartmentsInput ¶
type GetDepartmentsResponse ¶
type GetDepartmentsResponse struct { // request_id RequestId string `json:"request_id"` // errcode ErrCode int `json:"errcode"` // errmsg ErrMsg string `json:"errmsg"` // result Result []*Department `json:"result"` }
type GetUsersInput ¶
type GetUsersResponse ¶
type GetUsersResponse struct { // errcode ErrCode int64 `json:"errcode"` // errmsg ErrMsg string `json:"errmsg"` // result Result struct { // has_more bool HasMore bool `json:"has_more"` // next_cursor number NextCursor int64 `json:"next_cursor"` // list List []*UserInfo `json:"list"` } `json:"result"` }
type GrantProcessInstanceForDownloadFileResp ¶
type GrantProcessInstanceForDownloadFileResp workflow.GrantProcessInstanceForDownloadFileResponseBody
type ListWorkflowInput ¶
type ListWorkflowInput struct { ProcessCode string StartTime int64 EndTime int64 NextToken int64 Statuses []ApprovalStatus }
type LowApiError ¶
func (*LowApiError) Error ¶
func (e *LowApiError) Error() string
type MarkDownBody ¶
type MessageContent ¶
type MessageContent struct { MsgType string `json:"msgtype"` Text TextBody `json:"text,omitempty"` At AtBody `json:"at,omitempty"` Link LinkBody `json:"link,omitempty"` MarkDown MarkDownBody `json:"markdown,omitempty"` ActionCard ActionCardBody `json:"actionCard,omitempty"` }
type MiniProgram ¶
type MiniProgram interface { // 使用机器人发送工作通知 SendWorkNotification(ctx context.Context, req *SendWorkNotificationRequest, accessToken string) error // 发送到群会话,chatID很难找,弃用。改用群机器人 SendGroupNotification(ctx context.Context, req *SendGroupNotificationRequest, accessToken string) error //发送消息到企业群接口相关文档,已于2022年09月23日迁移至历史文档(不推荐)目录。不再支持新应用接入,已接入的应用可以正常调用。 }
func NewMiniProgram ¶
func NewMiniProgram(agentId int64, requestBuilder requestBuilder) MiniProgram
agentId 应用程序的agentId,后台查看
type OperationRecord ¶ added in v1.1.0
type ProcessInstance ¶
type ProcessInstance struct {
*workflow_1_0.GetProcessInstanceResponseBodyResult
}
type ProcessInstanceResp ¶
type ProcessInstanceResp workflow.GetProcessInstanceResponseBody
func (*ProcessInstanceResp) GetAttachmentFileIDs ¶
func (r *ProcessInstanceResp) GetAttachmentFileIDs() ([]AttachmentFiled, error)
func (*ProcessInstanceResp) GetComment ¶
func (r *ProcessInstanceResp) GetComment() ([]CommentResp, error)
drop 用户直接在detail获取操作
func (*ProcessInstanceResp) GetResult ¶
func (r *ProcessInstanceResp) GetResult() ApprovalResult
func (*ProcessInstanceResp) GetStatus ¶
func (r *ProcessInstanceResp) GetStatus() ApprovalStatus
func (*ProcessInstanceResp) IsAgree ¶
func (r *ProcessInstanceResp) IsAgree() bool
type ProcessInstanceRespV2 ¶ added in v1.1.0
type ProcessInstanceRespV2 struct { Success bool `json:"success"` Result ProcessInstanceResult `json:"result"` }
type ProcessInstanceResult ¶ added in v1.1.0
type ProcessInstanceResult struct { Status *string `json:"status"` Title *string `json:"title"` FinishTime *string `json:"finishTime"` CreateTime *string `json:"createTime"` Result *string `json:"result"` BusinessId *string `json:"businessId"` OperationRecords []OperationRecord `json:"operationRecords"` Tasks []ApprovalTask `json:"tasks"` FormComponentValues []FormComponentValue `json:"formComponentValues"` }
没有完全写完,需要自己加入解析的字段
type RobotClient ¶
type RobotClient struct {
// contains filtered or unexported fields
}
func NewRobotClient ¶
func NewRobotClient() *RobotClient
func (*RobotClient) SendMessage ¶
func (c *RobotClient) SendMessage(ctx context.Context, req *SendMessageRequest) error
type SendGroupNotificationRequest ¶
type SendGroupNotificationRequest struct { // chatid ChatId *string `json:"chatid" required:"true"` // 群会话的id // msg Msg *MessageContent `json:"msg" required:"true"` // 消息内容,消息类型和样例可参考“消息类型与数据格式”。最长不超过2048个字节 }
type SendMessageRequest ¶
type SendMessageRequest struct { AccessToken string `json:"access_token"` Sign string `json:"sign"` MessageContent MessageContent `json:"message_content"` }
type SendWorkNotificationRequest ¶
type SendWorkNotificationRequest struct { // agent_id AgentId *int64 `json:"agent_id" required:"true"` // 应用agentId。 12345 // userid_list UseridList *string `json:"userid_list" example:"user123,user456"` // 接收者的用户userid列表,最大列表长度:100 // dept_id_list DeptIdList *string `json:"dept_id_list" example:"123,456"` // 接收者的部门id列表。最大列表长度为20 // to_all_user ToAllUser *bool `json:"to_all_user" default:"false"` // 是否发送给企业全部用户 当设置为false时必须指定userid_list或dept_id_list其中一个参数的值。 // msg { "msgtype": "text", "text": { "content": "请提交日报。" } } Msg *MessageContent `json:"msg" required:"true"` // 消息内容,消息类型和样例可参考“消息类型与数据格式”。最长不超过2048个字节 }
type TokenDetail ¶
type TokenDetail struct { // Dingtalk token Token string `json:"token"` CreateAt int64 `json:"create_at"` ExpireIn int64 `json:"expire_in"` }
func (*TokenDetail) IsExpire ¶
func (t *TokenDetail) IsExpire() bool
type User ¶
type User interface { // 获取部门id的用户信息 GetUsers(*GetUsersInput, string) ([]*UserInfo, error) }
type UserClient ¶
type UserClient struct {
// contains filtered or unexported fields
}
func (*UserClient) GetUsers ¶
func (c *UserClient) GetUsers(input *GetUsersInput, accessToken string) ([]*UserInfo, error)
type UserInfo ¶
type UserInfo struct { // userid string UserID string `json:"userid"` // unionid string UnionID string `json:"unionid"` // name string Name string `json:"name"` // avatar Avatar string `json:"avatar"` // state_code 国际电话区号。 StateCode string `json:"state_code"` // mobile Mobile string `json:"mobile"` // hide_mobile bool HideMobile bool `json:"hide_mobile"` // telephone string 分机号 Telephone string `json:"telephone"` // job_number JobNumber string `json:"job_number"` // title Title string `json:"title"` // email Email string `json:"email"` // org_email OrgEmail string `json:"org_email"` // work_place WorkPlace string `json:"work_place"` // remark Remark string `json:"remark"` // dept_id_list DeptIDList []int64 `json:"dept_id_list"` // dept_order number 员工在部门中的排序。 DeptOrder int64 `json:"dept_order"` // extension string 扩展属性。 Extension string `json:"extension"` // hired_date number 入职时间,Unix时间戳,单位毫秒。 HiredDate int64 `json:"hired_date"` // active bool Active bool `json:"active"` // admin Admin bool `json:"admin"` // boss Boss bool `json:"boss"` // leader Leader bool `json:"leader"` // exclusive_account 是否企业账号 ExclusiveAccount bool `json:"exclusive_account"` }
type Workflow ¶
type Workflow interface { // 创建审批实例 CreateProcessInstance(input *CreateProcessInstanceInput, accessToken string) (string, error) // 查询审批工单 GetProcessInstance(processID string, accessToken string) (*ProcessInstanceRespV2, error) }
func NewWorkflowV2 ¶
func NewWorkflowV2(requestBuilder requestBuilder) Workflow
type WorkflowClient ¶
type WorkflowClient struct {
// contains filtered or unexported fields
}
func NewWorkflowClient ¶
func NewWorkflowClient(client *workflow.Client, token *TokenDetail) *WorkflowClient
func (*WorkflowClient) AddProcessInstancedComment ¶
func (c *WorkflowClient) AddProcessInstancedComment(ctx context.Context, input *CommentInput) error
func (*WorkflowClient) GetProcessInstance ¶
func (c *WorkflowClient) GetProcessInstance(ctx context.Context, processID string) (*ProcessInstanceResp, error)
func (*WorkflowClient) GrantProcessInstanceForDownloadFile ¶
func (c *WorkflowClient) GrantProcessInstanceForDownloadFile(ctx context.Context, input *GrantProcessInstanceForDownloadFileInput) (*GrantProcessInstanceForDownloadFileResp, error)
func (*WorkflowClient) ListProcessInstanceIds ¶
func (c *WorkflowClient) ListProcessInstanceIds(ctx context.Context, input *ListWorkflowInput) ([]string, error)
func (*WorkflowClient) TerminateProcessInstance ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.