summaryrefslogtreecommitdiff
path: root/src/types.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/types.rs')
-rw-r--r--src/types.rs25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/types.rs b/src/types.rs
index b6e9db4..8ea8350 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -1,6 +1,5 @@
use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
-use std::collections::HashMap;
use thiserror::Error;
#[derive(Error, Debug)]
@@ -33,6 +32,14 @@ impl From<reqwest::Error> for HydrusError {
}
}
+#[derive(Deserialize, Debug)]
+pub struct HydrusResponse<T> {
+ #[serde(alias = "service", alias = "services")]
+ pub body: T,
+ pub version: u64,
+ pub hydrus_version: u64,
+}
+
#[derive(PartialEq, Debug, Clone, Serialize_repr, Deserialize_repr)]
#[repr(u8)]
pub enum HydrusPermissions {
@@ -111,22 +118,6 @@ pub struct Service {
pub max_stars: Option<u8>,
}
-#[derive(Deserialize, Debug)]
-pub struct ServiceResponse {
- services: HashMap<String, Service>,
-}
-
-impl ServiceResponse {
- pub fn service_vec(mut self) -> Vec<Service> {
- let mut res = Vec::new();
- for (key, mut service) in self.services.drain() {
- service.service_key = key;
- res.push(service);
- }
- res
- }
-}
-
pub enum FileDomain {
FileServiceKey(String),
FileServiceKeys(Vec<String>),