public async Task <User> GetUserById(int userId) { _logger.Information("Request GetUserById - " + userId); var response = await _client.Request(RestSharp.Method.GET, "/users/" + userId); var user = JsonSerializer.Deserialize <User>(response, _client.SerializerOptions()); return(user); }
public async Task <List <Comment> > GetCommentsByPostId(int postId) { _logger.Information("Request GetCommentsByPostId - " + postId); var response = await _client.Request(RestSharp.Method.GET, "/comments?postId=" + postId); var comments = JsonSerializer.Deserialize <List <Comment> >(response, _client.SerializerOptions()); return(comments); }
public async Task <List <Post> > GetPostsByUserId(int userId) { _logger.Information("Request GetPostsByUserId - " + userId); var response = await _client.Request(RestSharp.Method.GET, "/posts?userId=" + userId); var posts = JsonSerializer.Deserialize <List <Post> >(response, _client.SerializerOptions()); return(posts); }
public async Task <List <Photo> > GetPhotosByAlbumId(int albumId) { _logger.Information("Request GetPhotosByAlbumId - " + albumId); var response = await _client.Request(RestSharp.Method.GET, "/photos?albumId=" + albumId); var photos = JsonSerializer.Deserialize <List <Photo> >(response, _client.SerializerOptions()); return(photos); }