diff options
| author | jakka <jakka@jakka.su> | 2025-09-09 10:11:04 +0300 |
|---|---|---|
| committer | jakka <jakka@jakka.su> | 2025-09-09 10:11:04 +0300 |
| commit | 3884a14c7dde671a96695f43a23bfbb2bd6c33e5 (patch) | |
| tree | 35656a20a8111a8e234e3231b339dcd309cff5b1 /src/types.rs | |
| parent | f96c95cdc5d2d974b3a1969a729e0492b178ee46 (diff) | |
continued working on api
Diffstat (limited to 'src/types.rs')
| -rw-r--r-- | src/types.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/types.rs b/src/types.rs index d1abb8d..2cf1524 100644 --- a/src/types.rs +++ b/src/types.rs @@ -8,6 +8,8 @@ pub enum HydrusError { NetworkError(ureq::Error), #[error("failed to deserialize data")] DeserializeError(musli::json::Error), + #[error("api or session key needed")] + KeyNotSupplied, } impl From<musli::json::Error> for HydrusError { @@ -95,17 +97,17 @@ where } } -#[derive(Decode)] +#[derive(Decode, Debug)] pub struct AccessKey { pub access_key: String, } -#[derive(Decode)] +#[derive(Decode, Debug)] pub struct SessionKey { pub session_key: String, } -#[derive(Decode)] +#[derive(Decode, Debug)] pub struct KeyInfo { pub name: String, pub permits_everything: bool, @@ -190,7 +192,8 @@ where where D: Decoder<'de>, { - Ok(decoder.decode()?) + let val: u8 = decoder.decode()?; + Ok(val.into()) } } @@ -201,4 +204,10 @@ pub struct Service { pub service_key: String, pub servicetype: ServiceType, pub type_pretty: String, + #[musli(default)] + pub star_shape: String, + #[musli(default)] + pub min_stars: u8, + #[musli(default)] + pub max_stars: u8, } |
