summary refs log tree commit diff
path: root/app/src/state.rs
diff options
context:
space:
mode:
authorAshelyn Rose <git@ashen.earth>2025-02-16 15:18:09 -0700
committerAshelyn Rose <git@ashen.earth>2025-02-16 15:18:09 -0700
commit5e8d3bc7008d29115bc520a75a9e49c00e2c270f (patch)
treedc3aab4ba61ff0b558cdee8cbe08e07533be5596 /app/src/state.rs
parentb5d6d25912993b91bc1b3ec52c352431398c36d9 (diff)
Can now sign in and fetch account data
Diffstat (limited to 'app/src/state.rs')
-rw-r--r--app/src/state.rs46
1 files changed, 46 insertions, 0 deletions
diff --git a/app/src/state.rs b/app/src/state.rs
new file mode 100644
index 0000000..44e74ed
--- /dev/null
+++ b/app/src/state.rs
@@ -0,0 +1,46 @@
+use tokio::sync::mpsc::Sender;
+
+#[derive(Clone)]
+pub struct AppState {
+    pub preferences: (),
+    pub accounts: Vec<Account>,
+}
+
+impl AppState {
+    pub fn default() -> Self {
+        Self {
+            preferences: (),
+            accounts: Vec::new(),
+
+        }
+    }
+}
+
+#[derive(Clone)]
+pub struct Account {
+    pub server_domain: String,
+    pub handle_domain: Option<String>,
+    pub client_credential: ClientCredential,
+    pub api_credential: ApiCredential,
+}
+
+#[derive(Clone)]
+pub struct ClientCredential {
+    pub client_name: String,
+    pub client_id: String,
+    pub client_secret: Option<String>,
+}
+
+#[derive(Clone)]
+pub struct AuthCode (pub String);
+
+#[derive(Clone)]
+pub enum ApiCredential {
+    None,
+    Pending(Sender<AuthCode>),
+    Some {
+        token: String,
+        refresh: Option<String>
+    }
+}
+