From 0f5223d3d3f6aeb6bb1a0b09ad3d4ef5731774dd Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Sat, 5 Nov 2022 21:53:24 +0100 Subject: added setup & download; direct input --- src/apis/modrinth.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/apis/modrinth.rs') 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 { serde_json::from_slice(&data.await.unwrap()).unwrap() } +pub async fn get_raw_versions(api: String, versions: Vec) -> Vec { + println!("Getting versions"); + + let url = format!(r#"versions?ids=["{}"]"#, versions.join(r#"",""#)); + + let data = get(api, url).await; + + serde_json::from_slice(&data.unwrap()).unwrap() +} + pub fn extract_current_version(versions: Vec) -> Result> { match versions.len() { 0 => Err(Box::new(Error::new(ErrorKind::NotFound, "NO_VERSIONS_AVAILABLE"))), -- cgit v1.2.3