Skip to content

Commit f378ebc

Browse files
committed
feat(search): tests now uses ModrinthAPI::search function instead of ModrinthAPI::extended_search
1 parent c5ae0f8 commit f378ebc

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

examples/search.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
use modrinth_api::structs::search::{ExtendedSearch, Sort};
2+
use modrinth_api::{Error, ModrinthAPI};
3+
4+
#[tokio::main]
5+
async fn main() -> Result<(), Error> {
6+
let api = ModrinthAPI::default();
7+
let result = api
8+
.extended_search(
9+
"xaeros", // Query
10+
&Sort::Downloads, // Sort
11+
Some(20), // Maximum number of results to return.
12+
Some(ExtendedSearch {
13+
offset: None, // The offset into the search. Skips this number of results
14+
facets: vec![], // Facets are an essential concept for understanding how to filter out results.
15+
}),
16+
)
17+
.await?;
18+
19+
println!("{:#?}", result);
20+
Ok(())
21+
}

src/api/search.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ mod tests {
120120
async fn search_project() -> Result<()> {
121121
let api = ModrinthAPI::default();
122122
let response = api
123-
.extended_search(
123+
.search(
124124
"xaeros",
125125
&Sort::Downloads,
126126
None,
@@ -143,7 +143,7 @@ mod tests {
143143
async fn test_fetching_project_with_mut() -> Result<()> {
144144
let api = ModrinthAPI::default();
145145
let response = api
146-
.extended_search(
146+
.search(
147147
"xaeros",
148148
&Sort::Downloads,
149149
None,
@@ -170,7 +170,7 @@ mod tests {
170170
async fn test_fetching_project_without_mut() -> Result<()> {
171171
let api = ModrinthAPI::default();
172172
let response = api
173-
.extended_search(
173+
.search(
174174
"xaeros",
175175
&Sort::Downloads,
176176
None,

0 commit comments

Comments
 (0)