rust_tg_bot_raw/bot/
user_profile.rs1use super::{push_opt, push_opt_str, Bot, Result};
2use crate::request::request_parameter::RequestParameter;
3use crate::types::{files, user_profile_audios, user_profile_photos};
4
5#[allow(dead_code)]
6impl Bot {
7 pub async fn get_user_profile_photos_raw(
15 &self,
16 user_id: i64,
17 offset: Option<i64>,
18 limit: Option<i64>,
19 ) -> Result<user_profile_photos::UserProfilePhotos> {
20 let mut params = vec![RequestParameter::new(
21 "user_id",
22 serde_json::to_value(user_id)?,
23 )];
24 push_opt(&mut params, "offset", &offset)?;
25 push_opt(&mut params, "limit", &limit)?;
26 self.do_post("getUserProfilePhotos", params).await
27 }
28
29 pub async fn get_user_profile_audios_raw(
33 &self,
34 user_id: i64,
35 offset: Option<i64>,
36 limit: Option<i64>,
37 ) -> Result<user_profile_audios::UserProfileAudios> {
38 let mut params = vec![RequestParameter::new(
39 "user_id",
40 serde_json::to_value(user_id)?,
41 )];
42 push_opt(&mut params, "offset", &offset)?;
43 push_opt(&mut params, "limit", &limit)?;
44 self.do_post("getUserProfileAudios", params).await
45 }
46
47 pub async fn set_user_emoji_status_raw(
51 &self,
52 user_id: i64,
53 emoji_status_custom_emoji_id: Option<&str>,
54 emoji_status_expiration_date: Option<i64>,
55 ) -> Result<bool> {
56 let mut params = vec![RequestParameter::new(
57 "user_id",
58 serde_json::to_value(user_id)?,
59 )];
60 push_opt_str(
61 &mut params,
62 "emoji_status_custom_emoji_id",
63 emoji_status_custom_emoji_id,
64 );
65 push_opt(
66 &mut params,
67 "emoji_status_expiration_date",
68 &emoji_status_expiration_date,
69 )?;
70 self.do_post("setUserEmojiStatus", params).await
71 }
72
73 pub async fn set_my_profile_photo_raw(&self, photo: serde_json::Value) -> Result<bool> {
77 let params = vec![RequestParameter::new("photo", photo)];
78 self.do_post("setMyProfilePhoto", params).await
79 }
80
81 pub async fn remove_my_profile_photo_raw(&self) -> Result<bool> {
85 self.do_post("removeMyProfilePhoto", Vec::new()).await
86 }
87
88 pub async fn get_file_raw(&self, file_id: &str) -> Result<files::file::File> {
97 let params = vec![RequestParameter::new(
98 "file_id",
99 serde_json::Value::String(file_id.to_owned()),
100 )];
101 self.do_post("getFile", params).await
102 }
103}