diff options
author | Nejc Habjan <hab.nejc@gmail.com> | 2021-02-07 00:29:59 +0100 |
---|---|---|
committer | Nejc Habjan <hab.nejc@gmail.com> | 2021-02-07 16:05:05 +0100 |
commit | a5a48ad08577be70c6ca511d3b4803624e5c2043 (patch) | |
tree | c1b80daad6dbb6ea3b1a3498d70016ef77abf6b3 /gitlab/v4/objects/appearance.py | |
parent | 9d6c1882d567116e16484f3e0a1036da4967c537 (diff) | |
download | gitlab-a5a48ad08577be70c6ca511d3b4803624e5c2043.tar.gz |
refactor(v4): split objects and managers per API resource
Diffstat (limited to 'gitlab/v4/objects/appearance.py')
-rw-r--r-- | gitlab/v4/objects/appearance.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/gitlab/v4/objects/appearance.py b/gitlab/v4/objects/appearance.py new file mode 100644 index 0000000..4854e2a --- /dev/null +++ b/gitlab/v4/objects/appearance.py @@ -0,0 +1,48 @@ +from gitlab import exceptions as exc +from gitlab.base import * # noqa +from gitlab.mixins import * # noqa + + +class ApplicationAppearance(SaveMixin, RESTObject): + _id_attr = None + + +class ApplicationAppearanceManager(GetWithoutIdMixin, UpdateMixin, RESTManager): + _path = "/application/appearance" + _obj_cls = ApplicationAppearance + _update_attrs = ( + tuple(), + ( + "title", + "description", + "logo", + "header_logo", + "favicon", + "new_project_guidelines", + "header_message", + "footer_message", + "message_background_color", + "message_font_color", + "email_header_and_footer_enabled", + ), + ) + + @exc.on_http_error(exc.GitlabUpdateError) + def update(self, id=None, new_data=None, **kwargs): + """Update an object on the server. + + Args: + id: ID of the object to update (can be None if not required) + new_data: the update data for the object + **kwargs: Extra options to send to the server (e.g. sudo) + + Returns: + dict: The new object data (*not* a RESTObject) + + Raises: + GitlabAuthenticationError: If authentication is not correct + GitlabUpdateError: If the server cannot perform the request + """ + new_data = new_data or {} + data = new_data.copy() + super(ApplicationAppearanceManager, self).update(id, data, **kwargs) |