gitcode-api 1.0.3__tar.gz → 1.1.1__tar.gz
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-1.0.3 → gitcode_api-1.1.1}/PKG-INFO +33 -17
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/README.md +30 -13
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/gitcode_api/_client.py +6 -0
- gitcode_api-1.1.1/gitcode_api/_models.py +3076 -0
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/gitcode_api/resources/_shared.py +65 -12
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/gitcode_api/resources/account.py +302 -53
- gitcode_api-1.1.1/gitcode_api/resources/collaboration.py +2453 -0
- gitcode_api-1.1.1/gitcode_api/resources/misc.py +578 -0
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/gitcode_api/resources/repositories.py +606 -123
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/gitcode_api.egg-info/PKG-INFO +33 -17
- gitcode_api-1.1.1/gitcode_api.egg-info/requires.txt +1 -0
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/pyproject.toml +4 -5
- gitcode_api-1.1.1/tests/test_client.py +89 -0
- gitcode_api-1.1.1/tests/test_models.py +31 -0
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/tests/test_resources_account.py +5 -5
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/tests/test_resources_collaboration.py +38 -5
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/tests/test_resources_misc.py +3 -2
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/tests/test_resources_repositories.py +4 -4
- gitcode_api-1.0.3/gitcode_api/_models.py +0 -272
- gitcode_api-1.0.3/gitcode_api/resources/collaboration.py +0 -1489
- gitcode_api-1.0.3/gitcode_api/resources/misc.py +0 -345
- gitcode_api-1.0.3/gitcode_api.egg-info/requires.txt +0 -2
- gitcode_api-1.0.3/tests/test_client.py +0 -35
- gitcode_api-1.0.3/tests/test_models.py +0 -16
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/LICENSE +0 -0
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/gitcode_api/__init__.py +0 -0
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/gitcode_api/_base_client.py +0 -0
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/gitcode_api/_exceptions.py +0 -0
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/gitcode_api/resources/__init__.py +0 -0
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/gitcode_api.egg-info/SOURCES.txt +0 -0
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/gitcode_api.egg-info/dependency_links.txt +0 -0
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/gitcode_api.egg-info/top_level.txt +0 -0
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/setup.cfg +0 -0
- {gitcode_api-1.0.3 → gitcode_api-1.1.1}/tests/test_base_client.py +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitcode-api
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: Easy to use Python SDK for the GitCode REST API, community-maintained.
|
|
5
5
|
Author-email: Hugo Huang <hugo@hugohuang.com>
|
|
6
6
|
License-Expression: MIT
|
|
7
|
-
Project-URL:
|
|
7
|
+
Project-URL: documentation, https://gitcode-api.readthedocs.io
|
|
8
8
|
Project-URL: gitcode, https://gitcode.com/SushiNinja/GitCode-API
|
|
9
|
-
Project-URL:
|
|
9
|
+
Project-URL: github, https://github.com/Trenza1ore/GitCode-API
|
|
10
10
|
Keywords: gitcode,git,devops,api,sdk,python,httpx,client
|
|
11
11
|
Classifier: Development Status :: 4 - Beta
|
|
12
12
|
Classifier: Programming Language :: Python
|
|
@@ -23,12 +23,11 @@ Requires-Python: <4,>=3.9
|
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE
|
|
25
25
|
Requires-Dist: httpx
|
|
26
|
-
Requires-Dist: python-dotenv
|
|
27
26
|
Dynamic: license-file
|
|
28
27
|
|
|
29
28
|
# GitCode-API
|
|
30
29
|
|
|
31
|
-
   
|
|
30
|
+
   
|
|
32
31
|
|
|
33
32
|
  
