gcs_rsync/gcp/
mod.rs

1pub mod oauth2;
2pub mod storage;
3pub mod sync;
4
5#[derive(Debug, Clone)]
6pub struct Client {
7    pub(self) client: reqwest::Client,
8}
9
10#[derive(Debug, serde::Deserialize)]
11#[serde(untagged)]
12enum DeserializedResponse<T> {
13    Success(T),
14    Error(serde_json::Value),
15}
16
17impl<T> DeserializedResponse<T> {
18    pub fn into_result(self) -> Result<T, serde_json::Value> {
19        match self {
20            DeserializedResponse::Success(x) => Ok(x),
21            DeserializedResponse::Error(e) => Err(e),
22        }
23    }
24}
25
26impl Default for Client {
27    fn default() -> Self {
28        Self {
29            client: reqwest::Client::new(),
30        }
31    }
32}