예제 #1
0
        public List <IPullRequestInformation> GetPullRequests()
        {
            var api  = _plugin.GetPullRequestApi();
            var data = api.List(Owner, Name);

            if (data == null)
            {
                throw new InvalidOperationException("Could not fetch data!" + _plugin.GetLoggerData());
            }

            return((from el in data select(IPullRequestInformation) new GithubPullRequestInformation(Owner, Name, el, _plugin)).ToList());
        }
예제 #2
0
        private void Load()
        {
            var pullRequestApi = _plugin.GetPullRequestApi();

            _pullRequest = pullRequestApi.GetById(_owner, _repositoryName, _id);

            Entries = new List <IDiscussionEntry>();

            GithubDiscussionEntry da = new GithubDiscussionEntry(_githubPullReqInfo.Owner, _githubPullReqInfo.Created, _githubPullReqInfo.Body);

            Entries.Add(da);

            foreach (var el in _pullRequest.Discussion)
            {
                GithubDiscussionEntry de;
                string author = GetAuthorFrom(el.User) ?? GetAuthorFrom(el.Author) ?? "!UNKNOWN!";

                if (el.Type.ToLowerInvariant() == "commit")
                {
                    de = new GithubCommitDiscussionEntry(author, el.Created, el.Message, el.Id);
                }
                else if (el.Type.ToLowerInvariant() == "issuecomment")
                {
                    de = new GithubDiscussionEntry(author, el.Created, el.Body);
                }
                else
                {
                    de = new GithubDiscussionEntry("ERROR", DateTime.Now, "COULD NOT UNDERSTAND A DISCUSSION ENTRY");
                }
                Entries.Add(de);
            }
        }