pub mod app;
pub mod auth;
pub mod log;
pub mod search;
pub mod sync;
pub mod torrents;
pub mod transfer;
use crate::error::ClientError;
use async_trait::async_trait;
use serde::{de::DeserializeOwned, Serialize};
use std::borrow::Cow;
#[async_trait]
pub trait Endpoint {
type Query: Serialize;
type Form: Serialize;
type Response: DeserializeOwned;
fn relative_path(&self) -> Cow<str>;
fn query(&self) -> Option<&Self::Query> {
None
}
fn form(&self) -> Option<&Self::Form> {
None
}
fn multipart(&self) -> Option<reqwest::multipart::Form> {
None
}
fn method(&self) -> reqwest::Method {
reqwest::Method::POST
}
fn check_status(&self, status: reqwest::StatusCode) -> Option<ClientError>;
async fn de_response(&self, res: reqwest::Response) -> Result<Self::Response, ClientError>;
}