mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
@ -5523,6 +5523,11 @@ components:
|
||||
appKey:
|
||||
type: string
|
||||
format: password
|
||||
priority:
|
||||
type: integer
|
||||
format: int32
|
||||
description: |
|
||||
A priority number [0-10]
|
||||
NotificationHttp:
|
||||
description: |
|
||||
A notification channel for receiving a generic http request.
|
||||
|
@ -74,7 +74,8 @@ object NotificationChannel {
|
||||
.flatMap(_.toRight("No recipients given!"))
|
||||
.leftMap(new IllegalArgumentException(_))
|
||||
.map(rec => Channel.Mail(mail.id, mail.connection, rec)),
|
||||
gotify => Right(Channel.Gotify(gotify.id, gotify.url, gotify.appKey)),
|
||||
gotify =>
|
||||
Right(Channel.Gotify(gotify.id, gotify.url, gotify.appKey, gotify.priority)),
|
||||
matrix =>
|
||||
Right(
|
||||
Channel
|
||||
@ -94,7 +95,8 @@ object NotificationChannel {
|
||||
m.recipients.toList.map(_.displayString)
|
||||
)
|
||||
},
|
||||
g => gotify(NotificationGotify(g.id, ChannelType.Gotify, g.url, g.appKey)),
|
||||
g =>
|
||||
gotify(NotificationGotify(g.id, ChannelType.Gotify, g.url, g.appKey, g.priority)),
|
||||
m =>
|
||||
matrix(
|
||||
NotificationMatrix(
|
||||
|
@ -53,7 +53,34 @@ class NotificationCodecTest extends FunSuite {
|
||||
id(""),
|
||||
ChannelType.Gotify,
|
||||
LenientUri.unsafe("http://test.gotify.com"),
|
||||
Password("abcde")
|
||||
Password("abcde"),
|
||||
None
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
test("decode with gotify data with prio") {
|
||||
val json = """{"id":"",
|
||||
"enabled": true,
|
||||
"channel": {"id":"", "channelType":"gotify", "url":"http://test.gotify.com", "appKey": "abcde", "priority":9},
|
||||
"allEvents": false,
|
||||
"eventFilter": null,
|
||||
"events": ["TagsChanged", "SetFieldValue"]
|
||||
}"""
|
||||
val hook = parse[NotificationHook](json)
|
||||
assertEquals(hook.enabled, true)
|
||||
assertEquals(
|
||||
hook.channel,
|
||||
Right(
|
||||
NotificationChannel.Gotify(
|
||||
NotificationGotify(
|
||||
id(""),
|
||||
ChannelType.Gotify,
|
||||
LenientUri.unsafe("http://test.gotify.com"),
|
||||
Password("abcde"),
|
||||
Some(9)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user