From 39116f98d9d1d65f06f4236fa06859ee3c5c7216 Mon Sep 17 00:00:00 2001 From: Alireza Eiji Date: Tue, 13 Aug 2024 12:44:04 +0330 Subject: [PATCH] add parent commit to the create commit (#29) Co-authored-by: Alireza Eiji --- .../Gitea/Commit/Common/Dtos/ParentCommitDto.cs | 9 +++++++++ .../CreateCommit/Dtos/Response/CommitResponseDto.cs | 7 ++++++- .../Dtos/LoadBranchCommitsResponseDto.cs | 7 +------ 3 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 Mohaymen.GiteaClient/Gitea/Commit/Common/Dtos/ParentCommitDto.cs diff --git a/Mohaymen.GiteaClient/Gitea/Commit/Common/Dtos/ParentCommitDto.cs b/Mohaymen.GiteaClient/Gitea/Commit/Common/Dtos/ParentCommitDto.cs new file mode 100644 index 0000000..9a02fa2 --- /dev/null +++ b/Mohaymen.GiteaClient/Gitea/Commit/Common/Dtos/ParentCommitDto.cs @@ -0,0 +1,9 @@ +using Newtonsoft.Json; + +namespace Mohaymen.GiteaClient.Gitea.Commit.Common.Dtos; + +public sealed class ParentCommitDto +{ + [JsonProperty("sha")] + public required string CommitSha { get; init; } +} \ No newline at end of file diff --git a/Mohaymen.GiteaClient/Gitea/Commit/CreateCommit/Dtos/Response/CommitResponseDto.cs b/Mohaymen.GiteaClient/Gitea/Commit/CreateCommit/Dtos/Response/CommitResponseDto.cs index 7e17028..efcca43 100644 --- a/Mohaymen.GiteaClient/Gitea/Commit/CreateCommit/Dtos/Response/CommitResponseDto.cs +++ b/Mohaymen.GiteaClient/Gitea/Commit/CreateCommit/Dtos/Response/CommitResponseDto.cs @@ -1,4 +1,6 @@ -using Newtonsoft.Json; +using System.Collections.Generic; +using Mohaymen.GiteaClient.Gitea.Commit.Common.Dtos; +using Newtonsoft.Json; namespace Mohaymen.GiteaClient.Gitea.Commit.CreateCommit.Dtos.Response; @@ -9,4 +11,7 @@ public class CommitResponseDto [JsonProperty("url")] public required string CommitUrl { get; init; } + + [JsonProperty("parents")] + public required List ParentCommitDtos { get; init; } } \ No newline at end of file diff --git a/Mohaymen.GiteaClient/Gitea/Commit/GetBranchCommits/Dtos/LoadBranchCommitsResponseDto.cs b/Mohaymen.GiteaClient/Gitea/Commit/GetBranchCommits/Dtos/LoadBranchCommitsResponseDto.cs index b3606e3..c6e3fa8 100644 --- a/Mohaymen.GiteaClient/Gitea/Commit/GetBranchCommits/Dtos/LoadBranchCommitsResponseDto.cs +++ b/Mohaymen.GiteaClient/Gitea/Commit/GetBranchCommits/Dtos/LoadBranchCommitsResponseDto.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using Mohaymen.GiteaClient.Gitea.Commit.Common.Dtos; using Newtonsoft.Json; namespace Mohaymen.GiteaClient.Gitea.Commit.GetBranchCommits.Dtos; @@ -22,10 +23,4 @@ public sealed class CommitDto { [JsonProperty("message")] public required string CommitMessage { get; init; } -} - -public sealed class ParentCommitDto -{ - [JsonProperty("sha")] - public required string CommitSha { get; init; } } \ No newline at end of file