diff options
Diffstat (limited to 'src/apis/modrinth.rs')
-rw-r--r-- | src/apis/modrinth.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/apis/modrinth.rs b/src/apis/modrinth.rs index c71b47f..abb8eec 100644 --- a/src/apis/modrinth.rs +++ b/src/apis/modrinth.rs | |||
@@ -156,6 +156,16 @@ pub async fn versions(api: String, id: String, list: List) -> Vec<Version> { | |||
156 | serde_json::from_slice(&data.await.unwrap()).unwrap() | 156 | serde_json::from_slice(&data.await.unwrap()).unwrap() |
157 | } | 157 | } |
158 | 158 | ||
159 | pub async fn get_raw_versions(api: String, versions: Vec<String>) -> Vec<Version> { | ||
160 | println!("Getting versions"); | ||
161 | |||
162 | let url = format!(r#"versions?ids=["{}"]"#, versions.join(r#"",""#)); | ||
163 | |||
164 | let data = get(api, url).await; | ||
165 | |||
166 | serde_json::from_slice(&data.unwrap()).unwrap() | ||
167 | } | ||
168 | |||
159 | pub fn extract_current_version(versions: Vec<Version>) -> Result<String, Box<dyn std::error::Error>> { | 169 | pub fn extract_current_version(versions: Vec<Version>) -> Result<String, Box<dyn std::error::Error>> { |
160 | match versions.len() { | 170 | match versions.len() { |
161 | 0 => Err(Box::new(Error::new(ErrorKind::NotFound, "NO_VERSIONS_AVAILABLE"))), | 171 | 0 => Err(Box::new(Error::new(ErrorKind::NotFound, "NO_VERSIONS_AVAILABLE"))), |