{
  "$id": "https://intentschema.org/intents/communication/email/thread/read/v1.json",
  "fqdn": "org.intentschema.communication.email.thread.read.v1",
  "title": "Read email thread",
  "description": "Read a single email thread by id, including all message ids in the thread.",
  "payload": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "required": [
      "target"
    ],
    "properties": {
      "target": {
        "allOf": [
          {
            "$ref": "https://intentschema.org/common/target/v1.json"
          },
          {
            "required": [
              "external_id"
            ]
          }
        ]
      }
    }
  },
  "result": {
    "type": "object",
    "required": [
      "external_id"
    ],
    "properties": {
      "external_id": {
        "type": "string"
      },
      "subject": {
        "type": "string"
      },
      "message_ids": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "message_count": {
        "type": "integer"
      },
      "labels": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "has_unread": {
        "type": "boolean"
      }
    }
  },
  "examples": [
    {
      "name": "get thread",
      "value": {
        "target": {
          "system": "gmail",
          "external_id": "thread_abc"
        }
      }
    }
  ]
}
