mirror of
https://github.com/C9Glax/tranga.git
synced 2025-06-13 06:47:54 +02:00
Add API
This commit is contained in:
8
API/Schema/NotificationConnectors/Gotify.cs
Normal file
8
API/Schema/NotificationConnectors/Gotify.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace API.Schema.NotificationConnectors;
|
||||
|
||||
public class Gotify(string endpoint, string appToken)
|
||||
: NotificationConnector(TokenGen.CreateToken(typeof(Gotify), 64), NotificationConnectorType.Gotify)
|
||||
{
|
||||
public string Endpoint { get; init; } = endpoint;
|
||||
public string AppToken { get; init; } = appToken;
|
||||
}
|
7
API/Schema/NotificationConnectors/Lunasea.cs
Normal file
7
API/Schema/NotificationConnectors/Lunasea.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace API.Schema.NotificationConnectors;
|
||||
|
||||
public class Lunasea(string id)
|
||||
: NotificationConnector(TokenGen.CreateToken(typeof(Lunasea), 64), NotificationConnectorType.LunaSea)
|
||||
{
|
||||
public string Id { get; init; } = id;
|
||||
}
|
13
API/Schema/NotificationConnectors/NotificationConnector.cs
Normal file
13
API/Schema/NotificationConnectors/NotificationConnector.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace API.Schema.NotificationConnectors;
|
||||
|
||||
[PrimaryKey("NotificationConnectorId")]
|
||||
public abstract class NotificationConnector(string notificationConnectorId, NotificationConnectorType notificationConnectorType) : APISerializable
|
||||
{
|
||||
[MaxLength(64)]
|
||||
public string NotificationConnectorId { get; } = notificationConnectorId;
|
||||
|
||||
public NotificationConnectorType NotificationConnectorType { get; init; } = notificationConnectorType;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace API.Schema.NotificationConnectors;
|
||||
|
||||
|
||||
public enum NotificationConnectorType : byte
|
||||
{
|
||||
Gotify = 0,
|
||||
LunaSea = 1,
|
||||
Ntfy = 2
|
||||
}
|
9
API/Schema/NotificationConnectors/Ntfy.cs
Normal file
9
API/Schema/NotificationConnectors/Ntfy.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace API.Schema.NotificationConnectors;
|
||||
|
||||
public class Ntfy(string endpoint, string auth, string topic)
|
||||
: NotificationConnector(TokenGen.CreateToken(typeof(Ntfy), 64), NotificationConnectorType.Ntfy)
|
||||
{
|
||||
public string Endpoint { get; init; } = endpoint;
|
||||
public string Auth { get; init; } = auth;
|
||||
public string Topic { get; init; } = topic;
|
||||
}
|
Reference in New Issue
Block a user