Add schema/example files for all specced msgtypes.

pull/22/head
Kegan Dougal 9 years ago
parent f5059057b3
commit 59168df363

@ -0,0 +1,18 @@
{
"age": 146,
"content": {
"body": "Bee Gees - Stayin' Alive",
"url": "mxc://localhost/ffed755USFFxlgbQYZGtryd",
"info": {
"duration": 2140786,
"size": 1563685,
"mimetype": "audio/mpeg"
},
"msgtype": "m.audio"
},
"event_id": "$143273582443PhrSn:localhost",
"origin_server_ts": 1432735824653,
"room_id": "!jEsUZKDJdhlrceRyVU:localhost",
"type": "m.room.message",
"user_id": "@example:localhost"
}

@ -0,0 +1,18 @@
{
"age": 146,
"content": {
"body": "something-important.doc",
"filename": "something-important.doc",
"info": {
"mimetype": "application/msword",
"size": 46144
},
"msgtype": "m.file",
"url": "mxc://localhost/FHyPlCeYUSFFxlgbQYZmoEoe"
},
"event_id": "$143273582443PhrSn:localhost",
"origin_server_ts": 1432735824653,
"room_id": "!jEsUZKDJdhlrceRyVU:localhost",
"type": "m.room.message",
"user_id": "@example:localhost"
}

@ -0,0 +1,20 @@
{
"age": 146,
"content": {
"body": "Big Ben, London, UK",
"geo_uri": "geo:51.5008,0.1247",
"thumbnail_url": "mxc://localhost/FHyPlCeYUSFFxlgbQYZmoEoe",
"thumbnail_info": {
"mimetype": "image/jpeg",
"size": 46144,
"w": 300,
"h": 300
},
"msgtype": "m.location"
},
"event_id": "$143273582443PhrSn:localhost",
"origin_server_ts": 1432735824653,
"room_id": "!jEsUZKDJdhlrceRyVU:localhost",
"type": "m.room.message",
"user_id": "@example:localhost"
}

@ -0,0 +1,27 @@
{
"age": 146,
"content": {
"body": "Gangnam Style",
"url": "mxc://localhost/a526eYUSFFxlgbQYZmo442",
"info": {
"thumbnail_url": "mxc://localhost/FHyPlCeYUSFFxlgbQYZmoEoe",
"thumbnail_info": {
"mimetype": "image/jpeg",
"size": 46144,
"w": 300,
"h": 300
},
"w": 480,
"h": 320,
"duration": 2140786,
"size": 1563685,
"mimetype": "video/mp4"
},
"msgtype": "m.video"
},
"event_id": "$143273582443PhrSn:localhost",
"origin_server_ts": 1432735824653,
"room_id": "!jEsUZKDJdhlrceRyVU:localhost",
"type": "m.room.message",
"user_id": "@example:localhost"
}

@ -0,0 +1,52 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "AudioMessage",
"description": "This message represents a single audio clip.",
"allOf": [{
"$ref": "core#/definitions/room_event"
}],
"properties": {
"content": {
"type": "object",
"properties": {
"msgtype": {
"type": "string",
"enum": ["m.audio"]
},
"body": {
"type": "string",
"description": "A description of the audio e.g. 'Bee Gees - Stayin' Alive', or some kind of content description for accessibility e.g. 'audio attachment'."
},
"url": {
"type": "string",
"description": "The URL to the audio clip."
},
"info": {
"type": "object",
"title": "AudioInfo",
"description": "Metadata for the audio clip referred to in ``url``.",
"properties": {
"mimetype": {
"type": "string",
"description": "The mimetype of the audio e.g. ``audio/aac``."
},
"size": {
"type": "integer",
"description": "The size of the audio clip in bytes."
},
"duration": {
"type": "integer",
"description": "The duration of the audio in milliseconds."
}
}
}
},
"required": ["msgtype", "body", "url"]
},
"type": {
"type": "string",
"enum": ["m.room.message"]
}
}
}

