safe_vk/traits/
methods.rs1use crate::{Ctx, LongPollResponse, Members, RequestBuilder, Result, User};
2use std::future::Future;
3
4pub trait Method {
5 fn new(token: String) -> Self;
6
7 fn keyboard<T: serde::Serialize + Send, N: crate::NdArray<T> + Send>(
8 &self,
9 message: &str,
10 one_time: bool,
11 inline: bool,
12 buttons: N,
13 ) -> impl Future<Output = Result<()>> + Send;
14
15 fn event_answer<
16 'de,
17 T: serde::Serialize + Send,
18 A: serde::de::DeserializeOwned + PartialEq + serde::Serialize + Send,
19 >(
20 &self,
21 event_data: T,
22 payload: A,
23 ) -> impl Future<Output = Result<Option<A>>> + Send;
24
25 fn reply(&self, message: &str) -> impl Future<Output = ()> + Send;
26
27 fn long_poll(&self, group_id: u32) -> impl Future<Output = LongPollResponse> + Send;
28
29 fn connect(
30 &self,
31 server: &str,
32 token: String,
33 ts: String,
34 wait: usize,
35 ) -> impl Future<Output = Ctx> + Send;
36
37 fn get_users(&self, user_ids: &[i32]) -> impl Future<Output = Result<Vec<User>>> + Send;
38
39 fn get_members(
40 &self,
41 offset: Option<u16>,
42 count: Option<u16>,
43 extended: bool,
44 ) -> impl Future<Output = Result<Members>> + Send;
45
46 fn custom_request(&self) -> &RequestBuilder;
47
48 fn context(&self) -> impl Future<Output = tokio::sync::RwLockReadGuard<'_, Ctx>> + Send;
49}