Ejemplo n.º 1
0
        /// <summary>Generates a payload for general information about a specific repository.</summary>
        /// <param name="repo">Describes the repository to include in the query.</param>
        /// <returns>An appropriate query payload for the GitHubQl service.</returns>
        public static string GetRepository(RepoParams repo)
        {
            var sb = new StringBuilder();

            sb.Append("{ ");
            sb.Append($"repository(owner:\"{repo.Owner}\" name:\"{repo.Name}\")" + " { ");

            sb.Append(RepositoryData);

            sb.Append(" } }");

            return(sb.ToString());
        }
Ejemplo n.º 2
0
        /// <summary>Generates a payload for a front-to-back issues query for a specific repository.</summary>
        /// <param name="repo">Describes the repository to include in the query.</param>
        /// <param name="cursor">The start cursor to use to get the previous page.</param>
        /// <param name="states">Optional, indicates which states to include, such as <see cref="IssueState.OPEN"/>.</param>
        /// <param name="labels">Optional, indicates which labels, by name, to include.</param>
        /// <returns>An appropriate query payload for the GitHubQl service.</returns>
        public static string GetAllIssues(RepoParams repo, string cursor, IssueState[] states = null, string[] labels = null)
        {
            var issueArgs = CreateIssueArguments(cursor, states, labels);

            var sb = new StringBuilder();

            sb.Append("{ ");
            sb.Append($"repository(owner:\"{repo.Owner}\" name:\"{repo.Name}\")" + " { ");
            sb.Append($"issues({issueArgs})" + " { ");

            sb.Append("nodes { " + IssueData + " } ");
            sb.Append("pageInfo { hasPreviousPage, startCursor } ");

            sb.Append("} } }");

            return(sb.ToString());
        }
Ejemplo n.º 3
0
        /// <summary>Generates a payload for a front-to-back issues query for a specific repository.</summary>
        /// <param name="repo">Describes the repository to include in the query.</param>
        /// <param name="sinceDate">Cut-off date. The response will ignore issues created before this date.</param>
        /// <param name="cursor">The start cursor to use to get the previous page.</param>
        /// <returns>An appropriate query payload for the GitHubQl service.</returns>
        public static string GetIssuesSince(RepoParams repo, DateTimeOffset sinceDate, string cursor)
        {
            var since = sinceDate.ToString("yyyy-MM-ddT08:00:00");

            var sb = new StringBuilder();

            sb.Append("{ ");
            sb.Append($"repository(owner:\"{repo.Owner}\" name:\"{repo.Name}\")" + " { ");
            sb.Append($"issues(last:{QueryPageSize} {cursor} filterBy: {{ since: \"{since}\" }})" + " { ");

            sb.Append("nodes { " + IssueData + " } ");
            sb.Append("pageInfo { hasPreviousPage, startCursor } ");

            sb.Append("} } }");

            return(sb.ToString());
        }