-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
198 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,2 @@ | ||
"""Initialize the package.""" | ||
from __future__ import annotations | ||
|
||
from datetime import datetime | ||
from typing import Optional | ||
|
||
from pydantic import BaseModel, Extra, Field # pylint: disable=no-name-in-module | ||
|
||
|
||
class OVOBase(BaseModel): | ||
"""Base class for all OVO models.""" | ||
|
||
class Config: | ||
"""Pydantic config.""" | ||
|
||
extra = Extra.allow | ||
|
||
|
||
class OVOInterval(OVOBase): | ||
"""Interval model.""" | ||
|
||
start: datetime = Field(..., alias="start") | ||
end: datetime = Field(..., alias="end") | ||
|
||
|
||
class OVOMeterReadings(OVOBase): | ||
"""Meter readings model.""" | ||
|
||
start: float = Field(..., alias="start") | ||
end: float = Field(..., alias="end") | ||
|
||
|
||
class OVOCost(OVOBase): | ||
"""Cost model.""" | ||
|
||
amount: Optional[float] = Field(None, alias="amount") | ||
currency_unit: Optional[str] = Field(None, alias="currencyUnit") | ||
|
||
|
||
class OVODailyElectricity(OVOBase): | ||
"""Daily electricity model.""" | ||
|
||
consumption: Optional[float] = Field(None, alias="consumption") | ||
interval: Optional[OVOInterval] = Field(None, alias="interval") | ||
meter_readings: Optional[OVOMeterReadings] = Field(None, alias="meterReadings") | ||
has_half_hour_data: Optional[bool] = Field(None, alias="hasHalfHourData") | ||
cost: Optional[OVOCost] = Field(None, alias="cost") | ||
|
||
|
||
class OVODailyGas(OVOBase): | ||
"""Daily gas model.""" | ||
|
||
consumption: Optional[float] = Field(None, alias="consumption") | ||
volume: Optional[float] = Field(None, alias="volume") | ||
interval: Optional[OVOInterval] = Field(None, alias="interval") | ||
meter_readings: Optional[OVOMeterReadings] = Field(None, alias="meterReadings") | ||
has_half_hour_data: Optional[bool] = Field(None, alias="hasHalfHourData") | ||
cost: Optional[OVOCost] = Field(None, alias="cost") | ||
|
||
|
||
class OVOHalfHour(OVOBase): | ||
"""Half hour model.""" | ||
|
||
consumption: float = Field(None, alias="consumption") | ||
interval: OVOInterval = Field(None, alias="interval") | ||
unit: str = Field(None, alias="unit") | ||
|
||
|
||
class OVODailyUsage(OVOBase): | ||
"""Daily usage model.""" | ||
|
||
electricity: Optional[list[OVODailyElectricity]] = Field(None, alias="electricity") | ||
gas: Optional[list[OVODailyGas]] = Field(None, alias="gas") | ||
|
||
|
||
class OVOHalfHourUsage(OVOBase): | ||
"""Half hour usage model.""" | ||
|
||
electricity: Optional[list[OVOHalfHour]] = Field(None, alias="electricity") | ||
gas: Optional[list[OVOHalfHour]] = Field(None, alias="gas") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
"""OVO Energy: Models.""" | ||
from __future__ import annotations | ||
|
||
from datetime import datetime | ||
from typing import Optional | ||
|
||
from pydantic import BaseModel, Extra, Field # pylint: disable=no-name-in-module | ||
|
||
|
||
class OVOBase(BaseModel): | ||
"""Base class for all OVO models.""" | ||
|
||
class Config: | ||
"""Pydantic config.""" | ||
|
||
extra = Extra.allow | ||
|
||
|
||
class OVOInterval(OVOBase): | ||
"""Interval model.""" | ||
|
||
start: datetime = Field(None, alias="start") | ||
end: datetime = Field(None, alias="end") | ||
|
||
|
||
class OVOMeterReadings(OVOBase): | ||
"""Meter readings model.""" | ||
|
||
start: float = Field(None, alias="start") | ||
end: float = Field(None, alias="end") | ||
|
||
|
||
class OVOCost(OVOBase): | ||
"""Cost model.""" | ||
|
||
amount: Optional[float] = Field(None, alias="amount") | ||
currency_unit: Optional[str] = Field(None, alias="currencyUnit") | ||
|
||
|
||
class OVODailyElectricity(OVOBase): | ||
"""Daily electricity model.""" | ||
|
||
consumption: Optional[float] = Field(None, alias="consumption") | ||
interval: Optional[OVOInterval] = Field(None, alias="interval") | ||
meter_readings: Optional[OVOMeterReadings] = Field(None, alias="meterReadings") | ||
has_half_hour_data: Optional[bool] = Field(None, alias="hasHalfHourData") | ||
cost: Optional[OVOCost] = Field(None, alias="cost") | ||
|
||
|
||
class OVODailyGas(OVOBase): | ||
"""Daily gas model.""" | ||
|
||
consumption: Optional[float] = Field(None, alias="consumption") | ||
volume: Optional[float] = Field(None, alias="volume") | ||
interval: Optional[OVOInterval] = Field(None, alias="interval") | ||
meter_readings: Optional[OVOMeterReadings] = Field(None, alias="meterReadings") | ||
has_half_hour_data: Optional[bool] = Field(None, alias="hasHalfHourData") | ||
cost: Optional[OVOCost] = Field(None, alias="cost") | ||
|
||
|
||
class OVOHalfHour(OVOBase): | ||
"""Half hour model.""" | ||
|
||
consumption: float = Field(None, alias="consumption") | ||
interval: OVOInterval = Field(None, alias="interval") | ||
unit: str = Field(None, alias="unit") | ||
|
||
|
||
class OVODailyUsage(OVOBase): | ||
"""Daily usage model.""" | ||
|
||
electricity: Optional[list[OVODailyElectricity]] = Field(None, alias="electricity") | ||
gas: Optional[list[OVODailyGas]] = Field(None, alias="gas") | ||
|
||
|
||
class OVOHalfHourUsage(OVOBase): | ||
"""Half hour usage model.""" | ||
|
||
electricity: Optional[list[OVOHalfHour]] = Field(None, alias="electricity") | ||
gas: Optional[list[OVOHalfHour]] = Field(None, alias="gas") | ||
|
||
|
||
class OVOPlan(OVOBase): | ||
"""Plan model.""" | ||
|
||
standing_charge: Optional[float] = Field(None, alias="standingCharge") | ||
unit_rate: Optional[float] = Field(None, alias="unitRate") | ||
tariff: Optional[str] = Field(None, alias="tariff") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
"""OVO Energy: Plan Models.""" | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
|
||
from pydantic import Field | ||
|
||
from . import OVOBase | ||
|
||
|
||
class OVOPlanRate(OVOBase): | ||
"""Plan rate model.""" | ||
|
||
amount: float = Field(None, alias="amount") | ||
currency_unit: str = Field(None, alias="currencyUnit") | ||
|
||
|
||
class OVOPlanStatus(OVOBase): | ||
"""Plan status model.""" | ||
|
||
active: bool | ||
in_renewal: bool = Field(None, alias="inRenewal") | ||
in_loss: bool = Field(None, alias="inLoss") | ||
loss_complete: bool = Field(None, alias="lossComplete") | ||
has_future_contracts: bool = Field(None, alias="hasFutureContracts") | ||
|
||
|
||
class OVOPlanUnitRate(OVOBase): | ||
"""Unit rate model.""" | ||
|
||
name: str = Field(None, alias="name") | ||
unit_rate: OVOPlanRate = Field(None, alias="unitRate") | ||
|
||
|
||
class OVOPlanElectricity(OVOBase): | ||
"""Plan electricity model.""" | ||
|
||
name: str = Field(None, alias="name") | ||
exit_fee: OVOPlanRate = Field(None, alias="exitFee") | ||
contract_start_date: str = Field(None, alias="contractStartDate") | ||
contract_end_date: Any = Field(None, alias="contractEndDate") | ||
contract_type: str = Field(None, alias="contractType") | ||
is_in_renewal: bool = Field(None, alias="isInRenewal") | ||
has_future_contracts: bool = Field(None, alias="hasFutureContracts") | ||
mpxn: str = Field(None, alias="mpxn") | ||
msn: str = Field(None, alias="msn") | ||
personal_projection: float = Field(None, alias="personalProjection") | ||
standing_charge: OVOPlanRate = Field(None, alias="standingCharge") | ||
unit_rates: list[OVOPlanUnitRate] = Field(None, alias="unitRates") | ||
|
||
|
||
class OVOPlanGas(OVOBase): | ||
"""Plan gas model.""" | ||
|
||
name: str = Field(None, alias="name") | ||
exit_fee: OVOPlanRate = Field(None, alias="exitFee") | ||
contract_start_date: str = Field(None, alias="contractStartDate") | ||
contract_end_date: Any = Field(None, alias="contractEndDate") | ||
contract_type: str = Field(None, alias="contractType") | ||
is_in_renewal: bool = Field(None, alias="isInRenewal") | ||
has_future_contracts: bool = Field(None, alias="hasFutureContracts") | ||
mpxn: str = Field(None, alias="mpxn") | ||
msn: str = Field(None, alias="msn") | ||
personal_projection: float = Field(None, alias="personalProjection") | ||
standing_charge: OVOPlanRate = Field(None, alias="standingCharge") | ||
unit_rates: list[OVOPlanUnitRate] = Field(None, alias="unitRates") | ||
|
||
|
||
class OVOPlan(OVOBase): | ||
"""Plan model.""" | ||
|
||
electricity: OVOPlanElectricity = Field(None, alias="electricity") | ||
gas: OVOPlanGas = Field(None, alias="gas") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters