gitcode-api 1.3.2__tar.gz → 1.3.3__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.3.2 → gitcode_api-1.3.3}/PKG-INFO +11 -11
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/README.md +10 -10
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/cli.py +2 -2
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/account/orgs_resource_group.py +178 -18
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/collaboration/issues_resource_group.py +3 -2
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/collaboration/pulls_resource_group.py +25 -7
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/misc/releases_resource_group.py +8 -5
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/misc/webhooks_resource_group.py +144 -17
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/repositories/repos_resource_group.py +422 -67
- gitcode_api-1.3.3/gitcode_api/version.txt +1 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api.egg-info/PKG-INFO +11 -11
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/pyproject.toml +1 -1
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/tests/test_resources_misc.py +2 -2
- gitcode_api-1.3.2/gitcode_api/version.txt +0 -1
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/LICENSE +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/__init__.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/__main__.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/_base_client.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/_base_resource.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/_cli_banner.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/_client.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/_exceptions.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/_models.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/constants.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/exceptions.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/llm/__init__.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/llm/_tool.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/llm/jiuwen.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/llm/mcp.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/llm/openai.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/models.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/py.typed +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/__init__.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/_shared/__init__.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/_shared/base.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/_shared/fetch_template.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/account/__init__.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/account/oauth_resource_group.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/account/search_resource_group.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/account/users_resource_group.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/collaboration/__init__.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/collaboration/_helpers.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/collaboration/labels_resource_group.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/collaboration/members_resource_group.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/collaboration/milestones_resource_group.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/misc/__init__.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/misc/tags_resource_group.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/repositories/__init__.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/repositories/branches_resource_group.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/repositories/commits_resource_group.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/repositories/repo_contents_resource_group.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/run_mcp.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/utils.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api.egg-info/SOURCES.txt +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api.egg-info/dependency_links.txt +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api.egg-info/entry_points.txt +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api.egg-info/requires.txt +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api.egg-info/top_level.txt +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/setup.cfg +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/tests/test_base_client.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/tests/test_build_manifest.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/tests/test_cli.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/tests/test_client.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/tests/test_collaboration_templates.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/tests/test_llm_tools.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/tests/test_models.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/tests/test_resources_account.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/tests/test_resources_collaboration.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/tests/test_resources_repositories.py +0 -0
- {gitcode_api-1.3.2 → gitcode_api-1.3.3}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitcode-api
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.3
|
|
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 (Jin Huang)" <hugo@hugohuang.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -35,10 +35,11 @@ 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 [](https://gitcode.com/SushiNinja/GitCode-API) [](https://github.com/Trenza1ore/GitCode-API)
|
|
39
|
-
[](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) [
|
|
40
|
+
](https://pepy.tech/projects/gitcode-api)
|
|
40
41
|
|
|
41
|
-
[](https://gitcode-api.readthedocs.io) [](README.zh.md)
|
|
42
|
+
[](https://gitcode-api.readthedocs.io) [](README.zh.md)
|
|
42
43
|
|
|
43
44
|
`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.
|
|
44
45
|
|
|
@@ -64,11 +65,11 @@ pip install -U gitcode-api
|
|
|
64
65
|
|
|
65
66
|
Install the MCP server to your AI-powered IDE of choice:
|
|
66
67
|
|
|
67
|
-
[](https://cursor.com/en/install-mcp?name=GitCode%20API&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJnaXRjb2RlLWFwaVttY3BdIiwiZ2l0Y29kZS1hcGkiLCJzZXJ2ZSJdLCJlbnYiOnsiR0lUQ09ERV9BQ0NFU1NfVE9LRU4iOiIke2lucHV0OmdpdGNvZGVfYWNjZXNzX3Rva2VufSJ9LCJpbnB1dHMiOlt7ImlkIjoiZ2l0Y29kZV9hY2Nlc3NfdG9rZW4iLCJ0eXBlIjoicHJvbXB0U3RyaW5nIiwiZGVzY3JpcHRpb24iOiJFbnRlciBHSVRDT0RFX0FDQ0VTU19UT0tFTiIsInBhc3N3b3JkIjp0cnVlfV19)
|
|
68
|
-
[](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)
|
|
69
|
-
[](https://insiders.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&quality=insiders)
|
|
70
|
-
[](https://vs-open.link/mcp-install?%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)
|
|
71
|
-
[](https://lmstudio.ai/install-mcp?name=GitCode%20API&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJnaXRjb2RlLWFwaVttY3BdIiwiZ2l0Y29kZS1hcGkiLCJzZXJ2ZSJdLCJlbnYiOnsiR0lUQ09ERV9BQ0NFU1NfVE9LRU4iOiIke2lucHV0OmdpdGNvZGVfYWNjZXNzX3Rva2VufSJ9LCJpbnB1dHMiOlt7ImlkIjoiZ2l0Y29kZV9hY2Nlc3NfdG9rZW4iLCJ0eXBlIjoicHJvbXB0U3RyaW5nIiwiZGVzY3JpcHRpb24iOiJFbnRlciBHSVRDT0RFX0FDQ0VTU19UT0tFTiIsInBhc3N3b3JkIjp0cnVlfV19)
|
|
68
|
+
[](https://cursor.com/en/install-mcp?name=GitCode%20API&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJnaXRjb2RlLWFwaVttY3BdIiwiZ2l0Y29kZS1hcGkiLCJzZXJ2ZSJdLCJlbnYiOnsiR0lUQ09ERV9BQ0NFU1NfVE9LRU4iOiIke2lucHV0OmdpdGNvZGVfYWNjZXNzX3Rva2VufSJ9LCJpbnB1dHMiOlt7ImlkIjoiZ2l0Y29kZV9hY2Nlc3NfdG9rZW4iLCJ0eXBlIjoicHJvbXB0U3RyaW5nIiwiZGVzY3JpcHRpb24iOiJFbnRlciBHSVRDT0RFX0FDQ0VTU19UT0tFTiIsInBhc3N3b3JkIjp0cnVlfV19)
|
|
69
|
+
[](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)
|
|
70
|
+
[](https://insiders.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&quality=insiders)
|
|
71
|
+
[](https://vs-open.link/mcp-install?%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)
|
|
72
|
+
[](https://lmstudio.ai/install-mcp?name=GitCode%20API&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJnaXRjb2RlLWFwaVttY3BdIiwiZ2l0Y29kZS1hcGkiLCJzZXJ2ZSJdLCJlbnYiOnsiR0lUQ09ERV9BQ0NFU1NfVE9LRU4iOiIke2lucHV0OmdpdGNvZGVfYWNjZXNzX3Rva2VufSJ9LCJpbnB1dHMiOlt7ImlkIjoiZ2l0Y29kZV9hY2Nlc3NfdG9rZW4iLCJ0eXBlIjoicHJvbXB0U3RyaW5nIiwiZGVzY3JpcHRpb24iOiJFbnRlciBHSVRDT0RFX0FDQ0VTU19UT0tFTiIsInBhc3N3b3JkIjp0cnVlfV19)
|
|
72
73
|
|
|
73
74
|
For detailed setup (including installing to services like Claude Code / Codex): see [install_mcp_server.md](install_mcp_server.md).
|
|
74
75
|
|
|
@@ -112,8 +113,7 @@ gitcode-api serve --api-key "$GITCODE_ACCESS_TOKEN"
|
|
|
112
113
|
Use `gitcode-api serve -h` for defaults such as `--owner`, `--repo`, `--transport` (`stdio`, `http`, or `sse`), and other options.
|
|
113
114
|
|
|
114
115
|
Commands mirror the synchronous resource methods on `GitCode`, using the pattern
|
|
115
|
-
`gitcode-api <resource> <method> ...`. For methods that accept extra
|
|
116
|
-
or `**payload`, pass repeated `--set key=value` flags or `--set-json '{"key": "value"}'`.
|
|
116
|
+
`gitcode-api <resource> <method> ...`. For methods that accept extra arguments, pass repeated `--set key=value` flags or `--set-json '{"key": "value"}'`.
|
|
117
117
|
|
|
118
118
|
When using string arguments with escape sequence (such as line break `\n`), pass `-e` / `--escape` with the sequences to un-escape, such as `-e '\n\t'`.
|
|
119
119
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
# GitCode-API [](https://gitcode.com/SushiNinja/GitCode-API) [](https://github.com/Trenza1ore/GitCode-API)
|
|
2
|
-
[](https://gitcode.com/SushiNinja/GitCode-API) [](https://github.com/Trenza1ore/GitCode-API)
|
|
2
|
+
[](https://pypi.org/project/gitcode-api) [](https://pypistats.org/packages/gitcode-api) [
|
|
3
|
+
](https://pepy.tech/projects/gitcode-api)
|
|
3
4
|
|
|
4
|
-
[](https://gitcode-api.readthedocs.io) [](README.zh.md)
|
|
5
|
+
[](https://gitcode-api.readthedocs.io) [](README.zh.md)
|
|
5
6
|
|
|
6
7
|
`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.
|
|
7
8
|
|
|
@@ -27,11 +28,11 @@ pip install -U gitcode-api
|
|
|
27
28
|
|
|
28
29
|
Install the MCP server to your AI-powered IDE of choice:
|
|
29
30
|
|
|
30
|
-
[](https://cursor.com/en/install-mcp?name=GitCode%20API&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJnaXRjb2RlLWFwaVttY3BdIiwiZ2l0Y29kZS1hcGkiLCJzZXJ2ZSJdLCJlbnYiOnsiR0lUQ09ERV9BQ0NFU1NfVE9LRU4iOiIke2lucHV0OmdpdGNvZGVfYWNjZXNzX3Rva2VufSJ9LCJpbnB1dHMiOlt7ImlkIjoiZ2l0Y29kZV9hY2Nlc3NfdG9rZW4iLCJ0eXBlIjoicHJvbXB0U3RyaW5nIiwiZGVzY3JpcHRpb24iOiJFbnRlciBHSVRDT0RFX0FDQ0VTU19UT0tFTiIsInBhc3N3b3JkIjp0cnVlfV19)
|
|
31
|
-
[](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)
|
|
32
|
-
[](https://insiders.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&quality=insiders)
|
|
33
|
-
[](https://vs-open.link/mcp-install?%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)
|
|
34
|
-
[](https://lmstudio.ai/install-mcp?name=GitCode%20API&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJnaXRjb2RlLWFwaVttY3BdIiwiZ2l0Y29kZS1hcGkiLCJzZXJ2ZSJdLCJlbnYiOnsiR0lUQ09ERV9BQ0NFU1NfVE9LRU4iOiIke2lucHV0OmdpdGNvZGVfYWNjZXNzX3Rva2VufSJ9LCJpbnB1dHMiOlt7ImlkIjoiZ2l0Y29kZV9hY2Nlc3NfdG9rZW4iLCJ0eXBlIjoicHJvbXB0U3RyaW5nIiwiZGVzY3JpcHRpb24iOiJFbnRlciBHSVRDT0RFX0FDQ0VTU19UT0tFTiIsInBhc3N3b3JkIjp0cnVlfV19)
|
|
31
|
+
[](https://cursor.com/en/install-mcp?name=GitCode%20API&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJnaXRjb2RlLWFwaVttY3BdIiwiZ2l0Y29kZS1hcGkiLCJzZXJ2ZSJdLCJlbnYiOnsiR0lUQ09ERV9BQ0NFU1NfVE9LRU4iOiIke2lucHV0OmdpdGNvZGVfYWNjZXNzX3Rva2VufSJ9LCJpbnB1dHMiOlt7ImlkIjoiZ2l0Y29kZV9hY2Nlc3NfdG9rZW4iLCJ0eXBlIjoicHJvbXB0U3RyaW5nIiwiZGVzY3JpcHRpb24iOiJFbnRlciBHSVRDT0RFX0FDQ0VTU19UT0tFTiIsInBhc3N3b3JkIjp0cnVlfV19)
|
|
32
|
+
[](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)
|
|
33
|
+
[](https://insiders.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&quality=insiders)
|
|
34
|
+
[](https://vs-open.link/mcp-install?%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)
|
|
35
|
+
[](https://lmstudio.ai/install-mcp?name=GitCode%20API&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJnaXRjb2RlLWFwaVttY3BdIiwiZ2l0Y29kZS1hcGkiLCJzZXJ2ZSJdLCJlbnYiOnsiR0lUQ09ERV9BQ0NFU1NfVE9LRU4iOiIke2lucHV0OmdpdGNvZGVfYWNjZXNzX3Rva2VufSJ9LCJpbnB1dHMiOlt7ImlkIjoiZ2l0Y29kZV9hY2Nlc3NfdG9rZW4iLCJ0eXBlIjoicHJvbXB0U3RyaW5nIiwiZGVzY3JpcHRpb24iOiJFbnRlciBHSVRDT0RFX0FDQ0VTU19UT0tFTiIsInBhc3N3b3JkIjp0cnVlfV19)
|
|
35
36
|
|
|
36
37
|
For detailed setup (including installing to services like Claude Code / Codex): see [install_mcp_server.md](install_mcp_server.md).
|
|
37
38
|
|
|
@@ -75,8 +76,7 @@ gitcode-api serve --api-key "$GITCODE_ACCESS_TOKEN"
|
|
|
75
76
|
Use `gitcode-api serve -h` for defaults such as `--owner`, `--repo`, `--transport` (`stdio`, `http`, or `sse`), and other options.
|
|
76
77
|
|
|
77
78
|
Commands mirror the synchronous resource methods on `GitCode`, using the pattern
|
|
78
|
-
`gitcode-api <resource> <method> ...`. For methods that accept extra
|
|
79
|
-
or `**payload`, pass repeated `--set key=value` flags or `--set-json '{"key": "value"}'`.
|
|
79
|
+
`gitcode-api <resource> <method> ...`. For methods that accept extra arguments, pass repeated `--set key=value` flags or `--set-json '{"key": "value"}'`.
|
|
80
80
|
|
|
81
81
|
When using string arguments with escape sequence (such as line break `\n`), pass `-e` / `--escape` with the sequences to un-escape, such as `-e '\n\t'`.
|
|
82
82
|
|
|
@@ -281,7 +281,7 @@ Examples:
|
|
|
281
281
|
%(prog)s users me --api-key "$GITCODE_ACCESS_TOKEN"
|
|
282
282
|
%(prog)s pulls list --set only_count=true --set reviewer=demo
|
|
283
283
|
|
|
284
|
-
Extra keyword arguments (
|
|
284
|
+
Extra keyword arguments (when needed):
|
|
285
285
|
Repeat --set key=value (value is JSON if it parses as JSON; otherwise a string).
|
|
286
286
|
--set-json merges one JSON object (or @path/to/file.json) into those kwargs.
|
|
287
287
|
|
|
@@ -375,7 +375,7 @@ Each method -h opens with resource.method_signature("<name>") from the Python SD
|
|
|
375
375
|
action="append",
|
|
376
376
|
default=None,
|
|
377
377
|
metavar="KEY=VALUE",
|
|
378
|
-
help="Extra keyword
|
|
378
|
+
help="Extra keyword arguments.",
|
|
379
379
|
)
|
|
380
380
|
method_parser.add_argument(
|
|
381
381
|
"--set-json",
|
{gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/account/orgs_resource_group.py
RENAMED
|
@@ -77,16 +77,43 @@ class AbstractOrgsResource(ABC):
|
|
|
77
77
|
"""
|
|
78
78
|
|
|
79
79
|
@abstractmethod
|
|
80
|
-
def create_repo(
|
|
80
|
+
def create_repo(
|
|
81
|
+
self,
|
|
82
|
+
*,
|
|
83
|
+
org: str,
|
|
84
|
+
name: str,
|
|
85
|
+
description: Optional[str] = None,
|
|
86
|
+
homepage: Optional[str] = None,
|
|
87
|
+
has_issues: Optional[bool] = None,
|
|
88
|
+
has_wiki: Optional[bool] = None,
|
|
89
|
+
can_comment: Optional[bool] = None,
|
|
90
|
+
public: Optional[int] = None,
|
|
91
|
+
private: Optional[bool] = None,
|
|
92
|
+
auto_init: Optional[bool] = None,
|
|
93
|
+
gitignore_template: Optional[str] = None,
|
|
94
|
+
license_template: Optional[str] = None,
|
|
95
|
+
path: Optional[str] = None,
|
|
96
|
+
default_branch: Optional[str] = None,
|
|
97
|
+
**kwargs,
|
|
98
|
+
) -> Repository:
|
|
81
99
|
"""Create an organization repository.
|
|
82
100
|
|
|
83
|
-
Additional payload fields match the organization repository creation
|
|
84
|
-
endpoint, such as ``description``, ``homepage``, ``private``,
|
|
85
|
-
``public``, ``auto_init``, and ``default_branch``.
|
|
86
|
-
|
|
87
101
|
:param org: Organization path or login.
|
|
88
102
|
:param name: Repository name.
|
|
89
|
-
:param
|
|
103
|
+
:param description: Repository description.
|
|
104
|
+
:param homepage: Homepage URL.
|
|
105
|
+
:param has_issues: Allow issues to be created. Default: ``True``.
|
|
106
|
+
:param has_wiki: Provide wiki. Default: ``True``.
|
|
107
|
+
:param can_comment: Allow users to comment on repositories. Default: ``True``.
|
|
108
|
+
:param public: Open source type: ``0`` (private), ``1`` (external), ``2`` (internal).
|
|
109
|
+
Mutually exclusive with *private*.
|
|
110
|
+
:param private: Repository visibility. Mutually exclusive with *public*.
|
|
111
|
+
:param auto_init: Initialize with a README. Default: ``False``.
|
|
112
|
+
:param gitignore_template: ``.gitignore`` template name.
|
|
113
|
+
:param license_template: License template name.
|
|
114
|
+
:param path: Repository path.
|
|
115
|
+
:param default_branch: Default branch name. Default: ``main``.
|
|
116
|
+
:param kwargs: Additional arguments forwarded directly in request.
|
|
90
117
|
:returns: Created repository metadata.
|
|
91
118
|
"""
|
|
92
119
|
|
|
@@ -184,11 +211,26 @@ class AbstractOrgsResource(ABC):
|
|
|
184
211
|
"""
|
|
185
212
|
|
|
186
213
|
@abstractmethod
|
|
187
|
-
def update(
|
|
214
|
+
def update(
|
|
215
|
+
self,
|
|
216
|
+
*,
|
|
217
|
+
org: str,
|
|
218
|
+
name: Optional[str] = None,
|
|
219
|
+
email: Optional[str] = None,
|
|
220
|
+
location: Optional[str] = None,
|
|
221
|
+
description: Optional[str] = None,
|
|
222
|
+
html_url: Optional[str] = None,
|
|
223
|
+
**kwargs,
|
|
224
|
+
) -> Organization:
|
|
188
225
|
"""Update organization metadata.
|
|
189
226
|
|
|
190
227
|
:param org: Organization path or login.
|
|
191
|
-
:param
|
|
228
|
+
:param name: Organization name.
|
|
229
|
+
:param email: Organization email.
|
|
230
|
+
:param location: Organization location.
|
|
231
|
+
:param description: Organization description.
|
|
232
|
+
:param html_url: Organization site URL.
|
|
233
|
+
:param kwargs: Additional arguments forwarded directly in request.
|
|
192
234
|
:returns: Updated organization details.
|
|
193
235
|
"""
|
|
194
236
|
|
|
@@ -239,9 +281,46 @@ class OrgsResource(SyncResource, AbstractOrgsResource):
|
|
|
239
281
|
params={"type": type, "page": page, "per_page": per_page},
|
|
240
282
|
)
|
|
241
283
|
|
|
242
|
-
def create_repo(
|
|
243
|
-
|
|
244
|
-
|
|
284
|
+
def create_repo(
|
|
285
|
+
self,
|
|
286
|
+
*,
|
|
287
|
+
org: str,
|
|
288
|
+
name: str,
|
|
289
|
+
description: Optional[str] = None,
|
|
290
|
+
homepage: Optional[str] = None,
|
|
291
|
+
has_issues: Optional[bool] = None,
|
|
292
|
+
has_wiki: Optional[bool] = None,
|
|
293
|
+
can_comment: Optional[bool] = None,
|
|
294
|
+
public: Optional[int] = None,
|
|
295
|
+
private: Optional[bool] = None,
|
|
296
|
+
auto_init: Optional[bool] = None,
|
|
297
|
+
gitignore_template: Optional[str] = None,
|
|
298
|
+
license_template: Optional[str] = None,
|
|
299
|
+
path: Optional[str] = None,
|
|
300
|
+
default_branch: Optional[str] = None,
|
|
301
|
+
**kwargs,
|
|
302
|
+
) -> Repository:
|
|
303
|
+
return self._model(
|
|
304
|
+
"POST",
|
|
305
|
+
self._client._path("orgs", org, "repos"),
|
|
306
|
+
Repository,
|
|
307
|
+
json={
|
|
308
|
+
"name": name,
|
|
309
|
+
"description": description,
|
|
310
|
+
"homepage": homepage,
|
|
311
|
+
"has_issues": has_issues,
|
|
312
|
+
"has_wiki": has_wiki,
|
|
313
|
+
"can_comment": can_comment,
|
|
314
|
+
"public": public,
|
|
315
|
+
"private": private,
|
|
316
|
+
"auto_init": auto_init,
|
|
317
|
+
"gitignore_template": gitignore_template,
|
|
318
|
+
"license_template": license_template,
|
|
319
|
+
"path": path,
|
|
320
|
+
"default_branch": default_branch,
|
|
321
|
+
**kwargs,
|
|
322
|
+
},
|
|
323
|
+
)
|
|
245
324
|
|
|
246
325
|
def get_enterprise_member(self, *, enterprise: str, username: str) -> EnterpriseMember:
|
|
247
326
|
return self._model("GET", self._client._path("enterprises", enterprise, "members", username), EnterpriseMember)
|
|
@@ -302,8 +381,30 @@ class OrgsResource(SyncResource, AbstractOrgsResource):
|
|
|
302
381
|
json={"role": role},
|
|
303
382
|
)
|
|
304
383
|
|
|
305
|
-
def update(
|
|
306
|
-
|
|
384
|
+
def update(
|
|
385
|
+
self,
|
|
386
|
+
*,
|
|
387
|
+
org: str,
|
|
388
|
+
name: Optional[str] = None,
|
|
389
|
+
email: Optional[str] = None,
|
|
390
|
+
location: Optional[str] = None,
|
|
391
|
+
description: Optional[str] = None,
|
|
392
|
+
html_url: Optional[str] = None,
|
|
393
|
+
**kwargs,
|
|
394
|
+
) -> Organization:
|
|
395
|
+
return self._model(
|
|
396
|
+
"PATCH",
|
|
397
|
+
self._client._path("orgs", org),
|
|
398
|
+
Organization,
|
|
399
|
+
json={
|
|
400
|
+
"name": name,
|
|
401
|
+
"email": email,
|
|
402
|
+
"location": location,
|
|
403
|
+
"description": description,
|
|
404
|
+
"html_url": html_url,
|
|
405
|
+
**kwargs,
|
|
406
|
+
},
|
|
407
|
+
)
|
|
307
408
|
|
|
308
409
|
def leave(self, *, org: str) -> None:
|
|
309
410
|
self._request("DELETE", self._client._path("user", "memberships", "orgs", org))
|
|
@@ -351,9 +452,46 @@ class AsyncOrgsResource(AsyncResource, AbstractOrgsResource):
|
|
|
351
452
|
params={"type": type, "page": page, "per_page": per_page},
|
|
352
453
|
)
|
|
353
454
|
|
|
354
|
-
async def create_repo(
|
|
355
|
-
|
|
356
|
-
|
|
455
|
+
async def create_repo(
|
|
456
|
+
self,
|
|
457
|
+
*,
|
|
458
|
+
org: str,
|
|
459
|
+
name: str,
|
|
460
|
+
description: Optional[str] = None,
|
|
461
|
+
homepage: Optional[str] = None,
|
|
462
|
+
has_issues: Optional[bool] = None,
|
|
463
|
+
has_wiki: Optional[bool] = None,
|
|
464
|
+
can_comment: Optional[bool] = None,
|
|
465
|
+
public: Optional[int] = None,
|
|
466
|
+
private: Optional[bool] = None,
|
|
467
|
+
auto_init: Optional[bool] = None,
|
|
468
|
+
gitignore_template: Optional[str] = None,
|
|
469
|
+
license_template: Optional[str] = None,
|
|
470
|
+
path: Optional[str] = None,
|
|
471
|
+
default_branch: Optional[str] = None,
|
|
472
|
+
**kwargs,
|
|
473
|
+
) -> Repository:
|
|
474
|
+
return await self._model(
|
|
475
|
+
"POST",
|
|
476
|
+
self._client._path("orgs", org, "repos"),
|
|
477
|
+
Repository,
|
|
478
|
+
json={
|
|
479
|
+
"name": name,
|
|
480
|
+
"description": description,
|
|
481
|
+
"homepage": homepage,
|
|
482
|
+
"has_issues": has_issues,
|
|
483
|
+
"has_wiki": has_wiki,
|
|
484
|
+
"can_comment": can_comment,
|
|
485
|
+
"public": public,
|
|
486
|
+
"private": private,
|
|
487
|
+
"auto_init": auto_init,
|
|
488
|
+
"gitignore_template": gitignore_template,
|
|
489
|
+
"license_template": license_template,
|
|
490
|
+
"path": path,
|
|
491
|
+
"default_branch": default_branch,
|
|
492
|
+
**kwargs,
|
|
493
|
+
},
|
|
494
|
+
)
|
|
357
495
|
|
|
358
496
|
async def get_enterprise_member(self, *, enterprise: str, username: str) -> EnterpriseMember:
|
|
359
497
|
return await self._model(
|
|
@@ -415,8 +553,30 @@ class AsyncOrgsResource(AsyncResource, AbstractOrgsResource):
|
|
|
415
553
|
json={"role": role},
|
|
416
554
|
)
|
|
417
555
|
|
|
418
|
-
async def update(
|
|
419
|
-
|
|
556
|
+
async def update(
|
|
557
|
+
self,
|
|
558
|
+
*,
|
|
559
|
+
org: str,
|
|
560
|
+
name: Optional[str] = None,
|
|
561
|
+
email: Optional[str] = None,
|
|
562
|
+
location: Optional[str] = None,
|
|
563
|
+
description: Optional[str] = None,
|
|
564
|
+
html_url: Optional[str] = None,
|
|
565
|
+
**kwargs,
|
|
566
|
+
) -> Organization:
|
|
567
|
+
return await self._model(
|
|
568
|
+
"PATCH",
|
|
569
|
+
self._client._path("orgs", org),
|
|
570
|
+
Organization,
|
|
571
|
+
json={
|
|
572
|
+
"name": name,
|
|
573
|
+
"email": email,
|
|
574
|
+
"location": location,
|
|
575
|
+
"description": description,
|
|
576
|
+
"html_url": html_url,
|
|
577
|
+
**kwargs,
|
|
578
|
+
},
|
|
579
|
+
)
|
|
420
580
|
|
|
421
581
|
async def leave(self, *, org: str) -> None:
|
|
422
582
|
await self._request("DELETE", self._client._path("user", "memberships", "orgs", org))
|
{gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/collaboration/issues_resource_group.py
RENAMED
|
@@ -512,8 +512,8 @@ class IssuesResource(SyncResource, AbstractIssuesResource):
|
|
|
512
512
|
"milestone": milestone,
|
|
513
513
|
"security_hole": security_hole,
|
|
514
514
|
"template_path": template_path,
|
|
515
|
-
|
|
516
|
-
|
|
515
|
+
**kwargs,
|
|
516
|
+
},
|
|
517
517
|
)
|
|
518
518
|
|
|
519
519
|
def update(
|
|
@@ -884,6 +884,7 @@ class AsyncIssuesResource(AsyncResource, AbstractIssuesResource):
|
|
|
884
884
|
"milestone": milestone,
|
|
885
885
|
"security_hole": security_hole,
|
|
886
886
|
"template_path": template_path,
|
|
887
|
+
**kwargs,
|
|
887
888
|
},
|
|
888
889
|
)
|
|
889
890
|
|
{gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/collaboration/pulls_resource_group.py
RENAMED
|
@@ -415,15 +415,21 @@ class AbstractPullsResource(ABC):
|
|
|
415
415
|
|
|
416
416
|
@abstractmethod
|
|
417
417
|
def request_test(
|
|
418
|
-
self,
|
|
418
|
+
self,
|
|
419
|
+
*,
|
|
420
|
+
number: Union[int, str],
|
|
421
|
+
owner: Optional[str] = None,
|
|
422
|
+
repo: Optional[str] = None,
|
|
423
|
+
force: Optional[bool] = None,
|
|
424
|
+
**kwargs,
|
|
419
425
|
) -> None:
|
|
420
426
|
"""Request testing for a pull request.
|
|
421
427
|
|
|
422
428
|
:param number: Pull request number.
|
|
423
429
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
424
430
|
:param repo: Repository path. Uses the client default when omitted.
|
|
425
|
-
:param
|
|
426
|
-
:
|
|
431
|
+
:param force: Force the test to pass (default ``False``), only effective for administrators.
|
|
432
|
+
:param kwargs: Additional arguments forwarded directly in request.
|
|
427
433
|
"""
|
|
428
434
|
|
|
429
435
|
@abstractmethod
|
|
@@ -919,12 +925,18 @@ class PullsResource(SyncResource, AbstractPullsResource):
|
|
|
919
925
|
return [as_model(item, PullRequestOperationLog) for item in data]
|
|
920
926
|
|
|
921
927
|
def request_test(
|
|
922
|
-
self,
|
|
928
|
+
self,
|
|
929
|
+
*,
|
|
930
|
+
number: Union[int, str],
|
|
931
|
+
owner: Optional[str] = None,
|
|
932
|
+
repo: Optional[str] = None,
|
|
933
|
+
force: Optional[bool] = None,
|
|
934
|
+
**kwargs,
|
|
923
935
|
) -> None:
|
|
924
936
|
self._request(
|
|
925
937
|
"POST",
|
|
926
938
|
self._client._repo_path("pulls", number, "test", owner=owner, repo=repo),
|
|
927
|
-
json=
|
|
939
|
+
json={"force": force, **kwargs},
|
|
928
940
|
)
|
|
929
941
|
|
|
930
942
|
def update_testers(
|
|
@@ -1375,12 +1387,18 @@ class AsyncPullsResource(AsyncResource, AbstractPullsResource):
|
|
|
1375
1387
|
return [as_model(item, PullRequestOperationLog) for item in data]
|
|
1376
1388
|
|
|
1377
1389
|
async def request_test(
|
|
1378
|
-
self,
|
|
1390
|
+
self,
|
|
1391
|
+
*,
|
|
1392
|
+
number: Union[int, str],
|
|
1393
|
+
owner: Optional[str] = None,
|
|
1394
|
+
repo: Optional[str] = None,
|
|
1395
|
+
force: Optional[bool] = None,
|
|
1396
|
+
**kwargs,
|
|
1379
1397
|
) -> None:
|
|
1380
1398
|
await self._request(
|
|
1381
1399
|
"POST",
|
|
1382
1400
|
self._client._repo_path("pulls", number, "test", owner=owner, repo=repo),
|
|
1383
|
-
json=
|
|
1401
|
+
json={"force": force, **kwargs},
|
|
1384
1402
|
)
|
|
1385
1403
|
|
|
1386
1404
|
async def update_testers(
|
{gitcode_api-1.3.2 → gitcode_api-1.3.3}/gitcode_api/resources/misc/releases_resource_group.py
RENAMED
|
@@ -4,6 +4,8 @@ from abc import ABC, abstractmethod
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
from typing import List, Optional, Union
|
|
6
6
|
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
7
9
|
from ..._models import Release, ReleaseUploadURL
|
|
8
10
|
from .._shared import AsyncResource, SyncResource
|
|
9
11
|
|
|
@@ -83,7 +85,7 @@ class AbstractReleasesResource(ABC):
|
|
|
83
85
|
owner: Optional[str] = None,
|
|
84
86
|
repo: Optional[str] = None,
|
|
85
87
|
upload_timeout: Optional[float] = 300.0,
|
|
86
|
-
) ->
|
|
88
|
+
) -> httpx.Response:
|
|
87
89
|
"""Upload a release attachment through the pre-signed upload URL.
|
|
88
90
|
|
|
89
91
|
:param tag: Tag name in the release URL path.
|
|
@@ -92,6 +94,7 @@ class AbstractReleasesResource(ABC):
|
|
|
92
94
|
:param owner: Repository owner path. Uses the client default when omitted.
|
|
93
95
|
:param repo: Repository path. Uses the client default when omitted.
|
|
94
96
|
:param upload_timeout: Timeout for upload operation. Default to 300 (5 minutes).
|
|
97
|
+
:returns: Response for upload put request (httpx.Response).
|
|
95
98
|
"""
|
|
96
99
|
|
|
97
100
|
@abstractmethod
|
|
@@ -231,7 +234,7 @@ class ReleasesResource(SyncResource, AbstractReleasesResource):
|
|
|
231
234
|
owner: Optional[str] = None,
|
|
232
235
|
repo: Optional[str] = None,
|
|
233
236
|
upload_timeout: Optional[float] = 300.0,
|
|
234
|
-
) ->
|
|
237
|
+
) -> httpx.Response:
|
|
235
238
|
upload_content = Path(content).read_bytes() if isinstance(content, str) else content
|
|
236
239
|
if not isinstance(upload_content, bytes):
|
|
237
240
|
raise TypeError("content must be bytes or a file path string.")
|
|
@@ -240,7 +243,7 @@ class ReleasesResource(SyncResource, AbstractReleasesResource):
|
|
|
240
243
|
if not upload_url.url:
|
|
241
244
|
raise ValueError("Release upload URL response did not include a URL.")
|
|
242
245
|
|
|
243
|
-
self._client._client.request(
|
|
246
|
+
return self._client._client.request(
|
|
244
247
|
"PUT",
|
|
245
248
|
upload_url.url,
|
|
246
249
|
content=upload_content,
|
|
@@ -372,7 +375,7 @@ class AsyncReleasesResource(AsyncResource, AbstractReleasesResource):
|
|
|
372
375
|
owner: Optional[str] = None,
|
|
373
376
|
repo: Optional[str] = None,
|
|
374
377
|
upload_timeout: Optional[float] = 300.0,
|
|
375
|
-
) ->
|
|
378
|
+
) -> httpx.Response:
|
|
376
379
|
upload_content = Path(content).read_bytes() if isinstance(content, str) else content
|
|
377
380
|
if not isinstance(upload_content, bytes):
|
|
378
381
|
raise TypeError("content must be bytes or a file path string.")
|
|
@@ -381,7 +384,7 @@ class AsyncReleasesResource(AsyncResource, AbstractReleasesResource):
|
|
|
381
384
|
if not upload_url.url:
|
|
382
385
|
raise ValueError("Release upload URL response did not include a URL.")
|
|
383
386
|
|
|
384
|
-
await self._client._client.request(
|
|
387
|
+
return await self._client._client.request(
|
|
385
388
|
"PUT",
|
|
386
389
|
upload_url.url,
|
|
387
390
|
content=upload_content,
|