NotificationConnector SendNotification public

This commit is contained in:
Glax 2024-12-16 20:33:59 +01:00
parent e6f8853b49
commit e1bfdd675b
4 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@ public class Gotify(string endpoint, string appToken)
public string Endpoint { get; init; } = endpoint; public string Endpoint { get; init; } = endpoint;
public string AppToken { get; init; } = appToken; public string AppToken { get; init; } = appToken;
protected override void SendNotificationInternal(string title, string notificationText) public override void SendNotification(string title, string notificationText)
{ {
MessageData message = new(title, notificationText); MessageData message = new(title, notificationText);
HttpRequestMessage request = new(HttpMethod.Post, $"{endpoint}/message"); HttpRequestMessage request = new(HttpMethod.Post, $"{endpoint}/message");

View File

@ -7,7 +7,7 @@ public class Lunasea(string id)
: NotificationConnector(TokenGen.CreateToken(typeof(Lunasea), 64), NotificationConnectorType.LunaSea) : NotificationConnector(TokenGen.CreateToken(typeof(Lunasea), 64), NotificationConnectorType.LunaSea)
{ {
public string Id { get; init; } = id; public string Id { get; init; } = id;
protected override void SendNotificationInternal(string title, string notificationText) public override void SendNotification(string title, string notificationText)
{ {
MessageData message = new(title, notificationText); MessageData message = new(title, notificationText);
HttpRequestMessage request = new(HttpMethod.Post, $"https://notify.lunasea.app/v1/custom/{id}"); HttpRequestMessage request = new(HttpMethod.Post, $"https://notify.lunasea.app/v1/custom/{id}");

View File

@ -16,5 +16,5 @@ public abstract class NotificationConnector(string notificationConnectorId, Noti
[NotMapped] [NotMapped]
protected readonly HttpClient _client = new(); protected readonly HttpClient _client = new();
protected abstract void SendNotificationInternal(string title, string notificationText); public abstract void SendNotification(string title, string notificationText);
} }

View File

@ -45,7 +45,7 @@ public class Ntfy : NotificationConnector
return ret; return ret;
} }
protected override void SendNotificationInternal(string title, string notificationText) public override void SendNotification(string title, string notificationText)
{ {
MessageData message = new(title, Topic, notificationText); MessageData message = new(title, Topic, notificationText);
HttpRequestMessage request = new(HttpMethod.Post, $"{this.Endpoint}?auth={this.Auth}"); HttpRequestMessage request = new(HttpMethod.Post, $"{this.Endpoint}?auth={this.Auth}");