summaryrefslogtreecommitdiffstats
path: root/lua/inbox/types.lua
blob: a4105b0a89cff923c32bcc86e439690ebf817405 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---@class inbox.Config
---@field default_maildir string|nil
---@field indexer_config inbox.Indexer.Config|nil
---@field buf_options table|nil
---@field win_options table|nil
---@field filters table<inbox.ContentType, inbox.PartFilter[]>
---@field columns integer[]
---@field flags table<string, table>
---@field headers inbox.HeaderKey[]

---@class inbox.PartFilter
---@field command string
---@field args string[]

---@alias inbox.HeaderKey
---| "Subject"
---| "Date"
---| "To"
---| "From"
---| string

---@alias inbox.ContentType
---| "text/plain"
---| "text/html"
---| string

---@class inbox.Indexer
---@field setup? fun(opts: table)
---@field available? fun(): boolean
---@field index? fun(maildir: string, cb: fun(ids: string[], entries: inbox.Summary[], signs: (string | integer)[][]), opts?: table)
---@field get_entry? fun(id: string): inbox.Entry|nil
---@field get_parts? fun(id: string): inbox.ContentType[]

---@alias inbox.Indexer.Config
---| "notmuch"
---| string
---| table

---@class inbox.Summary
---@field tags string[]
---@field date string
---@field from string
---@field subject string

---@class inbox.Entry
---@field id string
---@field timestamp integer
---@field filename string[]
---@field tags string[]
---@field parts inbox.EntryPart[]
---@field headers table<inbox.HeaderKey, string>

---@class inbox.EntryPart
---@field id integer
---@field content-type inbox.ContentType
---@field content-charset? string
---@field content-length? integer
---@field	content-disposition? string
---@field	content-transfer-encoding? string
---@field content string