Bug 1892674 - Change documentation of folders API to reference folderIds for all folder input parameters in Manifest V3. r=#thunderbird-reviewers

We morphed the folders API into a true id-based API (deprecating the
usage of an object with `accountId` and `path` as input parameter) and
we enforce the new `folderId` as the only supported input parameter in
Manifest V3. This adjusts the documentation accordingly.

Differential Revision: https://phabricator.services.mozilla.com/D208108

--HG--
extra : rebase_source : c8dfc80be4ee656b0618b21a3e5cc89ef471e425
This commit is contained in:
John Bieling 2024-04-21 17:32:50 +02:00
Родитель 82ffe6637d
Коммит edd18e1d88
2 изменённых файлов: 391 добавлений и 45 удалений

Просмотреть файл

@ -505,8 +505,37 @@
{
"name": "create",
"type": "function",
"min_manifest_version": 3,
"permissions": ["accountsFolders"],
"description": "Creates a new subfolder in the specified folder or at the root of the specified account.",
"description": "Creates a new subfolder in the specified folder.",
"async": "callback",
"parameters": [
{
"name": "folderId",
"$ref": "folders.MailFolderId"
},
{
"name": "childName",
"type": "string"
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": [
{
"$ref": "folders.MailFolder"
}
]
}
]
},
{
"name": "create",
"type": "function",
"max_manifest_version": 2,
"permissions": ["accountsFolders"],
"description": "Creates a new subfolder in the specified folder, or at the root of the specified account.",
"async": "callback",
"parameters": [
{
@ -516,12 +545,10 @@
"$ref": "folders.MailFolderId"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.create() requires to specify a MailFolderId instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.create() requires to specify the MailFolderId of the account's rootFolder, instead of a full MailAccount object.",
"$ref": "accounts.MailAccount"
}
@ -546,6 +573,7 @@
{
"name": "rename",
"type": "function",
"max_manifest_version": 2,
"permissions": ["accountsFolders"],
"description": "Renames a folder.",
"async": "callback",
@ -557,7 +585,6 @@
"$ref": "folders.MailFolderId"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.rename() requires to specify a MailFolderId instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
}
@ -579,9 +606,38 @@
}
]
},
{
"name": "rename",
"type": "function",
"min_manifest_version": 3,
"permissions": ["accountsFolders"],
"description": "Renames a folder.",
"async": "callback",
"parameters": [
{
"name": "folderId",
"$ref": "folders.MailFolderId"
},
{
"name": "newName",
"type": "string"
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": [
{
"$ref": "folders.MailFolder"
}
]
}
]
},
{
"name": "move",
"type": "function",
"max_manifest_version": 2,
"permissions": ["accountsFolders"],
"description": "Moves the given source folder into the given destination folder. Throws if the destination already contains a folder with the name of the source folder.",
"async": "callback",
@ -593,7 +649,6 @@
"$ref": "folders.MailFolderId"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.move() requires to specify a MailFolderId for its source parameter, instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
}
@ -606,12 +661,10 @@
"$ref": "folders.MailFolderId"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.move() requires to specify a MailFolderId for its destination parameter, instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.move() requires to specify the MailFolderId of the account's rootFolder for its destination parameter, instead of a full MailAccount object.",
"$ref": "accounts.MailAccount"
}
@ -629,43 +682,97 @@
}
]
},
{
"name": "move",
"type": "function",
"min_manifest_version": 3,
"permissions": ["accountsFolders"],
"description": "Moves the given source folder into the given destination folder. Throws if the destination already contains a folder with the name of the source folder.",
"async": "callback",
"parameters": [
{
"name": "sourceFolderId",
"$ref": "folders.MailFolderId"
},
{
"name": "destinationFolderId",
"$ref": "folders.MailFolderId"
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": [
{
"$ref": "folders.MailFolder"
}
]
}
]
},
{
"name": "copy",
"type": "function",
"max_manifest_version": 2,
"permissions": ["accountsFolders"],
"description": "Copies the given source folder into the given destination folder. Throws if the destination already contains a folder with the name of the source folder.",
"async": "callback",
"parameters": [
{
"name": "source",
"choices": [
{
"$ref": "folders.MailFolderId"
},
{
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.copy() requires to specify a MailFolderId for its source parameter, instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
}
]
},
{
"name": "destination",
"choices": [
{
"$ref": "folders.MailFolderId"
},
{
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.copy() requires to specify a MailFolderId for its destination parameter, instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
},
{
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.copy() requires to specify the MailFolderId of the account's rootFolder for its destination parameter, instead of a full MailAccount object.",
"$ref": "accounts.MailAccount"
}
]
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": [
{
"$ref": "folders.MailFolder"
}
]
}
]
},
{
"name": "copy",
"type": "function",
"min_manifest_version": 3,
"permissions": ["accountsFolders"],
"description": "Copies the given source folder into the given destination folder. Throws if the destination already contains a folder with the name of the source folder.",
"async": "callback",
"parameters": [
{
"name": "source",
"choices": [
{
"$ref": "folders.MailFolderId"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.copy() requires to specify a MailFolderId for its source parameter, instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
}
]
"name": "sourceFolderId",
"$ref": "folders.MailFolderId"
},
{
"name": "destination",
"choices": [
{
"$ref": "folders.MailFolderId"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.copy() requires to specify a MailFolderId for its destination parameter, instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.copy() requires to specify the MailFolderId of the account's rootFolder for its destination parameter, instead of a full MailAccount object.",
"$ref": "accounts.MailAccount"
}
]
"name": "destinationFolderId",
"$ref": "folders.MailFolderId"
},
{
"type": "function",
@ -683,6 +790,7 @@
"name": "delete",
"permissions": ["accountsFolders", "messagesDelete"],
"type": "function",
"max_manifest_version": 2,
"description": "Deletes a folder.",
"async": true,
"parameters": [
@ -693,7 +801,6 @@
"$ref": "folders.MailFolderId"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.delete() requires to specify a MailFolderId instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
}
@ -701,10 +808,25 @@
}
]
},
{
"name": "delete",
"permissions": ["accountsFolders", "messagesDelete"],
"type": "function",
"min_manifest_version": 3,
"description": "Deletes a folder.",
"async": true,
"parameters": [
{
"name": "folderId",
"$ref": "folders.MailFolderId"
}
]
},
{
"name": "update",
"permissions": ["accountsFolders"],
"type": "function",
"max_manifest_version": 2,
"description": "Updates properties of a folder.",
"async": true,
"parameters": [
@ -715,7 +837,6 @@
"$ref": "folders.MailFolderId"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.update() requires to specify a MailFolderId instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
}
@ -735,9 +856,36 @@
}
]
},
{
"name": "update",
"permissions": ["accountsFolders"],
"type": "function",
"min_manifest_version": 3,
"description": "Updates properties of a folder.",
"async": true,
"parameters": [
{
"name": "folderId",
"$ref": "folders.MailFolderId"
},
{
"name": "updateProperties",
"type": "object",
"description": "The properties to update.",
"properties": {
"isFavorite": {
"type": "boolean",
"optional": true,
"description": "Sets or clears the favorite status."
}
}
}
]
},
{
"name": "getFolderInfo",
"type": "function",
"max_manifest_version": 2,
"description": "Get additional information about a folder.",
"async": "callback",
"parameters": [
@ -748,7 +896,6 @@
"$ref": "folders.MailFolderId"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.getFolderInfo() requires to specify a MailFolderId instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
}
@ -766,9 +913,33 @@
}
]
},
{
"name": "getFolderInfo",
"type": "function",
"min_manifest_version": 3,
"description": "Get additional information about a folder.",
"async": "callback",
"parameters": [
{
"name": "folderId",
"$ref": "folders.MailFolderId"
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": [
{
"$ref": "folders.MailFolderInfo"
}
]
}
]
},
{
"name": "getFolderCapabilities",
"type": "function",
"max_manifest_version": 2,
"description": "Get capability information about a folder.",
"async": "callback",
"parameters": [
@ -779,7 +950,6 @@
"$ref": "folders.MailFolderId"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.getFolderCapabilities() requires to specify a MailFolderId instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
}
@ -797,9 +967,33 @@
}
]
},
{
"name": "getFolderCapabilities",
"type": "function",
"min_manifest_version": 3,
"description": "Get capability information about a folder.",
"async": "callback",
"parameters": [
{
"name": "folderId",
"$ref": "folders.MailFolderId"
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": [
{
"$ref": "folders.MailFolderCapabilities"
}
]
}
]
},
{
"name": "getParentFolders",
"type": "function",
"max_manifest_version": 2,
"description": "Get all parent folders as a flat ordered array. The first array entry is the direct parent.",
"async": "callback",
"parameters": [
@ -810,7 +1004,6 @@
"$ref": "folders.MailFolderId"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.getParentFolders() requires to specify a MailFolderId instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
}
@ -838,11 +1031,44 @@
}
]
},
{
"name": "getParentFolders",
"type": "function",
"min_manifest_version": 3,
"description": "Get all parent folders as a flat ordered array. The first array entry is the direct parent.",
"async": "callback",
"parameters": [
{
"name": "folderId",
"$ref": "folders.MailFolderId"
},
{
"name": "includeSubFolders",
"description": "Specifies whether the returned :ref:`folders.MailFolder` object for each parent folder should include its nested subfolders. Defaults to <value>false</value>.",
"optional": true,
"default": false,
"type": "boolean"
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": [
{
"type": "array",
"items": {
"$ref": "folders.MailFolder"
}
}
]
}
]
},
{
"name": "getSubFolders",
"type": "function",
"min_manifest_version": 3,
"description": "Get the subfolders of the specified folder or account.",
"description": "Get the subfolders of the specified folder.",
"async": "callback",
"parameters": [
{
@ -980,6 +1206,7 @@
"name": "markAsRead",
"permissions": ["accountsFolders"],
"type": "function",
"max_manifest_version": 2,
"description": "Marks all messages in a folder as read.",
"async": false,
"parameters": [
@ -990,13 +1217,26 @@
"$ref": "folders.MailFolderId"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: folders.markAsRead() requires to specify a MailFolderId instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
}
]
}
]
},
{
"name": "markAsRead",
"permissions": ["accountsFolders"],
"type": "function",
"min_manifest_version": 3,
"description": "Marks all messages in a folder as read.",
"async": false,
"parameters": [
{
"name": "folderId",
"$ref": "folders.MailFolderId"
}
]
}
],
"events": [

Просмотреть файл

@ -375,6 +375,31 @@
{
"name": "list",
"type": "function",
"min_manifest_version": 3,
"description": "Gets all messages in a folder.",
"async": "callback",
"permissions": ["accountsRead"],
"parameters": [
{
"name": "folderId",
"$ref": "folders.MailFolderId"
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": [
{
"$ref": "messages.MessageList"
}
]
}
]
},
{
"name": "list",
"type": "function",
"max_manifest_version": 2,
"description": "Gets all messages in a folder.",
"async": "callback",
"permissions": ["accountsRead"],
@ -386,7 +411,6 @@
"$ref": "folders.MailFolderId"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: messages.list() requires to specify a MailFolderId instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
}
@ -847,6 +871,7 @@
{
"name": "move",
"type": "function",
"max_manifest_version": 2,
"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"],
@ -866,7 +891,6 @@
"$ref": "folders.MailFolderId"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: messages.move() requires to specify a MailFolderId instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
}
@ -875,9 +899,33 @@
}
]
},
{
"name": "move",
"type": "function",
"min_manifest_version": 3,
"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": {
"$ref": "messages.MessageId"
}
},
{
"name": "folderId",
"$ref": "folders.MailFolderId",
"description": "The folder to move the messages to."
}
]
},
{
"name": "copy",
"type": "function",
"max_manifest_version": 2,
"description": "Copies messages to a specified folder.",
"async": true,
"permissions": ["accountsRead", "messagesMove"],
@ -897,7 +945,6 @@
"$ref": "folders.MailFolderId"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: messages.copy() requires to specify a MailFolderId instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
}
@ -906,6 +953,29 @@
}
]
},
{
"name": "copy",
"type": "function",
"min_manifest_version": 3,
"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": {
"$ref": "messages.MessageId"
}
},
{
"name": "folderId",
"$ref": "folders.MailFolderId",
"description": "The folder to copy the messages to."
}
]
},
{
"name": "delete",
"type": "function",
@ -932,6 +1002,7 @@
{
"name": "import",
"type": "function",
"max_manifest_version": 2,
"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"],
@ -949,7 +1020,6 @@
"$ref": "folders.MailFolderId"
},
{
"max_manifest_version": 2,
"deprecated": "Support deprecated since Thunderbird 121 and removed in Manifest V3: messages.import() requires to specify a MailFolderId instead of a full MailFolder object.",
"$ref": "folders.MailFolder"
}
@ -973,6 +1043,42 @@
}
]
},
{
"name": "import",
"type": "function",
"min_manifest_version": 3,
"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": "folderId",
"$ref": "folders.MailFolderId",
"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",