コード例 #1
0
        /// <summary>
        /// Retrieves issues linked to an epic.
        /// </summary>
        /// <param name="groupId">The ID, path or <see cref="Group"/> of the group.</param>
        /// <param name="epicId">Id of the epic.</param>
        /// <param name="options">Issues retrieval options.</param>
        /// <returns>Epic satisfying options.</returns>
        public async Task <IList <Issue> > GetIssusAsync(GroupId groupId, int epicId, Action <IssuesQueryOptions> options = null)
        {
            var queryOptions = new IssuesQueryOptions();

            options?.Invoke(queryOptions);

            string url = _issuesQueryBuilder.Build($"groups/{groupId}/epics/{epicId}/issues", queryOptions);

            return(await _httpFacade.GetPagedList <Issue>(url));
        }
コード例 #2
0
        /// <summary>
        /// Retrieves issues from all projects.
        /// By default retrieves opened issues from all users.
        /// </summary>
        /// <param name="options">Issues retrieval options.</param>
        /// <returns>Issues satisfying options.</returns>
        public async Task <IList <Issue> > GetAsync(Action <IssuesQueryOptions> options = null)
        {
            var queryOptions = new IssuesQueryOptions();

            options?.Invoke(queryOptions);

            string url = _queryBuilder.Build("issues", queryOptions);

            return(await _httpFacade.GetPagedList <Issue>(url));
        }
コード例 #3
0
        protected override void BuildCore(IssuesQueryOptions options)
        {
            if (!(options is ProjectIssuesQueryOptions projectIssuesQueryOptions))
            {
                base.BuildCore(options);
                return;
            }

            base.BuildCore(options);
        }
コード例 #4
0
        protected override void BuildCore(IssuesQueryOptions options)
        {
            if (!(options is ProjectIssuesQueryOptions projectIssuesQueryOptions))
            {
                base.BuildCore(options);
                return;
            }

            base.BuildCore(options);

            if (projectIssuesQueryOptions.CreatedAfter.HasValue)
            {
                Add("created_after", projectIssuesQueryOptions.CreatedAfter.Value);
            }

            if (projectIssuesQueryOptions.CreatedBefore.HasValue)
            {
                Add("created_before", projectIssuesQueryOptions.CreatedBefore.Value);
            }
        }
コード例 #5
0
        /// <summary>
        /// Retrieves issues.
        /// By default retrieves opened issues from all users. The more specific setting win (if both project and group are set, only project issues will be retrieved).
        /// </summary>
        /// <example>
        /// <code>
        /// /* Get all issues */
        /// var client = new GitLabClient("https://gitlab.com", "PRIVATE-TOKEN");
        /// var allIssues = await client.Issues.GetAllAsync();
        /// </code>
        /// <code>
        /// /* Get project issues */
        /// var client = new GitLabClient("https://gitlab.com", "PRIVATE-TOKEN");
        /// string projectPath = "dev/group/project-1";
        /// var allIssues = await client.Issues.GetAllAsync(projectId: projectPath);
        /// // OR
        /// int projectId = 55;
        /// var allIssues = await client.Issues.GetAllAsync(projectId: projectId);
        /// // OR - Group ID is skipped, project ID is more specific
        /// int projectId = 55;
        /// int groupId = 181;
        /// var allIssues = await client.Issues.GetAllAsync(projectId: projectId, groupId: groupId);
        /// </code>
        /// <code>
        /// /* Get group issues */
        /// var client = new GitLabClient("https://gitlab.com", "PRIVATE-TOKEN");
        /// string groupPath = "dev/group1/subgroup-1";
        /// var allIssues = await client.Issues.GetAllAsync(groupId: groupPath);
        /// // OR
        /// int groupId = 55;
        /// var allIssues = await client.Issues.GetAllAsync(groupId: groupId);
        /// </code>
        /// </example>
        /// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
        /// <param name="groupId">The ID, path or <see cref="Group"/> of the group.</param>
        /// <param name="options">Issues retrieval options.</param>
        /// <returns>Issues satisfying options.</returns>
        public async Task <IList <Issue> > GetAllAsync(ProjectId projectId = null, GroupId groupId = null,
                                                       Action <IssuesQueryOptions> options = null)
        {
            var queryOptions = new IssuesQueryOptions();

            options?.Invoke(queryOptions);

            string path = "issues";

            if (projectId != null)
            {
                path = $"projects/{projectId}/issues";
            }
            else if (groupId != null)
            {
                path = $"groups/{groupId}/issues";
            }

            string url = _queryBuilder.Build(path, queryOptions);

            return(await _httpFacade.GetPagedList <Issue>(url));
        }