1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct DeviceRecord {
8 pub id: String,
9 pub client_id: String,
11 pub auth_app_id: String,
12 pub user_id: String,
14 pub fingerprint: String,
15 pub device_info: String,
16 pub last_active_time: i64,
17 pub status: i32,
18 pub created_time: i64,
19 pub updated_time: i64,
20}
21
22#[derive(Debug, Clone, Serialize, Deserialize)]
25pub struct SoftwareInfo {
26 pub id: String,
27 pub name: String,
28 pub description: String,
29 pub software_type: i32,
30 pub icon: String,
31 pub status: i32,
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
35pub struct SoftwareVersion {
36 pub id: String,
37 pub software_id: String,
38 pub version: String,
39 pub release_notes: String,
40 pub download_url: String,
41 pub file_size: i64,
42 pub platform: String,
43 pub status: i32,
44 #[serde(default)]
46 pub force_update: bool,
47 #[serde(default)]
49 pub min_compatible: String,
50 #[serde(default)]
52 pub channel: String,
53}
54
55#[derive(Debug, Clone, Serialize, Deserialize)]
56pub struct SoftwareStoreItem {
57 pub software: SoftwareInfo,
58 pub latest_version: Option<SoftwareVersion>,
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize)]
62pub struct DownloadInfo {
63 pub download_url: String,
64 pub file_size: i64,
65 pub version: String,
66}
67
68#[derive(Debug, Clone, Deserialize)]
72pub struct VersionBrief {
73 pub id: String,
74 pub version: String,
75 pub release_notes: String,
76 pub download_url: String,
77 pub file_size: i64,
78 pub platform: String,
79 pub channel: String,
80 pub force_update: bool,
81 pub min_compatible: String,
82}
83
84#[derive(Debug, Clone, Deserialize)]
86pub struct UpdateInfo {
87 pub has_update: bool,
88 pub force_update: bool,
89 pub current_version: String,
90 pub target_version: Option<VersionBrief>,
91}
92
93#[derive(Debug, Clone, Deserialize)]
95pub struct UpdateEvent {
96 #[serde(default)]
97 pub id: u64,
98 pub software_id: String,
99 pub version: String,
100 pub platform: String,
101 pub channel: String,
102 pub force_update: bool,
103}
104
105#[derive(Debug, Clone, Deserialize)]
109pub struct ApiResponse<T> {
110 pub success: bool,
111 #[serde(default)]
112 pub message: Option<String>,
113 #[serde(default)]
114 pub code: Option<i32>,
115 pub data: Option<T>,
116}
117
118#[derive(Debug, Clone, Deserialize)]
122pub struct OfflineLicenseFile {
123 pub payload: String,
125 pub signature: String,
127 pub public_key: String,
129}
130
131#[derive(Debug, Clone, Deserialize)]
133#[serde(rename_all = "snake_case")]
134pub struct OfflineLicensePayload {
135 pub license_id: String,
136 pub user_id: String,
137 pub software_id: String,
138 pub fingerprint: String,
139 pub max_devices: i32,
140 pub expire_time: i64,
141 pub issued_at: i64,
142}