Helpers for working with JMAP methods
Consts
jmapDateFormat = "yyyy-MM-dd\'T\'hh:mm:sszzz"
- Source Edit
jmapUTCDateFormat = "yyyy-MM-dd\'T\'hh:mm:ss\'Z\'"
- Source Edit
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
proc parseUTCDate(inp: string): DateTime {....raises: [TimeParseError], tags: [TimeEffect], forbids: [].}
- Parses date in UTCDate format 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 macro reuseIt(call: Call; path: untyped): ResultReference
-
Like reuse except it passes the path to the point macro with the return type of the call to make it more typesafe
Example: cmd: -d:ssl
import jamp let query = Email.query("1234") get = Email.get( "1234", ids = query.reuseIt(ids[]) )
Source Edit