]> git.notmuchmail.org Git - notmuch/blob - devel/schemata
Rename the -json printer functions in notmuch-reply and notmuch-show to generic ...
[notmuch] / devel / schemata
1 This file describes the schemata used for notmuch's structured output
2 format (currently JSON).
3
4 []'s indicate lists.  List items can be marked with a '?', meaning
5 they are optional; or a '*', meaning there can be zero or more of that
6 item.  {}'s indicate an object that maps from field identifiers to
7 values.  An object field marked '?' is optional.  |'s indicate
8 alternates (e.g., int|string means something can be an int or a
9 string).
10
11 Common non-terminals
12 --------------------
13
14 # Number of seconds since the Epoch
15 unix_time = int
16
17 # Thread ID, sans "thread:"
18 threadid = string
19
20 # Message ID, sans "id:"
21 messageid = string
22
23 notmuch show schema
24 -------------------
25
26 # A top-level set of threads (do_show)
27 # Returned by notmuch show without a --part argument
28 thread_set = [thread*]
29
30 # Top-level messages in a thread (show_messages)
31 thread = [thread_node*]
32
33 # A message and its replies (show_messages)
34 thread_node = [
35     message|null,             # null if not matched and not --entire-thread
36     [thread_node*]            # children of message
37 ]
38
39 # A message (format_part_sprinter)
40 message = {
41     # (format_message_sprinter)
42     id:             messageid,
43     match:          bool,
44     filename:       string,
45     timestamp:      unix_time, # date header as unix time
46     date_relative:  string,   # user-friendly timestamp
47     tags:           [string*],
48
49     headers:        headers,
50     body?:          [part]    # omitted if --body=false
51 }
52
53 # A MIME part (format_part_sprinter)
54 part = {
55     id:             int|string, # part id (currently DFS part number)
56
57     encstatus?:     encstatus,
58     sigstatus?:     sigstatus,
59
60     content-type:   string,
61     content-id?:    string,
62     # if content-type starts with "multipart/":
63     content:        [part*],
64     # if content-type is "message/rfc822":
65     content:        [{headers: headers, body: [part]}],
66     # otherwise (leaf parts):
67     filename?:      string,
68     content-charset?: string,
69     # A leaf part's body content is optional, but may be included if
70     # it can be correctly encoded as a string.  Consumers should use
71     # this in preference to fetching the part content separately.
72     content?:       string
73 }
74
75 # The headers of a message or part (format_headers_sprinter with reply = FALSE)
76 headers = {
77     Subject:        string,
78     From:           string,
79     To?:            string,
80     Cc?:            string,
81     Bcc?:           string,
82     Reply-To?:      string,
83     Date:           string
84 }
85
86 # Encryption status (format_part_sprinter)
87 encstatus = [{status: "good"|"bad"}]
88
89 # Signature status (format_part_sigstatus_sprinter)
90 sigstatus = [signature*]
91
92 signature = {
93     # (signature_status_to_string)
94     status:         "none"|"good"|"bad"|"error"|"unknown",
95     # if status is "good":
96     fingerprint?:   string,
97     created?:       unix_time,
98     expires?:       unix_time,
99     userid?:        string
100     # if status is not "good":
101     keyid?:         string
102     # if the signature has errors:
103     errors?:        int
104 }
105
106 notmuch search schema
107 ---------------------
108
109 # --output=summary
110 summary = [thread*]
111
112 # --output=threads
113 threads = [threadid*]
114
115 # --output=messages
116 messages = [messageid*]
117
118 # --output=files
119 files = [string*]
120
121 # --output=tags
122 tags = [string*]
123
124 thread = {
125     thread:         threadid,
126     timestamp:      unix_time,
127     date_relative:  string,   # user-friendly timestamp
128     matched:        int,      # number of matched messages
129     total:          int,      # total messages in thread
130     authors:        string,   # comma-separated names with | between
131                               # matched and unmatched
132     subject:        string,
133     tags:           [string*]
134 }
135
136 notmuch reply schema
137 --------------------
138
139 reply = {
140     # The headers of the constructed reply
141     reply-headers: reply_headers,
142
143     # As in the show format (format_part_sprinter)
144     original: message
145 }
146
147 # Reply headers (format_headers_sprinter with reply = TRUE)
148 reply_headers = {
149     Subject:        string,
150     From:           string,
151     To?:            string,
152     Cc?:            string,
153     Bcc?:           string,
154     In-reply-to:    string,
155     References:     string
156 }