SimpleCloudNotifier/server/swagger/swagger.json

1102 lines
36 KiB
JSON
Raw Normal View History

2022-11-13 19:17:07 +01:00
{
"swagger": "2.0",
"info": {
"description": "API for SCN",
"title": "SimpleCloudNotifier API",
"contact": {},
"version": "2.0"
},
"host": "scn.blackforestbytes.com",
2022-11-18 21:25:40 +01:00
"basePath": "/",
2022-11-13 19:17:07 +01:00
"paths": {
2022-11-18 21:25:40 +01:00
"/api-v2/user/": {
"post": {
"summary": "Create a new user",
"operationId": "api-user-create",
"parameters": [
{
"description": " ",
"name": "post_body",
"in": "body",
"schema": {
"$ref": "#/definitions/handler.CreateUser.body"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.UserJSON"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
}
}
}
},
2022-11-18 23:28:37 +01:00
"/api-v2/user/{uid}": {
"get": {
2022-11-19 12:47:23 +01:00
"summary": "Get a user",
2022-11-18 23:28:37 +01:00
"operationId": "api-user-get",
"parameters": [
{
"type": "integer",
"description": "UserID",
"name": "uid",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.UserJSON"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
}
}
},
"patch": {
"description": "The body-values are optional, only send the ones you want to update",
2022-11-19 12:47:23 +01:00
"summary": "(Partially) update a user",
2022-11-18 23:28:37 +01:00
"operationId": "api-user-update",
"parameters": [
{
"description": " ",
"name": "post_body",
"in": "body",
"schema": {
"$ref": "#/definitions/handler.UpdateUser.body"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.UserJSON"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
}
}
}
},
2022-11-19 12:47:23 +01:00
"/api-v2/user/{uid}/clients": {
"get": {
"summary": "List all clients",
"operationId": "api-clients-list",
"parameters": [
{
"type": "integer",
"description": "UserID",
"name": "uid",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.ListClients.result"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
2022-11-19 12:50:41 +01:00
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
}
}
2022-11-19 12:59:25 +01:00
},
"post": {
"summary": "Delete a client",
"operationId": "api-clients-delete",
"parameters": [
{
"type": "integer",
"description": "UserID",
"name": "uid",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "ClientID",
"name": "cid",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.ClientJSON"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
}
}
2022-11-19 12:50:41 +01:00
}
},
"/api-v2/user/{uid}/clients/{cid}": {
"get": {
2022-11-19 12:59:25 +01:00
"summary": "Get a single clients",
2022-11-19 12:50:41 +01:00
"operationId": "api-clients-get",
"parameters": [
{
"type": "integer",
"description": "UserID",
"name": "uid",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "ClientID",
"name": "cid",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.ClientJSON"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
2022-11-19 12:47:23 +01:00
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
}
}
}
},
2022-11-18 21:25:40 +01:00
"/api/ack.php": {
2022-11-13 19:17:07 +01:00
"get": {
"summary": "Acknowledge that a message was received",
"operationId": "compat-ack",
2022-11-13 19:17:07 +01:00
"parameters": [
{
"type": "string",
"description": "the user_id",
"name": "user_id",
"in": "query",
"required": true
},
{
"type": "string",
"description": "the user_key",
"name": "user_key",
"in": "query",
"required": true
},
{
"type": "string",
"description": "the message id",
"name": "scn_msg_id",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.Ack.response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
2022-11-18 21:25:40 +01:00
"$ref": "#/definitions/ginresp.apiError"
2022-11-13 19:17:07 +01:00
}
}
}
}
},
2022-11-18 21:25:40 +01:00
"/api/expand.php": {
2022-11-13 19:17:07 +01:00
"get": {
"summary": "Get a whole (potentially truncated) message",
"operationId": "compat-expand",
2022-11-13 19:17:07 +01:00
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.Expand.response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
2022-11-18 21:25:40 +01:00
"$ref": "#/definitions/ginresp.apiError"
2022-11-13 19:17:07 +01:00
}
}
}
}
},
2022-11-18 21:25:40 +01:00
"/api/info.php": {
2022-11-13 19:17:07 +01:00
"get": {
"summary": "Get information about the current user",
"operationId": "compat-info",
2022-11-13 19:17:07 +01:00
"parameters": [
{
"type": "string",
"description": "the user_id",
"name": "user_id",
"in": "query",
"required": true
},
{
"type": "string",
"description": "the user_key",
"name": "user_key",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.Info.response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
2022-11-18 21:25:40 +01:00
"$ref": "#/definitions/ginresp.apiError"
2022-11-13 19:17:07 +01:00
}
}
}
}
},
2022-11-18 21:25:40 +01:00
"/api/register.php": {
2022-11-13 19:17:07 +01:00
"get": {
"summary": "Register a new account",
"operationId": "compat-register",
2022-11-13 19:17:07 +01:00
"parameters": [
{
"type": "string",
"description": "the (android) fcm token",
"name": "fcm_token",
"in": "query",
"required": true
},
{
"enum": [
"true",
"false"
],
"type": "string",
"description": "if the user is a paid account",
"name": "pro",
"in": "query",
"required": true
},
{
"type": "string",
"description": "the (android) IAP token",
"name": "pro_token",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.Register.response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
2022-11-18 21:25:40 +01:00
"$ref": "#/definitions/ginresp.apiError"
2022-11-13 19:17:07 +01:00
}
}
}
}
},
2022-11-18 21:25:40 +01:00
"/api/requery.php": {
2022-11-13 19:17:07 +01:00
"get": {
"summary": "Return all not-acknowledged messages",
"operationId": "compat-requery",
2022-11-13 19:17:07 +01:00
"parameters": [
{
"type": "string",
"description": "the user_id",
"name": "user_id",
"in": "query",
"required": true
},
{
"type": "string",
"description": "the user_key",
"name": "user_key",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.Requery.response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
2022-11-18 21:25:40 +01:00
"$ref": "#/definitions/ginresp.apiError"
2022-11-13 19:17:07 +01:00
}
}
}
}
},
2022-11-18 21:25:40 +01:00
"/api/update.php": {
2022-11-13 19:17:07 +01:00
"get": {
"summary": "Set the fcm-token (android)",
"operationId": "compat-update",
2022-11-13 19:17:07 +01:00
"parameters": [
{
"type": "string",
"description": "the user_id",
"name": "user_id",
"in": "query",
"required": true
},
{
"type": "string",
"description": "the user_key",
"name": "user_key",
"in": "query",
"required": true
},
{
"type": "string",
"description": "the (android) fcm token",
"name": "fcm_token",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.Update.response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
2022-11-18 21:25:40 +01:00
"$ref": "#/definitions/ginresp.apiError"
2022-11-13 19:17:07 +01:00
}
}
}
}
},
2022-11-18 21:25:40 +01:00
"/api/upgrade.php": {
2022-11-13 19:17:07 +01:00
"get": {
"summary": "Upgrade a free account to a paid account",
"operationId": "compat-upgrade",
2022-11-13 19:17:07 +01:00
"parameters": [
{
"type": "string",
"description": "the user_id",
"name": "user_id",
"in": "query",
"required": true
},
{
"type": "string",
"description": "the user_key",
"name": "user_key",
"in": "query",
"required": true
},
{
"enum": [
"true",
"false"
],
"type": "string",
"description": "if the user is a paid account",
"name": "pro",
"in": "query",
"required": true
},
{
"type": "string",
"description": "the (android) IAP token",
"name": "pro_token",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.Upgrade.response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
2022-11-18 21:25:40 +01:00
"$ref": "#/definitions/ginresp.apiError"
2022-11-13 19:17:07 +01:00
}
}
}
}
2022-11-18 21:25:40 +01:00
},
"/db-test": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.DatabaseTest.response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
}
2022-11-13 19:17:07 +01:00
}
}
},
2022-11-18 21:25:40 +01:00
"/health": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.Health.response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
}
2022-11-13 19:17:07 +01:00
}
}
},
2022-11-18 21:25:40 +01:00
"/ping": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.pingResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
}
}
},
"put": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.pingResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
}
}
},
"post": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.pingResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
}
}
},
"delete": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.pingResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
}
}
},
"patch": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.pingResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
}
}
}
}
},
"definitions": {
"ginresp.apiError": {
2022-11-13 19:17:07 +01:00
"type": "object",
"properties": {
"errhighlight": {
"type": "integer"
},
"error": {
"type": "integer"
},
2022-11-18 21:25:40 +01:00
"errorObject": {},
2022-11-13 19:17:07 +01:00
"message": {
"type": "string"
},
"success": {
"type": "boolean"
}
}
},
"handler.Ack.response": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"new_ack": {
"type": "integer"
},
"prev_ack": {
"type": "integer"
},
"success": {
"type": "string"
}
}
},
2022-11-19 12:59:25 +01:00
"handler.AddClient.body": {
"type": "object",
"properties": {
"agent_model": {
"type": "string"
},
"agent_version": {
"type": "string"
},
"client_type": {
"type": "string"
},
"fcm_token": {
"type": "string"
}
}
},
2022-11-18 21:25:40 +01:00
"handler.CreateUser.body": {
"type": "object",
"properties": {
2022-11-18 23:28:37 +01:00
"agent_model": {
2022-11-18 21:25:40 +01:00
"type": "string"
},
2022-11-18 23:28:37 +01:00
"agent_version": {
2022-11-18 21:25:40 +01:00
"type": "string"
},
2022-11-18 23:28:37 +01:00
"client_type": {
2022-11-18 21:25:40 +01:00
"type": "string"
},
2022-11-18 23:28:37 +01:00
"fcm_token": {
2022-11-18 21:25:40 +01:00
"type": "string"
},
2022-11-18 23:28:37 +01:00
"pro_token": {
2022-11-18 21:25:40 +01:00
"type": "string"
},
"username": {
"type": "string"
}
}
},
2022-11-13 19:17:07 +01:00
"handler.DatabaseTest.response": {
"type": "object",
"properties": {
"libVersion": {
"type": "string"
},
"libVersionNumber": {
"type": "integer"
},
"sourceID": {
"type": "string"
},
"success": {
"type": "boolean"
}
}
},
"handler.Expand.response": {
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.ShortCompatMessage"
},
"message": {
"type": "string"
},
"success": {
"type": "string"
}
}
},
"handler.Health.response": {
"type": "object",
"properties": {
"status": {
"type": "string"
}
}
},
"handler.Info.response": {
"type": "object",
"properties": {
"fcm_token_set": {
"type": "boolean"
},
"is_pro": {
"type": "string"
},
"message": {
"type": "string"
},
"quota": {
"type": "string"
},
"quota_max": {
"type": "string"
},
"success": {
"type": "string"
},
"unack_count": {
"type": "integer"
},
"user_id": {
"type": "string"
},
"user_key": {
"type": "string"
}
}
},
2022-11-19 12:47:23 +01:00
"handler.ListClients.result": {
"type": "object",
"properties": {
"clients": {
"type": "array",
"items": {
"$ref": "#/definitions/models.ClientJSON"
}
}
}
},
2022-11-13 19:17:07 +01:00
"handler.Register.response": {
"type": "object",
"properties": {
"is_pro": {
"type": "integer"
2022-11-13 19:17:07 +01:00
},
"message": {
"type": "string"
},
"quota": {
"type": "integer"
2022-11-13 19:17:07 +01:00
},
"quota_max": {
"type": "integer"
2022-11-13 19:17:07 +01:00
},
"success": {
"type": "boolean"
2022-11-13 19:17:07 +01:00
},
"user_id": {
"type": "string"
},
"user_key": {
"type": "string"
}
}
},
"handler.Requery.response": {
"type": "object",
"properties": {
"count": {
"type": "integer"
},
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.CompatMessage"
}
},
"message": {
"type": "string"
},
"success": {
"type": "string"
}
}
},
"handler.Update.response": {
"type": "object",
"properties": {
"is_pro": {
"type": "string"
},
"message": {
"type": "string"
},
"quota": {
"type": "string"
},
"quota_max": {
"type": "string"
},
"success": {
"type": "string"
},
"user_id": {
"type": "string"
},
"user_key": {
"type": "string"
2022-11-18 23:28:37 +01:00
}
}
},
"handler.UpdateUser.body": {
"type": "object",
"properties": {
"pro_token": {
"type": "string"
},
"username": {
"type": "string"
2022-11-13 19:17:07 +01:00
}
}
},
"handler.Upgrade.response": {
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.ShortCompatMessage"
},
"message": {
"type": "string"
},
"success": {
"type": "string"
}
}
},
"handler.pingResponse": {
"type": "object",
"properties": {
"info": {
"$ref": "#/definitions/handler.pingResponseInfo"
},
"message": {
"type": "string"
}
}
},
"handler.pingResponseInfo": {
"type": "object",
"properties": {
"addr": {
"type": "string"
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
},
"method": {
"type": "string"
},
"request": {
"type": "string"
},
"uri": {
"type": "string"
}
}
},
2022-11-19 12:47:23 +01:00
"models.ClientJSON": {
"type": "object",
"properties": {
"agent_model": {
"type": "string"
},
"agent_version": {
"type": "string"
},
"client_id": {
"type": "integer"
},
"fcm_token": {
"type": "string"
},
"timestamp_created": {
"type": "string"
},
"type": {
"type": "string"
},
"user_id": {
"type": "integer"
}
}
},
2022-11-13 19:17:07 +01:00
"models.CompatMessage": {
"type": "object",
"properties": {
"body": {
"type": "string"
},
"priority": {
"type": "integer"
},
"scn_msg_id": {
"type": "string"
},
"timestamp": {
"type": "integer"
},
"title": {
"type": "string"
},
"usr_msg_id": {
"type": "string"
}
}
},
"models.ShortCompatMessage": {
"type": "object",
"properties": {
"body": {
"type": "string"
},
"priority": {
"type": "integer"
},
"scn_msg_id": {
"type": "string"
},
"timestamp": {
"type": "integer"
},
"title": {
"type": "string"
},
"trimmed": {
"type": "boolean"
},
"usr_msg_id": {
"type": "string"
}
}
2022-11-18 21:25:40 +01:00
},
"models.UserJSON": {
"type": "object",
"properties": {
"admin_key": {
"type": "string"
},
"is_pro": {
"type": "boolean"
},
"messages_sent": {
"type": "integer"
},
"quota_day": {
"type": "string"
},
"quota_today": {
"type": "integer"
},
"read_key": {
"type": "string"
},
"send_key": {
"type": "string"
},
"timestamp_created": {
"type": "string"
},
"timestamp_last_read": {
"type": "string"
},
"timestamp_last_sent": {
"type": "string"
},
"user_id": {
"type": "integer"
},
"username": {
"type": "string"
}
}
2022-11-13 19:17:07 +01:00
}
}
}