gitee-client 1.0.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.
- gitee_client/__init__.py +36 -0
- gitee_client/api/__init__.py +4 -0
- gitee_client/api/activity.py +642 -0
- gitee_client/api/base.py +104 -0
- gitee_client/api/checks.py +233 -0
- gitee_client/api/emails.py +29 -0
- gitee_client/api/enterprises.py +497 -0
- gitee_client/api/gists.py +384 -0
- gitee_client/api/git_data.py +69 -0
- gitee_client/api/issues.py +788 -0
- gitee_client/api/labels.py +299 -0
- gitee_client/api/milestones.py +151 -0
- gitee_client/api/miscellaneous.py +141 -0
- gitee_client/api/organizations.py +374 -0
- gitee_client/api/pulls.py +722 -0
- gitee_client/api/repos.py +2007 -0
- gitee_client/api/search.py +169 -0
- gitee_client/api/users.py +423 -0
- gitee_client/api/webhooks.py +179 -0
- gitee_client/client.py +314 -0
- gitee_client/error.py +104 -0
- gitee_client/models/__init__.py +11 -0
- gitee_client/models/activity.py +78 -0
- gitee_client/models/check.py +36 -0
- gitee_client/models/common.py +278 -0
- gitee_client/models/enterprise.py +42 -0
- gitee_client/models/git.py +15 -0
- gitee_client/models/issue.py +83 -0
- gitee_client/models/org.py +71 -0
- gitee_client/models/pull_request.py +101 -0
- gitee_client/models/repo.py +494 -0
- gitee_client/pagination.py +100 -0
- gitee_client/utils.py +42 -0
- gitee_client-1.0.0.dist-info/METADATA +430 -0
- gitee_client-1.0.0.dist-info/RECORD +37 -0
- gitee_client-1.0.0.dist-info/WHEEL +5 -0
- gitee_client-1.0.0.dist-info/top_level.txt +1 -0
gitee_client/__init__.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Gitee API v5 Python Client Library.
|
|
2
|
+
|
|
3
|
+
A comprehensive, easy-to-use client for the Gitee Open API v5.
|
|
4
|
+
Covers all 175 endpoints across 16 resource groups.
|
|
5
|
+
|
|
6
|
+
Usage::
|
|
7
|
+
|
|
8
|
+
from gitee_client import GiteeClient
|
|
9
|
+
|
|
10
|
+
client = GiteeClient() # reads GITEE_ACCESS_TOKEN from env
|
|
11
|
+
repos = client.repos.list()
|
|
12
|
+
repo = client.repos.create(name="my-project", auto_init=True)
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from gitee_client.client import GiteeClient
|
|
16
|
+
from gitee_client.error import (
|
|
17
|
+
GiteeError,
|
|
18
|
+
GiteeAPIError,
|
|
19
|
+
GiteeAuthError,
|
|
20
|
+
GiteeNotFoundError,
|
|
21
|
+
GiteeValidationError,
|
|
22
|
+
GiteeRateLimitError,
|
|
23
|
+
GiteeServerError,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
"GiteeClient",
|
|
28
|
+
"GiteeError",
|
|
29
|
+
"GiteeAPIError",
|
|
30
|
+
"GiteeAuthError",
|
|
31
|
+
"GiteeNotFoundError",
|
|
32
|
+
"GiteeValidationError",
|
|
33
|
+
"GiteeRateLimitError",
|
|
34
|
+
"GiteeServerError",
|
|
35
|
+
]
|
|
36
|
+
__version__ = "1.0.0"
|
|
@@ -0,0 +1,642 @@
|
|
|
1
|
+
"""Activity API endpoints."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Optional
|
|
6
|
+
|
|
7
|
+
from gitee_client.api.base import BaseAPI
|
|
8
|
+
from gitee_client.pagination import list_all
|
|
9
|
+
from gitee_client.utils import build_url
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ActivityAPI(BaseAPI):
|
|
13
|
+
"""Gitee Activity API.
|
|
14
|
+
|
|
15
|
+
All methods correspond to endpoints under the ``Activity`` group.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
def create_notification_messages(self, content: str, username: str) -> Any:
|
|
19
|
+
"""发送私信给指定用户
|
|
20
|
+
|
|
21
|
+
Query/Form parameters:
|
|
22
|
+
username: 用户名(username/login) (**必填**)
|
|
23
|
+
content: 私信内容 (**必填**)
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
27
|
+
"""
|
|
28
|
+
url = build_url("", "/v5/notifications/messages")
|
|
29
|
+
return self._post(
|
|
30
|
+
url,
|
|
31
|
+
data={
|
|
32
|
+
"username": username,
|
|
33
|
+
"content": content,
|
|
34
|
+
},
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
def delete_user_subscriptions(self, owner: str, repo: str) -> Any:
|
|
38
|
+
"""取消 watch 一个仓库
|
|
39
|
+
|
|
40
|
+
Path parameters:
|
|
41
|
+
owner: 仓库所属空间地址(企业、组织或个人的地址path) (**必填**)
|
|
42
|
+
repo: 仓库路径(path) (**必填**)
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
46
|
+
"""
|
|
47
|
+
url = build_url("", "/v5/user/subscriptions/{owner}/{repo}", owner=owner, repo=repo)
|
|
48
|
+
return self._delete(
|
|
49
|
+
url,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
def get_notification_messages(self, id: str) -> Any:
|
|
53
|
+
"""获取一条私信
|
|
54
|
+
|
|
55
|
+
Path parameters:
|
|
56
|
+
id: 私信的 ID (**必填**)
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
60
|
+
"""
|
|
61
|
+
url = build_url("", "/v5/notifications/messages/{id}", id=id)
|
|
62
|
+
return self._get(
|
|
63
|
+
url,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
def get_notification_threads(self, id: str) -> Any:
|
|
67
|
+
"""获取一条通知
|
|
68
|
+
|
|
69
|
+
Path parameters:
|
|
70
|
+
id: 通知的 ID (**必填**)
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
74
|
+
"""
|
|
75
|
+
url = build_url("", "/v5/notifications/threads/{id}", id=id)
|
|
76
|
+
return self._get(
|
|
77
|
+
url,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
def get_notifications_count(self, unread: Optional[bool] = None) -> Any:
|
|
81
|
+
"""获取授权用户的通知数
|
|
82
|
+
|
|
83
|
+
Query/Form parameters:
|
|
84
|
+
unread: 是否只获取未读消息,默认:否
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
88
|
+
"""
|
|
89
|
+
url = build_url("", "/v5/notifications/count")
|
|
90
|
+
return self._get(
|
|
91
|
+
url,
|
|
92
|
+
params={
|
|
93
|
+
"unread": unread,
|
|
94
|
+
},
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
def get_user_subscriptions(self, owner: str, repo: str) -> Any:
|
|
98
|
+
"""检查授权用户是否 watch 了一个仓库
|
|
99
|
+
|
|
100
|
+
Path parameters:
|
|
101
|
+
owner: 仓库所属空间地址(企业、组织或个人的地址path) (**必填**)
|
|
102
|
+
repo: 仓库路径(path) (**必填**)
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
106
|
+
"""
|
|
107
|
+
url = build_url("", "/v5/user/subscriptions/{owner}/{repo}", owner=owner, repo=repo)
|
|
108
|
+
return self._get(
|
|
109
|
+
url,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
def get_users_events_orgs(self, org: str, username: str, limit: Optional[int] = None, prev_id: Optional[int] = None) -> Any:
|
|
113
|
+
"""列出用户所属组织的动态
|
|
114
|
+
|
|
115
|
+
Path parameters:
|
|
116
|
+
username: 用户名(username/login) (**必填**)
|
|
117
|
+
org: 组织的路径(path/login) (**必填**)
|
|
118
|
+
Query/Form parameters:
|
|
119
|
+
prev_id: 滚动列表的最后一条记录的id
|
|
120
|
+
limit: 滚动列表每页的数量,最大为 100
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
124
|
+
"""
|
|
125
|
+
url = build_url("", "/v5/users/{username}/events/orgs/{org}", org=org, username=username)
|
|
126
|
+
return self._get(
|
|
127
|
+
url,
|
|
128
|
+
params={
|
|
129
|
+
"prev_id": prev_id,
|
|
130
|
+
"limit": limit,
|
|
131
|
+
},
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
def list_networks_events(self, owner: str, repo: str, limit: Optional[int] = None, prev_id: Optional[int] = None) -> Any:
|
|
135
|
+
"""列出仓库的所有公开动态
|
|
136
|
+
|
|
137
|
+
Path parameters:
|
|
138
|
+
owner: 仓库所属空间地址(企业、组织或个人的地址path) (**必填**)
|
|
139
|
+
repo: 仓库路径(path) (**必填**)
|
|
140
|
+
Query/Form parameters:
|
|
141
|
+
prev_id: 滚动列表的最后一条记录的id
|
|
142
|
+
limit: 滚动列表每页的数量,最大为 100
|
|
143
|
+
|
|
144
|
+
Returns:
|
|
145
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
146
|
+
"""
|
|
147
|
+
url = build_url("", "/v5/networks/{owner}/{repo}/events", owner=owner, repo=repo)
|
|
148
|
+
return self._get(
|
|
149
|
+
url,
|
|
150
|
+
params={
|
|
151
|
+
"prev_id": prev_id,
|
|
152
|
+
"limit": limit,
|
|
153
|
+
},
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
def list_notification_messages(self, before: Optional[str] = None, ids: Optional[str] = None, page: Optional[int] = None, per_page: Optional[int] = None, since: Optional[str] = None, unread: Optional[bool] = None) -> Any:
|
|
157
|
+
"""列出授权用户的所有私信
|
|
158
|
+
|
|
159
|
+
Query/Form parameters:
|
|
160
|
+
unread: 是否只显示未读私信,默认:否
|
|
161
|
+
since: 只获取在给定时间后更新的私信,要求时间格式为 ISO 8601
|
|
162
|
+
before: 只获取在给定时间前更新的私信,要求时间格式为 ISO 8601
|
|
163
|
+
ids: 指定一组私信 ID,以 , 分隔
|
|
164
|
+
page: 当前的页码
|
|
165
|
+
per_page: 每页的数量,最大为 100
|
|
166
|
+
|
|
167
|
+
Returns:
|
|
168
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
169
|
+
"""
|
|
170
|
+
url = build_url("", "/v5/notifications/messages")
|
|
171
|
+
return self._get(
|
|
172
|
+
url,
|
|
173
|
+
params={
|
|
174
|
+
"unread": unread,
|
|
175
|
+
"since": since,
|
|
176
|
+
"before": before,
|
|
177
|
+
"ids": ids,
|
|
178
|
+
"page": page,
|
|
179
|
+
"per_page": per_page,
|
|
180
|
+
},
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
def list_notification_threads(self, before: Optional[str] = None, ids: Optional[str] = None, page: Optional[int] = None, participating: Optional[bool] = None, per_page: Optional[int] = None, since: Optional[str] = None, type: Optional[str] = None, unread: Optional[bool] = None) -> Any:
|
|
184
|
+
"""列出授权用户的所有通知
|
|
185
|
+
|
|
186
|
+
Query/Form parameters:
|
|
187
|
+
unread: 是否只获取未读消息,默认:否
|
|
188
|
+
participating: 是否只获取自己直接参与的消息,默认:否
|
|
189
|
+
type: 筛选指定类型的通知,all:所有,event:事件通知,referer:@ 通知
|
|
190
|
+
since: 只获取在给定时间后更新的消息,要求时间格式为 ISO 8601
|
|
191
|
+
before: 只获取在给定时间前更新的消息,要求时间格式为 ISO 8601
|
|
192
|
+
ids: 指定一组通知 ID,以 , 分隔
|
|
193
|
+
page: 当前的页码
|
|
194
|
+
per_page: 每页的数量,最大为 100
|
|
195
|
+
|
|
196
|
+
Returns:
|
|
197
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
198
|
+
"""
|
|
199
|
+
url = build_url("", "/v5/notifications/threads")
|
|
200
|
+
return self._get(
|
|
201
|
+
url,
|
|
202
|
+
params={
|
|
203
|
+
"unread": unread,
|
|
204
|
+
"participating": participating,
|
|
205
|
+
"type": type,
|
|
206
|
+
"since": since,
|
|
207
|
+
"before": before,
|
|
208
|
+
"ids": ids,
|
|
209
|
+
"page": page,
|
|
210
|
+
"per_page": per_page,
|
|
211
|
+
},
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
def list_orgs_events(self, org: str, limit: Optional[int] = None, prev_id: Optional[int] = None) -> Any:
|
|
215
|
+
"""列出组织的公开动态
|
|
216
|
+
|
|
217
|
+
Path parameters:
|
|
218
|
+
org: 组织的路径(path/login) (**必填**)
|
|
219
|
+
Query/Form parameters:
|
|
220
|
+
prev_id: 滚动列表的最后一条记录的id
|
|
221
|
+
limit: 滚动列表每页的数量,最大为 100
|
|
222
|
+
|
|
223
|
+
Returns:
|
|
224
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
225
|
+
"""
|
|
226
|
+
url = build_url("", "/v5/orgs/{org}/events", org=org)
|
|
227
|
+
return self._get(
|
|
228
|
+
url,
|
|
229
|
+
params={
|
|
230
|
+
"prev_id": prev_id,
|
|
231
|
+
"limit": limit,
|
|
232
|
+
},
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
def list_repos_events(self, owner: str, repo: str, limit: Optional[int] = None, prev_id: Optional[int] = None) -> Any:
|
|
236
|
+
"""列出仓库的所有动态
|
|
237
|
+
|
|
238
|
+
Path parameters:
|
|
239
|
+
owner: 仓库所属空间地址(企业、组织或个人的地址path) (**必填**)
|
|
240
|
+
repo: 仓库路径(path) (**必填**)
|
|
241
|
+
Query/Form parameters:
|
|
242
|
+
prev_id: 滚动列表的最后一条记录的id
|
|
243
|
+
limit: 滚动列表每页的数量,最大为 100
|
|
244
|
+
|
|
245
|
+
Returns:
|
|
246
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
247
|
+
"""
|
|
248
|
+
url = build_url("", "/v5/repos/{owner}/{repo}/events", owner=owner, repo=repo)
|
|
249
|
+
return self._get(
|
|
250
|
+
url,
|
|
251
|
+
params={
|
|
252
|
+
"prev_id": prev_id,
|
|
253
|
+
"limit": limit,
|
|
254
|
+
},
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
def list_repos_notifications(self, owner: str, repo: str, before: Optional[str] = None, ids: Optional[str] = None, page: Optional[int] = None, participating: Optional[bool] = None, per_page: Optional[int] = None, since: Optional[str] = None, type: Optional[str] = None, unread: Optional[bool] = None) -> Any:
|
|
258
|
+
"""列出一个仓库里的通知
|
|
259
|
+
|
|
260
|
+
Path parameters:
|
|
261
|
+
owner: 仓库所属空间地址(企业、组织或个人的地址path) (**必填**)
|
|
262
|
+
repo: 仓库路径(path) (**必填**)
|
|
263
|
+
Query/Form parameters:
|
|
264
|
+
unread: 是否只获取未读消息,默认:否
|
|
265
|
+
participating: 是否只获取自己直接参与的消息,默认:否
|
|
266
|
+
type: 筛选指定类型的通知,all:所有,event:事件通知,referer:@ 通知
|
|
267
|
+
since: 只获取在给定时间后更新的消息,要求时间格式为 ISO 8601
|
|
268
|
+
before: 只获取在给定时间前更新的消息,要求时间格式为 ISO 8601
|
|
269
|
+
ids: 指定一组通知 ID,以 , 分隔
|
|
270
|
+
page: 当前的页码
|
|
271
|
+
per_page: 每页的数量,最大为 100
|
|
272
|
+
|
|
273
|
+
Returns:
|
|
274
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
275
|
+
"""
|
|
276
|
+
url = build_url("", "/v5/repos/{owner}/{repo}/notifications", owner=owner, repo=repo)
|
|
277
|
+
return self._get(
|
|
278
|
+
url,
|
|
279
|
+
params={
|
|
280
|
+
"unread": unread,
|
|
281
|
+
"participating": participating,
|
|
282
|
+
"type": type,
|
|
283
|
+
"since": since,
|
|
284
|
+
"before": before,
|
|
285
|
+
"ids": ids,
|
|
286
|
+
"page": page,
|
|
287
|
+
"per_page": per_page,
|
|
288
|
+
},
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
def list_repos_subscribers(self, owner: str, repo: str, page: Optional[int] = None, per_page: Optional[int] = None) -> Any:
|
|
292
|
+
"""列出 watch 了仓库的用户
|
|
293
|
+
|
|
294
|
+
Path parameters:
|
|
295
|
+
owner: 仓库所属空间地址(企业、组织或个人的地址path) (**必填**)
|
|
296
|
+
repo: 仓库路径(path) (**必填**)
|
|
297
|
+
Query/Form parameters:
|
|
298
|
+
page: 当前的页码
|
|
299
|
+
per_page: 每页的数量,最大为 100
|
|
300
|
+
|
|
301
|
+
Returns:
|
|
302
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
303
|
+
"""
|
|
304
|
+
url = build_url("", "/v5/repos/{owner}/{repo}/subscribers", owner=owner, repo=repo)
|
|
305
|
+
return self._get(
|
|
306
|
+
url,
|
|
307
|
+
params={
|
|
308
|
+
"page": page,
|
|
309
|
+
"per_page": per_page,
|
|
310
|
+
},
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
def list_user_subscriptions(self, direction: Optional[str] = None, page: Optional[int] = None, per_page: Optional[int] = None, sort: Optional[str] = None) -> Any:
|
|
314
|
+
"""列出授权用户 watch 了的仓库
|
|
315
|
+
|
|
316
|
+
Query/Form parameters:
|
|
317
|
+
sort: 根据仓库创建时间(created)或最后推送时间(updated)进行排序,默认:创建时间
|
|
318
|
+
direction: 按递增(asc)或递减(desc)排序,默认:递减
|
|
319
|
+
page: 当前的页码
|
|
320
|
+
per_page: 每页的数量,最大为 100
|
|
321
|
+
|
|
322
|
+
Returns:
|
|
323
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
324
|
+
"""
|
|
325
|
+
url = build_url("", "/v5/user/subscriptions")
|
|
326
|
+
return self._get(
|
|
327
|
+
url,
|
|
328
|
+
params={
|
|
329
|
+
"sort": sort,
|
|
330
|
+
"direction": direction,
|
|
331
|
+
"page": page,
|
|
332
|
+
"per_page": per_page,
|
|
333
|
+
},
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
def list_users_events(self, username: str, limit: Optional[int] = None, prev_id: Optional[int] = None) -> Any:
|
|
337
|
+
"""列出用户的动态
|
|
338
|
+
|
|
339
|
+
Path parameters:
|
|
340
|
+
username: 用户名(username/login) (**必填**)
|
|
341
|
+
Query/Form parameters:
|
|
342
|
+
prev_id: 滚动列表的最后一条记录的id
|
|
343
|
+
limit: 滚动列表每页的数量,最大为 100
|
|
344
|
+
|
|
345
|
+
Returns:
|
|
346
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
347
|
+
"""
|
|
348
|
+
url = build_url("", "/v5/users/{username}/events", username=username)
|
|
349
|
+
return self._get(
|
|
350
|
+
url,
|
|
351
|
+
params={
|
|
352
|
+
"prev_id": prev_id,
|
|
353
|
+
"limit": limit,
|
|
354
|
+
},
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
def list_users_events_public(self, username: str, limit: Optional[int] = None, prev_id: Optional[int] = None) -> Any:
|
|
358
|
+
"""列出用户的公开动态
|
|
359
|
+
|
|
360
|
+
Path parameters:
|
|
361
|
+
username: 用户名(username/login) (**必填**)
|
|
362
|
+
Query/Form parameters:
|
|
363
|
+
prev_id: 滚动列表的最后一条记录的id
|
|
364
|
+
limit: 滚动列表每页的数量,最大为 100
|
|
365
|
+
|
|
366
|
+
Returns:
|
|
367
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
368
|
+
"""
|
|
369
|
+
url = build_url("", "/v5/users/{username}/events/public", username=username)
|
|
370
|
+
return self._get(
|
|
371
|
+
url,
|
|
372
|
+
params={
|
|
373
|
+
"prev_id": prev_id,
|
|
374
|
+
"limit": limit,
|
|
375
|
+
},
|
|
376
|
+
)
|
|
377
|
+
|
|
378
|
+
def list_users_received_events(self, username: str, limit: Optional[int] = None, prev_id: Optional[int] = None) -> Any:
|
|
379
|
+
"""列出一个用户收到的动态
|
|
380
|
+
|
|
381
|
+
Path parameters:
|
|
382
|
+
username: 用户名(username/login) (**必填**)
|
|
383
|
+
Query/Form parameters:
|
|
384
|
+
prev_id: 滚动列表的最后一条记录的id
|
|
385
|
+
limit: 滚动列表每页的数量,最大为 100
|
|
386
|
+
|
|
387
|
+
Returns:
|
|
388
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
389
|
+
"""
|
|
390
|
+
url = build_url("", "/v5/users/{username}/received_events", username=username)
|
|
391
|
+
return self._get(
|
|
392
|
+
url,
|
|
393
|
+
params={
|
|
394
|
+
"prev_id": prev_id,
|
|
395
|
+
"limit": limit,
|
|
396
|
+
},
|
|
397
|
+
)
|
|
398
|
+
|
|
399
|
+
def list_users_received_events_public(self, username: str, limit: Optional[int] = None, prev_id: Optional[int] = None) -> Any:
|
|
400
|
+
"""列出一个用户收到的公开动态
|
|
401
|
+
|
|
402
|
+
Path parameters:
|
|
403
|
+
username: 用户名(username/login) (**必填**)
|
|
404
|
+
Query/Form parameters:
|
|
405
|
+
prev_id: 滚动列表的最后一条记录的id
|
|
406
|
+
limit: 滚动列表每页的数量,最大为 100
|
|
407
|
+
|
|
408
|
+
Returns:
|
|
409
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
410
|
+
"""
|
|
411
|
+
url = build_url("", "/v5/users/{username}/received_events/public", username=username)
|
|
412
|
+
return self._get(
|
|
413
|
+
url,
|
|
414
|
+
params={
|
|
415
|
+
"prev_id": prev_id,
|
|
416
|
+
"limit": limit,
|
|
417
|
+
},
|
|
418
|
+
)
|
|
419
|
+
|
|
420
|
+
def list_users_subscriptions(self, username: str, direction: Optional[str] = None, limit: Optional[int] = None, prev_id: Optional[int] = None, sort: Optional[str] = None) -> Any:
|
|
421
|
+
"""列出用户 watch 了的仓库
|
|
422
|
+
|
|
423
|
+
Path parameters:
|
|
424
|
+
username: 用户名(username/login) (**必填**)
|
|
425
|
+
Query/Form parameters:
|
|
426
|
+
prev_id: 滚动列表的最后一条记录的id
|
|
427
|
+
limit: 滚动列表每页的数量,最大为 100
|
|
428
|
+
sort: 根据仓库创建时间(created)或最后推送时间(updated)进行排序,默认:创建时间
|
|
429
|
+
direction: 按递增(asc)或递减(desc)排序,默认:递减
|
|
430
|
+
|
|
431
|
+
Returns:
|
|
432
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
433
|
+
"""
|
|
434
|
+
url = build_url("", "/v5/users/{username}/subscriptions", username=username)
|
|
435
|
+
return self._get(
|
|
436
|
+
url,
|
|
437
|
+
params={
|
|
438
|
+
"prev_id": prev_id,
|
|
439
|
+
"limit": limit,
|
|
440
|
+
"sort": sort,
|
|
441
|
+
"direction": direction,
|
|
442
|
+
},
|
|
443
|
+
)
|
|
444
|
+
|
|
445
|
+
def update_notification_messages(self, ids: Optional[str] = None) -> Any:
|
|
446
|
+
"""标记所有私信为已读
|
|
447
|
+
|
|
448
|
+
Query/Form parameters:
|
|
449
|
+
ids: 指定一组私信 ID,以 , 分隔
|
|
450
|
+
|
|
451
|
+
Returns:
|
|
452
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
453
|
+
"""
|
|
454
|
+
url = build_url("", "/v5/notifications/messages")
|
|
455
|
+
return self._put(
|
|
456
|
+
url,
|
|
457
|
+
data={
|
|
458
|
+
"ids": ids,
|
|
459
|
+
},
|
|
460
|
+
)
|
|
461
|
+
|
|
462
|
+
def update_notification_messages_2(self, id: str) -> Any:
|
|
463
|
+
"""标记一条私信为已读
|
|
464
|
+
|
|
465
|
+
Path parameters:
|
|
466
|
+
id: 私信的 ID (**必填**)
|
|
467
|
+
Query/Form parameters:
|
|
468
|
+
|
|
469
|
+
Returns:
|
|
470
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
471
|
+
"""
|
|
472
|
+
url = build_url("", "/v5/notifications/messages/{id}", id=id)
|
|
473
|
+
return self._patch(
|
|
474
|
+
url,
|
|
475
|
+
)
|
|
476
|
+
|
|
477
|
+
def update_notification_threads(self, ids: Optional[str] = None) -> Any:
|
|
478
|
+
"""标记所有通知为已读
|
|
479
|
+
|
|
480
|
+
Query/Form parameters:
|
|
481
|
+
ids: 指定一组通知 ID,以 , 分隔
|
|
482
|
+
|
|
483
|
+
Returns:
|
|
484
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
485
|
+
"""
|
|
486
|
+
url = build_url("", "/v5/notifications/threads")
|
|
487
|
+
return self._put(
|
|
488
|
+
url,
|
|
489
|
+
data={
|
|
490
|
+
"ids": ids,
|
|
491
|
+
},
|
|
492
|
+
)
|
|
493
|
+
|
|
494
|
+
def update_notification_threads_2(self, id: str) -> Any:
|
|
495
|
+
"""标记一条通知为已读
|
|
496
|
+
|
|
497
|
+
Path parameters:
|
|
498
|
+
id: 通知的 ID (**必填**)
|
|
499
|
+
Query/Form parameters:
|
|
500
|
+
|
|
501
|
+
Returns:
|
|
502
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
503
|
+
"""
|
|
504
|
+
url = build_url("", "/v5/notifications/threads/{id}", id=id)
|
|
505
|
+
return self._patch(
|
|
506
|
+
url,
|
|
507
|
+
)
|
|
508
|
+
|
|
509
|
+
def update_repos_notifications(self, owner: str, repo: str, ids: Optional[str] = None) -> Any:
|
|
510
|
+
"""标记一个仓库里的通知为已读
|
|
511
|
+
|
|
512
|
+
Path parameters:
|
|
513
|
+
owner: 仓库所属空间地址(企业、组织或个人的地址path) (**必填**)
|
|
514
|
+
repo: 仓库路径(path) (**必填**)
|
|
515
|
+
Query/Form parameters:
|
|
516
|
+
ids: 指定一组通知 ID,以 , 分隔
|
|
517
|
+
|
|
518
|
+
Returns:
|
|
519
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
520
|
+
"""
|
|
521
|
+
url = build_url("", "/v5/repos/{owner}/{repo}/notifications", owner=owner, repo=repo)
|
|
522
|
+
return self._put(
|
|
523
|
+
url,
|
|
524
|
+
data={
|
|
525
|
+
"ids": ids,
|
|
526
|
+
},
|
|
527
|
+
)
|
|
528
|
+
|
|
529
|
+
def update_user_subscriptions(self, owner: str, repo: str, watch_type: str) -> Any:
|
|
530
|
+
"""watch 一个仓库
|
|
531
|
+
|
|
532
|
+
Path parameters:
|
|
533
|
+
owner: 仓库所属空间地址(企业、组织或个人的地址path) (**必填**)
|
|
534
|
+
repo: 仓库路径(path) (**必填**)
|
|
535
|
+
Query/Form parameters:
|
|
536
|
+
watch_type: watch策略, watching: 关注所有动态, ignoring: 关注但不提醒动态 (**必填**)
|
|
537
|
+
|
|
538
|
+
Returns:
|
|
539
|
+
Parsed JSON response (dict, list, or None for 204).
|
|
540
|
+
"""
|
|
541
|
+
url = build_url("", "/v5/user/subscriptions/{owner}/{repo}", owner=owner, repo=repo)
|
|
542
|
+
return self._put(
|
|
543
|
+
url,
|
|
544
|
+
data={
|
|
545
|
+
"watch_type": watch_type,
|
|
546
|
+
},
|
|
547
|
+
)
|
|
548
|
+
|
|
549
|
+
# ── pagination helpers ──────────────────────────────────────────
|
|
550
|
+
|
|
551
|
+
def list_notification_messages_all(self, before: Optional[str] = None, ids: Optional[str] = None, max_pages: Optional[int] = None, per_page: int = 100, since: Optional[str] = None, unread: Optional[bool] = None) -> Any:
|
|
552
|
+
"""Iterate over all pages of ``list_notification_messages()``.
|
|
553
|
+
|
|
554
|
+
This convenience wrapper handles pagination automatically.
|
|
555
|
+
Yields individual items rather than pages.
|
|
556
|
+
|
|
557
|
+
See :meth:`list_notification_messages` for parameter documentation.
|
|
558
|
+
"""
|
|
559
|
+
url = build_url("", "/v5/notifications/messages")
|
|
560
|
+
params = {
|
|
561
|
+
"unread": unread, "since": since, "before": before, "ids": ids, }
|
|
562
|
+
return list_all(
|
|
563
|
+
self._get,
|
|
564
|
+
url,
|
|
565
|
+
per_page=per_page,
|
|
566
|
+
max_pages=max_pages,
|
|
567
|
+
**params,
|
|
568
|
+
)
|
|
569
|
+
|
|
570
|
+
def list_notification_threads_all(self, before: Optional[str] = None, ids: Optional[str] = None, max_pages: Optional[int] = None, participating: Optional[bool] = None, per_page: int = 100, since: Optional[str] = None, type: Optional[str] = None, unread: Optional[bool] = None) -> Any:
|
|
571
|
+
"""Iterate over all pages of ``list_notification_threads()``.
|
|
572
|
+
|
|
573
|
+
This convenience wrapper handles pagination automatically.
|
|
574
|
+
Yields individual items rather than pages.
|
|
575
|
+
|
|
576
|
+
See :meth:`list_notification_threads` for parameter documentation.
|
|
577
|
+
"""
|
|
578
|
+
url = build_url("", "/v5/notifications/threads")
|
|
579
|
+
params = {
|
|
580
|
+
"unread": unread, "participating": participating, "type": type, "since": since, "before": before, "ids": ids, }
|
|
581
|
+
return list_all(
|
|
582
|
+
self._get,
|
|
583
|
+
url,
|
|
584
|
+
per_page=per_page,
|
|
585
|
+
max_pages=max_pages,
|
|
586
|
+
**params,
|
|
587
|
+
)
|
|
588
|
+
|
|
589
|
+
def list_repos_notifications_all(self, owner: str, repo: str, before: Optional[str] = None, ids: Optional[str] = None, max_pages: Optional[int] = None, participating: Optional[bool] = None, per_page: int = 100, since: Optional[str] = None, type: Optional[str] = None, unread: Optional[bool] = None) -> Any:
|
|
590
|
+
"""Iterate over all pages of ``list_repos_notifications()``.
|
|
591
|
+
|
|
592
|
+
This convenience wrapper handles pagination automatically.
|
|
593
|
+
Yields individual items rather than pages.
|
|
594
|
+
|
|
595
|
+
See :meth:`list_repos_notifications` for parameter documentation.
|
|
596
|
+
"""
|
|
597
|
+
url = build_url("", "/v5/repos/{owner}/{repo}/notifications", owner=owner, repo=repo)
|
|
598
|
+
params = {
|
|
599
|
+
"unread": unread, "participating": participating, "type": type, "since": since, "before": before, "ids": ids, }
|
|
600
|
+
return list_all(
|
|
601
|
+
self._get,
|
|
602
|
+
url,
|
|
603
|
+
per_page=per_page,
|
|
604
|
+
max_pages=max_pages,
|
|
605
|
+
**params,
|
|
606
|
+
)
|
|
607
|
+
|
|
608
|
+
def list_repos_subscribers_all(self, owner: str, repo: str, max_pages: Optional[int] = None, per_page: int = 100) -> Any:
|
|
609
|
+
"""Iterate over all pages of ``list_repos_subscribers()``.
|
|
610
|
+
|
|
611
|
+
This convenience wrapper handles pagination automatically.
|
|
612
|
+
Yields individual items rather than pages.
|
|
613
|
+
|
|
614
|
+
See :meth:`list_repos_subscribers` for parameter documentation.
|
|
615
|
+
"""
|
|
616
|
+
url = build_url("", "/v5/repos/{owner}/{repo}/subscribers", owner=owner, repo=repo)
|
|
617
|
+
return list_all(
|
|
618
|
+
self._get,
|
|
619
|
+
url,
|
|
620
|
+
per_page=per_page,
|
|
621
|
+
max_pages=max_pages,
|
|
622
|
+
)
|
|
623
|
+
|
|
624
|
+
def list_user_subscriptions_all(self, direction: Optional[str] = None, max_pages: Optional[int] = None, per_page: int = 100, sort: Optional[str] = None) -> Any:
|
|
625
|
+
"""Iterate over all pages of ``list_user_subscriptions()``.
|
|
626
|
+
|
|
627
|
+
This convenience wrapper handles pagination automatically.
|
|
628
|
+
Yields individual items rather than pages.
|
|
629
|
+
|
|
630
|
+
See :meth:`list_user_subscriptions` for parameter documentation.
|
|
631
|
+
"""
|
|
632
|
+
url = build_url("", "/v5/user/subscriptions")
|
|
633
|
+
params = {
|
|
634
|
+
"sort": sort, "direction": direction, }
|
|
635
|
+
return list_all(
|
|
636
|
+
self._get,
|
|
637
|
+
url,
|
|
638
|
+
per_page=per_page,
|
|
639
|
+
max_pages=max_pages,
|
|
640
|
+
**params,
|
|
641
|
+
)
|
|
642
|
+
|