telegram_bot_async_raw/requests/
get_user_profile_photos.rs1use crate::{requests::*, types::*};
2
3#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize)]
5#[must_use = "requests do nothing unless sent"]
6pub struct GetUserProfilePhotos {
7 user_id: UserId,
8 offset: Option<Integer>,
9 limit: Option<Integer>,
10}
11
12impl Request for GetUserProfilePhotos {
13 type Type = JsonRequestType<Self>;
14 type Response = JsonIdResponse<UserProfilePhotos>;
15
16 fn serialize(&self) -> Result<HttpRequest, Error> {
17 Self::Type::serialize(RequestUrl::method("getUserProfilePhotos"), self)
18 }
19}
20
21impl GetUserProfilePhotos {
22 pub fn new<U>(user: U) -> Self
23 where
24 U: ToUserId,
25 {
26 GetUserProfilePhotos {
27 user_id: user.to_user_id(),
28 offset: None,
29 limit: None,
30 }
31 }
32
33 pub fn offset(mut self, offset: Integer) -> Self {
34 self.offset = Some(offset);
35 self
36 }
37
38 pub fn limit(mut self, limit: Integer) -> Self {
39 self.limit = Some(limit);
40 self
41 }
42}
43
44pub trait CanGetUserProfilePhotos {
46 fn get_user_profile_photos(&self) -> GetUserProfilePhotos;
47}
48
49impl<'b, U> CanGetUserProfilePhotos for U
50where
51 U: ToUserId,
52{
53 fn get_user_profile_photos(&self) -> GetUserProfilePhotos {
54 GetUserProfilePhotos::new(self)
55 }
56}