diff options
author | fxqnlr <[email protected]> | 2022-12-04 20:32:51 +0100 |
---|---|---|
committer | fxqnlr <[email protected]> | 2022-12-04 20:32:51 +0100 |
commit | 2ec20c50e7c02d82b248835988df040bd266b659 (patch) | |
tree | a8306a2c07438068dcd190762d3f77e68064b448 /src/apis/modrinth.rs | |
parent | f3f746be6c1c19c93d440bbc210dec631e2b42bb (diff) | |
download | modlist-2ec20c50e7c02d82b248835988df040bd266b659.tar modlist-2ec20c50e7c02d82b248835988df040bd266b659.tar.gz modlist-2ec20c50e7c02d82b248835988df040bd266b659.zip |
fully added mod remove; fixed update from NONE
Diffstat (limited to 'src/apis/modrinth.rs')
-rw-r--r-- | src/apis/modrinth.rs | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/src/apis/modrinth.rs b/src/apis/modrinth.rs index fb1e666..3880fa0 100644 --- a/src/apis/modrinth.rs +++ b/src/apis/modrinth.rs | |||
@@ -135,7 +135,6 @@ async fn get(api: String, path: String) -> Result<Option<Vec<u8>>, Box<dyn std:: | |||
135 | } | 135 | } |
136 | 136 | ||
137 | pub async fn project(api: String, name: &str) -> Project { | 137 | pub async fn project(api: String, name: &str) -> Project { |
138 | println!("!!!PROJECT"); | ||
139 | let url = format!("project/{}", name); | 138 | let url = format!("project/{}", name); |
140 | let data = get(api, url).await.unwrap().unwrap(); | 139 | let data = get(api, url).await.unwrap().unwrap(); |
141 | 140 | ||
@@ -143,11 +142,9 @@ pub async fn project(api: String, name: &str) -> Project { | |||
143 | } | 142 | } |
144 | 143 | ||
145 | pub async fn projects(api: String, ids: Vec<String>) -> Vec<Project> { | 144 | pub async fn projects(api: String, ids: Vec<String>) -> Vec<Project> { |
146 | //println!("!!!PROJECTS"); | ||
147 | println!("Getting versions for all mods from modrinth"); | 145 | println!("Getting versions for all mods from modrinth"); |
148 | let all = ids.join(r#"",""#); | 146 | let all = ids.join(r#"",""#); |
149 | let url = format!(r#"projects?ids=["{}"]"#, all); | 147 | let url = format!(r#"projects?ids=["{}"]"#, all); |
150 | //println!("{}", url); | ||
151 | 148 | ||
152 | let data = get(api, url).await.unwrap().unwrap(); | 149 | let data = get(api, url).await.unwrap().unwrap(); |
153 | 150 | ||
@@ -155,7 +152,6 @@ pub async fn projects(api: String, ids: Vec<String>) -> Vec<Project> { | |||
155 | } | 152 | } |
156 | 153 | ||
157 | pub async fn versions(api: String, id: String, list: List) -> Vec<Version> { | 154 | pub async fn versions(api: String, id: String, list: List) -> Vec<Version> { |
158 | println!("!!!VERSIONS"); | ||
159 | let loaderstr = match list.modloader { | 155 | let loaderstr = match list.modloader { |
160 | Modloader::Forge => String::from("forge"), | 156 | Modloader::Forge => String::from("forge"), |
161 | Modloader::Fabric => String::from("fabric"), | 157 | Modloader::Fabric => String::from("fabric"), |
@@ -165,8 +161,6 @@ pub async fn versions(api: String, id: String, list: List) -> Vec<Version> { | |||
165 | 161 | ||
166 | let data = get(api, url).await.unwrap(); | 162 | let data = get(api, url).await.unwrap(); |
167 | 163 | ||
168 | dbg!(&data); | ||
169 | |||
170 | match data { | 164 | match data { |
171 | Some(data) => serde_json::from_slice(&data).unwrap(), | 165 | Some(data) => serde_json::from_slice(&data).unwrap(), |
172 | None => Vec::new(), | 166 | None => Vec::new(), |
@@ -174,7 +168,6 @@ pub async fn versions(api: String, id: String, list: List) -> Vec<Version> { | |||
174 | } | 168 | } |
175 | 169 | ||
176 | pub async fn get_raw_versions(api: String, versions: Vec<String>) -> Vec<Version> { | 170 | pub async fn get_raw_versions(api: String, versions: Vec<String>) -> Vec<Version> { |
177 | println!("!!!RAWVERSIONS"); | ||
178 | println!("Getting versions {}", &versions.join(", ")); | 171 | println!("Getting versions {}", &versions.join(", ")); |
179 | 172 | ||
180 | let url = format!(r#"versions?ids=["{}"]"#, versions.join(r#"",""#)); | 173 | let url = format!(r#"versions?ids=["{}"]"#, versions.join(r#"",""#)); |