|
|
34
33
|
|
|
@@ -50,18 +49,6 @@ Install from PyPI:
|
|
|
50
49
|
pip install gitcode-api
|
|
51
50
|
```
|
|
52
51
|
|
|
53
|
-
For local development from source:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
uv sync
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Install documentation dependencies:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
uv sync --group docs
|
|
63
|
-
```
|
|
64
|
-
|
|
65
52
|
## Authentication
|
|
66
53
|
|
|
67
54
|
Pass `api_key=` directly, or set `GITCODE_ACCESS_TOKEN` in your environment:
|
|
@@ -113,6 +100,35 @@ async def main() -> None:
|
|
|
113
100
|
asyncio.run(main())
|
|
114
101
|
```
|
|
115
102
|
|
|
103
|
+
### Context managers
|
|
104
|
+
|
|
105
|
+
`GitCode` and `AsyncGitCode` (and the lower-level `SyncAPIClient` / `AsyncAPIClient`) support `with` / `async with`. When the SDK creates the underlying httpx client for you, leaving the block calls `close()` / `await close()` on that client automatically.
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from gitcode_api import GitCode
|
|
109
|
+
|
|
110
|
+
with GitCode(owner="SushiNinja", repo="GitCode-API") as client:
|
|
111
|
+
repo = client.repos.get()
|
|
112
|
+
print(repo.full_name)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
import asyncio
|
|
117
|
+
|
|
118
|
+
from gitcode_api import AsyncGitCode
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
async def main() -> None:
|
|
122
|
+
async with AsyncGitCode(owner="SushiNinja", repo="GitCode-API") as client:
|
|
123
|
+
pulls = await client.pulls.list(state="open", per_page=20)
|
|
124
|
+
print(len(pulls))
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
asyncio.run(main())
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
If you pass a custom `http_client=`, the SDK does not close it; you still own that client’s lifecycle (for example `async with httpx.AsyncClient(...) as http:` plus `AsyncGitCode(http_client=http)`).
|
|
131
|
+
|
|
116
132
|
## Common Workflows
|
|
117
133
|
|
|
118
134
|
Create a pull request:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# GitCode-API
|
|
2
2
|
|
|
3
|
-
   
|
|
3
|
+
   
|
|
4
4
|
|
|
5
5
|
  
|
|
6
6
|
|
|
@@ -22,18 +22,6 @@ Install from PyPI:
|
|
|
22
22
|
pip install gitcode-api
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
For local development from source:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
uv sync
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Install documentation dependencies:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
uv sync --group docs
|
|
35
|
-
```
|
|
36
|
-
|
|
37
25
|
## Authentication
|
|
38
26
|
|
|
39
27
|
Pass `api_key=` directly, or set `GITCODE_ACCESS_TOKEN` in your environment:
|
|
@@ -85,6 +73,35 @@ async def main() -> None:
|
|
|
85
73
|
asyncio.run(main())
|
|
86
74
|
```
|
|
87
75
|
|
|
76
|
+
### Context managers
|
|
77
|
+
|
|
78
|
+
`GitCode` and `AsyncGitCode` (and the lower-level `SyncAPIClient` / `AsyncAPIClient`) support `with` / `async with`. When the SDK creates the underlying httpx client for you, leaving the block calls `close()` / `await close()` on that client automatically.
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from gitcode_api import GitCode
|
|
82
|
+
|
|
83
|
+
with GitCode(owner="SushiNinja", repo="GitCode-API") as client:
|
|
84
|
+
repo = client.repos.get()
|
|
85
|
+
print(repo.full_name)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
import asyncio
|
|
90
|
+
|
|
91
|
+
from gitcode_api import AsyncGitCode
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
async def main() -> None:
|
|
95
|
+
async with AsyncGitCode(owner="SushiNinja", repo="GitCode-API") as client:
|
|
96
|
+
pulls = await client.pulls.list(state="open", per_page=20)
|
|
97
|
+
print(len(pulls))
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
asyncio.run(main())
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
If you pass a custom `http_client=`, the SDK does not close it; you still own that client’s lifecycle (for example `async with httpx.AsyncClient(...) as http:` plus `AsyncGitCode(http_client=http)`).
|
|
104
|
+
|
|
88
105
|
## Common Workflows
|
|
89
106
|
|
|
90
107
|
Create a pull request:
|
|
@@ -140,6 +140,9 @@ class GitCode(SyncAPIClient):
|
|
|
140
140
|
self.search = SearchResource(self)
|
|
141
141
|
self.oauth = OAuthResource(self)
|
|
142
142
|
|
|
143
|
+
def __enter__(self) -> "GitCode":
|
|
144
|
+
return self
|
|
145
|
+
|
|
143
146
|
|
|
144
147
|
class AsyncGitCode(AsyncAPIClient):
|
|
145
148
|
"""Asynchronous GitCode API client.
|
|
@@ -235,3 +238,6 @@ class AsyncGitCode(AsyncAPIClient):
|
|
|
235
238
|
self.orgs = AsyncOrgsResource(self)
|
|
236
239
|
self.search = AsyncSearchResource(self)
|
|
237
240
|
self.oauth = AsyncOAuthResource(self)
|
|
241
|
+
|
|
242
|
+
async def __aenter__(self) -> "AsyncGitCode":
|
|
243
|
+
return self
|