using Oqtane.Models;
using System.Threading.Tasks;
using System.Net.Http;
using System.Collections.Generic;
using Oqtane.Documentation;
using Oqtane.Shared;
namespace Oqtane.Services
{
///
/// Service to read the job schedule log
///
public interface IJobLogService
{
///
/// Return a list of entries
///
///
///
Task> GetJobLogsAsync(int jobId);
///
/// Return a entry for the given Id
///
///
///
Task GetJobLogAsync(int jobLogId);
}
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
public class JobLogService : ServiceBase, IJobLogService
{
public JobLogService(HttpClient http, SiteState siteState) : base(http, siteState) { }
private string Apiurl => CreateApiUrl("JobLog");
public async Task> GetJobLogsAsync(int jobId)
{
return await GetJsonAsync>($"{Apiurl}?jobid={jobId}");
}
public async Task GetJobLogAsync(int jobLogId)
{
return await GetJsonAsync($"{Apiurl}/{jobLogId}");
}
}
}