Skip to content

Commit

Permalink
Remove projectId parameter from MergeRequestClient TimeStatsAsync met…
Browse files Browse the repository at this point in the history
…hod and use _projectPath
  • Loading branch information
DelphinRP committed Oct 24, 2023
1 parent 1b0ad70 commit 1e392fd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion NGitLab.Mock/Clients/MergeRequestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ public GitLabCollectionResponse<MergeRequestVersion> GetVersionsAsync(int mergeR
throw new NotImplementedException();
}

public Task<TimeStats> TimeStatsAsync(int projectId, int mergeRequestIid, CancellationToken cancellationToken = default)
public Task<TimeStats> TimeStatsAsync(int mergeRequestIid, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
Expand Down
3 changes: 1 addition & 2 deletions NGitLab/IMergeRequestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ public interface IMergeRequestClient
/// <summary>
/// Get time tracking statistics
/// </summary>
/// <param name="projectId">The project id.</param>
/// <param name="mergeRequestIid">The id of the merge request in the project's scope.</param>
/// <returns>The time tracking statistics of the merge request.</returns>
Task<TimeStats> TimeStatsAsync(int projectId, int mergeRequestIid, CancellationToken cancellationToken = default);
Task<TimeStats> TimeStatsAsync(int mergeRequestIid, CancellationToken cancellationToken = default);
}
}
6 changes: 2 additions & 4 deletions NGitLab/Impl/MergeRequestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ namespace NGitLab.Impl
{
public class MergeRequestClient : IMergeRequestClient
{
private const string TimeStatsUrl = "/projects/{0}/merge_requests/{1}/time_stats";

private readonly API _api;
private readonly string _projectPath;

Expand Down Expand Up @@ -154,9 +152,9 @@ public GitLabCollectionResponse<MergeRequestVersion> GetVersionsAsync(int mergeR
return _api.Get().GetAllAsync<MergeRequestVersion>(_projectPath + "/merge_requests/" + mergeRequestIid.ToString(CultureInfo.InvariantCulture) + "/versions");
}

public Task<TimeStats> TimeStatsAsync(int projectId, int mergeRequestIid, CancellationToken cancellationToken = default)
public Task<TimeStats> TimeStatsAsync(int mergeRequestIid, CancellationToken cancellationToken = default)
{
return _api.Get().ToAsync<TimeStats>(string.Format(CultureInfo.InvariantCulture, TimeStatsUrl, projectId, mergeRequestIid), cancellationToken);
return _api.Get().ToAsync<TimeStats>(_projectPath + "/merge_requests/" + mergeRequestIid.ToString(CultureInfo.InvariantCulture) + "/time_stats", cancellationToken);
}

public IMergeRequestCommentClient Comments(int mergeRequestIid) => new MergeRequestCommentClient(_api, _projectPath, mergeRequestIid);
Expand Down
4 changes: 2 additions & 2 deletions NGitLab/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ NGitLab.IMergeRequestClient.Rebase(int mergeRequestIid) -> NGitLab.Models.Rebase
NGitLab.IMergeRequestClient.RebaseAsync(int mergeRequestIid, NGitLab.Models.MergeRequestRebase options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<NGitLab.Models.RebaseResult>
NGitLab.IMergeRequestClient.Reopen(int mergeRequestIid) -> NGitLab.Models.MergeRequest
NGitLab.IMergeRequestClient.this[int iid].get -> NGitLab.Models.MergeRequest
NGitLab.IMergeRequestClient.TimeStatsAsync(int projectId, int mergeRequestIid, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<NGitLab.Models.TimeStats>
NGitLab.IMergeRequestClient.TimeStatsAsync(int mergeRequestIid, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<NGitLab.Models.TimeStats>
NGitLab.IMergeRequestClient.Update(int mergeRequestIid, NGitLab.Models.MergeRequestUpdate mergeRequest) -> NGitLab.Models.MergeRequest
NGitLab.IMergeRequestCommentClient
NGitLab.IMergeRequestCommentClient.Add(NGitLab.Models.MergeRequestComment comment) -> NGitLab.Models.MergeRequestComment
Expand Down Expand Up @@ -616,7 +616,7 @@ NGitLab.Impl.MergeRequestClient.Rebase(int mergeRequestIid) -> NGitLab.Models.Re
NGitLab.Impl.MergeRequestClient.RebaseAsync(int mergeRequestIid, NGitLab.Models.MergeRequestRebase options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<NGitLab.Models.RebaseResult>
NGitLab.Impl.MergeRequestClient.Reopen(int mergeRequestIid) -> NGitLab.Models.MergeRequest
NGitLab.Impl.MergeRequestClient.this[int iid].get -> NGitLab.Models.MergeRequest
NGitLab.Impl.MergeRequestClient.TimeStatsAsync(int projectId, int mergeRequestIid, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<NGitLab.Models.TimeStats>
NGitLab.Impl.MergeRequestClient.TimeStatsAsync(int mergeRequestIid, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<NGitLab.Models.TimeStats>
NGitLab.Impl.MergeRequestClient.Update(int mergeRequestIid, NGitLab.Models.MergeRequestUpdate mergeRequest) -> NGitLab.Models.MergeRequest
NGitLab.Impl.MergeRequestCommentClient
NGitLab.Impl.MergeRequestCommentClient.Add(NGitLab.Models.MergeRequestComment comment) -> NGitLab.Models.MergeRequestComment
Expand Down

0 comments on commit 1e392fd

Please sign in to comment.