gitcode-api 1.2.19__py3-none-any.whl → 1.2.20__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.
- gitcode_api/_base_client.py +1 -1
- gitcode_api/resources/_shared.py +8 -2
- gitcode_api/resources/account.py +85 -16
- gitcode_api/resources/collaboration.py +166 -32
- gitcode_api/resources/repositories.py +277 -48
- gitcode_api/version.txt +1 -1
- {gitcode_api-1.2.19.dist-info → gitcode_api-1.2.20.dist-info}/METADATA +2 -2
- {gitcode_api-1.2.19.dist-info → gitcode_api-1.2.20.dist-info}/RECORD +12 -12
- {gitcode_api-1.2.19.dist-info → gitcode_api-1.2.20.dist-info}/WHEEL +0 -0
- {gitcode_api-1.2.19.dist-info → gitcode_api-1.2.20.dist-info}/entry_points.txt +0 -0
- {gitcode_api-1.2.19.dist-info → gitcode_api-1.2.20.dist-info}/licenses/LICENSE +0 -0
- {gitcode_api-1.2.19.dist-info → gitcode_api-1.2.20.dist-info}/top_level.txt +0 -0
gitcode_api/_base_client.py
CHANGED
gitcode_api/resources/_shared.py
CHANGED
|
@@ -219,6 +219,7 @@ async def list_gitcode_template_rows_async(
|
|
|
219
219
|
repo: str,
|
|
220
220
|
path_pattern: Pattern[str],
|
|
221
221
|
) -> List[Tuple[str, str, str, str]]:
|
|
222
|
+
"""Return ``(template_owner, template_repo, path, sha)`` from the first resolution source with matches."""
|
|
222
223
|
for so, sr in await _resolution_sources_async(client, owner, repo):
|
|
223
224
|
acc: List[Tuple[str, str, str, str]] = []
|
|
224
225
|
try:
|
|
@@ -239,6 +240,8 @@ def get_gitcode_template_body_sync(
|
|
|
239
240
|
path_pattern: Pattern[str],
|
|
240
241
|
owner: str,
|
|
241
242
|
repo: str,
|
|
243
|
+
encoding: str = "utf-8",
|
|
244
|
+
**decoding_kwargs,
|
|
242
245
|
) -> str:
|
|
243
246
|
"""Fetch raw template text from the first resolution source that serves ``path``."""
|
|
244
247
|
if not path_pattern.match(path):
|
|
@@ -259,7 +262,7 @@ def get_gitcode_template_body_sync(
|
|
|
259
262
|
last_error = exc
|
|
260
263
|
continue
|
|
261
264
|
if isinstance(raw, bytes):
|
|
262
|
-
return raw.decode(
|
|
265
|
+
return raw.decode(encoding=encoding, **decoding_kwargs)
|
|
263
266
|
if isinstance(raw, str):
|
|
264
267
|
return raw
|
|
265
268
|
return str(raw)
|
|
@@ -278,7 +281,10 @@ async def get_gitcode_template_body_async(
|
|
|
278
281
|
path_pattern: Pattern[str],
|
|
279
282
|
owner: str,
|
|
280
283
|
repo: str,
|
|
284
|
+
encoding: str = "utf-8",
|
|
285
|
+
**decoding_kwargs,
|
|
281
286
|
) -> str:
|
|
287
|
+
"""Fetch raw template text from the first resolution source that serves ``path``."""
|
|
282
288
|
if not path_pattern.match(path):
|
|
283
289
|
raise GitCodeHTTPStatusError(
|
|
284
290
|
"Path does not match the expected GitCode template pattern for this resource.",
|
|
@@ -297,7 +303,7 @@ async def get_gitcode_template_body_async(
|
|
|
297
303
|
last_error = exc
|
|
298
304
|
continue
|
|
299
305
|
if isinstance(raw, bytes):
|
|
300
|
-
return raw.decode(
|
|
306
|
+
return raw.decode(encoding=encoding, **decoding_kwargs)
|
|
301
307
|
if isinstance(raw, str):
|
|
302
308
|
return raw
|
|
303
309
|
return str(raw)
|
gitcode_api/resources/account.py
CHANGED
|
@@ -909,37 +909,106 @@ class AsyncSearchResource(AsyncResource):
|
|
|
909
909
|
see ``docs/rest_api/search`` and the synchronous methods for field meanings.
|
|
910
910
|
"""
|
|
911
911
|
|
|
912
|
-
async def users(
|
|
912
|
+
async def users(
|
|
913
|
+
self,
|
|
914
|
+
*,
|
|
915
|
+
q: str,
|
|
916
|
+
page: Optional[int] = None,
|
|
917
|
+
per_page: Optional[int] = None,
|
|
918
|
+
sort: Optional[str] = None,
|
|
919
|
+
order: Optional[str] = None,
|
|
920
|
+
) -> List[SearchUser]:
|
|
913
921
|
"""Search users.
|
|
914
922
|
|
|
915
|
-
:param q: Search keywords
|
|
916
|
-
:param
|
|
917
|
-
|
|
923
|
+
:param q: Search keywords.
|
|
924
|
+
:param page: Page number.
|
|
925
|
+
:param per_page: Page size.
|
|
926
|
+
:param sort: Optional sort field such as ``joined_at``.
|
|
927
|
+
:param order: Sort order, usually ``asc`` or ``desc``.
|
|
918
928
|
:returns: Matching user search results.
|
|
919
929
|
"""
|
|
920
|
-
return await self._models(
|
|
930
|
+
return await self._models(
|
|
931
|
+
"GET",
|
|
932
|
+
self._client._path("search", "users"),
|
|
933
|
+
SearchUser,
|
|
934
|
+
params={"q": q, "page": page, "per_page": per_page, "sort": sort, "order": order},
|
|
935
|
+
)
|
|
921
936
|
|
|
922
|
-
async def issues(
|
|
937
|
+
async def issues(
|
|
938
|
+
self,
|
|
939
|
+
*,
|
|
940
|
+
q: str,
|
|
941
|
+
page: Optional[int] = None,
|
|
942
|
+
per_page: Optional[int] = None,
|
|
943
|
+
sort: Optional[str] = None,
|
|
944
|
+
order: Optional[str] = None,
|
|
945
|
+
repo: Optional[str] = None,
|
|
946
|
+
state: Optional[str] = None,
|
|
947
|
+
) -> List[SearchIssue]:
|
|
923
948
|
"""Search issues.
|
|
924
949
|
|
|
925
|
-
:param q: Search keywords
|
|
926
|
-
:param
|
|
927
|
-
|
|
950
|
+
:param q: Search keywords.
|
|
951
|
+
:param page: Page number.
|
|
952
|
+
:param per_page: Page size.
|
|
953
|
+
:param sort: Optional sort field.
|
|
954
|
+
:param order: Sort order, usually ``asc`` or ``desc``.
|
|
955
|
+
:param repo: Optional repository path filter.
|
|
956
|
+
:param state: Optional issue state filter.
|
|
928
957
|
:returns: Matching issue search results.
|
|
929
958
|
"""
|
|
930
|
-
return await self._models(
|
|
959
|
+
return await self._models(
|
|
960
|
+
"GET",
|
|
961
|
+
self._client._path("search", "issues"),
|
|
962
|
+
SearchIssue,
|
|
963
|
+
params={
|
|
964
|
+
"q": q,
|
|
965
|
+
"page": page,
|
|
966
|
+
"per_page": per_page,
|
|
967
|
+
"sort": sort,
|
|
968
|
+
"order": order,
|
|
969
|
+
"repo": repo,
|
|
970
|
+
"state": state,
|
|
971
|
+
},
|
|
972
|
+
)
|
|
931
973
|
|
|
932
|
-
async def repositories(
|
|
974
|
+
async def repositories(
|
|
975
|
+
self,
|
|
976
|
+
*,
|
|
977
|
+
q: str,
|
|
978
|
+
page: Optional[int] = None,
|
|
979
|
+
per_page: Optional[int] = None,
|
|
980
|
+
sort: Optional[str] = None,
|
|
981
|
+
order: Optional[str] = None,
|
|
982
|
+
owner: Optional[str] = None,
|
|
983
|
+
fork: Optional[str] = None,
|
|
984
|
+
language: Optional[str] = None,
|
|
985
|
+
) -> List[SearchRepository]:
|
|
933
986
|
"""Search repositories.
|
|
934
987
|
|
|
935
|
-
:param q: Search keywords
|
|
936
|
-
:param
|
|
937
|
-
|
|
938
|
-
|
|
988
|
+
:param q: Search keywords.
|
|
989
|
+
:param page: Page number.
|
|
990
|
+
:param per_page: Page size.
|
|
991
|
+
:param sort: Optional sort field such as ``stars_count``.
|
|
992
|
+
:param order: Sort order, usually ``asc`` or ``desc``.
|
|
993
|
+
:param owner: Optional owner path filter.
|
|
994
|
+
:param fork: Optional fork visibility filter.
|
|
995
|
+
:param language: Optional programming language filter.
|
|
939
996
|
:returns: Matching repository search results.
|
|
940
997
|
"""
|
|
941
998
|
return await self._models(
|
|
942
|
-
"GET",
|
|
999
|
+
"GET",
|
|
1000
|
+
self._client._path("search", "repositories"),
|
|
1001
|
+
SearchRepository,
|
|
1002
|
+
params={
|
|
1003
|
+
"q": q,
|
|
1004
|
+
"page": page,
|
|
1005
|
+
"per_page": per_page,
|
|
1006
|
+
"sort": sort,
|
|
1007
|
+
"order": order,
|
|
1008
|
+
"owner": owner,
|
|
1009
|
+
"fork": fork,
|
|
1010
|
+
"language": language,
|
|
1011
|
+
},
|
|
943
1012
|
)
|
|
944
1013
|
|
|
945
1014
|
|
|
@@ -442,7 +442,15 @@ class IssuesResource(SyncResource):
|
|
|
442
442
|
for template_owner, template_repo, path, sha in rows
|
|
443
443
|
]
|
|
444
444
|
|
|
445
|
-
def get_template(
|
|
445
|
+
def get_template(
|
|
446
|
+
self,
|
|
447
|
+
*,
|
|
448
|
+
path: str,
|
|
449
|
+
owner: Optional[str] = None,
|
|
450
|
+
repo: Optional[str] = None,
|
|
451
|
+
encoding: str = "utf-8",
|
|
452
|
+
**decoding_kwargs,
|
|
453
|
+
) -> str:
|
|
446
454
|
"""Load a single issue template file body from the default branch.
|
|
447
455
|
|
|
448
456
|
Uses the same resolution order as :meth:`list_templates`. The path must match the
|
|
@@ -452,11 +460,20 @@ class IssuesResource(SyncResource):
|
|
|
452
460
|
``.gitcode/ISSUE_TEMPLATE/config.yml``.
|
|
453
461
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
454
462
|
:param repo: Repository name. Uses the client default when omitted.
|
|
455
|
-
:
|
|
463
|
+
:param encoding: Codec to use when decoding raw file bytes. Default ``utf-8``.
|
|
464
|
+
:param decoding_kwargs: Keyword arguments forwarded to :meth:`bytes.decode`, such as
|
|
465
|
+
``errors`` (``"strict"``, ``"ignore"``, or ``"replace"``).
|
|
466
|
+
:returns: Decoded template file contents.
|
|
456
467
|
"""
|
|
457
468
|
resolved_owner, resolved_repo = self._client._resolve_repo_context(owner, repo)
|
|
458
469
|
return get_gitcode_template_body_sync(
|
|
459
|
-
self._client,
|
|
470
|
+
self._client,
|
|
471
|
+
path,
|
|
472
|
+
GITCODE_ISSUE_TEMPLATE_PATH_RE,
|
|
473
|
+
resolved_owner,
|
|
474
|
+
resolved_repo,
|
|
475
|
+
encoding=encoding,
|
|
476
|
+
**decoding_kwargs,
|
|
460
477
|
)
|
|
461
478
|
|
|
462
479
|
|
|
@@ -491,7 +508,7 @@ class PullsResource(SyncResource):
|
|
|
491
508
|
``since``, ``author``, ``assignee``, ``reviewer``, ``milestone_number``, ``labels`` (comma-separated),
|
|
492
509
|
``merged_after``, ``merged_before``, ``created_after``, ``created_before``, ``updated_after``,
|
|
493
510
|
``updated_before``, ``only_count`` (boolean), and ISO 8601 timestamps (URL-encoded when sent).
|
|
494
|
-
:returns: A list of pull requests, or an :class:`~gitcode_api._models.APIObject`
|
|
511
|
+
:returns: A list of pull requests, or an :class:`~gitcode_api._models.APIObject` for count-only responses.
|
|
495
512
|
"""
|
|
496
513
|
path = self._client._repo_path("pulls", owner=owner, repo=repo)
|
|
497
514
|
response = self._request(
|
|
@@ -1091,7 +1108,15 @@ class PullsResource(SyncResource):
|
|
|
1091
1108
|
for template_owner, template_repo, path, sha in rows
|
|
1092
1109
|
]
|
|
1093
1110
|
|
|
1094
|
-
def get_template(
|
|
1111
|
+
def get_template(
|
|
1112
|
+
self,
|
|
1113
|
+
*,
|
|
1114
|
+
path: str,
|
|
1115
|
+
owner: Optional[str] = None,
|
|
1116
|
+
repo: Optional[str] = None,
|
|
1117
|
+
encoding: str = "utf-8",
|
|
1118
|
+
**decoding_kwargs,
|
|
1119
|
+
) -> str:
|
|
1095
1120
|
"""Load a single pull request template file body from the default branch.
|
|
1096
1121
|
|
|
1097
1122
|
Uses the same resolution order as :meth:`list_templates`. The path must match the
|
|
@@ -1100,11 +1125,20 @@ class PullsResource(SyncResource):
|
|
|
1100
1125
|
:param path: Repository-relative path such as ``.gitcode/PULL_REQUEST_TEMPLATE.md``.
|
|
1101
1126
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
1102
1127
|
:param repo: Repository path. Uses the client default when omitted.
|
|
1103
|
-
:
|
|
1128
|
+
:param encoding: Codec to use when decoding raw file bytes. Default ``utf-8``.
|
|
1129
|
+
:param decoding_kwargs: Keyword arguments forwarded to :meth:`bytes.decode`, such as
|
|
1130
|
+
``errors`` (``"strict"``, ``"ignore"``, or ``"replace"``).
|
|
1131
|
+
:returns: Decoded template file contents.
|
|
1104
1132
|
"""
|
|
1105
1133
|
resolved_owner, resolved_repo = self._client._resolve_repo_context(owner, repo)
|
|
1106
1134
|
return get_gitcode_template_body_sync(
|
|
1107
|
-
self._client,
|
|
1135
|
+
self._client,
|
|
1136
|
+
path,
|
|
1137
|
+
GITCODE_PULL_REQUEST_TEMPLATE_PATH_RE,
|
|
1138
|
+
resolved_owner,
|
|
1139
|
+
resolved_repo,
|
|
1140
|
+
encoding=encoding,
|
|
1141
|
+
**decoding_kwargs,
|
|
1108
1142
|
)
|
|
1109
1143
|
|
|
1110
1144
|
|
|
@@ -1414,16 +1448,39 @@ class AsyncIssuesResource(AsyncResource):
|
|
|
1414
1448
|
parameter descriptions aligned with ``docs/rest_api`` (Issues API).
|
|
1415
1449
|
"""
|
|
1416
1450
|
|
|
1417
|
-
async def list(
|
|
1451
|
+
async def list(
|
|
1452
|
+
self,
|
|
1453
|
+
*,
|
|
1454
|
+
owner: Optional[str] = None,
|
|
1455
|
+
repo: Optional[str] = None,
|
|
1456
|
+
state: Optional[str] = None,
|
|
1457
|
+
sort: Optional[str] = None,
|
|
1458
|
+
direction: Optional[str] = None,
|
|
1459
|
+
page: Optional[int] = None,
|
|
1460
|
+
per_page: Optional[int] = None,
|
|
1461
|
+
) -> List[Issue]:
|
|
1418
1462
|
"""List issues for a repository.
|
|
1419
1463
|
|
|
1420
1464
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
1421
1465
|
:param repo: Repository name. Uses the client default when omitted.
|
|
1422
|
-
:param
|
|
1466
|
+
:param state: Issue state filter such as ``open`` or ``closed`` (see Issues API).
|
|
1467
|
+
:param sort: Optional sort field.
|
|
1468
|
+
:param direction: Optional sort direction.
|
|
1469
|
+
:param page: Page number.
|
|
1470
|
+
:param per_page: Page size.
|
|
1423
1471
|
:returns: Matching issues.
|
|
1424
1472
|
"""
|
|
1425
1473
|
return await self._models(
|
|
1426
|
-
"GET",
|
|
1474
|
+
"GET",
|
|
1475
|
+
self._client._repo_path("issues", owner=owner, repo=repo),
|
|
1476
|
+
Issue,
|
|
1477
|
+
params={
|
|
1478
|
+
"state": state,
|
|
1479
|
+
"sort": sort,
|
|
1480
|
+
"direction": direction,
|
|
1481
|
+
"page": page,
|
|
1482
|
+
"per_page": per_page,
|
|
1483
|
+
},
|
|
1427
1484
|
)
|
|
1428
1485
|
|
|
1429
1486
|
async def get(self, *, number: Union[int, str], owner: Optional[str] = None, repo: Optional[str] = None) -> Issue:
|
|
@@ -1522,21 +1579,28 @@ class AsyncIssuesResource(AsyncResource):
|
|
|
1522
1579
|
)
|
|
1523
1580
|
|
|
1524
1581
|
async def list_comments(
|
|
1525
|
-
self,
|
|
1582
|
+
self,
|
|
1583
|
+
*,
|
|
1584
|
+
number: Union[int, str],
|
|
1585
|
+
owner: Optional[str] = None,
|
|
1586
|
+
repo: Optional[str] = None,
|
|
1587
|
+
page: Optional[int] = None,
|
|
1588
|
+
per_page: Optional[int] = None,
|
|
1526
1589
|
) -> List[IssueComment]:
|
|
1527
1590
|
"""List comments for an issue.
|
|
1528
1591
|
|
|
1529
1592
|
:param number: Repository-local issue number.
|
|
1530
1593
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
1531
1594
|
:param repo: Repository path (name). Uses the client default when omitted.
|
|
1532
|
-
:param
|
|
1595
|
+
:param page: Current page number (query).
|
|
1596
|
+
:param per_page: Page size; maximum per REST API is typically 100.
|
|
1533
1597
|
:returns: Issue comments.
|
|
1534
1598
|
"""
|
|
1535
1599
|
return await self._models(
|
|
1536
1600
|
"GET",
|
|
1537
1601
|
self._client._repo_path("issues", number, "comments", owner=owner, repo=repo),
|
|
1538
1602
|
IssueComment,
|
|
1539
|
-
params=
|
|
1603
|
+
params={"page": page, "per_page": per_page},
|
|
1540
1604
|
)
|
|
1541
1605
|
|
|
1542
1606
|
async def create_comment(
|
|
@@ -1704,19 +1768,22 @@ class AsyncIssuesResource(AsyncResource):
|
|
|
1704
1768
|
"GET", self._client._path("enterprises", enterprise, "issues", issue_id, "labels"), Label
|
|
1705
1769
|
)
|
|
1706
1770
|
|
|
1707
|
-
async def list_operation_logs(
|
|
1771
|
+
async def list_operation_logs(
|
|
1772
|
+
self, *, owner: str, number: Union[int, str], page: Optional[int] = None, per_page: Optional[int] = None
|
|
1773
|
+
) -> List[IssueOperationLog]:
|
|
1708
1774
|
"""List operation (audit) logs for an issue.
|
|
1709
1775
|
|
|
1710
1776
|
:param owner: Repository owner path (path segment ``repos/{owner}/...`` for this endpoint).
|
|
1711
1777
|
:param number: Repository-local issue number.
|
|
1712
|
-
:param
|
|
1778
|
+
:param page: Page number.
|
|
1779
|
+
:param per_page: Page size.
|
|
1713
1780
|
:returns: Operation log entries.
|
|
1714
1781
|
"""
|
|
1715
1782
|
return await self._models(
|
|
1716
1783
|
"GET",
|
|
1717
1784
|
self._client._path("repos", owner, "issues", number, "operate_logs"),
|
|
1718
1785
|
IssueOperationLog,
|
|
1719
|
-
params=
|
|
1786
|
+
params={"page": page, "per_page": per_page},
|
|
1720
1787
|
)
|
|
1721
1788
|
|
|
1722
1789
|
async def list_templates(
|
|
@@ -1760,7 +1827,15 @@ class AsyncIssuesResource(AsyncResource):
|
|
|
1760
1827
|
for template_owner, template_repo, path, sha in rows
|
|
1761
1828
|
]
|
|
1762
1829
|
|
|
1763
|
-
async def get_template(
|
|
1830
|
+
async def get_template(
|
|
1831
|
+
self,
|
|
1832
|
+
*,
|
|
1833
|
+
path: str,
|
|
1834
|
+
owner: Optional[str] = None,
|
|
1835
|
+
repo: Optional[str] = None,
|
|
1836
|
+
encoding: str = "utf-8",
|
|
1837
|
+
**decoding_kwargs,
|
|
1838
|
+
) -> str:
|
|
1764
1839
|
"""Load a single issue template file body from the default branch.
|
|
1765
1840
|
|
|
1766
1841
|
Uses the same resolution order as :meth:`list_templates`. The path must match the
|
|
@@ -1770,11 +1845,20 @@ class AsyncIssuesResource(AsyncResource):
|
|
|
1770
1845
|
``.gitcode/ISSUE_TEMPLATE/config.yml``.
|
|
1771
1846
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
1772
1847
|
:param repo: Repository name. Uses the client default when omitted.
|
|
1773
|
-
:
|
|
1848
|
+
:param encoding: Codec to use when decoding raw file bytes. Default ``utf-8``.
|
|
1849
|
+
:param decoding_kwargs: Keyword arguments forwarded to :meth:`bytes.decode`, such as
|
|
1850
|
+
``errors`` (``"strict"``, ``"ignore"``, or ``"replace"``).
|
|
1851
|
+
:returns: Decoded template file contents.
|
|
1774
1852
|
"""
|
|
1775
1853
|
resolved_owner, resolved_repo = self._client._resolve_repo_context(owner, repo)
|
|
1776
1854
|
return await get_gitcode_template_body_async(
|
|
1777
|
-
self._client,
|
|
1855
|
+
self._client,
|
|
1856
|
+
path,
|
|
1857
|
+
GITCODE_ISSUE_TEMPLATE_PATH_RE,
|
|
1858
|
+
resolved_owner,
|
|
1859
|
+
resolved_repo,
|
|
1860
|
+
encoding=encoding,
|
|
1861
|
+
**decoding_kwargs,
|
|
1778
1862
|
)
|
|
1779
1863
|
|
|
1780
1864
|
|
|
@@ -1786,21 +1870,47 @@ class AsyncPullsResource(AsyncResource):
|
|
|
1786
1870
|
"""
|
|
1787
1871
|
|
|
1788
1872
|
async def list(
|
|
1789
|
-
self,
|
|
1873
|
+
self,
|
|
1874
|
+
*,
|
|
1875
|
+
owner: Optional[str] = None,
|
|
1876
|
+
repo: Optional[str] = None,
|
|
1877
|
+
state: Optional[str] = None,
|
|
1878
|
+
sort: Optional[str] = None,
|
|
1879
|
+
direction: Optional[str] = None,
|
|
1880
|
+
page: Optional[int] = None,
|
|
1881
|
+
per_page: Optional[int] = None,
|
|
1882
|
+
**params,
|
|
1790
1883
|
) -> Union[List[PullRequest], PullRequestCount]:
|
|
1791
1884
|
"""List pull requests for a repository.
|
|
1792
1885
|
|
|
1793
|
-
When ``only_count`` is true in ``params
|
|
1794
|
-
instead of an array (see Pull Request API).
|
|
1886
|
+
When ``only_count`` is true in ``params`` (or passed via ``**params``), the API returns a
|
|
1887
|
+
JSON object with counts per state instead of an array (see Pull Request API).
|
|
1795
1888
|
|
|
1796
1889
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
1797
1890
|
:param repo: Repository path (name). Uses the client default when omitted.
|
|
1798
|
-
:param
|
|
1799
|
-
|
|
1800
|
-
|
|
1891
|
+
:param state: PR state filter: ``all``, ``open``, ``closed``, ``locked``, ``merged`` (default ``all`` in API).
|
|
1892
|
+
:param sort: Sort field, typically ``created`` or ``updated``.
|
|
1893
|
+
:param direction: ``asc`` or ``desc`` (API default is usually ``desc``).
|
|
1894
|
+
:param page: Current page number.
|
|
1895
|
+
:param per_page: Page size (max 100 per API documentation).
|
|
1896
|
+
:param params: Extra query parameters from the Pull Request API, for example ``base``,
|
|
1897
|
+
``since``, ``author``, ``assignee``, ``reviewer``, ``milestone_number``, ``labels`` (comma-separated),
|
|
1898
|
+
``merged_after``, ``merged_before``, ``created_after``, ``created_before``, ``updated_after``,
|
|
1899
|
+
``updated_before``, ``only_count`` (boolean), and ISO 8601 timestamps (URL-encoded when sent).
|
|
1801
1900
|
:returns: A list of pull requests, or an :class:`~gitcode_api._models.APIObject` for count-only responses.
|
|
1802
1901
|
"""
|
|
1803
|
-
response = await self._request(
|
|
1902
|
+
response = await self._request(
|
|
1903
|
+
"GET",
|
|
1904
|
+
self._client._repo_path("pulls", owner=owner, repo=repo),
|
|
1905
|
+
params={
|
|
1906
|
+
"state": state,
|
|
1907
|
+
"sort": sort,
|
|
1908
|
+
"direction": direction,
|
|
1909
|
+
"page": page,
|
|
1910
|
+
"per_page": per_page,
|
|
1911
|
+
**params,
|
|
1912
|
+
},
|
|
1913
|
+
)
|
|
1804
1914
|
if isinstance(response, dict):
|
|
1805
1915
|
return as_model(response, PullRequestCount)
|
|
1806
1916
|
return [as_model(item, PullRequest) for item in response]
|
|
@@ -1986,21 +2096,28 @@ class AsyncPullsResource(AsyncResource):
|
|
|
1986
2096
|
)
|
|
1987
2097
|
|
|
1988
2098
|
async def list_comments(
|
|
1989
|
-
self,
|
|
2099
|
+
self,
|
|
2100
|
+
*,
|
|
2101
|
+
number: Union[int, str],
|
|
2102
|
+
owner: Optional[str] = None,
|
|
2103
|
+
repo: Optional[str] = None,
|
|
2104
|
+
page: Optional[int] = None,
|
|
2105
|
+
per_page: Optional[int] = None,
|
|
1990
2106
|
) -> List[PullRequestComment]:
|
|
1991
2107
|
"""List comments on a pull request.
|
|
1992
2108
|
|
|
1993
2109
|
:param number: Pull request number.
|
|
1994
2110
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
1995
2111
|
:param repo: Repository path. Uses the client default when omitted.
|
|
1996
|
-
:param
|
|
2112
|
+
:param page: Page number.
|
|
2113
|
+
:param per_page: Page size.
|
|
1997
2114
|
:returns: Pull request review comments.
|
|
1998
2115
|
"""
|
|
1999
2116
|
return await self._models(
|
|
2000
2117
|
"GET",
|
|
2001
2118
|
self._client._repo_path("pulls", number, "comments", owner=owner, repo=repo),
|
|
2002
2119
|
PullRequestComment,
|
|
2003
|
-
params=
|
|
2120
|
+
params={"page": page, "per_page": per_page},
|
|
2004
2121
|
)
|
|
2005
2122
|
|
|
2006
2123
|
async def create_comment(
|
|
@@ -2356,7 +2473,15 @@ class AsyncPullsResource(AsyncResource):
|
|
|
2356
2473
|
for template_owner, template_repo, path, sha in rows
|
|
2357
2474
|
]
|
|
2358
2475
|
|
|
2359
|
-
async def get_template(
|
|
2476
|
+
async def get_template(
|
|
2477
|
+
self,
|
|
2478
|
+
*,
|
|
2479
|
+
path: str,
|
|
2480
|
+
owner: Optional[str] = None,
|
|
2481
|
+
repo: Optional[str] = None,
|
|
2482
|
+
encoding: str = "utf-8",
|
|
2483
|
+
**decoding_kwargs,
|
|
2484
|
+
) -> str:
|
|
2360
2485
|
"""Load a single pull request template file body from the default branch.
|
|
2361
2486
|
|
|
2362
2487
|
Uses the same resolution order as :meth:`list_templates`. The path must match the
|
|
@@ -2365,11 +2490,20 @@ class AsyncPullsResource(AsyncResource):
|
|
|
2365
2490
|
:param path: Repository-relative path such as ``.gitcode/PULL_REQUEST_TEMPLATE.md``.
|
|
2366
2491
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
2367
2492
|
:param repo: Repository path. Uses the client default when omitted.
|
|
2368
|
-
:
|
|
2493
|
+
:param encoding: Codec to use when decoding raw file bytes. Default ``utf-8``.
|
|
2494
|
+
:param decoding_kwargs: Keyword arguments forwarded to :meth:`bytes.decode`, such as
|
|
2495
|
+
``errors`` (``"strict"``, ``"ignore"``, or ``"replace"``).
|
|
2496
|
+
:returns: Decoded template file contents.
|
|
2369
2497
|
"""
|
|
2370
2498
|
resolved_owner, resolved_repo = self._client._resolve_repo_context(owner, repo)
|
|
2371
2499
|
return await get_gitcode_template_body_async(
|
|
2372
|
-
self._client,
|
|
2500
|
+
self._client,
|
|
2501
|
+
path,
|
|
2502
|
+
GITCODE_PULL_REQUEST_TEMPLATE_PATH_RE,
|
|
2503
|
+
resolved_owner,
|
|
2504
|
+
resolved_repo,
|
|
2505
|
+
encoding=encoding,
|
|
2506
|
+
**decoding_kwargs,
|
|
2373
2507
|
)
|
|
2374
2508
|
|
|
2375
2509
|
|
|
@@ -1133,46 +1133,181 @@ class AsyncReposResource(AsyncResource):
|
|
|
1133
1133
|
"""
|
|
1134
1134
|
return await self._model("GET", self._client._repo_path(owner=owner, repo=repo), Repository)
|
|
1135
1135
|
|
|
1136
|
-
async def list_user(
|
|
1136
|
+
async def list_user(
|
|
1137
|
+
self,
|
|
1138
|
+
*,
|
|
1139
|
+
visibility: Optional[str] = None,
|
|
1140
|
+
affiliation: Optional[str] = None,
|
|
1141
|
+
type: Optional[str] = None,
|
|
1142
|
+
sort: Optional[str] = None,
|
|
1143
|
+
direction: Optional[str] = None,
|
|
1144
|
+
q: Optional[str] = None,
|
|
1145
|
+
page: Optional[int] = None,
|
|
1146
|
+
per_page: Optional[int] = None,
|
|
1147
|
+
) -> List[Repository]:
|
|
1137
1148
|
"""List repositories visible to the authenticated user.
|
|
1138
1149
|
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
:param
|
|
1150
|
+
:param visibility: Visibility filter such as ``public``, ``private``, or ``all``.
|
|
1151
|
+
:param affiliation: Ownership filter accepted by the REST API.
|
|
1152
|
+
:param type: Repository type filter.
|
|
1153
|
+
:param sort: Sort field such as ``created`` or ``full_name``.
|
|
1154
|
+
:param direction: Sort direction.
|
|
1155
|
+
:param q: Optional keyword filter.
|
|
1156
|
+
:param page: Page number.
|
|
1157
|
+
:param per_page: Page size.
|
|
1143
1158
|
:returns: Matching repositories.
|
|
1144
1159
|
"""
|
|
1145
|
-
return await self._models(
|
|
1160
|
+
return await self._models(
|
|
1161
|
+
"GET",
|
|
1162
|
+
self._client._path("user", "repos"),
|
|
1163
|
+
Repository,
|
|
1164
|
+
params={
|
|
1165
|
+
"visibility": visibility,
|
|
1166
|
+
"affiliation": affiliation,
|
|
1167
|
+
"type": type,
|
|
1168
|
+
"sort": sort,
|
|
1169
|
+
"direction": direction,
|
|
1170
|
+
"q": q,
|
|
1171
|
+
"page": page,
|
|
1172
|
+
"per_page": per_page,
|
|
1173
|
+
},
|
|
1174
|
+
)
|
|
1146
1175
|
|
|
1147
|
-
async def list_for_owner(
|
|
1176
|
+
async def list_for_owner(
|
|
1177
|
+
self,
|
|
1178
|
+
*,
|
|
1179
|
+
owner: str,
|
|
1180
|
+
type: Optional[str] = None,
|
|
1181
|
+
sort: Optional[str] = None,
|
|
1182
|
+
direction: Optional[str] = None,
|
|
1183
|
+
page: Optional[int] = None,
|
|
1184
|
+
per_page: Optional[int] = None,
|
|
1185
|
+
) -> List[Repository]:
|
|
1148
1186
|
"""List public repositories for a user or owner path.
|
|
1149
1187
|
|
|
1150
1188
|
:param owner: Repository owner path or username.
|
|
1151
|
-
:param
|
|
1189
|
+
:param type: Repository type filter.
|
|
1190
|
+
:param sort: Sort field.
|
|
1191
|
+
:param direction: Sort direction.
|
|
1192
|
+
:param page: Page number.
|
|
1193
|
+
:param per_page: Page size.
|
|
1152
1194
|
:returns: Matching repositories.
|
|
1153
1195
|
"""
|
|
1154
|
-
return await self._models(
|
|
1196
|
+
return await self._models(
|
|
1197
|
+
"GET",
|
|
1198
|
+
self._client._path("users", owner, "repos"),
|
|
1199
|
+
Repository,
|
|
1200
|
+
params={
|
|
1201
|
+
"type": type,
|
|
1202
|
+
"sort": sort,
|
|
1203
|
+
"direction": direction,
|
|
1204
|
+
"page": page,
|
|
1205
|
+
"per_page": per_page,
|
|
1206
|
+
},
|
|
1207
|
+
)
|
|
1155
1208
|
|
|
1156
|
-
async def create_personal(
|
|
1209
|
+
async def create_personal(
|
|
1210
|
+
self,
|
|
1211
|
+
*,
|
|
1212
|
+
name: str,
|
|
1213
|
+
description: Optional[str] = None,
|
|
1214
|
+
path: Optional[str] = None,
|
|
1215
|
+
private: Optional[bool] = None,
|
|
1216
|
+
auto_init: Optional[bool] = None,
|
|
1217
|
+
has_issues: Optional[bool] = None,
|
|
1218
|
+
has_wiki: Optional[bool] = None,
|
|
1219
|
+
default_branch: Optional[str] = None,
|
|
1220
|
+
gitignore_template: Optional[str] = None,
|
|
1221
|
+
license_template: Optional[str] = None,
|
|
1222
|
+
) -> Repository:
|
|
1157
1223
|
"""Create a repository for the authenticated user.
|
|
1158
1224
|
|
|
1159
|
-
:param name: Repository name
|
|
1160
|
-
:param
|
|
1225
|
+
:param name: Repository name.
|
|
1226
|
+
:param description: Repository description.
|
|
1227
|
+
:param path: Optional repository path.
|
|
1228
|
+
:param private: Whether the repository should be private.
|
|
1229
|
+
:param auto_init: Whether to initialize the repository with a README.
|
|
1230
|
+
:param has_issues: Whether issues are enabled.
|
|
1231
|
+
:param has_wiki: Whether wiki support is enabled.
|
|
1232
|
+
:param default_branch: Default branch name when initializing.
|
|
1233
|
+
:param gitignore_template: Optional gitignore template.
|
|
1234
|
+
:param license_template: Optional license template.
|
|
1161
1235
|
:returns: Created repository metadata.
|
|
1162
1236
|
"""
|
|
1163
|
-
|
|
1164
|
-
|
|
1237
|
+
return await self._model(
|
|
1238
|
+
"POST",
|
|
1239
|
+
self._client._path("user", "repos"),
|
|
1240
|
+
Repository,
|
|
1241
|
+
json={
|
|
1242
|
+
"name": name,
|
|
1243
|
+
"description": description,
|
|
1244
|
+
"path": path,
|
|
1245
|
+
"private": private,
|
|
1246
|
+
"auto_init": auto_init,
|
|
1247
|
+
"has_issues": has_issues,
|
|
1248
|
+
"has_wiki": has_wiki,
|
|
1249
|
+
"default_branch": default_branch,
|
|
1250
|
+
"gitignore_template": gitignore_template,
|
|
1251
|
+
"license_template": license_template,
|
|
1252
|
+
},
|
|
1253
|
+
)
|
|
1165
1254
|
|
|
1166
|
-
async def create_for_org(
|
|
1255
|
+
async def create_for_org(
|
|
1256
|
+
self,
|
|
1257
|
+
*,
|
|
1258
|
+
org: str,
|
|
1259
|
+
name: str,
|
|
1260
|
+
description: Optional[str] = None,
|
|
1261
|
+
homepage: Optional[str] = None,
|
|
1262
|
+
path: Optional[str] = None,
|
|
1263
|
+
private: Optional[bool] = None,
|
|
1264
|
+
public: Optional[int] = None,
|
|
1265
|
+
auto_init: Optional[bool] = None,
|
|
1266
|
+
has_issues: Optional[bool] = None,
|
|
1267
|
+
has_wiki: Optional[bool] = None,
|
|
1268
|
+
can_comment: Optional[bool] = None,
|
|
1269
|
+
default_branch: Optional[str] = None,
|
|
1270
|
+
gitignore_template: Optional[str] = None,
|
|
1271
|
+
license_template: Optional[str] = None,
|
|
1272
|
+
) -> Repository:
|
|
1167
1273
|
"""Create a repository under an organization.
|
|
1168
1274
|
|
|
1169
1275
|
:param org: Organization path or login.
|
|
1170
|
-
:param name: Repository name
|
|
1171
|
-
:param
|
|
1276
|
+
:param name: Repository name.
|
|
1277
|
+
:param description: Repository description.
|
|
1278
|
+
:param homepage: Repository homepage URL.
|
|
1279
|
+
:param path: Optional repository path.
|
|
1280
|
+
:param private: Whether the repository should be private.
|
|
1281
|
+
:param public: Visibility mode used by the GitCode API.
|
|
1282
|
+
:param auto_init: Whether to initialize the repository with a README.
|
|
1283
|
+
:param has_issues: Whether issues are enabled.
|
|
1284
|
+
:param has_wiki: Whether wiki support is enabled.
|
|
1285
|
+
:param can_comment: Whether comments are enabled.
|
|
1286
|
+
:param default_branch: Default branch name when initializing.
|
|
1287
|
+
:param gitignore_template: Optional gitignore template.
|
|
1288
|
+
:param license_template: Optional license template.
|
|
1172
1289
|
:returns: Created repository metadata.
|
|
1173
1290
|
"""
|
|
1174
|
-
|
|
1175
|
-
|
|
1291
|
+
return await self._model(
|
|
1292
|
+
"POST",
|
|
1293
|
+
self._client._path("orgs", org, "repos"),
|
|
1294
|
+
Repository,
|
|
1295
|
+
json={
|
|
1296
|
+
"name": name,
|
|
1297
|
+
"description": description,
|
|
1298
|
+
"homepage": homepage,
|
|
1299
|
+
"path": path,
|
|
1300
|
+
"private": private,
|
|
1301
|
+
"public": public,
|
|
1302
|
+
"auto_init": auto_init,
|
|
1303
|
+
"has_issues": has_issues,
|
|
1304
|
+
"has_wiki": has_wiki,
|
|
1305
|
+
"can_comment": can_comment,
|
|
1306
|
+
"default_branch": default_branch,
|
|
1307
|
+
"gitignore_template": gitignore_template,
|
|
1308
|
+
"license_template": license_template,
|
|
1309
|
+
},
|
|
1310
|
+
)
|
|
1176
1311
|
|
|
1177
1312
|
async def update(self, *, owner: Optional[str] = None, repo: Optional[str] = None, **changes) -> Repository:
|
|
1178
1313
|
"""Update repository metadata.
|
|
@@ -1192,47 +1327,77 @@ class AsyncReposResource(AsyncResource):
|
|
|
1192
1327
|
"""
|
|
1193
1328
|
await self._request("DELETE", self._client._repo_path(owner=owner, repo=repo))
|
|
1194
1329
|
|
|
1195
|
-
async def fork(
|
|
1330
|
+
async def fork(
|
|
1331
|
+
self,
|
|
1332
|
+
*,
|
|
1333
|
+
owner: Optional[str] = None,
|
|
1334
|
+
repo: Optional[str] = None,
|
|
1335
|
+
namespace: Optional[str] = None,
|
|
1336
|
+
path: Optional[str] = None,
|
|
1337
|
+
name: Optional[str] = None,
|
|
1338
|
+
) -> Repository:
|
|
1196
1339
|
"""Fork a repository.
|
|
1197
1340
|
|
|
1198
|
-
:param owner: Source repository owner path.
|
|
1199
|
-
:param repo: Source repository name.
|
|
1200
|
-
:param
|
|
1341
|
+
:param owner: Source repository owner path.
|
|
1342
|
+
:param repo: Source repository name.
|
|
1343
|
+
:param namespace: Optional destination namespace.
|
|
1344
|
+
:param path: Optional destination repository path.
|
|
1345
|
+
:param name: Optional destination repository name.
|
|
1201
1346
|
:returns: Forked repository metadata.
|
|
1202
1347
|
"""
|
|
1203
1348
|
return await self._model(
|
|
1204
|
-
"POST",
|
|
1349
|
+
"POST",
|
|
1350
|
+
self._client._repo_path("forks", owner=owner, repo=repo),
|
|
1351
|
+
Repository,
|
|
1352
|
+
json={"namespace": namespace, "path": path, "name": name},
|
|
1205
1353
|
)
|
|
1206
1354
|
|
|
1207
1355
|
async def list_forks(
|
|
1208
|
-
self,
|
|
1356
|
+
self,
|
|
1357
|
+
*,
|
|
1358
|
+
owner: Optional[str] = None,
|
|
1359
|
+
repo: Optional[str] = None,
|
|
1360
|
+
sort: Optional[str] = None,
|
|
1361
|
+
page: Optional[int] = None,
|
|
1362
|
+
per_page: Optional[int] = None,
|
|
1209
1363
|
) -> List[Repository]:
|
|
1210
1364
|
"""List forks of a repository.
|
|
1211
1365
|
|
|
1212
1366
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
1213
1367
|
:param repo: Repository name. Uses the client default when omitted.
|
|
1214
|
-
:param
|
|
1368
|
+
:param sort: Optional sort field.
|
|
1369
|
+
:param page: Page number.
|
|
1370
|
+
:param per_page: Page size.
|
|
1215
1371
|
:returns: Fork repositories.
|
|
1216
1372
|
"""
|
|
1217
1373
|
return await self._models(
|
|
1218
|
-
"GET",
|
|
1374
|
+
"GET",
|
|
1375
|
+
self._client._repo_path("forks", owner=owner, repo=repo),
|
|
1376
|
+
Repository,
|
|
1377
|
+
params={"sort": sort, "page": page, "per_page": per_page},
|
|
1219
1378
|
)
|
|
1220
1379
|
|
|
1221
1380
|
async def list_contributors(
|
|
1222
|
-
self,
|
|
1381
|
+
self,
|
|
1382
|
+
*,
|
|
1383
|
+
owner: Optional[str] = None,
|
|
1384
|
+
repo: Optional[str] = None,
|
|
1385
|
+
page: Optional[int] = None,
|
|
1386
|
+
per_page: Optional[int] = None,
|
|
1223
1387
|
) -> List[Contributor]:
|
|
1224
1388
|
"""List repository contributors.
|
|
1225
1389
|
|
|
1226
1390
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
1227
1391
|
:param repo: Repository name. Uses the client default when omitted.
|
|
1228
|
-
:param
|
|
1392
|
+
:param page: Page number.
|
|
1393
|
+
:param per_page: Page size.
|
|
1229
1394
|
:returns: Contributors for the repository.
|
|
1230
1395
|
"""
|
|
1231
1396
|
return await self._models(
|
|
1232
1397
|
"GET",
|
|
1233
1398
|
self._client._repo_path("contributors", owner=owner, repo=repo),
|
|
1234
1399
|
Contributor,
|
|
1235
|
-
params=
|
|
1400
|
+
params={"page": page, "per_page": per_page},
|
|
1236
1401
|
)
|
|
1237
1402
|
|
|
1238
1403
|
async def list_languages(self, *, owner: Optional[str] = None, repo: Optional[str] = None) -> Dict[str, int]:
|
|
@@ -1245,34 +1410,49 @@ class AsyncReposResource(AsyncResource):
|
|
|
1245
1410
|
return await self._request("GET", self._client._repo_path("languages", owner=owner, repo=repo))
|
|
1246
1411
|
|
|
1247
1412
|
async def list_stargazers(
|
|
1248
|
-
self,
|
|
1413
|
+
self,
|
|
1414
|
+
*,
|
|
1415
|
+
owner: Optional[str] = None,
|
|
1416
|
+
repo: Optional[str] = None,
|
|
1417
|
+
page: Optional[int] = None,
|
|
1418
|
+
per_page: Optional[int] = None,
|
|
1249
1419
|
) -> List[UserSummary]:
|
|
1250
1420
|
"""List users who starred a repository.
|
|
1251
1421
|
|
|
1252
1422
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
1253
1423
|
:param repo: Repository name. Uses the client default when omitted.
|
|
1254
|
-
:param
|
|
1424
|
+
:param page: Page number.
|
|
1425
|
+
:param per_page: Page size.
|
|
1255
1426
|
:returns: Users who starred the repository.
|
|
1256
1427
|
"""
|
|
1257
1428
|
return await self._models(
|
|
1258
|
-
"GET",
|
|
1429
|
+
"GET",
|
|
1430
|
+
self._client._repo_path("stargazers", owner=owner, repo=repo),
|
|
1431
|
+
UserSummary,
|
|
1432
|
+
params={"page": page, "per_page": per_page},
|
|
1259
1433
|
)
|
|
1260
1434
|
|
|
1261
1435
|
async def list_subscribers(
|
|
1262
|
-
self,
|
|
1436
|
+
self,
|
|
1437
|
+
*,
|
|
1438
|
+
owner: Optional[str] = None,
|
|
1439
|
+
repo: Optional[str] = None,
|
|
1440
|
+
page: Optional[int] = None,
|
|
1441
|
+
per_page: Optional[int] = None,
|
|
1263
1442
|
) -> List[UserSummary]:
|
|
1264
1443
|
"""List users watching a repository.
|
|
1265
1444
|
|
|
1266
1445
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
1267
1446
|
:param repo: Repository name. Uses the client default when omitted.
|
|
1268
|
-
:param
|
|
1447
|
+
:param page: Page number.
|
|
1448
|
+
:param per_page: Page size.
|
|
1269
1449
|
:returns: Subscribers for the repository.
|
|
1270
1450
|
"""
|
|
1271
1451
|
return await self._models(
|
|
1272
1452
|
"GET",
|
|
1273
1453
|
self._client._repo_path("subscribers", owner=owner, repo=repo),
|
|
1274
1454
|
UserSummary,
|
|
1275
|
-
params=
|
|
1455
|
+
params={"page": page, "per_page": per_page},
|
|
1276
1456
|
)
|
|
1277
1457
|
|
|
1278
1458
|
async def update_module_settings(
|
|
@@ -1559,16 +1739,26 @@ class AsyncReposResource(AsyncResource):
|
|
|
1559
1739
|
)
|
|
1560
1740
|
|
|
1561
1741
|
async def list_events(
|
|
1562
|
-
self,
|
|
1742
|
+
self,
|
|
1743
|
+
*,
|
|
1744
|
+
owner: Optional[str] = None,
|
|
1745
|
+
repo: Optional[str] = None,
|
|
1746
|
+
page: Optional[int] = None,
|
|
1747
|
+
per_page: Optional[int] = None,
|
|
1563
1748
|
) -> List[APIObject]:
|
|
1564
1749
|
"""List repository events.
|
|
1565
1750
|
|
|
1566
1751
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
1567
1752
|
:param repo: Repository name. Uses the client default when omitted.
|
|
1568
|
-
:param
|
|
1753
|
+
:param page: Page number.
|
|
1754
|
+
:param per_page: Page size.
|
|
1569
1755
|
:returns: Repository event payloads.
|
|
1570
1756
|
"""
|
|
1571
|
-
data = await self._request(
|
|
1757
|
+
data = await self._request(
|
|
1758
|
+
"GET",
|
|
1759
|
+
self._client._repo_path("events", owner=owner, repo=repo),
|
|
1760
|
+
params={"page": page, "per_page": per_page},
|
|
1761
|
+
)
|
|
1572
1762
|
return [as_model(item, APIObject) for item in data]
|
|
1573
1763
|
|
|
1574
1764
|
|
|
@@ -1788,16 +1978,31 @@ class AsyncBranchesResource(AsyncResource):
|
|
|
1788
1978
|
Mirrors :class:`BranchesResource` (``docs/rest_api/repos/branch``).
|
|
1789
1979
|
"""
|
|
1790
1980
|
|
|
1791
|
-
async def list(
|
|
1981
|
+
async def list(
|
|
1982
|
+
self,
|
|
1983
|
+
*,
|
|
1984
|
+
owner: Optional[str] = None,
|
|
1985
|
+
repo: Optional[str] = None,
|
|
1986
|
+
sort: Optional[str] = None,
|
|
1987
|
+
direction: Optional[str] = None,
|
|
1988
|
+
page: Optional[int] = None,
|
|
1989
|
+
per_page: Optional[int] = None,
|
|
1990
|
+
) -> List[Branch]:
|
|
1792
1991
|
"""List branches in a repository.
|
|
1793
1992
|
|
|
1794
1993
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
1795
1994
|
:param repo: Repository name. Uses the client default when omitted.
|
|
1796
|
-
:param
|
|
1995
|
+
:param sort: Optional sort field such as ``name`` or ``updated``.
|
|
1996
|
+
:param direction: Sort direction, usually ``asc`` or ``desc``.
|
|
1997
|
+
:param page: Page number.
|
|
1998
|
+
:param per_page: Page size.
|
|
1797
1999
|
:returns: Repository branches.
|
|
1798
2000
|
"""
|
|
1799
2001
|
return await self._models(
|
|
1800
|
-
"GET",
|
|
2002
|
+
"GET",
|
|
2003
|
+
self._client._repo_path("branches", owner=owner, repo=repo),
|
|
2004
|
+
Branch,
|
|
2005
|
+
params={"sort": sort, "direction": direction, "page": page, "per_page": per_page},
|
|
1801
2006
|
)
|
|
1802
2007
|
|
|
1803
2008
|
async def get(self, *, branch: str, owner: Optional[str] = None, repo: Optional[str] = None) -> BranchDetail:
|
|
@@ -1846,16 +2051,31 @@ class AsyncCommitsResource(AsyncResource):
|
|
|
1846
2051
|
Mirrors :class:`CommitsResource` (``docs/rest_api/repos/commit``).
|
|
1847
2052
|
"""
|
|
1848
2053
|
|
|
1849
|
-
async def list(
|
|
2054
|
+
async def list(
|
|
2055
|
+
self,
|
|
2056
|
+
*,
|
|
2057
|
+
owner: Optional[str] = None,
|
|
2058
|
+
repo: Optional[str] = None,
|
|
2059
|
+
sha: Optional[str] = None,
|
|
2060
|
+
path: Optional[str] = None,
|
|
2061
|
+
page: Optional[int] = None,
|
|
2062
|
+
per_page: Optional[int] = None,
|
|
2063
|
+
) -> List[CommitSummary]:
|
|
1850
2064
|
"""List commits in a repository.
|
|
1851
2065
|
|
|
1852
2066
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
1853
2067
|
:param repo: Repository name. Uses the client default when omitted.
|
|
1854
|
-
:param
|
|
2068
|
+
:param sha: Optional starting SHA or ref.
|
|
2069
|
+
:param path: Optional file path filter.
|
|
2070
|
+
:param page: Page number.
|
|
2071
|
+
:param per_page: Page size.
|
|
1855
2072
|
:returns: Matching commits.
|
|
1856
2073
|
"""
|
|
1857
2074
|
return await self._models(
|
|
1858
|
-
"GET",
|
|
2075
|
+
"GET",
|
|
2076
|
+
self._client._repo_path("commits", owner=owner, repo=repo),
|
|
2077
|
+
CommitSummary,
|
|
2078
|
+
params={"sha": sha, "path": path, "page": page, "per_page": per_page},
|
|
1859
2079
|
)
|
|
1860
2080
|
|
|
1861
2081
|
async def get(self, *, sha: str, owner: Optional[str] = None, repo: Optional[str] = None) -> Commit:
|
|
@@ -1884,17 +2104,26 @@ class AsyncCommitsResource(AsyncResource):
|
|
|
1884
2104
|
)
|
|
1885
2105
|
|
|
1886
2106
|
async def list_comments(
|
|
1887
|
-
self,
|
|
2107
|
+
self,
|
|
2108
|
+
*,
|
|
2109
|
+
owner: Optional[str] = None,
|
|
2110
|
+
repo: Optional[str] = None,
|
|
2111
|
+
page: Optional[int] = None,
|
|
2112
|
+
per_page: Optional[int] = None,
|
|
1888
2113
|
) -> List[CommitComment]:
|
|
1889
2114
|
"""List commit comments for a repository.
|
|
1890
2115
|
|
|
1891
2116
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
1892
2117
|
:param repo: Repository name. Uses the client default when omitted.
|
|
1893
|
-
:param
|
|
2118
|
+
:param page: Page number.
|
|
2119
|
+
:param per_page: Page size.
|
|
1894
2120
|
:returns: Commit comments.
|
|
1895
2121
|
"""
|
|
1896
2122
|
return await self._models(
|
|
1897
|
-
"GET",
|
|
2123
|
+
"GET",
|
|
2124
|
+
self._client._repo_path("comments", owner=owner, repo=repo),
|
|
2125
|
+
CommitComment,
|
|
2126
|
+
params={"page": page, "per_page": per_page},
|
|
1898
2127
|
)
|
|
1899
2128
|
|
|
1900
2129
|
async def get_comment(
|
gitcode_api/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.20
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitcode-api
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.20
|
|
4
4
|
Summary: Easy to use Python SDK for the GitCode REST API. Providing builtin CLI tool, and optional LLM integration (MCP, OpenAI tool, and openJiuwen tool) for agents. Community-maintained.
|
|
5
5
|
Author-email: Hugo Huang <hugo@hugohuang.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -37,7 +37,7 @@ Dynamic: license-file
|
|
|
37
37
|
|
|
38
38
|
# GitCode-API
|
|
39
39
|
|
|
40
|
-
[](https://pypi.org/project/gitcode-api) [](https://pepy.tech/projects/gitcode-api) [](https://www.codefactor.io/repository/github/trenza1ore/gitcode-api)
|
|
41
41
|
[](https://cursor.com/en/install-mcp?name=GitCode%20API&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJnaXRjb2RlLWFwaVttY3BdIiwiZ2l0Y29kZS1hcGkiLCJzZXJ2ZSJdLCJlbnYiOnsiR0lUQ09ERV9BQ0NFU1NfVE9LRU4iOiIke2lucHV0OmdpdGNvZGVfYWNjZXNzX3Rva2VufSJ9LCJpbnB1dHMiOlt7ImlkIjoiZ2l0Y29kZV9hY2Nlc3NfdG9rZW4iLCJ0eXBlIjoicHJvbXB0U3RyaW5nIiwiZGVzY3JpcHRpb24iOiJFbnRlciBHSVRDT0RFX0FDQ0VTU19UT0tFTiIsInBhc3N3b3JkIjp0cnVlfV19) [](https://vscode.dev/redirect/mcp/install?name=GitCode%20API&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22--from%22%2C%22gitcode-api%5Bmcp%5D%22%2C%22gitcode-api%22%2C%22serve%22%5D%2C%22env%22%3A%7B%22GITCODE_ACCESS_TOKEN%22%3A%22%24%7Binput%3Agitcode_access_token%7D%22%7D%2C%22inputs%22%3A%5B%7B%22id%22%3A%22gitcode_access_token%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22Enter%20GITCODE_ACCESS_TOKEN%22%2C%22password%22%3Atrue%7D%5D%7D)
|
|
42
42
|
[](https://github.com/Trenza1ore/GitCode-API) [](https://gitcode.com/SushiNinja/GitCode-API)
|
|
43
43
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
gitcode_api/__init__.py,sha256=94gg5E1bAWozIR6PBYIPdZMfj-VyBFJp_rQQda2Qagk,1672
|
|
2
2
|
gitcode_api/__main__.py,sha256=Yd8P4MSNcWFqUTKnUaNibbWX4Vd-MVVNmhPFaohzqcA,137
|
|
3
|
-
gitcode_api/_base_client.py,sha256=
|
|
3
|
+
gitcode_api/_base_client.py,sha256=FiNCI68jZMF3MibCBD-yUZ14c17Di3V5kT4xISnxKqk,13967
|
|
4
4
|
gitcode_api/_base_resource.py,sha256=mlKe1b_1AKcqxhptaCpP-AOjKkLNzCbYG-Pkp1HYWrA,2238
|
|
5
5
|
gitcode_api/_cli_banner.py,sha256=S6i8dnzCXrxytrboxNh_gz-x95u6w9E-Yz6IkTz2PJk,1576
|
|
6
6
|
gitcode_api/_client.py,sha256=bmZxBHdfshM5Kv_EurHUVu8rsEj0k3Up3ATSIPaFrvc,8258
|
|
@@ -11,21 +11,21 @@ gitcode_api/constants.py,sha256=uzcI7dVq4Qx_toYtnIphUh1IGepv9NuOdJ4DCswiYgo,769
|
|
|
11
11
|
gitcode_api/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
gitcode_api/run_mcp.py,sha256=3_JOrjg9_yL-0M-H-F8mPgxdVKh7K2ggipu7UHeNCg0,147
|
|
13
13
|
gitcode_api/utils.py,sha256=51QmPTQPeNsPSGf2IzhwmiEO1H2GkJrp2A7vkzhOOag,1351
|
|
14
|
-
gitcode_api/version.txt,sha256=
|
|
14
|
+
gitcode_api/version.txt,sha256=W_OzohOH75vkjkKEkmQ_CHtziKl_5BIa7mxCW86poc4,7
|
|
15
15
|
gitcode_api/llm/__init__.py,sha256=rU75ZlJvTWNVxBLc3QzdfWmSjqVc9z6hfQ8z6jVVKOk,1693
|
|
16
16
|
gitcode_api/llm/_tool.py,sha256=b65iUiHo1H29uA6mFM3WlD0zZlISsENx1tpEqlkiUoA,16239
|
|
17
17
|
gitcode_api/llm/jiuwen.py,sha256=qca2y4544xoRYFOCMbkjiUZZLpJGMcBkK4w5bqs60-4,4276
|
|
18
18
|
gitcode_api/llm/mcp.py,sha256=eeAuEETZ4THw31wbcnQaTlZQJ-9ZolvsejQY630OqHs,5702
|
|
19
19
|
gitcode_api/llm/openai.py,sha256=FSPA0Jv-k4n1Ud92TDfP1TWRlW4FB7smaLwY331nagk,3257
|
|
20
20
|
gitcode_api/resources/__init__.py,sha256=nsCKW0bFDZ5ombJZxLThmO82sOuF7o4OKUMRkAmwbwk,1725
|
|
21
|
-
gitcode_api/resources/_shared.py,sha256=
|
|
22
|
-
gitcode_api/resources/account.py,sha256=
|
|
23
|
-
gitcode_api/resources/collaboration.py,sha256=
|
|
21
|
+
gitcode_api/resources/_shared.py,sha256=UWGtQwoUYRZ0rvqH4MHR9Up7roQAr9RRyO08RoQx01o,15820
|
|
22
|
+
gitcode_api/resources/account.py,sha256=OMuGxfxazYBz8Ii1PumKPJlgcmgmZu9ztJqvKC-FgfM,40359
|
|
23
|
+
gitcode_api/resources/collaboration.py,sha256=pdQkkm8xl5EQgGVj2WXSx1TFclDlYMCzi0nBtNDFXuI,116558
|
|
24
24
|
gitcode_api/resources/misc.py,sha256=w7bq8rmgKr2ScBKeWZ3EZJmAdylDdPtSPrhi3AQre7w,34747
|
|
25
|
-
gitcode_api/resources/repositories.py,sha256=
|
|
26
|
-
gitcode_api-1.2.
|
|
27
|
-
gitcode_api-1.2.
|
|
28
|
-
gitcode_api-1.2.
|
|
29
|
-
gitcode_api-1.2.
|
|
30
|
-
gitcode_api-1.2.
|
|
31
|
-
gitcode_api-1.2.
|
|
25
|
+
gitcode_api/resources/repositories.py,sha256=T-xy1gVzqudfpm2J8na1RrRTrMRYCbYI65e4w3f13n4,84402
|
|
26
|
+
gitcode_api-1.2.20.dist-info/licenses/LICENSE,sha256=gOACXuWhMu6PJKVLr9RQbxX3HULnZIGNXCaMFJIXhoA,1067
|
|
27
|
+
gitcode_api-1.2.20.dist-info/METADATA,sha256=Ws6gsVCzz_lwTWxxSO_tlokn-1W6nUqdqP-ma90C64I,23592
|
|
28
|
+
gitcode_api-1.2.20.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
29
|
+
gitcode_api-1.2.20.dist-info/entry_points.txt,sha256=dIPylJcgohIE2RRIlt3In2WzcwDK8TOdkL_ReKuij4o,53
|
|
30
|
+
gitcode_api-1.2.20.dist-info/top_level.txt,sha256=gIlg0ptyOUHJT64ajOjWIhRPYgIQnMIvnhhnesw9fxU,12
|
|
31
|
+
gitcode_api-1.2.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|