hugging_face_client/api/
search_models.rs

1use crate::{api::SearchReq, model::Model};
2
3/// Request of [`crate::client::Client::search_model`]
4pub type SearchModelReq<'a> = SearchReq<'a>;
5
6/// Response of [`crate::client::Client::search_model`]
7pub type SearchModelRes = Vec<Model>;
8
9#[cfg(test)]
10mod test {
11  use std::assert_matches::assert_matches;
12
13  use crate::api::SearchModelReq;
14
15  #[test]
16  fn test_serde_req() {
17    let req: SearchModelReq = SearchModelReq::default()
18      .search("1")
19      .author("2")
20      .filter("3")
21      .sort("4")
22      .direction(1)
23      .limit(100)
24      .full(true)
25      .config(true);
26    let query = serde_urlencoded::to_string(req);
27    assert_matches!(query, Ok(v) if v == "search=1&author=2&filter=3&sort=4&direction=1&limit=100&full=true&config=true");
28  }
29}