Exemplo n.º 1
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 (Extension.IsNotBlank())
            {
                parameters.Add(String.Format(CultureInfo.InvariantCulture, "extension:{0}", Extension));
            }

            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)));
            }

            return(new ReadOnlyCollection <string>(parameters));
        }
Exemplo n.º 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 (Type != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "type:{0}",
                                             Type.ToParameter()));
            }

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

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

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

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

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

            if (State.HasValue)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "state:{0}", State.Value.ToParameter()));
            }

            if (Labels != null)
            {
                parameters.AddRange(Labels.Select(label => string.Format(CultureInfo.InvariantCulture, "label:{0}", label)));
            }

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

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

            if (Updated != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "updated:{0}", Updated));
            }
            if (Merged != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "merged:{0}", Merged));
            }
            if (Comments != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "comments:{0}", Comments));
            }

            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)));
            }

            return(new ReadOnlyCollection <string>(parameters));
        }
Exemplo n.º 3
0
        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));
        }