feat(search): offset & limit options for search
This commit is contained in:
parent
10e3ca2efb
commit
4c6daf1fb7
3 changed files with 18 additions and 8 deletions
|
|
@ -18,13 +18,19 @@ struct SearchQueryParams {
|
|||
|
||||
pub struct Search {
|
||||
query: String,
|
||||
offset: Option<u32>,
|
||||
limit: Option<u32>,
|
||||
}
|
||||
|
||||
impl Search {
|
||||
const BASE_URL: &str = "https://api.modrinth.com/v2";
|
||||
|
||||
pub fn new(query: String) -> Self {
|
||||
Search { query }
|
||||
pub fn new(
|
||||
query: String,
|
||||
offset: Option<u32>,
|
||||
limit: Option<u32>,
|
||||
) -> Self {
|
||||
Search { query, offset, limit }
|
||||
}
|
||||
|
||||
pub async fn run(&self) -> Result<(), Box<dyn Error>> {
|
||||
|
|
@ -49,8 +55,8 @@ impl Search {
|
|||
let params = SearchQueryParams {
|
||||
query: self.query.clone(),
|
||||
facets: facets.into(),
|
||||
offset: None,
|
||||
limit: None,
|
||||
offset: self.offset,
|
||||
limit: self.limit,
|
||||
};
|
||||
|
||||
let res: SearchResult = client
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue