43 lines
1.2 KiB
Nim
43 lines
1.2 KiB
Nim
|
|
import
|
|
preserves, std/tables
|
|
|
|
type
|
|
Attributes* = Table[Symbol, Preserve[void]]
|
|
MIMEData* {.preservesRecord: "mime".} = object
|
|
`type`*: Symbol
|
|
`data`*: seq[byte]
|
|
|
|
NewChatItem* {.preservesDictionary.} = object
|
|
`resp`*: NewChatItem1
|
|
|
|
ContactSubscriptions* {.preservesDictionary.} = object
|
|
`resp`*: ContactSubscriptions1
|
|
|
|
NewChatItem1* {.preservesDictionary.} = object
|
|
`chatInfo`*: Attributes
|
|
`chatItem`*: Attributes
|
|
`type`* {.preservesLiteral: "\"newChatItem\"".}: tuple[]
|
|
|
|
ContactSubscriptions1* {.preservesDictionary.} = object
|
|
`contactSubscriptions`*: ContactSubscriptions2
|
|
`type`* {.preservesLiteral: "\"contactSubSummary\"".}: tuple[]
|
|
|
|
ContactSubscriptions2* = seq[ContactSubscription]
|
|
ContactSubscription* {.preservesDictionary.} = object
|
|
`contact`*: Attributes
|
|
|
|
proc `$`*(x: Attributes | MIMEData | NewChatItem | ContactSubscriptions |
|
|
NewChatItem1 |
|
|
ContactSubscriptions1 |
|
|
ContactSubscriptions2 |
|
|
ContactSubscription): string =
|
|
`$`(toPreserve(x))
|
|
|
|
proc encode*(x: Attributes | MIMEData | NewChatItem | ContactSubscriptions |
|
|
NewChatItem1 |
|
|
ContactSubscriptions1 |
|
|
ContactSubscriptions2 |
|
|
ContactSubscription): seq[byte] =
|
|
encode(toPreserve(x))
|