clear-skies-gitlab 2.0.4__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.
Files changed (34) hide show
  1. {clear_skies_gitlab-2.0.4.dist-info → clear_skies_gitlab-2.0.5.dist-info}/METADATA +1 -1
  2. {clear_skies_gitlab-2.0.4.dist-info → clear_skies_gitlab-2.0.5.dist-info}/RECORD +34 -34
  3. clearskies_gitlab/defaults/gitlab_default_auth.py +33 -2
  4. clearskies_gitlab/defaults/gitlab_default_host.py +31 -2
  5. clearskies_gitlab/rest/backends/gitlab_rest_backend.py +98 -80
  6. clearskies_gitlab/rest/gitlab_branch_rule.py +74 -1
  7. clearskies_gitlab/rest/gitlab_cicd_variable.py +78 -1
  8. clearskies_gitlab/rest/gitlab_member.py +80 -1
  9. clearskies_gitlab/rest/models/gitlab_rest_advanced_search.py +67 -1
  10. clearskies_gitlab/rest/models/gitlab_rest_advanced_search_blob.py +72 -1
  11. clearskies_gitlab/rest/models/gitlab_rest_current_user.py +134 -1
  12. clearskies_gitlab/rest/models/gitlab_rest_group.py +60 -1
  13. clearskies_gitlab/rest/models/gitlab_rest_group_access_token.py +102 -1
  14. clearskies_gitlab/rest/models/gitlab_rest_group_base.py +305 -1
  15. clearskies_gitlab/rest/models/gitlab_rest_group_member.py +64 -1
  16. clearskies_gitlab/rest/models/gitlab_rest_group_project.py +27 -1
  17. clearskies_gitlab/rest/models/gitlab_rest_group_search.py +30 -1
  18. clearskies_gitlab/rest/models/gitlab_rest_group_search_blob.py +27 -1
  19. clearskies_gitlab/rest/models/gitlab_rest_group_subgroup.py +54 -17
  20. clearskies_gitlab/rest/models/gitlab_rest_group_variable.py +44 -1
  21. clearskies_gitlab/rest/models/gitlab_rest_namespace.py +178 -1
  22. clearskies_gitlab/rest/models/gitlab_rest_project.py +501 -3
  23. clearskies_gitlab/rest/models/gitlab_rest_project_approval_config.py +72 -1
  24. clearskies_gitlab/rest/models/gitlab_rest_project_approval_rule.py +92 -1
  25. clearskies_gitlab/rest/models/gitlab_rest_project_member.py +62 -1
  26. clearskies_gitlab/rest/models/gitlab_rest_project_protected_branch.py +132 -1
  27. clearskies_gitlab/rest/models/gitlab_rest_project_repository_commit.py +144 -2
  28. clearskies_gitlab/rest/models/gitlab_rest_project_repository_commit_diff.py +89 -2
  29. clearskies_gitlab/rest/models/gitlab_rest_project_repository_contributor.py +68 -2
  30. clearskies_gitlab/rest/models/gitlab_rest_project_repository_file.py +90 -1
  31. clearskies_gitlab/rest/models/gitlab_rest_project_repository_file_raw.py +57 -3
  32. clearskies_gitlab/rest/models/gitlab_rest_project_variable.py +46 -1
  33. {clear_skies_gitlab-2.0.4.dist-info → clear_skies_gitlab-2.0.5.dist-info}/WHEEL +0 -0
  34. {clear_skies_gitlab-2.0.4.dist-info → clear_skies_gitlab-2.0.5.dist-info}/licenses/LICENSE +0 -0
@@ -11,7 +11,38 @@ from clearskies_gitlab.rest.backends import GitlabRestBackend
11
11
  class GitlabRestProjectRepositoryCommitDiff(
12
12
  Model,
13
13
  ):
14
- """Model for projects repository commits diff."""
14
+ r"""
15
+ Model for GitLab project repository commit diffs.
16
+
17
+ This model provides access to the GitLab Commits API for retrieving
18
+ the diff (file changes) of a specific commit. Each diff entry represents
19
+ changes to a single file.
20
+
21
+ See https://docs.gitlab.com/api/commits/#get-the-diff-of-a-commit for more details.
22
+
23
+ Example usage:
24
+
25
+ ```python
26
+ from clearskies_gitlab.rest.models import GitlabRestProjectRepositoryCommitDiff
27
+
28
+
29
+ def my_function(diffs: GitlabRestProjectRepositoryCommitDiff):
30
+ # Get diff for a specific commit
31
+ for diff in diffs.where("project_id=123&commit_id=abc123"):
32
+ print(f"File: {diff.new_path}")
33
+ if diff.new_file:
34
+ print(" (new file)")
35
+ elif diff.deleted_file:
36
+ print(" (deleted)")
37
+ elif diff.renamed_file:
38
+ print(f" (renamed from {diff.old_path})")
39
+ print(f"Diff:\n{diff.diff}")
40
+
41
+ # Get unified diff format
42
+ for diff in diffs.where("project_id=123&commit_id=abc123&unidiff=true"):
43
+ print(diff.diff)
44
+ ```
45
+ """
15
46
 
