Helpers for working with JMAP methods
Procs
proc formatDate(date: DateTime): string {....raises: [], tags: [], forbids: [].}
- Returns date in the format that JMAP expects for Date Source Edit
proc formatUTCDate(date: DateTime): string {....raises: [], tags: [], forbids: [].}
- Returns date in the format that JMAP expects for UTCDate Source Edit
func reuse(call: Call; path: string): ResultReference {.inline, ...raises: [].}
-
Helper function for reuse for use with Call
Example: cmd: -d:ssl
import jamp let query = Email.query("1234") get = Email.get( "1234", ids = query.reuse("/ids/*") )
Source Edit func reuse(inv: Invocation; path: string): ResultReference {....raises: [], tags: [], forbids: [].}
- Pass this has a parameter to a JMAP call and it will allow you to reuse value from previous call. See TODO LINK JSONPTR MODULE for information about path Source Edit
Macros
macro props(x: typedesc; props: varargs[untyped]): seq[string]
-
Build a list of props from a type. Useful for having typesafe method for passing props to a method
Example:
type Person = object name: string age: int alive: bool assert Person.props(name, alive, age) == @["name", "alive", "age"]
Source Edit