Skip to main content

openlimits_binance/client/
general.rs

1use super::BaseClient;
2use crate::model::{ExchangeInformation, ServerTime};
3use serde_json::Value;
4use super::shared::Result;
5
6impl BaseClient {
7    // Test connectivity
8    pub async fn ping(&self) -> Result<String> {
9        self.transport
10            .get::<_, ()>("/api/v1/ping", None)
11            .await
12            .map(|_: Value| "pong".into())
13    }
14
15    // Check server time
16    pub async fn get_server_time(&self) -> Result<ServerTime> {
17        self.transport.get::<_, ()>("/api/v1/time", None).await
18    }
19
20    pub async fn get_exchange_info(&self) -> Result<ExchangeInformation> {
21        self.transport
22            .get::<_, ()>("/api/v1/exchangeInfo", None)
23            .await
24    }
25}