@ -0,0 +1,29 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "EmoteMessage",
"description": "This message is similar to ``m.text`` except that the sender is 'performing' the action contained in the ``body`` key, similar to ``/me`` in IRC. This message should be prefixed by the name of the sender. This message could also be represented in a different colour to distinguish it from regular ``m.text`` messages.",
"allOf": [{
"$ref": "core#/definitions/room_event"
}],
"properties": {
"content": {
"type": "object",
"properties": {
"msgtype": {
"type": "string",
"enum": ["m.emote"]
},
"body": {
"type": "string",
"description": "The emote action to perform."
}
},
"required": ["msgtype", "body"]
},
"type": {
"type": "string",
"enum": ["m.room.message"]
}
}
}

@ -0,0 +1,79 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "FileMessage",
"description": "TODO.",
"allOf": [{
"$ref": "core#/definitions/room_event"
}],
"properties": {
"content": {
"type": "object",
"properties": {
"msgtype": {
"type": "string",
"enum": ["m.file"]
},
"filename": {
"type": "string",
"description": "The original filename of the uploaded file."
},
"body": {
"type": "string",
"description": "A human-readable description of the file. This is recommended to be the filename of the original upload."
},
"url": {
"type": "string",
"description": "The URL to the file."
},
"info": {
"type": "object",
"title": "FileInfo",
"description": "Information about the file referred to in ``url``.",
"properties": {
"size": {
"type": "integer",
"description": "The size of the file in bytes."
},
"mimetype": {
"type": "string",
"description": "The mimetype of the file e.g. ``application/msword``."
}
}
},
"thumbnail_url": {
"type": "string",
"description": "The URL to the thumbnail of the file."
},
"thumbnail_info": {
"type": "object",
"title": "ImageInfo",
"description": "Metadata about the image referred to in ``thumbnail_url``.",
"properties": {
"size": {
"type": "integer",
"description": "Size of the image in bytes."
},
"w": {
"type": "integer",
"description": "The width of the image in pixels."
},
"h": {
"type": "integer",
"description": "The height of the image in pixels."
},
"mimetype": {
"type": "string",
"description": "The mimetype of the image, e.g. ``image/jpeg``."
}
}
}
},
"required": ["msgtype", "body", "url", "filename"]
},
"type": {
"type": "string",
"enum": ["m.room.message"]
}
}
}

@ -0,0 +1,83 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "ImageMessage",
"description": "This message represents a single image and an optional thumbnail.",
"allOf": [{
"$ref": "core#/definitions/room_event"
}],
"properties": {
"content": {
"type": "object",
"properties": {
"msgtype": {
"type": "string",
"enum": ["m.image"]
},
"body": {
"type": "string",
"description": "A textual representation of the image. This could be the alt text of the image, the filename of the image, or some kind of content description for accessibility e.g. 'image attachment'."
},
"url": {
"type": "string",
"description": "The URL to the image."
},
"thumbnail_url": {
"type": "string",
"description": "The URL to the thumbnail of the image."
},
"thumbnail_info": {
"type": "object",
"title": "ImageInfo",
"description": "Metadata about the image referred to in ``thumbnail_url``.",
"properties": {
"size": {
"type": "integer",
"description": "Size of the image in bytes."
},
"w": {
"type": "integer",
"description": "The width of the image in pixels."
},
"h": {
"type": "integer",
"description": "The height of the image in pixels."
},
"mimetype": {
"type": "string",
"description": "The mimetype of the image, e.g. ``image/jpeg``."
}
}
},
"info": {
"type": "object",
"title": "ImageInfo",
"description": "Metadata about the image referred to in ``url``.",
"properties": {
"size": {
"type": "integer",
"description": "Size of the image in bytes."
},
"w": {
"type": "integer",
"description": "The width of the image in pixels."
},
"h": {
"type": "integer",
"description": "The height of the image in pixels."
},
"mimetype": {
"type": "string",
"description": "The mimetype of the image, e.g. ``image/jpeg``."
}
}
}
},
"required": ["msgtype", "body", "url"]
},
"type": {
"type": "string",
"enum": ["m.room.message"]
}
}
}

