summaryrefslogtreecommitdiffstats
path: root/pkb_client/client/forwarding.py
blob: 64962ca82e6ffba424ade163598a98935053b082 (plain) (blame)
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
from dataclasses import dataclass
from enum import Enum


class URLForwardingType(str, Enum):
    temporary = "temporary"
    permanent = "permanent"


@dataclass
class URLForwarding:
    id: str
    subdomain: str
    location: str
    type: URLForwardingType
    include_path: bool
    wildcard: bool

    @staticmethod
    def from_dict(d):
        return URLForwarding(
            id=d["id"],
            subdomain=d["subdomain"],
            location=d["location"],
            type=URLForwardingType[d["type"]],
            include_path=d["includePath"] == "yes",
            wildcard=d["wildcard"] == "yes",
        )