コード例 #1
0
        public async Task <string> GetUsersByNameAsync(string name, int page)
        {
            var nameParts       = string.Join("+", name.Split(" "));
            var link            = "https://github.com/search?q=" + nameParts + "&type=users";
            var html            = _searchPageResultParser.GetHtml(link + "&p=" + page).Split(" ").ToList();
            var totalPagination = _searchPageResultParser.GetTotalPages(html);
            var usernames       = _searchPageResultParser.GetUsernames(html);
            var users           = await _gitHubRequestHandler.GetUserDataAsync(usernames);

            var searchResult = new SearchResultModel()
            {
                Users             = users,
                TotalPageNumbers  = totalPagination,
                CurrentPageNumber = page
            };

            return(JsonConvert.SerializeObject(searchResult));
        }
コード例 #2
0
 public async Task <List <UserModel> > GetUsersAsync(List <string> usernames)
 {
     return(await _gitHubRequestHandler.GetUserDataAsync(usernames));
 }