From 3c1289b6ed59001007966f13006748cdf03dc785 Mon Sep 17 00:00:00 2001 From: phdesroUbi <83839027+phdesroUbi@users.noreply.github.com> Date: Mon, 6 Nov 2023 15:25:03 -0500 Subject: [PATCH] Draft status missing in MergeRequest class (#553) * Draft status missing in MergeRequest class - Closes #552 * added obsolete to work in progress for mergeRequest * further changes for draft --- NGitLab.Mock/Clients/MergeRequestClient.cs | 2 +- NGitLab.Mock/MergeRequest.cs | 5 +++++ NGitLab.Mock/PublicAPI.Unshipped.txt | 1 + NGitLab/Models/MergeRequest.cs | 4 ++++ NGitLab/PublicAPI.Unshipped.txt | 1 + 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/NGitLab.Mock/Clients/MergeRequestClient.cs b/NGitLab.Mock/Clients/MergeRequestClient.cs index 33d7abf4..48072735 100644 --- a/NGitLab.Mock/Clients/MergeRequestClient.cs +++ b/NGitLab.Mock/Clients/MergeRequestClient.cs @@ -532,7 +532,7 @@ public void Delete(int mergeRequestIid) if (query.Wip != null) { - mergeRequests = mergeRequests.Where(mr => (bool)query.Wip ? mr.WorkInProgress : !mr.WorkInProgress); + mergeRequests = mergeRequests.Where(mr => (bool)query.Wip ? mr.Draft : !mr.Draft); } } diff --git a/NGitLab.Mock/MergeRequest.cs b/NGitLab.Mock/MergeRequest.cs index d48238bc..602d085e 100644 --- a/NGitLab.Mock/MergeRequest.cs +++ b/NGitLab.Mock/MergeRequest.cs @@ -153,10 +153,14 @@ public Pipeline HeadPipeline public NoteCollection Comments { get; } + [Obsolete("Deprecated by GitLab. Use Draft instead")] public bool WorkInProgress => Title is not null && (Title.StartsWith("WIP:", StringComparison.OrdinalIgnoreCase) || Title.StartsWith("Draft:", StringComparison.OrdinalIgnoreCase)); + public bool Draft => Title is not null && + Title.StartsWith("Draft:", StringComparison.OrdinalIgnoreCase); + public IList Approvers { get; } = new List(); public MergeRequestChangeCollection Changes @@ -286,6 +290,7 @@ internal Models.MergeRequest ToMergeRequestClient() MergedAt = MergedAt?.UtcDateTime, ClosedAt = ClosedAt?.UtcDateTime, Description = Description, + Draft = Draft, Id = Id, Iid = Iid, ProjectId = Project.Id, diff --git a/NGitLab.Mock/PublicAPI.Unshipped.txt b/NGitLab.Mock/PublicAPI.Unshipped.txt index 159a3e56..3fd2fb2b 100644 --- a/NGitLab.Mock/PublicAPI.Unshipped.txt +++ b/NGitLab.Mock/PublicAPI.Unshipped.txt @@ -607,6 +607,7 @@ NGitLab.Mock.MergeRequest.CreatedAt.set -> void NGitLab.Mock.MergeRequest.Description.get -> string NGitLab.Mock.MergeRequest.Description.set -> void NGitLab.Mock.MergeRequest.DivergedCommitsCount.get -> int? +NGitLab.Mock.MergeRequest.Draft.get -> bool NGitLab.Mock.MergeRequest.ForceRemoveSourceBranch.get -> bool NGitLab.Mock.MergeRequest.ForceRemoveSourceBranch.set -> void NGitLab.Mock.MergeRequest.GetDiscussions() -> System.Collections.Generic.IEnumerable diff --git a/NGitLab/Models/MergeRequest.cs b/NGitLab/Models/MergeRequest.cs index 93437283..52c45d10 100644 --- a/NGitLab/Models/MergeRequest.cs +++ b/NGitLab/Models/MergeRequest.cs @@ -38,6 +38,9 @@ public class MergeRequest [JsonPropertyName("downvotes")] public int Downvotes; + [JsonPropertyName("draft")] + public bool Draft; + [JsonPropertyName("upvotes")] public int Upvotes; @@ -59,6 +62,7 @@ public class MergeRequest [JsonPropertyName("target_project_id")] public int TargetProjectId; + [Obsolete("Deprecated by GitLab. Use Draft instead")] [JsonPropertyName("work_in_progress")] public bool? WorkInProgress; diff --git a/NGitLab/PublicAPI.Unshipped.txt b/NGitLab/PublicAPI.Unshipped.txt index 367915e9..5e4b1d61 100644 --- a/NGitLab/PublicAPI.Unshipped.txt +++ b/NGitLab/PublicAPI.Unshipped.txt @@ -2162,6 +2162,7 @@ NGitLab.Models.MergeRequest.DiffRefs -> NGitLab.Models.DiffRefs NGitLab.Models.MergeRequest.DivergedCommitsCount.get -> int? NGitLab.Models.MergeRequest.DivergedCommitsCount.set -> void NGitLab.Models.MergeRequest.Downvotes -> int +NGitLab.Models.MergeRequest.Draft -> bool NGitLab.Models.MergeRequest.ForceRemoveSourceBranch -> bool NGitLab.Models.MergeRequest.HasConflicts.get -> bool NGitLab.Models.MergeRequest.HasConflicts.set -> void