Add priority to gotify channel

Closes: #1277
This commit is contained in:
eikek
2022-01-12 20:59:07 +01:00
parent 5f10798e86
commit 7aebc1ccdf
15 changed files with 118 additions and 38 deletions

View File

@ -53,7 +53,12 @@ object Channel {
deriveConfiguredEncoder[Mail]
}
final case class Gotify(id: Ident, url: LenientUri, appKey: Password) extends Channel {
final case class Gotify(
id: Ident,
url: LenientUri,
appKey: Password,
priority: Option[Int]
) extends Channel {
val channelType = ChannelType.Gotify
def fold[A](
f1: Mail => A,

View File

@ -30,7 +30,8 @@ object NotificationChannel {
headers: Map[String, String]
) extends NotificationChannel
final case class Gotify(url: LenientUri, appKey: Password) extends NotificationChannel
final case class Gotify(url: LenientUri, appKey: Password, priority: Option[Int])
extends NotificationChannel
final case class Matrix(
homeServer: LenientUri,

View File

@ -35,6 +35,7 @@ final class GotifyBackend[F[_]: Async](
val req = POST(
Json.obj(
"title" -> Json.fromString(title),
"priority" -> Json.fromInt(channel.priority.getOrElse(0)),
"message" -> Json.fromString(body),
"extras" -> Json.obj(
"client::display" -> Json.obj(