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