summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects/broadcast_messages.py
blob: 3beb4ace039da2b72ed952b45b1d3ca9880ed712 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from typing import Any, cast, Union

from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
from gitlab.types import RequiredOptional

__all__ = [
    "BroadcastMessage",
    "BroadcastMessageManager",
]


class BroadcastMessage(SaveMixin, ObjectDeleteMixin, RESTObject):
    pass


class BroadcastMessageManager(CRUDMixin, RESTManager):
    _path = "/broadcast_messages"
    _obj_cls = BroadcastMessage

    _create_attrs = RequiredOptional(
        required=("message",), optional=("starts_at", "ends_at", "color", "font")
    )
    _update_attrs = RequiredOptional(
        optional=("message", "starts_at", "ends_at", "color", "font")
    )

    def get(
        self, id: Union[str, int], lazy: bool = False, **kwargs: Any
    ) -> BroadcastMessage:
        return cast(BroadcastMessage, super().get(id=id, lazy=lazy, **kwargs))