some_random_api/endpoints/
chatbot.rs

1use crate::{ChatBotResponse, Requester};
2use anyhow::Result;
3
4/// An endpoint for interactiong with the ChatBot
5///
6/// # Examples
7///
8/// ```
9/// use some_random_api::Client;
10/// use std::fs::write;
11///
12/// Client::new(Some("xxxxxxxxxx")).chatbot.chatbot("Hello there").await?;
13/// ```
14pub struct ChatBotEndpoint(pub(crate) Requester);
15
16impl ChatBotEndpoint {
17    /// Talk to a virtual chatbot
18    pub async fn chatbot<T: ToString>(&self, message: T) -> Result<ChatBotResponse> {
19        self.0
20            .request("chatbot", Some(&[("message", message.to_string())]))
21            .await
22    }
23}