pub struct Sarufi { /* private fields */ }
Expand description
API struct. Exposes function to interact with the Sarufi API 🥷 #[derive(Debug, Serialize, Deserialize)]
Implementations§
source§impl Sarufi
impl Sarufi
sourcepub fn new<S: Into<String>>(api_key: S) -> Result<Sarufi, ApiError>
pub fn new<S: Into<String>>(api_key: S) -> Result<Sarufi, ApiError>
Creates a new instance of Sarufi using the provided api key this function panics if the api_key is empty 🤒
pub async fn get_bot(&self, id: usize) -> Result<Bot, ApiError>
pub async fn get_all_bots(&self) -> Result<Vec<Bot>, ApiError>
pub async fn _fetch_response( &self, bot_id: usize, chat_id: &str, message: &str, message_type: &str, channel: &str ) -> Result<String, ApiError>
pub async fn chat(&self, bot_id: usize) -> Result<String, ApiError>
pub async fn chat_status( &self, bot_id: usize, chat_id: &str ) -> Result<String, ApiError>
pub async fn update_conversation_state( &self, bot_id: usize, chat_id: &str, next_state: &str ) -> Result<String, ApiError>
pub async fn delete_bot(&self, id: usize) -> Result<(), ApiError>
sourcepub async fn create_bot(
&self,
name: &str,
description: Option<&str>,
industry: Option<&str>,
flow: Option<HashMap<String, Value>>,
intents: Option<HashMap<String, Vec<String>>>,
webhook_url: Option<&str>,
webhook_trigger_intents: Option<Vec<String>>,
visible_on_community: Option<bool>
) -> Result<Bot, ApiError>
pub async fn create_bot( &self, name: &str, description: Option<&str>, industry: Option<&str>, flow: Option<HashMap<String, Value>>, intents: Option<HashMap<String, Vec<String>>>, webhook_url: Option<&str>, webhook_trigger_intents: Option<Vec<String>>, visible_on_community: Option<bool> ) -> Result<Bot, ApiError>
Creates a new bot
pub async fn create_bot_from_file( &self, file_path: &str ) -> Result<Bot, ApiError>
pub async fn update_bot( &self, id: usize, name: &str, description: Option<&str>, industry: Option<&str>, flow: Option<HashMap<String, Value>>, intents: Option<HashMap<String, Vec<String>>>, webhook_url: Option<&str>, webhook_trigger_intents: Option<Vec<String>>, visible_on_community: Option<bool> ) -> Result<Bot, ApiError>
Auto Trait Implementations§
impl !RefUnwindSafe for Sarufi
impl Send for Sarufi
impl Sync for Sarufi
impl Unpin for Sarufi
impl !UnwindSafe for Sarufi
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more