python-cnb 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cnb/__init__.py +7 -0
- cnb/artifactory.py +205 -0
- cnb/assets.py +219 -0
- cnb/build.py +91 -0
- cnb/client.py +79 -0
- cnb/cnb.py +46 -0
- cnb/collaborators.py +320 -0
- cnb/contributors.py +72 -0
- cnb/exceptions.py +21 -0
- cnb/followers.py +50 -0
- cnb/git.py +441 -0
- cnb/gitsettings.py +158 -0
- cnb/issues.py +233 -0
- cnb/missions.py +23 -0
- cnb/models/__init__.py +0 -0
- cnb/models/api.py +393 -0
- cnb/models/chart.py +43 -0
- cnb/models/constant.py +85 -0
- cnb/models/convert.py +13 -0
- cnb/models/die.py +19 -0
- cnb/models/dto.py +1523 -0
- cnb/models/git_woa_com_cnb_monorepo_git_internal_app_git_service_bff_api.py +14 -0
- cnb/models/git_woa_com_cnb_monorepo_git_internal_app_git_service_bff_web.py +14 -0
- cnb/models/git_woa_com_cnb_monorepo_git_internal_app_vcs_service_bff_api.py +13 -0
- cnb/models/git_woa_com_cnb_monorepo_git_internal_dto_web.py +14 -0
- cnb/models/git_woa_com_cnb_monorepo_mission_mission_resource_dto_web.py +13 -0
- cnb/models/handler.py +83 -0
- cnb/models/http.py +20 -0
- cnb/models/identity.py +19 -0
- cnb/models/label.py +15 -0
- cnb/models/map_constant.py +11 -0
- cnb/models/models.py +50 -0
- cnb/models/openapi.py +64 -0
- cnb/models/organization.py +16 -0
- cnb/models/organizations.py +18 -0
- cnb/models/scope.py +28 -0
- cnb/models/v1.py +26 -0
- cnb/models/web.py +1045 -0
- cnb/models/webapi.py +162 -0
- cnb/models/wechat.py +25 -0
- cnb/organizations.py +192 -0
- cnb/pulls.py +242 -0
- cnb/releases.py +170 -0
- cnb/repocontributor.py +31 -0
- cnb/repolabels.py +75 -0
- cnb/repositories.py +243 -0
- cnb/starring.py +58 -0
- cnb/users.py +73 -0
- cnb/workspace.py +66 -0
- python_cnb-0.1.0.dist-info/METADATA +102 -0
- python_cnb-0.1.0.dist-info/RECORD +54 -0
- python_cnb-0.1.0.dist-info/WHEEL +5 -0
- python_cnb-0.1.0.dist-info/licenses/LICENSE +20 -0
- python_cnb-0.1.0.dist-info/top_level.txt +1 -0
cnb/collaborators.py
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
# Code generated by cnb.cool/cnb/sdk/cnb-sdk-generator. DO NOT EDIT.
|
|
2
|
+
# versions:
|
|
3
|
+
# cnb-sdk-generator: 1.0.2
|
|
4
|
+
# source: https://api.cnb.cool/swagger.json
|
|
5
|
+
|
|
6
|
+
from typing import Optional
|
|
7
|
+
from .models import dto
|
|
8
|
+
class CollaboratorsService:
|
|
9
|
+
def __init__(self, client):
|
|
10
|
+
self._client = client
|
|
11
|
+
|
|
12
|
+
# 添加成员。Add members.
|
|
13
|
+
def add_members_of_group(self,
|
|
14
|
+
group: str,
|
|
15
|
+
username: str,
|
|
16
|
+
body_params: dto.UpdateMembersRequest,
|
|
17
|
+
):
|
|
18
|
+
u = "/%s/-/members/%s" % (group, username, )
|
|
19
|
+
|
|
20
|
+
data = self._client.request(
|
|
21
|
+
method="POST",
|
|
22
|
+
endpoint=u,
|
|
23
|
+
json=body_params.to_dict(),
|
|
24
|
+
)
|
|
25
|
+
return
|
|
26
|
+
|
|
27
|
+
# 添加成员。Add members.
|
|
28
|
+
def add_members_of_mission(self,
|
|
29
|
+
mission: str,
|
|
30
|
+
username: str,
|
|
31
|
+
body_params: dto.UpdateMembersRequest,
|
|
32
|
+
):
|
|
33
|
+
u = "/%s/-/members/%s" % (mission, username, )
|
|
34
|
+
|
|
35
|
+
data = self._client.request(
|
|
36
|
+
method="POST",
|
|
37
|
+
endpoint=u,
|
|
38
|
+
json=body_params.to_dict(),
|
|
39
|
+
)
|
|
40
|
+
return
|
|
41
|
+
|
|
42
|
+
# 添加成员。Add members.
|
|
43
|
+
def add_members_of_registry(self,
|
|
44
|
+
registry: str,
|
|
45
|
+
username: str,
|
|
46
|
+
body_params: dto.UpdateMembersRequest,
|
|
47
|
+
):
|
|
48
|
+
u = "/%s/-/members/%s" % (registry, username, )
|
|
49
|
+
|
|
50
|
+
data = self._client.request(
|
|
51
|
+
method="POST",
|
|
52
|
+
endpoint=u,
|
|
53
|
+
json=body_params.to_dict(),
|
|
54
|
+
)
|
|
55
|
+
return
|
|
56
|
+
|
|
57
|
+
# 添加成员。Add members.
|
|
58
|
+
def add_members_of_repo(self,
|
|
59
|
+
repo: str,
|
|
60
|
+
username: str,
|
|
61
|
+
body_params: dto.UpdateMembersRequest,
|
|
62
|
+
):
|
|
63
|
+
u = "/%s/-/members/%s" % (repo, username, )
|
|
64
|
+
|
|
65
|
+
data = self._client.request(
|
|
66
|
+
method="POST",
|
|
67
|
+
endpoint=u,
|
|
68
|
+
json=body_params.to_dict(),
|
|
69
|
+
)
|
|
70
|
+
return
|
|
71
|
+
|
|
72
|
+
# 删除指定组织或仓库的直接成员。Remove direct members from specified organization/repository.
|
|
73
|
+
def delete_members_of_group(self,
|
|
74
|
+
group: str,
|
|
75
|
+
username: str,
|
|
76
|
+
):
|
|
77
|
+
u = "/%s/-/members/%s" % (group, username, )
|
|
78
|
+
|
|
79
|
+
data = self._client.request(
|
|
80
|
+
method="DELETE",
|
|
81
|
+
endpoint=u,
|
|
82
|
+
)
|
|
83
|
+
return
|
|
84
|
+
|
|
85
|
+
# 删除指定组织或仓库的直接成员。Remove direct members from specified organization/repository.
|
|
86
|
+
def delete_members_of_repo(self,
|
|
87
|
+
repo: str,
|
|
88
|
+
username: str,
|
|
89
|
+
):
|
|
90
|
+
u = "/%s/-/members/%s" % (repo, username, )
|
|
91
|
+
|
|
92
|
+
data = self._client.request(
|
|
93
|
+
method="DELETE",
|
|
94
|
+
endpoint=u,
|
|
95
|
+
)
|
|
96
|
+
return
|
|
97
|
+
|
|
98
|
+
# 删除指定仓库的外部贡献者。Removes external contributors from specified repository.
|
|
99
|
+
def delete_outside_collaborators(self,
|
|
100
|
+
repo: str,
|
|
101
|
+
username: str,
|
|
102
|
+
):
|
|
103
|
+
u = "/%s/-/outside-collaborators/%s" % (repo, username, )
|
|
104
|
+
|
|
105
|
+
data = self._client.request(
|
|
106
|
+
method="DELETE",
|
|
107
|
+
endpoint=u,
|
|
108
|
+
)
|
|
109
|
+
return
|
|
110
|
+
|
|
111
|
+
# 获取指定仓库内的有效成员列表,包含继承成员。List active members in specified repository including inherited members.
|
|
112
|
+
def list_all_members(self,
|
|
113
|
+
repo: str,
|
|
114
|
+
page: Optional[int] = None,
|
|
115
|
+
page_size: Optional[int] = None,
|
|
116
|
+
role: Optional[str] = None,
|
|
117
|
+
search: Optional[str] = None,
|
|
118
|
+
names: Optional[str] = None,
|
|
119
|
+
order_by: Optional[str] = None,
|
|
120
|
+
desc: Optional[bool] = None,
|
|
121
|
+
) -> list[dto.UsersWithAccessLevelInSlug]:
|
|
122
|
+
u = "/%s/-/list-members" % (repo, )
|
|
123
|
+
|
|
124
|
+
query_params = {
|
|
125
|
+
"page": page,
|
|
126
|
+
"page_size": page_size,
|
|
127
|
+
"role": role,
|
|
128
|
+
"search": search,
|
|
129
|
+
"names": names,
|
|
130
|
+
"order_by": order_by,
|
|
131
|
+
"desc": desc,
|
|
132
|
+
}
|
|
133
|
+
data = self._client.request(
|
|
134
|
+
method="GET",
|
|
135
|
+
endpoint=u,
|
|
136
|
+
params=query_params,
|
|
137
|
+
)
|
|
138
|
+
return [dto.UsersWithAccessLevelInSlug.safe_parse(item) for item in data]
|
|
139
|
+
|
|
140
|
+
# 获取指定组织或仓库内的继承成员。List inherited members within specified organization or repository。
|
|
141
|
+
def list_inherit_members_of_group(self,
|
|
142
|
+
group: str,
|
|
143
|
+
search: Optional[str] = None,
|
|
144
|
+
role: Optional[str] = None,
|
|
145
|
+
page: Optional[int] = None,
|
|
146
|
+
page_size: Optional[int] = None,
|
|
147
|
+
) -> list[dto.ListInheritMembers]:
|
|
148
|
+
u = "/%s/-/inherit-members" % (group, )
|
|
149
|
+
|
|
150
|
+
query_params = {
|
|
151
|
+
"search": search,
|
|
152
|
+
"role": role,
|
|
153
|
+
"page": page,
|
|
154
|
+
"page_size": page_size,
|
|
155
|
+
}
|
|
156
|
+
data = self._client.request(
|
|
157
|
+
method="GET",
|
|
158
|
+
endpoint=u,
|
|
159
|
+
params=query_params,
|
|
160
|
+
)
|
|
161
|
+
return [dto.ListInheritMembers.safe_parse(item) for item in data]
|
|
162
|
+
|
|
163
|
+
# 获取指定组织或仓库内的继承成员。List inherited members within specified organization or repository。
|
|
164
|
+
def list_inherit_members_of_repo(self,
|
|
165
|
+
repo: str,
|
|
166
|
+
search: Optional[str] = None,
|
|
167
|
+
role: Optional[str] = None,
|
|
168
|
+
page: Optional[int] = None,
|
|
169
|
+
page_size: Optional[int] = None,
|
|
170
|
+
) -> list[dto.ListInheritMembers]:
|
|
171
|
+
u = "/%s/-/inherit-members" % (repo, )
|
|
172
|
+
|
|
173
|
+
query_params = {
|
|
174
|
+
"search": search,
|
|
175
|
+
"role": role,
|
|
176
|
+
"page": page,
|
|
177
|
+
"page_size": page_size,
|
|
178
|
+
}
|
|
179
|
+
data = self._client.request(
|
|
180
|
+
method="GET",
|
|
181
|
+
endpoint=u,
|
|
182
|
+
params=query_params,
|
|
183
|
+
)
|
|
184
|
+
return [dto.ListInheritMembers.safe_parse(item) for item in data]
|
|
185
|
+
|
|
186
|
+
# 获取指定组织或仓库内的所有直接成员。List all direct members within specified organization or repository.
|
|
187
|
+
def list_members_of_group(self,
|
|
188
|
+
group: str,
|
|
189
|
+
page: Optional[int] = None,
|
|
190
|
+
page_size: Optional[int] = None,
|
|
191
|
+
role: Optional[str] = None,
|
|
192
|
+
search: Optional[str] = None,
|
|
193
|
+
) -> list[dto.UsersWithAccessLevelInSlug]:
|
|
194
|
+
u = "/%s/-/members" % (group, )
|
|
195
|
+
|
|
196
|
+
query_params = {
|
|
197
|
+
"page": page,
|
|
198
|
+
"page_size": page_size,
|
|
199
|
+
"role": role,
|
|
200
|
+
"search": search,
|
|
201
|
+
}
|
|
202
|
+
data = self._client.request(
|
|
203
|
+
method="GET",
|
|
204
|
+
endpoint=u,
|
|
205
|
+
params=query_params,
|
|
206
|
+
)
|
|
207
|
+
return [dto.UsersWithAccessLevelInSlug.safe_parse(item) for item in data]
|
|
208
|
+
|
|
209
|
+
# 获取指定组织或仓库内的所有直接成员。List all direct members within specified organization or repository.
|
|
210
|
+
def list_members_of_repo(self,
|
|
211
|
+
repo: str,
|
|
212
|
+
page: Optional[int] = None,
|
|
213
|
+
page_size: Optional[int] = None,
|
|
214
|
+
role: Optional[str] = None,
|
|
215
|
+
search: Optional[str] = None,
|
|
216
|
+
) -> list[dto.UsersWithAccessLevelInSlug]:
|
|
217
|
+
u = "/%s/-/members" % (repo, )
|
|
218
|
+
|
|
219
|
+
query_params = {
|
|
220
|
+
"page": page,
|
|
221
|
+
"page_size": page_size,
|
|
222
|
+
"role": role,
|
|
223
|
+
"search": search,
|
|
224
|
+
}
|
|
225
|
+
data = self._client.request(
|
|
226
|
+
method="GET",
|
|
227
|
+
endpoint=u,
|
|
228
|
+
params=query_params,
|
|
229
|
+
)
|
|
230
|
+
return [dto.UsersWithAccessLevelInSlug.safe_parse(item) for item in data]
|
|
231
|
+
|
|
232
|
+
# 获取指定仓库内的外部贡献者。List external contributors in specified repository.
|
|
233
|
+
def list_outside_collaborators(self,
|
|
234
|
+
repo: str,
|
|
235
|
+
page: Optional[int] = None,
|
|
236
|
+
page_size: Optional[int] = None,
|
|
237
|
+
role: Optional[str] = None,
|
|
238
|
+
search: Optional[str] = None,
|
|
239
|
+
) -> list[dto.OutsideCollaboratorInRepo]:
|
|
240
|
+
u = "/%s/-/outside-collaborators" % (repo, )
|
|
241
|
+
|
|
242
|
+
query_params = {
|
|
243
|
+
"page": page,
|
|
244
|
+
"page_size": page_size,
|
|
245
|
+
"role": role,
|
|
246
|
+
"search": search,
|
|
247
|
+
}
|
|
248
|
+
data = self._client.request(
|
|
249
|
+
method="GET",
|
|
250
|
+
endpoint=u,
|
|
251
|
+
params=query_params,
|
|
252
|
+
)
|
|
253
|
+
return [dto.OutsideCollaboratorInRepo.safe_parse(item) for item in data]
|
|
254
|
+
|
|
255
|
+
# 获取 top 贡献用户。List the top contributing users
|
|
256
|
+
def top_contributors(self,
|
|
257
|
+
repo: str,
|
|
258
|
+
top: Optional[int] = None,
|
|
259
|
+
) -> list[dto.UsersResult]:
|
|
260
|
+
u = "/%s/-/top-activity-users" % (repo, )
|
|
261
|
+
|
|
262
|
+
query_params = {
|
|
263
|
+
"top": top,
|
|
264
|
+
}
|
|
265
|
+
data = self._client.request(
|
|
266
|
+
method="GET",
|
|
267
|
+
endpoint=u,
|
|
268
|
+
params=query_params,
|
|
269
|
+
)
|
|
270
|
+
return [dto.UsersResult.safe_parse(item) for item in data]
|
|
271
|
+
|
|
272
|
+
# 更新指定组织或仓库内的直接成员权限信息。Update permission information for direct members in specified organization/repository.
|
|
273
|
+
def update_members_of_group(self,
|
|
274
|
+
group: str,
|
|
275
|
+
username: str,
|
|
276
|
+
body_params: dto.UpdateMembersRequest,
|
|
277
|
+
):
|
|
278
|
+
u = "/%s/-/members/%s" % (group, username, )
|
|
279
|
+
|
|
280
|
+
data = self._client.request(
|
|
281
|
+
method="PUT",
|
|
282
|
+
endpoint=u,
|
|
283
|
+
json=body_params.to_dict(),
|
|
284
|
+
)
|
|
285
|
+
return
|
|
286
|
+
|
|
287
|
+
# 更新指定组织或仓库内的直接成员权限信息。Update permission information for direct members in specified organization/repository.
|
|
288
|
+
def update_members_of_repo(self,
|
|
289
|
+
repo: str,
|
|
290
|
+
username: str,
|
|
291
|
+
body_params: dto.UpdateMembersRequest,
|
|
292
|
+
):
|
|
293
|
+
u = "/%s/-/members/%s" % (repo, username, )
|
|
294
|
+
|
|
295
|
+
data = self._client.request(
|
|
296
|
+
method="PUT",
|
|
297
|
+
endpoint=u,
|
|
298
|
+
json=body_params.to_dict(),
|
|
299
|
+
)
|
|
300
|
+
return
|
|
301
|
+
|
|
302
|
+
# 更新指定仓库的外部贡献者权限信息。 Update permission information for external contributors in specified repository.
|
|
303
|
+
def update_outside_collaborators(self,
|
|
304
|
+
repo: str,
|
|
305
|
+
username: str,
|
|
306
|
+
role: Optional[str] = None,
|
|
307
|
+
):
|
|
308
|
+
u = "/%s/-/outside-collaborators/%s" % (repo, username, )
|
|
309
|
+
|
|
310
|
+
query_params = {
|
|
311
|
+
"role": role,
|
|
312
|
+
}
|
|
313
|
+
data = self._client.request(
|
|
314
|
+
method="PUT",
|
|
315
|
+
endpoint=u,
|
|
316
|
+
params=query_params,
|
|
317
|
+
)
|
|
318
|
+
return
|
|
319
|
+
|
|
320
|
+
|
cnb/contributors.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Code generated by cnb.cool/cnb/sdk/cnb-sdk-generator. DO NOT EDIT.
|
|
2
|
+
# versions:
|
|
3
|
+
# cnb-sdk-generator: 1.0.2
|
|
4
|
+
# source: https://api.cnb.cool/swagger.json
|
|
5
|
+
|
|
6
|
+
from typing import Optional
|
|
7
|
+
from .models import dto
|
|
8
|
+
class ContributorsService:
|
|
9
|
+
def __init__(self, client):
|
|
10
|
+
self._client = client
|
|
11
|
+
|
|
12
|
+
# 获取指定组织或仓库内, 访问成员在当前层级内的权限信息。Get permission information for accessing members at current level.
|
|
13
|
+
def get_member_access_level_of_group(self,
|
|
14
|
+
group: str,
|
|
15
|
+
include_inherit: Optional[bool] = None,
|
|
16
|
+
) -> dto.MemberAccessLevelInSlugUnion:
|
|
17
|
+
u = "/%s/-/members/access-level" % (group, )
|
|
18
|
+
|
|
19
|
+
query_params = {
|
|
20
|
+
"include_inherit": include_inherit,
|
|
21
|
+
}
|
|
22
|
+
data = self._client.request(
|
|
23
|
+
method="GET",
|
|
24
|
+
endpoint=u,
|
|
25
|
+
params=query_params,
|
|
26
|
+
)
|
|
27
|
+
return dto.MemberAccessLevelInSlugUnion.safe_parse(data)
|
|
28
|
+
|
|
29
|
+
# 获取指定组织或仓库内, 访问成员在当前层级内的权限信息。Get permission information for accessing members at current level.
|
|
30
|
+
def get_member_access_level_of_repo(self,
|
|
31
|
+
repo: str,
|
|
32
|
+
include_inherit: Optional[bool] = None,
|
|
33
|
+
) -> dto.MemberAccessLevelInSlugUnion:
|
|
34
|
+
u = "/%s/-/members/access-level" % (repo, )
|
|
35
|
+
|
|
36
|
+
query_params = {
|
|
37
|
+
"include_inherit": include_inherit,
|
|
38
|
+
}
|
|
39
|
+
data = self._client.request(
|
|
40
|
+
method="GET",
|
|
41
|
+
endpoint=u,
|
|
42
|
+
params=query_params,
|
|
43
|
+
)
|
|
44
|
+
return dto.MemberAccessLevelInSlugUnion.safe_parse(data)
|
|
45
|
+
|
|
46
|
+
# 获取指定组织或仓库内指定成员的权限信息, 结果按组织层级来展示, 包含上层组织的权限继承信息。Get specified member's permissions with organizational hierarchy.
|
|
47
|
+
def list_member_access_level_of_group(self,
|
|
48
|
+
group: str,
|
|
49
|
+
username: str,
|
|
50
|
+
) -> list[dto.MemberAccessLevel]:
|
|
51
|
+
u = "/%s/-/members/%s/access-level" % (group, username, )
|
|
52
|
+
|
|
53
|
+
data = self._client.request(
|
|
54
|
+
method="GET",
|
|
55
|
+
endpoint=u,
|
|
56
|
+
)
|
|
57
|
+
return [dto.MemberAccessLevel.safe_parse(item) for item in data]
|
|
58
|
+
|
|
59
|
+
# 获取指定组织或仓库内指定成员的权限信息, 结果按组织层级来展示, 包含上层组织的权限继承信息。Get specified member's permissions with organizational hierarchy.
|
|
60
|
+
def list_member_access_level_of_repo(self,
|
|
61
|
+
repo: str,
|
|
62
|
+
username: str,
|
|
63
|
+
) -> list[dto.MemberAccessLevel]:
|
|
64
|
+
u = "/%s/-/members/%s/access-level" % (repo, username, )
|
|
65
|
+
|
|
66
|
+
data = self._client.request(
|
|
67
|
+
method="GET",
|
|
68
|
+
endpoint=u,
|
|
69
|
+
)
|
|
70
|
+
return [dto.MemberAccessLevel.safe_parse(item) for item in data]
|
|
71
|
+
|
|
72
|
+
|
cnb/exceptions.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
class CNBAPIError(Exception):
|
|
4
|
+
def __init__(self,
|
|
5
|
+
detail: Optional[str] = None,
|
|
6
|
+
status_code: Optional[int] = None,
|
|
7
|
+
):
|
|
8
|
+
self.detail = detail
|
|
9
|
+
self.status_code = status_code
|
|
10
|
+
self.errcode: Optional[int] = None
|
|
11
|
+
self.errmsg: Optional[str] = None
|
|
12
|
+
# 解析 detail
|
|
13
|
+
if detail:
|
|
14
|
+
try:
|
|
15
|
+
import json
|
|
16
|
+
detail_dict = json.loads(detail)
|
|
17
|
+
self.errcode = detail_dict.get("errcode")
|
|
18
|
+
self.errmsg = detail_dict.get("errmsg")
|
|
19
|
+
except (json.JSONDecodeError, AttributeError):
|
|
20
|
+
self.errmsg = detail
|
|
21
|
+
super().__init__(f"API request failed with status {status_code}, detail: {detail}")
|
cnb/followers.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Code generated by cnb.cool/cnb/sdk/cnb-sdk-generator. DO NOT EDIT.
|
|
2
|
+
# versions:
|
|
3
|
+
# cnb-sdk-generator: 1.0.2
|
|
4
|
+
# source: https://api.cnb.cool/swagger.json
|
|
5
|
+
|
|
6
|
+
from typing import Optional
|
|
7
|
+
from .models import dto
|
|
8
|
+
class FollowersService:
|
|
9
|
+
def __init__(self, client):
|
|
10
|
+
self._client = client
|
|
11
|
+
|
|
12
|
+
# 获取指定用户的粉丝列表。Get the followers list of specified user.
|
|
13
|
+
def get_followers_by_user_id(self,
|
|
14
|
+
username: str,
|
|
15
|
+
page: Optional[int] = None,
|
|
16
|
+
page_size: Optional[int] = None,
|
|
17
|
+
) -> list[dto.UserFollowResult]:
|
|
18
|
+
u = "/users/%s/followers" % (username, )
|
|
19
|
+
|
|
20
|
+
query_params = {
|
|
21
|
+
"page": page,
|
|
22
|
+
"page_size": page_size,
|
|
23
|
+
}
|
|
24
|
+
data = self._client.request(
|
|
25
|
+
method="GET",
|
|
26
|
+
endpoint=u,
|
|
27
|
+
params=query_params,
|
|
28
|
+
)
|
|
29
|
+
return [dto.UserFollowResult.safe_parse(item) for item in data]
|
|
30
|
+
|
|
31
|
+
# 获取指定用户的关注人列表。Get the list of users that the specified user is following.
|
|
32
|
+
def get_following_by_user_id(self,
|
|
33
|
+
username: str,
|
|
34
|
+
page: Optional[int] = None,
|
|
35
|
+
page_size: Optional[int] = None,
|
|
36
|
+
) -> list[dto.UserFollowResult]:
|
|
37
|
+
u = "/users/%s/following" % (username, )
|
|
38
|
+
|
|
39
|
+
query_params = {
|
|
40
|
+
"page": page,
|
|
41
|
+
"page_size": page_size,
|
|
42
|
+
}
|
|
43
|
+
data = self._client.request(
|
|
44
|
+
method="GET",
|
|
45
|
+
endpoint=u,
|
|
46
|
+
params=query_params,
|
|
47
|
+
)
|
|
48
|
+
return [dto.UserFollowResult.safe_parse(item) for item in data]
|
|
49
|
+
|
|
50
|
+
|