示例#1
0
        public async Task Get_a_user()
        {
            var homeLink = _linkFactory.CreateLink <HomeLink>(new Uri("https://api.github.com"));

            await _httpClient.FollowLinkAsync(homeLink);

            var userLink = _clientstate.HomeDocument.GetLink <UserLink>();

            userLink.User = "******";

            await _httpClient.FollowLinkAsync(userLink);

            var userDoc         = _clientstate.LastDocument;
            var followersCount2 = _clientstate.CurrentUser.Followers;
            var followersCount  = (int)userDoc.Properties["followers"];

            var followersLink = userDoc.GetLink <FollowersLink>();
            await _httpClient.FollowLinkAsync(followersLink);

            var followers = _clientstate.LastDocument;

            _clientstate.ClearList();
            foreach (var doc in followers.Items)
            {
                var itemLink = doc.GetLink <ItemLink>();
                await _httpClient.FollowLinkAsync(itemLink);
            }
            var results = _clientstate.List.Select(s => UserLink.InterpretResponse(s)).Where(u => u.Hireable && u.Followers > 50).ToList();
        }
示例#2
0
        private async Task HandleUserLinkResponse(Link link, HttpResponseMessage responseMessage)
        {
            _lastDocument = await responseMessage.Content.ReadAsGithubDocumentAsync(_linkFactory);

            _currentUser = UserLink.InterpretResponse(_lastDocument);
        }