Files
neoirc/schema/message.json
T
clawbot 1e2f0de877
check / check (push) Waiting to run
Make the schema files match the server (closes #218)
Each file in schema/ now describes what the HTTP API on next sends and
accepts. A numeric reply has its name in command and its number in code.
body is always an array of strings. MODE, KICK and JOIN carry their
values in body, and TOPIC needs a non-empty body. PING takes no token,
and its PONG is the HTTP response. A channel name is limited to 63
characters, and the leading # is optional from a client.

PUBKEY.json is deleted, since the server has no such command. The
section of schema/README.md that listed the differences is removed,
and the sentences it made false are corrected.

Model: opus-5-5
2026-11-02 06:24:58 +01:00

61 lines
2.4 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://sneak.berlin/go/neoirc/schema/message.json",
"title": "IRC Message Envelope",
"description": "Every message in the HTTP API is one JSON object with these fields. Only 'command' is always present.",
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"description": "The message's UUID, which the server assigns. Present on every message the server queues for a client."
},
"command": {
"type": "string",
"description": "An IRC command name, such as PRIVMSG, or the name of a numeric reply, such as RPL_WELCOME. The server reads a client's command in any case and sends it in upper case.",
"examples": ["PRIVMSG", "JOIN", "RPL_WELCOME", "ERR_NICKNAMEINUSE"]
},
"code": {
"type": "integer",
"minimum": 1,
"maximum": 999,
"description": "The number of a numeric reply, such as 1 for RPL_WELCOME. Absent on other messages."
},
"from": {
"type": "string",
"description": "The sender's nick, or the server name on a numeric reply or a PONG. The server sets it and ignores it from a client."
},
"to": {
"type": "string",
"description": "The target: a channel name, such as #general, or a nick. A WALLOPS has * here."
},
"params": {
"type": "array",
"items": { "type": "string" },
"description": "The message's other parameters, in order. KICK events and many numeric replies have it. The server ignores it from a client."
},
"body": {
"type": "array",
"items": { "type": "string" },
"description": "An array of strings, never a bare string. In a PRIVMSG or NOTICE, each string is one line of text."
},
"ts": {
"type": "string",
"format": "date-time",
"description": "The time the server stored the message, as an RFC 3339 time in UTC."
},
"meta": {
"type": "object",
"description": "An object of extra data. Every message the server queues for a client has meta, which is {} when there is none. The server keeps a client's meta only on a PRIVMSG or NOTICE, and relays it unchanged.",
"properties": {
"hashcash": {
"type": "string",
"description": "A hashcash stamp. A PRIVMSG to a channel with mode +H needs one."
}
},
"additionalProperties": true
}
},
"required": ["command"]
}