syndicate_utils/src/schema/notifications.nim

19 lines
382 B
Nim
Raw Normal View History

2022-06-10 04:49:49 +00:00
import
std/typetraits, preserves
type
2023-03-01 23:39:18 +00:00
Notify* {.preservesRecord: "notify".} = object
2022-06-10 04:49:49 +00:00
`summary`*: string
2023-03-01 23:39:18 +00:00
`body`*: Preserve[void]
`timeout`*: BiggestInt
2022-06-10 04:49:49 +00:00
`urgency`*: Urgency
`Urgency`* {.preservesOr, pure.} = enum
`Low`, `Normal`, `Critical`
2023-03-01 23:39:18 +00:00
proc `$`*(x: Notify): string =
`$`(toPreserve(x))
2022-06-10 04:49:49 +00:00
2023-03-01 23:39:18 +00:00
proc encode*(x: Notify): seq[byte] =
encode(toPreserve(x))