#![allow(clippy::too_many_arguments)]
use serde::Serialize;
use crate::error::Result;
use crate::types::UserProfilePhotos;
use crate::Bot;
impl Bot {
pub fn get_user_profile_photos(&self, user_id: i64) -> GetUserProfilePhotosBuilder {
GetUserProfilePhotosBuilder::new(self, user_id)
}
}
#[derive(Serialize)]
pub struct GetUserProfilePhotosBuilder<'a> {
#[serde(skip)]
bot: &'a Bot,
pub user_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
pub offset: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
}
impl<'a> GetUserProfilePhotosBuilder<'a> {
pub fn new(bot: &'a Bot, user_id: i64) -> Self {
Self {
bot,
user_id,
offset: None,
limit: None,
}
}
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
pub fn offset(mut self, offset: i64) -> Self {
self.offset = Some(offset);
self
}
pub fn limit(mut self, limit: i64) -> Self {
self.limit = Some(limit);
self
}
pub async fn send(self) -> Result<UserProfilePhotos> {
let form = serde_json::to_value(&self)?;
self.bot.get("getUserProfilePhotos", Some(&form)).await
}
}