summaryrefslogtreecommitdiffstats
path: root/comm/mail/components/extensions/schemas/messages.json
blob: 6a025763a16955d3dc62162a70485765815e84c2 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
[
  {
    "namespace": "manifest",
    "types": [
      {
        "$extend": "OptionalPermission",
        "choices": [
          {
            "type": "string",
            "enum": [
              "messagesDelete",
              "messagesImport",
              "messagesMove",
              "messagesRead",
              "messagesTags",
              "sensitiveDataUpload"
            ]
          }
        ]
      }
    ]
  },
  {
    "namespace": "messages",
    "permissions": ["messagesRead"],
    "types": [
      {
        "id": "MessageHeader",
        "type": "object",
        "description": "Basic information about a message.",
        "properties": {
          "author": {
            "type": "string"
          },
          "bccList": {
            "description": "The Bcc recipients. Not populated for news/nntp messages.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "ccList": {
            "description": "The Cc recipients. Not populated for news/nntp messages.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "date": {
            "$ref": "extensionTypes.Date"
          },
          "external": {
            "type": "boolean",
            "description": "Whether this message is a real message or an external message (opened from a file or from an attachment)."
          },
          "flagged": {
            "type": "boolean",
            "description": "Whether this message is flagged (a.k.a. starred)."
          },
          "folder": {
            "$ref": "folders.MailFolder",
            "description": "The <permission>accountsRead</permission> permission is required for this property to be included. Not available for external or attached messages.",
            "optional": true
          },
          "headerMessageId": {
            "type": "string",
            "description": "The message-id header of the message."
          },
          "headersOnly": {
            "description": "Some account types (for example <value>pop3</value>) allow to download only the headers of the message, but not its body. The body of such messages will not be available.",
            "type": "boolean"
          },
          "id": {
            "type": "integer",
            "minimum": 1
          },
          "junk": {
            "description": "Whether the message has been marked as junk. Always <value>false</value> for news/nntp messages and external messages.",
            "type": "boolean"
          },
          "junkScore": {
            "type": "integer",
            "description": "The junk score associated with the message. Always <value>0</value> for news/nntp messages and external messages.",
            "minimum": 0,
            "maximum": 100
          },
          "read": {
            "type": "boolean",
            "optional": true,
            "description": "Whether the message has been marked as read. Not available for external or attached messages."
          },
          "new": {
            "type": "boolean",
            "description": "Whether the message has been received recently and is marked as new."
          },
          "recipients": {
            "description": "The To recipients. Not populated for news/nntp messages.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "size": {
            "description": "The total size of the message in bytes.",
            "type": "integer"
          },
          "subject": {
            "type": "string",
            "description": "The subject of the message."
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Tags associated with this message. For a list of available tags, call the listTags method."
          }
        }
      },
      {
        "id": "MessageList",
        "type": "object",
        "description": "See :doc:`how-to/messageLists` for more information.",
        "properties": {
          "id": {
            "type": "string",
            "optional": true
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "MessageHeader"
            }
          }
        }
      },
      {
        "id": "MessagePart",
        "type": "object",
        "description": "Represents an email message \"part\", which could be the whole message",
        "properties": {
          "body": {
            "type": "string",
            "description": "The content of the part",
            "optional": true
          },
          "contentType": {
            "type": "string",
            "optional": true
          },
          "headers": {
            "type": "object",
            "description": "A <em>dictionary object</em> of part headers as <em>key-value</em> pairs, with the header name as <em>key</em>, and an array of headers as <em>value</em>",
            "optional": true,
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "name": {
            "type": "string",
            "description": "Name of the part, if it is a file",
            "optional": true
          },
          "partName": {
            "type": "string",
            "optional": true,
            "description": "The identifier of this part, used in :ref:`messages.getAttachmentFile`"
          },
          "parts": {
            "type": "array",
            "items": {
              "$ref": "MessagePart"
            },
            "description": "Any sub-parts of this part",
            "optional": true
          },
          "size": {
            "type": "integer",
            "optional": true,
            "description": "The size of this part. The size of <em>message/*</em> parts is not the actual message size (on disc), but the total size of its decoded body parts, excluding headers."
          }
        }
      },
      {
        "id": "MessageProperties",
        "type": "object",
        "description": "Message properties used in :ref:`messages.update` and :ref:`messages.import`. They can also be monitored by :ref:`messages.onUpdated`.",
        "properties": {
          "flagged": {
            "type": "boolean",
            "description": "Whether the message is flagged (a.k.a starred).",
            "optional": true
          },
          "junk": {
            "type": "boolean",
            "optional": true,
            "description": "Whether the message is marked as junk. Only supported in :ref:`messages.update`"
          },
          "new": {
            "type": "boolean",
            "description": "Whether the message is marked as new. Only supported in :ref:`messages.import`",
            "optional": true
          },
          "read": {
            "type": "boolean",
            "description": "Whether the message is marked as read.",
            "optional": true
          },
          "tags": {
            "type": "array",
            "description": "Tags associated with this message. For a list of available tags, call the listTags method.",
            "optional": true,
            "items": {
              "type": "string"
            }
          }
        }
      },
      {
        "id": "MessageTag",
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "Unique tag identifier."
          },
          "tag": {
            "type": "string",
            "description": "Human-readable tag name."
          },
          "color": {
            "type": "string",
            "description": "Tag color."
          },
          "ordinal": {
            "type": "string",
            "description": "Custom sort string (usually empty)."
          }
        }
      },
      {
        "id": "TagsDetail",
        "type": "object",
        "description": "Used for filtering messages by tag in various methods. Note that functions using this type may have a partial implementation.",
        "properties": {
          "tags": {
            "type": "object",
            "description": "A <em>dictionary object</em> with one or more filter condition as <em>key-value</em> pairs, the <em>key</em> being the tag to filter on, and the <em>value</em> being a boolean expression, requesting whether a message must include (<value>true</value>) or exclude (<value>false</value>) the tag. For a list of available tags, call the :ref:`messages.listTags` method.",
            "patternProperties": {
              ".*": {
                "type": "boolean"
              }
            }
          },
          "mode": {
            "type": "string",
            "description": "Whether all of the tag filters must apply, or any of them.",
            "enum": ["all", "any"]
          }
        }
      },
      {
        "id": "MessageAttachment",
        "type": "object",
        "description": "Represents an attachment in a message.",
        "properties": {
          "contentType": {
            "type": "string",
            "description": "The content type of the attachment."
          },
          "name": {
            "type": "string",
            "description": "The name, as displayed to the user, of this attachment. This is usually but not always the filename of the attached file."
          },
          "partName": {
            "type": "string",
            "description": "Identifies the MIME part of the message associated with this attachment."
          },
          "size": {
            "type": "integer",
            "description": "The size in bytes of this attachment."
          },
          "message": {
            "$ref": "messages.MessageHeader",
            "optional": true,
            "description": "A MessageHeader, if this attachment is a message."
          }
        }
      }
    ],
    "events": [
      {
        "name": "onUpdated",
        "type": "function",
        "description": "Fired when one or more properties of a message have been updated.",
        "parameters": [
          {
            "name": "message",
            "$ref": "messages.MessageHeader"
          },
          {
            "name": "changedProperties",
            "$ref": "messages.MessageProperties"
          }
        ]
      },
      {
        "name": "onMoved",
        "type": "function",
        "description": "Fired when messages have been moved.",
        "permissions": ["accountsRead"],
        "parameters": [
          {
            "name": "originalMessages",
            "$ref": "messages.MessageList"
          },
          {
            "name": "movedMessages",
            "$ref": "messages.MessageList"
          }
        ]
      },
      {
        "name": "onCopied",
        "type": "function",
        "description": "Fired when messages have been copied.",
        "permissions": ["accountsRead"],
        "parameters": [
          {
            "name": "originalMessages",
            "$ref": "messages.MessageList"
          },
          {
            "name": "copiedMessages",
            "$ref": "messages.MessageList"
          }
        ]
      },
      {
        "name": "onDeleted",
        "type": "function",
        "description": "Fired when messages have been permanently deleted.",
        "permissions": ["accountsRead"],
        "parameters": [
          {
            "name": "messages",
            "$ref": "messages.MessageList"
          }
        ]
      },
      {
        "name": "onNewMailReceived",
        "type": "function",
        "description": "Fired when a new message is received, and has been through junk classification and message filters.",
        "permissions": ["accountsRead"],
        "parameters": [
          {
            "name": "folder",
            "$ref": "folders.MailFolder"
          },
          {
            "name": "messages",
            "$ref": "messages.MessageList"
          }
        ]
      }
    ],
    "functions": [
      {
        "name": "list",
        "type": "function",
        "description": "Gets all messages in a folder.",
        "async": "callback",
        "permissions": ["accountsRead"],
        "parameters": [
          {
            "name": "folder",
            "$ref": "folders.MailFolder"
          },
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "parameters": [
              {
                "$ref": "MessageList"
              }
            ]
          }
        ]
      },
      {
        "name": "continueList",
        "type": "function",
        "description": "Returns the next chunk of messages in a list. See :doc:`how-to/messageLists` for more information.",
        "async": "callback",
        "parameters": [
          {
            "name": "messageListId",
            "type": "string"
          },
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "parameters": [
              {
                "$ref": "MessageList"
              }
            ]
          }
        ]
      },
      {
        "name": "get",
        "type": "function",
        "description": "Returns a specified message.",
        "async": "callback",
        "parameters": [
          {
            "name": "messageId",
            "type": "integer"
          },
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "parameters": [
              {
                "$ref": "MessageHeader"
              }
            ]
          }
        ]
      },
      {
        "name": "getFull",
        "type": "function",
        "description": "Returns a specified message, including all headers and MIME parts. Throws if the message could not be read, for example due to network issues.",
        "async": "callback",
        "parameters": [
          {
            "name": "messageId",
            "type": "integer"
          },
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "parameters": [
              {
                "$ref": "MessagePart"
              }
            ]
          }
        ]
      },
      {
        "name": "getRaw",
        "type": "function",
        "description": "Returns the unmodified source of a message. Throws if the message could not be read, for example due to network issues.",
        "async": "callback",
        "parameters": [
          {
            "name": "messageId",
            "type": "integer"
          },
          {
            "name": "options",
            "type": "object",
            "properties": {
              "data_format": {
                "choices": [
                  {
                    "max_manifest_version": 2,
                    "description": "The message can either be returned as a DOM File or as a `binary string <|link-binary-string|>`__. The historic default is to return a binary string (kept for backward compatibility). However, it is now recommended to use the ``File`` format, because the DOM File object can be used as-is with the downloads API and has useful methods to access the content, like `File.text() <|link-DOMFile-text|>`__ and `File.arrayBuffer() <|link-DOMFile-arrayBuffer|>`__. Working with binary strings is error prone and needs special handling: <literalinclude>includes/messages/decodeBinaryString.js<lang>JavaScript</lang></literalinclude> (see MDN for `supported input encodings <|link-input-encoding|>`__).",
                    "type": "string",
                    "enum": ["File", "BinaryString"]
                  },
                  {
                    "min_manifest_version": 3,
                    "description": "The message can either be returned as a DOM File (default) or as a `binary string <|link-binary-string|>`__. It is recommended to use the ``File`` format, because the DOM File object can be used as-is with the downloads API and has useful methods to access the content, like `File.text() <|link-DOMFile-text|>`__ and `File.arrayBuffer() <|link-DOMFile-arrayBuffer|>`__. Working with binary strings is error prone and needs special handling: <literalinclude>includes/messages/decodeBinaryString.js<lang>JavaScript</lang></literalinclude> (see MDN for `supported input encodings <|link-input-encoding|>`__).",
                    "type": "string",
                    "enum": ["File", "BinaryString"]
                  }
                ]
              }
            },
            "optional": true
          },
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "parameters": [
              {
                "choices": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "isInstanceOf": "File",
                    "additionalProperties": true
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "name": "listAttachments",
        "type": "function",
        "description": "Lists the attachments of a message.",
        "async": "callback",
        "parameters": [
          {
            "name": "messageId",
            "type": "integer"
          },
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "parameters": [
              {
                "type": "array",
                "items": {
                  "$ref": "MessageAttachment"
                }
              }
            ]
          }
        ]
      },
      {
        "name": "getAttachmentFile",
        "type": "function",
        "description": "Gets the content of a :ref:`messages.MessageAttachment` as a |File| object.",
        "async": "callback",
        "parameters": [
          {
            "name": "messageId",
            "type": "integer"
          },
          {
            "name": "partName",
            "type": "string",
            "pattern": "^\\d+(\\.\\d+)*$"
          },
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "parameters": [
              {
                "type": "object",
                "isInstanceOf": "File",
                "additionalProperties": true
              }
            ]
          }
        ]
      },
      {
        "name": "openAttachment",
        "type": "function",
        "description": "Opens the specified attachment",
        "async": true,
        "parameters": [
          {
            "name": "messageId",
            "type": "integer"
          },
          {
            "name": "partName",
            "type": "string",
            "pattern": "^\\d+(\\.\\d+)*$"
          },
          {
            "name": "tabId",
            "type": "integer",
            "description": "The ID of the tab associated with the message opening."
          }
        ]
      },
      {
        "name": "query",
        "type": "function",
        "description": "Gets all messages that have the specified properties, or all messages if no properties are specified.",
        "async": "callback",
        "parameters": [
          {
            "type": "object",
            "name": "queryInfo",
            "optional": true,
            "default": {},
            "properties": {
              "attachment": {
                "type": "boolean",
                "optional": true,
                "description": "If specified, returns only messages with or without attachments."
              },
              "author": {
                "type": "string",
                "optional": true,
                "description": "Returns only messages with this value matching the author. The search value is a single email address, a name or a combination (e.g.: <value>Name <user@domain.org></value>). The address part of the search value (if provided) must match the author's address completely. The name part of the search value (if provided) must match the author's name partially. All matches are done case-insensitive."
              },
              "body": {
                "type": "string",
                "optional": true,
                "description": "Returns only messages with this value in the body of the mail."
              },
              "flagged": {
                "type": "boolean",
                "optional": true,
                "description": "Returns only flagged (or unflagged if false) messages."
              },
              "folder": {
                "$ref": "folders.MailFolder",
                "optional": true,
                "description": "Returns only messages from the specified folder. The <permission>accountsRead</permission> permission is required."
              },
              "fromDate": {
                "$ref": "extensionTypes.Date",
                "optional": true,
                "description": "Returns only messages with a date after this value."
              },
              "fromMe": {
                "type": "boolean",
                "optional": true,
                "description": "Returns only messages with the author's address matching any configured identity."
              },
              "fullText": {
                "type": "string",
                "optional": true,
                "description": "Returns only messages with this value somewhere in the mail (subject, body or author)."
              },
              "headerMessageId": {
                "type": "string",
                "optional": true,
                "description": "Returns only messages with a Message-ID header matching this value."
              },
              "includeSubFolders": {
                "type": "boolean",
                "optional": true,
                "description": "Search the folder specified by ``queryInfo.folder`` recursively."
              },
              "recipients": {
                "type": "string",
                "optional": true,
                "description": "Returns only messages whose recipients match all specified addresses. The search value is a semicolon separated list of email addresses, names or combinations (e.g.: <value>Name <user@domain.org></value>). For a match, all specified addresses must equal a recipient's address completely and all specified names must match a recipient's name partially. All matches are done case-insensitive."
              },
              "subject": {
                "type": "string",
                "optional": true,
                "description": "Returns only messages with this value matching the subject."
              },
              "tags": {
                "$ref": "TagsDetail",
                "optional": true,
                "description": "Returns only messages with the specified tags. For a list of available tags, call the :ref:`messages.listTags` method."
              },
              "toDate": {
                "$ref": "extensionTypes.Date",
                "optional": true,
                "description": "Returns only messages with a date before this value."
              },
              "toMe": {
                "type": "boolean",
                "optional": true,
                "description": "Returns only messages with at least one recipient address matching any configured identity."
              },
              "unread": {
                "type": "boolean",
                "optional": true,
                "description": "Returns only unread (or read if false) messages."
              }
            }
          },
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "parameters": [
              {
                "$ref": "MessageList"
              }
            ]
          }
        ]
      },
      {
        "name": "update",
        "type": "function",
        "description": "Marks or unmarks a message as junk, read, flagged, or tagged. Updating external messages will throw an <em>ExtensionError</em>.",
        "async": true,
        "parameters": [
          {
            "name": "messageId",
            "type": "integer",
            "minimum": 1
          },
          {
            "name": "newProperties",
            "$ref": "MessageProperties"
          }
        ]
      },
      {
        "name": "move",
        "type": "function",
        "description": "Moves messages to a specified folder. If the messages cannot be removed from the source folder, they will be copied instead of moved. Moving external messages will throw an <em>ExtensionError</em>.",
        "async": true,
        "permissions": ["accountsRead", "messagesMove"],
        "parameters": [
          {
            "name": "messageIds",
            "type": "array",
            "description": "The IDs of the messages to move.",
            "items": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "destination",
            "$ref": "folders.MailFolder",
            "description": "The folder to move the messages to."
          }
        ]
      },
      {
        "name": "copy",
        "type": "function",
        "description": "Copies messages to a specified folder.",
        "async": true,
        "permissions": ["accountsRead", "messagesMove"],
        "parameters": [
          {
            "name": "messageIds",
            "type": "array",
            "description": "The IDs of the messages to copy.",
            "items": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "destination",
            "$ref": "folders.MailFolder",
            "description": "The folder to copy the messages to."
          }
        ]
      },
      {
        "name": "delete",
        "type": "function",
        "description": "Deletes messages permanently, or moves them to the trash folder (honoring the account's deletion behavior settings). Deleting external messages will throw an <em>ExtensionError</em>. The ``skipTrash`` parameter allows immediate permanent deletion, bypassing the trash folder.\n**Note**: Consider using :ref:`messages.move` to manually move messages to the account's trash folder, instead of requesting the overly powerful permission to actually delete messages. The account's trash folder can be extracted as follows: <literalinclude>includes/messages/getTrash.js<lang>JavaScript</lang></literalinclude>",
        "async": true,
        "permissions": ["messagesDelete"],
        "parameters": [
          {
            "name": "messageIds",
            "type": "array",
            "description": "The IDs of the messages to delete.",
            "items": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "skipTrash",
            "type": "boolean",
            "description": "If true, the message will be deleted permanently, regardless of the account's deletion behavior settings.",
            "optional": true
          }
        ]
      },
      {
        "name": "import",
        "type": "function",
        "description": "Imports a message into a local Thunderbird folder. To import a message into an IMAP folder, add it to a local folder first and then move it to the IMAP folder.",
        "async": "callback",
        "permissions": ["accountsRead", "messagesImport"],
        "parameters": [
          {
            "name": "file",
            "type": "object",
            "isInstanceOf": "File",
            "additionalProperties": true
          },
          {
            "name": "destination",
            "$ref": "folders.MailFolder",
            "description": "The folder to import the messages into."
          },
          {
            "name": "properties",
            "$ref": "messages.MessageProperties",
            "optional": true
          },
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "parameters": [
              {
                "$ref": "messages.MessageHeader"
              }
            ]
          }
        ]
      },
      {
        "name": "archive",
        "type": "function",
        "description": "Archives messages using the current settings. Archiving external messages will throw an <em>ExtensionError</em>.",
        "async": true,
        "permissions": ["messagesMove"],
        "parameters": [
          {
            "name": "messageIds",
            "type": "array",
            "description": "The IDs of the messages to archive.",
            "items": {
              "type": "integer",
              "minimum": 1
            }
          }
        ]
      },
      {
        "name": "listTags",
        "type": "function",
        "description": "Returns a list of tags that can be set on messages, and their human-friendly name, colour, and sort order.",
        "async": "callback",
        "parameters": [
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "parameters": [
              {
                "type": "array",
                "items": {
                  "$ref": "MessageTag"
                }
              }
            ]
          }
        ]
      },
      {
        "name": "createTag",
        "type": "function",
        "description": "Creates a new message tag. Tagging a message will store the tag's key in the user's message. Throws if the specified tag key is used already.",
        "async": true,
        "permissions": ["messagesTags"],
        "parameters": [
          {
            "type": "string",
            "name": "key",
            "description": "Unique tag identifier (will be converted to lower case). Must not include <value>()<>{/%*\"</value> or spaces.",
            "pattern": "^[^ ()/{%*<>\"]+$"
          },
          {
            "type": "string",
            "name": "tag",
            "description": "Human-readable tag name."
          },
          {
            "type": "string",
            "name": "color",
            "description": "Tag color in hex format (i.e.: #000080 for navy blue)",
            "pattern": "^#[0-9a-f]{6}"
          }
        ]
      },
      {
        "name": "updateTag",
        "type": "function",
        "description": "Updates a message tag.",
        "async": true,
        "permissions": ["messagesTags"],
        "parameters": [
          {
            "type": "string",
            "name": "key",
            "description": "Unique tag identifier (will be converted to lower case). Must not include <value>()<>{/%*\"</value> or spaces.",
            "pattern": "^[^ ()/{%*<>\"]+$"
          },
          {
            "type": "object",
            "name": "updateProperties",
            "properties": {
              "tag": {
                "type": "string",
                "optional": "true",
                "description": "Human-readable tag name."
              },
              "color": {
                "type": "string",
                "pattern": "^#[0-9a-f]{6}",
                "description": "Tag color in hex format (i.e.: #000080 for navy blue).",
                "optional": "true"
              }
            }
          }
        ]
      },
      {
        "name": "deleteTag",
        "type": "function",
        "description": "Deletes a message tag, removing it from the list of known tags. Its key will not be removed from tagged messages, but they will appear untagged. Recreating a deleted tag, will make all former tagged messages appear tagged again.",
        "async": true,
        "permissions": ["messagesTags"],
        "parameters": [
          {
            "type": "string",
            "name": "key",
            "description": "Unique tag identifier (will be converted to lower case). Must not include <value>()<>{/%*\"</value> or spaces.",
            "pattern": "^[^ ()/{%*<>\"]+$"
          }
        ]
      }
    ]
  }
]