python-cnb 0.8.0b1__tar.gz → 1.17.16__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.
- {python_cnb-0.8.0b1/python_cnb.egg-info → python_cnb-1.17.16}/PKG-INFO +2 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/README.md +1 -1
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/activities.py +17 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/ai.py +0 -16
- python_cnb-1.17.16/cnb/ai_ext.py +103 -0
- python_cnb-1.17.16/cnb/assets.py +42 -0
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/badge.py +0 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/build.py +17 -6
- python_cnb-1.17.16/cnb/charge.py +22 -0
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/cnb.py +5 -7
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/event.py +0 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/followers.py +0 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/git.py +69 -3
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/gitsettings.py +1 -4
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/issues.py +21 -3
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/knowledgebase.py +0 -2
- python_cnb-0.8.0b1/cnb/collaborators.py → python_cnb-1.17.16/cnb/members.py +69 -28
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/missions.py +0 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/models/api.py +30 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/models/chart.py +0 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/models/constant.py +0 -10
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/models/convert.py +0 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/models/die.py +0 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/models/dto.py +81 -76
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/models/flags.py +2 -3
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/models/git_woa_com_cnb_monorepo_git_internal_app_git_service_bff_api.py +7 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/models/git_woa_com_cnb_monorepo_git_internal_app_vcs_service_bff_api.py +8 -2
- python_cnb-1.17.16/cnb/models/git_woa_com_cnb_monorepo_platform_service_api_internal_models_artifactory_dto.py +23 -0
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/models/openapi.py +9 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/models/organization.py +4 -3
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/models/web.py +0 -6
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/organizations.py +0 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/pulls.py +80 -3
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/registries.py +5 -6
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/releases.py +25 -3
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/repocontributor.py +0 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/repolabels.py +0 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/repositories.py +0 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/security.py +0 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/starring.py +4 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/users.py +13 -4
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/workspace.py +2 -4
- {python_cnb-0.8.0b1 → python_cnb-1.17.16/python_cnb.egg-info}/PKG-INFO +2 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/python_cnb.egg-info/SOURCES.txt +4 -2
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/setup.py +1 -1
- python_cnb-0.8.0b1/cnb/assets.py +0 -91
- python_cnb-0.8.0b1/cnb/contributors.py +0 -72
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/LICENSE +0 -0
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/MANIFEST.in +0 -0
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/__init__.py +0 -0
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/client.py +0 -0
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/exceptions.py +0 -0
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/models/__init__.py +0 -0
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/cnb/models/models.py +0 -0
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/pyproject.toml +0 -0
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/python_cnb.egg-info/dependency_links.txt +0 -0
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/python_cnb.egg-info/requires.txt +0 -0
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/python_cnb.egg-info/top_level.txt +0 -0
- {python_cnb-0.8.0b1 → python_cnb-1.17.16}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-cnb
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1.17.16
|
|
4
4
|
Summary: CNB OpenAPI的Python SDK,方便与CNB平台进行交互
|
|
5
5
|
Home-page: https://cnb.cool
|
|
6
6
|
Author: Tencent Cloud
|
|
@@ -40,7 +40,7 @@ Dynamic: summary
|
|
|
40
40
|
[](https://pypi.org/project/python-cnb/)
|
|
41
41
|
[](https://www.python.org/downloads/)
|
|
42
42
|
[](LICENSE)
|
|
43
|
-
<a href="https://
|
|
43
|
+
<a href="https://www.codebuddy.cn/"><img src="https://img.shields.io/badge/AI-Code%20Assist-EB9FDA"></a>
|
|
44
44
|
|
|
45
45
|
CNB OpenAPI的Python SDK,方便与CNB平台进行交互。
|
|
46
46
|
> 该 sdk 由 [cnb-sdk-generator](https://cnb.cool/cnb/sdk/cnb-sdk-generator) 生成
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://pypi.org/project/python-cnb/)
|
|
4
4
|
[](https://www.python.org/downloads/)
|
|
5
5
|
[](LICENSE)
|
|
6
|
-
<a href="https://
|
|
6
|
+
<a href="https://www.codebuddy.cn/"><img src="https://img.shields.io/badge/AI-Code%20Assist-EB9FDA"></a>
|
|
7
7
|
|
|
8
8
|
CNB OpenAPI的Python SDK,方便与CNB平台进行交互。
|
|
9
9
|
> 该 sdk 由 [cnb-sdk-generator](https://cnb.cool/cnb/sdk/cnb-sdk-generator) 生成
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
# Code generated by cnb.cool/cnb/sdk/cnb-sdk-generator. DO NOT EDIT.
|
|
2
|
-
# versions:
|
|
3
|
-
# cnb-sdk-generator: 1.0.2
|
|
4
2
|
# source: https://api.cnb-dev.woa.com/swagger.json
|
|
5
3
|
|
|
6
4
|
from typing import Optional
|
|
@@ -46,4 +44,21 @@ class ActivitiesService:
|
|
|
46
44
|
)
|
|
47
45
|
return data
|
|
48
46
|
|
|
47
|
+
# 获取仓库 top 活跃用户。List the top active users
|
|
48
|
+
def top_contributors(self,
|
|
49
|
+
repo: str,
|
|
50
|
+
top: Optional[int] = None,
|
|
51
|
+
) -> list[dto.UsersResult]:
|
|
52
|
+
u = "/%s/-/top-activity-users" % (repo, )
|
|
53
|
+
|
|
54
|
+
query_params = {
|
|
55
|
+
"top": top,
|
|
56
|
+
}
|
|
57
|
+
data = self._client.request(
|
|
58
|
+
method="GET",
|
|
59
|
+
endpoint=u,
|
|
60
|
+
params=query_params,
|
|
61
|
+
)
|
|
62
|
+
return [dto.UsersResult.safe_parse(item) for item in data]
|
|
63
|
+
|
|
49
64
|
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
# Code generated by cnb.cool/cnb/sdk/cnb-sdk-generator. DO NOT EDIT.
|
|
2
|
-
# versions:
|
|
3
|
-
# cnb-sdk-generator: 1.0.2
|
|
4
2
|
# source: https://api.cnb-dev.woa.com/swagger.json
|
|
5
3
|
|
|
6
4
|
from typing import Optional
|
|
@@ -23,18 +21,4 @@ class AiService:
|
|
|
23
21
|
)
|
|
24
22
|
return dto.AiAutoPrResult.safe_parse(data)
|
|
25
23
|
|
|
26
|
-
# AI 对话,参数根据模型不同会有区别。AI chat completions, params may differ by model.
|
|
27
|
-
def ai_chat_completions(self,
|
|
28
|
-
repo: str,
|
|
29
|
-
body_params: dto.AiChatCompletionsReq,
|
|
30
|
-
) -> dto.AiChatCompletionsResult:
|
|
31
|
-
u = "/%s/-/ai/chat/completions" % (repo, )
|
|
32
|
-
|
|
33
|
-
data = self._client.request(
|
|
34
|
-
method="POST",
|
|
35
|
-
endpoint=u,
|
|
36
|
-
json=body_params.to_dict(),
|
|
37
|
-
)
|
|
38
|
-
return dto.AiChatCompletionsResult.safe_parse(data)
|
|
39
|
-
|
|
40
24
|
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# AI Service Extensions - Manual implementation for streaming and additional AI features
|
|
2
|
+
# This file extends the AiService class with streaming support
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
from typing import Generator, Union
|
|
6
|
+
from .ai import AiService
|
|
7
|
+
from .models import dto
|
|
8
|
+
|
|
9
|
+
class AiService(AiService):
|
|
10
|
+
"""
|
|
11
|
+
扩展的 AiService 类,添加流式输出支持
|
|
12
|
+
Extended AiService class with streaming support
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def request_stream(self, method: str, endpoint: str, **kwargs) -> Generator[str, None, None]:
|
|
16
|
+
"""
|
|
17
|
+
发送流式请求并逐行返回数据
|
|
18
|
+
Send streaming request and yield data line by line
|
|
19
|
+
"""
|
|
20
|
+
response = self._client.session.request(
|
|
21
|
+
method=method,
|
|
22
|
+
url=f"{self._client.base_url}{endpoint}",
|
|
23
|
+
stream=True, # 启用流式响应
|
|
24
|
+
**kwargs
|
|
25
|
+
)
|
|
26
|
+
response.raise_for_status()
|
|
27
|
+
response.encoding = 'utf-8' # 强制使用 UTF-8 解码
|
|
28
|
+
|
|
29
|
+
# 逐行读取流式响应
|
|
30
|
+
for line in response.iter_lines(decode_unicode=True):
|
|
31
|
+
if line:
|
|
32
|
+
# 处理 Server-Sent Events 格式
|
|
33
|
+
if line.startswith('data: '):
|
|
34
|
+
data = line[6:] # 移除 'data: ' 前缀
|
|
35
|
+
if data.strip() == '[DONE]':
|
|
36
|
+
break
|
|
37
|
+
yield data
|
|
38
|
+
elif line.strip():
|
|
39
|
+
# 处理其他格式的流式数据
|
|
40
|
+
yield line
|
|
41
|
+
|
|
42
|
+
# AI 对话。调用者需有代码写权限(CI 中使用 CNB_TOKEN 不检查写权限)。AI chat completions. Requires caller to have repo write permission (except when using CNB_TOKEN in CI).
|
|
43
|
+
def ai_chat_completions(self,
|
|
44
|
+
repo: str,
|
|
45
|
+
body_params: dto.AiChatCompletionsReq,
|
|
46
|
+
) -> Union[dto.AiChatCompletionsResult, Generator[str, None, None]]:
|
|
47
|
+
u = "/%s/-/ai/chat/completions" % (repo,)
|
|
48
|
+
|
|
49
|
+
# 根据 stream 参数决定输出格式
|
|
50
|
+
if body_params.stream:
|
|
51
|
+
# 流式输出:返回生成器
|
|
52
|
+
return self.request_stream(
|
|
53
|
+
method="POST",
|
|
54
|
+
endpoint=u,
|
|
55
|
+
json=body_params.to_dict(),
|
|
56
|
+
)
|
|
57
|
+
else:
|
|
58
|
+
# 非流式输出:使用标准请求
|
|
59
|
+
data = self._client.request(
|
|
60
|
+
method="POST",
|
|
61
|
+
endpoint=u,
|
|
62
|
+
json=body_params.to_dict(),
|
|
63
|
+
)
|
|
64
|
+
return dto.AiChatCompletionsResult.safe_parse(data)
|
|
65
|
+
|
|
66
|
+
def ai_chat_completions_stream(self,
|
|
67
|
+
repo: str,
|
|
68
|
+
body_params: dto.AiChatCompletionsReq,
|
|
69
|
+
) -> Generator[str, None, None]:
|
|
70
|
+
# 强制启用流式输出
|
|
71
|
+
body_params.stream = True
|
|
72
|
+
|
|
73
|
+
# 直接调用优化后的 ai_chat_completions 方法
|
|
74
|
+
return self.ai_chat_completions(repo, body_params)
|
|
75
|
+
|
|
76
|
+
def ai_chat_completions_stream_parsed(self,
|
|
77
|
+
repo: str,
|
|
78
|
+
body_params: dto.AiChatCompletionsReq,
|
|
79
|
+
) -> Generator[dict, None, None]:
|
|
80
|
+
stream_generator = self.ai_chat_completions_stream(repo, body_params)
|
|
81
|
+
|
|
82
|
+
for chunk in stream_generator:
|
|
83
|
+
try:
|
|
84
|
+
# 尝试解析 JSON 数据
|
|
85
|
+
parsed_data = json.loads(chunk)
|
|
86
|
+
yield parsed_data
|
|
87
|
+
except json.JSONDecodeError:
|
|
88
|
+
# 如果不是有效的 JSON,跳过或记录错误
|
|
89
|
+
continue
|
|
90
|
+
|
|
91
|
+
def ai_chat_completions_stream_content(self,
|
|
92
|
+
repo: str,
|
|
93
|
+
body_params: dto.AiChatCompletionsReq,
|
|
94
|
+
) -> Generator[str, None, None]:
|
|
95
|
+
for parsed_data in self.ai_chat_completions_stream_parsed(repo, body_params):
|
|
96
|
+
# 提取 choices[0].delta.content 或类似字段
|
|
97
|
+
if isinstance(parsed_data, dict):
|
|
98
|
+
choices = parsed_data.get('choices', [])
|
|
99
|
+
if choices and len(choices) > 0:
|
|
100
|
+
delta = choices[0].get('delta', {})
|
|
101
|
+
content = delta.get('content')
|
|
102
|
+
if content:
|
|
103
|
+
yield content
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Code generated by cnb.cool/cnb/sdk/cnb-sdk-generator. DO NOT EDIT.
|
|
2
|
+
# source: https://api.cnb-dev.woa.com/swagger.json
|
|
3
|
+
|
|
4
|
+
from typing import Optional
|
|
5
|
+
from .models import dto
|
|
6
|
+
class AssetsService:
|
|
7
|
+
def __init__(self, client):
|
|
8
|
+
self._client = client
|
|
9
|
+
|
|
10
|
+
# 通过 asset 记录 id 删除一个 asset
|
|
11
|
+
def delete_asset(self,
|
|
12
|
+
repo: str,
|
|
13
|
+
assetID: str,
|
|
14
|
+
):
|
|
15
|
+
u = "/%s/-/assets/%s" % (repo, assetID, )
|
|
16
|
+
|
|
17
|
+
data = self._client.request(
|
|
18
|
+
method="DELETE",
|
|
19
|
+
endpoint=u,
|
|
20
|
+
)
|
|
21
|
+
return
|
|
22
|
+
|
|
23
|
+
# 仓库的 asset 记录列表
|
|
24
|
+
def list_assets(self,
|
|
25
|
+
slug: str,
|
|
26
|
+
page: Optional[int] = None,
|
|
27
|
+
page_size: Optional[int] = None,
|
|
28
|
+
) -> list[dto.AssetRecords]:
|
|
29
|
+
u = "/%s/-/list-assets" % (slug, )
|
|
30
|
+
|
|
31
|
+
query_params = {
|
|
32
|
+
"page": page,
|
|
33
|
+
"page_size": page_size,
|
|
34
|
+
}
|
|
35
|
+
data = self._client.request(
|
|
36
|
+
method="GET",
|
|
37
|
+
endpoint=u,
|
|
38
|
+
params=query_params,
|
|
39
|
+
)
|
|
40
|
+
return [dto.AssetRecords.safe_parse(item) for item in data]
|
|
41
|
+
|
|
42
|
+
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
# Code generated by cnb.cool/cnb/sdk/cnb-sdk-generator. DO NOT EDIT.
|
|
2
|
-
# versions:
|
|
3
|
-
# cnb-sdk-generator: 1.0.2
|
|
4
2
|
# source: https://api.cnb-dev.woa.com/swagger.json
|
|
5
3
|
|
|
6
4
|
from typing import Optional
|
|
@@ -9,18 +7,31 @@ class BuildService:
|
|
|
9
7
|
def __init__(self, client):
|
|
10
8
|
self._client = client
|
|
11
9
|
|
|
10
|
+
# 同步仓库分支下的定时任务。 Synchronize the content under the repository branch.
|
|
11
|
+
def build_crontab_sync(self,
|
|
12
|
+
repo: str,
|
|
13
|
+
branch: str,
|
|
14
|
+
) -> dto.BuildCommonResult:
|
|
15
|
+
u = "/%s/-/build/crontab/sync/%s" % (repo, branch, )
|
|
16
|
+
|
|
17
|
+
data = self._client.request(
|
|
18
|
+
method="POST",
|
|
19
|
+
endpoint=u,
|
|
20
|
+
)
|
|
21
|
+
return dto.BuildCommonResult.safe_parse(data)
|
|
22
|
+
|
|
12
23
|
# 删除流水线日志内容。Delete pipeline logs content.
|
|
13
24
|
def build_logs_delete(self,
|
|
14
25
|
repo: str,
|
|
15
26
|
sn: str,
|
|
16
|
-
) -> dto.
|
|
27
|
+
) -> dto.BuildCommonResult:
|
|
17
28
|
u = "/%s/-/build/logs/%s" % (repo, sn, )
|
|
18
29
|
|
|
19
30
|
data = self._client.request(
|
|
20
31
|
method="DELETE",
|
|
21
32
|
endpoint=u,
|
|
22
33
|
)
|
|
23
|
-
return dto.
|
|
34
|
+
return dto.BuildCommonResult.safe_parse(data)
|
|
24
35
|
|
|
25
36
|
# 流水线runner日志下载。Pipeline runner log download.
|
|
26
37
|
def build_runner_download_log(self,
|
|
@@ -42,7 +53,7 @@ class BuildService:
|
|
|
42
53
|
endTime: Optional[str] = None,
|
|
43
54
|
event: Optional[str] = None,
|
|
44
55
|
page: Optional[int] = None,
|
|
45
|
-
|
|
56
|
+
page_size: Optional[int] = None,
|
|
46
57
|
sha: Optional[str] = None,
|
|
47
58
|
sn: Optional[str] = None,
|
|
48
59
|
sourceRef: Optional[str] = None,
|
|
@@ -58,7 +69,7 @@ class BuildService:
|
|
|
58
69
|
"endTime": endTime,
|
|
59
70
|
"event": event,
|
|
60
71
|
"page": page,
|
|
61
|
-
"
|
|
72
|
+
"page_size": page_size,
|
|
62
73
|
"sha": sha,
|
|
63
74
|
"sn": sn,
|
|
64
75
|
"sourceRef": sourceRef,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Code generated by cnb.cool/cnb/sdk/cnb-sdk-generator. DO NOT EDIT.
|
|
2
|
+
# source: https://api.cnb-dev.woa.com/swagger.json
|
|
3
|
+
|
|
4
|
+
from typing import Optional
|
|
5
|
+
from .models import dto
|
|
6
|
+
class ChargeService:
|
|
7
|
+
def __init__(self, client):
|
|
8
|
+
self._client = client
|
|
9
|
+
|
|
10
|
+
# 查看特权额度
|
|
11
|
+
def get_special_amount(self,
|
|
12
|
+
slug: str,
|
|
13
|
+
) -> dto.SpecialAmount:
|
|
14
|
+
u = "/%s/-/charge/special-amount" % (slug, )
|
|
15
|
+
|
|
16
|
+
data = self._client.request(
|
|
17
|
+
method="GET",
|
|
18
|
+
endpoint=u,
|
|
19
|
+
)
|
|
20
|
+
return dto.SpecialAmount.safe_parse(data)
|
|
21
|
+
|
|
22
|
+
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
# Code generated by cnb.cool/cnb/sdk/cnb-sdk-generator. DO NOT EDIT.
|
|
2
|
-
# versions:
|
|
3
|
-
# cnb-sdk-generator: 1.0.2
|
|
4
2
|
# source: https://api.cnb-dev.woa.com/swagger.json
|
|
5
3
|
from .activities import ActivitiesService
|
|
6
|
-
from .
|
|
4
|
+
from .ai_ext import AiService
|
|
7
5
|
from .assets import AssetsService
|
|
8
6
|
from .badge import BadgeService
|
|
9
7
|
from .build import BuildService
|
|
10
|
-
from .
|
|
11
|
-
from .contributors import ContributorsService
|
|
8
|
+
from .charge import ChargeService
|
|
12
9
|
from .event import EventService
|
|
13
10
|
from .followers import FollowersService
|
|
14
11
|
from .git import GitService
|
|
15
12
|
from .gitsettings import GitsettingsService
|
|
16
13
|
from .issues import IssuesService
|
|
17
14
|
from .knowledgebase import KnowledgebaseService
|
|
15
|
+
from .members import MembersService
|
|
18
16
|
from .missions import MissionsService
|
|
19
17
|
from .organizations import OrganizationsService
|
|
20
18
|
from .pulls import PullsService
|
|
@@ -36,14 +34,14 @@ class CNBServices:
|
|
|
36
34
|
self.assets = AssetsService(client)
|
|
37
35
|
self.badge = BadgeService(client)
|
|
38
36
|
self.build = BuildService(client)
|
|
39
|
-
self.
|
|
40
|
-
self.contributors = ContributorsService(client)
|
|
37
|
+
self.charge = ChargeService(client)
|
|
41
38
|
self.event = EventService(client)
|
|
42
39
|
self.followers = FollowersService(client)
|
|
43
40
|
self.git = GitService(client)
|
|
44
41
|
self.gitsettings = GitsettingsService(client)
|
|
45
42
|
self.issues = IssuesService(client)
|
|
46
43
|
self.knowledgebase = KnowledgebaseService(client)
|
|
44
|
+
self.members = MembersService(client)
|
|
47
45
|
self.missions = MissionsService(client)
|
|
48
46
|
self.organizations = OrganizationsService(client)
|
|
49
47
|
self.pulls = PullsService(client)
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
# Code generated by cnb.cool/cnb/sdk/cnb-sdk-generator. DO NOT EDIT.
|
|
2
|
-
# versions:
|
|
3
|
-
# cnb-sdk-generator: 1.0.2
|
|
4
2
|
# source: https://api.cnb-dev.woa.com/swagger.json
|
|
5
3
|
|
|
6
4
|
from typing import Optional
|
|
@@ -40,6 +38,19 @@ class GitService:
|
|
|
40
38
|
)
|
|
41
39
|
return
|
|
42
40
|
|
|
41
|
+
# 锁定分支
|
|
42
|
+
def create_branch_lock(self,
|
|
43
|
+
repo: str,
|
|
44
|
+
branch: str,
|
|
45
|
+
):
|
|
46
|
+
u = "/%s/-/git/branch-locks/%s" % (repo, branch, )
|
|
47
|
+
|
|
48
|
+
data = self._client.request(
|
|
49
|
+
method="POST",
|
|
50
|
+
endpoint=u,
|
|
51
|
+
)
|
|
52
|
+
return
|
|
53
|
+
|
|
43
54
|
# 创建一个 tag。Create a tag.
|
|
44
55
|
def create_tag(self,
|
|
45
56
|
repo: str,
|
|
@@ -67,6 +78,19 @@ class GitService:
|
|
|
67
78
|
)
|
|
68
79
|
return
|
|
69
80
|
|
|
81
|
+
# 解除锁定分支
|
|
82
|
+
def delete_branch_lock(self,
|
|
83
|
+
repo: str,
|
|
84
|
+
branch: str,
|
|
85
|
+
):
|
|
86
|
+
u = "/%s/-/git/branch-locks/%s" % (repo, branch, )
|
|
87
|
+
|
|
88
|
+
data = self._client.request(
|
|
89
|
+
method="DELETE",
|
|
90
|
+
endpoint=u,
|
|
91
|
+
)
|
|
92
|
+
return
|
|
93
|
+
|
|
70
94
|
# 删除指定 commit 的元数据。Delete commit annotation.
|
|
71
95
|
def delete_commit_annotation(self,
|
|
72
96
|
repo: str,
|
|
@@ -213,6 +237,25 @@ class GitService:
|
|
|
213
237
|
)
|
|
214
238
|
return [web.CommitAnnotationInBatch.safe_parse(item) for item in data]
|
|
215
239
|
|
|
240
|
+
# 发起一个获取 commits 附件的请求, 302到有一定效期的下载地址。Get a request to fetch a commit assets and returns 302 redirect to the assets URL with specific valid time.
|
|
241
|
+
def get_commit_assets(self,
|
|
242
|
+
repo: str,
|
|
243
|
+
commit_id: str,
|
|
244
|
+
filename: str,
|
|
245
|
+
share: Optional[bool] = None,
|
|
246
|
+
):
|
|
247
|
+
u = "/%s/-/commit-assets/download/%s/%s" % (repo, commit_id, filename, )
|
|
248
|
+
|
|
249
|
+
query_params = {
|
|
250
|
+
"share": share,
|
|
251
|
+
}
|
|
252
|
+
data = self._client.request(
|
|
253
|
+
method="GET",
|
|
254
|
+
endpoint=u,
|
|
255
|
+
params=query_params,
|
|
256
|
+
)
|
|
257
|
+
return
|
|
258
|
+
|
|
216
259
|
# 查询指定 commit 的附件。List commit assets.
|
|
217
260
|
def get_commit_assets_by_sha(self,
|
|
218
261
|
repo: str,
|
|
@@ -299,6 +342,24 @@ class GitService:
|
|
|
299
342
|
)
|
|
300
343
|
return openapi.HeadRef.safe_parse(data)
|
|
301
344
|
|
|
345
|
+
# 获取 git lfs 文件下载链接
|
|
346
|
+
def get_presigned_lfsdownload_link(self,
|
|
347
|
+
slug: str,
|
|
348
|
+
oid: str,
|
|
349
|
+
name: Optional[str] = None,
|
|
350
|
+
):
|
|
351
|
+
u = "/%s/-/lfs/%s" % (slug, oid, )
|
|
352
|
+
|
|
353
|
+
query_params = {
|
|
354
|
+
"name": name,
|
|
355
|
+
}
|
|
356
|
+
data = self._client.request(
|
|
357
|
+
method="GET",
|
|
358
|
+
endpoint=u,
|
|
359
|
+
params=query_params,
|
|
360
|
+
)
|
|
361
|
+
return
|
|
362
|
+
|
|
302
363
|
# 获得仓库指定文件内容
|
|
303
364
|
def get_raw(self,
|
|
304
365
|
repo: str,
|
|
@@ -416,12 +477,17 @@ class GitService:
|
|
|
416
477
|
sha1: str,
|
|
417
478
|
upload_token: str,
|
|
418
479
|
asset_path: str,
|
|
419
|
-
|
|
480
|
+
ttl: Optional[int] = None,
|
|
481
|
+
):
|
|
420
482
|
u = "/%s/-/git/commit-assets/%s/asset-upload-confirmation/%s/%s" % (repo, sha1, upload_token, asset_path, )
|
|
421
483
|
|
|
484
|
+
query_params = {
|
|
485
|
+
"ttl": ttl,
|
|
486
|
+
}
|
|
422
487
|
data = self._client.request(
|
|
423
488
|
method="POST",
|
|
424
489
|
endpoint=u,
|
|
490
|
+
params=query_params,
|
|
425
491
|
)
|
|
426
492
|
return
|
|
427
493
|
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
# Code generated by cnb.cool/cnb/sdk/cnb-sdk-generator. DO NOT EDIT.
|
|
2
|
-
# versions:
|
|
3
|
-
# cnb-sdk-generator: 1.0.2
|
|
4
2
|
# source: https://api.cnb-dev.woa.com/swagger.json
|
|
5
3
|
|
|
6
4
|
from typing import Optional
|
|
7
5
|
from .models import api
|
|
8
|
-
from .models import web
|
|
9
6
|
class GitsettingsService:
|
|
10
7
|
def __init__(self, client):
|
|
11
8
|
self._client = client
|
|
@@ -116,7 +113,7 @@ class GitsettingsService:
|
|
|
116
113
|
# 更新仓库云原生构建设置。Update pipeline settings.
|
|
117
114
|
def put_pipeline_settings(self,
|
|
118
115
|
repo: str,
|
|
119
|
-
body_params:
|
|
116
|
+
body_params: api.PipelineSettings,
|
|
120
117
|
):
|
|
121
118
|
u = "/%s/-/settings/cloud-native-build" % (repo, )
|
|
122
119
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
# Code generated by cnb.cool/cnb/sdk/cnb-sdk-generator. DO NOT EDIT.
|
|
2
|
-
# versions:
|
|
3
|
-
# cnb-sdk-generator: 1.0.2
|
|
4
2
|
# source: https://api.cnb-dev.woa.com/swagger.json
|
|
5
3
|
|
|
6
4
|
from typing import Optional
|
|
7
5
|
from .models import api
|
|
8
6
|
from .models import git_woa_com_cnb_monorepo_git_internal_app_vcs_service_bff_api
|
|
7
|
+
from .models import openapi
|
|
9
8
|
class IssuesService:
|
|
10
9
|
def __init__(self, client):
|
|
11
10
|
self._client = client
|
|
@@ -124,12 +123,14 @@ class IssuesService:
|
|
|
124
123
|
def list_issue_comments(self,
|
|
125
124
|
repo: str,
|
|
126
125
|
number: str,
|
|
127
|
-
|
|
126
|
+
sort: Optional[str] = None,
|
|
127
|
+
page: Optional[int] = None,
|
|
128
128
|
page_size: Optional[int] = None,
|
|
129
129
|
) -> list[api.IssueComment]:
|
|
130
130
|
u = "/%s/-/issues/%s/comments" % (repo, number, )
|
|
131
131
|
|
|
132
132
|
query_params = {
|
|
133
|
+
"sort": sort,
|
|
133
134
|
"page": page,
|
|
134
135
|
"page_size": page_size,
|
|
135
136
|
}
|
|
@@ -169,6 +170,7 @@ class IssuesService:
|
|
|
169
170
|
keyword: Optional[str] = None,
|
|
170
171
|
priority: Optional[str] = None,
|
|
171
172
|
labels: Optional[str] = None,
|
|
173
|
+
labels_operator: Optional[str] = None,
|
|
172
174
|
authors: Optional[str] = None,
|
|
173
175
|
assignees: Optional[str] = None,
|
|
174
176
|
updated_time_begin: Optional[str] = None,
|
|
@@ -186,6 +188,7 @@ class IssuesService:
|
|
|
186
188
|
"keyword": keyword,
|
|
187
189
|
"priority": priority,
|
|
188
190
|
"labels": labels,
|
|
191
|
+
"labels_operator": labels_operator,
|
|
189
192
|
"authors": authors,
|
|
190
193
|
"assignees": assignees,
|
|
191
194
|
"updated_time_begin": updated_time_begin,
|
|
@@ -307,4 +310,19 @@ class IssuesService:
|
|
|
307
310
|
)
|
|
308
311
|
return api.IssueDetail.safe_parse(data)
|
|
309
312
|
|
|
313
|
+
# 批量更新Issue自定义属性值
|
|
314
|
+
def update_issue_properties(self,
|
|
315
|
+
repo: str,
|
|
316
|
+
number: str,
|
|
317
|
+
body_params: openapi.IssuePropertiesForm,
|
|
318
|
+
) -> api.IssuePropertyUpdateResult:
|
|
319
|
+
u = "/%s/-/issues/%s/property" % (repo, number, )
|
|
320
|
+
|
|
321
|
+
data = self._client.request(
|
|
322
|
+
method="PATCH",
|
|
323
|
+
endpoint=u,
|
|
324
|
+
json=body_params.to_dict(),
|
|
325
|
+
)
|
|
326
|
+
return api.IssuePropertyUpdateResult.safe_parse(data)
|
|
327
|
+
|
|
310
328
|
|