bybit_rust_api/rest/market/dto/
server_time.rs

1use crate::rest::client::ServerResponse;
2use serde::{Deserialize, Serialize};
3
4// https://bybit-exchange.github.io/docs/v5/market/time
5// https://bybit-exchange.github.io/docs/v5/market/time#response-example
6/*
7{
8    "retCode": 0,
9    "retMsg": "OK",
10    "result": {
11        "timeSecond": "1688639403",
12        "timeNano": "1688639403423213947"
13    },
14    "retExtInfo": {},
15    "time": 1688639403423
16}
17*/
18
19#[derive(Debug, Clone, Serialize, Deserialize)]
20pub struct ServerTimeResult {
21    #[serde(rename = "timeSecond")]
22    pub time_second: String,
23    #[serde(rename = "timeNano")]
24    pub time_nano: String,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct ServerTimeResponse(ServerResponse<ServerTimeResult>);
29
30impl ServerTimeResponse {
31    pub fn into_inner(self) -> ServerTimeResult {
32        self.0.result
33    }
34
35    pub fn into_response(self) -> ServerResponse<ServerTimeResult> {
36        self.0
37    }
38}