sharded-gotify/docs/spec.json

1217 lines
27 KiB
JSON

{
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"schemes": [
"http",
"https"
],
"swagger": "2.0",
"info": {
"description": "This is the documentation of the Gotify REST-API.",
"title": "Gotify REST-API.",
"contact": {
"url": "https://github.com/gotify/server/issues"
},
"license": {
"name": "MIT",
"url": "https://github.com/gotify/server/blob/master/LICENSE"
},
"version": "1.0.0"
},
"host": "localhost",
"paths": {
"/application": {
"get": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"token"
],
"summary": "Return all applications.",
"operationId": "getApps",
"responses": {
"200": {
"description": "Ok",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Application"
}
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"post": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"token"
],
"summary": "Create an application.",
"operationId": "createApp",
"parameters": [
{
"description": "the application to add",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Application"
}
}
],
"responses": {
"200": {
"description": "Ok",
"schema": {
"$ref": "#/definitions/Application"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/application/{id}": {
"delete": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"token"
],
"summary": "Delete an application.",
"operationId": "deleteApp",
"parameters": [
{
"type": "string",
"description": "the application id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Ok"
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/application/{id}/message": {
"get": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"message"
],
"summary": "Return all messages from a specific application.",
"operationId": "getAppMessages",
"parameters": [
{
"type": "string",
"description": "the application id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Ok",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Message"
}
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"delete": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"message"
],
"summary": "Delete all messages from a specific application.",
"operationId": "deleteAppMessages",
"parameters": [
{
"type": "string",
"description": "the application id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Ok"
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/client": {
"get": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"token"
],
"summary": "Return all clients.",
"operationId": "getClients",
"responses": {
"200": {
"description": "Ok",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Client"
}
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"post": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"token"
],
"summary": "Create a client.",
"operationId": "createClient",
"parameters": [
{
"description": "the client to add",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Client"
}
}
],
"responses": {
"200": {
"description": "Ok",
"schema": {
"$ref": "#/definitions/Client"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/client/{id}": {
"delete": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"token"
],
"summary": "Delete a client.",
"operationId": "deleteClient",
"parameters": [
{
"type": "string",
"description": "the client id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Ok"
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/current/user": {
"get": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Return the current user.",
"operationId": "currentUser",
"responses": {
"200": {
"description": "Ok",
"schema": {
"$ref": "#/definitions/User"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/current/user/password": {
"post": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Update the password of the current user.",
"operationId": "updateCurrentUser",
"parameters": [
{
"description": "the user",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/User"
}
}
],
"responses": {
"200": {
"description": "Ok"
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/message": {
"get": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"message"
],
"summary": "Return all messages.",
"operationId": "getMessages",
"responses": {
"200": {
"description": "Ok",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Message"
}
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"post": {
"security": [
{
"appTokenHeader": []
},
{
"appTokenQuery": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"message"
],
"summary": "Create a message.",
"operationId": "createMessage",
"parameters": [
{
"description": "the message to add",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Message"
}
}
],
"responses": {
"200": {
"description": "Ok",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Message"
}
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"delete": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"message"
],
"summary": "Delete all messages.",
"operationId": "deleteMessages",
"responses": {
"200": {
"description": "Ok"
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/message/{id}": {
"delete": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"message"
],
"summary": "Deletes a message with an id.",
"operationId": "deleteMessage",
"parameters": [
{
"type": "integer",
"description": "the message id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Ok"
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/stream": {
"get": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"message"
],
"summary": "Websocket, return newly created messages.",
"operationId": "streamMessages",
"responses": {
"200": {
"description": "Ok",
"schema": {
"$ref": "#/definitions/Message"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/user": {
"get": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Return all users.",
"operationId": "getUsers",
"responses": {
"200": {
"description": "Ok",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/User"
}
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"post": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Create a user.",
"operationId": "createUser",
"parameters": [
{
"description": "the user to add",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/User"
}
}
],
"responses": {
"200": {
"description": "Ok",
"schema": {
"$ref": "#/definitions/User"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/user/{id}": {
"get": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Get a user.",
"operationId": "getUser",
"parameters": [
{
"type": "integer",
"description": "the user id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Ok",
"schema": {
"$ref": "#/definitions/User"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"post": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Update a user.",
"operationId": "updateUser",
"parameters": [
{
"type": "integer",
"description": "the user id",
"name": "id",
"in": "path",
"required": true
},
{
"description": "the updated user",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/User"
}
}
],
"responses": {
"200": {
"description": "Ok",
"schema": {
"$ref": "#/definitions/User"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"delete": {
"security": [
{
"clientTokenHeader": []
},
{
"clientTokenQuery": []
},
{
"basicAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Deletes a user.",
"operationId": "deleteUser",
"parameters": [
{
"type": "integer",
"description": "the user id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Ok"
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/version": {
"get": {
"produces": [
"application/json"
],
"tags": [
"version"
],
"summary": "Get version information.",
"operationId": "getVersion",
"responses": {
"200": {
"description": "Ok",
"schema": {
"$ref": "#/definitions/VersionInfo"
}
}
}
}
}
},
"definitions": {
"Application": {
"description": "The Application holds information about an app which can send notifications.",
"type": "object",
"title": "Application Model",
"properties": {
"description": {
"type": "string",
"x-go-name": "Description"
},
"id": {
"type": "string",
"x-go-name": "ID"
},
"name": {
"type": "string",
"x-go-name": "Name"
}
},
"x-go-package": "github.com/gotify/server/model"
},
"Client": {
"description": "The Client holds information about a device which can receive notifications (and other stuff).",
"type": "object",
"title": "Client Model",
"properties": {
"id": {
"type": "string",
"x-go-name": "ID"
},
"name": {
"type": "string",
"x-go-name": "Name"
}
},
"x-go-package": "github.com/gotify/server/model"
},
"Error": {
"description": "The Error contains error relevant information.",
"type": "object",
"title": "Error Model",
"properties": {
"error": {
"type": "string",
"x-go-name": "Error"
},
"errorCode": {
"type": "integer",
"format": "int64",
"x-go-name": "ErrorCode"
},
"errorDescription": {
"type": "string",
"x-go-name": "ErrorDescription"
}
},
"x-go-package": "github.com/gotify/server/model"
},
"Message": {
"description": "The Message holds information about a message which was sent by an Application.",
"type": "object",
"title": "Message Model",
"properties": {
"appid": {
"type": "string",
"x-go-name": "ApplicationID"
},
"date": {
"type": "string",
"format": "date-time",
"x-go-name": "Date"
},
"id": {
"type": "integer",
"format": "uint64",
"x-go-name": "ID"
},
"message": {
"type": "string",
"x-go-name": "Message"
},
"priority": {
"type": "integer",
"format": "int64",
"x-go-name": "Priority"
},
"title": {
"type": "string",
"x-go-name": "Title"
}
},
"x-go-package": "github.com/gotify/server/model"
},
"User": {
"description": "The User holds information about the credentials and other stuff.",
"type": "object",
"title": "UserExternal Model",
"properties": {
"admin": {
"type": "boolean",
"x-go-name": "Admin"
},
"id": {
"type": "integer",
"format": "uint64",
"x-go-name": "ID"
},
"name": {
"type": "string",
"x-go-name": "Name"
},
"pass": {
"type": "string",
"x-go-name": "Pass"
}
},
"x-go-name": "UserExternal",
"x-go-package": "github.com/gotify/server/model"
},
"VersionInfo": {
"description": "VersionInfo Model",
"type": "object",
"properties": {
"branch": {
"type": "string",
"x-go-name": "Branch"
},
"buildDate": {
"type": "string",
"x-go-name": "BuildDate"
},
"commit": {
"type": "string",
"x-go-name": "Commit"
},
"version": {
"type": "string",
"x-go-name": "Version"
}
},
"x-go-package": "github.com/gotify/server/model"
}
},
"securityDefinitions": {
"appTokenHeader": {
"type": "apiKey",
"name": "X-Gotify-Key",
"in": "header"
},
"appTokenQuery": {
"type": "apiKey",
"name": "token",
"in": "query"
},
"basicAuth": {
"type": "basic"
},
"clientTokenHeader": {
"type": "apiKey",
"name": "X-Gotify-Key",
"in": "header"
},
"clientTokenQuery": {
"type": "apiKey",
"name": "token",
"in": "query"
}
}
}