#4303: add search function.
This commit is contained in:
@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Oqtane.Documentation;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Modules.SearchResults.Services
|
||||
{
|
||||
[PrivateApi("Mark SearchResults classes as private, since it's not very useful in the public docs")]
|
||||
public interface ISearchResultsService
|
||||
{
|
||||
Task<Models.SearchResults> SearchAsync(int moduleId, SearchQuery searchQuery);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Oqtane.Documentation;
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Services;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Modules.SearchResults.Services
|
||||
{
|
||||
[PrivateApi("Mark SearchResults classes as private, since it's not very useful in the public docs")]
|
||||
public class SearchResultsService : ServiceBase, ISearchResultsService, IClientService
|
||||
{
|
||||
public SearchResultsService(HttpClient http, SiteState siteState) : base(http, siteState) {}
|
||||
|
||||
private string ApiUrl => CreateApiUrl("SearchResults");
|
||||
|
||||
public async Task<Models.SearchResults> SearchAsync(int moduleId, SearchQuery searchQuery)
|
||||
{
|
||||
return await PostJsonAsync<SearchQuery, Models.SearchResults>(CreateAuthorizationPolicyUrl(ApiUrl, EntityNames.Module, moduleId), searchQuery);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user