Skip to content

init

Module to store the common domain objects.

City dataclass

City.

Attributes:

Name Type Description
name str

City name.

transport_types List[now8_api.domain.__init__.TransportType]

Supported transport types for the city.

Source code in now8_api/domain/__init__.py
@dataclass
class City:
    """City.

    Attributes:
        name: City name.
        transport_types: Supported transport types for the city.
    """

    name: str = ""
    transport_types: List[TransportType] = None

Coordinates dataclass

Coordinates (in degrees).

Attributes:

Name Type Description
longitude float

Longitude.

latitude float

Latitude.

Source code in now8_api/domain/__init__.py
@dataclass
class Coordinates:
    """Coordinates (in degrees).

    Attributes:
        longitude: Longitude.
        latitude: Latitude.
    """

    longitude: float = Field(..., ge=-180, le=180)
    latitude: float = Field(..., ge=-90, le=90)

Estimation dataclass

Estimation class.

Attributes:

Name Type Description
estimation datetime

Estimated time of arrival.

time datetime

Time when the estimation was made.

Source code in now8_api/domain/__init__.py
@dataclass
class Estimation:
    """Estimation class.

    Attributes:
        estimation: Estimated time of arrival.
        time: Time when the estimation was made.
    """

    time: datetime
    estimation: datetime

Route dataclass

Transport route.

Attributes:

Name Type Description
id str

Route identifier.

code str

Route identifier in the user format.

transport_type Optional[now8_api.domain.__init__.TransportType]

Transport type of the route.

name Optional[str]

Route name.

color Color

Route color.

Source code in now8_api/domain/__init__.py
@dataclass
class Route:
    """Transport route.

    Attributes:
        id: Route identifier.
        code: Route identifier in the user format.
        transport_type: Transport type of the route.
        name: Route name.
        color: Route color.
    """

    id: str
    code: str = None
    transport_type: Optional[TransportType] = None
    name: Optional[str] = None
    color: Color = None

Stop dataclass

Transportation stop.

Attributes:

Name Type Description
id str

Stop identifier.

code Optional[str]

Stop identifier in the user format.

name Optional[str]

Name of the stop.

transport_type Optional[now8_api.domain.__init__.TransportType]

Transport type of the stop.

coordinates Optional[now8_api.domain.__init__.Coordinates]

Coordinates where the stop is located at.

zone Optional[str]

Zone where the stop is located at.

Source code in now8_api/domain/__init__.py
@dataclass
class Stop:
    """Transportation stop.

    Attributes:
        id: Stop identifier.
        code: Stop identifier in the user format.
        name: Name of the stop.
        transport_type: Transport type of the stop.
        coordinates: Coordinates where the stop is located at.
        zone: Zone where the stop is located at.
    """

    id: str
    code: Optional[str] = None
    name: Optional[str] = None
    transport_type: Optional[TransportType] = None
    coordinates: Optional[Coordinates] = None
    zone: Optional[str] = None

TransportType (int, Enum)

Transport type (bus, metro, train, etc.).

Source code in now8_api/domain/__init__.py
class TransportType(int, Enum):
    """Transport type (bus, metro, train, etc.)."""

    TRAM = 0
    METRO = 1
    RAIL = 2
    BUS = 3
    FERRY = 4
    CABLE_TRAM = 5
    AERIAL_LIFT = 6
    FUNICULAR = 7
    INTERCITY_BUS = 8
    URBAN_BUS = 9
    TROLLEY_BUS = 11
    MONORAIL = 12

Vehicle dataclass

Transport vehicle.

Attributes:

Name Type Description
id Optional[str]

Vehicle identifier.

route_id str

Route to which the vehicle belongs to.

name Optional[str]

Vehicle name.

Source code in now8_api/domain/__init__.py
@dataclass
class Vehicle:
    """Transport vehicle.

    Attributes:
        id: Vehicle identifier.
        route_id: Route to which the vehicle belongs to.
        name: Vehicle name.
    """

    route_id: str
    id: Optional[str] = None
    route_way: Optional[Way] = None
    name: Optional[str] = None
    destination_stop: Optional[Stop] = None

VehicleEstimation dataclass

Vehicle estimated time of arrival.

Attributes:

Name Type Description
vehicle Vehicle

Vehicle for which the estimation is for.

estimation Estimation

Estimated time of arrival.

Source code in now8_api/domain/__init__.py
@dataclass
class VehicleEstimation:
    """Vehicle estimated time of arrival.

    Attributes:
        vehicle: Vehicle for which the estimation is for.
        estimation: Estimated time of arrival.
    """

    vehicle: Vehicle
    estimation: Estimation

Way (int, Enum)

Way (inbound or outbound).

Source code in now8_api/domain/__init__.py
class Way(int, Enum):
    """Way (inbound or outbound)."""

    OUTBOUND = 0
    INBOUND = 1

Last update: 2022-08-05