POST:/users works

This commit is contained in:
2022-11-18 21:25:40 +01:00
parent 34a27d9ca4
commit 5991631bfa
44 changed files with 2131 additions and 737 deletions

View File

@@ -7,9 +7,45 @@
"version": "2.0"
},
"host": "scn.blackforestbytes.com",
"basePath": "/api/",
"basePath": "/",
"paths": {
"/ack.php": {
"/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"
}
}
}
}
},
"/api/ack.php": {
"get": {
"summary": "Acknowledge that a message was received",
"operationId": "compat-ack",
@@ -46,31 +82,13 @@
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.internAPIError"
"$ref": "#/definitions/ginresp.apiError"
}
}
}
}
},
"/db-test": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.DatabaseTest.response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.errBody"
}
}
}
}
},
"/expand.php": {
"/api/expand.php": {
"get": {
"summary": "Get a whole (potentially truncated) message",
"operationId": "compat-expand",
@@ -84,31 +102,13 @@
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.internAPIError"
"$ref": "#/definitions/ginresp.apiError"
}
}
}
}
},
"/health": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.Health.response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.errBody"
}
}
}
}
},
"/info.php": {
"/api/info.php": {
"get": {
"summary": "Get information about the current user",
"operationId": "compat-info",
@@ -138,95 +138,13 @@
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.internAPIError"
"$ref": "#/definitions/ginresp.apiError"
}
}
}
}
},
"/ping": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.pingResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.errBody"
}
}
}
},
"put": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.pingResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.errBody"
}
}
}
},
"post": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.pingResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.errBody"
}
}
}
},
"delete": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.pingResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.errBody"
}
}
}
},
"patch": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.pingResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.errBody"
}
}
}
}
},
"/register.php": {
"/api/register.php": {
"get": {
"summary": "Register a new account",
"operationId": "compat-register",
@@ -267,13 +185,13 @@
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.internAPIError"
"$ref": "#/definitions/ginresp.apiError"
}
}
}
}
},
"/requery.php": {
"/api/requery.php": {
"get": {
"summary": "Return all not-acknowledged messages",
"operationId": "compat-requery",
@@ -303,85 +221,13 @@
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.internAPIError"
"$ref": "#/definitions/ginresp.apiError"
}
}
}
}
},
"/send.php": {
"post": {
"description": "(all arguments can either be supplied in the query or in the json body)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "Send a message",
"operationId": "compat-send",
"parameters": [
{
"type": "string",
"name": "content",
"in": "query"
},
{
"type": "string",
"name": "messageID",
"in": "query"
},
{
"type": "string",
"name": "priority",
"in": "query"
},
{
"type": "string",
"name": "timestamp",
"in": "query"
},
{
"type": "string",
"name": "title",
"in": "query"
},
{
"type": "string",
"name": "userID",
"in": "query"
},
{
"type": "string",
"name": "userKey",
"in": "query"
},
{
"description": " ",
"name": "post_body",
"in": "body",
"schema": {
"$ref": "#/definitions/handler.Send.body"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.Send.response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.sendAPIError"
}
}
}
}
},
"/update.php": {
"/api/update.php": {
"get": {
"summary": "Set the fcm-token (android)",
"operationId": "compat-update",
@@ -418,13 +264,13 @@
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.internAPIError"
"$ref": "#/definitions/ginresp.apiError"
}
}
}
}
},
"/upgrade.php": {
"/api/upgrade.php": {
"get": {
"summary": "Upgrade a free account to a paid account",
"operationId": "compat-upgrade",
@@ -472,7 +318,125 @@
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.internAPIError"
"$ref": "#/definitions/ginresp.apiError"
}
}
}
}
},
"/db-test": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.DatabaseTest.response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
}
}
}
},
"/health": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.Health.response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ginresp.apiError"
}
}
}
}
},
"/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"
}
}
}
@@ -480,32 +444,7 @@
}
},
"definitions": {
"ginresp.errBody": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "boolean"
}
}
},
"ginresp.internAPIError": {
"type": "object",
"properties": {
"errid": {
"type": "integer"
},
"message": {
"type": "string"
},
"success": {
"type": "boolean"
}
}
},
"ginresp.sendAPIError": {
"ginresp.apiError": {
"type": "object",
"properties": {
"errhighlight": {
@@ -514,6 +453,7 @@
"error": {
"type": "integer"
},
"errorObject": {},
"message": {
"type": "string"
},
@@ -539,6 +479,29 @@
}
}
},
"handler.CreateUser.body": {
"type": "object",
"properties": {
"agentModel": {
"type": "string"
},
"agentVersion": {
"type": "string"
},
"clientType": {
"type": "string"
},
"fcmtoken": {
"type": "string"
},
"proToken": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"handler.DatabaseTest.response": {
"type": "object",
"properties": {
@@ -656,43 +619,6 @@
}
}
},
"handler.Send.body": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"msg_id": {
"type": "string"
},
"priority": {
"type": "string"
},
"timestamp": {
"type": "string"
},
"title": {
"type": "string"
},
"user_id": {
"type": "string"
},
"user_key": {
"type": "string"
}
}
},
"handler.Send.response": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "string"
}
}
},
"handler.Update.response": {
"type": "object",
"properties": {
@@ -818,6 +744,47 @@
"type": "string"
}
}
},
"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"
}
}
}
}
}

