nodesty_api_library/models/
user.rs1use serde::{Deserialize, Serialize};
2#[derive(Debug, Serialize, Deserialize)]
3#[serde(rename_all = "camelCase")]
4
5pub struct Service {
6 pub id: u32,
7 pub product_id: u32,
8 pub group_id: u32,
9 pub name: String,
10 pub raw_name: String,
11 pub domain: String,
12 pub first_payment_amount: f64,
13 pub recurring_amount: f64,
14 pub billing_cycle: String,
15 pub next_due_date: u64,
16 pub status: String,
17 pub username: String,
18 pub password: Option<String>,
19 pub vps_id: Option<u32>,
20 pub dedicated_id: Option<Vec<String>>,
21 pub is_vps: bool,
22 pub is_web_hosting: bool,
23 pub is_dedicated: bool,
24 pub is_hetzner_dedicated: bool,
25 pub is_sky_link_dedicated: bool,
26 pub addons: Vec<Addon>,
27 pub features: Vec<String>,
28}
29
30#[derive(Debug, Serialize, Deserialize)]
31#[serde(rename_all = "camelCase")]
32pub struct Addon {
33 pub name: String,
34 pub recurring_amount: f64,
35 pub billing_cycle: String,
36 pub status: String,
37 pub register_date: u64,
38 pub next_due_date: u64,
39}
40
41#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
42pub enum TicketStatus {
43 #[serde(rename = "OPEN")]
44 Open,
45 #[serde(rename = "ANSWERED")]
46 Answered,
47 #[serde(rename = "CLOSED")]
48 Closed,
49}
50
51#[derive(Debug, Serialize, Deserialize)]
52#[serde(rename_all = "camelCase")]
53pub struct TicketAuthor {
54 pub id: String,
55 pub avatar: Option<String>,
56 pub name: String,
57 pub role: String,
58}
59#[derive(Debug, Serialize, Deserialize)]
60#[serde(rename_all = "camelCase")]
61pub struct TicketMessage {
62 pub id: String,
63 pub message_id: String,
64 pub content: String,
65 pub attachments: Vec<String>,
66 pub author_id: String,
67 pub created_at: String,
68 pub author: TicketAuthor,
69}
70
71#[derive(Debug, Serialize, Deserialize)]
72#[serde(rename_all = "camelCase")]
73pub struct Ticket {
74 pub id: String,
75 pub subject: String,
76 pub status: TicketStatus,
77 pub priority: String,
78 pub last_reply: String,
79 pub marked: bool,
80 pub messages: Vec<TicketMessage>,
81}
82
83#[derive(Debug, Serialize, Deserialize)]
84#[serde(rename_all = "camelCase")]
85pub struct UserTicketSummary {
86 pub id: String,
87 pub subject: String,
88 pub status: TicketStatus,
89 pub priority: String,
90 pub last_reply: String,
91 pub marked: bool,
92}
93
94#[derive(Debug, Serialize, Deserialize)]
95#[serde(rename_all = "camelCase")]
96pub struct UserStats {
97 pub active_services: u32,
98 pub unpaid_invoices: u32,
99 pub balance: f64,
100 pub active_tickets: u32,
101}
102
103#[derive(Debug, Serialize, Deserialize)]
104#[serde(rename_all = "camelCase")]
105pub struct User {
106 pub id: String,
107 pub first_name: String,
108 pub last_name: String,
109 pub full_name: String,
110 pub email: String,
111 pub country: String,
112 pub city: String,
113 pub state: String,
114 pub address: String,
115 pub post_code: String,
116 pub currency: String,
117 pub currency_symbol: String,
118 pub phone_number: String,
119 #[serde(skip_serializing_if = "Option::is_none")]
120 pub tckn: Option<String>,
121 #[serde(skip_serializing_if = "Option::is_none")]
122 pub company_name: Option<String>,
123 pub birth_year: Option<String>,
124 pub banned: bool,
125 pub current_session_id: String,
126 pub totp_enabled: bool,
127 pub stats: UserStats,
128}
129
130#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
131pub enum InvoiceStatus {
132 #[serde(rename = "Paid")]
133 Paid,
134 #[serde(rename = "Unpaid")]
135 Unpaid,
136 #[serde(rename = "Cancelled")]
137 Cancelled,
138 #[serde(rename = "Refunded")]
139 Refunded,
140}
141#[derive(Debug, Serialize, Deserialize)]
142#[serde(rename_all = "camelCase")]
143pub struct InvoiceItem {
144 pub id: u32,
145 #[serde(rename = "type")]
146 pub item_type: String,
147 pub description: String,
148 pub amount: f64,
149}
150
151#[derive(Debug, Serialize, Deserialize)]
152#[serde(rename_all = "camelCase")]
153pub struct Invoice {
154 pub id: u32,
155 pub due_date: u64,
156 #[serde(skip_serializing_if = "Option::is_none")]
157 pub date_paid: Option<u64>,
158 pub sub_total: f64,
159 pub total: f64,
160 pub status: InvoiceStatus,
161 pub applied_balance: f64,
162 pub items: Vec<InvoiceItem>,
163}
164
165#[derive(Debug, Serialize, Deserialize)]
166#[serde(rename_all = "camelCase")]
167pub struct UserInvoiceSummary {
168 pub id: u32,
169 pub due_date: u64,
170 pub date_paid: Option<u64>,
171 pub sub_total: f64,
172 pub total: f64,
173 pub status: InvoiceStatus,
174 pub applied_balance: f64,
175}
176
177#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
178pub enum SessionOs {
179 #[serde(rename = "Desktop")]
180 Desktop,
181 #[serde(rename = "Mobile")]
182 Mobile,
183}
184
185#[derive(Debug, Serialize, Deserialize)]
186#[serde(rename_all = "camelCase")]
187pub struct Session {
188 pub id: String,
189 pub ip: String,
190 pub location: String,
191 pub os: SessionOs,
192 pub platform: String,
193 pub last_seen: String,
194}