* Added method to get all branches from repo
Some checks failed
ci/woodpecker/push/push_to_repo Pipeline failed
Some checks failed
ci/woodpecker/push/push_to_repo Pipeline failed
This commit is contained in:
@@ -41,16 +41,28 @@ public class GiteaService : IGiteaService
|
||||
|
||||
public async Task<Commit?> GetLastCommitAsync(RepositoryApi repositoryApi, GiteaConfiguration configuration)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(repositoryApi);
|
||||
ArgumentNullException.ThrowIfNull(configuration);
|
||||
|
||||
var lastCommit = await GetLastCommitsAsync(repositoryApi, configuration, 1);
|
||||
return lastCommit.FirstOrDefault();
|
||||
}
|
||||
|
||||
public async Task<List<Branch>> GetAllBranchesAsync(RepositoryApi repositoryApi, GiteaConfiguration configuration)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(repositoryApi);
|
||||
ArgumentNullException.ThrowIfNull(configuration);
|
||||
|
||||
var branches = await repositoryApi.RepoListBranchesAsync(configuration.Owner, configuration.Repository);
|
||||
return branches;
|
||||
}
|
||||
|
||||
public async Task<ContentsResponse> GetFileContentAsync(RepositoryApi repositoryApi,
|
||||
GiteaConfiguration configuration,
|
||||
string filename)
|
||||
{
|
||||
if (repositoryApi == null) throw new ArgumentNullException(nameof(repositoryApi));
|
||||
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
|
||||
ArgumentNullException.ThrowIfNull(repositoryApi);
|
||||
ArgumentNullException.ThrowIfNull(configuration);
|
||||
if (string.IsNullOrEmpty(filename)) throw new ArgumentException("Filename cannot be null or empty.", nameof(filename));
|
||||
|
||||
var repoGetContentsAsync =
|
||||
|
||||
@@ -13,6 +13,8 @@ public interface IGiteaService
|
||||
|
||||
Task<Commit?> GetLastCommitAsync(RepositoryApi repositoryApi, GiteaConfiguration configuration);
|
||||
|
||||
Task<List<Branch>> GetAllBranchesAsync(RepositoryApi repositoryApi, GiteaConfiguration configuration);
|
||||
|
||||
Task<(bool Status, string Response)> SendRequestAsync(GiteaConfiguration configuration, string endpoint,
|
||||
HttpContent content);
|
||||
}
|
||||
Reference in New Issue
Block a user