1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
use serde::{Deserialize, Serialize};
/// [`Gateio`](super::Gateio) WebSocket message.
///
/// ### Raw Payload Examples
/// #### Subscription Trades Success
/// See docs: <https://www.gate.io/docs/developers/apiv4/ws/en/#api-overview>
/// ```json
/// {
/// "time": 1606292218,
/// "time_ms": 1606292218231,
/// "channel": "spot.trades",
/// "event": "subscribe",
/// "result": {
/// "status": "success"
/// }
/// }
/// ```
///
/// #### Subscription Trades Failure
/// See docs: <https://www.gate.io/docs/developers/apiv4/ws/en/#api-overview>
/// ```json
/// {
/// "time": 1606292218,
/// "time_ms": 1606292218231,
/// "channel": "spot.trades",
/// "event": "subscribe",
/// "error":{
/// "code":2,
/// "message":"unknown currency pair GIBBERISH_USD"
/// },
/// "result": null,
/// }
/// ```
///
/// #### Spot Trade
/// See docs: <https://www.gate.io/docs/developers/apiv4/ws/en/#public-trades-channel>
/// ```json
/// {
/// "time": 1606292218,
/// "time_ms": 1606292218231,
/// "channel": "spot.trades",
/// "event": "update",
/// "result": {
/// "id": 309143071,
/// "create_time": 1606292218,
/// "create_time_ms": "1606292218213.4578",
/// "side": "sell",
/// "currency_pair": "GT_USDT",
/// "amount": "16.4700000000",
/// "price": "0.4705000000"
/// }
/// }
/// ```
///
/// See docs: <https://www.gate.io/docs/developers/apiv4/ws/en/#public-trades-channel>
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Deserialize, Serialize)]
pub struct GateioMessage<T> {
pub channel: String,
pub error: Option<GateioError>,
#[serde(rename = "result")]
pub data: T,
}
/// [`Gateio`](super::Gateio) WebSocket error message.
///
/// See docs: <https://www.gate.io/docs/developers/apiv4/ws/en/#public-trades-channel>
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Deserialize, Serialize)]
pub struct GateioError {
pub code: u8,
pub message: String,
}