Updated swagger JSON: cleaned up unused entries. Converted most paths to the new format.

This commit is contained in:
Kegan Dougal 2014-08-27 12:14:26 +01:00
parent 6c609425ba
commit 71095f4e6e
4 changed files with 115 additions and 487 deletions

View file

@ -21,6 +21,10 @@
{ {
"path": "/presence", "path": "/presence",
"description": "Presence operations" "description": "Presence operations"
},
{
"path": "/events",
"description": "Event operations"
} }
], ],
"authorizations": { "authorizations": {

View file

@ -1,256 +1,68 @@
{ {
"apiVersion": "1.0.0", "apiVersion": "1.0.0",
"swaggerVersion": "1.2", "swaggerVersion": "1.2",
"basePath": "http://petstore.swagger.wordnik.com/api", "basePath": "http://localhost:8080/matrix/client/api/v1",
"resourcePath": "/user", "resourcePath": "/events",
"produces": [ "produces": [
"application/json" "application/json"
], ],
"apis": [ "apis": [
{ {
"path": "/user", "path": "/events",
"operations": [
{
"method": "POST",
"summary": "Create user",
"notes": "This can only be done by the logged in user.",
"type": "void",
"nickname": "createUser",
"authorizations": {
"oauth2": [
{
"scope": "test:anything",
"description": "anything"
}
]
},
"parameters": [
{
"name": "body",
"description": "Created user object",
"required": true,
"type": "User",
"paramType": "body"
}
]
}
]
},
{
"path": "/user/logout",
"operations": [ "operations": [
{ {
"method": "GET", "method": "GET",
"summary": "Logs out current logged in user session", "summary": "Listen on the event stream",
"notes": "", "notes": "This can only be done by the logged in user. This will block until an event is received, or until the timeout is reached.",
"type": "void", "type": "PaginationChunk",
"nickname": "logoutUser", "nickname": "get_event_stream"
"authorizations": {},
"parameters": []
} }
] ],
}, "parameters": [
{
"path": "/user/createWithArray",
"operations": [
{ {
"method": "POST", "name": "from",
"summary": "Creates list of users with given input array", "description": "The token to stream from.",
"notes": "", "required": false,
"type": "void",
"nickname": "createUsersWithArrayInput",
"authorizations": {
"oauth2": [
{
"scope": "test:anything",
"description": "anything"
}
]
},
"parameters": [
{
"name": "body",
"description": "List of user object",
"required": true,
"type": "array",
"items": {
"$ref": "User"
},
"paramType": "body"
}
]
}
]
},
{
"path": "/user/createWithList",
"operations": [
{
"method": "POST",
"summary": "Creates list of users with given list input",
"notes": "",
"type": "void",
"nickname": "createUsersWithListInput",
"authorizations": {
"oauth2": [
{
"scope": "test:anything",
"description": "anything"
}
]
},
"parameters": [
{
"name": "body",
"description": "List of user object",
"required": true,
"type": "array",
"items": {
"$ref": "User"
},
"paramType": "body"
}
]
}
]
},
{
"path": "/user/{username}",
"operations": [
{
"method": "PUT",
"summary": "Updated user",
"notes": "This can only be done by the logged in user.",
"type": "void",
"nickname": "updateUser",
"authorizations": {
"oauth2": [
{
"scope": "test:anything",
"description": "anything"
}
]
},
"parameters": [
{
"name": "username",
"description": "name that need to be deleted",
"required": true,
"type": "string",
"paramType": "path"
},
{
"name": "body",
"description": "Updated user object",
"required": true,
"type": "User",
"paramType": "body"
}
],
"responseMessages": [
{
"code": 400,
"message": "Invalid username supplied"
},
{
"code": 404,
"message": "User not found"
}
]
},
{
"method": "DELETE",
"summary": "Delete user",
"notes": "This can only be done by the logged in user.",
"type": "void",
"nickname": "deleteUser",
"authorizations": {
"oauth2": [
{
"scope": "test:anything",
"description": "anything"
}
]
},
"parameters": [
{
"name": "username",
"description": "The name that needs to be deleted",
"required": true,
"type": "string",
"paramType": "path"
}
],
"responseMessages": [
{
"code": 400,
"message": "Invalid username supplied"
},
{
"code": 404,
"message": "User not found"
}
]
},
{
"method": "GET",
"summary": "Get user by user name",
"notes": "",
"type": "User",
"nickname": "getUserByName",
"authorizations": {},
"parameters": [
{
"name": "username",
"description": "The name that needs to be fetched. Use user1 for testing.",
"required": true,
"type": "string",
"paramType": "path"
}
],
"responseMessages": [
{
"code": 400,
"message": "Invalid username supplied"
},
{
"code": 404,
"message": "User not found"
}
]
}
]
},
{
"path": "/user/login",
"operations": [
{
"method": "GET",
"summary": "Logs user into the system",
"notes": "",
"type": "string", "type": "string",
"nickname": "loginUser", "paramType": "query"
"authorizations": {}, },
{
"name": "timeout",
"description": "The maximum time in milliseconds to wait for an event.",
"required": false,
"type": "integer",
"paramType": "query"
}
],
"responseMessages": [
{
"code": 400,
"message": "Bad pagination token."
}
]
},
{
"path": "/events/{eventId}",
"operations": [
{
"method": "GET",
"summary": "Get information about a single event.",
"notes": "Get information about a single event.",
"type": "Event",
"nickname": "get_event",
"parameters": [ "parameters": [
{ {
"name": "username", "name": "eventId",
"description": "The user name for login", "description": "The event ID to get.",
"required": true, "required": true,
"type": "string", "type": "string",
"paramType": "query" "paramType": "path"
},
{
"name": "password",
"description": "The password for login in clear text",
"required": true,
"type": "string",
"paramType": "query"
} }
], ],
"responseMessages": [ "responseMessages": [
{ {
"code": 400, "code": 404,
"message": "Invalid username and password combination" "message": "Event not found."
} }
] ]
} }
@ -258,40 +70,41 @@
} }
], ],
"models": { "models": {
"User": { "PaginationChunk": {
"id": "User", "id": "PaginationChunk",
"properties": { "properties": {
"id": { "start": {
"type": "integer", "type": "string",
"format": "int64" "description": "A token which correlates to the first value in \"chunk\" for paginating.",
"required": true
}, },
"firstName": { "end": {
"type": "string" "type": "string",
"description": "A token which correlates to the last value in \"chunk\" for paginating.",
"required": true
}, },
"username": { "chunk": {
"type": "string" "type": "array",
"description": "An array of events.",
"required": true,
"items": {
"$ref": "Event"
}
}
}
},
"Event": {
"id": "Event",
"properties": {
"event_id": {
"type": "string",
"description": "An ID which uniquely identifies this event.",
"required": true
}, },
"lastName": { "room_id": {
"type": "string" "type": "string",
}, "description": "The room in which this event occurred.",
"email": { "required": true
"type": "string"
},
"password": {
"type": "string"
},
"phone": {
"type": "string"
},
"userStatus": {
"type": "integer",
"format": "int32",
"description": "User Status",
"enum": [
"1-registered",
"2-active",
"3-closed"
]
} }
} }
} }

View file

@ -55,7 +55,7 @@
] ]
}, },
{ {
"path": "/presence_list/{userId}", "path": "/presence/list/{userId}",
"operations": [ "operations": [
{ {
"method": "GET", "method": "GET",

View file

@ -14,7 +14,7 @@
}, },
"apis": [ "apis": [
{ {
"path": "/rooms/{roomId}/messages/{userId}/{messageId}", "path": "/rooms/{roomId}/send/m.room.message/{txnId}",
"operations": [ "operations": [
{ {
"method": "PUT", "method": "PUT",
@ -41,67 +41,18 @@
"paramType": "path" "paramType": "path"
}, },
{ {
"name": "userId", "name": "txnId",
"description": "The fully qualified message sender's user ID.", "description": "A client transaction ID to ensure idempotency.",
"required": true, "required": true,
"type": "string", "type": "string",
"paramType": "path" "paramType": "path"
},
{
"name": "messageId",
"description": "A message ID which is unique for each room and user.",
"required": true,
"type": "string",
"paramType": "path"
}
],
"responseMessages": [
{
"code": 403,
"message": "Must send messages as yourself."
}
]
},
{
"method": "GET",
"summary": "Get a message from this room.",
"notes": "Get a message from this room.",
"type": "Message",
"nickname": "get_message",
"parameters": [
{
"name": "roomId",
"description": "The room to send the message in.",
"required": true,
"type": "string",
"paramType": "path"
},
{
"name": "userId",
"description": "The fully qualified message sender's user ID.",
"required": true,
"type": "string",
"paramType": "path"
},
{
"name": "messageId",
"description": "A message ID which is unique for each room and user.",
"required": true,
"type": "string",
"paramType": "path"
}
],
"responseMessages": [
{
"code": 404,
"message": "Message not found."
} }
] ]
} }
] ]
}, },
{ {
"path": "/rooms/{roomId}/topic", "path": "/rooms/{roomId}/state/m.room.topic",
"operations": [ "operations": [
{ {
"method": "PUT", "method": "PUT",
@ -127,12 +78,6 @@
"type": "string", "type": "string",
"paramType": "path" "paramType": "path"
} }
],
"responseMessages": [
{
"code": 403,
"message": "Must send messages as yourself."
}
] ]
}, },
{ {
@ -160,7 +105,7 @@
] ]
}, },
{ {
"path": "/rooms/{roomId}/messages/{msgSenderId}/{messageId}/feedback/{senderId}/{feedbackType}", "path": "/rooms/{roomId}/send/m.room.message.feedback/{txnId}",
"operations": [ "operations": [
{ {
"method": "PUT", "method": "PUT",
@ -187,105 +132,33 @@
"paramType": "path" "paramType": "path"
}, },
{ {
"name": "msgSenderId", "name": "txnId",
"description": "The fully qualified message sender's user ID.", "description": "A client transaction ID to ensure idempotency.",
"required": true, "required": true,
"type": "string", "type": "string",
"paramType": "path" "paramType": "path"
},
{
"name": "messageId",
"description": "A message ID which is unique for each room and user.",
"required": true,
"type": "string",
"paramType": "path"
},
{
"name": "senderId",
"description": "The fully qualified feedback sender's user ID.",
"required": true,
"type": "string",
"paramType": "path"
},
{
"name": "feedbackType",
"description": "The type of feedback being sent.",
"required": true,
"type": "string",
"paramType": "path",
"enum": [
"d",
"r"
]
} }
], ],
"responseMessages": [ "responseMessages": [
{
"code": 403,
"message": "Must send feedback as yourself."
},
{ {
"code": 400, "code": 400,
"message": "Bad feedback type." "message": "Bad feedback type."
} }
] ]
},
{
"method": "GET",
"summary": "Get feedback for a message.",
"notes": "Get feedback for a message.",
"type": "Feedback",
"nickname": "get_feedback",
"parameters": [
{
"name": "roomId",
"description": "The room to send the message in.",
"required": true,
"type": "string",
"paramType": "path"
},
{
"name": "msgSenderId",
"description": "The fully qualified message sender's user ID.",
"required": true,
"type": "string",
"paramType": "path"
},
{
"name": "messageId",
"description": "A message ID which is unique for each room and user.",
"required": true,
"type": "string",
"paramType": "path"
},
{
"name": "senderId",
"description": "The fully qualified feedback sender's user ID.",
"required": true,
"type": "string",
"paramType": "path"
},
{
"name": "feedbackType",
"description": "Enum: The type of feedback being sent.",
"required": true,
"type": "string",
"paramType": "path",
"enum": [
"d",
"r"
]
}
],
"responseMessages": [
{
"code": 404,
"message": "Feedback not found."
}
]
} }
] ]
}, },
{ {
"path": "/rooms/{roomId}/members/{userId}/state", "path": "/rooms/{roomId}/members/{userId}/state",
"operations": [ "operations": [
@ -412,22 +285,30 @@
} }
] ]
}, },
{ {
"path": "/join/{roomAlias}", "path": "/join/{roomAliasOrId}",
"operations": [ "operations": [
{ {
"method": "PUT", "method": "PUT",
"summary": "Join a room via a room alias.", "summary": "Join a room via a room alias or room ID.",
"notes": "Join a room via a room alias.", "notes": "Join a room via a room alias or room ID.",
"type": "RoomInfo", "type": "RoomInfo",
"nickname": "join_room_via_alias", "nickname": "join",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
"parameters": [ "parameters": [
{ {
"name": "roomAlias", "name": "roomAliasOrId",
"description": "The room alias to join.", "description": "The room alias or room ID to join.",
"required": true, "required": true,
"type": "string", "type": "string",
"paramType": "path" "paramType": "path"
@ -443,7 +324,7 @@
] ]
}, },
{ {
"path": "/rooms", "path": "/createRoom",
"operations": [ "operations": [
{ {
"method": "POST", "method": "POST",
@ -477,7 +358,7 @@
] ]
}, },
{ {
"path": "/rooms/{roomId}/messages/list", "path": "/rooms/{roomId}/messages",
"operations": [ "operations": [
{ {
"method": "GET", "method": "GET",
@ -519,7 +400,7 @@
] ]
}, },
{ {
"path": "/rooms/{roomId}/members/list", "path": "/rooms/{roomId}/members",
"operations": [ "operations": [
{ {
"method": "GET", "method": "GET",
@ -732,76 +613,6 @@
"type": "Member" "type": "Member"
} }
} }
},
"Tag": {
"id": "Tag",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
}
},
"Pet": {
"id": "Pet",
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "integer",
"format": "int64",
"description": "unique identifier for the pet",
"minimum": "0.0",
"maximum": "100.0"
},
"category": {
"$ref": "Category"
},
"name": {
"type": "string"
},
"photoUrls": {
"type": "array",
"items": {
"type": "string"
}
},
"tags": {
"type": "array",
"items": {
"$ref": "Tag"
}
},
"status": {
"type": "string",
"description": "pet status in the store",
"enum": [
"available",
"pending",
"sold"
]
}
}
},
"Category": {
"id": "Category",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"pet": {
"$ref": "Pet"
}
}
} }
} }
} }