Skip to main content

torbox_core_rs/data/
user.rs

1use std::collections::HashMap;
2
3use chrono::{DateTime, FixedOffset};
4use serde::{Deserialize, Serialize};
5use serde_json::Value;
6
7#[derive(Debug, Serialize, Deserialize)]
8#[cfg_attr(feature = "specta", derive(specta::Type))]
9pub struct UserProfile {
10    pub id: u64,
11    pub auth_id: String,
12    pub created_at: DateTime<FixedOffset>,
13    pub updated_at: DateTime<FixedOffset>,
14    pub plan: u8,
15    pub total_downloaded: u64,
16    pub customer: String,
17    pub is_subscribed: bool,
18    pub premium_expires_at: DateTime<FixedOffset>,
19    pub cooldown_until: DateTime<FixedOffset>,
20    pub email: String,
21    pub user_referral: String,
22    pub base_email: String,
23    pub server: Option<u64>,
24    pub total_bytes_downloaded: u64,
25    pub total_bytes_uploaded: u64,
26    pub torrents_downloaded: u64,
27    pub web_downloads_downloaded: u64,
28    pub usenet_downloads_downloaded: u64,
29    pub additional_concurrent_slots: u64,
30    pub long_term_seeding: bool,
31    pub long_term_storage: bool,
32    pub is_vendor: bool,
33    pub vendor_id: Option<String>,
34    pub purchases_referred: u64,
35    #[serde(default)]
36    pub settings: Option<HashMap<String, Value>>,
37}
38
39#[derive(Debug, Serialize, Deserialize)]
40#[cfg_attr(feature = "specta", derive(specta::Type))]
41pub struct Job {
42    pub id: u64,
43    pub created_at: DateTime<FixedOffset>,
44    pub updated_at: DateTime<FixedOffset>,
45    pub auth_id: String,
46    pub hash: String,
47    #[serde(rename = "type")]
48    pub job_type: String,
49    pub integration: String,
50    #[serde(default)]
51    pub file_id: Option<u64>,
52    pub zip: bool,
53    pub progress: f64,
54    pub detail: String,
55    pub download_url: Option<String>,
56    pub status: String,
57}
58
59#[derive(Debug, Serialize, Deserialize)]
60#[cfg_attr(feature = "specta", derive(specta::Type))]
61pub struct SessionToken {
62    pub token: String,
63    pub expires_at: u64,
64}
65
66#[derive(Debug, Serialize, Deserialize)]
67#[cfg_attr(feature = "specta", derive(specta::Type))]
68pub struct DeviceCodeAuth {
69    pub device_code: String,
70    pub interval: u64,
71    pub expires_at: String,
72    pub verification_url: String,
73    pub friendly_verification_url: String,
74    pub code: String,
75}
76
77#[derive(Debug, Serialize, Deserialize)]
78#[cfg_attr(feature = "specta", derive(specta::Type))]
79pub struct ReferralData {
80    pub referred_accounts: u32,
81    pub referral_code: String,
82    pub purchases_referred: u32,
83}
84
85#[derive(Debug, Serialize, Deserialize)]
86#[cfg_attr(feature = "specta", derive(specta::Type))]
87pub struct SubscriptionData {
88    pub created_at: String,
89    pub updated_at: String,
90    pub subscription_code: String,
91    pub email_token: String,
92    pub auth_id: String,
93    pub plan_code: String,
94    pub status: String,
95    pub gateway: String,
96    pub plan_name: String,
97}
98
99#[derive(Debug, Serialize, Deserialize)]
100#[cfg_attr(feature = "specta", derive(specta::Type))]
101pub struct TransactionData {
102    pub at: String,
103    #[serde(rename = "type")]
104    pub kind: String,
105    pub amount: u32,
106    pub transaction_id: String,
107}
108
109#[derive(Debug, Serialize, Deserialize)]
110#[cfg_attr(feature = "specta", derive(specta::Type))]
111pub struct SearchEngineData {
112    pub id: u64,
113    pub created_at: String,
114    pub auth_id: String,
115    #[serde(rename = "type")]
116    pub kind: String,
117    pub url: String,
118    pub apikey: String,
119    pub active: bool,
120    pub valid: bool,
121    pub download_type: String,
122    pub indexers: Vec<String>,
123}
124