Coverage for nexios\websockets\utils.py: 100%

1 from datetime import datetime, timezone

2 from enum import Enum

3 from dataclasses import dataclass

4 import uuid

5 from uuid import UUID

6 import typing

7

8

9 class ChannelAddStatusEnum(Enum):

10 CHANNEL_ADDED = "CHANNEL_ADDED"

11 CHANNEL_EXIST = "CHANNEL_EXIST"

12

13

14 class ChannelRemoveStatusEnum(Enum):

15 CHANNEL_REMOVED = "CHANNEL_REMOVED"

16 CHANNEL_DOES_NOT_EXIST = "CHANNEL_DOES_NOT_EXIST"

17 GROUP_REMOVED = "GROUP_REMOVED"

18 GROUP_DOES_NOT_EXIST = "GROUP_DOES_NOT_EXIST"

19

20

21 class GroupSendStatusEnum(Enum):

22 GROUP_SEND = "GROUP_SEND"

23 NO_SUCH_GROUP = "NO_SUCH_GROUP"

24

25

26 class PayloadTypeEnum(Enum):

27 JSON = "json"

28 TEXT = "text"

29 BYTES = "bytes"

30

31

32@dataclass

33 class ChannelMessageDC:

34 payload: typing.Union[str, bytes]

35 uuid: UUID = uuid.uuid4()

36 created: datetime = datetime.now(tz=timezone.utc)