gitcode-api 1.3.0__py3-none-any.whl → 1.3.2__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/llm/mcp.py +1 -1
- gitcode_api/resources/account/users_resource_group.py +65 -9
- gitcode_api/resources/collaboration/issues_resource_group.py +343 -25
- gitcode_api/resources/collaboration/milestones_resource_group.py +64 -6
- gitcode_api/resources/collaboration/pulls_resource_group.py +271 -29
- gitcode_api/resources/repositories/repos_resource_group.py +30 -6
- gitcode_api/version.txt +1 -1
- {gitcode_api-1.3.0.dist-info → gitcode_api-1.3.2.dist-info}/METADATA +15 -18
- {gitcode_api-1.3.0.dist-info → gitcode_api-1.3.2.dist-info}/RECORD +13 -13
- {gitcode_api-1.3.0.dist-info → gitcode_api-1.3.2.dist-info}/WHEEL +0 -0
- {gitcode_api-1.3.0.dist-info → gitcode_api-1.3.2.dist-info}/entry_points.txt +0 -0
- {gitcode_api-1.3.0.dist-info → gitcode_api-1.3.2.dist-info}/licenses/LICENSE +0 -0
- {gitcode_api-1.3.0.dist-info → gitcode_api-1.3.2.dist-info}/top_level.txt +0 -0
|
@@ -48,12 +48,26 @@ class AbstractPullsResource(ABC):
|
|
|
48
48
|
direction: Optional[str] = None,
|
|
49
49
|
page: Optional[int] = None,
|
|
50
50
|
per_page: Optional[int] = None,
|
|
51
|
-
|
|
51
|
+
base: Optional[str] = None,
|
|
52
|
+
since: Optional[str] = None,
|
|
53
|
+
milestone_number: Optional[int] = None,
|
|
54
|
+
labels: Optional[str] = None,
|
|
55
|
+
author: Optional[str] = None,
|
|
56
|
+
assignee: Optional[str] = None,
|
|
57
|
+
reviewer: Optional[str] = None,
|
|
58
|
+
merged_after: Optional[str] = None,
|
|
59
|
+
merged_before: Optional[str] = None,
|
|
60
|
+
only_count: Optional[bool] = None,
|
|
61
|
+
created_after: Optional[str] = None,
|
|
62
|
+
created_before: Optional[str] = None,
|
|
63
|
+
updated_before: Optional[str] = None,
|
|
64
|
+
updated_after: Optional[str] = None,
|
|
65
|
+
**kwargs,
|
|
52
66
|
) -> Union[List[PullRequest], PullRequestCount]:
|
|
53
67
|
"""List pull requests for a repository.
|
|
54
68
|
|
|
55
|
-
When ``only_count`` is true
|
|
56
|
-
|
|
69
|
+
When ``only_count`` is true, the API returns a JSON object with counts per state
|
|
70
|
+
instead of an array (see Pull Request API).
|
|
57
71
|
|
|
58
72
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
59
73
|
:param repo: Repository path (name). Uses the client default when omitted.
|
|
@@ -62,10 +76,21 @@ class AbstractPullsResource(ABC):
|
|
|
62
76
|
:param direction: ``asc`` or ``desc`` (API default is usually ``desc``).
|
|
63
77
|
:param page: Current page number.
|
|
64
78
|
:param per_page: Page size (max 100 per API documentation).
|
|
65
|
-
:param
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
:param base: Base branch filter.
|
|
80
|
+
:param since: Return PRs updated since this ISO 8601 timestamp.
|
|
81
|
+
:param milestone_number: Milestone number filter.
|
|
82
|
+
:param labels: Comma-separated label names.
|
|
83
|
+
:param author: Username of the PR creator.
|
|
84
|
+
:param assignee: Username of the PR assignee.
|
|
85
|
+
:param reviewer: Username of the PR reviewer.
|
|
86
|
+
:param merged_after: Return PRs merged after this ISO 8601 timestamp.
|
|
87
|
+
:param merged_before: Return PRs merged before this ISO 8601 timestamp.
|
|
88
|
+
:param only_count: If true, only return the count of merge requests.
|
|
89
|
+
:param created_after: Return PRs created after this ISO 8601 timestamp.
|
|
90
|
+
:param created_before: Return PRs created before this ISO 8601 timestamp.
|
|
91
|
+
:param updated_before: Return PRs updated before this ISO 8601 timestamp.
|
|
92
|
+
:param updated_after: Return PRs updated after this ISO 8601 timestamp.
|
|
93
|
+
:param kwargs: Additional arguments forwarded directly in request.
|
|
69
94
|
:returns: A list of pull requests, or an :class:`~gitcode_api._models.APIObject` for count-only responses.
|
|
70
95
|
"""
|
|
71
96
|
|
|
@@ -366,14 +391,25 @@ class AbstractPullsResource(ABC):
|
|
|
366
391
|
|
|
367
392
|
@abstractmethod
|
|
368
393
|
def list_operation_logs(
|
|
369
|
-
self,
|
|
394
|
+
self,
|
|
395
|
+
*,
|
|
396
|
+
number: Union[int, str],
|
|
397
|
+
owner: Optional[str] = None,
|
|
398
|
+
repo: Optional[str] = None,
|
|
399
|
+
sort: Optional[str] = None,
|
|
400
|
+
page: Optional[int] = None,
|
|
401
|
+
per_page: Optional[int] = None,
|
|
402
|
+
**kwargs,
|
|
370
403
|
) -> List[PullRequestOperationLog]:
|
|
371
404
|
"""List operation logs for a pull request.
|
|
372
405
|
|
|
373
406
|
:param number: Pull request number.
|
|
374
407
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
375
408
|
:param repo: Repository path. Uses the client default when omitted.
|
|
376
|
-
:param
|
|
409
|
+
:param sort: Sort direction: ``desc`` (default) or ``asc``.
|
|
410
|
+
:param page: Page number.
|
|
411
|
+
:param per_page: Page size.
|
|
412
|
+
:param kwargs: Additional arguments forwarded directly in request.
|
|
377
413
|
:returns: Log entries as generic API objects.
|
|
378
414
|
"""
|
|
379
415
|
|
|
@@ -467,20 +503,56 @@ class AbstractPullsResource(ABC):
|
|
|
467
503
|
"""
|
|
468
504
|
|
|
469
505
|
@abstractmethod
|
|
470
|
-
def list_enterprise(
|
|
506
|
+
def list_enterprise(
|
|
507
|
+
self,
|
|
508
|
+
*,
|
|
509
|
+
enterprise: str,
|
|
510
|
+
repo: Optional[str] = None,
|
|
511
|
+
state: Optional[str] = None,
|
|
512
|
+
issue_number: Optional[int] = None,
|
|
513
|
+
sort: Optional[str] = None,
|
|
514
|
+
direction: Optional[str] = None,
|
|
515
|
+
page: Optional[int] = None,
|
|
516
|
+
per_page: Optional[int] = None,
|
|
517
|
+
**kwargs,
|
|
518
|
+
) -> List[PullRequest]:
|
|
471
519
|
"""List enterprise pull requests.
|
|
472
520
|
|
|
473
521
|
:param enterprise: Enterprise path or login.
|
|
474
|
-
:param
|
|
522
|
+
:param repo: Repository path filter (query parameter).
|
|
523
|
+
:param state: Pull request state filter.
|
|
524
|
+
:param issue_number: Issue global id filter.
|
|
525
|
+
:param sort: Sort field. Default: sorted by creation time.
|
|
526
|
+
:param direction: ``asc`` or ``desc``.
|
|
527
|
+
:param page: Page number.
|
|
528
|
+
:param per_page: Page size.
|
|
529
|
+
:param kwargs: Additional arguments forwarded directly in request.
|
|
475
530
|
:returns: Pull requests in the enterprise scope.
|
|
476
531
|
"""
|
|
477
532
|
|
|
478
533
|
@abstractmethod
|
|
479
|
-
def list_org(
|
|
534
|
+
def list_org(
|
|
535
|
+
self,
|
|
536
|
+
*,
|
|
537
|
+
org: str,
|
|
538
|
+
state: Optional[str] = None,
|
|
539
|
+
issue_number: Optional[int] = None,
|
|
540
|
+
sort: Optional[str] = None,
|
|
541
|
+
direction: Optional[str] = None,
|
|
542
|
+
page: Optional[int] = None,
|
|
543
|
+
per_page: Optional[int] = None,
|
|
544
|
+
**kwargs,
|
|
545
|
+
) -> List[PullRequest]:
|
|
480
546
|
"""List pull requests for an organization scope.
|
|
481
547
|
|
|
482
548
|
:param org: Organization path (``GET .../org/{org}/pull_requests``).
|
|
483
|
-
:param
|
|
549
|
+
:param state: Pull request state filter.
|
|
550
|
+
:param issue_number: Global issue id filter.
|
|
551
|
+
:param sort: Sort field. Default: sorted by creation time.
|
|
552
|
+
:param direction: ``asc`` or ``desc``.
|
|
553
|
+
:param page: Page number.
|
|
554
|
+
:param per_page: Page size.
|
|
555
|
+
:param kwargs: Additional arguments forwarded directly in request.
|
|
484
556
|
:returns: Organization-scoped pull requests.
|
|
485
557
|
"""
|
|
486
558
|
|
|
@@ -553,7 +625,21 @@ class PullsResource(SyncResource, AbstractPullsResource):
|
|
|
553
625
|
direction: Optional[str] = None,
|
|
554
626
|
page: Optional[int] = None,
|
|
555
627
|
per_page: Optional[int] = None,
|
|
556
|
-
|
|
628
|
+
base: Optional[str] = None,
|
|
629
|
+
since: Optional[str] = None,
|
|
630
|
+
milestone_number: Optional[int] = None,
|
|
631
|
+
labels: Optional[str] = None,
|
|
632
|
+
author: Optional[str] = None,
|
|
633
|
+
assignee: Optional[str] = None,
|
|
634
|
+
reviewer: Optional[str] = None,
|
|
635
|
+
merged_after: Optional[str] = None,
|
|
636
|
+
merged_before: Optional[str] = None,
|
|
637
|
+
only_count: Optional[bool] = None,
|
|
638
|
+
created_after: Optional[str] = None,
|
|
639
|
+
created_before: Optional[str] = None,
|
|
640
|
+
updated_before: Optional[str] = None,
|
|
641
|
+
updated_after: Optional[str] = None,
|
|
642
|
+
**kwargs,
|
|
557
643
|
) -> Union[List[PullRequest], PullRequestCount]:
|
|
558
644
|
path = self._client._repo_path("pulls", owner=owner, repo=repo)
|
|
559
645
|
response = self._request(
|
|
@@ -565,7 +651,21 @@ class PullsResource(SyncResource, AbstractPullsResource):
|
|
|
565
651
|
"direction": direction,
|
|
566
652
|
"page": page,
|
|
567
653
|
"per_page": per_page,
|
|
568
|
-
|
|
654
|
+
"base": base,
|
|
655
|
+
"since": since,
|
|
656
|
+
"milestone_number": milestone_number,
|
|
657
|
+
"labels": labels,
|
|
658
|
+
"author": author,
|
|
659
|
+
"assignee": assignee,
|
|
660
|
+
"reviewer": reviewer,
|
|
661
|
+
"merged_after": merged_after,
|
|
662
|
+
"merged_before": merged_before,
|
|
663
|
+
"only_count": only_count,
|
|
664
|
+
"created_after": created_after,
|
|
665
|
+
"created_before": created_before,
|
|
666
|
+
"updated_before": updated_before,
|
|
667
|
+
"updated_after": updated_after,
|
|
668
|
+
**kwargs,
|
|
569
669
|
},
|
|
570
670
|
)
|
|
571
671
|
if isinstance(response, dict):
|
|
@@ -801,12 +901,20 @@ class PullsResource(SyncResource, AbstractPullsResource):
|
|
|
801
901
|
)
|
|
802
902
|
|
|
803
903
|
def list_operation_logs(
|
|
804
|
-
self,
|
|
904
|
+
self,
|
|
905
|
+
*,
|
|
906
|
+
number: Union[int, str],
|
|
907
|
+
owner: Optional[str] = None,
|
|
908
|
+
repo: Optional[str] = None,
|
|
909
|
+
sort: Optional[str] = None,
|
|
910
|
+
page: Optional[int] = None,
|
|
911
|
+
per_page: Optional[int] = None,
|
|
912
|
+
**kwargs,
|
|
805
913
|
) -> List[PullRequestOperationLog]:
|
|
806
914
|
data = self._request(
|
|
807
915
|
"GET",
|
|
808
916
|
self._client._repo_path("pulls", number, "operate_logs", owner=owner, repo=repo),
|
|
809
|
-
params=
|
|
917
|
+
params={"sort": sort, "page": page, "per_page": per_page, **kwargs},
|
|
810
918
|
)
|
|
811
919
|
return [as_model(item, PullRequestOperationLog) for item in data]
|
|
812
920
|
|
|
@@ -871,13 +979,61 @@ class PullsResource(SyncResource, AbstractPullsResource):
|
|
|
871
979
|
) -> List[Issue]:
|
|
872
980
|
return self._models("GET", self._client._repo_path("pulls", number, "issues", owner=owner, repo=repo), Issue)
|
|
873
981
|
|
|
874
|
-
def list_enterprise(
|
|
982
|
+
def list_enterprise(
|
|
983
|
+
self,
|
|
984
|
+
*,
|
|
985
|
+
enterprise: str,
|
|
986
|
+
repo: Optional[str] = None,
|
|
987
|
+
state: Optional[str] = None,
|
|
988
|
+
issue_number: Optional[int] = None,
|
|
989
|
+
sort: Optional[str] = None,
|
|
990
|
+
direction: Optional[str] = None,
|
|
991
|
+
page: Optional[int] = None,
|
|
992
|
+
per_page: Optional[int] = None,
|
|
993
|
+
**kwargs,
|
|
994
|
+
) -> List[PullRequest]:
|
|
875
995
|
return self._models(
|
|
876
|
-
"GET",
|
|
996
|
+
"GET",
|
|
997
|
+
self._client._path("enterprises", enterprise, "pull_requests"),
|
|
998
|
+
PullRequest,
|
|
999
|
+
params={
|
|
1000
|
+
"repo": repo,
|
|
1001
|
+
"state": state,
|
|
1002
|
+
"issue_number": issue_number,
|
|
1003
|
+
"sort": sort,
|
|
1004
|
+
"direction": direction,
|
|
1005
|
+
"page": page,
|
|
1006
|
+
"per_page": per_page,
|
|
1007
|
+
**kwargs,
|
|
1008
|
+
},
|
|
877
1009
|
)
|
|
878
1010
|
|
|
879
|
-
def list_org(
|
|
880
|
-
|
|
1011
|
+
def list_org(
|
|
1012
|
+
self,
|
|
1013
|
+
*,
|
|
1014
|
+
org: str,
|
|
1015
|
+
state: Optional[str] = None,
|
|
1016
|
+
issue_number: Optional[int] = None,
|
|
1017
|
+
sort: Optional[str] = None,
|
|
1018
|
+
direction: Optional[str] = None,
|
|
1019
|
+
page: Optional[int] = None,
|
|
1020
|
+
per_page: Optional[int] = None,
|
|
1021
|
+
**kwargs,
|
|
1022
|
+
) -> List[PullRequest]:
|
|
1023
|
+
return self._models(
|
|
1024
|
+
"GET",
|
|
1025
|
+
self._client._path("org", org, "pull_requests"),
|
|
1026
|
+
PullRequest,
|
|
1027
|
+
params={
|
|
1028
|
+
"state": state,
|
|
1029
|
+
"issue_number": issue_number,
|
|
1030
|
+
"sort": sort,
|
|
1031
|
+
"direction": direction,
|
|
1032
|
+
"page": page,
|
|
1033
|
+
"per_page": per_page,
|
|
1034
|
+
**kwargs,
|
|
1035
|
+
},
|
|
1036
|
+
)
|
|
881
1037
|
|
|
882
1038
|
def list_issue_pull_requests(self, *, enterprise: str, number: Union[int, str]) -> List[PullRequest]:
|
|
883
1039
|
return self._models(
|
|
@@ -947,7 +1103,21 @@ class AsyncPullsResource(AsyncResource, AbstractPullsResource):
|
|
|
947
1103
|
direction: Optional[str] = None,
|
|
948
1104
|
page: Optional[int] = None,
|
|
949
1105
|
per_page: Optional[int] = None,
|
|
950
|
-
|
|
1106
|
+
base: Optional[str] = None,
|
|
1107
|
+
since: Optional[str] = None,
|
|
1108
|
+
milestone_number: Optional[int] = None,
|
|
1109
|
+
labels: Optional[str] = None,
|
|
1110
|
+
author: Optional[str] = None,
|
|
1111
|
+
assignee: Optional[str] = None,
|
|
1112
|
+
reviewer: Optional[str] = None,
|
|
1113
|
+
merged_after: Optional[str] = None,
|
|
1114
|
+
merged_before: Optional[str] = None,
|
|
1115
|
+
only_count: Optional[bool] = None,
|
|
1116
|
+
created_after: Optional[str] = None,
|
|
1117
|
+
created_before: Optional[str] = None,
|
|
1118
|
+
updated_before: Optional[str] = None,
|
|
1119
|
+
updated_after: Optional[str] = None,
|
|
1120
|
+
**kwargs,
|
|
951
1121
|
) -> Union[List[PullRequest], PullRequestCount]:
|
|
952
1122
|
response = await self._request(
|
|
953
1123
|
"GET",
|
|
@@ -958,7 +1128,21 @@ class AsyncPullsResource(AsyncResource, AbstractPullsResource):
|
|
|
958
1128
|
"direction": direction,
|
|
959
1129
|
"page": page,
|
|
960
1130
|
"per_page": per_page,
|
|
961
|
-
|
|
1131
|
+
"base": base,
|
|
1132
|
+
"since": since,
|
|
1133
|
+
"milestone_number": milestone_number,
|
|
1134
|
+
"labels": labels,
|
|
1135
|
+
"author": author,
|
|
1136
|
+
"assignee": assignee,
|
|
1137
|
+
"reviewer": reviewer,
|
|
1138
|
+
"merged_after": merged_after,
|
|
1139
|
+
"merged_before": merged_before,
|
|
1140
|
+
"only_count": only_count,
|
|
1141
|
+
"created_after": created_after,
|
|
1142
|
+
"created_before": created_before,
|
|
1143
|
+
"updated_before": updated_before,
|
|
1144
|
+
"updated_after": updated_after,
|
|
1145
|
+
**kwargs,
|
|
962
1146
|
},
|
|
963
1147
|
)
|
|
964
1148
|
if isinstance(response, dict):
|
|
@@ -1173,10 +1357,20 @@ class AsyncPullsResource(AsyncResource, AbstractPullsResource):
|
|
|
1173
1357
|
)
|
|
1174
1358
|
|
|
1175
1359
|
async def list_operation_logs(
|
|
1176
|
-
self,
|
|
1360
|
+
self,
|
|
1361
|
+
*,
|
|
1362
|
+
number: Union[int, str],
|
|
1363
|
+
owner: Optional[str] = None,
|
|
1364
|
+
repo: Optional[str] = None,
|
|
1365
|
+
sort: Optional[str] = None,
|
|
1366
|
+
page: Optional[int] = None,
|
|
1367
|
+
per_page: Optional[int] = None,
|
|
1368
|
+
**kwargs,
|
|
1177
1369
|
) -> List[PullRequestOperationLog]:
|
|
1178
1370
|
data = await self._request(
|
|
1179
|
-
"GET",
|
|
1371
|
+
"GET",
|
|
1372
|
+
self._client._repo_path("pulls", number, "operate_logs", owner=owner, repo=repo),
|
|
1373
|
+
params={"sort": sort, "page": page, "per_page": per_page, **kwargs},
|
|
1180
1374
|
)
|
|
1181
1375
|
return [as_model(item, PullRequestOperationLog) for item in data]
|
|
1182
1376
|
|
|
@@ -1243,13 +1437,61 @@ class AsyncPullsResource(AsyncResource, AbstractPullsResource):
|
|
|
1243
1437
|
"GET", self._client._repo_path("pulls", number, "issues", owner=owner, repo=repo), Issue
|
|
1244
1438
|
)
|
|
1245
1439
|
|
|
1246
|
-
async def list_enterprise(
|
|
1440
|
+
async def list_enterprise(
|
|
1441
|
+
self,
|
|
1442
|
+
*,
|
|
1443
|
+
enterprise: str,
|
|
1444
|
+
repo: Optional[str] = None,
|
|
1445
|
+
state: Optional[str] = None,
|
|
1446
|
+
issue_number: Optional[int] = None,
|
|
1447
|
+
sort: Optional[str] = None,
|
|
1448
|
+
direction: Optional[str] = None,
|
|
1449
|
+
page: Optional[int] = None,
|
|
1450
|
+
per_page: Optional[int] = None,
|
|
1451
|
+
**kwargs,
|
|
1452
|
+
) -> List[PullRequest]:
|
|
1247
1453
|
return await self._models(
|
|
1248
|
-
"GET",
|
|
1454
|
+
"GET",
|
|
1455
|
+
self._client._path("enterprises", enterprise, "pull_requests"),
|
|
1456
|
+
PullRequest,
|
|
1457
|
+
params={
|
|
1458
|
+
"repo": repo,
|
|
1459
|
+
"state": state,
|
|
1460
|
+
"issue_number": issue_number,
|
|
1461
|
+
"sort": sort,
|
|
1462
|
+
"direction": direction,
|
|
1463
|
+
"page": page,
|
|
1464
|
+
"per_page": per_page,
|
|
1465
|
+
**kwargs,
|
|
1466
|
+
},
|
|
1249
1467
|
)
|
|
1250
1468
|
|
|
1251
|
-
async def list_org(
|
|
1252
|
-
|
|
1469
|
+
async def list_org(
|
|
1470
|
+
self,
|
|
1471
|
+
*,
|
|
1472
|
+
org: str,
|
|
1473
|
+
state: Optional[str] = None,
|
|
1474
|
+
issue_number: Optional[int] = None,
|
|
1475
|
+
sort: Optional[str] = None,
|
|
1476
|
+
direction: Optional[str] = None,
|
|
1477
|
+
page: Optional[int] = None,
|
|
1478
|
+
per_page: Optional[int] = None,
|
|
1479
|
+
**kwargs,
|
|
1480
|
+
) -> List[PullRequest]:
|
|
1481
|
+
return await self._models(
|
|
1482
|
+
"GET",
|
|
1483
|
+
self._client._path("org", org, "pull_requests"),
|
|
1484
|
+
PullRequest,
|
|
1485
|
+
params={
|
|
1486
|
+
"state": state,
|
|
1487
|
+
"issue_number": issue_number,
|
|
1488
|
+
"sort": sort,
|
|
1489
|
+
"direction": direction,
|
|
1490
|
+
"page": page,
|
|
1491
|
+
"per_page": per_page,
|
|
1492
|
+
**kwargs,
|
|
1493
|
+
},
|
|
1494
|
+
)
|
|
1253
1495
|
|
|
1254
1496
|
async def list_issue_pull_requests(self, *, enterprise: str, number: Union[int, str]) -> List[PullRequest]:
|
|
1255
1497
|
return await self._models(
|
|
@@ -474,13 +474,23 @@ class AbstractReposResource(ABC):
|
|
|
474
474
|
|
|
475
475
|
@abstractmethod
|
|
476
476
|
def get_download_statistics(
|
|
477
|
-
self,
|
|
477
|
+
self,
|
|
478
|
+
*,
|
|
479
|
+
owner: Optional[str] = None,
|
|
480
|
+
repo: Optional[str] = None,
|
|
481
|
+
start_date: Optional[str] = None,
|
|
482
|
+
end_date: Optional[str] = None,
|
|
483
|
+
direction: Optional[str] = None,
|
|
484
|
+
**kwargs,
|
|
478
485
|
) -> RepositoryDownloadStatistics:
|
|
479
486
|
"""Get download statistics for a repository.
|
|
480
487
|
|
|
481
488
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
482
489
|
:param repo: Repository name. Uses the client default when omitted.
|
|
483
|
-
:param
|
|
490
|
+
:param start_date: Start date filter (e.g. ``2024-01-06``).
|
|
491
|
+
:param end_date: End date filter (e.g. ``2024-12-06``).
|
|
492
|
+
:param direction: Sort direction: ``asc`` or ``desc``. Default: ``desc``.
|
|
493
|
+
:param kwargs: Additional arguments forwarded directly in request.
|
|
484
494
|
:returns: Download statistics payload.
|
|
485
495
|
"""
|
|
486
496
|
|
|
@@ -856,13 +866,20 @@ class ReposResource(SyncResource, AbstractReposResource):
|
|
|
856
866
|
return [as_model(item, RepositoryCustomizedRole) for item in data]
|
|
857
867
|
|
|
858
868
|
def get_download_statistics(
|
|
859
|
-
self,
|
|
869
|
+
self,
|
|
870
|
+
*,
|
|
871
|
+
owner: Optional[str] = None,
|
|
872
|
+
repo: Optional[str] = None,
|
|
873
|
+
start_date: Optional[str] = None,
|
|
874
|
+
end_date: Optional[str] = None,
|
|
875
|
+
direction: Optional[str] = None,
|
|
876
|
+
**kwargs,
|
|
860
877
|
) -> RepositoryDownloadStatistics:
|
|
861
878
|
return self._model(
|
|
862
879
|
"GET",
|
|
863
880
|
self._client._repo_path("download_statistics", owner=owner, repo=repo),
|
|
864
881
|
RepositoryDownloadStatistics,
|
|
865
|
-
params=
|
|
882
|
+
params={"start_date": start_date, "end_date": end_date, "direction": direction, **kwargs},
|
|
866
883
|
)
|
|
867
884
|
|
|
868
885
|
def get_contributor_statistics(
|
|
@@ -1245,13 +1262,20 @@ class AsyncReposResource(AsyncResource, AbstractReposResource):
|
|
|
1245
1262
|
return [as_model(item, RepositoryCustomizedRole) for item in data]
|
|
1246
1263
|
|
|
1247
1264
|
async def get_download_statistics(
|
|
1248
|
-
self,
|
|
1265
|
+
self,
|
|
1266
|
+
*,
|
|
1267
|
+
owner: Optional[str] = None,
|
|
1268
|
+
repo: Optional[str] = None,
|
|
1269
|
+
start_date: Optional[str] = None,
|
|
1270
|
+
end_date: Optional[str] = None,
|
|
1271
|
+
direction: Optional[str] = None,
|
|
1272
|
+
**kwargs,
|
|
1249
1273
|
) -> RepositoryDownloadStatistics:
|
|
1250
1274
|
return await self._model(
|
|
1251
1275
|
"GET",
|
|
1252
1276
|
self._client._repo_path("download_statistics", owner=owner, repo=repo),
|
|
1253
1277
|
RepositoryDownloadStatistics,
|
|
1254
|
-
params=
|
|
1278
|
+
params={"start_date": start_date, "end_date": end_date, "direction": direction, **kwargs},
|
|
1255
1279
|
)
|
|
1256
1280
|
|
|
1257
1281
|
async def get_contributor_statistics(
|
gitcode_api/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.3.
|
|
1
|
+
1.3.2
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitcode-api
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.2
|
|
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
|
-
Author-email: Hugo Huang <hugo@hugohuang.com>
|
|
5
|
+
Author-email: "Hugo (Jin Huang)" <hugo@hugohuang.com>
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Changelog, https://gitcode-api.readthedocs.io/en/latest/changelog.html
|
|
8
8
|
Project-URL: Issues, https://github.com/Trenza1ore/GitCode-API/issues
|
|
@@ -12,7 +12,7 @@ Project-URL: Github, https://github.com/Trenza1ore/GitCode-API
|
|
|
12
12
|
Project-URL: Homepage, https://hugohuang.com/gitcode-api
|
|
13
13
|
Project-URL: Author, https://hugohuang.com
|
|
14
14
|
Keywords: gitcode,git,devops,api,sdk,python,httpx,client,mcp,agent,fastmcp,llm,openjiuwen,mcp client,mcp server,model context protocol
|
|
15
|
-
Classifier: Development Status ::
|
|
15
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
16
16
|
Classifier: Programming Language :: Python
|
|
17
17
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
18
18
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -35,15 +35,12 @@ Provides-Extra: mcp
|
|
|
35
35
|
Requires-Dist: fastmcp; python_version >= "3.10" and extra == "mcp"
|
|
36
36
|
Dynamic: license-file
|
|
37
37
|
|
|
38
|
-
# GitCode-API
|
|
39
|
-
|
|
40
|
-
[](https://pypi.org/project/gitcode-api) [](https://pepy.tech/projects/gitcode-api)
|
|
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
|
-
[](https://github.com/Trenza1ore/GitCode-API) [](https://gitcode.com/SushiNinja/GitCode-API) [](https://github.com/Trenza1ore/GitCode-API/actions/workflows/check-code.yml/)
|
|
38
|
+
# GitCode-API [](https://gitcode.com/SushiNinja/GitCode-API) [](https://github.com/Trenza1ore/GitCode-API)
|
|
39
|
+
[](https://pypi.org/project/gitcode-api) [](https://pypistats.org/packages/gitcode-api) [](https://github.com/Trenza1ore/GitCode-API/releases)
|
|
43
40
|
|
|
44
41
|
[](https://gitcode-api.readthedocs.io) [](README.zh.md)
|
|
45
42
|
|
|
46
|
-
`gitcode-api` is a community-maintained Python SDK for the GitCode REST API. It provides easy-to-use synchronous and asynchronous clients,
|
|
43
|
+
`gitcode-api` is a community-maintained Python SDK for the GitCode REST API. It provides easy-to-use synchronous and asynchronous clients, helpers methods grouped by resource groups, and type-hinted response models so you can work with GitCode from Python without hand-writing raw HTTP requests. The `gitcode_api.llm` module adds an OpenAI-style function tool, an MCP service, and an [openJiuwen](https://openjiuwen.com) tool integration so agents can reuse the same resource-oriented API.
|
|
47
44
|
|
|
48
45
|
## Why This Project
|
|
49
46
|
|
|
@@ -51,7 +48,7 @@ Dynamic: license-file
|
|
|
51
48
|
- Sync and async clients with a consistent API surface.
|
|
52
49
|
- Convenient methods not offered by REST API directly: such as fetching Issue and PR templates.
|
|
53
50
|
- Resource groups such as `client.repos`, `client.pulls`, and `client.users`.
|
|
54
|
-
- Repository defaults via `owner
|
|
51
|
+
- Repository defaults via `owner` and `repo` on the client.
|
|
55
52
|
- Sphinx docs plus a mirrored GitCode REST API reference in `docs/`.
|
|
56
53
|
- Provides MCP server, OpenAI tool, and [openJiuwen](https://openjiuwen.com) tool for LLM agent usage.
|
|
57
54
|
- Provide MCP service that directly installs to your IDE of choice, such as Cursor and VS Code!
|
|
@@ -77,14 +74,14 @@ For detailed setup (including installing to services like Claude Code / Codex):
|
|
|
77
74
|
|
|
78
75
|
## Authentication
|
|
79
76
|
|
|
80
|
-
Pass `api_key
|
|
77
|
+
Pass `api_key` directly, or set `GITCODE_ACCESS_TOKEN` in your environment:
|
|
81
78
|
|
|
82
79
|
```bash
|
|
83
80
|
export GITCODE_ACCESS_TOKEN="your-token"
|
|
84
81
|
```
|
|
85
82
|
|
|
86
|
-
If your token is stored in encrypted form, pass `decrypt
|
|
87
|
-
encrypted `api_key
|
|
83
|
+
If your token is stored in encrypted form, pass `decrypt` to decode either an
|
|
84
|
+
encrypted `api_key` value or an encrypted `GITCODE_ACCESS_TOKEN` value before
|
|
88
85
|
the client uses it.
|
|
89
86
|
|
|
90
87
|
```python
|
|
@@ -171,7 +168,7 @@ meta = as_dict(repo) # dict
|
|
|
171
168
|
|
|
172
169
|
### Context managers
|
|
173
170
|
|
|
174
|
-
`GitCode` and `AsyncGitCode` (and the lower-level `SyncAPIClient` / `AsyncAPIClient`) support `with` / `async with`. Leaving the block calls `close()` / `await close()` on the underlying client automatically, including a custom `http_client
|
|
171
|
+
`GitCode` and `AsyncGitCode` (and the lower-level `SyncAPIClient` / `AsyncAPIClient`) support `with` / `async with`. Leaving the block calls `close()` / `await close()` on the underlying client automatically, including a custom `http_client` you passed in. `close()` also clears the LRU cache used by each resource group's `method_signature(...)` helper (see the [Available Resources](#available-resources) section).
|
|
175
172
|
|
|
176
173
|
```python
|
|
177
174
|
from gitcode_api import GitCode
|
|
@@ -328,7 +325,7 @@ while True:
|
|
|
328
325
|
pip install 'gitcode-api[mcp]'
|
|
329
326
|
```
|
|
330
327
|
|
|
331
|
-
- **`create_mcp_server`** — builds a `FastMCP` instance with `gitcode_api_tool` already registered; optional `name
|
|
328
|
+
- **`create_mcp_server`** — builds a `FastMCP` instance with `gitcode_api_tool` already registered; optional `name`, `tool`, and extra keyword arguments are forwarded to `FastMCP(...)`.
|
|
332
329
|
- **`GitCodeMCP`** — thin wrapper that constructs that server and registers the tool; unknown attributes are delegated to the underlying `FastMCP` object (for example transport helpers exposed by your FastMCP version).
|
|
333
330
|
- **`create_mcp_gitcode_api_tool`** — returns the standalone async callable used as the tool body (for custom wiring).
|
|
334
331
|
- **`register_mcp_gitcode_api_tool`** — attaches that callable to an existing FastMCP-compatible object (`mcp.tool(...)` or `mcp.add_tool(...)`).
|
|
@@ -342,7 +339,7 @@ mcp = create_mcp_server(name="GitCode API", owner="SushiNinja", repo="GitCode-AP
|
|
|
342
339
|
|
|
343
340
|
The same server is available from the CLI as `gitcode-api serve` (see the [CLI](#cli) section).
|
|
344
341
|
|
|
345
|
-
To share auth or clients across tools, build `GitCodeLLMTool` once (`from gitcode_api.llm._tool import GitCodeLLMTool`) and pass it as `tool
|
|
342
|
+
To share auth or clients across tools, build `GitCodeLLMTool` once (`from gitcode_api.llm._tool import GitCodeLLMTool`) and pass it as `tool` into `GitCodeMCP`, `create_mcp_server`, `register_mcp_gitcode_api_tool`, or `create_mcp_gitcode_api_tool`.
|
|
346
343
|
|
|
347
344
|
### openJiuwen (`LocalFunction`)
|
|
348
345
|
|
|
@@ -360,7 +357,7 @@ jiuwen_tool = create_openjiuwen_gitcode_api_tool(owner="SushiNinja", repo="GitCo
|
|
|
360
357
|
# await jiuwen_tool.invoke({"op_type": "repos", "action": "get", "params": {}})
|
|
361
358
|
```
|
|
362
359
|
|
|
363
|
-
Optional `name
|
|
360
|
+
Optional `name` and `description` override the default tool card. Constructor options otherwise mirror `GitCode` / `AsyncGitCode` (`client`, `async_client`, `api_key`, `owner`, `repo`, `base_url`, `timeout`, `decrypt`).
|
|
364
361
|
|
|
365
362
|
**Claude Desktop (MCPB):** published GitHub Releases include a `gitcode-<version>.mcpb` bundle for one-click installation as a Claude Desktop extension; see Anthropic’s guide, [Build a desktop extension with MCPB](https://claude.com/docs/connectors/building/mcpb). From a checkout you can run `make mcpb` (requires the [`@anthropic-ai/mcpb`](https://www.npmjs.com/package/@anthropic-ai/mcpb) CLI on your `PATH`).
|
|
366
363
|
|
|
@@ -431,7 +428,7 @@ with GitCode(
|
|
|
431
428
|
|
|
432
429
|
Use `httpx.AsyncClient(verify=...)` with `AsyncGitCode` for async code.
|
|
433
430
|
|
|
434
|
-
The OpenAI tool (`GitCodeOpenAITool`), MCP helpers, and `create_openjiuwen_gitcode_api_tool` accept the same `client
|
|
431
|
+
The OpenAI tool (`GitCodeOpenAITool`), MCP helpers, and `create_openjiuwen_gitcode_api_tool` accept the same `client` / `async_client` arguments (OpenAI and MCP also accept a shared `GitCodeLLMTool` via `tool`). Build `GitCode` / `AsyncGitCode` with your custom `http_client` once and pass it through so LLM tool calls reuse the same TLS settings.
|
|
435
432
|
|
|
436
433
|
## Project Status
|
|
437
434
|
|
|
@@ -13,11 +13,11 @@ gitcode_api/models.py,sha256=Yfkn3zj2iEecOockytFS8lCNaYICYdjHdhpsxyaPkDk,4425
|
|
|
13
13
|
gitcode_api/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
gitcode_api/run_mcp.py,sha256=3_JOrjg9_yL-0M-H-F8mPgxdVKh7K2ggipu7UHeNCg0,147
|
|
15
15
|
gitcode_api/utils.py,sha256=51QmPTQPeNsPSGf2IzhwmiEO1H2GkJrp2A7vkzhOOag,1351
|
|
16
|
-
gitcode_api/version.txt,sha256=
|
|
16
|
+
gitcode_api/version.txt,sha256=MxWJcqU4d7Qhz-JZi42TyrFpljpJZLRe6InoU0mXkBg,6
|
|
17
17
|
gitcode_api/llm/__init__.py,sha256=rU75ZlJvTWNVxBLc3QzdfWmSjqVc9z6hfQ8z6jVVKOk,1693
|
|
18
18
|
gitcode_api/llm/_tool.py,sha256=b65iUiHo1H29uA6mFM3WlD0zZlISsENx1tpEqlkiUoA,16239
|
|
19
19
|
gitcode_api/llm/jiuwen.py,sha256=qca2y4544xoRYFOCMbkjiUZZLpJGMcBkK4w5bqs60-4,4276
|
|
20
|
-
gitcode_api/llm/mcp.py,sha256=
|
|
20
|
+
gitcode_api/llm/mcp.py,sha256=Af-B1hgd1hOHx_IxafM8FygBtnd4BAGuw681fGjmBps,5821
|
|
21
21
|
gitcode_api/llm/openai.py,sha256=FSPA0Jv-k4n1Ud92TDfP1TWRlW4FB7smaLwY331nagk,3257
|
|
22
22
|
gitcode_api/resources/__init__.py,sha256=G5Pmi7J_I3APe8k0lJq9jaAP7Hz1JdFm5O1KwEkSIuw,1743
|
|
23
23
|
gitcode_api/resources/_shared/__init__.py,sha256=JcwcLigNx5OxN0wGNEUlEy6baJdEdWfEVv5QVN0-Mo8,496
|
|
@@ -27,14 +27,14 @@ gitcode_api/resources/account/__init__.py,sha256=lZueYwioHR4dRyHoABGM05cT0YkO52T
|
|
|
27
27
|
gitcode_api/resources/account/oauth_resource_group.py,sha256=kmHHjtRhqtkOqB228nPp-ci5Wy1GAfSr0olWKObA36s,5690
|
|
28
28
|
gitcode_api/resources/account/orgs_resource_group.py,sha256=AnwuP23N9MkmS7QHeNGCG7s6GRTCVL6Cm7VgHGFxP_4,16539
|
|
29
29
|
gitcode_api/resources/account/search_resource_group.py,sha256=0xqJUOEFdCnyEA_EhwhJoNMXo8wpXU-DYfG7Dl0zyIk,6998
|
|
30
|
-
gitcode_api/resources/account/users_resource_group.py,sha256=
|
|
30
|
+
gitcode_api/resources/account/users_resource_group.py,sha256=uFUcYS_fPP73If8rIklSyI_swyDtaeCYBfeFzIidv3w,10373
|
|
31
31
|
gitcode_api/resources/collaboration/__init__.py,sha256=jcH-u9KIgLEThoqKShh7MkBdqKioZ93gNY58hJeTWW0,727
|
|
32
32
|
gitcode_api/resources/collaboration/_helpers.py,sha256=t2OYoMo0_jra4hQIrYRpY88ZZNrZJRe6EiCwOM9t0uU,305
|
|
33
|
-
gitcode_api/resources/collaboration/issues_resource_group.py,sha256=
|
|
33
|
+
gitcode_api/resources/collaboration/issues_resource_group.py,sha256=QXu6wwuozaX4j7l33J-R9ATfOkNB-8k7lIqCmD7w5eg,41677
|
|
34
34
|
gitcode_api/resources/collaboration/labels_resource_group.py,sha256=TML77N2t_IWO3uoPyQNl-wNVPF7L75syHkdFQa89vSk,9549
|
|
35
35
|
gitcode_api/resources/collaboration/members_resource_group.py,sha256=qd_6fV5bllGMJ-9SDvNDLj_XiGloXsiv27qufboUX5g,6770
|
|
36
|
-
gitcode_api/resources/collaboration/milestones_resource_group.py,sha256=
|
|
37
|
-
gitcode_api/resources/collaboration/pulls_resource_group.py,sha256=
|
|
36
|
+
gitcode_api/resources/collaboration/milestones_resource_group.py,sha256=Nz--QZAHwgIjwVTDrlFTYtPSBtF2f85-cpzUAC1M1ic,8525
|
|
37
|
+
gitcode_api/resources/collaboration/pulls_resource_group.py,sha256=op1NHAfIIcY5NHucn2o3hg0V53DkjVmrGWKrj4ags6U,57561
|
|
38
38
|
gitcode_api/resources/misc/__init__.py,sha256=UWmADs0zoWrn4L2ZlaWTkt3CMQfRE_IADzruNGaJmm4,451
|
|
39
39
|
gitcode_api/resources/misc/releases_resource_group.py,sha256=FuedWSqbAsbSc0ppIVwJl_mB2TWFizYCCyJSE9PtSQI,15244
|
|
40
40
|
gitcode_api/resources/misc/tags_resource_group.py,sha256=jzs9ezJbBanI2LOSBWK7U0zMql0Xxz1hgOaNzC_Ncro,9662
|
|
@@ -43,10 +43,10 @@ gitcode_api/resources/repositories/__init__.py,sha256=HuatiYSlbk_yACIvzgVQyMuHQO
|
|
|
43
43
|
gitcode_api/resources/repositories/branches_resource_group.py,sha256=dGhd6241IzhLuHCmtjYWsTxDhhS9tgLT6zvyz6lYPiY,5673
|
|
44
44
|
gitcode_api/resources/repositories/commits_resource_group.py,sha256=vqgy_-d7Ec-5w6FKWJ0v6QGbh9mtjnmqm7iZ9P5gBLw,11254
|
|
45
45
|
gitcode_api/resources/repositories/repo_contents_resource_group.py,sha256=pPsEMTU_3kbSNlCRtkHM7dUdzAo3lLxdYleMs1vmLBU,14832
|
|
46
|
-
gitcode_api/resources/repositories/repos_resource_group.py,sha256=
|
|
47
|
-
gitcode_api-1.3.
|
|
48
|
-
gitcode_api-1.3.
|
|
49
|
-
gitcode_api-1.3.
|
|
50
|
-
gitcode_api-1.3.
|
|
51
|
-
gitcode_api-1.3.
|
|
52
|
-
gitcode_api-1.3.
|
|
46
|
+
gitcode_api/resources/repositories/repos_resource_group.py,sha256=nUOgMRTzSaA8ZM8tLumMtxWB2a-a0hjYgfLh2UUiSDw,47380
|
|
47
|
+
gitcode_api-1.3.2.dist-info/licenses/LICENSE,sha256=gOACXuWhMu6PJKVLr9RQbxX3HULnZIGNXCaMFJIXhoA,1067
|
|
48
|
+
gitcode_api-1.3.2.dist-info/METADATA,sha256=1y9U5O2-83k9gdOGv-g4cV9PdOqHu6s9LlfSdyA9WWE,22512
|
|
49
|
+
gitcode_api-1.3.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
50
|
+
gitcode_api-1.3.2.dist-info/entry_points.txt,sha256=dIPylJcgohIE2RRIlt3In2WzcwDK8TOdkL_ReKuij4o,53
|
|
51
|
+
gitcode_api-1.3.2.dist-info/top_level.txt,sha256=gIlg0ptyOUHJT64ajOjWIhRPYgIQnMIvnhhnesw9fxU,12
|
|
52
|
+
gitcode_api-1.3.2.dist-info/RECORD,,
|
|
File without changes
|