{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Creates a channel. This creates a space for the channel, then writes the channel's configuration record at key 'self' inside that space.",
      "errors": [
        {
          "description": "The request has no valid service auth.",
          "name": "AuthRequired"
        },
        {
          "description": "The requesting user lacks the channel.create permission.",
          "name": "Forbidden"
        },
        {
          "description": "No community matches the given DID.",
          "name": "CommunityNotFound"
        },
        {
          "description": "No category matches the given record key.",
          "name": "CategoryNotFound"
        },
        {
          "description": "The requesting user cannot grant a role that outranks their own.",
          "name": "RoleHierarchy"
        },
        {
          "description": "The arguments are inconsistent or malformed beyond schema validation.",
          "name": "InvalidRequest"
        },
        {
          "description": "The AppView cannot act as the community because its stored credentials are missing or unusable.",
          "name": "CredentialsUnavailable"
        },
        {
          "description": "The community's PDS is unreachable or the AppView has no administrative access to it.",
          "name": "PdsUnavailable"
        },
        {
          "description": "The community's PDS failed while creating the channel's space.",
          "name": "UpstreamFailure"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "allowedMembers": {
              "description": "Members allowed to post here in addition to allowedRoles.",
              "items": {
                "description": "A member permitted to post.",
                "format": "did",
                "type": "string"
              },
              "type": "array"
            },
            "allowedRoles": {
              "description": "Roles allowed to post here.",
              "items": {
                "description": "A role permitted to post.",
                "format": "record-key",
                "type": "string"
              },
              "type": "array"
            },
            "category": {
              "description": "The category to list the channel under.",
              "format": "record-key",
              "type": "string"
            },
            "community": {
              "description": "The community the channel belongs to.",
              "format": "did",
              "type": "string"
            },
            "description": {
              "description": "The channel's topic.",
              "maxLength": 256,
              "type": "string"
            },
            "name": {
              "description": "The channel's name.",
              "maxLength": 32,
              "minLength": 1,
              "type": "string"
            },
            "ownerOnly": {
              "description": "Whether only community admins may post.",
              "type": "boolean"
            },
            "type": {
              "description": "The channel's space type.",
              "format": "nsid",
              "knownValues": [
                "social.colibri.beta.channel.text",
                "social.colibri.beta.channel.voice"
              ],
              "type": "string"
            },
            "visibleToMembers": {
              "description": "Members that may read this channel beyond visibleToRoles.",
              "items": {
                "description": "A member.",
                "format": "did",
                "type": "string"
              },
              "type": "array"
            },
            "visibleToRoles": {
              "description": "Roles that may read this channel. Empty means every member may.",
              "items": {
                "description": "A role.",
                "format": "record-key",
                "type": "string"
              },
              "type": "array"
            }
          },
          "required": [
            "community",
            "type",
            "name",
            "category"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "channel": {
              "description": "The newly created channel.",
              "ref": "social.colibri.beta.community.defs#channelView",
              "type": "ref"
            }
          },
          "required": [
            "channel"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "social.colibri.beta.channel.create",
  "lexicon": 1
}