View File

@@ -1,27 +1,12 @@
basePath: /api/
basePath: /
definitions:
ginresp.errBody:
properties:
message:
type: string
success:
type: boolean
type: object
ginresp.internAPIError:
properties:
errid:
type: integer
message:
type: string
success:
type: boolean
type: object
ginresp.sendAPIError:
ginresp.apiError:
properties:
errhighlight:
type: integer
error:
type: integer
errorObject: {}
message:
type: string
success:
@@ -38,6 +23,21 @@ definitions:
success:
type: string
type: object
handler.CreateUser.body:
properties:
agentModel:
type: string
agentVersion:
type: string
clientType:
type: string
fcmtoken:
type: string
proToken:
type: string
username:
type: string
type: object
handler.DatabaseTest.response:
properties:
libVersion:
@@ -114,30 +114,6 @@ definitions:
success:
type: string
type: object
handler.Send.body:
properties:
content:
type: string
msg_id:
type: string
priority:
type: string
timestamp:
type: string
title:
type: string
user_id:
type: string
user_key:
type: string
type: object
handler.Send.response:
properties:
message:
type: string
success:
type: string
type: object
handler.Update.response:
properties:
is_pro:
@@ -220,6 +196,33 @@ definitions:
usr_msg_id:
type: string
type: object
models.UserJSON:
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
type: object
host: scn.blackforestbytes.com
info:
contact: {}
@@ -227,7 +230,30 @@ info:
title: SimpleCloudNotifier API
version: "2.0"
paths:
/ack.php:
/api-v2/user/:
post:
operationId: api-user-create
parameters:
- description: ' '
in: body
name: post_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'
summary: Create a new user
/api/ack.php:
get:
operationId: compat-ack
parameters:
@@ -254,20 +280,9 @@ paths:
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.internAPIError'
$ref: '#/definitions/ginresp.apiError'
summary: Acknowledge that a message was received
/db-test:
get:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.DatabaseTest.response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.errBody'
/expand.php:
/api/expand.php:
get:
operationId: compat-expand
responses:
@@ -278,20 +293,9 @@ paths:
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.internAPIError'
$ref: '#/definitions/ginresp.apiError'
summary: Get a whole (potentially truncated) message
/health:
get:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.Health.response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.errBody'
/info.php:
/api/info.php:
get:
operationId: compat-info
parameters:
@@ -313,60 +317,9 @@ paths:
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.internAPIError'
$ref: '#/definitions/ginresp.apiError'
summary: Get information about the current user
/ping:
delete:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.pingResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.errBody'
get:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.pingResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.errBody'
patch:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.pingResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.errBody'
post:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.pingResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.errBody'
put:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.pingResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.errBody'
/register.php:
/api/register.php:
get:
operationId: compat-register
parameters:
@@ -396,9 +349,9 @@ paths:
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.internAPIError'
$ref: '#/definitions/ginresp.apiError'
summary: Register a new account
/requery.php:
/api/requery.php:
get:
operationId: compat-requery
parameters:
@@ -420,55 +373,9 @@ paths:
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.internAPIError'
$ref: '#/definitions/ginresp.apiError'
summary: Return all not-acknowledged messages
/send.php:
post:
consumes:
- application/json
description: (all arguments can either be supplied in the query or in the json
body)
operationId: compat-send
parameters:
- in: query
name: content
type: string
- in: query
name: messageID
type: string
- in: query
name: priority
type: string
- in: query
name: timestamp
type: string
- in: query
name: title
type: string
- in: query
name: userID
type: string
- in: query
name: userKey
type: string
- description: ' '
in: body
name: post_body
schema:
$ref: '#/definitions/handler.Send.body'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.Send.response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.sendAPIError'
summary: Send a message
/update.php:
/api/update.php:
get:
operationId: compat-update
parameters:
@@ -495,9 +402,9 @@ paths:
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.internAPIError'
$ref: '#/definitions/ginresp.apiError'
summary: Set the fcm-token (android)
/upgrade.php:
/api/upgrade.php:
get:
operationId: compat-upgrade
parameters:
@@ -532,6 +439,79 @@ paths:
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.internAPIError'
$ref: '#/definitions/ginresp.apiError'
summary: Upgrade a free account to a paid account
/db-test:
get:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.DatabaseTest.response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
/health:
get:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.Health.response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
/ping:
delete:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.pingResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
get:
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'
post:
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'
swagger: "2.0"