exc_binance/http/request/
utils.rs

1use super::{Rest, RestEndpoint, RestError};
2
3/// Ping USD-M Futures API.
4#[derive(Debug, Clone, Copy, Default)]
5pub struct Ping;
6
7impl Rest for Ping {
8    fn method(&self, _endpoint: &RestEndpoint) -> Result<http::Method, RestError> {
9        Ok(http::Method::GET)
10    }
11
12    fn to_path(&self, endpoint: &RestEndpoint) -> Result<String, RestError> {
13        match endpoint {
14            RestEndpoint::Spot(_) => Ok("/api/v3/ping".to_string()),
15            RestEndpoint::UsdMarginFutures => Ok("/fapi/v1/ping".to_string()),
16            RestEndpoint::EuropeanOptions => Ok("/eapi/v1/ping".to_string()),
17        }
18    }
19
20    fn to_payload(&self) -> super::Payload {
21        super::Payload::new(*self)
22    }
23}