{
  "$id": "https://intentschema.org/intents/communication/chat/channel/list/v1.json",
  "fqdn": "org.intentschema.communication.chat.channel.list.v1",
  "title": "List chat channels",
  "description": "List channels (and DMs / group conversations) the user has access to.",
  "payload": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "required": [
      "target"
    ],
    "properties": {
      "target": {
        "$ref": "https://intentschema.org/common/target/v1.json"
      },
      "object": {
        "type": "object",
        "properties": {
          "filter": {
            "type": "object",
            "properties": {
              "membership": {
                "enum": [
                  "member",
                  "all"
                ]
              },
              "kind": {
                "enum": [
                  "channel",
                  "dm",
                  "group_dm"
                ]
              },
              "private": {
                "type": "boolean"
              },
              "archived": {
                "type": "boolean"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500,
            "default": 50
          },
          "cursor": {
            "type": "string"
          }
        }
      }
    }
  },
  "result": {
    "type": "object",
    "required": [
      "items"
    ],
    "properties": {
      "items": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "external_id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "topic": {
              "type": "string"
            },
            "kind": {
              "enum": [
                "channel",
                "dm",
                "group_dm"
              ]
            },
            "private": {
              "type": "boolean"
            },
            "archived": {
              "type": "boolean"
            },
            "member_count": {
              "type": "integer"
            }
          }
        }
      },
      "next_cursor": {
        "type": "string"
      }
    }
  },
  "examples": [
    {
      "name": "list joined channels",
      "value": {
        "target": {
          "system": "slack"
        },
        "object": {
          "filter": {
            "membership": "member"
          }
        }
      }
    }
  ]
}
