mirror of
https://github.com/C9Glax/tranga.git
synced 2025-09-10 11:58:19 +02:00
NotificationConnector DTO and RequestRecords
This commit is contained in:
37
API/Controllers/Requests/CreateGotifyConnectorRecord.cs
Normal file
37
API/Controllers/Requests/CreateGotifyConnectorRecord.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace API.Controllers.Requests;
|
||||
|
||||
public record CreateGotifyConnectorRecord(string Name, string Url, string AppToken, int Priority)
|
||||
{
|
||||
/// <summary>
|
||||
/// The Name of the Notification Connector
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("The Name of the Notification Connector")]
|
||||
public string Name { get; init; } = Name;
|
||||
|
||||
/// <summary>
|
||||
/// The Url of the Instance
|
||||
/// </summary>
|
||||
/// <remarks>Formatting placeholders: "%title" and "%text" will be replaced when notifications are sent</remarks>
|
||||
[Required]
|
||||
[Url]
|
||||
[Description("The Url of the Instance")]
|
||||
public string Url { get; internal set; } = Url;
|
||||
|
||||
/// <summary>
|
||||
/// The Apptoken used for authentication
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("The Apptoken used for authentication")]
|
||||
public string AppToken { get; init; } = AppToken;
|
||||
|
||||
/// <summary>
|
||||
/// The Priority of Notifications
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("The Priority of Notifications")]
|
||||
public int Priority { get; init; } = Priority;
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace API.Controllers.Requests;
|
||||
|
||||
public record CreateNotificationConnectorRecord(string Name, string Url, string HttpMethod, string Body, Dictionary<string, string> Headers)
|
||||
{
|
||||
/// <summary>
|
||||
/// The Name of the Notification Connector
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("The Name of the Notification Connector")]
|
||||
public string Name { get; init; } = Name;
|
||||
|
||||
/// <summary>
|
||||
/// The Url of the Instance
|
||||
/// </summary>
|
||||
/// <remarks>Formatting placeholders: "%title" and "%text" will be replaced when notifications are sent</remarks>
|
||||
[Required]
|
||||
[Url]
|
||||
[Description("The Url of the Instance")]
|
||||
public string Url { get; internal set; } = Url;
|
||||
|
||||
/// <summary>
|
||||
/// The HTTP Request Method to use for notifications
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("The HTTP Request Method to use for notifications")]
|
||||
public string HttpMethod { get; internal set; } = HttpMethod;
|
||||
|
||||
/// <summary>
|
||||
/// The Request Body to use to send notifications
|
||||
/// </summary>
|
||||
/// <remarks>Formatting placeholders: "%title" and "%text" will be replaced when notifications are sent</remarks>
|
||||
[Required]
|
||||
[Description("The Request Body to use to send notifications")]
|
||||
public string Body { get; internal set; } = Body;
|
||||
|
||||
/// <summary>
|
||||
/// The Request Headers to use to send notifications
|
||||
/// </summary>
|
||||
/// <remarks>Formatting placeholders: "%title" and "%text" will be replaced when notifications are sent</remarks>
|
||||
[Required]
|
||||
[Description("The Request Headers to use to send notifications")]
|
||||
public Dictionary<string, string> Headers { get; internal set; } = Headers;
|
||||
}
|
51
API/Controllers/Requests/CreateNtfyConnectorRecord.cs
Normal file
51
API/Controllers/Requests/CreateNtfyConnectorRecord.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace API.Controllers.Requests;
|
||||
|
||||
public record CreateNtfyConnectorRecord(string Name, string Url, string Username, string Password, string Topic, int Priority)
|
||||
{
|
||||
/// <summary>
|
||||
/// The Name of the Notification Connector
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("The Name of the Notification Connector")]
|
||||
public string Name { get; init; } = Name;
|
||||
|
||||
/// <summary>
|
||||
/// The Url of the Instance
|
||||
/// </summary>
|
||||
/// <remarks>Formatting placeholders: "%title" and "%text" will be replaced when notifications are sent</remarks>
|
||||
[Required]
|
||||
[Url]
|
||||
[Description("The Url of the Instance")]
|
||||
public string Url { get; internal set; } = Url;
|
||||
|
||||
/// <summary>
|
||||
/// The Priority of Notifications
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("The Priority of Notifications")]
|
||||
public int Priority { get; init; } = Priority;
|
||||
|
||||
/// <summary>
|
||||
/// The Username used for authentication
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("The Username used for authentication")]
|
||||
public string Username { get; init; } = Username;
|
||||
|
||||
/// <summary>
|
||||
/// The Password used for authentication
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("The Password used for authentication")]
|
||||
public string Password { get; init; } = Password;
|
||||
|
||||
/// <summary>
|
||||
/// The Topic of Notifications
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("The Topic of Notifications")]
|
||||
public string Topic { get; init; } = Topic;
|
||||
}
|
28
API/Controllers/Requests/CreatePushoverConnectorRecord.cs
Normal file
28
API/Controllers/Requests/CreatePushoverConnectorRecord.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace API.Controllers.Requests;
|
||||
|
||||
public record CreatePushoverConnectorRecord(string Name, string AppToken, string Username)
|
||||
{
|
||||
/// <summary>
|
||||
/// The Name of the Notification Connector
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("The Name of the Notification Connector")]
|
||||
public string Name { get; init; } = Name;
|
||||
|
||||
/// <summary>
|
||||
/// The Apptoken used for authentication
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("The Apptoken used for authentication")]
|
||||
public string AppToken { get; init; } = AppToken;
|
||||
|
||||
/// <summary>
|
||||
/// The Username used for authentication
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("The Username used for authentication")]
|
||||
public string Username { get; init; } = Username;
|
||||
}
|
Reference in New Issue
Block a user