Пример #1
0
        public ListOfUsersDTO GetUsers(string endpoint)
        {
            var            user     = new APIHelper <ListOfUsersDTO>();
            var            url      = user.SetUrl(endpoint);
            var            request  = user.CreateGetRequest();
            var            response = user.GetResponse(url, request);
            ListOfUsersDTO content  = user.GetContent <ListOfUsersDTO>(response);

            return(content);
        }
Пример #2
0
        public ListOfUsersDTO GetUsers(String endpoint)
        {
            var            user     = new APIHelper <ListOfUsersDTO>();
            var            url      = user.SetUrl(endpoint);
            var            request  = user.CreateGetRequest();
            var            response = user.GetResponse(url, request);
            ListOfUsersDTO content  = user.GetContent <ListOfUsersDTO>(response);

            return(content);

            // var restClient =new RestClient("https://reqres.in");
            // var restrequest = new RestRequest("/api/users?page=2", Method.GET);
            // restrequest.AddHeader("Accept", "application/json");
            // restrequest.RequestFormat = DataFormat.Json;
            //IRestResponse response = restClient.Execute(restrequest);
            // var content = response.Content;
            // var users = JsonConvert.DeserializeObject<ListOfUsersDTO>(content);
            // return users;
        }