revolt_database/models/bots/
ops.rs1use revolt_result::Result;
2
3use crate::{Bot, FieldsBot, PartialBot};
4
5#[cfg(feature = "mongodb")]
6mod mongodb;
7mod reference;
8
9#[async_trait]
10pub trait AbstractBots: Sync + Send {
11 async fn insert_bot(&self, bot: &Bot) -> Result<()>;
13
14 async fn fetch_bot(&self, id: &str) -> Result<Bot>;
16
17 async fn fetch_bot_by_token(&self, token: &str) -> Result<Bot>;
19
20 async fn fetch_bots_by_user(&self, user_id: &str) -> Result<Vec<Bot>>;
22
23 async fn get_number_of_bots_by_user(&self, user_id: &str) -> Result<usize>;
25
26 async fn update_bot(
28 &self,
29 id: &str,
30 partial: &PartialBot,
31 remove: Vec<FieldsBot>,
32 ) -> Result<()>;
33
34 async fn delete_bot(&self, id: &str) -> Result<()>;
36}