diff --git a/src/requests/get_user_profile_photos.rs b/src/requests/get_user_profile_photos.rs index 5feca84e..619dde88 100644 --- a/src/requests/get_user_profile_photos.rs +++ b/src/requests/get_user_profile_photos.rs @@ -1,7 +1,7 @@ -use crate::requests::RequestContext; +use crate::network; +use crate::requests::{Request, RequestContext, RequestFuture, ResponseResult}; +use crate::types::UserProfilePhotos; -//TODO: complete implementation after user_profile_fotos will be added to -// types/mod.rs ///Use this method to get a list of profile pictures for a user. Returns a /// UserProfilePhotos object. #[derive(Debug, Clone, Serialize)] @@ -17,3 +17,46 @@ pub struct GetUserProfilePhotos<'a> { /// accepted. Defaults to 100. limit: Option, } + +impl<'a> Request<'a> for GetUserProfilePhotos<'a> { + type ReturnValue = UserProfilePhotos; + + fn send(self) -> RequestFuture<'a, ResponseResult> { + Box::pin(async move { + network::request_json( + &self.ctx.client, + &self.ctx.token, + "getUserProfilePhotos", + &self, + ) + .await + }) + } +} + +impl<'a> GetUserProfilePhotos<'a> { + pub fn new(ctx: RequestContext<'a>, user_id: i32) -> Self { + Self { + ctx, + user_id, + offset: None, + limit: None, + } + } + + pub fn user_id(mut self, user_id: T) -> Self + where + T: Into, + { + self.user_id = user_id.into(); + self + } + + pub fn offset(mut self, offset: T) -> Self + where + T: Into, + { + self.offset = Some(offset.into()); + self + } +}