UpdateUser() works

This commit is contained in:
2022-11-18 23:28:37 +01:00
parent 55f53deadf
commit 35ef2175bc
8 changed files with 329 additions and 44 deletions

View File

@@ -45,6 +45,100 @@
}
}
},
"/api-v2/user/{uid}": {
"get": {
"summary": "Get a user (only self is allowed)",
"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",
"summary": "(Partially) update a user (only self allowed)",
"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"
}
}
}
}
},
"/api/ack.php": {
"get": {
"summary": "Acknowledge that a message was received",
@@ -482,19 +576,19 @@
"handler.CreateUser.body": {
"type": "object",
"properties": {
"agentModel": {
"agent_model": {
"type": "string"
},
"agentVersion": {
"agent_version": {
"type": "string"
},
"clientType": {
"client_type": {
"type": "string"
},
"fcmtoken": {
"fcm_token": {
"type": "string"
},
"proToken": {
"pro_token": {
"type": "string"
},
"username": {
@@ -645,6 +739,17 @@
}
}
},
"handler.UpdateUser.body": {
"type": "object",
"properties": {
"pro_token": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"handler.Upgrade.response": {
"type": "object",
"properties": {

View File

@@ -25,15 +25,15 @@ definitions:
type: object
handler.CreateUser.body:
properties:
agentModel:
agent_model:
type: string
agentVersion:
agent_version:
type: string
clientType:
client_type:
type: string
fcmtoken:
fcm_token:
type: string
proToken:
pro_token:
type: string
username:
type: string
@@ -131,6 +131,13 @@ definitions:
user_key:
type: string
type: object
handler.UpdateUser.body:
properties:
pro_token:
type: string
username:
type: string
type: object
handler.Upgrade.response:
properties:
data:
@@ -253,6 +260,68 @@ paths:
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Create a new user
/api-v2/user/{uid}:
get:
operationId: api-user-get
parameters:
- description: UserID
in: path
name: uid
required: true
type: integer
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'
summary: Get a user (only self is allowed)
patch:
description: The body-values are optional, only send the ones you want to update
operationId: api-user-update
parameters:
- description: ' '
in: body
name: post_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'
summary: (Partially) update a user (only self allowed)
/api/ack.php:
get:
operationId: compat-ack