fundamentum_sdk_api/models/
devices.rs

1//! Devices API structures
2
3use super::general::MqttField;
4use serde::{Deserialize, Serialize};
5
6/// Get Device Response Scheme.
7#[derive(Deserialize, Debug)]
8pub struct GetDeviceRes {
9    /// ID of the devices's type in the database (not the same as asset type ID).
10    pub device_type_id: u32,
11    /// Device's current configuration.
12    pub configuration: serde_json::Value,
13    /// Device's pending configuration.
14    pub pending_configuration: serde_json::Value,
15    /// Device's metadata.
16    pub meta_data: serde_json::Value,
17    /// Mqtt configuration of the device.
18    pub mqtt: MqttField,
19}
20
21/// Store Device Request Scheme.
22#[derive(Serialize, Debug)]
23pub struct StoreDeviceReq {
24    /// Serial number.
25    pub serial_number: String,
26    /// Optional name for the device (default = serial number).
27    pub name: String,
28    /// Device's type on the Hub.
29    pub asset_type_id: i32,
30}
31
32/// Store Device Response Scheme.
33pub type StoreDeviceRes = GetDeviceRes;
34
35/// Authorization Configuration Scheme.
36#[derive(Serialize, Debug)]
37pub struct AuthorizationConfigReq {
38    /// Type of authorization by the end device.
39    pub authorization_type: String,
40    /// The key that will be used to validate the JWT token made by the device.
41    pub public_key: String,
42}