python-gitlab 5.6.0__py3-none-any.whl → 6.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gitlab/__init__.py +0 -1
- gitlab/_backends/protocol.py +9 -13
- gitlab/_backends/requests_backend.py +12 -12
- gitlab/_version.py +1 -1
- gitlab/base.py +48 -48
- gitlab/cli.py +14 -24
- gitlab/client.py +114 -140
- gitlab/config.py +16 -17
- gitlab/exceptions.py +7 -5
- gitlab/mixins.py +154 -238
- gitlab/types.py +13 -14
- gitlab/utils.py +32 -43
- gitlab/v4/cli.py +50 -53
- gitlab/v4/objects/__init__.py +1 -0
- gitlab/v4/objects/access_requests.py +11 -3
- gitlab/v4/objects/appearance.py +12 -14
- gitlab/v4/objects/applications.py +5 -6
- gitlab/v4/objects/artifacts.py +10 -17
- gitlab/v4/objects/audit_events.py +4 -19
- gitlab/v4/objects/award_emojis.py +13 -57
- gitlab/v4/objects/badges.py +4 -19
- gitlab/v4/objects/boards.py +7 -27
- gitlab/v4/objects/branches.py +3 -15
- gitlab/v4/objects/broadcast_messages.py +3 -13
- gitlab/v4/objects/bulk_imports.py +6 -14
- gitlab/v4/objects/ci_lint.py +7 -13
- gitlab/v4/objects/cluster_agents.py +3 -13
- gitlab/v4/objects/clusters.py +13 -23
- gitlab/v4/objects/commits.py +23 -28
- gitlab/v4/objects/container_registry.py +13 -19
- gitlab/v4/objects/custom_attributes.py +16 -21
- gitlab/v4/objects/deploy_keys.py +22 -19
- gitlab/v4/objects/deploy_tokens.py +14 -32
- gitlab/v4/objects/deployments.py +13 -15
- gitlab/v4/objects/discussions.py +13 -29
- gitlab/v4/objects/draft_notes.py +4 -14
- gitlab/v4/objects/environments.py +13 -21
- gitlab/v4/objects/epics.py +14 -17
- gitlab/v4/objects/events.py +27 -79
- gitlab/v4/objects/export_import.py +7 -19
- gitlab/v4/objects/features.py +11 -12
- gitlab/v4/objects/files.py +23 -38
- gitlab/v4/objects/geo_nodes.py +7 -11
- gitlab/v4/objects/group_access_tokens.py +6 -13
- gitlab/v4/objects/groups.py +40 -37
- gitlab/v4/objects/hooks.py +4 -17
- gitlab/v4/objects/integrations.py +7 -18
- gitlab/v4/objects/invitations.py +12 -23
- gitlab/v4/objects/issues.py +21 -27
- gitlab/v4/objects/iterations.py +4 -8
- gitlab/v4/objects/job_token_scope.py +18 -14
- gitlab/v4/objects/jobs.py +17 -32
- gitlab/v4/objects/keys.py +8 -11
- gitlab/v4/objects/labels.py +19 -30
- gitlab/v4/objects/ldap.py +25 -9
- gitlab/v4/objects/member_roles.py +102 -0
- gitlab/v4/objects/members.py +11 -29
- gitlab/v4/objects/merge_request_approvals.py +31 -44
- gitlab/v4/objects/merge_requests.py +30 -40
- gitlab/v4/objects/merge_trains.py +3 -6
- gitlab/v4/objects/milestones.py +23 -29
- gitlab/v4/objects/namespaces.py +4 -10
- gitlab/v4/objects/notes.py +26 -69
- gitlab/v4/objects/notification_settings.py +5 -14
- gitlab/v4/objects/package_protection_rules.py +8 -8
- gitlab/v4/objects/packages.py +22 -37
- gitlab/v4/objects/pages.py +8 -14
- gitlab/v4/objects/personal_access_tokens.py +7 -10
- gitlab/v4/objects/pipelines.py +38 -47
- gitlab/v4/objects/project_access_tokens.py +6 -13
- gitlab/v4/objects/projects.py +54 -76
- gitlab/v4/objects/push_rules.py +13 -15
- gitlab/v4/objects/registry_protection_repository_rules.py +6 -7
- gitlab/v4/objects/registry_protection_rules.py +7 -11
- gitlab/v4/objects/releases.py +6 -20
- gitlab/v4/objects/repositories.py +25 -34
- gitlab/v4/objects/resource_groups.py +10 -15
- gitlab/v4/objects/reviewers.py +4 -2
- gitlab/v4/objects/runners.py +14 -13
- gitlab/v4/objects/secure_files.py +8 -21
- gitlab/v4/objects/service_accounts.py +7 -5
- gitlab/v4/objects/settings.py +13 -14
- gitlab/v4/objects/sidekiq.py +17 -18
- gitlab/v4/objects/snippets.py +78 -66
- gitlab/v4/objects/statistics.py +8 -23
- gitlab/v4/objects/status_checks.py +6 -3
- gitlab/v4/objects/tags.py +3 -13
- gitlab/v4/objects/templates.py +11 -59
- gitlab/v4/objects/todos.py +3 -6
- gitlab/v4/objects/topics.py +10 -21
- gitlab/v4/objects/triggers.py +3 -13
- gitlab/v4/objects/users.py +87 -93
- gitlab/v4/objects/variables.py +4 -19
- gitlab/v4/objects/wikis.py +4 -19
- {python_gitlab-5.6.0.dist-info → python_gitlab-6.0.0.dist-info}/METADATA +3 -2
- python_gitlab-6.0.0.dist-info/RECORD +107 -0
- {python_gitlab-5.6.0.dist-info → python_gitlab-6.0.0.dist-info}/WHEEL +1 -1
- python_gitlab-5.6.0.dist-info/RECORD +0 -106
- {python_gitlab-5.6.0.dist-info → python_gitlab-6.0.0.dist-info}/entry_points.txt +0 -0
- {python_gitlab-5.6.0.dist-info → python_gitlab-6.0.0.dist-info/licenses}/AUTHORS +0 -0
- {python_gitlab-5.6.0.dist-info → python_gitlab-6.0.0.dist-info/licenses}/COPYING +0 -0
- {python_gitlab-5.6.0.dist-info → python_gitlab-6.0.0.dist-info}/top_level.txt +0 -0
gitlab/v4/objects/notes.py
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
from
|
2
|
-
|
3
|
-
from gitlab.base import RESTManager, RESTObject
|
1
|
+
from gitlab.base import RESTObject
|
4
2
|
from gitlab.mixins import (
|
5
3
|
CreateMixin,
|
6
4
|
CRUDMixin,
|
@@ -48,25 +46,23 @@ class GroupEpicNote(SaveMixin, ObjectDeleteMixin, RESTObject):
|
|
48
46
|
awardemojis: GroupEpicNoteAwardEmojiManager
|
49
47
|
|
50
48
|
|
51
|
-
class GroupEpicNoteManager(CRUDMixin
|
49
|
+
class GroupEpicNoteManager(CRUDMixin[GroupEpicNote]):
|
52
50
|
_path = "/groups/{group_id}/epics/{epic_id}/notes"
|
53
51
|
_obj_cls = GroupEpicNote
|
54
52
|
_from_parent_attrs = {"group_id": "group_id", "epic_id": "id"}
|
55
53
|
_create_attrs = RequiredOptional(required=("body",), optional=("created_at",))
|
56
54
|
_update_attrs = RequiredOptional(required=("body",))
|
57
55
|
|
58
|
-
def get(
|
59
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
60
|
-
) -> GroupEpicNote:
|
61
|
-
return cast(GroupEpicNote, super().get(id=id, lazy=lazy, **kwargs))
|
62
|
-
|
63
56
|
|
64
57
|
class GroupEpicDiscussionNote(SaveMixin, ObjectDeleteMixin, RESTObject):
|
65
58
|
pass
|
66
59
|
|
67
60
|
|
68
61
|
class GroupEpicDiscussionNoteManager(
|
69
|
-
GetMixin,
|
62
|
+
GetMixin[GroupEpicDiscussionNote],
|
63
|
+
CreateMixin[GroupEpicDiscussionNote],
|
64
|
+
UpdateMixin[GroupEpicDiscussionNote],
|
65
|
+
DeleteMixin[GroupEpicDiscussionNote],
|
70
66
|
):
|
71
67
|
_path = "/groups/{group_id}/epics/{epic_id}/discussions/{discussion_id}/notes"
|
72
68
|
_obj_cls = GroupEpicDiscussionNote
|
@@ -78,34 +74,27 @@ class GroupEpicDiscussionNoteManager(
|
|
78
74
|
_create_attrs = RequiredOptional(required=("body",), optional=("created_at",))
|
79
75
|
_update_attrs = RequiredOptional(required=("body",))
|
80
76
|
|
81
|
-
def get(
|
82
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
83
|
-
) -> GroupEpicDiscussionNote:
|
84
|
-
return cast(GroupEpicDiscussionNote, super().get(id=id, lazy=lazy, **kwargs))
|
85
|
-
|
86
77
|
|
87
78
|
class ProjectNote(RESTObject):
|
88
79
|
pass
|
89
80
|
|
90
81
|
|
91
|
-
class ProjectNoteManager(RetrieveMixin
|
82
|
+
class ProjectNoteManager(RetrieveMixin[ProjectNote]):
|
92
83
|
_path = "/projects/{project_id}/notes"
|
93
84
|
_obj_cls = ProjectNote
|
94
85
|
_from_parent_attrs = {"project_id": "id"}
|
95
86
|
_create_attrs = RequiredOptional(required=("body",))
|
96
87
|
|
97
|
-
def get(
|
98
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
99
|
-
) -> ProjectNote:
|
100
|
-
return cast(ProjectNote, super().get(id=id, lazy=lazy, **kwargs))
|
101
|
-
|
102
88
|
|
103
89
|
class ProjectCommitDiscussionNote(SaveMixin, ObjectDeleteMixin, RESTObject):
|
104
90
|
pass
|
105
91
|
|
106
92
|
|
107
93
|
class ProjectCommitDiscussionNoteManager(
|
108
|
-
GetMixin,
|
94
|
+
GetMixin[ProjectCommitDiscussionNote],
|
95
|
+
CreateMixin[ProjectCommitDiscussionNote],
|
96
|
+
UpdateMixin[ProjectCommitDiscussionNote],
|
97
|
+
DeleteMixin[ProjectCommitDiscussionNote],
|
109
98
|
):
|
110
99
|
_path = (
|
111
100
|
"/projects/{project_id}/repository/commits/{commit_id}/"
|
@@ -122,37 +111,28 @@ class ProjectCommitDiscussionNoteManager(
|
|
122
111
|
)
|
123
112
|
_update_attrs = RequiredOptional(required=("body",))
|
124
113
|
|
125
|
-
def get(
|
126
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
127
|
-
) -> ProjectCommitDiscussionNote:
|
128
|
-
return cast(
|
129
|
-
ProjectCommitDiscussionNote, super().get(id=id, lazy=lazy, **kwargs)
|
130
|
-
)
|
131
|
-
|
132
114
|
|
133
115
|
class ProjectIssueNote(SaveMixin, ObjectDeleteMixin, RESTObject):
|
134
116
|
awardemojis: ProjectIssueNoteAwardEmojiManager
|
135
117
|
|
136
118
|
|
137
|
-
class ProjectIssueNoteManager(CRUDMixin
|
119
|
+
class ProjectIssueNoteManager(CRUDMixin[ProjectIssueNote]):
|
138
120
|
_path = "/projects/{project_id}/issues/{issue_iid}/notes"
|
139
121
|
_obj_cls = ProjectIssueNote
|
140
122
|
_from_parent_attrs = {"project_id": "project_id", "issue_iid": "iid"}
|
141
123
|
_create_attrs = RequiredOptional(required=("body",), optional=("created_at",))
|
142
124
|
_update_attrs = RequiredOptional(required=("body",))
|
143
125
|
|
144
|
-
def get(
|
145
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
146
|
-
) -> ProjectIssueNote:
|
147
|
-
return cast(ProjectIssueNote, super().get(id=id, lazy=lazy, **kwargs))
|
148
|
-
|
149
126
|
|
150
127
|
class ProjectIssueDiscussionNote(SaveMixin, ObjectDeleteMixin, RESTObject):
|
151
128
|
pass
|
152
129
|
|
153
130
|
|
154
131
|
class ProjectIssueDiscussionNoteManager(
|
155
|
-
GetMixin,
|
132
|
+
GetMixin[ProjectIssueDiscussionNote],
|
133
|
+
CreateMixin[ProjectIssueDiscussionNote],
|
134
|
+
UpdateMixin[ProjectIssueDiscussionNote],
|
135
|
+
DeleteMixin[ProjectIssueDiscussionNote],
|
156
136
|
):
|
157
137
|
_path = (
|
158
138
|
"/projects/{project_id}/issues/{issue_iid}/discussions/{discussion_id}/notes"
|
@@ -166,35 +146,28 @@ class ProjectIssueDiscussionNoteManager(
|
|
166
146
|
_create_attrs = RequiredOptional(required=("body",), optional=("created_at",))
|
167
147
|
_update_attrs = RequiredOptional(required=("body",))
|
168
148
|
|
169
|
-
def get(
|
170
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
171
|
-
) -> ProjectIssueDiscussionNote:
|
172
|
-
return cast(ProjectIssueDiscussionNote, super().get(id=id, lazy=lazy, **kwargs))
|
173
|
-
|
174
149
|
|
175
150
|
class ProjectMergeRequestNote(SaveMixin, ObjectDeleteMixin, RESTObject):
|
176
151
|
awardemojis: ProjectMergeRequestNoteAwardEmojiManager
|
177
152
|
|
178
153
|
|
179
|
-
class ProjectMergeRequestNoteManager(CRUDMixin
|
154
|
+
class ProjectMergeRequestNoteManager(CRUDMixin[ProjectMergeRequestNote]):
|
180
155
|
_path = "/projects/{project_id}/merge_requests/{mr_iid}/notes"
|
181
156
|
_obj_cls = ProjectMergeRequestNote
|
182
157
|
_from_parent_attrs = {"project_id": "project_id", "mr_iid": "iid"}
|
183
158
|
_create_attrs = RequiredOptional(required=("body",))
|
184
159
|
_update_attrs = RequiredOptional(required=("body",))
|
185
160
|
|
186
|
-
def get(
|
187
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
188
|
-
) -> ProjectMergeRequestNote:
|
189
|
-
return cast(ProjectMergeRequestNote, super().get(id=id, lazy=lazy, **kwargs))
|
190
|
-
|
191
161
|
|
192
162
|
class ProjectMergeRequestDiscussionNote(SaveMixin, ObjectDeleteMixin, RESTObject):
|
193
163
|
pass
|
194
164
|
|
195
165
|
|
196
166
|
class ProjectMergeRequestDiscussionNoteManager(
|
197
|
-
GetMixin,
|
167
|
+
GetMixin[ProjectMergeRequestDiscussionNote],
|
168
|
+
CreateMixin[ProjectMergeRequestDiscussionNote],
|
169
|
+
UpdateMixin[ProjectMergeRequestDiscussionNote],
|
170
|
+
DeleteMixin[ProjectMergeRequestDiscussionNote],
|
198
171
|
):
|
199
172
|
_path = (
|
200
173
|
"/projects/{project_id}/merge_requests/{mr_iid}/"
|
@@ -209,37 +182,28 @@ class ProjectMergeRequestDiscussionNoteManager(
|
|
209
182
|
_create_attrs = RequiredOptional(required=("body",), optional=("created_at",))
|
210
183
|
_update_attrs = RequiredOptional(required=("body",))
|
211
184
|
|
212
|
-
def get(
|
213
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
214
|
-
) -> ProjectMergeRequestDiscussionNote:
|
215
|
-
return cast(
|
216
|
-
ProjectMergeRequestDiscussionNote, super().get(id=id, lazy=lazy, **kwargs)
|
217
|
-
)
|
218
|
-
|
219
185
|
|
220
186
|
class ProjectSnippetNote(SaveMixin, ObjectDeleteMixin, RESTObject):
|
221
187
|
awardemojis: ProjectSnippetNoteAwardEmojiManager
|
222
188
|
|
223
189
|
|
224
|
-
class ProjectSnippetNoteManager(CRUDMixin
|
190
|
+
class ProjectSnippetNoteManager(CRUDMixin[ProjectSnippetNote]):
|
225
191
|
_path = "/projects/{project_id}/snippets/{snippet_id}/notes"
|
226
192
|
_obj_cls = ProjectSnippetNote
|
227
193
|
_from_parent_attrs = {"project_id": "project_id", "snippet_id": "id"}
|
228
194
|
_create_attrs = RequiredOptional(required=("body",))
|
229
195
|
_update_attrs = RequiredOptional(required=("body",))
|
230
196
|
|
231
|
-
def get(
|
232
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
233
|
-
) -> ProjectSnippetNote:
|
234
|
-
return cast(ProjectSnippetNote, super().get(id=id, lazy=lazy, **kwargs))
|
235
|
-
|
236
197
|
|
237
198
|
class ProjectSnippetDiscussionNote(SaveMixin, ObjectDeleteMixin, RESTObject):
|
238
199
|
pass
|
239
200
|
|
240
201
|
|
241
202
|
class ProjectSnippetDiscussionNoteManager(
|
242
|
-
GetMixin,
|
203
|
+
GetMixin[ProjectSnippetDiscussionNote],
|
204
|
+
CreateMixin[ProjectSnippetDiscussionNote],
|
205
|
+
UpdateMixin[ProjectSnippetDiscussionNote],
|
206
|
+
DeleteMixin[ProjectSnippetDiscussionNote],
|
243
207
|
):
|
244
208
|
_path = (
|
245
209
|
"/projects/{project_id}/snippets/{snippet_id}/"
|
@@ -253,10 +217,3 @@ class ProjectSnippetDiscussionNoteManager(
|
|
253
217
|
}
|
254
218
|
_create_attrs = RequiredOptional(required=("body",), optional=("created_at",))
|
255
219
|
_update_attrs = RequiredOptional(required=("body",))
|
256
|
-
|
257
|
-
def get(
|
258
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
259
|
-
) -> ProjectSnippetDiscussionNote:
|
260
|
-
return cast(
|
261
|
-
ProjectSnippetDiscussionNote, super().get(id=id, lazy=lazy, **kwargs)
|
262
|
-
)
|
@@ -1,6 +1,4 @@
|
|
1
|
-
from
|
2
|
-
|
3
|
-
from gitlab.base import RESTManager, RESTObject
|
1
|
+
from gitlab.base import RESTObject
|
4
2
|
from gitlab.mixins import GetWithoutIdMixin, SaveMixin, UpdateMixin
|
5
3
|
from gitlab.types import RequiredOptional
|
6
4
|
|
@@ -18,7 +16,9 @@ class NotificationSettings(SaveMixin, RESTObject):
|
|
18
16
|
_id_attr = None
|
19
17
|
|
20
18
|
|
21
|
-
class NotificationSettingsManager(
|
19
|
+
class NotificationSettingsManager(
|
20
|
+
GetWithoutIdMixin[NotificationSettings], UpdateMixin[NotificationSettings]
|
21
|
+
):
|
22
22
|
_path = "/notification_settings"
|
23
23
|
_obj_cls = NotificationSettings
|
24
24
|
|
@@ -36,12 +36,9 @@ class NotificationSettingsManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
|
|
36
36
|
"close_merge_request",
|
37
37
|
"reassign_merge_request",
|
38
38
|
"merge_merge_request",
|
39
|
-
)
|
39
|
+
)
|
40
40
|
)
|
41
41
|
|
42
|
-
def get(self, **kwargs: Any) -> NotificationSettings:
|
43
|
-
return cast(NotificationSettings, super().get(**kwargs))
|
44
|
-
|
45
42
|
|
46
43
|
class GroupNotificationSettings(NotificationSettings):
|
47
44
|
pass
|
@@ -52,9 +49,6 @@ class GroupNotificationSettingsManager(NotificationSettingsManager):
|
|
52
49
|
_obj_cls = GroupNotificationSettings
|
53
50
|
_from_parent_attrs = {"group_id": "id"}
|
54
51
|
|
55
|
-
def get(self, **kwargs: Any) -> GroupNotificationSettings:
|
56
|
-
return cast(GroupNotificationSettings, super().get(id=id, **kwargs))
|
57
|
-
|
58
52
|
|
59
53
|
class ProjectNotificationSettings(NotificationSettings):
|
60
54
|
pass
|
@@ -64,6 +58,3 @@ class ProjectNotificationSettingsManager(NotificationSettingsManager):
|
|
64
58
|
_path = "/projects/{project_id}/notification_settings"
|
65
59
|
_obj_cls = ProjectNotificationSettings
|
66
60
|
_from_parent_attrs = {"project_id": "id"}
|
67
|
-
|
68
|
-
def get(self, **kwargs: Any) -> ProjectNotificationSettings:
|
69
|
-
return cast(ProjectNotificationSettings, super().get(id=id, **kwargs))
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from gitlab.base import
|
1
|
+
from gitlab.base import RESTObject
|
2
2
|
from gitlab.mixins import (
|
3
3
|
CreateMixin,
|
4
4
|
DeleteMixin,
|
@@ -10,10 +10,7 @@ from gitlab.mixins import (
|
|
10
10
|
)
|
11
11
|
from gitlab.types import RequiredOptional
|
12
12
|
|
13
|
-
__all__ = [
|
14
|
-
"ProjectPackageProtectionRule",
|
15
|
-
"ProjectPackageProtectionRuleManager",
|
16
|
-
]
|
13
|
+
__all__ = ["ProjectPackageProtectionRule", "ProjectPackageProtectionRuleManager"]
|
17
14
|
|
18
15
|
|
19
16
|
class ProjectPackageProtectionRule(ObjectDeleteMixin, SaveMixin, RESTObject):
|
@@ -21,7 +18,10 @@ class ProjectPackageProtectionRule(ObjectDeleteMixin, SaveMixin, RESTObject):
|
|
21
18
|
|
22
19
|
|
23
20
|
class ProjectPackageProtectionRuleManager(
|
24
|
-
ListMixin,
|
21
|
+
ListMixin[ProjectPackageProtectionRule],
|
22
|
+
CreateMixin[ProjectPackageProtectionRule],
|
23
|
+
DeleteMixin[ProjectPackageProtectionRule],
|
24
|
+
UpdateMixin[ProjectPackageProtectionRule],
|
25
25
|
):
|
26
26
|
_path = "/projects/{project_id}/packages/protection/rules"
|
27
27
|
_obj_cls = ProjectPackageProtectionRule
|
@@ -31,13 +31,13 @@ class ProjectPackageProtectionRuleManager(
|
|
31
31
|
"package_name_pattern",
|
32
32
|
"package_type",
|
33
33
|
"minimum_access_level_for_push",
|
34
|
-
)
|
34
|
+
)
|
35
35
|
)
|
36
36
|
_update_attrs = RequiredOptional(
|
37
37
|
optional=(
|
38
38
|
"package_name_pattern",
|
39
39
|
"package_type",
|
40
40
|
"minimum_access_level_for_push",
|
41
|
-
)
|
41
|
+
)
|
42
42
|
)
|
43
43
|
_update_method = UpdateMethod.PATCH
|
gitlab/v4/objects/packages.py
CHANGED
@@ -4,19 +4,10 @@ https://docs.gitlab.com/ee/api/packages.html
|
|
4
4
|
https://docs.gitlab.com/ee/user/packages/generic_packages/
|
5
5
|
"""
|
6
6
|
|
7
|
+
from __future__ import annotations
|
8
|
+
|
7
9
|
from pathlib import Path
|
8
|
-
from typing import
|
9
|
-
Any,
|
10
|
-
BinaryIO,
|
11
|
-
Callable,
|
12
|
-
cast,
|
13
|
-
Iterator,
|
14
|
-
Literal,
|
15
|
-
Optional,
|
16
|
-
overload,
|
17
|
-
TYPE_CHECKING,
|
18
|
-
Union,
|
19
|
-
)
|
10
|
+
from typing import Any, BinaryIO, Callable, Iterator, Literal, overload, TYPE_CHECKING
|
20
11
|
|
21
12
|
import requests
|
22
13
|
|
@@ -44,7 +35,7 @@ class GenericPackage(RESTObject):
|
|
44
35
|
_id_attr = "package_name"
|
45
36
|
|
46
37
|
|
47
|
-
class GenericPackageManager(RESTManager):
|
38
|
+
class GenericPackageManager(RESTManager[GenericPackage]):
|
48
39
|
_path = "/projects/{project_id}/packages/generic"
|
49
40
|
_obj_cls = GenericPackage
|
50
41
|
_from_parent_attrs = {"project_id": "id"}
|
@@ -59,9 +50,9 @@ class GenericPackageManager(RESTManager):
|
|
59
50
|
package_name: str,
|
60
51
|
package_version: str,
|
61
52
|
file_name: str,
|
62
|
-
path:
|
63
|
-
select:
|
64
|
-
data:
|
53
|
+
path: str | Path | None = None,
|
54
|
+
select: str | None = None,
|
55
|
+
data: bytes | BinaryIO | None = None,
|
65
56
|
**kwargs: Any,
|
66
57
|
) -> GenericPackage:
|
67
58
|
"""Upload a file as a generic package.
|
@@ -93,7 +84,7 @@ class GenericPackageManager(RESTManager):
|
|
93
84
|
if path is not None and data is not None:
|
94
85
|
raise exc.GitlabUploadError("File contents and file path specified")
|
95
86
|
|
96
|
-
file_data:
|
87
|
+
file_data: bytes | BinaryIO | None = data
|
97
88
|
|
98
89
|
if not file_data:
|
99
90
|
if TYPE_CHECKING:
|
@@ -159,7 +150,7 @@ class GenericPackageManager(RESTManager):
|
|
159
150
|
package_version: str,
|
160
151
|
file_name: str,
|
161
152
|
streamed: Literal[True] = True,
|
162
|
-
action:
|
153
|
+
action: Callable[[bytes], Any] | None = None,
|
163
154
|
chunk_size: int = 1024,
|
164
155
|
*,
|
165
156
|
iterator: Literal[False] = False,
|
@@ -177,12 +168,12 @@ class GenericPackageManager(RESTManager):
|
|
177
168
|
package_version: str,
|
178
169
|
file_name: str,
|
179
170
|
streamed: bool = False,
|
180
|
-
action:
|
171
|
+
action: Callable[[bytes], Any] | None = None,
|
181
172
|
chunk_size: int = 1024,
|
182
173
|
*,
|
183
174
|
iterator: bool = False,
|
184
175
|
**kwargs: Any,
|
185
|
-
) ->
|
176
|
+
) -> bytes | Iterator[Any] | None:
|
186
177
|
"""Download a generic package.
|
187
178
|
|
188
179
|
Args:
|
@@ -219,7 +210,7 @@ class GroupPackage(RESTObject):
|
|
219
210
|
pass
|
220
211
|
|
221
212
|
|
222
|
-
class GroupPackageManager(ListMixin
|
213
|
+
class GroupPackageManager(ListMixin[GroupPackage]):
|
223
214
|
_path = "/groups/{group_id}/packages"
|
224
215
|
_obj_cls = GroupPackage
|
225
216
|
_from_parent_attrs = {"group_id": "id"}
|
@@ -233,32 +224,26 @@ class GroupPackageManager(ListMixin, RESTManager):
|
|
233
224
|
|
234
225
|
|
235
226
|
class ProjectPackage(ObjectDeleteMixin, RESTObject):
|
236
|
-
package_files:
|
237
|
-
pipelines:
|
227
|
+
package_files: ProjectPackageFileManager
|
228
|
+
pipelines: ProjectPackagePipelineManager
|
238
229
|
|
239
230
|
|
240
|
-
class ProjectPackageManager(
|
231
|
+
class ProjectPackageManager(
|
232
|
+
ListMixin[ProjectPackage], GetMixin[ProjectPackage], DeleteMixin[ProjectPackage]
|
233
|
+
):
|
241
234
|
_path = "/projects/{project_id}/packages"
|
242
235
|
_obj_cls = ProjectPackage
|
243
236
|
_from_parent_attrs = {"project_id": "id"}
|
244
|
-
_list_filters = (
|
245
|
-
"order_by",
|
246
|
-
"sort",
|
247
|
-
"package_type",
|
248
|
-
"package_name",
|
249
|
-
)
|
250
|
-
|
251
|
-
def get(
|
252
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
253
|
-
) -> ProjectPackage:
|
254
|
-
return cast(ProjectPackage, super().get(id=id, lazy=lazy, **kwargs))
|
237
|
+
_list_filters = ("order_by", "sort", "package_type", "package_name")
|
255
238
|
|
256
239
|
|
257
240
|
class ProjectPackageFile(ObjectDeleteMixin, RESTObject):
|
258
241
|
pass
|
259
242
|
|
260
243
|
|
261
|
-
class ProjectPackageFileManager(
|
244
|
+
class ProjectPackageFileManager(
|
245
|
+
DeleteMixin[ProjectPackageFile], ListMixin[ProjectPackageFile]
|
246
|
+
):
|
262
247
|
_path = "/projects/{project_id}/packages/{package_id}/package_files"
|
263
248
|
_obj_cls = ProjectPackageFile
|
264
249
|
_from_parent_attrs = {"project_id": "project_id", "package_id": "id"}
|
@@ -268,7 +253,7 @@ class ProjectPackagePipeline(RESTObject):
|
|
268
253
|
pass
|
269
254
|
|
270
255
|
|
271
|
-
class ProjectPackagePipelineManager(ListMixin
|
256
|
+
class ProjectPackagePipelineManager(ListMixin[ProjectPackagePipeline]):
|
272
257
|
_path = "/projects/{project_id}/packages/{package_id}/pipelines"
|
273
258
|
_obj_cls = ProjectPackagePipeline
|
274
259
|
_from_parent_attrs = {"project_id": "project_id", "package_id": "id"}
|
gitlab/v4/objects/pages.py
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
from
|
2
|
-
|
3
|
-
from gitlab.base import RESTManager, RESTObject
|
1
|
+
from gitlab.base import RESTObject
|
4
2
|
from gitlab.mixins import (
|
5
3
|
CRUDMixin,
|
6
4
|
DeleteMixin,
|
@@ -28,7 +26,7 @@ class PagesDomain(RESTObject):
|
|
28
26
|
_id_attr = "domain"
|
29
27
|
|
30
28
|
|
31
|
-
class PagesDomainManager(ListMixin
|
29
|
+
class PagesDomainManager(ListMixin[PagesDomain]):
|
32
30
|
_path = "/pages/domains"
|
33
31
|
_obj_cls = PagesDomain
|
34
32
|
|
@@ -37,7 +35,7 @@ class ProjectPagesDomain(SaveMixin, ObjectDeleteMixin, RESTObject):
|
|
37
35
|
_id_attr = "domain"
|
38
36
|
|
39
37
|
|
40
|
-
class ProjectPagesDomainManager(CRUDMixin
|
38
|
+
class ProjectPagesDomainManager(CRUDMixin[ProjectPagesDomain]):
|
41
39
|
_path = "/projects/{project_id}/pages/domains"
|
42
40
|
_obj_cls = ProjectPagesDomain
|
43
41
|
_from_parent_attrs = {"project_id": "id"}
|
@@ -46,17 +44,16 @@ class ProjectPagesDomainManager(CRUDMixin, RESTManager):
|
|
46
44
|
)
|
47
45
|
_update_attrs = RequiredOptional(optional=("certificate", "key"))
|
48
46
|
|
49
|
-
def get(
|
50
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
51
|
-
) -> ProjectPagesDomain:
|
52
|
-
return cast(ProjectPagesDomain, super().get(id=id, lazy=lazy, **kwargs))
|
53
|
-
|
54
47
|
|
55
48
|
class ProjectPages(ObjectDeleteMixin, RefreshMixin, RESTObject):
|
56
49
|
_id_attr = None
|
57
50
|
|
58
51
|
|
59
|
-
class ProjectPagesManager(
|
52
|
+
class ProjectPagesManager(
|
53
|
+
DeleteMixin[ProjectPages],
|
54
|
+
UpdateMixin[ProjectPages],
|
55
|
+
GetWithoutIdMixin[ProjectPages],
|
56
|
+
):
|
60
57
|
_path = "/projects/{project_id}/pages"
|
61
58
|
_obj_cls = ProjectPages
|
62
59
|
_from_parent_attrs = {"project_id": "id"}
|
@@ -64,6 +61,3 @@ class ProjectPagesManager(DeleteMixin, UpdateMixin, GetWithoutIdMixin, RESTManag
|
|
64
61
|
optional=("pages_unique_domain_enabled", "pages_https_only")
|
65
62
|
)
|
66
63
|
_update_method: UpdateMethod = UpdateMethod.PATCH
|
67
|
-
|
68
|
-
def get(self, **kwargs: Any) -> ProjectPages:
|
69
|
-
return cast(ProjectPages, super().get(**kwargs))
|
@@ -1,6 +1,4 @@
|
|
1
|
-
from
|
2
|
-
|
3
|
-
from gitlab.base import RESTManager, RESTObject
|
1
|
+
from gitlab.base import RESTObject
|
4
2
|
from gitlab.mixins import (
|
5
3
|
CreateMixin,
|
6
4
|
DeleteMixin,
|
@@ -23,22 +21,21 @@ class PersonalAccessToken(ObjectDeleteMixin, ObjectRotateMixin, RESTObject):
|
|
23
21
|
pass
|
24
22
|
|
25
23
|
|
26
|
-
class PersonalAccessTokenManager(
|
24
|
+
class PersonalAccessTokenManager(
|
25
|
+
DeleteMixin[PersonalAccessToken],
|
26
|
+
RetrieveMixin[PersonalAccessToken],
|
27
|
+
RotateMixin[PersonalAccessToken],
|
28
|
+
):
|
27
29
|
_path = "/personal_access_tokens"
|
28
30
|
_obj_cls = PersonalAccessToken
|
29
31
|
_list_filters = ("user_id",)
|
30
32
|
|
31
|
-
def get(
|
32
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
33
|
-
) -> PersonalAccessToken:
|
34
|
-
return cast(PersonalAccessToken, super().get(id=id, lazy=lazy, **kwargs))
|
35
|
-
|
36
33
|
|
37
34
|
class UserPersonalAccessToken(RESTObject):
|
38
35
|
pass
|
39
36
|
|
40
37
|
|
41
|
-
class UserPersonalAccessTokenManager(CreateMixin
|
38
|
+
class UserPersonalAccessTokenManager(CreateMixin[UserPersonalAccessToken]):
|
42
39
|
_path = "/users/{user_id}/personal_access_tokens"
|
43
40
|
_obj_cls = UserPersonalAccessToken
|
44
41
|
_from_parent_attrs = {"user_id": "id"}
|