/// <summary> /// Retrieves merge request from a project. /// By default returns opened merged requests created by anyone. /// </summary> /// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param> /// <param name="options">Merge requests retrieval options.</param> /// <returns>Merge requests satisfying options.</returns> public async Task <IList <MergeRequest> > GetAsync(ProjectId projectId, Action <ProjectMergeRequestsQueryOptions> options = null) { var projectMergeRequestOptions = new ProjectMergeRequestsQueryOptions(); options?.Invoke(projectMergeRequestOptions); string query = _projectMergeRequestsQueryBuilder. Build($"projects/{projectId}/merge_requests", projectMergeRequestOptions); return(await _httpFacade.GetPagedList <MergeRequest>(query)); }
public void NonDefaultQueryBuilt() { var sut = new ProjectMergeRequestsQueryBuilder(); string query = sut.Build( "https://gitlab.com/api/v4/merge_requests", new ProjectMergeRequestsQueryOptions(3) { MergeRequestsIds = new[] { 4, 5 }, State = QueryMergeRequestState.Opened, Order = MergeRequestsOrder.UpdatedAt, SortOrder = SortOrder.Ascending, MilestoneTitle = "milestone1", Simple = true, Labels = { "label1", "label2" }, CreatedAfter = new DateTime(1991, 11, 11, 1, 1, 1), CreatedBefore = new DateTime(1991, 12, 12, 2, 2, 2), Scope = Scope.All, AuthorId = 1, AssigneeId = 2 }); query.Should().Be("https://gitlab.com/api/v4/merge_requests?" + "id=3&" + "iids%5b%5d=4&iids%5b%5d=5&" + "state=opened&" + "order_by=updated_at&" + "sort=asc&" + "milestone=milestone1&" + "view=simple&" + "labels=label1%2clabel2&" + "created_after=1991-11-11T01%3a01%3a01.0000000&" + "created_before=1991-12-12T02%3a02%3a02.0000000&" + "scope=all&" + "author_id=1&" + "assignee_id=2"); }