1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use holochain_core_types::cas::content::Address;

#[derive(Deserialize, Default, Debug, Serialize)]
pub struct GetEntryArgs {
    pub address: Address,
}

#[derive(Deserialize, Debug, Serialize)]
pub enum GetResultStatus {
    Found,
    NotFound,
}

// empty for now, need to implement get options
#[derive(Deserialize, Debug, Serialize)]
pub struct GetEntryOptions {}

#[derive(Deserialize, Debug, Serialize)]
pub struct GetEntryResult {
    pub status: GetResultStatus,
    pub entry: String,
}

impl GetEntryResult {
    pub fn found(entry: String) -> GetEntryResult {
        GetEntryResult {
            status: GetResultStatus::Found,
            entry,
        }
    }

    pub fn not_found() -> GetEntryResult {
        GetEntryResult {
            status: GetResultStatus::NotFound,
            entry: String::from(""),
        }
    }
}