コード例 #1
0
        private static GithubFollowee GetUserFollowees(string username, GithubApi githubApi, string etag)
        {
            var output = new GithubFollowee();

            output.Username = username;

            var followeesApiResults = githubApi.GetUserFollowees(username, etag);

            if (followeesApiResults.Any() == true)
            {
                output.Etag     = followeesApiResults.First().Etag;
                output.Modified = followeesApiResults.First().Modified;

                var followees = followeesApiResults.SelectMany(r => r.Data);
                output.Followees = followees.Select(u => (string)u.login.Value).Distinct().ToList();
            }

            return(output);
        }
コード例 #2
0
        public void StoreInBlob(CloudBlockBlob githubStatusBlob, List <GithubApiResult <List <dynamic> > > githubEventsApiResults, GithubFollowee meFollowee)
        {
            string newEventsLastModified      = "";
            string previousEventsLastModified = this.Raw.events_last_modified.Value;

            if (githubEventsApiResults != null && githubEventsApiResults.Any() == true)
            {
                newEventsLastModified = githubEventsApiResults.First().LastModifiedDate;
            }

            if (string.IsNullOrWhiteSpace(newEventsLastModified) == true)
            {
                newEventsLastModified = previousEventsLastModified;
            }

            var newStatus = new
            {
                events_last_modified = newEventsLastModified,
                followees_etag       = meFollowee.Etag,
                followees            = this.Followees
            };


            string statusJson = JsonConvert.SerializeObject(newStatus, Formatting.Indented);

            githubStatusBlob.Properties.ContentType = "application/json";
            githubStatusBlob.UploadText(statusJson);
        }