ferrisgram/methods/
set_chat_administrator_custom_title.rs1#![allow(clippy::too_many_arguments)]
5use serde::Serialize;
6
7use crate::error::Result;
8use crate::Bot;
9
10impl Bot {
11 pub fn set_chat_administrator_custom_title(
14 &self,
15 chat_id: i64,
16 user_id: i64,
17 custom_title: String,
18 ) -> SetChatAdministratorCustomTitleBuilder {
19 SetChatAdministratorCustomTitleBuilder::new(self, chat_id, user_id, custom_title)
20 }
21}
22
23#[derive(Serialize)]
24pub struct SetChatAdministratorCustomTitleBuilder<'a> {
25 #[serde(skip)]
26 bot: &'a Bot,
27 pub chat_id: i64,
29 pub user_id: i64,
31 pub custom_title: String,
33}
34
35impl<'a> SetChatAdministratorCustomTitleBuilder<'a> {
36 pub fn new(bot: &'a Bot, chat_id: i64, user_id: i64, custom_title: String) -> Self {
37 Self {
38 bot,
39 chat_id,
40 user_id,
41 custom_title,
42 }
43 }
44
45 pub fn chat_id(mut self, chat_id: i64) -> Self {
46 self.chat_id = chat_id;
47 self
48 }
49
50 pub fn user_id(mut self, user_id: i64) -> Self {
51 self.user_id = user_id;
52 self
53 }
54
55 pub fn custom_title(mut self, custom_title: String) -> Self {
56 self.custom_title = custom_title;
57 self
58 }
59
60 pub async fn send(self) -> Result<bool> {
61 let form = serde_json::to_value(&self)?;
62 self.bot
63 .get("setChatAdministratorCustomTitle", Some(&form))
64 .await
65 }
66}