summaryrefslogtreecommitdiff
path: root/src/apis
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2023-01-19 18:37:42 +0100
committerfxqnlr <[email protected]>2023-01-19 18:37:42 +0100
commitf7a6d2e9c67c1fdf8fc17fa0461a201fd2720537 (patch)
tree21d0c7356b55e9b45517fd9ca874dd3270b6bc3a /src/apis
parentbe9f74f4fb82b25abd99f7024e0f5eea2691f34f (diff)
downloadmodlist-f7a6d2e9c67c1fdf8fc17fa0461a201fd2720537.tar
modlist-f7a6d2e9c67c1fdf8fc17fa0461a201fd2720537.tar.gz
modlist-f7a6d2e9c67c1fdf8fc17fa0461a201fd2720537.zip
input mostly inplemented, mods missing
Diffstat (limited to 'src/apis')
-rw-r--r--src/apis/modrinth.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/apis/modrinth.rs b/src/apis/modrinth.rs
index 78073e6..9890cf2 100644
--- a/src/apis/modrinth.rs
+++ b/src/apis/modrinth.rs
@@ -3,7 +3,7 @@ use chrono::{DateTime, FixedOffset};
3use reqwest::Client; 3use reqwest::Client;
4use serde::Deserialize; 4use serde::Deserialize;
5 5
6use crate::{Modloader, List}; 6use crate::{Modloader, List, error::{MLE, MLError, ErrorType}};
7 7
8#[derive(Debug, Deserialize, Clone)] 8#[derive(Debug, Deserialize, Clone)]
9pub struct Project { 9pub struct Project {
@@ -177,9 +177,9 @@ pub async fn get_raw_versions(api: String, versions: Vec<String>) -> Vec<Version
177 serde_json::from_slice(&data).unwrap() 177 serde_json::from_slice(&data).unwrap()
178} 178}
179 179
180pub fn extract_current_version(versions: Vec<Version>) -> Result<String, Box<dyn std::error::Error>> { 180pub fn extract_current_version(versions: Vec<Version>) -> MLE<String> {
181 match versions.len() { 181 match versions.len() {
182 0 => Err(Box::new(Error::new(ErrorKind::NotFound, "NO_VERSIONS_AVAILABLE"))), 182 0 => Err(MLError::new(ErrorType::ModError, "NO_VERSIONS_AVAILABLE")),
183 1.. => { 183 1.. => {
184 let mut times: Vec<(String, DateTime<FixedOffset>)> = vec![]; 184 let mut times: Vec<(String, DateTime<FixedOffset>)> = vec![];
185 for ver in versions { 185 for ver in versions {