Skip to content

Added 'GetCommitsAsync' for getting a merge request's commits #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
8 changes: 8 additions & 0 deletions src/GitLabApiClient/IMergeRequestsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Threading.Tasks;
using GitLabApiClient.Internal.Paths;
using GitLabApiClient.Models.AwardEmojis.Responses;
using GitLabApiClient.Models.Commits.Responses;
using GitLabApiClient.Models.Discussions.Responses;
using GitLabApiClient.Models.MergeRequests.Requests;
using GitLabApiClient.Models.MergeRequests.Responses;
Expand Down Expand Up @@ -112,5 +113,12 @@ public interface IMergeRequestsClient
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// <param name="mergeRequestIid">The Internal Merge Request Id.</param>
Task<IList<AwardEmoji>> GetAwardEmojisAsync(ProjectId projectId, int mergeRequestIid);

/// <summary>
/// Retrieves a list of all commits for a specified merge request.
/// </summary>
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// <param name="mergeRequestIid">The Internal Merge Request Id.</param>
Task<IList<Commit>> GetCommitsAsync(ProjectId projectId, int mergeRequestId);
}
}
9 changes: 9 additions & 0 deletions src/GitLabApiClient/MergeRequestsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using GitLabApiClient.Internal.Paths;
using GitLabApiClient.Internal.Queries;
using GitLabApiClient.Models.AwardEmojis.Responses;
using GitLabApiClient.Models.Commits.Responses;
using GitLabApiClient.Models.Discussions.Responses;
using GitLabApiClient.Models.MergeRequests.Requests;
using GitLabApiClient.Models.MergeRequests.Responses;
Expand Down Expand Up @@ -175,5 +176,13 @@ public async Task<IList<Discussion>> GetDiscussionsAsync(ProjectId projectId, in
public async Task<IList<AwardEmoji>> GetAwardEmojisAsync(ProjectId projectId, int mergeRequestIid) =>
await _httpFacade.GetPagedList<AwardEmoji>($"projects/{projectId}/merge_requests/{mergeRequestIid}/award_emoji");

/// <summary>
/// Retrieves a list of all commits for a specified merge request.
/// </summary>
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// <param name="mergeRequestIid">The Internal Merge Request Id.</param>
public async Task<IList<Commit>> GetCommitsAsync(ProjectId projectId, int mergeRequestId) =>
await _httpFacade.GetPagedList<Commit>($"projects/{projectId}/merge_requests/{mergeRequestId}/commits");

}
}