import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DeviceTypeModel:
# @ApiMember(DataType="Guid", Description="Guid representing the saved Device Type", Name="DeviceTypeId", ParameterType="query")
device_type_id: Optional[str] = None
"""
Guid representing the saved Device Type
"""
# @ApiMember(DataType="Guid", Description="Guid representing the saved Device Class", Name="DeviceClassId", ParameterType="query")
device_class_id: Optional[str] = None
"""
Guid representing the saved Device Class
"""
# @ApiMember(DataType="string", Description="The Device Class Name", Name="DeviceClassName", ParameterType="query")
device_class_name: Optional[str] = None
"""
The Device Class Name
"""
# @ApiMember(DataType="string", Description="The Device Brand.", Name="Brand", ParameterType="query")
brand: Optional[str] = None
"""
The Device Brand.
"""
# @ApiMember(DataType="string", Description="The Device Model Name.", IsRequired=true, Name="ModelName", ParameterType="query")
model_name: Optional[str] = None
"""
The Device Model Name.
"""
# @ApiMember(DataType="string", Description="The Device Form, e.g Phone | Tablet.", Name="FormFactor", ParameterType="query")
form_factor: Optional[str] = None
"""
The Device Form, e.g Phone | Tablet.
"""
# @ApiMember(DataType="string", Description="The Device Dimensions (Height x Width x Depth).", Name="Dimensions", ParameterType="query")
dimensions: Optional[str] = None
"""
The Device Dimensions (Height x Width x Depth).
"""
# @ApiMember(DataType="int", Description="The Device display resolution width in pixels.", Name="DisplayResolutionWidthPixels", ParameterType="query")
display_resolution_width_pixels: Optional[int] = None
"""
The Device display resolution width in pixels.
"""
# @ApiMember(DataType="int", Description="The Device display resolution height in pixels.", Name="DisplayResolutionHeightPixels", ParameterType="query")
display_resolution_height_pixels: Optional[int] = None
"""
The Device display resolution height in pixels.
"""
# @ApiMember(DataType="decimal", Description="The Device display width size in inches.", Name="DisplaySizeWidthInches", ParameterType="query")
display_size_width_inches: Optional[Decimal] = None
"""
The Device display width size in inches.
"""
# @ApiMember(DataType="decimal", Description="The Device display height size in inches.", Name="DisplaySizeHeightInches", ParameterType="query")
display_size_height_inches: Optional[Decimal] = None
"""
The Device display height size in inches.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DeviceHistoryModel:
# @ApiMember(DataType="Guid", Description="Guid representing the current Device History", Name="DeviceHistoryId", ParameterType="query")
device_history_id: Optional[str] = None
"""
Guid representing the current Device History
"""
# @ApiMember(DataType="Guid", Description="Guid representing the current Device History Device Configuration record.", Name="PrimaryDeviceHistoryDeviceConfigurationId", ParameterType="query")
primary_device_history_device_configuration_id: Optional[str] = None
"""
Guid representing the current Device History Device Configuration record.
"""
# @ApiMember(DataType="string", Description="The Device name.", Name="DeviceName", ParameterType="query")
device_name: Optional[str] = None
"""
The Device name.
"""
# @ApiMember(DataType="string", Description="The Device operating system.", Name="OperatingSystem", ParameterType="query")
operating_system: Optional[str] = None
"""
The Device operating system.
"""
# @ApiMember(DataType="string", Description="The Device operating system version.", Name="OperatingSystemVersion", ParameterType="query")
operating_system_version: Optional[str] = None
"""
The Device operating system version.
"""
# @ApiMember(DataType="string", Description="The Device IP Address.", Name="IpAddress", ParameterType="query")
ip_address: Optional[str] = None
"""
The Device IP Address.
"""
# @ApiMember(DataType="string", Description="Any Notes about the device.", Name="Notes", ParameterType="query")
notes: Optional[str] = None
"""
Any Notes about the device.
"""
# @ApiMember(DataType="string", Description="Total memory size available (in bytes).", Name="TotalMemorySize", ParameterType="query")
total_memory_size: Optional[int] = None
"""
Total memory size available (in bytes).
"""
# @ApiMember(DataType="string", Description="The Network provider name.", Name="CellularProviderName", ParameterType="query")
cellular_provider_name: Optional[str] = None
"""
The Network provider name.
"""
# @ApiMember(DataType="string", Description="The Mobile Country Code the device is currently located in.", Name="MobileCountryCode", ParameterType="query")
mobile_country_code: Optional[str] = None
"""
The Mobile Country Code the device is currently located in.
"""
# @ApiMember(DataType="string", Description="The Mobile Network Code the device is currently using.", Name="MobileNetworkCode", ParameterType="query")
mobile_network_code: Optional[str] = None
"""
The Mobile Network Code the device is currently using.
"""
# @ApiMember(DataType="string", Description="The Language Code Identifier that represents the language used on the device.", Name="LanguageCodeIdentifier", ParameterType="query")
language_code_identifier: Optional[str] = None
"""
The Language Code Identifier that represents the language used on the device.
"""
# @ApiMember(DataType="double", Description="The latitude the device was last located at.", Name="Latitude", ParameterType="query")
latitude: float = 0.0
"""
The latitude the device was last located at.
"""
# @ApiMember(DataType="double", Description="The longitude the device was last located at.", Name="Longitude", ParameterType="query")
longitude: float = 0.0
"""
The longitude the device was last located at.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DeviceModel:
# @ApiMember(DataType="Guid", Description="Guid representing the saved Device", Name="DeviceId", ParameterType="query")
device_id: Optional[str] = None
"""
Guid representing the saved Device
"""
# @ApiMember(DataType="DeviceTypeModel", Description="Details of the Type of Device", Name="DeviceType", ParameterType="query")
device_type: Optional[DeviceTypeModel] = None
"""
Details of the Type of Device
"""
# @ApiMember(DataType="DeviceHistoryModel", Description="Current saved settings of the Device", Name="CurrentHistory", ParameterType="query")
current_history: Optional[DeviceHistoryModel] = None
"""
Current saved settings of the Device
"""
# @ApiMember(DataType="string", Description="The Device Model Name.", IsRequired=true, Name="ModelName", ParameterType="query")
model_name: Optional[str] = None
"""
The Device Model Name.
"""
# @ApiMember(DataType="string", Description="The Device model number.", Name="ModelNumber", ParameterType="query")
model_number: Optional[str] = None
"""
The Device model number.
"""
# @ApiMember(DataType="string", Description="The Device serial number.", Name="SerialNumber", ParameterType="query")
serial_number: Optional[str] = None
"""
The Device serial number.
"""
# @ApiMember(DataType="string", Description="The Device manufacturers number.", Name="ManufacturerDeviceNumber", ParameterType="query")
manufacturer_device_number: Optional[str] = None
"""
The Device manufacturers number.
"""
# @ApiMember(DataType="string", Description="The Device MAC Address.", Name="MacAddress", ParameterType="query")
mac_address: Optional[str] = None
"""
The Device MAC Address.
"""
# @ApiMember(DataType="int", Description="The current value of InstanceSeed that the device has stored. If InstanceCounterLastValue has gone over 99999, this will contain a new seed value for the device.", IsRequired=true, Name="InstanceSeed", ParameterType="query")
instance_seed: int = 0
"""
The current value of InstanceSeed that the device has stored. If InstanceCounterLastValue has gone over 99999, this will contain a new seed value for the device.
"""
# @ApiMember(DataType="int", Description="The current value of InstanceCounterLastValue that the device has stored", IsRequired=true, Name="InstanceCounterLastValue", ParameterType="query")
instance_counter_last_value: int = 0
"""
The current value of InstanceCounterLastValue that the device has stored
"""
# @ApiMember(DataType="ResponseStatus", Description="ServiceStack ResponseStatus.", Name="ResponseStatus", ParameterType="query")
response_status: Optional[ResponseStatus] = None
"""
ServiceStack ResponseStatus.
"""
# @Api(Description="Saves/Updates a Devices details and registers that device with an appliance.")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RegisterDevice:
"""
Saves/Updates a Devices details and registers that device with an appliance.
"""
# @ApiMember(DataType="Guid", Description="Guid of the Appliance this Device is Registering under.", IsRequired=true, Name="ApplianceId", ParameterType="query")
appliance_id: Optional[str] = None
"""
Guid of the Appliance this Device is Registering under.
"""
# @ApiMember(DataType="Guid", Description="Guid of the Device. If empty the Device will be inserted, if provided the device will be updated.", IsRequired=true, Name="DeviceId", ParameterType="query")
device_id: Optional[str] = None
"""
Guid of the Device. If empty the Device will be inserted, if provided the device will be updated.
"""
# @ApiMember(DataType="string", Description="The Device manufacturers number.", Name="ManufacturerDeviceNumber", ParameterType="query")
manufacturer_device_number: Optional[str] = None
"""
The Device manufacturers number.
"""
# @ApiMember(DataType="string", Description="The Device MAC Address.", Name="MacAddress", ParameterType="query")
mac_address: Optional[str] = None
"""
The Device MAC Address.
"""
# @ApiMember(DataType="string", Description="The Device Model Name.", IsRequired=true, Name="ModelName", ParameterType="query")
model_name: Optional[str] = None
"""
The Device Model Name.
"""
# @ApiMember(DataType="string", Description="The Device Form, e.g Phone | Tablet.", IsRequired=true, Name="FormFactor", ParameterType="query")
form_factor: Optional[str] = None
"""
The Device Form, e.g Phone | Tablet.
"""
# @ApiMember(DataType="string", Description="The Device Brand.", Name="Brand", ParameterType="query")
brand: Optional[str] = None
"""
The Device Brand.
"""
# @ApiMember(DataType="string", Description="The Device Dimensions (Height x Width x Depth).", Name="Dimensions", ParameterType="query")
dimensions: Optional[str] = None
"""
The Device Dimensions (Height x Width x Depth).
"""
# @ApiMember(DataType="int", Description="The Device display resolution width in pixels.", Name="DisplayResolutionWidthPixels", ParameterType="query")
display_resolution_width_pixels: Optional[int] = None
"""
The Device display resolution width in pixels.
"""
# @ApiMember(DataType="int", Description="The Device display resolution height in pixels.", Name="DisplayResolutionHeightPixels", ParameterType="query")
display_resolution_height_pixels: Optional[int] = None
"""
The Device display resolution height in pixels.
"""
# @ApiMember(DataType="decimal", Description="The Device display width size in inches.", Name="DisplaySizeWidthInches", ParameterType="query")
display_size_width_inches: Optional[Decimal] = None
"""
The Device display width size in inches.
"""
# @ApiMember(DataType="decimal", Description="The Device display height size in inches.", Name="DisplaySizeHeightInches", ParameterType="query")
display_size_height_inches: Optional[Decimal] = None
"""
The Device display height size in inches.
"""
# @ApiMember(DataType="string", Description="The Device operating system.", Name="OperatingSystem", ParameterType="query")
operating_system: Optional[str] = None
"""
The Device operating system.
"""
# @ApiMember(DataType="string", Description="The Device operating system version.", Name="OperatingSystemVersion", ParameterType="query")
operating_system_version: Optional[str] = None
"""
The Device operating system version.
"""
# @ApiMember(DataType="string", Description="The Device IP Address.", Name="IpAddress", ParameterType="query")
ip_address: Optional[str] = None
"""
The Device IP Address.
"""
# @ApiMember(DataType="string", Description="Any Notes about the device.", Name="Notes", ParameterType="query")
notes: Optional[str] = None
"""
Any Notes about the device.
"""
# @ApiMember(DataType="string", Description="Total memory size available (in bytes).", Name="TotalMemorySize", ParameterType="query")
total_memory_size: Optional[int] = None
"""
Total memory size available (in bytes).
"""
# @ApiMember(DataType="string", Description="The Network provider name.", Name="CellularProviderName", ParameterType="query")
cellular_provider_name: Optional[str] = None
"""
The Network provider name.
"""
# @ApiMember(DataType="string", Description="The ISO Country Code of the country the device is currently located in.", Name="ISOCountryCode", ParameterType="query")
iso_country_code: Optional[str] = None
"""
The ISO Country Code of the country the device is currently located in.
"""
# @ApiMember(DataType="string", Description="The Mobile Country Code the device is currently located in.", Name="MobileCountryCode", ParameterType="query")
mobile_country_code: Optional[str] = None
"""
The Mobile Country Code the device is currently located in.
"""
# @ApiMember(DataType="string", Description="The Mobile Network Code the device is currently using.", Name="MobileNetworkCode", ParameterType="query")
mobile_network_code: Optional[str] = None
"""
The Mobile Network Code the device is currently using.
"""
# @ApiMember(DataType="string", Description="The Language Code Identifier that represents the language used on the device.", Name="LanguageCodeIdentifier", ParameterType="query")
language_code_identifier: Optional[str] = None
"""
The Language Code Identifier that represents the language used on the device.
"""
# @ApiMember(DataType="string", Description="The name of the Timezone the device was last used in.", Name="LastKnownTimeZone", ParameterType="query")
last_known_time_zone: Optional[str] = None
"""
The name of the Timezone the device was last used in.
"""
# @ApiMember(DataType="string", Description="The UTC Offset of the Timezone the device was last used in. Formatted as +-##:##", Name="LastKnownTimeZoneOffset", ParameterType="query")
last_known_time_zone_offset: Optional[str] = None
"""
The UTC Offset of the Timezone the device was last used in. Formatted as +-##:##
"""
# @ApiMember(DataType="double", Description="The latitude the device was last located at.", IsRequired=true, Name="Latitude", ParameterType="query")
latitude: float = 0.0
"""
The latitude the device was last located at.
"""
# @ApiMember(DataType="double", Description="The longitude the device was last located at.", IsRequired=true, Name="Longitude", ParameterType="query")
longitude: float = 0.0
"""
The longitude the device was last located at.
"""
# @ApiMember(DataType="int", Description="The current value of InstanceSeed that the device has stored.", IsRequired=true, Name="InstanceSeed", ParameterType="query")
instance_seed: int = 0
"""
The current value of InstanceSeed that the device has stored.
"""
# @ApiMember(DataType="int", Description="The current value of InstanceCounterLastValue that the device has stored", IsRequired=true, Name="InstanceCounterLastValue", ParameterType="query")
instance_counter_last_value: int = 0
"""
The current value of InstanceCounterLastValue that the device has stored
"""
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /xml/reply/RegisterDevice HTTP/1.1
Host: pfapi.pstpf.com.au
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<RegisterDevice xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Eros.Subtle.Canvara.WebAPIModel.ServiceModel">
<ApplianceId>00000000-0000-0000-0000-000000000000</ApplianceId>
<Brand>String</Brand>
<CellularProviderName>String</CellularProviderName>
<DeviceId>00000000-0000-0000-0000-000000000000</DeviceId>
<Dimensions>String</Dimensions>
<DisplayResolutionHeightPixels>0</DisplayResolutionHeightPixels>
<DisplayResolutionWidthPixels>0</DisplayResolutionWidthPixels>
<DisplaySizeHeightInches>0</DisplaySizeHeightInches>
<DisplaySizeWidthInches>0</DisplaySizeWidthInches>
<FormFactor>String</FormFactor>
<ISOCountryCode>String</ISOCountryCode>
<InstanceCounterLastValue>0</InstanceCounterLastValue>
<InstanceSeed>0</InstanceSeed>
<IpAddress>String</IpAddress>
<LanguageCodeIdentifier>String</LanguageCodeIdentifier>
<LastKnownTimeZone>String</LastKnownTimeZone>
<LastKnownTimeZoneOffset>String</LastKnownTimeZoneOffset>
<Latitude>0</Latitude>
<Longitude>0</Longitude>
<MacAddress>String</MacAddress>
<ManufacturerDeviceNumber>String</ManufacturerDeviceNumber>
<MobileCountryCode>String</MobileCountryCode>
<MobileNetworkCode>String</MobileNetworkCode>
<ModelName>String</ModelName>
<Notes>String</Notes>
<OperatingSystem>String</OperatingSystem>
<OperatingSystemVersion>String</OperatingSystemVersion>
<TotalMemorySize>0</TotalMemorySize>
</RegisterDevice>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<DeviceModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Eros.Subtle.Canvara.WebAPIModel.ServiceModel">
<CurrentHistory>
<CellularProviderName>String</CellularProviderName>
<DeviceHistoryId>00000000-0000-0000-0000-000000000000</DeviceHistoryId>
<DeviceName>String</DeviceName>
<IpAddress>String</IpAddress>
<LanguageCodeIdentifier>String</LanguageCodeIdentifier>
<Latitude>0</Latitude>
<Longitude>0</Longitude>
<MobileCountryCode>String</MobileCountryCode>
<MobileNetworkCode>String</MobileNetworkCode>
<Notes>String</Notes>
<OperatingSystem>String</OperatingSystem>
<OperatingSystemVersion>String</OperatingSystemVersion>
<PrimaryDeviceHistoryDeviceConfigurationId>00000000-0000-0000-0000-000000000000</PrimaryDeviceHistoryDeviceConfigurationId>
<TotalMemorySize>0</TotalMemorySize>
</CurrentHistory>
<DeviceId>00000000-0000-0000-0000-000000000000</DeviceId>
<DeviceType>
<Brand>String</Brand>
<DeviceClassId>00000000-0000-0000-0000-000000000000</DeviceClassId>
<DeviceClassName>String</DeviceClassName>
<DeviceTypeId>00000000-0000-0000-0000-000000000000</DeviceTypeId>
<Dimensions>String</Dimensions>
<DisplayResolutionHeightPixels>0</DisplayResolutionHeightPixels>
<DisplayResolutionWidthPixels>0</DisplayResolutionWidthPixels>
<DisplaySizeHeightInches>0</DisplaySizeHeightInches>
<DisplaySizeWidthInches>0</DisplaySizeWidthInches>
<FormFactor>String</FormFactor>
<ModelName>String</ModelName>
</DeviceType>
<InstanceCounterLastValue>0</InstanceCounterLastValue>
<InstanceSeed>0</InstanceSeed>
<MacAddress>String</MacAddress>
<ManufacturerDeviceNumber>String</ManufacturerDeviceNumber>
<ModelName>String</ModelName>
<ModelNumber>String</ModelNumber>
<ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:Message>String</d2p1:Message>
<d2p1:StackTrace>String</d2p1:StackTrace>
<d2p1:Errors>
<d2p1:ResponseError>
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:FieldName>String</d2p1:FieldName>
<d2p1:Message>String</d2p1:Message>
<d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d5p1:KeyValueOfstringstring>
<d5p1:Key>String</d5p1:Key>
<d5p1:Value>String</d5p1:Value>
</d5p1:KeyValueOfstringstring>
</d2p1:Meta>
</d2p1:ResponseError>
</d2p1:Errors>
<d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:KeyValueOfstringstring>
<d3p1:Key>String</d3p1:Key>
<d3p1:Value>String</d3p1:Value>
</d3p1:KeyValueOfstringstring>
</d2p1:Meta>
</ResponseStatus>
<SerialNumber>String</SerialNumber>
</DeviceModel>