1pub mod app;
2pub mod auth;
3pub mod log;
4pub mod search;
5pub mod sync;
6pub mod torrents;
7pub mod transfer;
8
9use crate::error::ClientError;
10use async_trait::async_trait;
11use serde::{de::DeserializeOwned, Serialize};
12use std::borrow::Cow;
13
14#[async_trait]
15pub trait Endpoint {
16 type Query: Serialize;
18 type Form: Serialize;
19 type Response: DeserializeOwned;
20 fn relative_path(&self) -> Cow<str>;
22 fn query(&self) -> Option<&Self::Query> {
24 None
25 }
26 fn form(&self) -> Option<&Self::Form> {
28 None
29 }
30 fn multipart(&self) -> Option<reqwest::multipart::Form> {
32 None
33 }
34 fn method(&self) -> reqwest::Method {
36 reqwest::Method::POST
37 }
38 fn check_status(&self, status: reqwest::StatusCode) -> Option<ClientError>;
40 async fn de_response(&self, res: reqwest::Response) -> Result<Self::Response, ClientError>;
42}