Files
matterbridge/docs/swagger/swagger.json
2018-11-29 04:32:58 +08:00

187 lines
6.1 KiB
JSON

{
"swagger": "2.0",
"info": {
"description": "A read/write API for the Matterbridge chat bridge.",
"title": "Matterbridge API",
"contact": {},
"license": {
"name": "Apache 2.0",
"url": "https://github.com/42wim/matterbridge/blob/master/LICENSE"
}
},
"basePath": "/api",
"paths": {
"/health": {
"get": {
"summary": "Checks if the server is alive.",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
}
}
}
},
"/message": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Required fields: text, gateway. Optional fields: username, avatar.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "Create/Update a message",
"parameters": [
{
"description": "Message object to create",
"name": "message",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/config.Message"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"$ref": "#/definitions/config.Message"
}
}
}
}
},
"/messages": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
"summary": "List new messages",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/config.Message"
}
}
}
}
}
},
"/stream": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/x-json-stream"
],
"summary": "Stream realtime messages",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"$ref": "#/definitions/config.Message"
}
}
}
}
}
},
"definitions": {
"config.Message": {
"type": "object",
"properties": {
"account": {
"description": "Unique account name of format \"[protocol].[slug]\"\n",
"type": "string",
"example": "slack.myteam"
},
"avatar": {
"description": "URL to an avatar image\n",
"type": "string",
"example": "https://secure.gravatar.com/avatar/1234567890abcdef1234567890abcdef.jpg"
},
"channel": {
"description": "Human-readable channel name\n",
"type": "string",
"example": "test-channel"
},
"event": {
"description": "Can be blank.\n",
"type": "string"
},
"extra": {
"description": "Extra data that doesn't fit in other fields. Used for processing incoming messages.\n",
"type": "object"
},
"gateway": {
"description": "Name of the gateway\n",
"type": "string",
"example": "test-channel-gateway"
},
"id": {
"description": "Unique ID of message on the gateway\n",
"type": "string",
"example": "slack 1541361213.030700"
},
"parent_id": {
"description": "Unique ID of a parent message, if threaded\n",
"type": "string"
},
"protocol": {
"description": "Chat protocol of incoming message\n",
"type": "string",
"example": "slack"
},
"text": {
"description": "Content of the message\n",
"type": "string",
"example": "Testing, testing, 1-2-3."
},
"timestamp": {
"type": "string",
"example": "1541361213.030700"
},
"userid": {
"description": "userid on the bridge\n",
"type": "string",
"example": "U4MCXJKNC"
},
"username": {
"description": "Human-readable username\n",
"type": "string",
"example": "alice"
}
}
}
},
"securityDefinitions": {
"ApiKeyAuth": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}