From abe2035d8518d334910024cbf20f0917781d317e Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 27 Aug 2014 15:41:19 +0100 Subject: [PATCH] api docs: Finished adding all C-S APIs. Added initialSync, publicRooms, membership changes (generic and RPCy) and directory paths. --- docs/client-server/swagger_matrix/api-docs | 4 + docs/client-server/swagger_matrix/directory | 83 ++++++++++ docs/client-server/swagger_matrix/events | 134 ++++++++++++++++ docs/client-server/swagger_matrix/rooms | 163 +++++++++++++------- 4 files changed, 331 insertions(+), 53 deletions(-) create mode 100644 docs/client-server/swagger_matrix/directory diff --git a/docs/client-server/swagger_matrix/api-docs b/docs/client-server/swagger_matrix/api-docs index e52d4ee69..58462a906 100644 --- a/docs/client-server/swagger_matrix/api-docs +++ b/docs/client-server/swagger_matrix/api-docs @@ -25,6 +25,10 @@ { "path": "/events", "description": "Event operations" + }, + { + "path": "/directory", + "description": "Directory operations" } ], "authorizations": { diff --git a/docs/client-server/swagger_matrix/directory b/docs/client-server/swagger_matrix/directory new file mode 100644 index 000000000..3f3bef9c1 --- /dev/null +++ b/docs/client-server/swagger_matrix/directory @@ -0,0 +1,83 @@ +{ + "apiVersion": "1.0.0", + "swaggerVersion": "1.2", + "basePath": "http://localhost:8080/matrix/client/api/v1", + "resourcePath": "/directory", + "produces": [ + "application/json" + ], + "apis": [ + { + "path": "/directory/room/{roomAlias}", + "operations": [ + { + "method": "GET", + "summary": "Get the room ID corresponding to this room alias.", + "type": "DirectoryResponse", + "nickname": "get_room_id_for_alias", + "parameters": [ + { + "name": "roomAlias", + "description": "The room alias.", + "required": true, + "type": "string", + "paramType": "path" + } + ] + }, + { + "method": "PUT", + "summary": "Create a new mapping from room alias to room ID.", + "type": "void", + "nickname": "add_room_alias", + "parameters": [ + { + "name": "roomAlias", + "description": "The room alias to set.", + "required": true, + "type": "string", + "paramType": "path" + }, + { + "name": "body", + "description": "The room ID to set.", + "required": true, + "type": "RoomAliasRequest", + "paramType": "body" + } + ] + } + ] + } + ], + "models": { + "DirectoryResponse": { + "id": "DirectoryResponse", + "properties": { + "room_id": { + "type": "string", + "description": "The fully-qualified room ID.", + "required": true + }, + "servers": { + "type": "array", + "items": { + "$ref": "string" + }, + "description": "A list of servers that know about this room.", + "required": true + } + } + }, + "RoomAliasRequest": { + "id": "RoomAliasRequest", + "properties": { + "room_id": { + "type": "string", + "description": "The room ID to map the alias to.", + "required": true + } + } + } + } +} diff --git a/docs/client-server/swagger_matrix/events b/docs/client-server/swagger_matrix/events index e8b96861f..ca69d34db 100644 --- a/docs/client-server/swagger_matrix/events +++ b/docs/client-server/swagger_matrix/events @@ -67,6 +67,38 @@ ] } ] + }, + { + "path": "/initialSync", + "operations": [ + { + "method": "GET", + "summary": "Get this user's current state.", + "notes": "Get this user's current state.", + "type": "InitialSyncResponse", + "nickname": "initial_sync", + "parameters": [ + { + "name": "limit", + "description": "The maximum number of messages to return for each room.", + "type": "integer", + "paramType": "query", + "required": false + } + ] + } + ] + }, + { + "path": "/publicRooms", + "operations": [ + { + "method": "GET", + "summary": "Get a list of publicly visible rooms.", + "type": "PublicRoomsPaginationChunk", + "nickname": "get_public_room_list" + } + ] } ], "models": { @@ -107,6 +139,108 @@ "required": true } } + }, + "PublicRoomInfo": { + "id": "PublicRoomInfo", + "properties": { + "aliases": { + "type": "array", + "description": "A list of room aliases for this room.", + "items": { + "$ref": "string" + } + }, + "name": { + "type": "string", + "description": "The name of the room, as given by the m.room.name state event." + }, + "room_id": { + "type": "string", + "description": "The room ID for this public room.", + "required": true + }, + "topic": { + "type": "string", + "description": "The topic of this room, as given by the m.room.topic state event." + } + } + }, + "PublicRoomsPaginationChunk": { + "id": "PublicRoomsPaginationChunk", + "properties": { + "start": { + "type": "string", + "description": "A token which correlates to the first value in \"chunk\" for paginating.", + "required": true + }, + "end": { + "type": "string", + "description": "A token which correlates to the last value in \"chunk\" for paginating.", + "required": true + }, + "chunk": { + "type": "array", + "description": "A list of public room data.", + "required": true, + "items": { + "$ref": "PublicRoomInfo" + } + } + } + }, + "InitialSyncResponse": { + "id": "InitialSyncResponse", + "properties": { + "end": { + "type": "string", + "description": "A streaming token which can be used with /events to continue from this snapshot of data.", + "required": true + }, + "presence": { + "type": "array", + "description": "A list of presence events.", + "items": { + "$ref": "Event" + }, + "required": false + }, + "rooms": { + "type": "array", + "description": "A list of initial sync room data.", + "required": false, + "items": { + "$ref": "InitialSyncRoomData" + } + } + } + }, + "InitialSyncRoomData": { + "id": "InitialSyncRoomData", + "properties": { + "membership": { + "type": "string", + "description": "This user's membership state in this room.", + "required": true + }, + "room_id": { + "type": "string", + "description": "The ID of this room.", + "required": true + }, + "messages": { + "type": "PaginationChunk", + "description": "The most recent messages for this room, governed by the limit parameter.", + "required": false + }, + "state": { + "type": "array", + "description": "A list of state events representing the current state of the room.", + "required": false, + "items": { + "$ref": "Event" + } + } + } } } } diff --git a/docs/client-server/swagger_matrix/rooms b/docs/client-server/swagger_matrix/rooms index 7a2b5399a..1ead8b8c1 100644 --- a/docs/client-server/swagger_matrix/rooms +++ b/docs/client-server/swagger_matrix/rooms @@ -148,19 +148,108 @@ } ] }, - - - - - - - - - - - { - "path": "/rooms/{roomId}/members/{userId}/state", + "path": "/rooms/{roomId}/invite/{txnId}", + "operations": [ + { + "method": "PUT", + "summary": "Invite a user to this room.", + "notes": "This operation can also be done as a POST to /rooms/{roomId}/invite", + "type": "void", + "nickname": "invite", + "consumes": [ + "application/json" + ], + "parameters": [ + { + "name": "roomId", + "description": "The room which has this user.", + "required": true, + "type": "string", + "paramType": "path" + }, + { + "name": "txnId", + "description": "A client transaction ID for this PUT to ensure idempotency. This can only be omitted if the HTTP method becomes a POST. ", + "required": false, + "type": "string", + "paramType": "path" + }, + { + "name": "body", + "description": "The user to invite.", + "required": true, + "type": "InviteRequest", + "paramType": "body" + } + ] + } + ] + }, + { + "path": "/rooms/{roomId}/join/{txnId}", + "operations": [ + { + "method": "PUT", + "summary": "Join this room.", + "notes": "This operation can also be done as a POST to /rooms/{roomId}/join", + "type": "void", + "nickname": "join_room", + "consumes": [ + "application/json" + ], + "parameters": [ + { + "name": "roomId", + "description": "The room to join.", + "required": true, + "type": "string", + "paramType": "path" + }, + { + "name": "txnId", + "description": "A client transaction ID for this PUT to ensure idempotency. This can only be omitted if the HTTP method becomes a POST. ", + "required": false, + "type": "string", + "paramType": "path" + } + ] + } + ] + }, + { + "path": "/rooms/{roomId}/leave/{txnId}", + "operations": [ + { + "method": "PUT", + "summary": "Leave this room.", + "notes": "This operation can also be done as a POST to /rooms/{roomId}/leave", + "type": "void", + "nickname": "leave", + "consumes": [ + "application/json" + ], + "parameters": [ + { + "name": "roomId", + "description": "The room to leave.", + "required": true, + "type": "string", + "paramType": "path" + }, + { + "name": "txnId", + "description": "A client transaction ID for this PUT to ensure idempotency. This can only be omitted if the HTTP method becomes a POST. ", + "required": false, + "type": "string", + "paramType": "path" + } + ] + } + ] + }, + { + "path": "/rooms/{roomId}/state/m.room.member/{userId}", "operations": [ { "method": "PUT", @@ -249,50 +338,9 @@ "message": "Member not found." } ] - }, - { - "method": "DELETE", - "summary": "Leave a room.", - "notes": "Leave a room.", - "type": "void", - "nickname": "remove_membership", - "parameters": [ - { - "name": "userId", - "description": "The user who is leaving.", - "required": true, - "type": "string", - "paramType": "path" - }, - { - "name": "roomId", - "description": "The room which has this user.", - "required": true, - "type": "string", - "paramType": "path" - } - ], - "responseMessages": [ - { - "code": 403, - "message": "You are not in the room." - }, - { - "code": 403, - "message": "Cannot force another user to leave." - } - ] } ] }, - - - - - - - - { "path": "/join/{roomAliasOrId}", "operations": [ @@ -613,6 +661,15 @@ "type": "Member" } } + }, + "InviteRequest": { + "id": "InviteRequest", + "properties": { + "user_id": { + "type": "string", + "description": "The fully-qualified user ID." + } + } } } }