clear-skies-gitlab 2.0.3__py3-none-any.whl → 2.0.5__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.
- {clear_skies_gitlab-2.0.3.dist-info → clear_skies_gitlab-2.0.5.dist-info}/METADATA +1 -1
- {clear_skies_gitlab-2.0.3.dist-info → clear_skies_gitlab-2.0.5.dist-info}/RECORD +34 -34
- clearskies_gitlab/defaults/gitlab_default_auth.py +33 -2
- clearskies_gitlab/defaults/gitlab_default_host.py +31 -2
- clearskies_gitlab/rest/backends/gitlab_rest_backend.py +98 -80
- clearskies_gitlab/rest/gitlab_branch_rule.py +74 -1
- clearskies_gitlab/rest/gitlab_cicd_variable.py +78 -1
- clearskies_gitlab/rest/gitlab_member.py +80 -1
- clearskies_gitlab/rest/models/gitlab_rest_advanced_search.py +67 -1
- clearskies_gitlab/rest/models/gitlab_rest_advanced_search_blob.py +72 -1
- clearskies_gitlab/rest/models/gitlab_rest_current_user.py +134 -1
- clearskies_gitlab/rest/models/gitlab_rest_group.py +60 -1
- clearskies_gitlab/rest/models/gitlab_rest_group_access_token.py +102 -1
- clearskies_gitlab/rest/models/gitlab_rest_group_base.py +305 -1
- clearskies_gitlab/rest/models/gitlab_rest_group_member.py +64 -1
- clearskies_gitlab/rest/models/gitlab_rest_group_project.py +27 -1
- clearskies_gitlab/rest/models/gitlab_rest_group_search.py +30 -1
- clearskies_gitlab/rest/models/gitlab_rest_group_search_blob.py +27 -1
- clearskies_gitlab/rest/models/gitlab_rest_group_subgroup.py +54 -17
- clearskies_gitlab/rest/models/gitlab_rest_group_variable.py +44 -1
- clearskies_gitlab/rest/models/gitlab_rest_namespace.py +178 -1
- clearskies_gitlab/rest/models/gitlab_rest_project.py +501 -3
- clearskies_gitlab/rest/models/gitlab_rest_project_approval_config.py +72 -1
- clearskies_gitlab/rest/models/gitlab_rest_project_approval_rule.py +92 -1
- clearskies_gitlab/rest/models/gitlab_rest_project_member.py +62 -1
- clearskies_gitlab/rest/models/gitlab_rest_project_protected_branch.py +132 -1
- clearskies_gitlab/rest/models/gitlab_rest_project_repository_commit.py +144 -2
- clearskies_gitlab/rest/models/gitlab_rest_project_repository_commit_diff.py +89 -2
- clearskies_gitlab/rest/models/gitlab_rest_project_repository_contributor.py +68 -2
- clearskies_gitlab/rest/models/gitlab_rest_project_repository_file.py +90 -1
- clearskies_gitlab/rest/models/gitlab_rest_project_repository_file_raw.py +57 -3
- clearskies_gitlab/rest/models/gitlab_rest_project_variable.py +46 -1
- {clear_skies_gitlab-2.0.3.dist-info → clear_skies_gitlab-2.0.5.dist-info}/WHEEL +0 -0
- {clear_skies_gitlab-2.0.3.dist-info → clear_skies_gitlab-2.0.5.dist-info}/licenses/LICENSE +0 -0
|
@@ -20,7 +20,18 @@ from clearskies_gitlab.rest.backends import GitlabRestBackend
|
|
|
20
20
|
class GitlabRestGroupBase(
|
|
21
21
|
Model,
|
|
22
22
|
):
|
|
23
|
-
"""
|
|
23
|
+
"""
|
|
24
|
+
Base model for GitLab groups.
|
|
25
|
+
|
|
26
|
+
This model provides the common fields and functionality shared by all group-related
|
|
27
|
+
models (GitlabRestGroup, GitlabRestGroupSubgroup, etc.). It contains the core
|
|
28
|
+
group attributes and search parameters.
|
|
29
|
+
|
|
30
|
+
See https://docs.gitlab.com/api/groups/ for more details.
|
|
31
|
+
|
|
32
|
+
Note: This is a base class and should typically not be used directly.
|
|
33
|
+
Use GitlabRestGroup or GitlabRestGroupSubgroup instead.
|
|
34
|
+
"""
|
|
24
35
|
|
|
25
36
|
@classmethod
|
|
26
37
|
def destination_name(cls: type[Self]) -> str:
|
|
@@ -31,74 +42,367 @@ class GitlabRestGroupBase(
|
|
|
31
42
|
|
|
32
43
|
backend = GitlabRestBackend()
|
|
33
44
|
|
|
45
|
+
"""
|
|
46
|
+
The unique identifier for the group.
|
|
47
|
+
"""
|
|
34
48
|
id = String()
|
|
49
|
+
|
|
50
|
+
"""
|
|
51
|
+
URL to the group's GitLab page.
|
|
52
|
+
"""
|
|
35
53
|
web_url = String()
|
|
54
|
+
|
|
55
|
+
"""
|
|
56
|
+
The display name of the group.
|
|
57
|
+
"""
|
|
36
58
|
name = String()
|
|
59
|
+
|
|
60
|
+
"""
|
|
61
|
+
The URL-friendly path/slug of the group.
|
|
62
|
+
"""
|
|
37
63
|
path = String()
|
|
64
|
+
|
|
65
|
+
"""
|
|
66
|
+
A description of the group's purpose.
|
|
67
|
+
"""
|
|
38
68
|
description = String()
|
|
69
|
+
|
|
70
|
+
"""
|
|
71
|
+
The visibility level of the group.
|
|
72
|
+
|
|
73
|
+
Values: "public", "internal", or "private".
|
|
74
|
+
"""
|
|
39
75
|
visibility = String()
|
|
76
|
+
|
|
77
|
+
"""
|
|
78
|
+
Whether sharing the group with other groups is locked.
|
|
79
|
+
"""
|
|
40
80
|
share_with_group_lock = Boolean()
|
|
81
|
+
|
|
82
|
+
"""
|
|
83
|
+
Whether two-factor authentication is required for group members.
|
|
84
|
+
"""
|
|
41
85
|
require_two_factor_authentication = Boolean()
|
|
86
|
+
|
|
87
|
+
"""
|
|
88
|
+
Grace period (in hours) for enabling two-factor authentication.
|
|
89
|
+
"""
|
|
42
90
|
two_factor_grace_period = Integer()
|
|
91
|
+
|
|
92
|
+
"""
|
|
93
|
+
Who can create projects in this group.
|
|
94
|
+
|
|
95
|
+
Values: "noone", "maintainer", "developer".
|
|
96
|
+
"""
|
|
43
97
|
project_creation_level = String()
|
|
98
|
+
|
|
99
|
+
"""
|
|
100
|
+
Whether Auto DevOps is enabled for projects in this group.
|
|
101
|
+
"""
|
|
44
102
|
auto_devops_enabled = Boolean()
|
|
103
|
+
|
|
104
|
+
"""
|
|
105
|
+
Who can create subgroups in this group.
|
|
106
|
+
|
|
107
|
+
Values: "owner", "maintainer".
|
|
108
|
+
"""
|
|
45
109
|
subgroup_creation_level = String()
|
|
110
|
+
|
|
111
|
+
"""
|
|
112
|
+
Whether email notifications are disabled for this group.
|
|
113
|
+
"""
|
|
46
114
|
emails_disabled = Boolean()
|
|
115
|
+
|
|
116
|
+
"""
|
|
117
|
+
Whether email notifications are enabled for this group.
|
|
118
|
+
"""
|
|
47
119
|
emails_enabled = Boolean()
|
|
120
|
+
|
|
121
|
+
"""
|
|
122
|
+
Whether mentions are disabled for this group.
|
|
123
|
+
"""
|
|
48
124
|
mentions_disabled = String()
|
|
125
|
+
|
|
126
|
+
"""
|
|
127
|
+
Whether Git LFS is enabled for projects in this group.
|
|
128
|
+
"""
|
|
49
129
|
lfs_enabled = String()
|
|
130
|
+
|
|
131
|
+
"""
|
|
132
|
+
Whether math rendering limits are enabled.
|
|
133
|
+
"""
|
|
50
134
|
math_rendering_limits_enabled = Boolean()
|
|
135
|
+
|
|
136
|
+
"""
|
|
137
|
+
Whether math rendering limits are locked.
|
|
138
|
+
"""
|
|
51
139
|
lock_math_rendering_limits_enabled = Boolean()
|
|
140
|
+
|
|
141
|
+
"""
|
|
142
|
+
The default branch for new projects in this group.
|
|
143
|
+
"""
|
|
52
144
|
default_branch = String()
|
|
145
|
+
|
|
146
|
+
"""
|
|
147
|
+
The default branch protection level.
|
|
148
|
+
"""
|
|
53
149
|
default_branch_protection = String()
|
|
150
|
+
|
|
151
|
+
"""
|
|
152
|
+
Default branch protection settings.
|
|
153
|
+
"""
|
|
54
154
|
default_branch_protection_defaults = String()
|
|
155
|
+
|
|
156
|
+
"""
|
|
157
|
+
URL to the group's avatar image.
|
|
158
|
+
"""
|
|
55
159
|
avatar_url = String()
|
|
160
|
+
|
|
161
|
+
"""
|
|
162
|
+
Whether users can request access to this group.
|
|
163
|
+
"""
|
|
56
164
|
request_access_enabled = Boolean()
|
|
165
|
+
|
|
166
|
+
"""
|
|
167
|
+
The full display name including parent groups.
|
|
168
|
+
|
|
169
|
+
For example: "Parent Group / Child Group".
|
|
170
|
+
"""
|
|
57
171
|
full_name = String()
|
|
172
|
+
|
|
173
|
+
"""
|
|
174
|
+
The full path including parent groups.
|
|
175
|
+
|
|
176
|
+
For example: "parent-group/child-group".
|
|
177
|
+
"""
|
|
58
178
|
full_path = String()
|
|
179
|
+
|
|
180
|
+
"""
|
|
181
|
+
The date and time when the group was created.
|
|
182
|
+
"""
|
|
59
183
|
created_at = Datetime()
|
|
184
|
+
|
|
185
|
+
"""
|
|
186
|
+
The ID of the parent group.
|
|
187
|
+
|
|
188
|
+
Null for top-level groups.
|
|
189
|
+
"""
|
|
60
190
|
parent_id = String()
|
|
191
|
+
|
|
192
|
+
"""
|
|
193
|
+
The ID of the organization this group belongs to.
|
|
194
|
+
"""
|
|
61
195
|
organization_id = String()
|
|
196
|
+
|
|
197
|
+
"""
|
|
198
|
+
The shared runners setting for this group.
|
|
199
|
+
|
|
200
|
+
Controls whether shared runners are available to projects.
|
|
201
|
+
"""
|
|
62
202
|
shared_runners_setting = String()
|
|
203
|
+
|
|
204
|
+
"""
|
|
205
|
+
Custom attributes attached to this group.
|
|
206
|
+
"""
|
|
63
207
|
custom_attributes = Json()
|
|
208
|
+
|
|
209
|
+
"""
|
|
210
|
+
Statistics about the group (storage, repository size, etc.).
|
|
211
|
+
"""
|
|
64
212
|
statistics = Json()
|
|
213
|
+
|
|
214
|
+
"""
|
|
215
|
+
LDAP Common Name for LDAP-synced groups.
|
|
216
|
+
"""
|
|
65
217
|
ldap_cn = String()
|
|
218
|
+
|
|
219
|
+
"""
|
|
220
|
+
LDAP access level for LDAP-synced groups.
|
|
221
|
+
"""
|
|
66
222
|
ldap_access = String()
|
|
223
|
+
|
|
224
|
+
"""
|
|
225
|
+
LDAP group links configuration.
|
|
226
|
+
"""
|
|
67
227
|
ldap_group_links = Json()
|
|
228
|
+
|
|
229
|
+
"""
|
|
230
|
+
SAML group links configuration.
|
|
231
|
+
"""
|
|
68
232
|
saml_group_links = Json()
|
|
233
|
+
|
|
234
|
+
"""
|
|
235
|
+
The ID of the project used for file templates.
|
|
236
|
+
"""
|
|
69
237
|
file_template_project_id = String()
|
|
238
|
+
|
|
239
|
+
"""
|
|
240
|
+
The date when the group was marked for deletion.
|
|
241
|
+
"""
|
|
70
242
|
marked_for_deletion_on = Datetime()
|
|
243
|
+
|
|
244
|
+
"""
|
|
245
|
+
The wiki access level for this group.
|
|
246
|
+
"""
|
|
71
247
|
wiki_access_level = String()
|
|
248
|
+
|
|
249
|
+
"""
|
|
250
|
+
The repository storage location for this group.
|
|
251
|
+
"""
|
|
72
252
|
repository_storage = String()
|
|
253
|
+
|
|
254
|
+
"""
|
|
255
|
+
Whether GitLab Duo features are enabled.
|
|
256
|
+
"""
|
|
73
257
|
duo_features_enabled = Boolean()
|
|
258
|
+
|
|
259
|
+
"""
|
|
260
|
+
Whether GitLab Duo features setting is locked.
|
|
261
|
+
"""
|
|
74
262
|
lock_duo_features_enabled = Boolean()
|
|
263
|
+
|
|
264
|
+
"""
|
|
265
|
+
Groups that this group is shared with.
|
|
266
|
+
"""
|
|
75
267
|
shared_with_groups = Json()
|
|
268
|
+
|
|
269
|
+
"""
|
|
270
|
+
The runners registration token for this group.
|
|
271
|
+
|
|
272
|
+
Used to register new runners with this group.
|
|
273
|
+
"""
|
|
76
274
|
runners_token = String()
|
|
275
|
+
|
|
276
|
+
"""
|
|
277
|
+
The enabled Git access protocol.
|
|
278
|
+
|
|
279
|
+
Values: "ssh", "http", "all".
|
|
280
|
+
"""
|
|
77
281
|
enabled_git_access_protocol = String()
|
|
282
|
+
|
|
283
|
+
"""
|
|
284
|
+
Whether sharing groups outside the hierarchy is prevented.
|
|
285
|
+
"""
|
|
78
286
|
prevent_sharing_groups_outside_hierarchy = Boolean()
|
|
287
|
+
|
|
288
|
+
"""
|
|
289
|
+
The shared runners compute minutes limit for this group.
|
|
290
|
+
"""
|
|
79
291
|
shared_runners_minutes_limit = Integer()
|
|
292
|
+
|
|
293
|
+
"""
|
|
294
|
+
Extra shared runners compute minutes for this group.
|
|
295
|
+
"""
|
|
80
296
|
extra_shared_runners_minutes_limit = Integer()
|
|
297
|
+
|
|
298
|
+
"""
|
|
299
|
+
Whether forking projects outside the group is prevented.
|
|
300
|
+
"""
|
|
81
301
|
prevent_forking_outside_group = Boolean()
|
|
302
|
+
|
|
303
|
+
"""
|
|
304
|
+
Whether service access token expiration is enforced.
|
|
305
|
+
"""
|
|
82
306
|
service_access_tokens_expiration_enforced = Boolean()
|
|
307
|
+
|
|
308
|
+
"""
|
|
309
|
+
Whether membership changes are locked.
|
|
310
|
+
"""
|
|
83
311
|
membership_lock = Boolean()
|
|
312
|
+
|
|
313
|
+
"""
|
|
314
|
+
IP address ranges allowed to access this group.
|
|
315
|
+
"""
|
|
84
316
|
ip_restriction_ranges = Json()
|
|
317
|
+
|
|
318
|
+
"""
|
|
319
|
+
Limit for unique project downloads.
|
|
320
|
+
"""
|
|
85
321
|
unique_project_download_limit = String()
|
|
322
|
+
|
|
323
|
+
"""
|
|
324
|
+
Interval in seconds for unique project download limit.
|
|
325
|
+
"""
|
|
86
326
|
unique_project_download_limit_interval_in_seconds = Integer()
|
|
327
|
+
|
|
328
|
+
"""
|
|
329
|
+
List of users to alert when download limit is exceeded.
|
|
330
|
+
"""
|
|
87
331
|
unique_project_download_limit_alertlist = Json()
|
|
332
|
+
|
|
333
|
+
"""
|
|
334
|
+
Whether to auto-ban users on excessive project downloads.
|
|
335
|
+
"""
|
|
88
336
|
auto_ban_user_on_excessive_projects_download = Boolean()
|
|
89
337
|
|
|
338
|
+
"""
|
|
339
|
+
Reference to the parent group.
|
|
340
|
+
"""
|
|
90
341
|
parent_id = BelongsToSelf()
|
|
342
|
+
|
|
343
|
+
"""
|
|
344
|
+
The parent group model.
|
|
345
|
+
"""
|
|
91
346
|
parent = BelongsToModel("parent_id")
|
|
347
|
+
|
|
92
348
|
### Search params
|
|
349
|
+
|
|
350
|
+
"""
|
|
351
|
+
List of group IDs to exclude from results.
|
|
352
|
+
"""
|
|
93
353
|
skip_groups = Json()
|
|
354
|
+
|
|
355
|
+
"""
|
|
356
|
+
Whether to include all available groups.
|
|
357
|
+
"""
|
|
94
358
|
all_available = Boolean()
|
|
359
|
+
|
|
360
|
+
"""
|
|
361
|
+
Search query to filter groups by name or path.
|
|
362
|
+
"""
|
|
95
363
|
search = String()
|
|
364
|
+
|
|
365
|
+
"""
|
|
366
|
+
Field to order results by.
|
|
367
|
+
"""
|
|
96
368
|
order_by = String()
|
|
369
|
+
|
|
370
|
+
"""
|
|
371
|
+
Sort direction (asc or desc).
|
|
372
|
+
"""
|
|
97
373
|
sort = String()
|
|
374
|
+
|
|
375
|
+
"""
|
|
376
|
+
Filter by visibility level.
|
|
377
|
+
"""
|
|
98
378
|
visibility = Select(allowed_values=["public", "internal", "private"])
|
|
379
|
+
|
|
380
|
+
"""
|
|
381
|
+
Whether to include custom attributes in the response.
|
|
382
|
+
"""
|
|
99
383
|
with_custom_attributes = Boolean()
|
|
384
|
+
|
|
385
|
+
"""
|
|
386
|
+
Whether to only return groups owned by the current user.
|
|
387
|
+
"""
|
|
100
388
|
owned = Boolean()
|
|
389
|
+
|
|
390
|
+
"""
|
|
391
|
+
Minimum access level required to include a group.
|
|
392
|
+
"""
|
|
101
393
|
min_access_level = Integer()
|
|
394
|
+
|
|
395
|
+
"""
|
|
396
|
+
Whether to only return top-level groups.
|
|
397
|
+
"""
|
|
102
398
|
top_level_only = Boolean()
|
|
399
|
+
|
|
400
|
+
"""
|
|
401
|
+
Filter by repository storage location.
|
|
402
|
+
"""
|
|
103
403
|
repository_storage = String()
|
|
404
|
+
|
|
405
|
+
"""
|
|
406
|
+
Filter by deletion date.
|
|
407
|
+
"""
|
|
104
408
|
marked_for_deletion_on = Datetime(date_format="%Y-%m-%d")
|
|
@@ -11,7 +11,41 @@ from clearskies_gitlab.rest.backends import GitlabRestBackend
|
|
|
11
11
|
class GitlabRestGroupMember(
|
|
12
12
|
gitlab_member.GitlabMember,
|
|
13
13
|
):
|
|
14
|
-
"""
|
|
14
|
+
"""
|
|
15
|
+
Model for GitLab group members.
|
|
16
|
+
|
|
17
|
+
This model provides access to the GitLab Group Members API for managing
|
|
18
|
+
user membership in groups. It allows listing, adding, updating, and removing
|
|
19
|
+
members from a group.
|
|
20
|
+
|
|
21
|
+
See https://docs.gitlab.com/api/members/ for more details.
|
|
22
|
+
|
|
23
|
+
Example usage:
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from clearskies_gitlab.rest.models import GitlabRestGroupMember
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def my_function(group_members: GitlabRestGroupMember):
|
|
30
|
+
# List all members of a group
|
|
31
|
+
for member in group_members.where("group_id=123"):
|
|
32
|
+
print(f"Member: {member.username}, Access Level: {member.access_level}")
|
|
33
|
+
|
|
34
|
+
# Find a specific member
|
|
35
|
+
admin = group_members.find("username=admin")
|
|
36
|
+
if admin:
|
|
37
|
+
print(f"Admin access level: {admin.access_level}")
|
|
38
|
+
|
|
39
|
+
# Add a new member
|
|
40
|
+
new_member = group_members.create(
|
|
41
|
+
{
|
|
42
|
+
"group_id": "123",
|
|
43
|
+
"user_id": 456,
|
|
44
|
+
"access_level": 30, # Developer
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
```
|
|
48
|
+
"""
|
|
15
49
|
|
|
16
50
|
id_column_name = "id"
|
|
17
51
|
backend = GitlabRestBackend()
|
|
@@ -21,9 +55,38 @@ class GitlabRestGroupMember(
|
|
|
21
55
|
"""Return the slug of the api endpoint for this model."""
|
|
22
56
|
return "groups/:group_id/members"
|
|
23
57
|
|
|
58
|
+
"""
|
|
59
|
+
The ID of the group to list members for.
|
|
60
|
+
|
|
61
|
+
Used to scope API requests to a specific group.
|
|
62
|
+
"""
|
|
24
63
|
group_id = String()
|
|
64
|
+
|
|
65
|
+
"""
|
|
66
|
+
Search query to filter members by name or username.
|
|
67
|
+
"""
|
|
25
68
|
query = String()
|
|
69
|
+
|
|
70
|
+
"""
|
|
71
|
+
List of user IDs to filter results.
|
|
72
|
+
"""
|
|
26
73
|
user_ids = Json()
|
|
74
|
+
|
|
75
|
+
"""
|
|
76
|
+
List of user IDs to exclude from results.
|
|
77
|
+
"""
|
|
27
78
|
skip_users = Json()
|
|
79
|
+
|
|
80
|
+
"""
|
|
81
|
+
Whether to include seat usage information in the response.
|
|
82
|
+
|
|
83
|
+
Only available for groups with a paid subscription.
|
|
84
|
+
"""
|
|
28
85
|
show_seat_info = Boolean()
|
|
86
|
+
|
|
87
|
+
"""
|
|
88
|
+
Whether to include inherited members from parent groups.
|
|
89
|
+
|
|
90
|
+
When True, returns all members including those inherited from parent groups.
|
|
91
|
+
"""
|
|
29
92
|
all = Boolean()
|
|
@@ -8,7 +8,33 @@ from clearskies_gitlab.rest.models import gitlab_rest_project
|
|
|
8
8
|
class GitlabRestGroupProject(
|
|
9
9
|
gitlab_rest_project.GitlabRestProject,
|
|
10
10
|
):
|
|
11
|
-
"""
|
|
11
|
+
"""
|
|
12
|
+
Model for projects within a GitLab group.
|
|
13
|
+
|
|
14
|
+
This model extends GitlabRestProject to provide access to projects scoped
|
|
15
|
+
to a specific group. It inherits all project fields and adds group-specific
|
|
16
|
+
filtering capabilities.
|
|
17
|
+
|
|
18
|
+
See https://docs.gitlab.com/api/groups/#list-a-groups-projects for more details.
|
|
19
|
+
|
|
20
|
+
Example usage:
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from clearskies_gitlab.rest.models import GitlabRestGroupProject
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def my_function(group_projects: GitlabRestGroupProject):
|
|
27
|
+
# List all projects in a group
|
|
28
|
+
for project in group_projects.where("group_id=123"):
|
|
29
|
+
print(f"Project: {project.name}")
|
|
30
|
+
print(f"Path: {project.path_with_namespace}")
|
|
31
|
+
|
|
32
|
+
# Find a specific project in the group
|
|
33
|
+
my_project = group_projects.find("name=my-project")
|
|
34
|
+
if my_project:
|
|
35
|
+
print(f"Found project: {my_project.web_url}")
|
|
36
|
+
```
|
|
37
|
+
"""
|
|
12
38
|
|
|
13
39
|
@classmethod
|
|
14
40
|
def destination_name(cls: type[Self]) -> str:
|
|
@@ -10,11 +10,40 @@ from clearskies_gitlab.rest.models import gitlab_rest_advanced_search
|
|
|
10
10
|
class GitlabRestGroupSearch(
|
|
11
11
|
gitlab_rest_advanced_search.GitlabRestAdvancedSearch,
|
|
12
12
|
):
|
|
13
|
-
"""
|
|
13
|
+
"""
|
|
14
|
+
Model for GitLab group-scoped search.
|
|
15
|
+
|
|
16
|
+
This model extends GitlabRestAdvancedSearch to provide search functionality
|
|
17
|
+
scoped to a specific group. It allows searching for content within a group
|
|
18
|
+
and its projects.
|
|
19
|
+
|
|
20
|
+
See https://docs.gitlab.com/api/search/#group-search-api for more details.
|
|
21
|
+
|
|
22
|
+
Example usage:
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from clearskies_gitlab.rest.models import GitlabRestGroupSearch
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def my_function(group_search: GitlabRestGroupSearch):
|
|
29
|
+
# Search for issues within a group
|
|
30
|
+
for result in group_search.where("group_id=123").where("scope=issues").where("search=bug"):
|
|
31
|
+
print(f"Found issue: {result.fields}")
|
|
32
|
+
|
|
33
|
+
# Search for code within a group
|
|
34
|
+
for result in group_search.where("group_id=123").where("scope=blobs").where("search=TODO"):
|
|
35
|
+
print(f"Found code match: {result.fields}")
|
|
36
|
+
```
|
|
37
|
+
"""
|
|
14
38
|
|
|
15
39
|
@classmethod
|
|
16
40
|
def destination_name(cls: type[Self]) -> str:
|
|
17
41
|
"""Return the slug of the api endpoint for this model."""
|
|
18
42
|
return "groups/:group_id/search"
|
|
19
43
|
|
|
44
|
+
"""
|
|
45
|
+
The ID of the group to search within.
|
|
46
|
+
|
|
47
|
+
Limits the search scope to this group and its projects.
|
|
48
|
+
"""
|
|
20
49
|
group_id = Integer()
|
|
@@ -10,4 +10,30 @@ class GitlabRestGroupSearchBlob(
|
|
|
10
10
|
gitlab_rest_group_search.GitlabRestGroupSearch,
|
|
11
11
|
gitlab_rest_advanced_search_blob.GitlabRestAdvancedSearchBlob,
|
|
12
12
|
):
|
|
13
|
-
"""
|
|
13
|
+
"""
|
|
14
|
+
Model for GitLab group-scoped blob search results.
|
|
15
|
+
|
|
16
|
+
This model combines GitlabRestGroupSearch and GitlabRestAdvancedSearchBlob
|
|
17
|
+
to provide blob (code/file) search functionality scoped to a specific group.
|
|
18
|
+
It includes all the blob-specific fields like path, filename, and line numbers.
|
|
19
|
+
|
|
20
|
+
See https://docs.gitlab.com/api/search/#scope-blobs for more details.
|
|
21
|
+
|
|
22
|
+
Example usage:
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from clearskies_gitlab.rest.models import GitlabRestGroupSearchBlob
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def my_function(group_blob_search: GitlabRestGroupSearchBlob):
|
|
29
|
+
# Search for code within a group
|
|
30
|
+
for blob in (
|
|
31
|
+
group_blob_search.where("group_id=123")
|
|
32
|
+
.where("scope=blobs")
|
|
33
|
+
.where("search=def authenticate")
|
|
34
|
+
):
|
|
35
|
+
print(f"Found in {blob.path} at line {blob.startline}")
|
|
36
|
+
print(f"Project ID: {blob.project_id}")
|
|
37
|
+
print(f"Content: {blob.data}")
|
|
38
|
+
```
|
|
39
|
+
"""
|
|
@@ -16,48 +16,85 @@ from clearskies_gitlab.rest.models import (
|
|
|
16
16
|
class GitlabRestGroupSubgroup(
|
|
17
17
|
gitlab_rest_group_base.GitlabRestGroupBase,
|
|
18
18
|
):
|
|
19
|
-
"""
|
|
19
|
+
"""
|
|
20
|
+
Model for GitLab subgroups.
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
This model provides access to subgroups within a parent group. Subgroups
|
|
23
|
+
allow for hierarchical organization of projects and teams within GitLab.
|
|
24
|
+
|
|
25
|
+
See https://docs.gitlab.com/api/groups/#list-a-groups-subgroups for more details.
|
|
26
|
+
|
|
27
|
+
Example usage:
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from clearskies_gitlab.rest.models import GitlabRestGroupSubgroup
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def my_function(subgroups: GitlabRestGroupSubgroup):
|
|
34
|
+
# List all subgroups of a parent group
|
|
35
|
+
for subgroup in subgroups.where("group_id=123"):
|
|
36
|
+
print(f"Subgroup: {subgroup.name}")
|
|
37
|
+
print(f"Full path: {subgroup.full_path}")
|
|
38
|
+
|
|
39
|
+
# Access nested subgroups
|
|
40
|
+
for nested in subgroup.subgroups:
|
|
41
|
+
print(f" Nested: {nested.name}")
|
|
42
|
+
|
|
43
|
+
# Find a specific subgroup
|
|
44
|
+
team = subgroups.find("path=my-team")
|
|
45
|
+
if team:
|
|
46
|
+
for project in team.projects:
|
|
47
|
+
print(f"Project: {project.name}")
|
|
48
|
+
```
|
|
49
|
+
"""
|
|
22
50
|
|
|
23
51
|
@classmethod
|
|
24
52
|
def destination_name(cls: type[Self]) -> str:
|
|
25
53
|
"""Return the slug of the api endpoint for this model."""
|
|
26
54
|
return "groups/:group_id/subgroups"
|
|
27
55
|
|
|
56
|
+
"""
|
|
57
|
+
The ID of the parent group.
|
|
58
|
+
|
|
59
|
+
Used to scope API requests to subgroups of a specific parent group.
|
|
60
|
+
"""
|
|
28
61
|
group_id = String()
|
|
29
62
|
|
|
63
|
+
"""
|
|
64
|
+
Projects belonging to this subgroup.
|
|
65
|
+
"""
|
|
30
66
|
projects = HasMany(
|
|
31
67
|
gitlab_rest_group_project_reference.GitlabRestGroupProjectReference,
|
|
32
68
|
foreign_column_name="group_id",
|
|
33
69
|
)
|
|
70
|
+
|
|
71
|
+
"""
|
|
72
|
+
Access tokens for this subgroup.
|
|
73
|
+
"""
|
|
34
74
|
access_tokens = HasMany(
|
|
35
75
|
gitlab_rest_group_access_token_reference.GitlabRestGroupAccessTokenReference,
|
|
36
76
|
foreign_column_name="group_id",
|
|
37
77
|
)
|
|
78
|
+
|
|
79
|
+
"""
|
|
80
|
+
CI/CD variables defined for this subgroup.
|
|
81
|
+
"""
|
|
38
82
|
variables = HasMany(
|
|
39
83
|
gitlab_rest_group_variable_reference.GitlabRestGroupVariableReference,
|
|
40
84
|
foreign_column_name="group_id",
|
|
41
85
|
)
|
|
86
|
+
|
|
87
|
+
"""
|
|
88
|
+
Nested subgroups within this subgroup.
|
|
89
|
+
"""
|
|
42
90
|
subgroups = HasManySelf(
|
|
43
91
|
foreign_column_name="group_id",
|
|
44
92
|
)
|
|
93
|
+
|
|
94
|
+
"""
|
|
95
|
+
Members of this subgroup.
|
|
96
|
+
"""
|
|
45
97
|
members = HasMany(
|
|
46
98
|
gitlab_rest_group_member_reference.GitlabRestGroupMemberReference,
|
|
47
99
|
foreign_column_name="group_id",
|
|
48
100
|
)
|
|
49
|
-
# parent_id = BelongsToSelf()
|
|
50
|
-
# parent = BelongsToModel("parent_id")
|
|
51
|
-
# ### Search params
|
|
52
|
-
# skip_groups = Json()
|
|
53
|
-
# all_available = Boolean()
|
|
54
|
-
# search = String()
|
|
55
|
-
# order_by = String()
|
|
56
|
-
# sort = String()
|
|
57
|
-
# visibility = Select(allowed_values=["public", "internal", "private"])
|
|
58
|
-
# with_custom_attributes = Boolean()
|
|
59
|
-
# owned = Boolean()
|
|
60
|
-
# min_access_level = Integer()
|
|
61
|
-
# top_level_only = Boolean()
|
|
62
|
-
# repository_storage = String()
|
|
63
|
-
# marked_for_deletion_on = Datetime(date_format="%Y-%m-%d")
|