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
extern crate serde; extern crate serde_json; #[macro_use] extern crate serde_derive; extern crate reqwest; #[cfg(test)] extern crate mockito; extern crate chrono; pub mod ops; pub mod models; pub mod errors; pub mod gateway; use gateway::{Gateway}; pub use self::models::*; pub use self::gateway::Options; pub struct Client { pub contients: ops::ContinentGateway, pub commentaries: ops::CommentariesGateway, pub countries: ops::CountryGateway, pub fixtures: ops::FixtureGateway, pub head_to_head: ops::HeadToHeadGateway, pub leagues: ops::LeagueGateway, pub livescores: ops::LivescoreGateway, pub players: ops::PlayerGateway, pub seasons: ops::SeasonGateway, pub standings: ops::StandingGateway, pub teams: ops::TeamGateway, pub topscorers: ops::TopscorerGateway, } impl std::fmt::Debug for Client { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "SportsMonks::Client") } } impl Client { pub fn new<S: Into<String>>(api_key: S) -> Client { let api_key_string = api_key.into(); Client { contients: ops::ContinentGateway::new(Gateway::new(api_key_string.clone())), commentaries: ops::CommentariesGateway::new(Gateway::new(api_key_string.clone())), countries: ops::CountryGateway::new(Gateway::new(api_key_string.clone())), fixtures: ops::FixtureGateway::new(Gateway::new(api_key_string.clone())), head_to_head: ops::HeadToHeadGateway::new(Gateway::new(api_key_string.clone())), leagues: ops::LeagueGateway::new(Gateway::new(api_key_string.clone())), livescores: ops::LivescoreGateway::new(Gateway::new(api_key_string.clone())), players: ops::PlayerGateway::new(Gateway::new(api_key_string.clone())), seasons: ops::SeasonGateway::new(Gateway::new(api_key_string.clone())), standings: ops::StandingGateway::new(Gateway::new(api_key_string.clone())), teams: ops::TeamGateway::new(Gateway::new(api_key_string.clone())), topscorers: ops::TopscorerGateway::new(Gateway::new(api_key_string.clone())), } } }