exa_async/resources/
search.rs1use crate::client::Client;
2use crate::config::Config;
3use crate::error::ExaError;
4use crate::types::search::SearchRequest;
5use crate::types::search::SearchResponse;
6
7pub struct Search<'c, C: Config> {
9 client: &'c Client<C>,
10}
11
12impl<'c, C: Config> Search<'c, C> {
13 #[must_use]
15 pub const fn new(client: &'c Client<C>) -> Self {
16 Self { client }
17 }
18
19 pub async fn create(&self, req: SearchRequest) -> Result<SearchResponse, ExaError> {
25 self.client.post("/search", req).await
26 }
27}
28
29impl<C: Config> crate::Client<C> {
31 #[must_use]
33 pub const fn search(&self) -> Search<'_, C> {
34 Search::new(self)
35 }
36}