コード例 #1
0
        public override void AddIssue(Issue issue, float devEstimate, float testEstimate)
        {
            IssueStates states = ValidateIssueStates(issue);

            if (states != null)
            {
                issues.Add(new IssueEntry(states.ToString(), devEstimate, testEstimate, issue.Number, issue.Title));
            }
        }
コード例 #2
0
        protected IssueStates ValidateIssueStates(Issue issue)
        {
            var issueStates = new IssueStates(issue);

            if (issueStates.IsBlocked)
            {
                AddError(issue, "Blocked");
            }

            if (!issueStates.IsDone && !issueStates.HasState)
            {
                AddError(issue, "Issue doesn't have a state");
                return(null);
            }

            if (!issueStates.IsDone && issueStates.HasManyStates)
            {
                AddError(issue, "Issue has multiple state labels");
                return(null);
            }

            return(issueStates);
        }
コード例 #3
0
ファイル: IssueStates.cs プロジェクト: wyvernzora/IronGitHub
 public static string ToJsonValue(this IssueStates state)
 {
     return(CustomEnumValueSerializer <IssueStates> .ToJsonValue(state));
 }
コード例 #4
0
ファイル: SearchApi.cs プロジェクト: grmartin/IronGitHub
        /// <summary>
        /// Search issues - Find issues by state and keyword.
        /// 
        /// /legacy/issues/search/:owner/:repository/:state/:keyword
        /// </summary>
        /// <param name="owner">The owner of the repository in which to search for issues.</param>
        /// <param name="repository">The repository in which to search for issues.</param>
        /// <param name="state">open or closed </param>
        /// <param name="keyword">Search term</param>
        /// <returns>An Issue.IssueSearchResults with the matching Issues</returns>
        async public Task<Issue.IssueSearchResults> Issues(string owner, string repository, IssueStates state, string keyword)
        {
            if (string.IsNullOrEmpty(owner))
                throw new ArgumentException("must be populated", "owner");

            if (string.IsNullOrEmpty(repository))
                throw new ArgumentException("must be populated", "repository");

            var request = CreateRequest(string.Format("/legacy/issues/search/{0}/{1}/{2}/{3}", owner, repository, state.ToJsonValue(), Uri.EscapeDataString(keyword)));

            var response = await Complete<Issue.IssueSearchResults>(request);

            return response.Result;
        }
コード例 #5
0
ファイル: SearchApi.cs プロジェクト: wyvernzora/IronGitHub
        /// <summary>
        /// Search issues - Find issues by state and keyword.
        ///
        /// /legacy/issues/search/:owner/:repository/:state/:keyword
        /// </summary>
        /// <param name="owner">The owner of the repository in which to search for issues.</param>
        /// <param name="repository">The repository in which to search for issues.</param>
        /// <param name="state">open or closed </param>
        /// <param name="keyword">Search term</param>
        /// <returns>An Issue.IssueSearchResults with the matching Issues</returns>
        async public Task <Issue.IssueSearchResults> Issues(string owner, string repository, IssueStates state, string keyword)
        {
            if (string.IsNullOrEmpty(owner))
            {
                throw new ArgumentException("must be populated", "owner");
            }

            if (string.IsNullOrEmpty(repository))
            {
                throw new ArgumentException("must be populated", "repository");
            }

            var request = CreateRequest(string.Format("/legacy/issues/search/{0}/{1}/{2}/{3}", owner, repository, state.ToJsonValue(), Uri.EscapeDataString(keyword)));

            var response = await Complete <Issue.IssueSearchResults>(request);

            return(response.Result);
        }