Skip to content

Commit 7f6b6e6

Browse files
committed
feat: add appearance API
1 parent afdc43f commit 7f6b6e6

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

gitlab/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ def __init__(
129129
self.projects = objects.ProjectManager(self)
130130
self.runners = objects.RunnerManager(self)
131131
self.settings = objects.ApplicationSettingsManager(self)
132+
self.appearance = objects.ApplicationAppearanceManager(self)
132133
self.sidekiq = objects.SidekiqManager(self)
133134
self.snippets = objects.SnippetManager(self)
134135
self.users = objects.UserManager(self)

gitlab/v4/objects.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,51 @@ class CurrentUserManager(GetWithoutIdMixin, RESTManager):
514514
_obj_cls = CurrentUser
515515

516516

517+
class ApplicationAppearance(SaveMixin, RESTObject):
518+
_id_attr = None
519+
520+
521+
class ApplicationAppearanceManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
522+
_path = "/application/appearance"
523+
_obj_cls = ApplicationAppearance
524+
_update_attrs = (
525+
tuple(),
526+
(
527+
"title",
528+
"description",
529+
"logo",
530+
"header_logo",
531+
"favicon",
532+
"new_project_guidelines",
533+
"header_message",
534+
"footer_message",
535+
"message_background_color",
536+
"message_font_color",
537+
"email_header_and_footer_enabled",
538+
),
539+
)
540+
541+
@exc.on_http_error(exc.GitlabUpdateError)
542+
def update(self, id=None, new_data=None, **kwargs):
543+
"""Update an object on the server.
544+
545+
Args:
546+
id: ID of the object to update (can be None if not required)
547+
new_data: the update data for the object
548+
**kwargs: Extra options to send to the server (e.g. sudo)
549+
550+
Returns:
551+
dict: The new object data (*not* a RESTObject)
552+
553+
Raises:
554+
GitlabAuthenticationError: If authentication is not correct
555+
GitlabUpdateError: If the server cannot perform the request
556+
"""
557+
new_data = new_data or {}
558+
data = new_data.copy()
559+
super(ApplicationAppearanceManager, self).update(id, data, **kwargs)
560+
561+
517562
class ApplicationSettings(SaveMixin, RESTObject):
518563
_id_attr = None
519564

0 commit comments

Comments
 (0)