python-cnb 0.8.0__tar.gz → 0.8.0b1__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.0/python_cnb.egg-info → python_cnb-0.8.0b1}/PKG-INFO +1 -1
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/activities.py +0 -17
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/ai.py +14 -0
- python_cnb-0.8.0b1/cnb/assets.py +91 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/build.py +2 -15
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/cnb.py +7 -5
- python_cnb-0.8.0/cnb/members.py → python_cnb-0.8.0b1/cnb/collaborators.py +26 -69
- python_cnb-0.8.0b1/cnb/contributors.py +72 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/git.py +0 -37
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/gitsettings.py +2 -1
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/issues.py +0 -18
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/models/api.py +0 -7
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/models/dto.py +1 -25
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/models/openapi.py +0 -7
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/models/organization.py +1 -3
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/models/web.py +4 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/pulls.py +1 -34
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/releases.py +0 -19
- {python_cnb-0.8.0 → python_cnb-0.8.0b1/python_cnb.egg-info}/PKG-INFO +1 -1
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/python_cnb.egg-info/SOURCES.txt +3 -3
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/setup.py +1 -1
- python_cnb-0.8.0/cnb/ai_ext.py +0 -103
- python_cnb-0.8.0/cnb/charge.py +0 -24
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/LICENSE +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/MANIFEST.in +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/README.md +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/__init__.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/badge.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/client.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/event.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/exceptions.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/followers.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/knowledgebase.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/missions.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/models/__init__.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/models/chart.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/models/constant.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/models/convert.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/models/die.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/models/flags.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/models/git_woa_com_cnb_monorepo_git_internal_app_git_service_bff_api.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/models/git_woa_com_cnb_monorepo_git_internal_app_vcs_service_bff_api.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/models/models.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/organizations.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/registries.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/repocontributor.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/repolabels.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/repositories.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/security.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/starring.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/users.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/cnb/workspace.py +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/pyproject.toml +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/python_cnb.egg-info/dependency_links.txt +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/python_cnb.egg-info/requires.txt +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/python_cnb.egg-info/top_level.txt +0 -0
- {python_cnb-0.8.0 → python_cnb-0.8.0b1}/setup.cfg +0 -0
|
@@ -46,21 +46,4 @@ class ActivitiesService:
|
|
|
46
46
|
)
|
|
47
47
|
return data
|
|
48
48
|
|
|
49
|
-
# 获取仓库 top 活跃用户。List the top active users
|
|
50
|
-
def top_contributors(self,
|
|
51
|
-
repo: str,
|
|
52
|
-
top: Optional[int] = None,
|
|
53
|
-
) -> list[dto.UsersResult]:
|
|
54
|
-
u = "/%s/-/top-activity-users" % (repo, )
|
|
55
|
-
|
|
56
|
-
query_params = {
|
|
57
|
-
"top": top,
|
|
58
|
-
}
|
|
59
|
-
data = self._client.request(
|
|
60
|
-
method="GET",
|
|
61
|
-
endpoint=u,
|
|
62
|
-
params=query_params,
|
|
63
|
-
)
|
|
64
|
-
return [dto.UsersResult.safe_parse(item) for item in data]
|
|
65
|
-
|
|
66
49
|
|
|
@@ -23,4 +23,18 @@ class AiService:
|
|
|
23
23
|
)
|
|
24
24
|
return dto.AiAutoPrResult.safe_parse(data)
|
|
25
25
|
|
|
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
|
+
|
|
26
40
|
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Code generated by cnb.cool/cnb/sdk/cnb-sdk-generator. DO NOT EDIT.
|
|
2
|
+
# versions:
|
|
3
|
+
# cnb-sdk-generator: 1.0.2
|
|
4
|
+
# source: https://api.cnb-dev.woa.com/swagger.json
|
|
5
|
+
|
|
6
|
+
from typing import Optional
|
|
7
|
+
from .models import dto
|
|
8
|
+
class AssetsService:
|
|
9
|
+
def __init__(self, client):
|
|
10
|
+
self._client = client
|
|
11
|
+
|
|
12
|
+
# 发起一个获取 commits 附件的请求,返回内容或者 302 到某个地址。Get a request to fetch a commit assets and returns the content directly or a 302 redirect to the assets URL.
|
|
13
|
+
def get_commit_assets(self,
|
|
14
|
+
repo: str,
|
|
15
|
+
commit_id: str,
|
|
16
|
+
filename: str,
|
|
17
|
+
share: Optional[bool] = None,
|
|
18
|
+
):
|
|
19
|
+
u = "/%s/-/commit-assets/download/%s/%s" % (repo, commit_id, filename, )
|
|
20
|
+
|
|
21
|
+
query_params = {
|
|
22
|
+
"share": share,
|
|
23
|
+
}
|
|
24
|
+
data = self._client.request(
|
|
25
|
+
method="GET",
|
|
26
|
+
endpoint=u,
|
|
27
|
+
params=query_params,
|
|
28
|
+
)
|
|
29
|
+
return
|
|
30
|
+
|
|
31
|
+
# 发起一个获取 latest release 附件的请求,返回内容或者 302 到某个地址。Initiate a request to get latest release attachments, returns content or 302 redirect.
|
|
32
|
+
def get_latest_releases_asset(self,
|
|
33
|
+
repo: str,
|
|
34
|
+
fileName: str,
|
|
35
|
+
):
|
|
36
|
+
u = "/%s/-/releases/latest/download/%s" % (repo, fileName, )
|
|
37
|
+
|
|
38
|
+
data = self._client.request(
|
|
39
|
+
method="GET",
|
|
40
|
+
endpoint=u,
|
|
41
|
+
)
|
|
42
|
+
return
|
|
43
|
+
|
|
44
|
+
# 发起一个获取 release 附件的请求,返回内容或者 302 到某个地址。Initiate a request to get release attachments, returns content or 302 redirect.
|
|
45
|
+
def get_releases_asset(self,
|
|
46
|
+
repo: str,
|
|
47
|
+
tag: str,
|
|
48
|
+
filename: str,
|
|
49
|
+
share: Optional[bool] = None,
|
|
50
|
+
):
|
|
51
|
+
u = "/%s/-/releases/download/%s/%s" % (repo, tag, filename, )
|
|
52
|
+
|
|
53
|
+
query_params = {
|
|
54
|
+
"share": share,
|
|
55
|
+
}
|
|
56
|
+
data = self._client.request(
|
|
57
|
+
method="GET",
|
|
58
|
+
endpoint=u,
|
|
59
|
+
params=query_params,
|
|
60
|
+
)
|
|
61
|
+
return
|
|
62
|
+
|
|
63
|
+
# 发起一个上传 files 的请求,返回上传文件的url,请使用 put 发起流式上传。Initiate a request to upload files,returns upload URL.Use PUT to initiate a stream upload.
|
|
64
|
+
def upload_files(self,
|
|
65
|
+
repo: str,
|
|
66
|
+
body_params: dto.UploadRequestParams,
|
|
67
|
+
) -> dto.UploadAssetsResponse:
|
|
68
|
+
u = "/%s/-/upload/files" % (repo, )
|
|
69
|
+
|
|
70
|
+
data = self._client.request(
|
|
71
|
+
method="POST",
|
|
72
|
+
endpoint=u,
|
|
73
|
+
json=body_params.to_dict(),
|
|
74
|
+
)
|
|
75
|
+
return dto.UploadAssetsResponse.safe_parse(data)
|
|
76
|
+
|
|
77
|
+
# 发起一个上传 imgs 的请求,返回上传文件的url,请使用 put 发起流式上传。Initiate a request to upload images,returns upload URL.Use PUT to initiate a stream upload.
|
|
78
|
+
def upload_imgs(self,
|
|
79
|
+
repo: str,
|
|
80
|
+
body_params: dto.UploadRequestParams,
|
|
81
|
+
) -> dto.UploadAssetsResponse:
|
|
82
|
+
u = "/%s/-/upload/imgs" % (repo, )
|
|
83
|
+
|
|
84
|
+
data = self._client.request(
|
|
85
|
+
method="POST",
|
|
86
|
+
endpoint=u,
|
|
87
|
+
json=body_params.to_dict(),
|
|
88
|
+
)
|
|
89
|
+
return dto.UploadAssetsResponse.safe_parse(data)
|
|
90
|
+
|
|
91
|
+
|
|
@@ -9,31 +9,18 @@ class BuildService:
|
|
|
9
9
|
def __init__(self, client):
|
|
10
10
|
self._client = client
|
|
11
11
|
|
|
12
|
-
# 同步仓库分支下的定时任务。 Synchronize the content under the repository branch.
|
|
13
|
-
def build_crontab_sync(self,
|
|
14
|
-
repo: str,
|
|
15
|
-
branch: str,
|
|
16
|
-
) -> dto.BuildCommonResult:
|
|
17
|
-
u = "/%s/-/build/crontab/sync/%s" % (repo, branch, )
|
|
18
|
-
|
|
19
|
-
data = self._client.request(
|
|
20
|
-
method="POST",
|
|
21
|
-
endpoint=u,
|
|
22
|
-
)
|
|
23
|
-
return dto.BuildCommonResult.safe_parse(data)
|
|
24
|
-
|
|
25
12
|
# 删除流水线日志内容。Delete pipeline logs content.
|
|
26
13
|
def build_logs_delete(self,
|
|
27
14
|
repo: str,
|
|
28
15
|
sn: str,
|
|
29
|
-
) -> dto.
|
|
16
|
+
) -> dto.BuildLogsDeleteResult:
|
|
30
17
|
u = "/%s/-/build/logs/%s" % (repo, sn, )
|
|
31
18
|
|
|
32
19
|
data = self._client.request(
|
|
33
20
|
method="DELETE",
|
|
34
21
|
endpoint=u,
|
|
35
22
|
)
|
|
36
|
-
return dto.
|
|
23
|
+
return dto.BuildLogsDeleteResult.safe_parse(data)
|
|
37
24
|
|
|
38
25
|
# 流水线runner日志下载。Pipeline runner log download.
|
|
39
26
|
def build_runner_download_log(self,
|
|
@@ -3,17 +3,18 @@
|
|
|
3
3
|
# cnb-sdk-generator: 1.0.2
|
|
4
4
|
# source: https://api.cnb-dev.woa.com/swagger.json
|
|
5
5
|
from .activities import ActivitiesService
|
|
6
|
-
from .
|
|
6
|
+
from .ai import AiService
|
|
7
|
+
from .assets import AssetsService
|
|
7
8
|
from .badge import BadgeService
|
|
8
9
|
from .build import BuildService
|
|
9
|
-
from .
|
|
10
|
+
from .collaborators import CollaboratorsService
|
|
11
|
+
from .contributors import ContributorsService
|
|
10
12
|
from .event import EventService
|
|
11
13
|
from .followers import FollowersService
|
|
12
14
|
from .git import GitService
|
|
13
15
|
from .gitsettings import GitsettingsService
|
|
14
16
|
from .issues import IssuesService
|
|
15
17
|
from .knowledgebase import KnowledgebaseService
|
|
16
|
-
from .members import MembersService
|
|
17
18
|
from .missions import MissionsService
|
|
18
19
|
from .organizations import OrganizationsService
|
|
19
20
|
from .pulls import PullsService
|
|
@@ -32,16 +33,17 @@ class CNBServices:
|
|
|
32
33
|
self.client = client
|
|
33
34
|
self.activities = ActivitiesService(client)
|
|
34
35
|
self.ai = AiService(client)
|
|
36
|
+
self.assets = AssetsService(client)
|
|
35
37
|
self.badge = BadgeService(client)
|
|
36
38
|
self.build = BuildService(client)
|
|
37
|
-
self.
|
|
39
|
+
self.collaborators = CollaboratorsService(client)
|
|
40
|
+
self.contributors = ContributorsService(client)
|
|
38
41
|
self.event = EventService(client)
|
|
39
42
|
self.followers = FollowersService(client)
|
|
40
43
|
self.git = GitService(client)
|
|
41
44
|
self.gitsettings = GitsettingsService(client)
|
|
42
45
|
self.issues = IssuesService(client)
|
|
43
46
|
self.knowledgebase = KnowledgebaseService(client)
|
|
44
|
-
self.members = MembersService(client)
|
|
45
47
|
self.missions = MissionsService(client)
|
|
46
48
|
self.organizations = OrganizationsService(client)
|
|
47
49
|
self.pulls = PullsService(client)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
from typing import Optional
|
|
7
7
|
from .models import dto
|
|
8
|
-
class
|
|
8
|
+
class CollaboratorsService:
|
|
9
9
|
def __init__(self, client):
|
|
10
10
|
self._client = client
|
|
11
11
|
|
|
@@ -69,7 +69,7 @@ class MembersService:
|
|
|
69
69
|
)
|
|
70
70
|
return
|
|
71
71
|
|
|
72
|
-
#
|
|
72
|
+
# 删除指定组织或仓库的直接成员。Remove direct members from specified organization/repository.
|
|
73
73
|
def delete_members_of_group(self,
|
|
74
74
|
group: str,
|
|
75
75
|
username: str,
|
|
@@ -82,7 +82,7 @@ class MembersService:
|
|
|
82
82
|
)
|
|
83
83
|
return
|
|
84
84
|
|
|
85
|
-
#
|
|
85
|
+
# 删除指定组织或仓库的直接成员。Remove direct members from specified organization/repository.
|
|
86
86
|
def delete_members_of_repo(self,
|
|
87
87
|
repo: str,
|
|
88
88
|
username: str,
|
|
@@ -108,40 +108,6 @@ class MembersService:
|
|
|
108
108
|
)
|
|
109
109
|
return
|
|
110
110
|
|
|
111
|
-
# 获取指定组织内, 访问成员在当前层级内的权限信息。Get permission information for accessing members at current level.
|
|
112
|
-
def get_member_access_level_of_group(self,
|
|
113
|
-
group: str,
|
|
114
|
-
include_inherit: Optional[bool] = None,
|
|
115
|
-
) -> dto.MemberAccessLevelInSlugUnion:
|
|
116
|
-
u = "/%s/-/members/access-level" % (group, )
|
|
117
|
-
|
|
118
|
-
query_params = {
|
|
119
|
-
"include_inherit": include_inherit,
|
|
120
|
-
}
|
|
121
|
-
data = self._client.request(
|
|
122
|
-
method="GET",
|
|
123
|
-
endpoint=u,
|
|
124
|
-
params=query_params,
|
|
125
|
-
)
|
|
126
|
-
return dto.MemberAccessLevelInSlugUnion.safe_parse(data)
|
|
127
|
-
|
|
128
|
-
# 获取指定仓库内, 访问成员在当前层级内的权限信息。Get permission information for accessing members at current level.
|
|
129
|
-
def get_member_access_level_of_repo(self,
|
|
130
|
-
repo: str,
|
|
131
|
-
include_inherit: Optional[bool] = None,
|
|
132
|
-
) -> dto.MemberAccessLevelInSlugUnion:
|
|
133
|
-
u = "/%s/-/members/access-level" % (repo, )
|
|
134
|
-
|
|
135
|
-
query_params = {
|
|
136
|
-
"include_inherit": include_inherit,
|
|
137
|
-
}
|
|
138
|
-
data = self._client.request(
|
|
139
|
-
method="GET",
|
|
140
|
-
endpoint=u,
|
|
141
|
-
params=query_params,
|
|
142
|
-
)
|
|
143
|
-
return dto.MemberAccessLevelInSlugUnion.safe_parse(data)
|
|
144
|
-
|
|
145
111
|
# 获取指定仓库内的有效成员列表,包含继承成员。List active members in specified repository including inherited members.
|
|
146
112
|
def list_all_members(self,
|
|
147
113
|
slug: str,
|
|
@@ -171,7 +137,7 @@ class MembersService:
|
|
|
171
137
|
)
|
|
172
138
|
return [dto.UsersWithAccessLevelInSlug.safe_parse(item) for item in data]
|
|
173
139
|
|
|
174
|
-
#
|
|
140
|
+
# 获取指定组织或仓库内的继承成员。List inherited members within specified organization or repository。
|
|
175
141
|
def list_inherit_members_of_group(self,
|
|
176
142
|
group: str,
|
|
177
143
|
search: Optional[str] = None,
|
|
@@ -194,7 +160,7 @@ class MembersService:
|
|
|
194
160
|
)
|
|
195
161
|
return [dto.ListInheritMembers.safe_parse(item) for item in data]
|
|
196
162
|
|
|
197
|
-
#
|
|
163
|
+
# 获取指定组织或仓库内的继承成员。List inherited members within specified organization or repository。
|
|
198
164
|
def list_inherit_members_of_repo(self,
|
|
199
165
|
repo: str,
|
|
200
166
|
search: Optional[str] = None,
|
|
@@ -217,33 +183,7 @@ class MembersService:
|
|
|
217
183
|
)
|
|
218
184
|
return [dto.ListInheritMembers.safe_parse(item) for item in data]
|
|
219
185
|
|
|
220
|
-
#
|
|
221
|
-
def list_member_access_level_of_group(self,
|
|
222
|
-
group: str,
|
|
223
|
-
username: str,
|
|
224
|
-
) -> list[dto.MemberAccessLevel]:
|
|
225
|
-
u = "/%s/-/members/%s/access-level" % (group, username, )
|
|
226
|
-
|
|
227
|
-
data = self._client.request(
|
|
228
|
-
method="GET",
|
|
229
|
-
endpoint=u,
|
|
230
|
-
)
|
|
231
|
-
return [dto.MemberAccessLevel.safe_parse(item) for item in data]
|
|
232
|
-
|
|
233
|
-
# 获取指定仓库内指定成员的权限信息, 结果按组织层级来展示, 包含上层组织的权限继承信息。Get specified member's permissions with organizational hierarchy.
|
|
234
|
-
def list_member_access_level_of_repo(self,
|
|
235
|
-
repo: str,
|
|
236
|
-
username: str,
|
|
237
|
-
) -> list[dto.MemberAccessLevel]:
|
|
238
|
-
u = "/%s/-/members/%s/access-level" % (repo, username, )
|
|
239
|
-
|
|
240
|
-
data = self._client.request(
|
|
241
|
-
method="GET",
|
|
242
|
-
endpoint=u,
|
|
243
|
-
)
|
|
244
|
-
return [dto.MemberAccessLevel.safe_parse(item) for item in data]
|
|
245
|
-
|
|
246
|
-
# 获取指定组织内的所有直接成员。List all direct members within specified organization.
|
|
186
|
+
# 获取指定组织或仓库内的所有直接成员。List all direct members within specified organization or repository.
|
|
247
187
|
def list_members_of_group(self,
|
|
248
188
|
group: str,
|
|
249
189
|
page: Optional[int] = None,
|
|
@@ -266,7 +206,7 @@ class MembersService:
|
|
|
266
206
|
)
|
|
267
207
|
return [dto.UsersWithAccessLevelInSlug.safe_parse(item) for item in data]
|
|
268
208
|
|
|
269
|
-
#
|
|
209
|
+
# 获取指定组织或仓库内的所有直接成员。List all direct members within specified organization or repository.
|
|
270
210
|
def list_members_of_repo(self,
|
|
271
211
|
repo: str,
|
|
272
212
|
page: Optional[int] = None,
|
|
@@ -312,7 +252,24 @@ class MembersService:
|
|
|
312
252
|
)
|
|
313
253
|
return [dto.OutsideCollaboratorInRepo.safe_parse(item) for item in data]
|
|
314
254
|
|
|
315
|
-
#
|
|
255
|
+
# 获取 top 贡献用户。List the top contributing users
|
|
256
|
+
def top_contributors(self,
|
|
257
|
+
slug: str,
|
|
258
|
+
top: Optional[int] = None,
|
|
259
|
+
) -> list[dto.UsersResult]:
|
|
260
|
+
u = "/%s/-/top-activity-users" % (slug, )
|
|
261
|
+
|
|
262
|
+
query_params = {
|
|
263
|
+
"top": top,
|
|
264
|
+
}
|
|
265
|
+
data = self._client.request(
|
|
266
|
+
method="GET",
|
|
267
|
+
endpoint=u,
|
|
268
|
+
params=query_params,
|
|
269
|
+
)
|
|
270
|
+
return [dto.UsersResult.safe_parse(item) for item in data]
|
|
271
|
+
|
|
272
|
+
# 更新指定组织或仓库内的直接成员权限信息。Update permission information for direct members in specified organization/repository.
|
|
316
273
|
def update_members_of_group(self,
|
|
317
274
|
group: str,
|
|
318
275
|
username: str,
|
|
@@ -327,7 +284,7 @@ class MembersService:
|
|
|
327
284
|
)
|
|
328
285
|
return
|
|
329
286
|
|
|
330
|
-
#
|
|
287
|
+
# 更新指定组织或仓库内的直接成员权限信息。Update permission information for direct members in specified organization/repository.
|
|
331
288
|
def update_members_of_repo(self,
|
|
332
289
|
repo: str,
|
|
333
290
|
username: str,
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Code generated by cnb.cool/cnb/sdk/cnb-sdk-generator. DO NOT EDIT.
|
|
2
|
+
# versions:
|
|
3
|
+
# cnb-sdk-generator: 1.0.2
|
|
4
|
+
# source: https://api.cnb-dev.woa.com/swagger.json
|
|
5
|
+
|
|
6
|
+
from typing import Optional
|
|
7
|
+
from .models import dto
|
|
8
|
+
class ContributorsService:
|
|
9
|
+
def __init__(self, client):
|
|
10
|
+
self._client = client
|
|
11
|
+
|
|
12
|
+
# 获取指定组织或仓库内, 访问成员在当前层级内的权限信息。Get permission information for accessing members at current level.
|
|
13
|
+
def get_member_access_level_of_group(self,
|
|
14
|
+
group: str,
|
|
15
|
+
include_inherit: Optional[bool] = None,
|
|
16
|
+
) -> dto.MemberAccessLevelInSlugUnion:
|
|
17
|
+
u = "/%s/-/members/access-level" % (group, )
|
|
18
|
+
|
|
19
|
+
query_params = {
|
|
20
|
+
"include_inherit": include_inherit,
|
|
21
|
+
}
|
|
22
|
+
data = self._client.request(
|
|
23
|
+
method="GET",
|
|
24
|
+
endpoint=u,
|
|
25
|
+
params=query_params,
|
|
26
|
+
)
|
|
27
|
+
return dto.MemberAccessLevelInSlugUnion.safe_parse(data)
|
|
28
|
+
|
|
29
|
+
# 获取指定组织或仓库内, 访问成员在当前层级内的权限信息。Get permission information for accessing members at current level.
|
|
30
|
+
def get_member_access_level_of_repo(self,
|
|
31
|
+
repo: str,
|
|
32
|
+
include_inherit: Optional[bool] = None,
|
|
33
|
+
) -> dto.MemberAccessLevelInSlugUnion:
|
|
34
|
+
u = "/%s/-/members/access-level" % (repo, )
|
|
35
|
+
|
|
36
|
+
query_params = {
|
|
37
|
+
"include_inherit": include_inherit,
|
|
38
|
+
}
|
|
39
|
+
data = self._client.request(
|
|
40
|
+
method="GET",
|
|
41
|
+
endpoint=u,
|
|
42
|
+
params=query_params,
|
|
43
|
+
)
|
|
44
|
+
return dto.MemberAccessLevelInSlugUnion.safe_parse(data)
|
|
45
|
+
|
|
46
|
+
# 获取指定组织或仓库内指定成员的权限信息, 结果按组织层级来展示, 包含上层组织的权限继承信息。Get specified member's permissions with organizational hierarchy.
|
|
47
|
+
def list_member_access_level_of_group(self,
|
|
48
|
+
group: str,
|
|
49
|
+
username: str,
|
|
50
|
+
) -> list[dto.MemberAccessLevel]:
|
|
51
|
+
u = "/%s/-/members/%s/access-level" % (group, username, )
|
|
52
|
+
|
|
53
|
+
data = self._client.request(
|
|
54
|
+
method="GET",
|
|
55
|
+
endpoint=u,
|
|
56
|
+
)
|
|
57
|
+
return [dto.MemberAccessLevel.safe_parse(item) for item in data]
|
|
58
|
+
|
|
59
|
+
# 获取指定组织或仓库内指定成员的权限信息, 结果按组织层级来展示, 包含上层组织的权限继承信息。Get specified member's permissions with organizational hierarchy.
|
|
60
|
+
def list_member_access_level_of_repo(self,
|
|
61
|
+
repo: str,
|
|
62
|
+
username: str,
|
|
63
|
+
) -> list[dto.MemberAccessLevel]:
|
|
64
|
+
u = "/%s/-/members/%s/access-level" % (repo, username, )
|
|
65
|
+
|
|
66
|
+
data = self._client.request(
|
|
67
|
+
method="GET",
|
|
68
|
+
endpoint=u,
|
|
69
|
+
)
|
|
70
|
+
return [dto.MemberAccessLevel.safe_parse(item) for item in data]
|
|
71
|
+
|
|
72
|
+
|
|
@@ -213,25 +213,6 @@ class GitService:
|
|
|
213
213
|
)
|
|
214
214
|
return [web.CommitAnnotationInBatch.safe_parse(item) for item in data]
|
|
215
215
|
|
|
216
|
-
# 发起一个获取 commits 附件的请求, 302到有一定效期的下载地址。Get a request to fetch a commit assets and returns 302 redirect to the assets URL with specific valid time.
|
|
217
|
-
def get_commit_assets(self,
|
|
218
|
-
repo: str,
|
|
219
|
-
commit_id: str,
|
|
220
|
-
filename: str,
|
|
221
|
-
share: Optional[bool] = None,
|
|
222
|
-
):
|
|
223
|
-
u = "/%s/-/commit-assets/download/%s/%s" % (repo, commit_id, filename, )
|
|
224
|
-
|
|
225
|
-
query_params = {
|
|
226
|
-
"share": share,
|
|
227
|
-
}
|
|
228
|
-
data = self._client.request(
|
|
229
|
-
method="GET",
|
|
230
|
-
endpoint=u,
|
|
231
|
-
params=query_params,
|
|
232
|
-
)
|
|
233
|
-
return
|
|
234
|
-
|
|
235
216
|
# 查询指定 commit 的附件。List commit assets.
|
|
236
217
|
def get_commit_assets_by_sha(self,
|
|
237
218
|
repo: str,
|
|
@@ -318,24 +299,6 @@ class GitService:
|
|
|
318
299
|
)
|
|
319
300
|
return openapi.HeadRef.safe_parse(data)
|
|
320
301
|
|
|
321
|
-
# 获取 git lfs 文件下载链接
|
|
322
|
-
def get_presigned_lfsdownload_link(self,
|
|
323
|
-
slug: str,
|
|
324
|
-
oid: str,
|
|
325
|
-
name: Optional[str] = None,
|
|
326
|
-
):
|
|
327
|
-
u = "/%s/-/lfs/%s" % (slug, oid, )
|
|
328
|
-
|
|
329
|
-
query_params = {
|
|
330
|
-
"name": name,
|
|
331
|
-
}
|
|
332
|
-
data = self._client.request(
|
|
333
|
-
method="GET",
|
|
334
|
-
endpoint=u,
|
|
335
|
-
params=query_params,
|
|
336
|
-
)
|
|
337
|
-
return
|
|
338
|
-
|
|
339
302
|
# 获得仓库指定文件内容
|
|
340
303
|
def get_raw(self,
|
|
341
304
|
repo: str,
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
from typing import Optional
|
|
7
7
|
from .models import api
|
|
8
|
+
from .models import web
|
|
8
9
|
class GitsettingsService:
|
|
9
10
|
def __init__(self, client):
|
|
10
11
|
self._client = client
|
|
@@ -115,7 +116,7 @@ class GitsettingsService:
|
|
|
115
116
|
# 更新仓库云原生构建设置。Update pipeline settings.
|
|
116
117
|
def put_pipeline_settings(self,
|
|
117
118
|
repo: str,
|
|
118
|
-
body_params:
|
|
119
|
+
body_params: web.PipelineSettings,
|
|
119
120
|
):
|
|
120
121
|
u = "/%s/-/settings/cloud-native-build" % (repo, )
|
|
121
122
|
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
from typing import Optional
|
|
7
7
|
from .models import api
|
|
8
8
|
from .models import git_woa_com_cnb_monorepo_git_internal_app_vcs_service_bff_api
|
|
9
|
-
from .models import openapi
|
|
10
9
|
class IssuesService:
|
|
11
10
|
def __init__(self, client):
|
|
12
11
|
self._client = client
|
|
@@ -39,21 +38,6 @@ class IssuesService:
|
|
|
39
38
|
)
|
|
40
39
|
return api.IssueDetail.safe_parse(data)
|
|
41
40
|
|
|
42
|
-
# 批量设置Issue自定义属性值
|
|
43
|
-
def create_issue_properties(self,
|
|
44
|
-
repo: str,
|
|
45
|
-
number: str,
|
|
46
|
-
body_params: openapi.IssuePropertiesForm,
|
|
47
|
-
):
|
|
48
|
-
u = "/%s/-/issues/%s/property" % (repo, number, )
|
|
49
|
-
|
|
50
|
-
data = self._client.request(
|
|
51
|
-
method="POST",
|
|
52
|
-
endpoint=u,
|
|
53
|
-
json=body_params.to_dict(),
|
|
54
|
-
)
|
|
55
|
-
return
|
|
56
|
-
|
|
57
41
|
# 删除 issue 中的处理人。 Removes one or more assignees from an issue.
|
|
58
42
|
def delete_issue_assignees(self,
|
|
59
43
|
repo: str,
|
|
@@ -185,7 +169,6 @@ class IssuesService:
|
|
|
185
169
|
keyword: Optional[str] = None,
|
|
186
170
|
priority: Optional[str] = None,
|
|
187
171
|
labels: Optional[str] = None,
|
|
188
|
-
labels_operator: Optional[str] = None,
|
|
189
172
|
authors: Optional[str] = None,
|
|
190
173
|
assignees: Optional[str] = None,
|
|
191
174
|
updated_time_begin: Optional[str] = None,
|
|
@@ -203,7 +186,6 @@ class IssuesService:
|
|
|
203
186
|
"keyword": keyword,
|
|
204
187
|
"priority": priority,
|
|
205
188
|
"labels": labels,
|
|
206
|
-
"labels_operator": labels_operator,
|
|
207
189
|
"authors": authors,
|
|
208
190
|
"assignees": assignees,
|
|
209
191
|
"updated_time_begin": updated_time_begin,
|
|
@@ -54,7 +54,6 @@ class CommitAsset(CNBBaseModel):
|
|
|
54
54
|
author: Optional['git_woa_com_cnb_monorepo_git_internal_app_git_service_bff_api.UserInfo'] = Field(alias="author", default=None)
|
|
55
55
|
content_type: Optional[str] = Field(alias="content_type", default=None)
|
|
56
56
|
created_at: Optional[str] = Field(alias="created_at", default=None)
|
|
57
|
-
download_count: Optional[int] = Field(alias="download_count", default=None)
|
|
58
57
|
id: Optional[str] = Field(alias="id", default=None)
|
|
59
58
|
name: Optional[str] = Field(alias="name", default=None)
|
|
60
59
|
path: Optional[str] = Field(alias="path", default=None)
|
|
@@ -285,7 +284,6 @@ class Pull(CNBBaseModel):
|
|
|
285
284
|
body: Optional[str] = Field(alias="body", default=None)
|
|
286
285
|
head: Optional['PullRef'] = Field(alias="head", default=None)
|
|
287
286
|
is_wip: Optional[bool] = Field(alias="is_wip", default=None)
|
|
288
|
-
labels: Optional[list['Label']] = Field(alias="labels", default=None)
|
|
289
287
|
merged_by: Optional['git_woa_com_cnb_monorepo_git_internal_app_git_service_bff_api.UserInfo'] = Field(alias="merged_by", default=None)
|
|
290
288
|
number: Optional[str] = Field(alias="number", default=None)
|
|
291
289
|
reviewers: Optional[list['PullReviewer']] = Field(alias="reviewers", default=None)
|
|
@@ -332,7 +330,6 @@ class PullRequest(CNBBaseModel):
|
|
|
332
330
|
created_at: Optional[str] = Field(alias="created_at", default=None)
|
|
333
331
|
head: Optional['PullRef'] = Field(alias="head", default=None)
|
|
334
332
|
is_wip: Optional[bool] = Field(alias="is_wip", default=None)
|
|
335
|
-
labels: Optional[list['Label']] = Field(alias="labels", default=None)
|
|
336
333
|
last_acted_at: Optional[str] = Field(alias="last_acted_at", default=None)
|
|
337
334
|
mergeable_state: Optional[str] = Field(alias="mergeable_state", default=None)
|
|
338
335
|
merged_by: Optional['git_woa_com_cnb_monorepo_git_internal_app_git_service_bff_api.UserInfo'] = Field(alias="merged_by", default=None)
|
|
@@ -357,7 +354,6 @@ class PullRequestInfo(CNBBaseModel):
|
|
|
357
354
|
blocked_on: Optional[str] = Field(alias="blocked_on", default=None)
|
|
358
355
|
created_at: Optional[str] = Field(alias="created_at", default=None)
|
|
359
356
|
head: Optional['PullRefInfo'] = Field(alias="head", default=None)
|
|
360
|
-
labels: Optional[list['Label']] = Field(alias="labels", default=None)
|
|
361
357
|
last_acted_at: Optional[str] = Field(alias="last_acted_at", default=None)
|
|
362
358
|
mergeable_state: Optional[str] = Field(alias="mergeable_state", default=None)
|
|
363
359
|
merged_by: Optional['git_woa_com_cnb_monorepo_git_internal_app_vcs_service_bff_api.UserInfo'] = Field(alias="merged_by", default=None)
|
|
@@ -448,17 +444,14 @@ class Release(CNBBaseModel):
|
|
|
448
444
|
updated_at: Optional[str] = Field(alias="updated_at", default=None)
|
|
449
445
|
pass
|
|
450
446
|
class ReleaseAsset(CNBBaseModel):
|
|
451
|
-
brower_download_url: Optional[str] = Field(alias="brower_download_url", default=None)
|
|
452
447
|
content_type: Optional[str] = Field(alias="content_type", default=None)
|
|
453
448
|
created_at: Optional[str] = Field(alias="created_at", default=None)
|
|
454
|
-
download_count: Optional[int] = Field(alias="download_count", default=None)
|
|
455
449
|
id: Optional[str] = Field(alias="id", default=None)
|
|
456
450
|
name: Optional[str] = Field(alias="name", default=None)
|
|
457
451
|
path: Optional[str] = Field(alias="path", default=None)
|
|
458
452
|
size: Optional[int] = Field(alias="size", default=None)
|
|
459
453
|
updated_at: Optional[str] = Field(alias="updated_at", default=None)
|
|
460
454
|
uploader: Optional['git_woa_com_cnb_monorepo_git_internal_app_git_service_bff_api.UserInfo'] = Field(alias="uploader", default=None)
|
|
461
|
-
url: Optional[str] = Field(alias="url", default=None)
|
|
462
455
|
pass
|
|
463
456
|
class Repo(CNBBaseModel):
|
|
464
457
|
id: Optional[str] = Field(alias="id", default=None)
|
|
@@ -54,9 +54,7 @@ class ActivitySlugDetail(CNBBaseModel):
|
|
|
54
54
|
class AiAutoPrReq(CNBBaseModel):
|
|
55
55
|
body: Optional[str] = Field(alias="body", default=None)
|
|
56
56
|
branch: Optional[str] = Field(alias="branch", default=None)
|
|
57
|
-
source: Optional[str] = Field(alias="source", default=None)
|
|
58
57
|
title: Optional[str] = Field(alias="title", default=None)
|
|
59
|
-
url: Optional[str] = Field(alias="url", default=None)
|
|
60
58
|
pass
|
|
61
59
|
class AiAutoPrResult(CNBBaseModel):
|
|
62
60
|
buildLogUrl: Optional[str] = Field(alias="buildLogUrl", default=None)
|
|
@@ -100,7 +98,7 @@ class BadgeGroup(CNBBaseModel):
|
|
|
100
98
|
type: Optional[str] = Field(alias="type", default=None)
|
|
101
99
|
typeEn: Optional[str] = Field(alias="typeEn", default=None)
|
|
102
100
|
pass
|
|
103
|
-
class
|
|
101
|
+
class BuildLogsDeleteResult(CNBBaseModel):
|
|
104
102
|
code: Optional[int] = Field(alias="code", default=None)
|
|
105
103
|
message: Optional[str] = Field(alias="message", default=None)
|
|
106
104
|
pass
|
|
@@ -114,7 +112,6 @@ class BuildResult(CNBBaseModel):
|
|
|
114
112
|
buildLogUrl: Optional[str] = Field(alias="buildLogUrl", default=None)
|
|
115
113
|
message: Optional[str] = Field(alias="message", default=None)
|
|
116
114
|
sn: Optional[str] = Field(alias="sn", default=None)
|
|
117
|
-
success: Optional[bool] = Field(alias="success", default=None)
|
|
118
115
|
pass
|
|
119
116
|
class BuildStageResult(CNBBaseModel):
|
|
120
117
|
content: Optional[list[str]] = Field(alias="content", default=None)
|
|
@@ -314,7 +311,6 @@ class ContainerTag(CNBBaseModel):
|
|
|
314
311
|
name: Optional[str] = Field(alias="name", default=None)
|
|
315
312
|
pull_count: Optional[int] = Field(alias="pull_count", default=None)
|
|
316
313
|
recent_pull_count: Optional[int] = Field(alias="recent_pull_count", default=None)
|
|
317
|
-
type: Optional[str] = Field(alias="type", default=None)
|
|
318
314
|
pass
|
|
319
315
|
class ContainerTagDetail(CNBBaseModel):
|
|
320
316
|
address: Optional[str] = Field(alias="address", default=None)
|
|
@@ -945,26 +941,6 @@ class Slugs(CNBBaseModel):
|
|
|
945
941
|
root_id: Optional[int] = Field(alias="root_id", default=None)
|
|
946
942
|
updated_at: Optional[str] = Field(alias="updated_at", default=None)
|
|
947
943
|
pass
|
|
948
|
-
class SpecialAmount(CNBBaseModel):
|
|
949
|
-
compute_build_corehour: Optional[int] = Field(alias="compute_build_corehour", default=None)
|
|
950
|
-
compute_build_desc: Optional[str] = Field(alias="compute_build_desc", default=None)
|
|
951
|
-
compute_build_expire: Optional[str] = Field(alias="compute_build_expire", default=None)
|
|
952
|
-
compute_build_gpu_corehour: Optional[int] = Field(alias="compute_build_gpu_corehour", default=None)
|
|
953
|
-
compute_build_gpu_desc: Optional[str] = Field(alias="compute_build_gpu_desc", default=None)
|
|
954
|
-
compute_build_gpu_expire: Optional[str] = Field(alias="compute_build_gpu_expire", default=None)
|
|
955
|
-
compute_develop_corehour: Optional[int] = Field(alias="compute_develop_corehour", default=None)
|
|
956
|
-
compute_develop_desc: Optional[str] = Field(alias="compute_develop_desc", default=None)
|
|
957
|
-
compute_develop_expire: Optional[str] = Field(alias="compute_develop_expire", default=None)
|
|
958
|
-
compute_develop_gpu_corehour: Optional[int] = Field(alias="compute_develop_gpu_corehour", default=None)
|
|
959
|
-
compute_develop_gpu_desc: Optional[str] = Field(alias="compute_develop_gpu_desc", default=None)
|
|
960
|
-
compute_develop_gpu_expire: Optional[str] = Field(alias="compute_develop_gpu_expire", default=None)
|
|
961
|
-
storage_git_desc: Optional[str] = Field(alias="storage_git_desc", default=None)
|
|
962
|
-
storage_git_expire: Optional[str] = Field(alias="storage_git_expire", default=None)
|
|
963
|
-
storage_git_gib: Optional[int] = Field(alias="storage_git_gib", default=None)
|
|
964
|
-
storage_object_desc: Optional[str] = Field(alias="storage_object_desc", default=None)
|
|
965
|
-
storage_object_expire: Optional[str] = Field(alias="storage_object_expire", default=None)
|
|
966
|
-
storage_object_gib: Optional[int] = Field(alias="storage_object_gib", default=None)
|
|
967
|
-
pass
|
|
968
944
|
class Stage(CNBBaseModel):
|
|
969
945
|
duration: Optional[int] = Field(alias="duration", default=None)
|
|
970
946
|
id: Optional[str] = Field(alias="id", default=None)
|
|
@@ -20,9 +20,6 @@ class HeadRef(CNBBaseModel):
|
|
|
20
20
|
name: Optional[str] = Field(alias="name", default=None)
|
|
21
21
|
protected: Optional[bool] = Field(alias="protected", default=None)
|
|
22
22
|
pass
|
|
23
|
-
class IssuePropertiesForm(CNBBaseModel):
|
|
24
|
-
properties: Optional[list['PropertyForm']] = Field(alias="properties", default=None)
|
|
25
|
-
pass
|
|
26
23
|
class PatchReleaseForm(CNBBaseModel):
|
|
27
24
|
body: Optional[str] = Field(alias="body", default=None)
|
|
28
25
|
draft: Optional[bool] = Field(alias="draft", default=None)
|
|
@@ -48,10 +45,6 @@ class PostReleaseForm(CNBBaseModel):
|
|
|
48
45
|
tag_name: Optional[str] = Field(alias="tag_name", default=None)
|
|
49
46
|
target_commitish: Optional[str] = Field(alias="target_commitish", default=None)
|
|
50
47
|
pass
|
|
51
|
-
class PropertyForm(CNBBaseModel):
|
|
52
|
-
key: Optional[str] = Field(alias="key", default=None)
|
|
53
|
-
value: Optional[str] = Field(alias="value", default=None)
|
|
54
|
-
pass
|
|
55
48
|
class PutCommitAnnotation(CNBBaseModel):
|
|
56
49
|
key: Optional[str] = Field(alias="key", default=None)
|
|
57
50
|
value: Optional[str] = Field(alias="value", default=None)
|
|
@@ -29,7 +29,5 @@ class SettingValue(Enum):
|
|
|
29
29
|
PreventRegistryTransfer = "prevent_registry_transfer"
|
|
30
30
|
UseGroupGitQuota = "use_group_git_quota"
|
|
31
31
|
UseGroupGitObjectLimit = "use_group_git_object_limit"
|
|
32
|
-
|
|
32
|
+
EnableAddMember = "enable_add_member"
|
|
33
33
|
UseRootGroupGitPushLimit = "use_root_group_git_push_limit"
|
|
34
|
-
enableAddMember = "enable_add_member"
|
|
35
|
-
enableChangeMemberRoleOnlyRoot = "enable_change_member_role_only_root"
|
|
@@ -34,6 +34,10 @@ class Meta(CNBBaseModel):
|
|
|
34
34
|
gen_hash: Optional[str] = Field(alias="gen_hash", default=None)
|
|
35
35
|
updated_at: Optional[str] = Field(alias="updated_at", default=None)
|
|
36
36
|
pass
|
|
37
|
+
class PipelineSettings(CNBBaseModel):
|
|
38
|
+
auto_trigger: Optional[bool] = Field(alias="auto_trigger", default=None)
|
|
39
|
+
forked_repo_auto_trigger: Optional[bool] = Field(alias="forked_repo_auto_trigger", default=None)
|
|
40
|
+
pass
|
|
37
41
|
class RepoContribTrend(CNBBaseModel):
|
|
38
42
|
meta: Optional['Meta'] = Field(alias="meta", default=None)
|
|
39
43
|
repo_data: Optional[list['Week']] = Field(alias="repo_data", default=None)
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
from typing import Optional
|
|
7
7
|
from .models import api
|
|
8
|
-
from .models import dto
|
|
9
8
|
from .models import git_woa_com_cnb_monorepo_git_internal_app_git_service_bff_api
|
|
10
9
|
class PullsService:
|
|
11
10
|
def __init__(self, client):
|
|
@@ -127,7 +126,7 @@ class PullsService:
|
|
|
127
126
|
)
|
|
128
127
|
return [api.PullRequestComment.safe_parse(item) for item in data]
|
|
129
128
|
|
|
130
|
-
# 查询 Pull
|
|
129
|
+
# 查询 Pull 的状态检查
|
|
131
130
|
def list_pull_commit_statuses(self,
|
|
132
131
|
repo: str,
|
|
133
132
|
number: str,
|
|
@@ -243,8 +242,6 @@ class PullsService:
|
|
|
243
242
|
authors: Optional[str] = None,
|
|
244
243
|
reviewers: Optional[str] = None,
|
|
245
244
|
assignees: Optional[str] = None,
|
|
246
|
-
labels: Optional[str] = None,
|
|
247
|
-
labels_operator: Optional[str] = None,
|
|
248
245
|
base_ref: Optional[str] = None,
|
|
249
246
|
) -> list[api.PullRequest]:
|
|
250
247
|
u = "/%s/-/pulls" % (repo, )
|
|
@@ -256,8 +253,6 @@ class PullsService:
|
|
|
256
253
|
"authors": authors,
|
|
257
254
|
"reviewers": reviewers,
|
|
258
255
|
"assignees": assignees,
|
|
259
|
-
"labels": labels,
|
|
260
|
-
"labels_operator": labels_operator,
|
|
261
256
|
"base_ref": base_ref,
|
|
262
257
|
}
|
|
263
258
|
data = self._client.request(
|
|
@@ -419,32 +414,4 @@ class PullsService:
|
|
|
419
414
|
)
|
|
420
415
|
return api.Label.safe_parse(data)
|
|
421
416
|
|
|
422
|
-
# 发起一个上传 files 的请求,返回上传文件的url,请使用 put 发起流式上传。Initiate a request to upload files,returns upload URL.Use PUT to initiate a stream upload.
|
|
423
|
-
def upload_files(self,
|
|
424
|
-
repo: str,
|
|
425
|
-
body_params: dto.UploadRequestParams,
|
|
426
|
-
) -> dto.UploadAssetsResponse:
|
|
427
|
-
u = "/%s/-/upload/files" % (repo, )
|
|
428
|
-
|
|
429
|
-
data = self._client.request(
|
|
430
|
-
method="POST",
|
|
431
|
-
endpoint=u,
|
|
432
|
-
json=body_params.to_dict(),
|
|
433
|
-
)
|
|
434
|
-
return dto.UploadAssetsResponse.safe_parse(data)
|
|
435
|
-
|
|
436
|
-
# 发起一个上传 imgs 的请求,返回上传文件的url,请使用 put 发起流式上传。Initiate a request to upload images,returns upload URL.Use PUT to initiate a stream upload.
|
|
437
|
-
def upload_imgs(self,
|
|
438
|
-
repo: str,
|
|
439
|
-
body_params: dto.UploadRequestParams,
|
|
440
|
-
) -> dto.UploadAssetsResponse:
|
|
441
|
-
u = "/%s/-/upload/imgs" % (repo, )
|
|
442
|
-
|
|
443
|
-
data = self._client.request(
|
|
444
|
-
method="POST",
|
|
445
|
-
endpoint=u,
|
|
446
|
-
json=body_params.to_dict(),
|
|
447
|
-
)
|
|
448
|
-
return dto.UploadAssetsResponse.safe_parse(data)
|
|
449
|
-
|
|
450
417
|
|
|
@@ -89,25 +89,6 @@ class ReleasesService:
|
|
|
89
89
|
)
|
|
90
90
|
return api.Release.safe_parse(data)
|
|
91
91
|
|
|
92
|
-
# 发起一个获取 release 附件的请求, 302到有一定效期的下载地址。Get a request to fetch a release assets and returns 302 redirect to the assets URL with specific valid time.
|
|
93
|
-
def get_releases_asset(self,
|
|
94
|
-
repo: str,
|
|
95
|
-
tag: str,
|
|
96
|
-
filename: str,
|
|
97
|
-
share: Optional[bool] = None,
|
|
98
|
-
):
|
|
99
|
-
u = "/%s/-/releases/download/%s/%s" % (repo, tag, filename, )
|
|
100
|
-
|
|
101
|
-
query_params = {
|
|
102
|
-
"share": share,
|
|
103
|
-
}
|
|
104
|
-
data = self._client.request(
|
|
105
|
-
method="GET",
|
|
106
|
-
endpoint=u,
|
|
107
|
-
params=query_params,
|
|
108
|
-
)
|
|
109
|
-
return
|
|
110
|
-
|
|
111
92
|
# 查询 release 列表。List releases.
|
|
112
93
|
def list_releases(self,
|
|
113
94
|
repo: str,
|
|
@@ -6,12 +6,13 @@ setup.py
|
|
|
6
6
|
cnb/__init__.py
|
|
7
7
|
cnb/activities.py
|
|
8
8
|
cnb/ai.py
|
|
9
|
-
cnb/
|
|
9
|
+
cnb/assets.py
|
|
10
10
|
cnb/badge.py
|
|
11
11
|
cnb/build.py
|
|
12
|
-
cnb/charge.py
|
|
13
12
|
cnb/client.py
|
|
14
13
|
cnb/cnb.py
|
|
14
|
+
cnb/collaborators.py
|
|
15
|
+
cnb/contributors.py
|
|
15
16
|
cnb/event.py
|
|
16
17
|
cnb/exceptions.py
|
|
17
18
|
cnb/followers.py
|
|
@@ -19,7 +20,6 @@ cnb/git.py
|
|
|
19
20
|
cnb/gitsettings.py
|
|
20
21
|
cnb/issues.py
|
|
21
22
|
cnb/knowledgebase.py
|
|
22
|
-
cnb/members.py
|
|
23
23
|
cnb/missions.py
|
|
24
24
|
cnb/organizations.py
|
|
25
25
|
cnb/pulls.py
|
|
@@ -7,7 +7,7 @@ long_description = (this_directory / "README.md").read_text(encoding="utf-8")
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name="python-cnb",
|
|
10
|
-
version="0.8.
|
|
10
|
+
version="0.8.0b1",
|
|
11
11
|
author="Tencent Cloud",
|
|
12
12
|
author_email="ericdduan@tencent.com",
|
|
13
13
|
description="CNB OpenAPI的Python SDK,方便与CNB平台进行交互",
|
python_cnb-0.8.0/cnb/ai_ext.py
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
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
|
python_cnb-0.8.0/cnb/charge.py
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Code generated by cnb.cool/cnb/sdk/cnb-sdk-generator. DO NOT EDIT.
|
|
2
|
-
# versions:
|
|
3
|
-
# cnb-sdk-generator: 1.0.2
|
|
4
|
-
# source: https://api.cnb-dev.woa.com/swagger.json
|
|
5
|
-
|
|
6
|
-
from typing import Optional
|
|
7
|
-
from .models import dto
|
|
8
|
-
class ChargeService:
|
|
9
|
-
def __init__(self, client):
|
|
10
|
-
self._client = client
|
|
11
|
-
|
|
12
|
-
# 查看特权额度
|
|
13
|
-
def get_special_amount(self,
|
|
14
|
-
slug: str,
|
|
15
|
-
) -> dto.SpecialAmount:
|
|
16
|
-
u = "/%s/-/charge/special-amount" % (slug, )
|
|
17
|
-
|
|
18
|
-
data = self._client.request(
|
|
19
|
-
method="GET",
|
|
20
|
-
endpoint=u,
|
|
21
|
-
)
|
|
22
|
-
return dto.SpecialAmount.safe_parse(data)
|
|
23
|
-
|
|
24
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|