swagger doku for compat methods

This commit is contained in:
Mike Schwörer 2022-11-20 13:18:09 +01:00
parent 5ec66e1777
commit c2899fd727
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
4 changed files with 357 additions and 47 deletions

View File

@ -8,8 +8,6 @@
- https://firebase.google.com/docs/cloud-messaging/send-message#rest - https://firebase.google.com/docs/cloud-messaging/send-message#rest
- List subscriptions on all owned channels (RESTful?) - List subscriptions on all owned channels (RESTful?)
- deploy - deploy
- Dockerfile
- php in html
- full-text-search: https://www.sqlite.org/fts5.html#contentless_tables - full-text-search: https://www.sqlite.org/fts5.html#contentless_tables
- route to re-create keys - route to re-create keys
- ack/read deliveries && return ack-count - ack/read deliveries && return ack-count

View File

@ -29,17 +29,24 @@ func NewCompatHandler(app *logic.Application) CompatHandler {
// @Summary Register a new account // @Summary Register a new account
// @ID compat-register // @ID compat-register
// @Deprecated // @Deprecated
//
// @Param fcm_token query string true "the (android) fcm token" // @Param fcm_token query string true "the (android) fcm token"
// @Param pro query string true "if the user is a paid account" Enums(true, false) // @Param pro query string true "if the user is a paid account" Enums(true, false)
// @Param pro_token query string true "the (android) IAP token" // @Param pro_token query string true "the (android) IAP token"
//
// @Param fcm_token formData string true "the (android) fcm token"
// @Param pro formData string true "if the user is a paid account" Enums(true, false)
// @Param pro_token formData string true "the (android) IAP token"
//
// @Success 200 {object} handler.Register.response // @Success 200 {object} handler.Register.response
// @Failure 200 {object} ginresp.compatAPIError // @Failure 200 {object} ginresp.compatAPIError
//
// @Router /api/register.php [get] // @Router /api/register.php [get]
func (h CompatHandler) Register(g *gin.Context) ginresp.HTTPResponse { func (h CompatHandler) Register(g *gin.Context) ginresp.HTTPResponse {
type query struct { type query struct {
FCMToken *string `form:"fcm_token" json:"fcm_token"` FCMToken *string `form:"fcm_token"`
Pro *string `form:"pro" json:"pro"` Pro *string `form:"pro"`
ProToken *string `form:"pro_token" json:"pro_token"` ProToken *string `form:"pro_token"`
} }
type response struct { type response struct {
Success bool `json:"success"` Success bool `json:"success"`
@ -53,7 +60,7 @@ func (h CompatHandler) Register(g *gin.Context) ginresp.HTTPResponse {
var datq query var datq query
var datb query var datb query
ctx, errResp := h.app.StartRequest(g, nil, &datq, &datb, nil) ctx, errResp := h.app.StartRequest(g, nil, &datq, nil, &datb)
if errResp != nil { if errResp != nil {
return *errResp return *errResp
} }
@ -128,10 +135,16 @@ func (h CompatHandler) Register(g *gin.Context) ginresp.HTTPResponse {
// @Summary Get information about the current user // @Summary Get information about the current user
// @ID compat-info // @ID compat-info
// @Deprecated // @Deprecated
//
// @Param user_id query string true "the user_id" // @Param user_id query string true "the user_id"
// @Param user_key query string true "the user_key" // @Param user_key query string true "the user_key"
//
// @Param user_id formData string true "the user_id"
// @Param user_key formData string true "the user_key"
//
// @Success 200 {object} handler.Info.response // @Success 200 {object} handler.Info.response
// @Failure 200 {object} ginresp.compatAPIError // @Failure 200 {object} ginresp.compatAPIError
//
// @Router /api/info.php [get] // @Router /api/info.php [get]
func (h CompatHandler) Info(g *gin.Context) ginresp.HTTPResponse { func (h CompatHandler) Info(g *gin.Context) ginresp.HTTPResponse {
type query struct { type query struct {
@ -152,7 +165,7 @@ func (h CompatHandler) Info(g *gin.Context) ginresp.HTTPResponse {
var datq query var datq query
var datb query var datb query
ctx, errResp := h.app.StartRequest(g, nil, &datq, &datb, nil) ctx, errResp := h.app.StartRequest(g, nil, &datq, nil, &datb)
if errResp != nil { if errResp != nil {
return *errResp return *errResp
} }
@ -204,11 +217,18 @@ func (h CompatHandler) Info(g *gin.Context) ginresp.HTTPResponse {
// @Summary Acknowledge that a message was received // @Summary Acknowledge that a message was received
// @ID compat-ack // @ID compat-ack
// @Deprecated // @Deprecated
//
// @Param user_id query string true "the user_id" // @Param user_id query string true "the user_id"
// @Param user_key query string true "the user_key" // @Param user_key query string true "the user_key"
// @Param scn_msg_id query string true "the message id" // @Param scn_msg_id query string true "the message id"
//
// @Param user_id formData string true "the user_id"
// @Param user_key formData string true "the user_key"
// @Param scn_msg_id formData string true "the message id"
//
// @Success 200 {object} handler.Ack.response // @Success 200 {object} handler.Ack.response
// @Failure 200 {object} ginresp.compatAPIError // @Failure 200 {object} ginresp.compatAPIError
//
// @Router /api/ack.php [get] // @Router /api/ack.php [get]
func (h CompatHandler) Ack(g *gin.Context) ginresp.HTTPResponse { func (h CompatHandler) Ack(g *gin.Context) ginresp.HTTPResponse {
type query struct { type query struct {
@ -225,7 +245,7 @@ func (h CompatHandler) Ack(g *gin.Context) ginresp.HTTPResponse {
var datq query var datq query
var datb query var datb query
ctx, errResp := h.app.StartRequest(g, nil, &datq, &datb, nil) ctx, errResp := h.app.StartRequest(g, nil, &datq, nil, &datb)
if errResp != nil { if errResp != nil {
return *errResp return *errResp
} }
@ -268,10 +288,16 @@ func (h CompatHandler) Ack(g *gin.Context) ginresp.HTTPResponse {
// @Summary Return all not-acknowledged messages // @Summary Return all not-acknowledged messages
// @ID compat-requery // @ID compat-requery
// @Deprecated // @Deprecated
//
// @Param user_id query string true "the user_id" // @Param user_id query string true "the user_id"
// @Param user_key query string true "the user_key" // @Param user_key query string true "the user_key"
//
// @Param user_id formData string true "the user_id"
// @Param user_key formData string true "the user_key"
//
// @Success 200 {object} handler.Requery.response // @Success 200 {object} handler.Requery.response
// @Failure 200 {object} ginresp.compatAPIError // @Failure 200 {object} ginresp.compatAPIError
//
// @Router /api/requery.php [get] // @Router /api/requery.php [get]
func (h CompatHandler) Requery(g *gin.Context) ginresp.HTTPResponse { func (h CompatHandler) Requery(g *gin.Context) ginresp.HTTPResponse {
type query struct { type query struct {
@ -287,7 +313,7 @@ func (h CompatHandler) Requery(g *gin.Context) ginresp.HTTPResponse {
var datq query var datq query
var datb query var datb query
ctx, errResp := h.app.StartRequest(g, nil, &datq, &datb, nil) ctx, errResp := h.app.StartRequest(g, nil, &datq, nil, &datb)
if errResp != nil { if errResp != nil {
return *errResp return *errResp
} }
@ -327,11 +353,18 @@ func (h CompatHandler) Requery(g *gin.Context) ginresp.HTTPResponse {
// @Summary Set the fcm-token (android) // @Summary Set the fcm-token (android)
// @ID compat-update // @ID compat-update
// @Deprecated // @Deprecated
//
// @Param user_id query string true "the user_id" // @Param user_id query string true "the user_id"
// @Param user_key query string true "the user_key" // @Param user_key query string true "the user_key"
// @Param fcm_token query string true "the (android) fcm token" // @Param fcm_token query string true "the (android) fcm token"
//
// @Param user_id formData string true "the user_id"
// @Param user_key formData string true "the user_key"
// @Param fcm_token formData string true "the (android) fcm token"
//
// @Success 200 {object} handler.Update.response // @Success 200 {object} handler.Update.response
// @Failure 200 {object} ginresp.compatAPIError // @Failure 200 {object} ginresp.compatAPIError
//
// @Router /api/update.php [get] // @Router /api/update.php [get]
func (h CompatHandler) Update(g *gin.Context) ginresp.HTTPResponse { func (h CompatHandler) Update(g *gin.Context) ginresp.HTTPResponse {
type query struct { type query struct {
@ -351,7 +384,7 @@ func (h CompatHandler) Update(g *gin.Context) ginresp.HTTPResponse {
var datq query var datq query
var datb query var datb query
ctx, errResp := h.app.StartRequest(g, nil, &datq, &datb, nil) ctx, errResp := h.app.StartRequest(g, nil, &datq, nil, &datb)
if errResp != nil { if errResp != nil {
return *errResp return *errResp
} }
@ -431,8 +464,18 @@ func (h CompatHandler) Update(g *gin.Context) ginresp.HTTPResponse {
// @Summary Get a whole (potentially truncated) message // @Summary Get a whole (potentially truncated) message
// @ID compat-expand // @ID compat-expand
// @Deprecated // @Deprecated
//
// @Param user_id query string true "The user_id"
// @Param user_key query string true "The user_key"
// @Param scn_msg_id query string true "The message-id"
//
// @Param user_id formData string true "The user_id"
// @Param user_key formData string true "The user_key"
// @Param scn_msg_id formData string true "The message-id"
//
// @Success 200 {object} handler.Expand.response // @Success 200 {object} handler.Expand.response
// @Failure 200 {object} ginresp.compatAPIError // @Failure 200 {object} ginresp.compatAPIError
//
// @Router /api/expand.php [get] // @Router /api/expand.php [get]
func (h CompatHandler) Expand(g *gin.Context) ginresp.HTTPResponse { func (h CompatHandler) Expand(g *gin.Context) ginresp.HTTPResponse {
type query struct { type query struct {
@ -448,7 +491,7 @@ func (h CompatHandler) Expand(g *gin.Context) ginresp.HTTPResponse {
var datq query var datq query
var datb query var datb query
ctx, errResp := h.app.StartRequest(g, nil, &datq, &datb, nil) ctx, errResp := h.app.StartRequest(g, nil, &datq, nil, &datb)
if errResp != nil { if errResp != nil {
return *errResp return *errResp
} }
@ -505,14 +548,22 @@ func (h CompatHandler) Expand(g *gin.Context) ginresp.HTTPResponse {
// //
// @Summary Upgrade a free account to a paid account // @Summary Upgrade a free account to a paid account
// @ID compat-upgrade // @ID compat-upgrade
// @Deprecated
//
// @Param user_id query string true "the user_id" // @Param user_id query string true "the user_id"
// @Param user_key query string true "the user_key" // @Param user_key query string true "the user_key"
// @Param pro query string true "if the user is a paid account" Enums(true, false) // @Param pro query string true "if the user is a paid account" Enums(true, false)
// @Param pro_token query string true "the (android) IAP token" // @Param pro_token query string true "the (android) IAP token"
//
// @Param user_id formData string true "the user_id"
// @Param user_key formData string true "the user_key"
// @Param pro formData string true "if the user is a paid account" Enums(true, false)
// @Param pro_token formData string true "the (android) IAP token"
//
// @Success 200 {object} handler.Upgrade.response // @Success 200 {object} handler.Upgrade.response
// @Failure 200 {object} ginresp.compatAPIError // @Failure 200 {object} ginresp.compatAPIError
//
// @Router /api/upgrade.php [get] // @Router /api/upgrade.php [get]
// @Deprecated
func (h CompatHandler) Upgrade(g *gin.Context) ginresp.HTTPResponse { func (h CompatHandler) Upgrade(g *gin.Context) ginresp.HTTPResponse {
type query struct { type query struct {
UserID *int64 `form:"user_id"` UserID *int64 `form:"user_id"`
@ -531,7 +582,7 @@ func (h CompatHandler) Upgrade(g *gin.Context) ginresp.HTTPResponse {
var datq query var datq query
var datb query var datb query
ctx, errResp := h.app.StartRequest(g, nil, &datq, &datb, nil) ctx, errResp := h.app.StartRequest(g, nil, &datq, nil, &datb)
if errResp != nil { if errResp != nil {
return *errResp return *errResp
} }

View File

@ -1005,6 +1005,27 @@
"name": "scn_msg_id", "name": "scn_msg_id",
"in": "query", "in": "query",
"required": true "required": true
},
{
"type": "string",
"description": "the user_id",
"name": "user_id",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "the user_key",
"name": "user_key",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "the message id",
"name": "scn_msg_id",
"in": "formData",
"required": true
} }
], ],
"responses": { "responses": {
@ -1022,6 +1043,50 @@
"summary": "Get a whole (potentially truncated) message", "summary": "Get a whole (potentially truncated) message",
"operationId": "compat-expand", "operationId": "compat-expand",
"deprecated": true, "deprecated": true,
"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
},
{
"type": "string",
"description": "The user_id",
"name": "user_id",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "The user_key",
"name": "user_key",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "The message-id",
"name": "scn_msg_id",
"in": "formData",
"required": true
}
],
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
@ -1051,6 +1116,20 @@
"name": "user_key", "name": "user_key",
"in": "query", "in": "query",
"required": true "required": true
},
{
"type": "string",
"description": "the user_id",
"name": "user_id",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "the user_key",
"name": "user_key",
"in": "formData",
"required": true
} }
], ],
"responses": { "responses": {
@ -1093,6 +1172,31 @@
"name": "pro_token", "name": "pro_token",
"in": "query", "in": "query",
"required": true "required": true
},
{
"type": "string",
"description": "the (android) fcm token",
"name": "fcm_token",
"in": "formData",
"required": true
},
{
"enum": [
"true",
"false"
],
"type": "string",
"description": "if the user is a paid account",
"name": "pro",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "the (android) IAP token",
"name": "pro_token",
"in": "formData",
"required": true
} }
], ],
"responses": { "responses": {
@ -1124,6 +1228,20 @@
"name": "user_key", "name": "user_key",
"in": "query", "in": "query",
"required": true "required": true
},
{
"type": "string",
"description": "the user_id",
"name": "user_id",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "the user_key",
"name": "user_key",
"in": "formData",
"required": true
} }
], ],
"responses": { "responses": {
@ -1162,6 +1280,27 @@
"name": "fcm_token", "name": "fcm_token",
"in": "query", "in": "query",
"required": true "required": true
},
{
"type": "string",
"description": "the user_id",
"name": "user_id",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "the user_key",
"name": "user_key",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "the (android) fcm token",
"name": "fcm_token",
"in": "formData",
"required": true
} }
], ],
"responses": { "responses": {
@ -1211,6 +1350,38 @@
"name": "pro_token", "name": "pro_token",
"in": "query", "in": "query",
"required": true "required": true
},
{
"type": "string",
"description": "the user_id",
"name": "user_id",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "the user_key",
"name": "user_key",
"in": "formData",
"required": true
},
{
"enum": [
"true",
"false"
],
"type": "string",
"description": "if the user is a paid account",
"name": "pro",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "the (android) IAP token",
"name": "pro_token",
"in": "formData",
"required": true
} }
], ],
"responses": { "responses": {
@ -1446,16 +1617,6 @@
"summary": "Send a new message (compatibility)", "summary": "Send a new message (compatibility)",
"deprecated": true, "deprecated": true,
"parameters": [ "parameters": [
{
"type": "string",
"name": "chanKey",
"in": "query"
},
{
"type": "string",
"name": "channel",
"in": "query"
},
{ {
"type": "string", "type": "string",
"name": "content", "name": "content",
@ -1491,16 +1652,6 @@
"name": "userMessageID", "name": "userMessageID",
"in": "query" "in": "query"
}, },
{
"type": "string",
"name": "chanKey",
"in": "formData"
},
{
"type": "string",
"name": "channel",
"in": "formData"
},
{ {
"type": "string", "type": "string",
"name": "content", "name": "content",

View File

@ -1110,6 +1110,21 @@ paths:
name: scn_msg_id name: scn_msg_id
required: true required: true
type: string type: string
- description: the user_id
in: formData
name: user_id
required: true
type: string
- description: the user_key
in: formData
name: user_key
required: true
type: string
- description: the message id
in: formData
name: scn_msg_id
required: true
type: string
responses: responses:
"200": "200":
description: OK description: OK
@ -1120,6 +1135,37 @@ paths:
get: get:
deprecated: true deprecated: true
operationId: compat-expand operationId: compat-expand
parameters:
- description: The user_id
in: query
name: user_id
required: true
type: string
- description: The user_key
in: query
name: user_key
required: true
type: string
- description: The message-id
in: query
name: scn_msg_id
required: true
type: string
- description: The user_id
in: formData
name: user_id
required: true
type: string
- description: The user_key
in: formData
name: user_key
required: true
type: string
- description: The message-id
in: formData
name: scn_msg_id
required: true
type: string
responses: responses:
"200": "200":
description: OK description: OK
@ -1141,6 +1187,16 @@ paths:
name: user_key name: user_key
required: true required: true
type: string type: string
- description: the user_id
in: formData
name: user_id
required: true
type: string
- description: the user_key
in: formData
name: user_key
required: true
type: string
responses: responses:
"200": "200":
description: OK description: OK
@ -1170,6 +1226,24 @@ paths:
name: pro_token name: pro_token
required: true required: true
type: string type: string
- description: the (android) fcm token
in: formData
name: fcm_token
required: true
type: string
- description: if the user is a paid account
enum:
- "true"
- "false"
in: formData
name: pro
required: true
type: string
- description: the (android) IAP token
in: formData
name: pro_token
required: true
type: string
responses: responses:
"200": "200":
description: OK description: OK
@ -1191,6 +1265,16 @@ paths:
name: user_key name: user_key
required: true required: true
type: string type: string
- description: the user_id
in: formData
name: user_id
required: true
type: string
- description: the user_key
in: formData
name: user_key
required: true
type: string
responses: responses:
"200": "200":
description: OK description: OK
@ -1217,6 +1301,21 @@ paths:
name: fcm_token name: fcm_token
required: true required: true
type: string type: string
- description: the user_id
in: formData
name: user_id
required: true
type: string
- description: the user_key
in: formData
name: user_key
required: true
type: string
- description: the (android) fcm token
in: formData
name: fcm_token
required: true
type: string
responses: responses:
"200": "200":
description: OK description: OK
@ -1251,6 +1350,29 @@ paths:
name: pro_token name: pro_token
required: true required: true
type: string type: string
- description: the user_id
in: formData
name: user_id
required: true
type: string
- description: the user_key
in: formData
name: user_key
required: true
type: string
- description: if the user is a paid account
enum:
- "true"
- "false"
in: formData
name: pro
required: true
type: string
- description: the (android) IAP token
in: formData
name: pro_token
required: true
type: string
responses: responses:
"200": "200":
description: OK description: OK
@ -1399,12 +1521,6 @@ paths:
description: All parameter can be set via query-parameter or form-data body. description: All parameter can be set via query-parameter or form-data body.
Only UserID, UserKey and Title are required Only UserID, UserKey and Title are required
parameters: parameters:
- in: query
name: chanKey
type: string
- in: query
name: channel
type: string
- in: query - in: query
name: content name: content
type: string type: string
@ -1426,12 +1542,6 @@ paths:
- in: query - in: query
name: userMessageID name: userMessageID
type: string type: string
- in: formData
name: chanKey
type: string
- in: formData
name: channel
type: string
- in: formData - in: formData
name: content name: content
type: string type: string