fixed error in swagger documentation

* set pin request needs to be a POST request
* added payload to swagger documentation
This commit is contained in:
Bernhard B
2025-03-16 00:22:39 +01:00
parent 2833a9b8a7
commit 8346f9072a
4 changed files with 50 additions and 4 deletions

View File

@@ -2178,7 +2178,8 @@ func (a *Api) ListContacts(c *gin.Context) {
// @Success 201
// @Failure 400 {object} Error
// @Param number path string true "Registered Phone Number"
// @Router /v1/accounts/{number}/pin [get]
// @Param data body SetPinRequest true "Request"
// @Router /v1/accounts/{number}/pin [post]
func (a *Api) SetPin(c *gin.Context) {
number, err := url.PathUnescape(c.Param("number"))
if err != nil {

View File

@@ -65,7 +65,7 @@ const docTemplate = `{
}
},
"/v1/accounts/{number}/pin": {
"get": {
"post": {
"description": "Sets a new Signal Pin",
"produces": [
"application/json"
@@ -81,6 +81,15 @@ const docTemplate = `{
"name": "number",
"in": "path",
"required": true
},
{
"description": "Request",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.SetPinRequest"
}
}
],
"responses": {
@@ -2426,6 +2435,14 @@ const docTemplate = `{
}
}
},
"api.SetPinRequest": {
"type": "object",
"properties": {
"pin": {
"type": "string"
}
}
},
"api.SetUsernameRequest": {
"type": "object",
"properties": {

View File

@@ -62,7 +62,7 @@
}
},
"/v1/accounts/{number}/pin": {
"get": {
"post": {
"description": "Sets a new Signal Pin",
"produces": [
"application/json"
@@ -78,6 +78,15 @@
"name": "number",
"in": "path",
"required": true
},
{
"description": "Request",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.SetPinRequest"
}
}
],
"responses": {
@@ -2423,6 +2432,14 @@
}
}
},
"api.SetPinRequest": {
"type": "object",
"properties": {
"pin": {
"type": "string"
}
}
},
"api.SetUsernameRequest": {
"type": "object",
"properties": {

View File

@@ -206,6 +206,11 @@ definitions:
- styled
type: string
type: object
api.SetPinRequest:
properties:
pin:
type: string
type: object
api.SetUsernameRequest:
properties:
username:
@@ -456,7 +461,7 @@ paths:
summary: Remove Pin
tags:
- Accounts
get:
post:
description: Sets a new Signal Pin
parameters:
- description: Registered Phone Number
@@ -464,6 +469,12 @@ paths:
name: number
required: true
type: string
- description: Request
in: body
name: data
required: true
schema:
$ref: '#/definitions/api.SetPinRequest'
produces:
- application/json
responses: