public override IReadOnlyList <string> MergedQualifiers()
        {
            var parameters = new List <string>();

            if (User.IsNotBlank())
            {
                parameters.Add($"user:{User}");
            }

            if (Author.IsNotBlank())
            {
                parameters.Add($"author:{Author}");
            }

            if (Committer.IsNotBlank())
            {
                parameters.Add($"committer:{Committer}");
            }

            if (AuthorName.IsNotBlank())
            {
                parameters.Add($"author-name:{AuthorName}");
            }

            if (CommitterName.IsNotBlank())
            {
                parameters.Add($"committer-name:{CommitterName}");
            }

            if (AuthorEmail.IsNotBlank())
            {
                parameters.Add($"author-email:{AuthorEmail}");
            }

            if (CommitterEmail.IsNotBlank())
            {
                parameters.Add($"committer-email:{CommitterEmail}");
            }

            if (AuthoredDate.IsNotDefault())
            {
                parameters.Add($"author-date:{QueryDateTime(AuthoredDate)}");
            }
            if (CommittedDate.IsNotDefault())
            {
                parameters.Add($"committer-date:{QueryDateTime(CommittedDate)}");
            }

            if (IsMerge.IsNotNull())
            {
                parameters.Add($"merge:{IsMerge.ToString()}");
            }

            if (CommitHash.IsNotBlank())
            {
                parameters.Add($"hash:{CommitHash}");
            }

            if (Parent.IsNotBlank())
            {
                parameters.Add($"parent:{Parent}");
            }

            if (Tree.IsNotBlank())
            {
                parameters.Add($"tree:{Tree}");
            }

            if (Repos.Any())
            {
                var invalidFormatRepos = Repos.Where(x => !x.IsNameWithOwnerFormat());
                if (invalidFormatRepos.Any())
                {
                    throw new RepositoryFormatException(invalidFormatRepos);
                }

                parameters.Add(
                    string.Join("+", Repos.Select(x => "repo:" + x)));
            }

            if (Organization.IsNotBlank())
            {
                parameters.Add($"org:{Organization}");
            }

            return(new ReadOnlyCollection <string>(parameters));
        }
示例#2
0
        public override IReadOnlyList <string> MergedQualifiers()
        {
            var parameters = new List <string>();

            if (In != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "in:{0}",
                                             string.Join(",", In.Select(i => i.ToParameter()))));
            }

            if (Language != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "language:\"{0}\"", Language.ToParameter()));
            }

            if (Forks != null)
            {
                // API is expecting 'true', bool.ToString() returns 'True', if there is a better way,
                // please, oh please let me know...
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "fork:{0}", Forks.Value.ToString().ToLower()));
            }

            if (Size != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "size:{0}", Size));
            }

            if (Path.IsNotBlank())
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "path:{0}", Path));
            }

            if (Extensions.Any())
            {
                foreach (var extension in Extensions)
                {
                    parameters.Add(string.Format(CultureInfo.InvariantCulture, "extension:{0}", extension));
                }
            }

            if (FileName.IsNotBlank())
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "filename:{0}", FileName));
            }

            if (User.IsNotBlank())
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "user:{0}", User));
            }

            if (Repos.Any())
            {
                var invalidFormatRepos = Repos.Where(x => !x.IsNameWithOwnerFormat());
                if (invalidFormatRepos.Any())
                {
                    throw new RepositoryFormatException(invalidFormatRepos);
                }

                parameters.Add(
                    string.Join("+", Repos.Select(x => "repo:" + x)));
            }

            if (Organization.IsNotBlank())
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "org:{0}", Organization));
            }

            return(new ReadOnlyCollection <string>(parameters));
        }