-
-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathapi_contact_user_search_old.go
98 lines (86 loc) · 4.55 KB
/
api_contact_user_search_old.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
// 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"
)
// SearchUserOld 以用户身份搜索其他用户的信息, 无法搜索到外部企业或已离职的用户。
//
// 调用该接口需要申请 `搜索用户` 权限。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uMTM4UjLzEDO14yMxgTN
// new doc: https://open.feishu.cn/document/server-docs/contact-v3/user/search-users
func (r *ContactService) SearchUserOld(ctx context.Context, request *SearchUserOldReq, options ...MethodOptionFunc) (*SearchUserOldResp, *Response, error) {
if r.cli.mock.mockContactSearchUserOld != nil {
r.cli.Log(ctx, LogLevelDebug, "[lark] Contact#SearchUserOld mock enable")
return r.cli.mock.mockContactSearchUserOld(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Contact",
API: "SearchUserOld",
Method: "GET",
URL: r.cli.openBaseURL + "/open-apis/search/v1/user",
Body: request,
MethodOption: newMethodOption(options),
NeedUserAccessToken: true,
}
resp := new(searchUserOldResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
// MockContactSearchUserOld mock ContactSearchUserOld method
func (r *Mock) MockContactSearchUserOld(f func(ctx context.Context, request *SearchUserOldReq, options ...MethodOptionFunc) (*SearchUserOldResp, *Response, error)) {
r.mockContactSearchUserOld = f
}
// UnMockContactSearchUserOld un-mock ContactSearchUserOld method
func (r *Mock) UnMockContactSearchUserOld() {
r.mockContactSearchUserOld = nil
}
// SearchUserOldReq ...
type SearchUserOldReq struct {
Query string `query:"query" json:"-"` // 要执行搜索的字符串, 一般为用户名。
PageSize *int64 `query:"page_size" json:"-"` // 分页大小, 最小为 1, 最大为 200, 默认为 20。
PageToken *string `query:"page_token" json:"-"` // 分页标识, 获取首页不需要填写, 获取下一页时传入上一页返回的分页标识值。 请注意此字段的值并没有特殊含义, 请使用每次请求所返回的标识值。
}
// SearchUserOldResp ...
type SearchUserOldResp struct {
HasMore bool `json:"has_more,omitempty"` // 是否还有更多用户, 值为 true 表示存在下一页。
PageToken string `json:"page_token,omitempty"` // 分页标识, 存在下一页的时候返回。下次请求带上此标识可以获取下一页的用户。
Users []*SearchUserOldRespUser `json:"users,omitempty"` // 搜索到的用户列表。
}
// SearchUserOldRespUser ...
type SearchUserOldRespUser struct {
Avatar *SearchUserOldRespUserAvatar `json:"avatar,omitempty"` // 用户的头像信息。
DepartmentIDs []string `json:"department_ids,omitempty"` // 用户所在的部门 ID。
Name string `json:"name,omitempty"` // 用户名。
OpenID string `json:"open_id,omitempty"` // 用户的 open_id。
UserID string `json:"user_id,omitempty"` // 用户的 user_id, 只有已申请 `获取用户UserID` 权限的企业自建应用返回此字段。
}
// SearchUserOldRespUserAvatar ...
type SearchUserOldRespUserAvatar struct {
Avatar72 string `json:"avatar_72,omitempty"` // 用户的头像图片 URL, 72×72px。
Avatar240 string `json:"avatar_240,omitempty"` // 用户的头像图片 URL, 240×240px。
Avatar640 string `json:"avatar_640,omitempty"` // 用户的头像图片 URL, 640×640px。
AvatarOrigin string `json:"avatar_origin,omitempty"` // 用户的头像图片 URL, 原始大小。
}
// searchUserOldResp ...
type searchUserOldResp struct {
Code int64 `json:"code,omitempty"` // 返回码, 非 0 表示失败。
Msg string `json:"msg,omitempty"` // 对返回码的文本描述。
Data *SearchUserOldResp `json:"data,omitempty"`
Error *ErrorDetail `json:"error,omitempty"`
}