Beispiel #1
0
    /// <summary>
    ///     Get all boards
    ///     See <a href="https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-getAllBoards">get all boards</a>
    /// </summary>
    /// <param name="jiraClient">IAgileDomain to bind the extension method to</param>
    /// <param name="type">Filters results to boards of the specified type. Valid values: scrum, kanban.</param>
    /// <param name="name">Filters results to boards that match or partially match the specified name.</param>
    /// <param name="projectKeyOrId">
    ///     Filters results to boards that are relevant to a project. Relevance means that the jql
    ///     filter defined in board contains a reference to a project.
    /// </param>
    /// <param name="page">optional Page</param>
    /// <param name="cancellationToken">CancellationToken</param>
    /// <returns>Results with Board objects</returns>
    public static async Task <SearchResult <Board, Tuple <string, string, string> > > GetBoardsAsync(this IAgileDomain jiraClient, string type = null, string name = null,
                                                                                                     string projectKeyOrId = null,
                                                                                                     Page page             = null, CancellationToken cancellationToken = default)
    {
        jiraClient.Behaviour.MakeCurrent();
        var boardsUri = jiraClient.JiraAgileRestUri.AppendSegments("board");

        if (page != null)
        {
            boardsUri = boardsUri.ExtendQuery(new Dictionary <string, object>
            {
                {
                    "startAt", page.StartAt
                },
                {
                    "maxResults", page.MaxResults
                }
            });
        }

        if (type != null)
        {
            boardsUri = boardsUri.ExtendQuery("type", type);
        }

        if (name != null)
        {
            boardsUri = boardsUri.ExtendQuery("name", name);
        }

        if (projectKeyOrId != null)
        {
            boardsUri = boardsUri.ExtendQuery("projectKeyOrId", projectKeyOrId);
        }

        var response = await boardsUri.GetAsAsync <HttpResponse <SearchResult <Board, Tuple <string, string, string> >, Error> >(cancellationToken).ConfigureAwait(false);

        // Store the original search parameter(s), so we can get the next page
        var result = response.HandleErrors();

        // Store the original search parameter(s), so we can get the next page
        result.SearchParameter = new Tuple <string, string, string>(type, name, projectKeyOrId);
        return(result);
    }
Beispiel #2
0
    /// <summary>
    ///     Get all issues without an Epic
    ///     See <a href="https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board/{boardId}/epic-getIssuesWithoutEpic">get issues without epic</a>
    /// </summary>
    /// <param name="jiraClient">IAgileDomain to bind the extension method to</param>
    /// <param name="boardId">Id of the board to get the issues for</param>
    /// <param name="page">optional Page</param>
    /// <param name="cancellationToken">CancellationToken</param>
    /// <returns>SearchResult with AgileIssue objects</returns>
    public static async Task <SearchIssuesResult <AgileIssue, long> > GetIssuesWithoutEpicAsync(this IAgileDomain jiraClient, long boardId, Page page = null,
                                                                                                CancellationToken cancellationToken = default)
    {
        jiraClient.Behaviour.MakeCurrent();
        var epicLessIssuesUri = jiraClient.JiraAgileRestUri.AppendSegments("board", boardId, "epic", "none", "issue");

        if (page != null)
        {
            epicLessIssuesUri = epicLessIssuesUri.ExtendQuery(new Dictionary <string, object>
            {
                {
                    "startAt", page.StartAt
                },
                {
                    "maxResults", page.MaxResults
                }
            });
        }

        var response = await epicLessIssuesUri.GetAsAsync <HttpResponse <SearchIssuesResult <AgileIssue, long>, Error> >(cancellationToken).ConfigureAwait(false);

        var result = response.HandleErrors();

        // Store the original search parameter(s), so we can get the next page
        result.SearchParameter = boardId;
        return(result);
    }
Beispiel #3
0
        /// <summary>
        ///     Get all sprints
        ///     See: https://docs.atlassian.com/jira/REST/latest/#d2e1139
        /// </summary>
        /// <param name="jiraClient">IAgileDomain to bind the extension method to</param>
        /// <param name="boardId">Id of the board to get the sprints for</param>
        /// <param name="stateFilter">
        ///     Filters results to sprints in specified states. Valid values: future, active, closed. You can
        ///     define multiple states separated by commas, e.g. state=active,closed
        /// </param>
        /// <param name="page">optional Page</param>
        /// <param name="cancellationToken">CancellationToken</param>
        /// <returns>Results with Sprint objects</returns>
        public static async Task <SearchResult <Sprint, Tuple <long, string> > > GetSprintsAsync(this IAgileDomain jiraClient, long boardId, string stateFilter = null, Page page = null,
                                                                                                 CancellationToken cancellationToken = default)
        {
            jiraClient.Behaviour.MakeCurrent();
            var sprintsUri = jiraClient.JiraAgileRestUri.AppendSegments("board", boardId, "sprint");

            if (page != null)
            {
                sprintsUri = sprintsUri.ExtendQuery(new Dictionary <string, object>
                {
                    {
                        "startAt", page.StartAt
                    },
                    {
                        "maxResults", page.MaxResults
                    }
                });
            }
            if (stateFilter != null)
            {
                sprintsUri = sprintsUri.ExtendQuery("state", stateFilter);
            }
            var response = await sprintsUri.GetAsAsync <HttpResponse <SearchResult <Sprint, Tuple <long, string> >, Error> >(cancellationToken).ConfigureAwait(false);

            var result = response.HandleErrors();

            // Store the original search parameter(s), so we can get the next page
            result.SearchParameter = new Tuple <long, string>(boardId, stateFilter);
            return(result);
        }