16
47
  id_column_name = "commit_id"
17
48
 
@@ -22,15 +53,71 @@ class GitlabRestProjectRepositoryCommitDiff(
22
53
  """Return the slug of the api endpoint for this model."""
23
54
  return "projects/:project_id/repository/commits/:commit_id/diff"
24
55
 
56
+ """
57
+ The diff content showing the changes.
58
+
59
+ Contains the unified diff format showing additions and deletions.
60
+ """
25
61
  diff = String()
62
+
63
+ """
64
+ The new file path after the commit.
65
+
66
+ For renamed files, this is the destination path.
67
+ """
26
68
  new_path = String()
69
+
70
+ """
71
+ The old file path before the commit.
72
+
73
+ For renamed files, this is the source path.
74
+ """
27
75
  old_path = String()
76
+
77
+ """
78
+ The file mode before the change.
79
+
80
+ Unix file permission mode (e.g., 100644 for regular file).
81
+ """
28
82
  a_mode = Integer()
83
+
84
+ """
85
+ The file mode after the change.
86
+
87
+ Unix file permission mode (e.g., 100644 for regular file).
88
+ """
29
89
  b_mode = Integer()
90
+
91
+ """
92
+ Whether this is a newly created file.
93
+ """
30
94
  new_file = Boolean()
95
+
96
+ """
97
+ Whether this file was renamed.
98
+ """
31
99
  renamed_file = Boolean()
100
+
101
+ """
102
+ Whether this file was deleted.
103
+ """
32
104
  deleted_file = Boolean()
33
- # search params
105
+
106
+ ### Search params
107
+
108
+ """
109
+ The ID of the project containing the commit.
110
+ """
34
111
  project_id = Integer()
112
+
113
+ """
114
+ The SHA hash of the commit to get the diff for.
115
+ """
35
116
  commit_id = String()
117
+
118
+ """
119
+ Whether to return the diff in unified diff format.
120
+
121
+ When true, returns a more standard unified diff format.
122
+ """
36
123
  unidiff = Boolean()
@@ -12,7 +12,35 @@ from clearskies_gitlab.rest.models import gitlab_rest_project_reference
12
12
  class GitlabRestProjectRepositoryContributor(
13
13
  Model,
14
14
  ):
15
- """Model for projects repository contributors."""
15
+ """
16
+ Model for GitLab project repository contributors.
17
+
18
+ This model provides access to the GitLab Repository Contributors API for
19
+ retrieving statistics about contributors to a project's repository.
20
+ Contributors are identified by their commit email address.
21
+
22
+ See https://docs.gitlab.com/api/repositories/#contributors for more details.
23
+
24
+ Example usage:
25
+
26
+ ```python
27
+ from clearskies_gitlab.rest.models import GitlabRestProjectRepositoryContributor
28
+
29
+
30
+ def my_function(contributors: GitlabRestProjectRepositoryContributor):
31
+ # List all contributors to a project
32
+ for contributor in contributors.where("project_id=123"):
33
+ print(f"Contributor: {contributor.name}")
34
+ print(f"Email: {contributor.email}")
35
+ print(f"Commits: {contributor.commits}")
36
+ print(f"Lines added: {contributor.additions}")
37
+ print(f"Lines deleted: {contributor.deletions}")
38
+
39
+ # Get contributors for a specific branch
40
+ for contributor in contributors.where("project_id=123&ref=develop"):
41
+ print(f"{contributor.name}: {contributor.commits} commits")
42
+ ```
43
+ """
16
44
 
17
45
  id_column_name = "email"
18
46
 
@@ -23,12 +51,50 @@ class GitlabRestProjectRepositoryContributor(
23
51
  """Return the slug of the api endpoint for this model."""
24
52
  return "projects/:project_id/repository/contributors"
25
53
 
54
+ """
55
+ The display name of the contributor.
56
+
57
+ This is taken from the Git commit author name.
58
+ """
26
59
  name = String()
60
+
61
+ """
62
+ The email address of the contributor.
63
+
64
+ This is taken from the Git commit author email and serves as the unique identifier.
65
+ """
27
66
  email = Email()
67
+
68
+ """
69
+ The total number of commits by this contributor.
70
+ """
28
71
  commits = Integer()
72
+
73
+ """
74
+ The total number of lines added by this contributor.
75
+ """
29
76
  additions = Integer()
77
+
78
+ """
79
+ The total number of lines deleted by this contributor.
80
+ """
30
81
  deletions = Integer()
31
- # search params
82
+
83
+ ### Search params
84
+
85
+ """
86
+ The ID of the project to query contributors for.
87
+ """
32
88
  project_id = BelongsToId(gitlab_rest_project_reference.GitlabRestProjectReference)
89
+
90
+ """
91
+ The project model this contributor belongs to.
92
+ """
33
93
  project = BelongsToModel("project_id")
94
+
95
+ """
96
+ The branch or tag to get contributors for.
97
+
98
+ Defaults to the default branch if not specified.
99
+ """
34
100
  ref = String()
@@ -12,7 +12,37 @@ from clearskies_gitlab.rest.models import gitlab_rest_project_reference
12
12
  class GitlabRestProjectRepositoryFile(
13
13
  Model,
14
14
  ):
15
- """Model for projects repository commits diff."""
15
+ """
16
+ Model for GitLab project repository files.
17
+
18
+ This model provides access to the GitLab Repository Files API for
19
+ retrieving file metadata and content from a project's repository.
20
+ Files are identified by their path within the repository.
21
+
22
+ See https://docs.gitlab.com/api/repository_files/ for more details.
23
+
24
+ Example usage:
25
+
26
+ ```python
27
+ from clearskies_gitlab.rest.models import GitlabRestProjectRepositoryFile
28
+
29
+
30
+ def my_function(files: GitlabRestProjectRepositoryFile):
31
+ # Get a specific file from the repository
32
+ readme = files.find("project_id=123&file_path=README.md")
33
+ if readme:
34
+ print(f"File: {readme.file_name}")
35
+ print(f"Size: {readme.size} bytes")
36
+ print(f"Encoding: {readme.encoding}")
37
+ # Content is base64 encoded by default
38
+ print(f"Content: {readme.content}")
39
+
40
+ # Get a file from a specific branch
41
+ config = files.find("project_id=123&file_path=config.yml&ref=develop")
42
+ if config:
43
+ print(f"Last commit: {config.last_commit_id}")
44
+ ```
45
+ """
16
46
 
17
47
  id_column_name = "file_path"
18
48
 
@@ -23,17 +53,76 @@ class GitlabRestProjectRepositoryFile(
23
53
  """Return the slug of the api endpoint for this model."""
24
54
  return "projects/:project_id/repository/files/:file_path"
25
55
 
56
+ """
57
+ The ID of the project containing the file.
58
+ """
26
59
  project_id = BelongsToId(gitlab_rest_project_reference.GitlabRestProjectReference)
60
+
61
+ """
62
+ The project model this file belongs to.
63
+ """
27
64
  project = BelongsToModel("project_id")
28
65
 
66
+ """
67
+ The path to the file within the repository.
68
+
69
+ This serves as the unique identifier for the file.
70
+ """
29
71
  file_path = String()
72
+
73
+ """
74
+ The branch, tag, or commit SHA to retrieve the file from.
75
+
76
+ Defaults to HEAD (the default branch).
77
+ """
30
78
  ref = String(default="HEAD")
79
+
80
+ """
81
+ The blob SHA of the file content.
82
+ """
31
83
  blob_id = String()
84
+
85
+ """
86
+ The commit SHA where this file was last modified.
87
+ """
32
88
  commit_id = String()
89
+
90
+ """
91
+ The file content.
92
+
93
+ By default, this is base64 encoded. Use the encoding field
94
+ to determine how to decode it.
95
+ """
33
96
  content = String()
97
+
98
+ """
99
+ The SHA256 hash of the file content.
100
+ """
34
101
  content_sha256 = String()
102
+
103
+ """
104
+ The encoding of the content field.
105
+
106
+ Typically "base64" for binary-safe transfer.
107
+ """
35
108
  encoding = String()
109
+
110
+ """
111
+ Whether the file has the executable permission set.
112
+ """
36
113
  execute_filemode = Boolean()
114
+
115
+ """
116
+ The name of the file (without path).
117
+ """
37
118
  file_name = String()
119
+
120
+ """
121
+ The commit SHA of the last commit that modified this file.
122
+ """
38
123
  last_commit_id = String()
124
+
125
+ """
126
+ The size of the file in bytes.
127
+ """
39
128
  size = Integer()
@@ -9,10 +9,39 @@ from clearskies_gitlab.rest.backends import GitlabRestBackend
9
9
  from clearskies_gitlab.rest.models import gitlab_rest_project_reference
10
10
 
11
11
 
12
- class GitlabRestProjectRepositoryCommitDiff(
12
+ class GitlabRestProjectRepositoryFileRaw(
13
13
  Model,
14
14
  ):
15
- """Model for projects repository commits diff."""
15
+ """
16
+ Model for GitLab project repository raw file content.
17
+
18
+ This model provides access to the GitLab Repository Files API for
19
+ retrieving raw file content from a project's repository. Unlike the
20
+ regular file endpoint, this returns the raw file content without
21
+ base64 encoding.
22
+
23
+ See https://docs.gitlab.com/api/repository_files/#get-raw-file-from-repository for more details.
24
+
25
+ Example usage:
26
+
27
+ ```python
28
+ from clearskies_gitlab.rest.models import GitlabRestProjectRepositoryFileRaw
29
+
30
+
31
+ def my_function(raw_files: GitlabRestProjectRepositoryFileRaw):
32
+ # Get raw content of a file
33
+ readme = raw_files.find("project_id=123&file_path=README.md")
34
+ if readme:
35
+ # Content is returned as-is, not base64 encoded
36
+ print(readme.content)
37
+
38
+ # Get raw content from a specific branch
39
+ config = raw_files.find("project_id=123&file_path=config.yml&ref=develop")
40
+
41
+ # Get LFS pointer content
42
+ large_file = raw_files.find("project_id=123&file_path=data.bin&lfs=true")
43
+ ```
44
+ """
16
45
 
17
46
  id_column_name = "file_path"
18
47
 
@@ -21,11 +50,36 @@ class GitlabRestProjectRepositoryCommitDiff(
21
50
  @classmethod
22
51
  def destination_name(cls: type[Self]) -> str:
23
52
  """Return the slug of the api endpoint for this model."""
24
- return "projects/:project_id/repository/files/:file_path"
53
+ return "projects/:project_id/repository/files/:file_path/raw"
25
54
 
55
+ """
56
+ The ID of the project containing the file.
57
+ """
26
58
  project_id = BelongsToId(gitlab_rest_project_reference.GitlabRestProjectReference)
59
+
60
+ """
61
+ The project model this file belongs to.
62
+ """
27
63
  project = BelongsToModel("project_id")
28
64
 
65
+ """
66
+ The path to the file within the repository.
67
+
68
+ This serves as the unique identifier for the file.
69
+ """
29
70
  file_path = String()
71
+
72
+ """
73
+ The branch, tag, or commit SHA to retrieve the file from.
74
+
75
+ Defaults to HEAD (the default branch).
76
+ """
30
77
  ref = String(default="HEAD")
78
+
79
+ """
80
+ Whether to return the LFS pointer content.
81
+
82
+ When true and the file is stored in Git LFS, returns the
83
+ LFS pointer file content instead of the actual file.
84
+ """
31
85
  lfs = Boolean()
@@ -12,7 +12,45 @@ from clearskies_gitlab.rest.models import gitlab_rest_project_reference
12
12
  class GitlabRestProjectVariable(
13
13
  gitlab_cicd_variable.GitlabCICDVariable,
14
14
  ):
15
- """Model for gitlab group variables."""
15
+ """
16
+ Model for GitLab project CI/CD variables.
17
+
18
+ This model provides access to the GitLab Project Variables API for managing
19
+ CI/CD variables at the project level. It extends the base GitlabCICDVariable
20
+ class with project-specific functionality.
21
+
22
+ See https://docs.gitlab.com/api/project_level_variables/ for more details.
23
+
24
+ Example usage:
25
+
26
+ ```python
27
+ from clearskies_gitlab.rest.models import GitlabRestProjectVariable
28
+
29
+
30
+ def my_function(variables: GitlabRestProjectVariable):
31
+ # List all variables for a project
32
+ for var in variables.where("project_id=123"):
33
+ print(f"Variable: {var.key}")
34
+ print(f"Protected: {var.protected}")
35
+ print(f"Masked: {var.masked}")
36
+
37
+ # Get a specific variable
38
+ api_key = variables.find("project_id=123&key=API_KEY")
39
+ if api_key:
40
+ print(f"Value: {api_key.value}")
41
+
42
+ # Create a new variable
43
+ variables.create(
44
+ {
45
+ "project_id": 123,
46
+ "key": "NEW_VAR",
47
+ "value": "secret_value",
48
+ "protected": True,
49
+ "masked": True,
50
+ }
51
+ )
52
+ ```
53
+ """
16
54
 
17
55
  backend = GitlabRestBackend()
18
56
  id_column_name = "key"
@@ -22,5 +60,12 @@ class GitlabRestProjectVariable(
22
60
  """Return the slug of the api endpoint for this model."""
23
61
  return "projects/:project_id/variables"
24
62
 
63
+ """
64
+ The ID of the project this variable belongs to.
65
+ """
25
66
  project_id = BelongsToId(gitlab_rest_project_reference.GitlabRestProjectReference)
67
+
68
+ """
69
+ The project model this variable belongs to.
70
+ """
26
71
  project = BelongsToModel("project_id")