fix: update go-swagger

This commit is contained in:
Jannis Mattheis 2023-09-16 20:38:20 +02:00
parent 4728e995bc
commit 9592cc95c9
11 changed files with 959 additions and 960 deletions

View File

@ -39,7 +39,7 @@ check-js:
(cd ui && yarn testformat) (cd ui && yarn testformat)
download-tools: download-tools:
go install github.com/go-swagger/go-swagger/cmd/swagger@v0.26.1 go install github.com/go-swagger/go-swagger/cmd/swagger@v0.30.5
update-swagger: update-swagger:
swagger generate spec --scan-models -o docs/spec.json swagger generate spec --scan-models -o docs/spec.json

View File

@ -31,7 +31,7 @@ type ApplicationAPI struct {
// Application Params Model // Application Params Model
// //
// Params allowed to create or update Applications // Params allowed to create or update Applications.
// //
// swagger:model ApplicationParams // swagger:model ApplicationParams
type ApplicationParams struct { type ApplicationParams struct {
@ -55,34 +55,34 @@ type ApplicationParams struct {
// //
// Create an application. // Create an application.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// parameters: // parameters:
// - name: body // - name: body
// in: body // in: body
// description: the application to add // description: the application to add
// required: true // required: true
// schema: // schema:
// $ref: "#/definitions/ApplicationParams" // $ref: "#/definitions/ApplicationParams"
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// $ref: "#/definitions/Application" // $ref: "#/definitions/Application"
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *ApplicationAPI) CreateApplication(ctx *gin.Context) { func (a *ApplicationAPI) CreateApplication(ctx *gin.Context) {
applicationParams := ApplicationParams{} applicationParams := ApplicationParams{}
if err := ctx.Bind(&applicationParams); err == nil { if err := ctx.Bind(&applicationParams); err == nil {
@ -107,25 +107,25 @@ func (a *ApplicationAPI) CreateApplication(ctx *gin.Context) {
// //
// Return all applications. // Return all applications.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// type: array // type: array
// items: // items:
// $ref: "#/definitions/Application" // $ref: "#/definitions/Application"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *ApplicationAPI) GetApplications(ctx *gin.Context) { func (a *ApplicationAPI) GetApplications(ctx *gin.Context) {
userID := auth.GetUserID(ctx) userID := auth.GetUserID(ctx)
apps, err := a.DB.GetApplicationsByUser(userID) apps, err := a.DB.GetApplicationsByUser(userID)
@ -143,36 +143,36 @@ func (a *ApplicationAPI) GetApplications(ctx *gin.Context) {
// //
// Delete an application. // Delete an application.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/json] // produces: [application/json]
// parameters: // parameters:
// - name: id // - name: id
// in: path // in: path
// description: the application id // description: the application id
// required: true // required: true
// type: integer // type: integer
// format: int64 // format: int64
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *ApplicationAPI) DeleteApplication(ctx *gin.Context) { func (a *ApplicationAPI) DeleteApplication(ctx *gin.Context) {
withID(ctx, "id", func(id uint) { withID(ctx, "id", func(id uint) {
app, err := a.DB.GetApplicationByID(id) app, err := a.DB.GetApplicationByID(id)
@ -201,44 +201,44 @@ func (a *ApplicationAPI) DeleteApplication(ctx *gin.Context) {
// //
// Update an application. // Update an application.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// parameters: // parameters:
// - name: body // - name: body
// in: body // in: body
// description: the application to update // description: the application to update
// required: true // required: true
// schema: // schema:
// $ref: "#/definitions/ApplicationParams" // $ref: "#/definitions/ApplicationParams"
// - name: id // - name: id
// in: path // in: path
// description: the application id // description: the application id
// required: true // required: true
// type: integer // type: integer
// format: int64 // format: int64
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// $ref: "#/definitions/Application" // $ref: "#/definitions/Application"
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *ApplicationAPI) UpdateApplication(ctx *gin.Context) { func (a *ApplicationAPI) UpdateApplication(ctx *gin.Context) {
withID(ctx, "id", func(id uint) { withID(ctx, "id", func(id uint) {
app, err := a.DB.GetApplicationByID(id) app, err := a.DB.GetApplicationByID(id)
@ -268,48 +268,48 @@ func (a *ApplicationAPI) UpdateApplication(ctx *gin.Context) {
// //
// Upload an image for an application. // Upload an image for an application.
// //
// --- // ---
// consumes: // consumes:
// - multipart/form-data // - multipart/form-data
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// parameters: // parameters:
// - name: file // - name: file
// in: formData // in: formData
// description: the application image // description: the application image
// required: true // required: true
// type: file // type: file
// - name: id // - name: id
// in: path // in: path
// description: the application id // description: the application id
// required: true // required: true
// type: integer // type: integer
// format: int64 // format: int64
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// $ref: "#/definitions/Application" // $ref: "#/definitions/Application"
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 500: // 500:
// description: Server Error // description: Server Error
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *ApplicationAPI) UploadApplicationImage(ctx *gin.Context) { func (a *ApplicationAPI) UploadApplicationImage(ctx *gin.Context) {
withID(ctx, "id", func(id uint) { withID(ctx, "id", func(id uint) {
app, err := a.DB.GetApplicationByID(id) app, err := a.DB.GetApplicationByID(id)
@ -369,40 +369,40 @@ func (a *ApplicationAPI) UploadApplicationImage(ctx *gin.Context) {
// //
// Deletes an image of an application. // Deletes an image of an application.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/json] // produces: [application/json]
// parameters: // parameters:
// - name: id // - name: id
// in: path // in: path
// description: the application id // description: the application id
// required: true // required: true
// type: integer // type: integer
// format: int64 // format: int64
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 500: // 500:
// description: Server Error // description: Server Error
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *ApplicationAPI) RemoveApplicationImage(ctx *gin.Context) { func (a *ApplicationAPI) RemoveApplicationImage(ctx *gin.Context) {
withID(ctx, "id", func(id uint) { withID(ctx, "id", func(id uint) {
app, err := a.DB.GetApplicationByID(id) app, err := a.DB.GetApplicationByID(id)

View File

@ -27,7 +27,7 @@ type ClientAPI struct {
// Client Params Model // Client Params Model
// //
// Params allowed to create or update Clients // Params allowed to create or update Clients.
// //
// swagger:model ClientParams // swagger:model ClientParams
type ClientParams struct { type ClientParams struct {
@ -43,44 +43,44 @@ type ClientParams struct {
// //
// Update a client. // Update a client.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// parameters: // parameters:
// - name: body // - name: body
// in: body // in: body
// description: the client to update // description: the client to update
// required: true // required: true
// schema: // schema:
// $ref: "#/definitions/ClientParams" // $ref: "#/definitions/ClientParams"
// - name: id // - name: id
// in: path // in: path
// description: the client id // description: the client id
// required: true // required: true
// type: integer // type: integer
// format: int64 // format: int64
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// $ref: "#/definitions/Client" // $ref: "#/definitions/Client"
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *ClientAPI) UpdateClient(ctx *gin.Context) { func (a *ClientAPI) UpdateClient(ctx *gin.Context) {
withID(ctx, "id", func(id uint) { withID(ctx, "id", func(id uint) {
client, err := a.DB.GetClientByID(id) client, err := a.DB.GetClientByID(id)
@ -108,34 +108,34 @@ func (a *ClientAPI) UpdateClient(ctx *gin.Context) {
// //
// Create a client. // Create a client.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// parameters: // parameters:
// - name: body // - name: body
// in: body // in: body
// description: the client to add // description: the client to add
// required: true // required: true
// schema: // schema:
// $ref: "#/definitions/ClientParams" // $ref: "#/definitions/ClientParams"
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// $ref: "#/definitions/Client" // $ref: "#/definitions/Client"
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *ClientAPI) CreateClient(ctx *gin.Context) { func (a *ClientAPI) CreateClient(ctx *gin.Context) {
clientParams := ClientParams{} clientParams := ClientParams{}
if err := ctx.Bind(&clientParams); err == nil { if err := ctx.Bind(&clientParams); err == nil {
@ -157,25 +157,25 @@ func (a *ClientAPI) CreateClient(ctx *gin.Context) {
// //
// Return all clients. // Return all clients.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// type: array // type: array
// items: // items:
// $ref: "#/definitions/Client" // $ref: "#/definitions/Client"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *ClientAPI) GetClients(ctx *gin.Context) { func (a *ClientAPI) GetClients(ctx *gin.Context) {
userID := auth.GetUserID(ctx) userID := auth.GetUserID(ctx)
clients, err := a.DB.GetClientsByUser(userID) clients, err := a.DB.GetClientsByUser(userID)
@ -190,36 +190,36 @@ func (a *ClientAPI) GetClients(ctx *gin.Context) {
// //
// Delete a client. // Delete a client.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/json] // produces: [application/json]
// parameters: // parameters:
// - name: id // - name: id
// in: path // in: path
// description: the client id // description: the client id
// required: true // required: true
// type: integer // type: integer
// format: int64 // format: int64
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *ClientAPI) DeleteClient(ctx *gin.Context) { func (a *ClientAPI) DeleteClient(ctx *gin.Context) {
withID(ctx, "id", func(id uint) { withID(ctx, "id", func(id uint) {
client, err := a.DB.GetClientByID(id) client, err := a.DB.GetClientByID(id)

View File

@ -20,17 +20,17 @@ type HealthAPI struct {
// //
// Get health information. // Get health information.
// //
// --- // ---
// produces: [application/json] // produces: [application/json]
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// $ref: "#/definitions/Health" // $ref: "#/definitions/Health"
// 500: // 500:
// description: Ok // description: Ok
// schema: // schema:
// $ref: "#/definitions/Health" // $ref: "#/definitions/Health"
func (a *HealthAPI) Health(ctx *gin.Context) { func (a *HealthAPI) Health(ctx *gin.Context) {
if err := a.DB.Ping(); err != nil { if err := a.DB.Ping(); err != nil {
ctx.JSON(500, model.Health{ ctx.JSON(500, model.Health{

View File

@ -50,42 +50,42 @@ type pagingParams struct {
// //
// Return all messages. // Return all messages.
// //
// --- // ---
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// parameters: // parameters:
// - name: limit // - name: limit
// in: query // in: query
// description: the maximal amount of messages to return // description: the maximal amount of messages to return
// required: false // required: false
// maximum: 200 // maximum: 200
// minimum: 1 // minimum: 1
// default: 100 // default: 100
// type: integer // type: integer
// - name: since // - name: since
// in: query // in: query
// description: return all messages with an ID less than this value // description: return all messages with an ID less than this value
// minimum: 0 // minimum: 0
// required: false // required: false
// type: integer // type: integer
// format: int64 // format: int64
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// $ref: "#/definitions/PagedMessages" // $ref: "#/definitions/PagedMessages"
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *MessageAPI) GetMessages(ctx *gin.Context) { func (a *MessageAPI) GetMessages(ctx *gin.Context) {
userID := auth.GetUserID(ctx) userID := auth.GetUserID(ctx)
withPaging(ctx, func(params *pagingParams) { withPaging(ctx, func(params *pagingParams) {
@ -131,52 +131,52 @@ func withPaging(ctx *gin.Context, f func(pagingParams *pagingParams)) {
// //
// Return all messages from a specific application. // Return all messages from a specific application.
// //
// --- // ---
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// parameters: // parameters:
// - name: id // - name: id
// in: path // in: path
// description: the application id // description: the application id
// required: true // required: true
// type: integer // type: integer
// format: int64 // format: int64
// - name: limit // - name: limit
// in: query // in: query
// description: the maximal amount of messages to return // description: the maximal amount of messages to return
// required: false // required: false
// maximum: 200 // maximum: 200
// minimum: 1 // minimum: 1
// default: 100 // default: 100
// type: integer // type: integer
// - name: since // - name: since
// in: query // in: query
// description: return all messages with an ID less than this value // description: return all messages with an ID less than this value
// minimum: 0 // minimum: 0
// required: false // required: false
// type: integer // type: integer
// format: int64 // format: int64
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// $ref: "#/definitions/PagedMessages" // $ref: "#/definitions/PagedMessages"
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *MessageAPI) GetMessagesWithApplication(ctx *gin.Context) { func (a *MessageAPI) GetMessagesWithApplication(ctx *gin.Context) {
withID(ctx, "id", func(id uint) { withID(ctx, "id", func(id uint) {
withPaging(ctx, func(params *pagingParams) { withPaging(ctx, func(params *pagingParams) {
@ -203,20 +203,20 @@ func (a *MessageAPI) GetMessagesWithApplication(ctx *gin.Context) {
// //
// Delete all messages. // Delete all messages.
// //
// --- // ---
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *MessageAPI) DeleteMessages(ctx *gin.Context) { func (a *MessageAPI) DeleteMessages(ctx *gin.Context) {
userID := auth.GetUserID(ctx) userID := auth.GetUserID(ctx)
successOrAbort(ctx, 500, a.DB.DeleteMessagesByUser(userID)) successOrAbort(ctx, 500, a.DB.DeleteMessagesByUser(userID))
@ -227,35 +227,35 @@ func (a *MessageAPI) DeleteMessages(ctx *gin.Context) {
// //
// Delete all messages from a specific application. // Delete all messages from a specific application.
// //
// --- // ---
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// parameters: // parameters:
// - name: id // - name: id
// in: path // in: path
// description: the application id // description: the application id
// required: true // required: true
// type: integer // type: integer
// format: int64 // format: int64
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *MessageAPI) DeleteMessageWithApplication(ctx *gin.Context) { func (a *MessageAPI) DeleteMessageWithApplication(ctx *gin.Context) {
withID(ctx, "id", func(id uint) { withID(ctx, "id", func(id uint) {
application, err := a.DB.GetApplicationByID(id) application, err := a.DB.GetApplicationByID(id)
@ -275,35 +275,35 @@ func (a *MessageAPI) DeleteMessageWithApplication(ctx *gin.Context) {
// //
// Deletes a message with an id. // Deletes a message with an id.
// //
// --- // ---
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// parameters: // parameters:
// - name: id // - name: id
// in: path // in: path
// description: the message id // description: the message id
// required: true // required: true
// type: integer // type: integer
// format: int64 // format: int64
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *MessageAPI) DeleteMessage(ctx *gin.Context) { func (a *MessageAPI) DeleteMessage(ctx *gin.Context) {
withID(ctx, "id", func(id uint) { withID(ctx, "id", func(id uint) {
msg, err := a.DB.GetMessageByID(id) msg, err := a.DB.GetMessageByID(id)
@ -332,34 +332,35 @@ func (a *MessageAPI) DeleteMessage(ctx *gin.Context) {
// Create a message. // Create a message.
// //
// __NOTE__: This API ONLY accepts an application token as authentication. // __NOTE__: This API ONLY accepts an application token as authentication.
// --- //
// consumes: [application/json] // ---
// produces: [application/json] // consumes: [application/json]
// security: [appTokenAuthorizationHeader: [], appTokenHeader: [], appTokenQuery: []] // produces: [application/json]
// parameters: // security: [appTokenAuthorizationHeader: [], appTokenHeader: [], appTokenQuery: []]
// - name: body // parameters:
// in: body // - name: body
// description: the message to add // in: body
// required: true // description: the message to add
// schema: // required: true
// $ref: "#/definitions/Message" // schema:
// responses: // $ref: "#/definitions/Message"
// 200: // responses:
// description: Ok // 200:
// schema: // description: Ok
// $ref: "#/definitions/Message" // schema:
// 400: // $ref: "#/definitions/Message"
// description: Bad Request // 400:
// schema: // description: Bad Request
// $ref: "#/definitions/Error" // schema:
// 401: // $ref: "#/definitions/Error"
// description: Unauthorized // 401:
// schema: // description: Unauthorized
// $ref: "#/definitions/Error" // schema:
// 403: // $ref: "#/definitions/Error"
// description: Forbidden // 403:
// schema: // description: Forbidden
// $ref: "#/definitions/Error" // schema:
// $ref: "#/definitions/Error"
func (a *MessageAPI) CreateMessage(ctx *gin.Context) { func (a *MessageAPI) CreateMessage(ctx *gin.Context) {
message := model.MessageExternal{} message := model.MessageExternal{}
if err := ctx.Bind(&message); err == nil { if err := ctx.Bind(&message); err == nil {

View File

@ -33,33 +33,33 @@ type PluginAPI struct {
// //
// Return all plugins. // Return all plugins.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// type: array // type: array
// items: // items:
// $ref: "#/definitions/PluginConf" // $ref: "#/definitions/PluginConf"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 500: // 500:
// description: Internal Server Error // description: Internal Server Error
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (c *PluginAPI) GetPlugins(ctx *gin.Context) { func (c *PluginAPI) GetPlugins(ctx *gin.Context) {
userID := auth.GetUserID(ctx) userID := auth.GetUserID(ctx)
plugins, err := c.DB.GetPluginConfByUser(userID) plugins, err := c.DB.GetPluginConfByUser(userID)
@ -91,36 +91,36 @@ func (c *PluginAPI) GetPlugins(ctx *gin.Context) {
// //
// Enable a plugin. // Enable a plugin.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/json] // produces: [application/json]
// parameters: // parameters:
// - name: id // - name: id
// in: path // in: path
// description: the plugin id // description: the plugin id
// required: true // required: true
// type: integer // type: integer
// format: int64 // format: int64
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 500: // 500:
// description: Internal Server Error // description: Internal Server Error
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (c *PluginAPI) EnablePlugin(ctx *gin.Context) { func (c *PluginAPI) EnablePlugin(ctx *gin.Context) {
withID(ctx, "id", func(id uint) { withID(ctx, "id", func(id uint) {
conf, err := c.DB.GetPluginConfByID(id) conf, err := c.DB.GetPluginConfByID(id)
@ -149,36 +149,36 @@ func (c *PluginAPI) EnablePlugin(ctx *gin.Context) {
// //
// Disable a plugin. // Disable a plugin.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/json] // produces: [application/json]
// parameters: // parameters:
// - name: id // - name: id
// in: path // in: path
// description: the plugin id // description: the plugin id
// required: true // required: true
// type: integer // type: integer
// format: int64 // format: int64
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 500: // 500:
// description: Internal Server Error // description: Internal Server Error
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (c *PluginAPI) DisablePlugin(ctx *gin.Context) { func (c *PluginAPI) DisablePlugin(ctx *gin.Context) {
withID(ctx, "id", func(id uint) { withID(ctx, "id", func(id uint) {
conf, err := c.DB.GetPluginConfByID(id) conf, err := c.DB.GetPluginConfByID(id)
@ -207,38 +207,38 @@ func (c *PluginAPI) DisablePlugin(ctx *gin.Context) {
// //
// Get display info for a Displayer plugin. // Get display info for a Displayer plugin.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/json] // produces: [application/json]
// parameters: // parameters:
// - name: id // - name: id
// in: path // in: path
// description: the plugin id // description: the plugin id
// required: true // required: true
// type: integer // type: integer
// format: int64 // format: int64
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// type: string // type: string
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 500: // 500:
// description: Internal Server Error // description: Internal Server Error
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (c *PluginAPI) GetDisplay(ctx *gin.Context) { func (c *PluginAPI) GetDisplay(ctx *gin.Context) {
withID(ctx, "id", func(id uint) { withID(ctx, "id", func(id uint) {
conf, err := c.DB.GetPluginConfByID(id) conf, err := c.DB.GetPluginConfByID(id)
@ -263,43 +263,43 @@ func (c *PluginAPI) GetDisplay(ctx *gin.Context) {
// //
// Get YAML configuration for Configurer plugin. // Get YAML configuration for Configurer plugin.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/x-yaml] // produces: [application/x-yaml]
// parameters: // parameters:
// - name: id // - name: id
// in: path // in: path
// description: the plugin id // description: the plugin id
// required: true // required: true
// type: integer // type: integer
// format: int64 // format: int64
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// type: object // type: object
// description: plugin configuration // description: plugin configuration
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 500: // 500:
// description: Internal Server Error // description: Internal Server Error
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (c *PluginAPI) GetConfig(ctx *gin.Context) { func (c *PluginAPI) GetConfig(ctx *gin.Context) {
withID(ctx, "id", func(id uint) { withID(ctx, "id", func(id uint) {
conf, err := c.DB.GetPluginConfByID(id) conf, err := c.DB.GetPluginConfByID(id)
@ -330,40 +330,40 @@ func (c *PluginAPI) GetConfig(ctx *gin.Context) {
// //
// Update YAML configuration for Configurer plugin. // Update YAML configuration for Configurer plugin.
// //
// --- // ---
// consumes: [application/x-yaml] // consumes: [application/x-yaml]
// produces: [application/json] // produces: [application/json]
// parameters: // parameters:
// - name: id // - name: id
// in: path // in: path
// description: the plugin id // description: the plugin id
// required: true // required: true
// type: integer // type: integer
// format: int64 // format: int64
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 500: // 500:
// description: Internal Server Error // description: Internal Server Error
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (c *PluginAPI) UpdateConfig(ctx *gin.Context) { func (c *PluginAPI) UpdateConfig(ctx *gin.Context) {
withID(ctx, "id", func(id uint) { withID(ctx, "id", func(id uint) {
conf, err := c.DB.GetPluginConfByID(id) conf, err := c.DB.GetPluginConfByID(id)

View File

@ -115,31 +115,31 @@ func (a *API) register(client *client) {
// //
// Websocket, return newly created messages. // Websocket, return newly created messages.
// //
// --- // ---
// schema: ws, wss // schema: ws, wss
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// $ref: "#/definitions/Message" // $ref: "#/definitions/Message"
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 500: // 500:
// description: Server Error // description: Server Error
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *API) Handle(ctx *gin.Context) { func (a *API) Handle(ctx *gin.Context) {
conn, err := a.upgrader.Upgrade(ctx.Writer, ctx.Request, nil) conn, err := a.upgrader.Upgrade(ctx.Writer, ctx.Request, nil)
if err != nil { if err != nil {

View File

@ -69,24 +69,24 @@ type UserAPI struct {
// //
// Return all users. // Return all users.
// //
// --- // ---
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// type: array // type: array
// items: // items:
// $ref: "#/definitions/User" // $ref: "#/definitions/User"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *UserAPI) GetUsers(ctx *gin.Context) { func (a *UserAPI) GetUsers(ctx *gin.Context) {
users, err := a.DB.GetUsers() users, err := a.DB.GetUsers()
if success := successOrAbort(ctx, 500, err); !success { if success := successOrAbort(ctx, 500, err); !success {
@ -105,22 +105,22 @@ func (a *UserAPI) GetUsers(ctx *gin.Context) {
// //
// Return the current user. // Return the current user.
// //
// --- // ---
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// $ref: "#/definitions/User" // $ref: "#/definitions/User"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *UserAPI) GetCurrentUser(ctx *gin.Context) { func (a *UserAPI) GetCurrentUser(ctx *gin.Context) {
user, err := a.DB.GetUserByID(auth.GetUserID(ctx)) user, err := a.DB.GetUserByID(auth.GetUserID(ctx))
if success := successOrAbort(ctx, 500, err); !success { if success := successOrAbort(ctx, 500, err); !success {
@ -137,34 +137,34 @@ func (a *UserAPI) GetCurrentUser(ctx *gin.Context) {
// With enabled registration: non admin users can be created without authentication. // With enabled registration: non admin users can be created without authentication.
// With disabled registrations: users can only be created by admin users. // With disabled registrations: users can only be created by admin users.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// parameters: // parameters:
// - name: body // - name: body
// in: body // in: body
// description: the user to add // description: the user to add
// required: true // required: true
// schema: // schema:
// $ref: "#/definitions/CreateUserExternal" // $ref: "#/definitions/CreateUserExternal"
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// $ref: "#/definitions/User" // $ref: "#/definitions/User"
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *UserAPI) CreateUser(ctx *gin.Context) { func (a *UserAPI) CreateUser(ctx *gin.Context) {
user := model.CreateUserExternal{} user := model.CreateUserExternal{}
if err := ctx.Bind(&user); err == nil { if err := ctx.Bind(&user); err == nil {
@ -223,38 +223,38 @@ func (a *UserAPI) CreateUser(ctx *gin.Context) {
// //
// Get a user. // Get a user.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// parameters: // parameters:
// - name: id // - name: id
// in: path // in: path
// description: the user id // description: the user id
// required: true // required: true
// type: integer // type: integer
// format: int64 // format: int64
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// $ref: "#/definitions/User" // $ref: "#/definitions/User"
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *UserAPI) GetUserByID(ctx *gin.Context) { func (a *UserAPI) GetUserByID(ctx *gin.Context) {
withID(ctx, "id", func(id uint) { withID(ctx, "id", func(id uint) {
user, err := a.DB.GetUserByID(id) user, err := a.DB.GetUserByID(id)
@ -274,35 +274,35 @@ func (a *UserAPI) GetUserByID(ctx *gin.Context) {
// //
// Deletes a user. // Deletes a user.
// //
// --- // ---
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// parameters: // parameters:
// - name: id // - name: id
// in: path // in: path
// description: the user id // description: the user id
// required: true // required: true
// type: integer // type: integer
// format: int64 // format: int64
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *UserAPI) DeleteUserByID(ctx *gin.Context) { func (a *UserAPI) DeleteUserByID(ctx *gin.Context) {
withID(ctx, "id", func(id uint) { withID(ctx, "id", func(id uint) {
user, err := a.DB.GetUserByID(id) user, err := a.DB.GetUserByID(id)
@ -334,32 +334,32 @@ func (a *UserAPI) DeleteUserByID(ctx *gin.Context) {
// //
// Update the password of the current user. // Update the password of the current user.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// parameters: // parameters:
// - name: body // - name: body
// in: body // in: body
// description: the user // description: the user
// required: true // required: true
// schema: // schema:
// $ref: "#/definitions/UserPass" // $ref: "#/definitions/UserPass"
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *UserAPI) ChangePassword(ctx *gin.Context) { func (a *UserAPI) ChangePassword(ctx *gin.Context) {
pw := model.UserExternalPass{} pw := model.UserExternalPass{}
if err := ctx.Bind(&pw); err == nil { if err := ctx.Bind(&pw); err == nil {
@ -377,44 +377,44 @@ func (a *UserAPI) ChangePassword(ctx *gin.Context) {
// //
// Update a user. // Update a user.
// //
// --- // ---
// consumes: [application/json] // consumes: [application/json]
// produces: [application/json] // produces: [application/json]
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] // security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
// parameters: // parameters:
// - name: id // - name: id
// in: path // in: path
// description: the user id // description: the user id
// required: true // required: true
// type: integer // type: integer
// format: int64 // format: int64
// - name: body // - name: body
// in: body // in: body
// description: the updated user // description: the updated user
// required: true // required: true
// schema: // schema:
// $ref: "#/definitions/UpdateUserExternal" // $ref: "#/definitions/UpdateUserExternal"
// responses: // responses:
// 200: // 200:
// description: Ok // description: Ok
// schema: // schema:
// $ref: "#/definitions/User" // $ref: "#/definitions/User"
// 400: // 400:
// description: Bad Request // description: Bad Request
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 401: // 401:
// description: Unauthorized // description: Unauthorized
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 403: // 403:
// description: Forbidden // description: Forbidden
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
// 404: // 404:
// description: Not Found // description: Not Found
// schema: // schema:
// $ref: "#/definitions/Error" // $ref: "#/definitions/Error"
func (a *UserAPI) UpdateUserByID(ctx *gin.Context) { func (a *UserAPI) UpdateUserByID(ctx *gin.Context) {
withID(ctx, "id", func(id uint) { withID(ctx, "id", func(id uint) {
var user *model.UpdateUserExternal var user *model.UpdateUserExternal

View File

@ -2,61 +2,61 @@
// //
// This is the documentation of the Gotify REST-API. // This is the documentation of the Gotify REST-API.
// //
// # Authentication // # Authentication
// In Gotify there are two token types: // In Gotify there are two token types:
// __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) // __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app)
// __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) // __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script)
// //
// The token can be transmitted in a header named `X-Gotify-Key`, in a query parameter named `token` or // The token can be transmitted in a header named `X-Gotify-Key`, in a query parameter named `token` or
// through a header named `Authorization` with the value prefixed with `Bearer` (Ex. `Bearer randomtoken`). // through a header named `Authorization` with the value prefixed with `Bearer` (Ex. `Bearer randomtoken`).
// There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. // There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken.
// //
// \--- // \---
// //
// Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues) // Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
// //
// Schemes: http, https // Schemes: http, https
// Host: localhost // Host: localhost
// Version: 2.0.2 // Version: 2.0.2
// License: MIT https://github.com/gotify/server/blob/master/LICENSE // License: MIT https://github.com/gotify/server/blob/master/LICENSE
// //
// Consumes: // Consumes:
// - application/json // - application/json
// //
// Produces: // Produces:
// - application/json // - application/json
// //
// SecurityDefinitions: // SecurityDefinitions:
// appTokenQuery: // appTokenQuery:
// type: apiKey // type: apiKey
// name: token // name: token
// in: query // in: query
// clientTokenQuery: // clientTokenQuery:
// type: apiKey // type: apiKey
// name: token // name: token
// in: query // in: query
// appTokenHeader: // appTokenHeader:
// type: apiKey // type: apiKey
// name: X-Gotify-Key // name: X-Gotify-Key
// in: header // in: header
// clientTokenHeader: // clientTokenHeader:
// type: apiKey // type: apiKey
// name: X-Gotify-Key // name: X-Gotify-Key
// in: header // in: header
// appTokenAuthorizationHeader: // appTokenAuthorizationHeader:
// type: apiKey // type: apiKey
// name: Authorization // name: Authorization
// in: header // in: header
// description: >- // description: >-
// Enter an application token with the `Bearer` prefix, e.g. `Bearer Axxxxxxxxxx`. // Enter an application token with the `Bearer` prefix, e.g. `Bearer Axxxxxxxxxx`.
// clientTokenAuthorizationHeader: // clientTokenAuthorizationHeader:
// type: apiKey // type: apiKey
// name: Authorization // name: Authorization
// in: header // in: header
// description: >- // description: >-
// Enter a client token with the `Bearer` prefix, e.g. `Bearer Cxxxxxxxxxx`. // Enter a client token with the `Bearer` prefix, e.g. `Bearer Cxxxxxxxxxx`.
// basicAuth: // basicAuth:
// type: basic // type: basic
// //
// swagger:meta // swagger:meta
package docs package docs

View File

@ -2123,7 +2123,7 @@
"x-go-package": "github.com/gotify/server/v2/model" "x-go-package": "github.com/gotify/server/v2/model"
}, },
"ApplicationParams": { "ApplicationParams": {
"description": "Params allowed to create or update Applications", "description": "Params allowed to create or update Applications.",
"type": "object", "type": "object",
"title": "Application Params Model", "title": "Application Params Model",
"required": [ "required": [
@ -2195,7 +2195,7 @@
"x-go-package": "github.com/gotify/server/v2/model" "x-go-package": "github.com/gotify/server/v2/model"
}, },
"ClientParams": { "ClientParams": {
"description": "Params allowed to create or update Clients", "description": "Params allowed to create or update Clients.",
"type": "object", "type": "object",
"title": "Client Params Model", "title": "Client Params Model",
"required": [ "required": [
@ -2328,9 +2328,7 @@
"extras": { "extras": {
"description": "The extra data sent along the message.\n\nThe extra fields are stored in a key-value scheme. Only accepted in CreateMessage requests with application/json content-type.\n\nThe keys should be in the following format: \u0026lt;top-namespace\u0026gt;::[\u0026lt;sub-namespace\u0026gt;::]\u0026lt;action\u0026gt;\n\nThese namespaces are reserved and might be used in the official clients: gotify android ios web server client. Do not use them for other purposes.", "description": "The extra data sent along the message.\n\nThe extra fields are stored in a key-value scheme. Only accepted in CreateMessage requests with application/json content-type.\n\nThe keys should be in the following format: \u0026lt;top-namespace\u0026gt;::[\u0026lt;sub-namespace\u0026gt;::]\u0026lt;action\u0026gt;\n\nThese namespaces are reserved and might be used in the official clients: gotify android ios web server client. Do not use them for other purposes.",
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {},
"type": "object"
},
"x-go-name": "Extras", "x-go-name": "Extras",
"example": { "example": {
"home::appliances::lighting::on": { "home::appliances::lighting::on": {
@ -2373,7 +2371,7 @@
"x-go-package": "github.com/gotify/server/v2/model" "x-go-package": "github.com/gotify/server/v2/model"
}, },
"PagedMessages": { "PagedMessages": {
"description": "Wrapper for the paging and the messages", "description": "Wrapper for the paging and the messages.",
"type": "object", "type": "object",
"title": "PagedMessages Model", "title": "PagedMessages Model",
"required": [ "required": [

View File

@ -37,7 +37,7 @@ type Paging struct {
// PagedMessages Model // PagedMessages Model
// //
// Wrapper for the paging and the messages // Wrapper for the paging and the messages.
// //
// swagger:model PagedMessages // swagger:model PagedMessages
type PagedMessages struct { type PagedMessages struct {