diff options
author | Nejc Habjan <nejc.habjan@siemens.com> | 2022-06-22 23:34:47 +0200 |
---|---|---|
committer | John Villalovos <john@sodarock.com> | 2022-06-27 16:36:23 -0700 |
commit | d65213385a6f497c2595d3af3a41756919b9c9a1 (patch) | |
tree | a736bd15d750b4dd300bdfb982923e3ec562f3aa /gitlab/const.py | |
parent | f185b17ff5aabedd32d3facd2a46ebf9069c9692 (diff) | |
download | gitlab-d65213385a6f497c2595d3af3a41756919b9c9a1.tar.gz |
refactor: do not recommend plain gitlab.const constants
Diffstat (limited to 'gitlab/const.py')
-rw-r--r-- | gitlab/const.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gitlab/const.py b/gitlab/const.py index 382590d..5108de2 100644 --- a/gitlab/const.py +++ b/gitlab/const.py @@ -56,6 +56,10 @@ _DEPRECATED = [ ] +class GitlabEnum(str, Enum): + """An enum mixed in with str to make it JSON-serializable.""" + + # https://gitlab.com/gitlab-org/gitlab/-/blob/e97357824bedf007e75f8782259fe07435b64fbb/lib/gitlab/access.rb#L12-18 class AccessLevel(IntEnum): NO_ACCESS: int = 0 @@ -69,13 +73,13 @@ class AccessLevel(IntEnum): # https://gitlab.com/gitlab-org/gitlab/-/blob/e97357824bedf007e75f8782259fe07435b64fbb/lib/gitlab/visibility_level.rb#L23-25 -class Visibility(Enum): +class Visibility(GitlabEnum): PRIVATE: str = "private" INTERNAL: str = "internal" PUBLIC: str = "public" -class NotificationLevel(Enum): +class NotificationLevel(GitlabEnum): DISABLED: str = "disabled" PARTICIPATING: str = "participating" WATCH: str = "watch" @@ -85,7 +89,7 @@ class NotificationLevel(Enum): # https://gitlab.com/gitlab-org/gitlab/-/blob/e97357824bedf007e75f8782259fe07435b64fbb/app/views/search/_category.html.haml#L10-37 -class SearchScope(Enum): +class SearchScope(GitlabEnum): # all scopes (global, group and project) PROJECTS: str = "projects" ISSUES: str = "issues" |