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
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
extern crate hex;
#[macro_use]
extern crate lazy_static;
extern crate ring;
extern crate serde;
extern crate serde_json;
extern crate time;
extern crate ureq;

pub mod endpoint;
pub mod private;
pub mod public;

use serde::{Deserialize, Serialize};

/// ## Symbol
/// validなsymbol
#[derive(Debug)]
#[allow(non_camel_case_types)]
pub enum Symbol {
    BTC,
    ETH,
    BCH,
    LTC,
    XRP,
    BTC_JPY,
    ETH_JPY,
    BCH_JPY,
    LTC_JPY,
    XRP_JPY,
}

impl std::fmt::Display for self::Symbol {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        match self {
            Symbol::BTC => write!(f, "BTC"),
            Symbol::ETH => write!(f, "ETH"),
            Symbol::BCH => write!(f, "BCH"),
            Symbol::LTC => write!(f, "LTC"),
            Symbol::XRP => write!(f, "XRP"),
            Symbol::BTC_JPY => write!(f, "BTC_JPY"),
            Symbol::ETH_JPY => write!(f, "ETH_JPY"),
            Symbol::BCH_JPY => write!(f, "BCH_JPY"),
            Symbol::LTC_JPY => write!(f, "LTC_JPY"),
            Symbol::XRP_JPY => write!(f, "XRP_JPY"),
        }
    }
}

/// ## LevarageSymbol
/// levarageのvalidなsymbol
#[derive(Debug)]
#[allow(non_camel_case_types)]
pub enum LeverageSymbol {
    BTC_JPY,
    ETH_JPY,
    BCH_JPY,
    LTC_JPY,
    XRP_JPY,
}

impl std::fmt::Display for self::LeverageSymbol {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        match self {
            LeverageSymbol::BTC_JPY => write!(f, "BTC_JPY"),
            LeverageSymbol::ETH_JPY => write!(f, "ETH_JPY"),
            LeverageSymbol::BCH_JPY => write!(f, "BCH_JPY"),
            LeverageSymbol::LTC_JPY => write!(f, "LTC_JPY"),
            LeverageSymbol::XRP_JPY => write!(f, "XRP_JPY"),
        }
    }
}
/// ## Pagenation
/// ページ形式で返ってくるレスポンス用の構造体
///
///  - currentPage
///  - count
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Pagenation {
    pub current_page: usize,
    pub count: usize,
}

/// ## Response
///
/// Response
#[derive(Debug, Serialize, Deserialize)]
pub struct Response<T> {
    pub status: usize,
    pub data: T,
    pub responsetime: String
}

/// ## ResponsePage
///
/// Response
#[derive(Debug, Serialize, Deserialize)]
pub struct ResponsePage<T> {
    pub status: usize,
    pub data: DataPage<T>,
    pub responsetime: String
}

#[derive(Debug, Serialize, Deserialize)]
pub struct DataPage<T> {
    pub pagination: Pagenation,
    pub list: Vec<T>
}