Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ protected override void BuildCore(Query query, MergeRequestsQueryOptions options

if (options.AssigneeId.HasValue)
query.Add("assignee_id", options.AssigneeId.Value);

if (!string.IsNullOrEmpty(options.TargetBranch))
query.Add("target_branch", options.TargetBranch);
}

private static string GetStateQueryValue(QueryMergeRequestState state)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,10 @@ internal MergeRequestsQueryOptions() { }
/// Returns merge requests assigned to the given user id.
/// </summary>
public int? AssigneeId { get; set; }

/// <summary>
/// Returns merge requests targetting the given branch.
/// </summary>
public string TargetBranch { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public void NonDefaultQueryBuilt()
CreatedBefore = new DateTime(1991, 12, 12, 2, 2, 2),
Scope = Scope.All,
AuthorId = 1,
AssigneeId = 2
AssigneeId = 2,
TargetBranch = "targetBranch1"
});

query.Should().Be("https://gitlab.com/api/v4/merge_requests?" +
Expand All @@ -42,7 +43,8 @@ public void NonDefaultQueryBuilt()
"created_before=1991-12-12T02%3A02%3A02.0000000&" +
"scope=all&" +
"author_id=1&" +
"assignee_id=2");
"assignee_id=2&" +
"target_branch=targetBranch1");
}
}
}