-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_approval_instance_preview.go
More file actions
94 lines (83 loc) · 5.2 KB
/
api_approval_instance_preview.go
File metadata and controls
94 lines (83 loc) · 5.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Code generated by lark_sdk_gen. DO NOT EDIT.
/**
* Copyright 2022 chyroc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lark
import (
"context"
)
// PreviewApprovalInstance 提交审批前, 预览审批流程。或者发起审批后, 在某一审批节点预览后续流程。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/ukTM5UjL5ETO14SOxkTN/approval-preview
// new doc: https://open.feishu.cn/document/server-docs/approval-v4/instance/approval-preview
func (r *ApprovalService) PreviewApprovalInstance(ctx context.Context, request *PreviewApprovalInstanceReq, options ...MethodOptionFunc) (*PreviewApprovalInstanceResp, *Response, error) {
if r.cli.mock.mockApprovalPreviewApprovalInstance != nil {
r.cli.log(ctx, LogLevelDebug, "[lark] Approval#PreviewApprovalInstance mock enable")
return r.cli.mock.mockApprovalPreviewApprovalInstance(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Approval",
API: "PreviewApprovalInstance",
Method: "POST",
URL: r.cli.openBaseURL + "/open-apis/approval/v4/instances/preview",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
}
resp := new(previewApprovalInstanceResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
// MockApprovalPreviewApprovalInstance mock ApprovalPreviewApprovalInstance method
func (r *Mock) MockApprovalPreviewApprovalInstance(f func(ctx context.Context, request *PreviewApprovalInstanceReq, options ...MethodOptionFunc) (*PreviewApprovalInstanceResp, *Response, error)) {
r.mockApprovalPreviewApprovalInstance = f
}
// UnMockApprovalPreviewApprovalInstance un-mock ApprovalPreviewApprovalInstance method
func (r *Mock) UnMockApprovalPreviewApprovalInstance() {
r.mockApprovalPreviewApprovalInstance = nil
}
// PreviewApprovalInstanceReq ...
type PreviewApprovalInstanceReq struct {
UserIDType *IDType `query:"user_id_type" json:"-"` // 用户 ID 类型, 示例值: "open_id", 可选值有: `open_id`: 用户的 open id, `union_id`: 用户的 union id, `user_id`: 用户的 user id, 默认值: `open_id`, 当值为 `user_id`, 字段权限要求: 获取用户 user ID
ApprovalCode *string `json:"approval_code,omitempty"` // 审批定义 Code
UserID string `json:"user_id,omitempty"` // 发起审批用户, employeid或者openid
DepartmentID *string `json:"department_id,omitempty"` // 发起审批用户部门, 如果用户只属于一个部门, 可以不填, 如果属于多个部门, 必须填其中一个部门
Form ApprovalWidgetList `json:"form,omitempty"` // JSON字符串, 控件值。提交审批之前, 查看预览流程时, 该字段必填
InstanceCode *string `json:"instance_code,omitempty"` // 审批实例code
TaskID *string `json:"task_id,omitempty"` // 若审批实例已存在, 则传递当前审批任务对应的task_id, 并且user_id需要传task的指派人
}
// PreviewApprovalInstanceResp ...
type PreviewApprovalInstanceResp struct {
PreviewNodes []*PreviewApprovalInstanceRespPreviewNode `json:"preview_nodes,omitempty"` // 预览节点信息
}
// PreviewApprovalInstanceRespPreviewNode ...
type PreviewApprovalInstanceRespPreviewNode struct {
UserIDList []string `json:"user_id_list,omitempty"` // 审批人id列表
EndCcIDList []string `json:"end_cc_id_list,omitempty"` // 审批结束抄送人id列表
NodeID string `json:"node_id,omitempty"` // 节点id
NodeName string `json:"node_name,omitempty"` // 节点名称
NodeType string `json:"node_type,omitempty"` // 节点类型: AND: 会签 OR: 或签 AUTO_PASS:自动通过 AUTO_REJECT:自动拒绝 SEQUENTIAL:按顺序
CustomNodeID string `json:"custom_node_id,omitempty"` // 用户自定义节点id
Comments []string `json:"comments,omitempty"` // 节点的说明信息
IsEmptyLogic bool `json:"is_empty_logic,omitempty"` // 审批人是否为空, 若为空, 则user_id_list为兜底审批人id列表
IsApproverTypeFree bool `json:"is_approver_type_free,omitempty"` // 是否发起人自选节点
HasCcTypeFree bool `json:"has_cc_type_free,omitempty"` // 节点是否支持抄送人自选
}
// previewApprovalInstanceResp ...
type previewApprovalInstanceResp struct {
Code int64 `json:"code,omitempty"` // 错误码, 非0表示失败
Msg string `json:"msg,omitempty"` // 返回码的描述
Data *PreviewApprovalInstanceResp `json:"data,omitempty"` // 返回业务信息
}