diff --git a/tig-api/src/lib.rs b/tig-api/src/lib.rs index 567f3c8a..d8dcd569 100644 --- a/tig-api/src/lib.rs +++ b/tig-api/src/lib.rs @@ -60,9 +60,7 @@ impl Api { pub async fn get_challenges(&self, req: GetChallengesReq) -> Result { let mut query = HashMap::::new(); - if let Some(block_id) = req.block_id { - query.insert("block_id".to_string(), block_id); - } + query.insert("block_id".to_string(), req.block_id); let query = QueryMap::from(query); self.get(format!("get-challenges?{}", query.to_query_string())) .await @@ -70,9 +68,7 @@ impl Api { pub async fn get_algorithms(&self, req: GetAlgorithmsReq) -> Result { let mut query = HashMap::::new(); - if let Some(block_id) = req.block_id { - query.insert("block_id".to_string(), block_id); - } + query.insert("block_id".to_string(), req.block_id); let query = QueryMap::from(query); self.get(format!("get-algorithms?{}", query.to_query_string())) .await @@ -80,9 +76,7 @@ impl Api { pub async fn get_players(&self, req: GetPlayersReq) -> Result { let mut query = HashMap::::new(); - if let Some(block_id) = req.block_id { - query.insert("block_id".to_string(), block_id); - } + query.insert("block_id".to_string(), req.block_id); query.insert("player_type".to_string(), req.player_type.to_string()); let query = QueryMap::from(query); self.get(format!("get-players?{}", query.to_query_string())) @@ -91,9 +85,7 @@ impl Api { pub async fn get_benchmarks(&self, req: GetBenchmarksReq) -> Result { let mut query = HashMap::::new(); - if let Some(block_id) = req.block_id { - query.insert("block_id".to_string(), block_id); - } + query.insert("block_id".to_string(), req.block_id); query.insert("player_id".to_string(), req.player_id); let query = QueryMap::from(query); self.get(format!("get-benchmarks?{}", query.to_query_string())) diff --git a/tig-structs/src/api.rs b/tig-structs/src/api.rs index 3334aaf3..61ac51b8 100644 --- a/tig-structs/src/api.rs +++ b/tig-structs/src/api.rs @@ -39,7 +39,7 @@ impl PlayerType { serializable_struct_with_getters! { GetPlayersReq { - block_id: Option, + block_id: String, player_type: PlayerType, } } @@ -69,7 +69,7 @@ serializable_struct_with_getters! { serializable_struct_with_getters! { GetChallengesReq { - block_id: Option, + block_id: String, } } @@ -83,7 +83,7 @@ serializable_struct_with_getters! { serializable_struct_with_getters! { GetAlgorithmsReq { - block_id: Option, + block_id: String, } } @@ -98,7 +98,7 @@ serializable_struct_with_getters! { serializable_struct_with_getters! { GetBenchmarksReq { - block_id: Option, + block_id: String, player_id: String, } }