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