diff options
| author | jakka <jakka@jakka.su> | 2025-09-09 10:13:40 +0300 |
|---|---|---|
| committer | jakka <jakka@jakka.su> | 2025-09-09 10:13:40 +0300 |
| commit | ab6f2caa83e05a2eaff40307f608975841ba6cfb (patch) | |
| tree | 2bb0648f09abe6f25d5ee86d876d52c6577d3e21 | |
| parent | 3884a14c7dde671a96695f43a23bfbb2bd6c33e5 (diff) | |
continued working on api
| -rw-r--r-- | Cargo.lock | 1 | ||||
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | src/client.rs | 4 | ||||
| -rw-r--r-- | src/lib.rs | 4 | ||||
| -rw-r--r-- | src/tests.rs | 4 | ||||
| -rw-r--r-- | src/types.rs | 1 |
6 files changed, 6 insertions, 9 deletions
@@ -122,7 +122,6 @@ checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" name = "hydrus-api-rs" version = "0.1.0" dependencies = [ - "http", "musli", "thiserror", "ureq", @@ -4,7 +4,6 @@ version = "0.1.0" edition = "2024" [dependencies] -http = "1.3.1" musli = { version = "0.0.145", features = ["json"] } thiserror = "2.0.16" ureq = "3.1.0" diff --git a/src/client.rs b/src/client.rs index 4847db8..49d903e 100644 --- a/src/client.rs +++ b/src/client.rs @@ -32,7 +32,7 @@ impl HydrusClient { ) -> Result<String> { let mut req_url = self.url.to_owned(); req_url.push_str("request_new_permissions?name="); - req_url.push_str(&urlencoding::encode(&name)); + req_url.push_str(&urlencoding::encode(name)); if permissions.is_empty() { req_url.push_str("&permit_everything=true"); @@ -83,7 +83,7 @@ impl HydrusClient { pub fn get_service_name(&self, name: &str) -> Result<Service> { let mut req_url = self.url.to_owned(); req_url.push_str("get_service?service_name="); - req_url.push_str(&urlencoding::encode(&name)); + req_url.push_str(&urlencoding::encode(name)); let response = if let Some(key) = &self.sessionkey { ureq::get(req_url) .header("Hydrus-Client-API-Access-Key", key) @@ -1,3 +1,5 @@ pub mod client; -mod tests; pub mod types; + +#[cfg(test)] +mod tests; diff --git a/src/tests.rs b/src/tests.rs index d22dedd..3fafdbe 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -1,8 +1,6 @@ use crate::client::HydrusClient; -use http::Uri; - -#[cfg(test)] use crate::types::*; + #[test] fn correct_hydruspermissions_url_encode() { let perms: [HydrusPermissions; 3] = [ diff --git a/src/types.rs b/src/types.rs index 2cf1524..5472906 100644 --- a/src/types.rs +++ b/src/types.rs @@ -26,7 +26,6 @@ impl From<ureq::Error> for HydrusError { #[derive(PartialEq, Debug, Clone)] #[repr(u8)] - pub enum HydrusPermissions { ImportAndEditURLs = 0, ImportAndEditFiles, |
