using Oqtane.Models;
using System.Threading.Tasks;
using System.Net.Http;
using Oqtane.Documentation;
using Oqtane.Shared;
namespace Oqtane.Services
{
///
/// Service to manage tasks ()
///
public interface IJobTaskService
{
///
/// Return a specific task
///
///
///
Task GetJobTaskAsync(int jobTaskId);
///
/// Adds a new task
///
///
///
Task AddJobTaskAsync(JobTask jobTask);
}
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
public class JobTaskService : ServiceBase, IJobTaskService
{
public JobTaskService(HttpClient http, SiteState siteState) : base(http, siteState) { }
private string Apiurl => CreateApiUrl("JobTask");
public async Task GetJobTaskAsync(int jobTaskId)
{
return await GetJsonAsync($"{Apiurl}/{jobTaskId}");
}
public async Task AddJobTaskAsync(JobTask jobTask)
{
return await PostJsonAsync(Apiurl, jobTask);
}
}
}