-
-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathapi_approval_external_list.go
104 lines (92 loc) · 6.44 KB
/
api_approval_external_list.go
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
95
96
97
98
99
100
101
102
103
104
// 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"
)
// GetApprovalExternalList 该接口用于获取三方审批的状态。用户传入查询条件, 接口返回满足条件的审批实例的状态。该接口支持多种参数的组合, 包括如下组合:
//
// - 通过 instance_ids 获取指定实例的任务状态
// - 通过 user_ids 获取指定用户的任务状态
// - 通过 status 获取指定状态的所有任务
// - 通过page_token获取下一批数据
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/approval-v4/external_task/list
// new doc: https://open.feishu.cn/document/server-docs/approval-v4/external_task/list
func (r *ApprovalService) GetApprovalExternalList(ctx context.Context, request *GetApprovalExternalListReq, options ...MethodOptionFunc) (*GetApprovalExternalListResp, *Response, error) {
if r.cli.mock.mockApprovalGetApprovalExternalList != nil {
r.cli.Log(ctx, LogLevelDebug, "[lark] Approval#GetApprovalExternalList mock enable")
return r.cli.mock.mockApprovalGetApprovalExternalList(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Approval",
API: "GetApprovalExternalList",
Method: "GET",
URL: r.cli.openBaseURL + "/open-apis/approval/v4/external_tasks",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
}
resp := new(getApprovalExternalListResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
// MockApprovalGetApprovalExternalList mock ApprovalGetApprovalExternalList method
func (r *Mock) MockApprovalGetApprovalExternalList(f func(ctx context.Context, request *GetApprovalExternalListReq, options ...MethodOptionFunc) (*GetApprovalExternalListResp, *Response, error)) {
r.mockApprovalGetApprovalExternalList = f
}
// UnMockApprovalGetApprovalExternalList un-mock ApprovalGetApprovalExternalList method
func (r *Mock) UnMockApprovalGetApprovalExternalList() {
r.mockApprovalGetApprovalExternalList = nil
}
// GetApprovalExternalListReq ...
type GetApprovalExternalListReq struct {
PageSize *int64 `query:"page_size" json:"-"` // 分页大小, 示例值: 100, 默认值: `50`, 最大值: `500`
PageToken *string `query:"page_token" json:"-"` // 分页标记, 第一次请求不填, 表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token, 下次遍历可采用该 page_token 获取查询结果, 示例值: nF1ZXJ5VGhlbkZldGNoCgAAAAAA6PZwFmUzSldvTC1yU
ApprovalCodes []string `json:"approval_codes,omitempty"` // 审批定义 Code, 用于指定只获取这些定义下的数据, 示例值: ["E78F1022-A166-447C-8320-E151DA90D70F"], 最大长度: `20`
InstanceIDs []string `json:"instance_ids,omitempty"` // 审批实例 ID, 用于指定只获取这些实例下的数据, 最多支持 20 个, 示例值: ["oa_159160304"]
UserIDs []string `json:"user_ids,omitempty"` // 审批人 user_id, 用于指定只获取这些用户的数据, 示例值: ["112321"]
Status *string `json:"status,omitempty"` // 审批任务状态, 用于指定获取该状态下的数据, 示例值: "PENDING", 可选值有: PENDING: 审批中, APPROVED: 审批流程结束, 结果为同意, REJECTED: 审批流程结束, 结果为拒绝, TRANSFERRED: 任务转交, DONE: 任务通过但审批人未操作;审批人看不到这个任务, 若想要看到, 可以通过抄送该人.
}
// GetApprovalExternalListResp ...
type GetApprovalExternalListResp struct {
Data []*GetApprovalExternalListRespData `json:"data,omitempty"` // 返回数据
PageToken string `json:"page_token,omitempty"` // 分页标记, 当 has_more 为 true 时, 会同时返回新的 page_token, 否则不返回 page_token
HasMore bool `json:"has_more,omitempty"` // 是否还有更多项
}
// GetApprovalExternalListRespData ...
type GetApprovalExternalListRespData struct {
InstanceID string `json:"instance_id,omitempty"` // 审批实例 ID
ApprovalID string `json:"approval_id,omitempty"` // 审批的id
ApprovalCode string `json:"approval_code,omitempty"` // 审批对应的 approval_code
Status string `json:"status,omitempty"` // 审批实例当前的状态, 可选值有: PENDING: 审批中, APPROVED: 审批流程结束, 结果为同意, REJECTED: 审批流程结束, 结果为拒绝, CANCELED: 审批发起人撤回, DELETED: 审批被删除, HIDDEN: 状态隐藏(不显示状态)
UpdateTime string `json:"update_time,omitempty"` // 审批实例最后更新时间, 单位 毫秒
Tasks []*GetApprovalExternalListRespDataTask `json:"tasks,omitempty"` // 审批实例下的审批任务
}
// GetApprovalExternalListRespDataTask ...
type GetApprovalExternalListRespDataTask struct {
ID string `json:"id,omitempty"` // 审批任务 ID
Status string `json:"status,omitempty"` // 审批任务状态, 可选值有: PENDING: 审批中, APPROVED: 审批流程结束, 结果为同意, REJECTED: 审批流程结束, 结果为拒绝, TRANSFERRED: 任务转交, DONE: 任务通过但审批人未操作;审批人看不到这个任务, 若想要看到, 可以通过抄送该人.
UpdateTime string `json:"update_time,omitempty"` // 审批任务最后更新时间, 单位 毫秒
}
// getApprovalExternalListResp ...
type getApprovalExternalListResp struct {
Code int64 `json:"code,omitempty"` // 错误码, 非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *GetApprovalExternalListResp `json:"data,omitempty"`
Error *ErrorDetail `json:"error,omitempty"`
}