Skip to main content

context69_sdk/client/
search.rs

1use context69_contracts::{DocumentResponse, SearchRequest, SearchResponse};
2use reqwest::Method;
3
4use crate::{Context69Client, Error};
5
6impl Context69Client {
7    pub async fn search(&self, request: SearchRequest) -> Result<SearchResponse, Error> {
8        self.execute_json(
9            self.authorized_request(Method::POST, "/v1/search")
10                .await?
11                .json(&request),
12        )
13        .await
14    }
15
16    pub async fn get_document(&self, document_id: i64) -> Result<DocumentResponse, Error> {
17        let path = format!("/v1/documents/{document_id}");
18        self.execute_json(self.authorized_request(Method::GET, &path).await?)
19            .await
20    }
21}