From eec9c7532f060c715744c4308d7b54db6e25305c Mon Sep 17 00:00:00 2001 From: HamedSY Date: Thu, 25 Jul 2024 15:44:41 +0330 Subject: [PATCH] chore: add cancellation token --- .../File/GetFile/Commands/GetFileCommandHandlerTests.cs | 3 ++- .../File/Common/ApiCall/Abstractions/IFileRestClient.cs | 6 ++++-- .../Gitea/File/GetFile/Commands/GetFileCommand.cs | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Mohaymen.GiteaClient.Tests/Gitea/File/GetFile/Commands/GetFileCommandHandlerTests.cs b/Mohaymen.GiteaClient.Tests/Gitea/File/GetFile/Commands/GetFileCommandHandlerTests.cs index e2289d7..60709b8 100644 --- a/Mohaymen.GiteaClient.Tests/Gitea/File/GetFile/Commands/GetFileCommandHandlerTests.cs +++ b/Mohaymen.GiteaClient.Tests/Gitea/File/GetFile/Commands/GetFileCommandHandlerTests.cs @@ -76,6 +76,7 @@ await _fileRestClient.Received(1).GetFileAsync(owner, repositoryName, filePath, Arg.Is(x => - x.ReferenceName == referenceName)); + x.ReferenceName == referenceName), + default); } } \ No newline at end of file diff --git a/Mohaymen.GiteaClient/Gitea/File/Common/ApiCall/Abstractions/IFileRestClient.cs b/Mohaymen.GiteaClient/Gitea/File/Common/ApiCall/Abstractions/IFileRestClient.cs index 6523df4..b6585b9 100644 --- a/Mohaymen.GiteaClient/Gitea/File/Common/ApiCall/Abstractions/IFileRestClient.cs +++ b/Mohaymen.GiteaClient/Gitea/File/Common/ApiCall/Abstractions/IFileRestClient.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +using System.Threading; +using System.Threading.Tasks; using Mohaymen.GiteaClient.Core.ApiCall.Abstractions; using Mohaymen.GiteaClient.Gitea.File.GetRepositoryFile.Context; using Mohaymen.GiteaClient.Gitea.File.GetRepositoryFile.Dtos; @@ -13,5 +14,6 @@ Task> GetFileAsync( [AliasAs("owner")] string owner, [AliasAs("repo")] string repositoryName, [AliasAs("filepath")] string filePath, - [Body] GetFileRequest getFileRequest); + [Body] GetFileRequest getFileRequest, + CancellationToken cancellationToken); } \ No newline at end of file diff --git a/Mohaymen.GiteaClient/Gitea/File/GetFile/Commands/GetFileCommand.cs b/Mohaymen.GiteaClient/Gitea/File/GetFile/Commands/GetFileCommand.cs index be198eb..52bfd57 100644 --- a/Mohaymen.GiteaClient/Gitea/File/GetFile/Commands/GetFileCommand.cs +++ b/Mohaymen.GiteaClient/Gitea/File/GetFile/Commands/GetFileCommand.cs @@ -39,7 +39,7 @@ public async Task> Handle(GetFileCommand command _validator.ValidateAndThrow(command); var createBranchRequest = command.ToGetRepositoryFileRequest(); var owner = _options.Value.RepositoriesOwner; - return await _fileRestClient.GetFileAsync(owner, command.RepositoryName, command.FilePath, createBranchRequest) + return await _fileRestClient.GetFileAsync(owner, command.RepositoryName, command.FilePath, createBranchRequest, cancellationToken) .ConfigureAwait(false); } }