- Notifications
You must be signed in to change notification settings - Fork674
feat(api): Convert gitlab.const to Enums#1688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
12 changes: 6 additions & 6 deletionsdocs/gl_objects/access_requests.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
18 changes: 9 additions & 9 deletionsdocs/gl_objects/groups.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
16 changes: 8 additions & 8 deletionsdocs/gl_objects/notifications.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletionsdocs/gl_objects/projects.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletionsdocs/gl_objects/protected_branches.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
32 changes: 16 additions & 16 deletionsdocs/gl_objects/search.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletiondocs/gl_objects/snippets.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
109 changes: 80 additions & 29 deletionsgitlab/const.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -15,13 +15,16 @@ | ||
| # You should have received a copy of the GNU Lesser General Public License | ||
| # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| from enum import Enum, IntEnum | ||
| from gitlab._version import __title__, __version__ | ||
| # NOTE(jlvillal): '_DEPRECATED' only affects users accessing constants via the | ||
| # top-level gitlab.* namespace. See 'gitlab/__init__.py:__getattr__()' for the | ||
| # consumer of '_DEPRECATED' For example 'x = gitlab.NO_ACCESS'. We want users | ||
| # to instead use constants by doing code like: gitlab.const.NO_ACCESS. | ||
| _DEPRECATED = [ | ||
| "ADMIN_ACCESS", | ||
| "DEFAULT_URL", | ||
| "DEVELOPER_ACCESS", | ||
| "GUEST_ACCESS", | ||
| @@ -52,43 +55,91 @@ | ||
| "VISIBILITY_PUBLIC", | ||
| ] | ||
jspricke marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| # https://gitlab.com/gitlab-org/gitlab/-/blob/e97357824bedf007e75f8782259fe07435b64fbb/lib/gitlab/access.rb#L12-18 | ||
| class AccessLevel(IntEnum): | ||
| NO_ACCESS: int = 0 | ||
| MINIMAL_ACCESS: int = 5 | ||
| GUEST: int = 10 | ||
| REPORTER: int = 20 | ||
| DEVELOPER: int = 30 | ||
| MAINTAINER: int = 40 | ||
| OWNER: int = 50 | ||
| ADMIN: int = 60 | ||
| # https://gitlab.com/gitlab-org/gitlab/-/blob/e97357824bedf007e75f8782259fe07435b64fbb/lib/gitlab/visibility_level.rb#L23-25 | ||
| class Visibility(Enum): | ||
| PRIVATE: str = "private" | ||
| INTERNAL: str = "internal" | ||
| PUBLIC: str = "public" | ||
| class NotificationLevel(Enum): | ||
| DISABLED: str = "disabled" | ||
| PARTICIPATING: str = "participating" | ||
| WATCH: str = "watch" | ||
| GLOBAL: str = "global" | ||
| MENTION: str = "mention" | ||
| CUSTOM: str = "custom" | ||
| # https://gitlab.com/gitlab-org/gitlab/-/blob/e97357824bedf007e75f8782259fe07435b64fbb/app/views/search/_category.html.haml#L10-37 | ||
| class SearchScope(Enum): | ||
| # all scopes (global, group and project) | ||
| PROJECTS: str = "projects" | ||
| ISSUES: str = "issues" | ||
| MERGE_REQUESTS: str = "merge_requests" | ||
| MILESTONES: str = "milestones" | ||
| WIKI_BLOBS: str = "wiki_blobs" | ||
| COMMITS: str = "commits" | ||
| BLOBS: str = "blobs" | ||
| USERS: str = "users" | ||
| # specific global scope | ||
| GLOBAL_SNIPPET_TITLES: str = "snippet_titles" | ||
| # specific project scope | ||
| PROJECT_NOTES: str = "notes" | ||
| DEFAULT_URL: str = "https://gitlab.com" | ||
| NO_ACCESS = AccessLevel.NO_ACCESS.value | ||
| MINIMAL_ACCESS = AccessLevel.MINIMAL_ACCESS.value | ||
| GUEST_ACCESS = AccessLevel.GUEST.value | ||
| REPORTER_ACCESS = AccessLevel.REPORTER.value | ||
| DEVELOPER_ACCESS = AccessLevel.DEVELOPER.value | ||
| MAINTAINER_ACCESS = AccessLevel.MAINTAINER.value | ||
| OWNER_ACCESS = AccessLevel.OWNER.value | ||
| ADMIN_ACCESS = AccessLevel.ADMIN.value | ||
| VISIBILITY_PRIVATE = Visibility.PRIVATE.value | ||
| VISIBILITY_INTERNAL = Visibility.INTERNAL.value | ||
| VISIBILITY_PUBLIC = Visibility.PUBLIC.value | ||
| NOTIFICATION_LEVEL_DISABLED = NotificationLevel.DISABLED.value | ||
| NOTIFICATION_LEVEL_PARTICIPATING = NotificationLevel.PARTICIPATING.value | ||
| NOTIFICATION_LEVEL_WATCH = NotificationLevel.WATCH.value | ||
| NOTIFICATION_LEVEL_GLOBAL = NotificationLevel.GLOBAL.value | ||
| NOTIFICATION_LEVEL_MENTION = NotificationLevel.MENTION.value | ||
| NOTIFICATION_LEVEL_CUSTOM = NotificationLevel.CUSTOM.value | ||
| # Search scopes | ||
| # all scopes (global, group and project) | ||
| SEARCH_SCOPE_PROJECTS = SearchScope.PROJECTS.value | ||
| SEARCH_SCOPE_ISSUES = SearchScope.ISSUES.value | ||
| SEARCH_SCOPE_MERGE_REQUESTS = SearchScope.MERGE_REQUESTS.value | ||
| SEARCH_SCOPE_MILESTONES = SearchScope.MILESTONES.value | ||
| SEARCH_SCOPE_WIKI_BLOBS = SearchScope.WIKI_BLOBS.value | ||
| SEARCH_SCOPE_COMMITS = SearchScope.COMMITS.value | ||
| SEARCH_SCOPE_BLOBS = SearchScope.BLOBS.value | ||
| SEARCH_SCOPE_USERS = SearchScope.USERS.value | ||
| # specific global scope | ||
jspricke marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| SEARCH_SCOPE_GLOBAL_SNIPPET_TITLES = SearchScope.GLOBAL_SNIPPET_TITLES.value | ||
| # specific project scope | ||
| SEARCH_SCOPE_PROJECT_NOTES = SearchScope.PROJECT_NOTES.value | ||
| USER_AGENT: str = f"{__title__}/{__version__}" | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.