Skip to main content

hinge_rs/api/
raw.rs

1use crate::client::HingeClient;
2use crate::errors::HingeError;
3use crate::storage::Storage;
4
5pub struct RawApi<'a, S: Storage + Clone> {
6    pub(super) client: &'a mut HingeClient<S>,
7}
8
9impl<S: Storage + Clone> RawApi<'_, S> {
10    pub async fn hinge(
11        &self,
12        method: reqwest::Method,
13        path_or_url: &str,
14        body: Option<serde_json::Value>,
15    ) -> Result<serde_json::Value, HingeError> {
16        self.client.raw_hinge_json(method, path_or_url, body).await
17    }
18
19    pub async fn sendbird(
20        &self,
21        method: reqwest::Method,
22        path_or_url: &str,
23        body: Option<serde_json::Value>,
24    ) -> Result<serde_json::Value, HingeError> {
25        self.client
26            .raw_sendbird_json(method, path_or_url, body)
27            .await
28    }
29}