@ -0,0 +1,41 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "LocationMessage",
"description": "This message represents a real-world location.",
"allOf": [{
"$ref": "core#/definitions/room_event"
}],
"properties": {
"content": {
"type": "object",
"properties": {
"msgtype": {
"type": "string",
"enum": ["m.location"]
},
"body": {
"type": "string",
"description": "A description of the location e.g. 'Big Ben, London, UK', or some kind of content description for accessibility e.g. 'location attachment'."
},
"geo_uri": {
"type": "string",
"description": "A geo URI representing this location."
},
"thumbnail_url": {
"type": "string",
"description": "The URL to a thumbnail of the location being represented."
},
"thumbnail_info": {
"type": "object",
"title": "ImageInfo"
}
},
"required": ["msgtype", "body", "geo_uri"]
},
"type": {
"type": "string",
"enum": ["m.room.message"]
}
}
}

@ -0,0 +1,29 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "NoticeMessage",
"description": "A m.notice message should be considered similar to a plain m.text message except that clients should visually distinguish it in some way. It is intended to be used by automated clients, such as bots, bridges, and other entities, rather than humans. Additionally, such automated agents which watch a room for messages and respond to them ought to ignore m.notice messages. This helps to prevent infinite-loop situations where two automated clients continuously exchange messages, as each responds to the other.",
"allOf": [{
"$ref": "core#/definitions/room_event"
}],
"properties": {
"content": {
"type": "object",
"properties": {
"msgtype": {
"type": "string",
"enum": ["m.notice"]
},
"body": {
"type": "string",
"description": "The notice text to send."
}
},
"required": ["msgtype", "body"]
},
"type": {
"type": "string",
"enum": ["m.room.message"]
}
}
}

@ -0,0 +1,29 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "TextMessage",
"description": "This message is the most basic message and is used to represent text.",
"allOf": [{
"$ref": "core#/definitions/room_event"
}],
"properties": {
"content": {
"type": "object",
"properties": {
"msgtype": {
"type": "string",
"enum": ["m.text"]
},
"body": {
"type": "string",
"description": "The body of the message."
}
},
"required": ["msgtype", "body"]
},
"type": {
"type": "string",
"enum": ["m.room.message"]
}
}
}

@ -0,0 +1,68 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "VideoMessage",
"description": "This message represents a single video clip.",
"allOf": [{
"$ref": "core#/definitions/room_event"
}],
"properties": {
"content": {
"type": "object",
"properties": {
"msgtype": {
"type": "string",
"enum": ["m.video"]
},
"body": {
"type": "string",
"description": "A description of the video e.g. 'Gangnam style', or some kind of content description for accessibility e.g. 'video attachment'."
},
"url": {
"type": "string",
"description": "The URL to the video clip."
},
"info": {
"type": "object",
"title": "VideoInfo",
"description": "Metadata about the video clip referred to in ``url``.",
"properties": {
"mimetype": {
"type": "string",
"description": "The mimetype of the video e.g. ``video/mp4``."
},
"size": {
"type": "integer",
"description": "The size of the video in bytes."
},
"duration": {
"type": "integer",
"description": "The duration of the video in milliseconds."
},
"w": {
"type": "integer",
"description": "The width of the video in pixels."
},
"h": {
"type": "integer",
"description": "The height of the video in pixels."
},
"thumbnail_url": {
"type": "string",
"description": "The URL to a thumbnail of the video clip."
},
"thumbnail_info": {
"type": "object",
"title": "ImageInfo"
}
}
}
},
"required": ["msgtype", "body", "url"]
},
"type": {
"type": "string",
"enum": ["m.room.message"]
}
}
}
Loading…
Cancel
Save