fundamentum_sdk_api/models/
shelf_devices.rs

1//! Devices API structures
2
3use chrono::{DateTime, Utc};
4use serde::{Deserialize, Serialize};
5
6/// Get Shelf Device Response Scheme.
7#[derive(Deserialize, Debug)]
8pub struct GetShelfDeviceResponse {
9    /// Shelf device's ID.
10    pub id: u32,
11    /// Shelf device's creation date.
12    pub created_at: DateTime<Utc>,
13    /// Shelf device's last updated date.
14    pub updated_at: DateTime<Utc>,
15    /// Shelf device's deletion date.
16    pub deleted_at: Option<DateTime<Utc>>,
17    /// Project id on the Hub.
18    pub project_id: u32,
19    /// Asset type of the device.
20    pub asset_type_id: i32,
21    /// Registry id on the Hub.
22    pub registry_id: Option<u32>,
23    /// Serial number of the shelf device.
24    pub serial_number: String,
25    /// The RSA public key that will be used to validate the JWT token made by the device.
26    pub secret: String,
27    /// Algorithm used to encrypt the secret (i.e. RS256).
28    pub algorithm: String,
29    /// MQTT Host.
30    pub mqtt_host: Option<String>,
31    /// MQTT Port.
32    pub mqtt_port: Option<u16>,
33}
34
35/// Store Shelf Device Request Scheme.
36#[derive(Serialize, Debug)]
37pub struct StoreShelfDeviceRequest {
38    /// Serial number.
39    pub serial_number: String,
40    /// The RSA public key that will be used to validate the JWT token made by the device.
41    pub secret: String,
42}
43
44/// Store Shelf Device Response Scheme.
45pub type StoreShelfDeviceResponse = GetShelfDeviceResponse;
46
47/// Provision Shelf Device Request Scheme.
48#[derive(Serialize, Debug)]
49pub struct ProvisionShelfDeviceRequest {
50    /// Registry id on the Hub.
51    pub registry_id: u32,
52}
53
54/// Provision Shelf Device Response Scheme.
55#[derive(Deserialize, Debug)]
56pub struct ProvisionShelfDeviceResponse {
57    /// Unknown at implementation time.
58    pub configuration: serde_json::Value,
59    /// MQTT configuration.
60    pub mqtt: MqttConfiguration,
61}
62
63/// Deprovision Shelf Device Response Scheme.
64pub type DeprovisionShelfDeviceResponse = GetShelfDeviceResponse;
65
66/// Delete Shelf Device Response Scheme.
67pub type DeleteShelfDeviceResponse = GetShelfDeviceResponse;
68
69/// Mqtt configuration Scheme.
70#[derive(Deserialize, Debug)]
71pub struct MqttConfiguration {
72    /// MQTT Client ID.
73    pub client_id: String,
74    /// MQTT Host.
75    pub host: String,
76    /// MQTT Port.
77    pub port: u16,
78}