generated from marcieltorres/python-boilerplate-project
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Device endpoint * Add Invoice request
- Loading branch information
Showing
7 changed files
with
417 additions
and
30 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
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
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 @@ | ||
from dataclasses import dataclass, field | ||
|
||
from mashumaro import DataClassDictMixin, field_options | ||
|
||
from src.models.response_descriptor import ResponseDescriptor | ||
|
||
# | ||
# GET https://iecapi.iec.co.il//api/Device/{bp_number} | ||
# | ||
# [ | ||
# { | ||
# "isActive": true, | ||
# "deviceType": 3, | ||
# "deviceNumber": "23231111", | ||
# "deviceCode": "503" | ||
# } | ||
# | ||
# ----------- | ||
# GET https://iecapi.iec.co.il//api/Device/{bp_number}/{contract_id} | ||
# { | ||
# "data": { | ||
# "counterDevices": [ | ||
# { | ||
# "device": "00000000002000111", | ||
# "register": "001", | ||
# "lastMR": "00000000000011111", | ||
# "lastMRDate": "2024-01-11", | ||
# "lastMRType": "01", | ||
# "lastMRTypeDesc": "קריאת מונה לפי שגרות מערכת", | ||
# "connectionSize": { | ||
# "size": 25, | ||
# "phase": 3, | ||
# "representativeConnectionSize": "3X20" | ||
# } | ||
# } | ||
# ], | ||
# "mrType": "01" | ||
# }, | ||
# "reponseDescriptor": { | ||
# "isSuccess": true, | ||
# "code": "00", | ||
# "description": null | ||
# } | ||
# } | ||
|
||
|
||
@dataclass | ||
class Device(DataClassDictMixin): | ||
"""Device dataclass.""" | ||
|
||
device_type: int = field(metadata=field_options(alias="deviceType")) | ||
device_number: str = field(metadata=field_options(alias="deviceNumber")) | ||
device_code: str = field(metadata=field_options(alias="deviceCode")) | ||
is_active: bool = field(metadata=field_options(alias="isActive")) | ||
|
||
|
||
@dataclass | ||
class ConnectionSize(DataClassDictMixin): | ||
"""Connection dataclass.""" | ||
size: int = field(metadata=field_options(alias="size")) | ||
phase: str = field(metadata=field_options(alias="phase")) | ||
representative_connection_size: str = field(metadata=field_options(alias="representativeConnectionSize")) | ||
|
||
|
||
@dataclass | ||
class CounterDevice(DataClassDictMixin): | ||
"""Counter Device dataclass.""" | ||
device: str = field(metadata=field_options(alias="device")) | ||
register: str = field(metadata=field_options(alias="register")) | ||
last_mr: str = field(metadata=field_options(alias="lastMR")) | ||
last_mr_date: str = field(metadata=field_options(alias="lastMRDate")) | ||
last_mr_type: str = field(metadata=field_options(alias="lastMRType")) | ||
last_mr_type_desc: str = field(metadata=field_options(alias="lastMRTypeDesc")) | ||
connection_size: ConnectionSize = field(metadata=field_options(alias="connectionSize")) | ||
|
||
|
||
@dataclass | ||
class Devices(DataClassDictMixin): | ||
"""Devices dataclass.""" | ||
counter_devices: list[CounterDevice] | ||
mr_type: str = field(metadata=field_options(alias="mrType")) | ||
|
||
|
||
@dataclass | ||
class GetDeviceResponse(Device): | ||
"""Get Device Response dataclass.""" | ||
data: Devices | ||
response_descriptor: ResponseDescriptor = field(metadata=field_options(alias="reponseDescriptor")) |
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,55 @@ | ||
from dataclasses import dataclass, field | ||
|
||
from mashumaro import DataClassDictMixin, field_options | ||
|
||
from src.models.response_descriptor import ResponseDescriptor | ||
|
||
# | ||
# GET https://iecapi.iec.co.il//api/Device/type/{bp_number}/{contract_id}/false | ||
# | ||
# { | ||
# "data": { | ||
# "deviceNumber": "20008389", | ||
# "deviceBalance": null, | ||
# "deviceType": 0, | ||
# "estimatedDaysByWeek": null, | ||
# "averageUsageCostByWeek": null, | ||
# "estimatedDaysByMonth": null, | ||
# "averageUsageCostByMonth": null, | ||
# "balanceTime": null, | ||
# "balanceDate": null, | ||
# "isActive": true, | ||
# "numberOfDevices": 1 | ||
# }, | ||
# "reponseDescriptor": { | ||
# "isSuccess": true, | ||
# "code": "00", | ||
# "description": "" | ||
# } | ||
# } | ||
# | ||
|
||
|
||
@dataclass | ||
class DeviceType(DataClassDictMixin): | ||
"""Device dataclass.""" | ||
|
||
device_number: str = field(metadata=field_options(alias="deviceNumber")) | ||
device_balance: int = field(metadata=field_options(alias="deviceBalance")) | ||
device_type: int = field(metadata=field_options(alias="deviceType")) | ||
estimated_days_by_week: int = field(metadata=field_options(alias="estimatedDaysByWeek")) | ||
average_usage_cost_by_week: int = field(metadata=field_options(alias="averageUsageCostByWeek")) | ||
estimated_days_by_month: int = field(metadata=field_options(alias="estimatedDaysByMonth")) | ||
average_usage_cost_by_month: int = field(metadata=field_options(alias="averageUsageCostByMonth")) | ||
balance_time: str = field(metadata=field_options(alias="balanceTime")) | ||
balance_date: str = field(metadata=field_options(alias="balanceDate")) | ||
is_active: bool = field(metadata=field_options(alias="isActive")) | ||
number_of_devices: int = field(metadata=field_options(alias="numberOfDevices")) | ||
|
||
|
||
@dataclass | ||
class DeviceTypeResponse(DataClassDictMixin): | ||
"""Device Type Response dataclass.""" | ||
|
||
data: DeviceType | ||
response_descriptor: ResponseDescriptor = field(metadata=field_options(alias="reponseDescriptor")) |
Oops, something went wrong.