using Oqtane.Models;
using Oqtane.Shared;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Oqtane.Documentation;
namespace Oqtane.Services
{
///
/// Service to retrieve entries
///
public interface ISiteTemplateService
{
///
/// Returns a list of site templates
///
///
Task> GetSiteTemplatesAsync();
}
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
public class SiteTemplateService : ServiceBase, ISiteTemplateService
{
public SiteTemplateService(HttpClient http, SiteState siteState) : base(http, siteState) { }
private string Apiurl => CreateApiUrl("SiteTemplate");
public async Task> GetSiteTemplatesAsync()
{
List siteTemplates = await GetJsonAsync>(Apiurl);
return siteTemplates.OrderBy(item => item.Name).ToList();
}
}
}