mail/components/extensions/schemas/messages.json
author Geoff Lankow <geoff@darktrojan.net>
Fri, 25 Jan 2019 17:32:10 +1300
changeset 34295 132113b4ce51c899bc8932f30401be73728f1268
parent 34185 18f7dcdd1bedc765d73cccc18fe72f43c80342b5
permissions -rw-r--r--
Bug 1520338 - Messages API function to move, copy, or delete messages; r=Fallen

[
  {
    "namespace": "manifest",
    "types": [
      {
        "$extend": "OptionalPermission",
        "choices": [
          {
            "type": "string",
            "enum": [
              "messagesMove",
              "messagesRead"
            ]
          }
        ]
      }
    ]
  },
  {
    "namespace": "messages",
    "permissions": [
      "messagesRead"
    ],
    "functions": [
      {
        "name": "list",
        "type": "function",
        "description": "Gets all messages in a folder.",
        "async": true,
        "parameters": [
          {
            "name": "folder",
            "$ref": "accounts.MailFolder"
          }
        ]
      },
      {
        "name": "continueList",
        "type": "function",
        "description": "Returns the next chunk of messages in a list. See :doc:`how-to/messageLists` for more information.",
        "async": true,
        "parameters": [
          {
            "name": "messageListId",
            "type": "string"
          }
        ]
      },
      {
        "name": "get",
        "type": "function",
        "description": "Returns a specified message.",
        "async": true,
        "parameters": [
          {
            "name": "messageId",
            "type": "integer"
          }
        ]
      },
      {
        "name": "getFull",
        "type": "function",
        "description": "Returns a specified message, including all headers and MIME parts.",
        "async": true,
        "parameters": [
          {
            "name": "messageId",
            "type": "integer"
          }
        ]
      },
      {
        "name": "update",
        "type": "function",
        "description": "Marks or unmarks a message as read, starred, or tagged.",
        "async": true,
        "parameters": [
          {
            "name": "messageId",
            "type": "integer",
            "minimum": 1
          },
          {
            "name": "newProperties",
            "type": "object",
            "properties": {
              "read": {
                "type": "boolean",
                "description": "Marks the message as read or unread.",
                "optional": true
              },
              "flagged": {
                "type": "boolean",
                "description": "Marks the message as starred or unstarred.",
                "optional": true
              },
              "tags": {
                "type": "array",
                "description": "Sets the tags on the message. For a list of available tags, call the listTags method.",
                "optional": true,
                "items": {
                  "type": "string"
                }
              }
            }
          }
        ]
      },
      {
        "name": "move",
        "type": "function",
        "description": "Moves messages to a specified folder.",
        "async": true,
        "permissions": [
          "messagesMove"
        ],
        "parameters": [
          {
            "name": "messageIds",
            "type": "array",
            "description": "The IDs of the messages to move.",
            "items": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "destination",
            "$ref": "accounts.MailFolder",
            "description": "The folder to move the messages to."
          }
        ]
      },
      {
        "name": "copy",
        "type": "function",
        "description": "Copies messages to a specified folder.",
        "async": true,
        "permissions": [
          "messagesMove"
        ],
        "parameters": [
          {
            "name": "messageIds",
            "type": "array",
            "description": "The IDs of the messages to copy.",
            "items": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "destination",
            "$ref": "accounts.MailFolder",
            "description": "The folder to copy the messages to."
          }
        ]
      },
      {
        "name": "delete",
        "type": "function",
        "description": "Deletes messages, or moves them to the trash folder.",
        "async": true,
        "permissions": [
          "messagesMove"
        ],
        "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 permanently deleted without warning the user. If false or not specified, it will be moved to the trash folder.",
            "optional": true
          }
        ]
      },
      {
        "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": true,
        "parameters": []
      }
    ]
  }
]