コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }