1
0
mirror of https://github.com/chylex/Discord-History-Tracker.git synced 2025-01-06 22:42:49 +01:00
Discord-History-Tracker/app/Server/Endpoints/TrackMessagesEndpoint.cs
2023-07-21 18:47:21 +02:00

24 lines
665 B
C#

using System.Net;
using System.Text.Json;
using System.Threading.Tasks;
using DHT.Server.Database;
using DHT.Server.Service;
using DHT.Utils.Http;
using Microsoft.AspNetCore.Http;
namespace DHT.Server.Endpoints;
sealed class TrackMessagesEndpoint : BaseEndpoint {
public TrackMessagesEndpoint(IDatabaseFile db, ServerAccessToken accessToken) : base(db, accessToken) {}
protected override async Task<IHttpOutput> Respond(HttpContext ctx) {
var root = await ReadJson(ctx);
if (root.ValueKind != JsonValueKind.Array) {
throw new HttpException(HttpStatusCode.BadRequest, "Expected root element to be an array.");
}
return new HttpOutput.Json(0);
}
}