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.
30 lines
655 B
30 lines
655 B
using System.Text.Json.Nodes;
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
namespace Connected.Rest;
|
|
|
|
internal abstract class ApiFormatter
|
|
{
|
|
public HttpContext Context { get; set; }
|
|
public async Task<JsonNode?> ParseArguments()
|
|
{
|
|
return await OnParseArguments();
|
|
}
|
|
|
|
protected abstract Task<JsonNode?> OnParseArguments();
|
|
|
|
public async Task RenderError(int statusCode, string message)
|
|
{
|
|
await OnRenderError(statusCode, message);
|
|
}
|
|
|
|
protected abstract Task OnRenderError(int statusCode, string message);
|
|
|
|
public async Task RenderResult(object content)
|
|
{
|
|
await OnRenderResult(content);
|
|
}
|
|
|
|
protected abstract Task OnRenderResult(object content);
|
|
}
|