feat: integrate Forgejo API for release synchronization and asset download

This commit is contained in:
mahdium committed 2026-11-03 20:11:43 +03:30
1 parent 7fa501266e
commit 7b43e47a64
7 files changed
+225 -32

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
namespace ForgejoReleaseSync.Services;
public class ReleaseAssetDownloadService(HttpClient httpClient)
{
public async Task<string> DownloadReleaseAssetAsync(Uri url)
{
var fileName = Path.GetFileName(url.AbsoluteUri);
var filePath = Path.Combine(Path.GetTempPath(), fileName);
await using Stream resource = await httpClient.GetStreamAsync(url);
await using FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate);
await resource.CopyToAsync(fs, 8192);
return filePath;
}
}