fix: Modrinth search categories not being serialized properly

This commit is contained in:
LynithDev 2025-08-07 18:45:53 +02:00
parent 33c865893f
commit 37b85adefa

View file

@ -97,20 +97,24 @@ impl ProviderExt for ModrinthProviderImpl {
let url = url.as_str(); let url = url.as_str();
#[derive(Deserialize)] #[derive(Deserialize)]
struct SearchResults { struct Response {
pub hits: Vec<SearchResult>, pub hits: Vec<ModrinthSearchResult>,
pub offset: usize, pub offset: usize,
pub limit: usize, pub limit: usize,
pub total_hits: usize, pub total_hits: usize,
} }
let response = http::fetch_json::<SearchResults>(Method::GET, url, None, None).await?; let response = http::fetch_json::<Response>(Method::GET, url, None, None).await?;
Ok(Paginated { Ok(Paginated {
offset: response.offset, offset: response.offset,
limit: response.limit, limit: response.limit,
total: response.total_hits, total: response.total_hits,
items: response.hits, items: response
.hits
.into_iter()
.map(Into::into)
.collect::<Vec<_>>(),
}) })
} }