#![allow(clippy::too_many_arguments)]
use serde::Serialize;
use crate::error::Result;
use crate::Bot;
impl Bot {
pub fn set_chat_administrator_custom_title(
&self,
chat_id: i64,
user_id: i64,
custom_title: String,
) -> SetChatAdministratorCustomTitleBuilder {
SetChatAdministratorCustomTitleBuilder::new(self, chat_id, user_id, custom_title)
}
}
#[derive(Serialize)]
pub struct SetChatAdministratorCustomTitleBuilder<'a> {
#[serde(skip)]
bot: &'a Bot,
pub chat_id: i64,
pub user_id: i64,
pub custom_title: String,
}
impl<'a> SetChatAdministratorCustomTitleBuilder<'a> {
pub fn new(bot: &'a Bot, chat_id: i64, user_id: i64, custom_title: String) -> Self {
Self {
bot,
chat_id,
user_id,
custom_title,
}
}
pub fn chat_id(mut self, chat_id: i64) -> Self {
self.chat_id = chat_id;
self
}
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
pub fn custom_title(mut self, custom_title: String) -> Self {
self.custom_title = custom_title;
self
}
pub async fn send(self) -> Result<bool> {
let form = serde_json::to_value(&self)?;
self.bot
.get("setChatAdministratorCustomTitle", Some(&form))
.await
}
}