client_core/store/
models.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
4pub struct StoredClip {
5 pub id: String, pub source: String,
7 pub source_key: Option<String>,
8 pub content_type: String,
9 pub content: Option<Vec<u8>>,
10 pub media_path: Option<String>,
11 pub byte_size: i64,
12 pub created_at: i64, pub pinned: bool,
14 pub pinned_at: Option<i64>,
15 pub synced: bool,
16}
17
18#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
19pub struct StoredDevice {
20 pub id: String,
21 pub hostname: String,
22 pub nickname: Option<String>,
23 pub source_key: Option<String>,
24 pub machine_id: Option<String>,
25 pub public_key: Option<String>,
26 pub paired_at: Option<i64>,
27 pub last_push_at: Option<i64>,
28 pub online: bool,
29 pub refreshed_at: i64,
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
33pub struct SourceRow {
34 pub source: String,
35 pub clip_count: i64,
36 pub last_seen: Option<i64>,
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
40pub struct RetentionPref {
41 pub device_id: String,
42 pub days: i64,
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
46pub struct AlertPref {
47 pub source: String,
48 pub enabled: bool,
49}
50
51#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
52pub struct MatchInfo {
53 pub id: String,
54 pub source: String,
55 pub content_type: String,
56 pub created_at: i64,
57 pub preview: String, }
59
60#[derive(Debug, thiserror::Error)]
61pub enum ResolveError {
62 #[error("prefix must be at least 4 characters")]
63 TooShort,
64 #[error("no match found")]
65 NotFound,
66 #[error("ambiguous prefix; {} candidates", .candidates.len())]
67 Ambiguous { candidates: Vec<MatchInfo> },
68 #[error("store error: {0}")]
69 Store(#[from] super::StoreError),
70}