You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/src/Ombi/Controllers/UpdateController.cs

31 lines
850 B

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Ombi.Core.Processor;
using Ombi.Helpers;
namespace Ombi.Controllers
{
[ApiV1]
[Produces("application/json")]
[AllowAnonymous]
public class UpdateController : Controller
{
public UpdateController(ICacheService cache, IChangeLogProcessor processor)
{
_cache = cache;
_processor = processor;
}
private readonly ICacheService _cache;
private readonly IChangeLogProcessor _processor;
[HttpGet("{branch}")]
public async Task<UpdateModel> UpdateAvailable(string branch)
{
return await _cache.GetOrAdd(branch, async () => await _processor.Process(branch));
}
}
}