From dcb4f253d80751b50acd3fb7278950bdff3479b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sun, 28 May 2023 17:04:44 +0200 Subject: [PATCH] fix swagger errors --- scnserver/api/handler/apiChannel.go | 4 +- scnserver/api/handler/apiClient.go | 10 +- scnserver/api/handler/apiKeyToken.go | 20 +- scnserver/api/handler/apiMessage.go | 4 +- scnserver/api/handler/apiSubscription.go | 12 +- scnserver/api/handler/apiUser.go | 2 +- scnserver/swagger/swagger.json | 658 ++++++++++++----------- scnserver/swagger/swagger.yaml | 455 +++++++++------- 8 files changed, 629 insertions(+), 536 deletions(-) diff --git a/scnserver/api/handler/apiChannel.go b/scnserver/api/handler/apiChannel.go index f36dca8..3e9282a 100644 --- a/scnserver/api/handler/apiChannel.go +++ b/scnserver/api/handler/apiChannel.go @@ -118,8 +118,8 @@ func (h APIHandler) ListChannels(g *gin.Context) ginresp.HTTPResponse { // @ID api-channels-get // @Tags API-v2 // -// @Param uid path int true "UserID" -// @Param cid path int true "ChannelID" +// @Param uid path string true "UserID" +// @Param cid path string true "ChannelID" // // @Success 200 {object} models.ChannelWithSubscriptionJSON // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" diff --git a/scnserver/api/handler/apiClient.go b/scnserver/api/handler/apiClient.go index 42b28b6..05dbdae 100644 --- a/scnserver/api/handler/apiClient.go +++ b/scnserver/api/handler/apiClient.go @@ -16,7 +16,7 @@ import ( // @ID api-clients-list // @Tags API-v2 // -// @Param uid path int true "UserID" +// @Param uid path string true "UserID" // // @Success 200 {object} handler.ListClients.response // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" @@ -59,8 +59,8 @@ func (h APIHandler) ListClients(g *gin.Context) ginresp.HTTPResponse { // @ID api-clients-get // @Tags API-v2 // -// @Param uid path int true "UserID" -// @Param cid path int true "ClientID" +// @Param uid path string true "UserID" +// @Param cid path string true "ClientID" // // @Success 200 {object} models.ClientJSON // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" @@ -164,8 +164,8 @@ func (h APIHandler) AddClient(g *gin.Context) ginresp.HTTPResponse { // @ID api-clients-delete // @Tags API-v2 // -// @Param uid path int true "UserID" -// @Param cid path int true "ClientID" +// @Param uid path string true "UserID" +// @Param cid path string true "ClientID" // // @Success 200 {object} models.ClientJSON // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" diff --git a/scnserver/api/handler/apiKeyToken.go b/scnserver/api/handler/apiKeyToken.go index 7220fb5..69ccc1f 100644 --- a/scnserver/api/handler/apiKeyToken.go +++ b/scnserver/api/handler/apiKeyToken.go @@ -17,7 +17,7 @@ import ( // @ID api-tokenkeys-list // @Tags API-v2 // -// @Param uid path int true "UserID" +// @Param uid path string true "UserID" // // @Success 200 {object} handler.ListUserKeys.response // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" @@ -25,7 +25,7 @@ import ( // @Failure 404 {object} ginresp.apiError "message not found" // @Failure 500 {object} ginresp.apiError "internal server error" // -// @Router /api/v2/users/:uid/keys [GET] +// @Router /api/v2/users/{uid}/keys [GET] func (h APIHandler) ListUserKeys(g *gin.Context) ginresp.HTTPResponse { type uri struct { UserID models.UserID `uri:"uid" binding:"entityid"` @@ -62,8 +62,8 @@ func (h APIHandler) ListUserKeys(g *gin.Context) ginresp.HTTPResponse { // @ID api-tokenkeys-get // @Tags API-v2 // -// @Param uid path int true "UserID" -// @Param kid path int true "TokenKeyID" +// @Param uid path string true "UserID" +// @Param kid path string true "TokenKeyID" // // @Success 200 {object} models.KeyTokenJSON // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" @@ -71,7 +71,7 @@ func (h APIHandler) ListUserKeys(g *gin.Context) ginresp.HTTPResponse { // @Failure 404 {object} ginresp.apiError "message not found" // @Failure 500 {object} ginresp.apiError "internal server error" // -// @Router /api/v2/users/:uid/keys/:kid [GET] +// @Router /api/v2/users/{uid}/keys/{kid} [GET] func (h APIHandler) GetUserKey(g *gin.Context) ginresp.HTTPResponse { type uri struct { UserID models.UserID `uri:"uid" binding:"entityid"` @@ -117,7 +117,7 @@ func (h APIHandler) GetUserKey(g *gin.Context) ginresp.HTTPResponse { // @Failure 404 {object} ginresp.apiError "message not found" // @Failure 500 {object} ginresp.apiError "internal server error" // -// @Router /api/v2/users/:uid/keys/:kid [PATCH] +// @Router /api/v2/users/{uid}/keys/{kid} [PATCH] func (h APIHandler) UpdateUserKey(g *gin.Context) ginresp.HTTPResponse { type uri struct { UserID models.UserID `uri:"uid" binding:"entityid"` @@ -214,7 +214,7 @@ func (h APIHandler) UpdateUserKey(g *gin.Context) ginresp.HTTPResponse { // @Failure 404 {object} ginresp.apiError "message not found" // @Failure 500 {object} ginresp.apiError "internal server error" // -// @Router /api/v2/users/:uid/keys [POST] +// @Router /api/v2/users/{uid}/keys [POST] func (h APIHandler) CreateUserKey(g *gin.Context) ginresp.HTTPResponse { type uri struct { UserID models.UserID `uri:"uid" binding:"entityid"` @@ -263,8 +263,8 @@ func (h APIHandler) CreateUserKey(g *gin.Context) ginresp.HTTPResponse { // @ID api-tokenkeys-delete // @Tags API-v2 // -// @Param uid path int true "UserID" -// @Param kid path int true "TokenKeyID" +// @Param uid path string true "UserID" +// @Param kid path string true "TokenKeyID" // // @Success 200 {object} models.KeyTokenJSON // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" @@ -272,7 +272,7 @@ func (h APIHandler) CreateUserKey(g *gin.Context) ginresp.HTTPResponse { // @Failure 404 {object} ginresp.apiError "message not found" // @Failure 500 {object} ginresp.apiError "internal server error" // -// @Router /api/v2/users/:uid/keys/:kid [DELETE] +// @Router /api/v2/users/{uid}/keys/{kid} [DELETE] func (h APIHandler) DeleteUserKey(g *gin.Context) ginresp.HTTPResponse { type uri struct { UserID models.UserID `uri:"uid" binding:"entityid"` diff --git a/scnserver/api/handler/apiMessage.go b/scnserver/api/handler/apiMessage.go index fb670b5..1ee9f78 100644 --- a/scnserver/api/handler/apiMessage.go +++ b/scnserver/api/handler/apiMessage.go @@ -165,7 +165,7 @@ func (h APIHandler) ListMessages(g *gin.Context) ginresp.HTTPResponse { // @ID api-messages-get // @Tags API-v2 // -// @Param mid path int true "MessageID" +// @Param mid path string true "MessageID" // // @Success 200 {object} models.MessageJSON // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" @@ -233,7 +233,7 @@ func (h APIHandler) GetMessage(g *gin.Context) ginresp.HTTPResponse { // @ID api-messages-delete // @Tags API-v2 // -// @Param mid path int true "MessageID" +// @Param mid path string true "MessageID" // // @Success 200 {object} models.MessageJSON // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" diff --git a/scnserver/api/handler/apiSubscription.go b/scnserver/api/handler/apiSubscription.go index ee6e382..084bac1 100644 --- a/scnserver/api/handler/apiSubscription.go +++ b/scnserver/api/handler/apiSubscription.go @@ -121,8 +121,8 @@ func (h APIHandler) ListUserSubscriptions(g *gin.Context) ginresp.HTTPResponse { // @ID api-chan-subscriptions-list // @Tags API-v2 // -// @Param uid path int true "UserID" -// @Param cid path int true "ChannelID" +// @Param uid path string true "UserID" +// @Param cid path string true "ChannelID" // // @Success 200 {object} handler.ListChannelSubscriptions.response // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" @@ -175,8 +175,8 @@ func (h APIHandler) ListChannelSubscriptions(g *gin.Context) ginresp.HTTPRespons // @ID api-subscriptions-get // @Tags API-v2 // -// @Param uid path int true "UserID" -// @Param sid path int true "SubscriptionID" +// @Param uid path string true "UserID" +// @Param sid path string true "SubscriptionID" // // @Success 200 {object} models.SubscriptionJSON // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" @@ -222,8 +222,8 @@ func (h APIHandler) GetSubscription(g *gin.Context) ginresp.HTTPResponse { // @ID api-subscriptions-delete // @Tags API-v2 // -// @Param uid path int true "UserID" -// @Param sid path int true "SubscriptionID" +// @Param uid path string true "UserID" +// @Param sid path string true "SubscriptionID" // // @Success 200 {object} models.SubscriptionJSON // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" diff --git a/scnserver/api/handler/apiUser.go b/scnserver/api/handler/apiUser.go index 33c5073..51f054e 100644 --- a/scnserver/api/handler/apiUser.go +++ b/scnserver/api/handler/apiUser.go @@ -137,7 +137,7 @@ func (h APIHandler) CreateUser(g *gin.Context) ginresp.HTTPResponse { // @ID api-user-get // @Tags API-v2 // -// @Param uid path int true "UserID" +// @Param uid path string true "UserID" // // @Success 200 {object} models.UserJSON // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" diff --git a/scnserver/swagger/swagger.json b/scnserver/swagger/swagger.json index 8d37438..8a98a33 100644 --- a/scnserver/swagger/swagger.json +++ b/scnserver/swagger/swagger.json @@ -851,6 +851,36 @@ "summary": "List all (subscribed) messages", "operationId": "api-messages-list", "parameters": [ + { + "type": "string", + "description": "RFC3339", + "name": "after", + "in": "query" + }, + { + "type": "string", + "description": "RFC3339", + "name": "before", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "name": "channel", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "name": "channel_id", + "in": "query" + }, { "type": "string", "name": "filter", @@ -866,11 +896,37 @@ "name": "page_size", "in": "query" }, + { + "type": "array", + "items": { + "type": "integer" + }, + "collectionFormat": "csv", + "name": "priority", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "name": "sender", + "in": "query" + }, { "type": "boolean", - "description": "TODO more filter (sender-name, channel, timestamps, prio, )", "name": "trimmed", "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "name": "used_key", + "in": "query" } ], "responses": { @@ -911,7 +967,7 @@ "operationId": "api-messages-delete", "parameters": [ { - "type": "integer", + "type": "string", "description": "MessageID", "name": "mid", "in": "path", @@ -960,7 +1016,7 @@ "operationId": "api-messages-get", "parameters": [ { - "type": "integer", + "type": "string", "description": "MessageID", "name": "mid", "in": "path", @@ -1040,290 +1096,6 @@ } } }, - "/api/v2/users/:uid/keys": { - "get": { - "description": "The request must be done with an ADMIN key, the returned keys are without their token.", - "tags": [ - "API-v2" - ], - "summary": "List keys of the user", - "operationId": "api-tokenkeys-list", - "parameters": [ - { - "type": "integer", - "description": "UserID", - "name": "uid", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/handler.ListUserKeys.response" - } - }, - "400": { - "description": "supplied values/parameters cannot be parsed / are invalid", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "401": { - "description": "user is not authorized / has missing permissions", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "404": { - "description": "message not found", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "500": { - "description": "internal server error", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - } - } - }, - "post": { - "tags": [ - "API-v2" - ], - "summary": "Create a new key", - "operationId": "api-tokenkeys-create", - "parameters": [ - { - "type": "integer", - "description": "UserID", - "name": "uid", - "in": "path", - "required": true - }, - { - "description": " ", - "name": "post_body", - "in": "body", - "schema": { - "$ref": "#/definitions/handler.CreateUserKey.body" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/models.KeyTokenJSON" - } - }, - "400": { - "description": "supplied values/parameters cannot be parsed / are invalid", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "401": { - "description": "user is not authorized / has missing permissions", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "404": { - "description": "message not found", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "500": { - "description": "internal server error", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - } - } - } - }, - "/api/v2/users/:uid/keys/:kid": { - "get": { - "description": "The request must be done with an ADMIN key, the returned key does not include its token.", - "tags": [ - "API-v2" - ], - "summary": "Get a single key", - "operationId": "api-tokenkeys-get", - "parameters": [ - { - "type": "integer", - "description": "UserID", - "name": "uid", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "TokenKeyID", - "name": "kid", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/models.KeyTokenJSON" - } - }, - "400": { - "description": "supplied values/parameters cannot be parsed / are invalid", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "401": { - "description": "user is not authorized / has missing permissions", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "404": { - "description": "message not found", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "500": { - "description": "internal server error", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - } - } - }, - "delete": { - "description": "Cannot be used to delete the key used in the request itself", - "tags": [ - "API-v2" - ], - "summary": "Delete a key", - "operationId": "api-tokenkeys-delete", - "parameters": [ - { - "type": "integer", - "description": "UserID", - "name": "uid", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "TokenKeyID", - "name": "kid", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/models.KeyTokenJSON" - } - }, - "400": { - "description": "supplied values/parameters cannot be parsed / are invalid", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "401": { - "description": "user is not authorized / has missing permissions", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "404": { - "description": "message not found", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "500": { - "description": "internal server error", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - } - } - }, - "patch": { - "tags": [ - "API-v2" - ], - "summary": "Update a key", - "operationId": "api-tokenkeys-update", - "parameters": [ - { - "type": "integer", - "description": "UserID", - "name": "uid", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "TokenKeyID", - "name": "kid", - "in": "path", - "required": true - }, - { - "description": " ", - "name": "post_body", - "in": "body", - "schema": { - "$ref": "#/definitions/handler.UpdateUserKey.body" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/models.KeyTokenJSON" - } - }, - "400": { - "description": "supplied values/parameters cannot be parsed / are invalid", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "401": { - "description": "user is not authorized / has missing permissions", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "404": { - "description": "message not found", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "500": { - "description": "internal server error", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - } - } - } - }, "/api/v2/users/{uid}": { "get": { "tags": [ @@ -1333,7 +1105,7 @@ "operationId": "api-user-get", "parameters": [ { - "type": "integer", + "type": "string", "description": "UserID", "name": "uid", "in": "path", @@ -1562,14 +1334,14 @@ "operationId": "api-channels-get", "parameters": [ { - "type": "integer", + "type": "string", "description": "UserID", "name": "uid", "in": "path", "required": true }, { - "type": "integer", + "type": "string", "description": "ChannelID", "name": "cid", "in": "path", @@ -1776,14 +1548,14 @@ "operationId": "api-chan-subscriptions-list", "parameters": [ { - "type": "integer", + "type": "string", "description": "UserID", "name": "uid", "in": "path", "required": true }, { - "type": "integer", + "type": "string", "description": "ChannelID", "name": "cid", "in": "path", @@ -1833,7 +1605,7 @@ "operationId": "api-clients-list", "parameters": [ { - "type": "integer", + "type": "string", "description": "UserID", "name": "uid", "in": "path", @@ -1927,14 +1699,14 @@ "operationId": "api-clients-get", "parameters": [ { - "type": "integer", + "type": "string", "description": "UserID", "name": "uid", "in": "path", "required": true }, { - "type": "integer", + "type": "string", "description": "ClientID", "name": "cid", "in": "path", @@ -1982,14 +1754,14 @@ "operationId": "api-clients-delete", "parameters": [ { - "type": "integer", + "type": "string", "description": "UserID", "name": "uid", "in": "path", "required": true }, { - "type": "integer", + "type": "string", "description": "ClientID", "name": "cid", "in": "path", @@ -2030,6 +1802,290 @@ } } }, + "/api/v2/users/{uid}/keys": { + "get": { + "description": "The request must be done with an ADMIN key, the returned keys are without their token.", + "tags": [ + "API-v2" + ], + "summary": "List keys of the user", + "operationId": "api-tokenkeys-list", + "parameters": [ + { + "type": "string", + "description": "UserID", + "name": "uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handler.ListUserKeys.response" + } + }, + "400": { + "description": "supplied values/parameters cannot be parsed / are invalid", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + }, + "401": { + "description": "user is not authorized / has missing permissions", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + }, + "404": { + "description": "message not found", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + }, + "500": { + "description": "internal server error", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + } + } + }, + "post": { + "tags": [ + "API-v2" + ], + "summary": "Create a new key", + "operationId": "api-tokenkeys-create", + "parameters": [ + { + "type": "integer", + "description": "UserID", + "name": "uid", + "in": "path", + "required": true + }, + { + "description": " ", + "name": "post_body", + "in": "body", + "schema": { + "$ref": "#/definitions/handler.CreateUserKey.body" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.KeyTokenJSON" + } + }, + "400": { + "description": "supplied values/parameters cannot be parsed / are invalid", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + }, + "401": { + "description": "user is not authorized / has missing permissions", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + }, + "404": { + "description": "message not found", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + }, + "500": { + "description": "internal server error", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + } + } + } + }, + "/api/v2/users/{uid}/keys/{kid}": { + "get": { + "description": "The request must be done with an ADMIN key, the returned key does not include its token.", + "tags": [ + "API-v2" + ], + "summary": "Get a single key", + "operationId": "api-tokenkeys-get", + "parameters": [ + { + "type": "string", + "description": "UserID", + "name": "uid", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "TokenKeyID", + "name": "kid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.KeyTokenJSON" + } + }, + "400": { + "description": "supplied values/parameters cannot be parsed / are invalid", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + }, + "401": { + "description": "user is not authorized / has missing permissions", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + }, + "404": { + "description": "message not found", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + }, + "500": { + "description": "internal server error", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + } + } + }, + "delete": { + "description": "Cannot be used to delete the key used in the request itself", + "tags": [ + "API-v2" + ], + "summary": "Delete a key", + "operationId": "api-tokenkeys-delete", + "parameters": [ + { + "type": "string", + "description": "UserID", + "name": "uid", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "TokenKeyID", + "name": "kid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.KeyTokenJSON" + } + }, + "400": { + "description": "supplied values/parameters cannot be parsed / are invalid", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + }, + "401": { + "description": "user is not authorized / has missing permissions", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + }, + "404": { + "description": "message not found", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + }, + "500": { + "description": "internal server error", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + } + } + }, + "patch": { + "tags": [ + "API-v2" + ], + "summary": "Update a key", + "operationId": "api-tokenkeys-update", + "parameters": [ + { + "type": "integer", + "description": "UserID", + "name": "uid", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "TokenKeyID", + "name": "kid", + "in": "path", + "required": true + }, + { + "description": " ", + "name": "post_body", + "in": "body", + "schema": { + "$ref": "#/definitions/handler.UpdateUserKey.body" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.KeyTokenJSON" + } + }, + "400": { + "description": "supplied values/parameters cannot be parsed / are invalid", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + }, + "401": { + "description": "user is not authorized / has missing permissions", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + }, + "404": { + "description": "message not found", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + }, + "500": { + "description": "internal server error", + "schema": { + "$ref": "#/definitions/ginresp.apiError" + } + } + } + } + }, "/api/v2/users/{uid}/subscriptions": { "get": { "description": "The possible values for 'selector' are:\n- \"outgoing_all\" All subscriptions (confirmed/unconfirmed) with the user as subscriber (= subscriptions he can use to read channels)\n- \"outgoing_confirmed\" Confirmed subscriptions with the user as subscriber\n- \"outgoing_unconfirmed\" Unconfirmed (Pending) subscriptions with the user as subscriber\n- \"incoming_all\" All subscriptions (confirmed/unconfirmed) from other users to channels of this user (= incoming subscriptions and subscription requests)\n- \"incoming_confirmed\" Confirmed subscriptions from other users to channels of this user\n- \"incoming_unconfirmed\" Unconfirmed subscriptions from other users to channels of this user (= requests)", @@ -2155,14 +2211,14 @@ "operationId": "api-subscriptions-get", "parameters": [ { - "type": "integer", + "type": "string", "description": "UserID", "name": "uid", "in": "path", "required": true }, { - "type": "integer", + "type": "string", "description": "SubscriptionID", "name": "sid", "in": "path", @@ -2210,14 +2266,14 @@ "operationId": "api-subscriptions-delete", "parameters": [ { - "type": "integer", + "type": "string", "description": "UserID", "name": "uid", "in": "path", "required": true }, { - "type": "integer", + "type": "string", "description": "SubscriptionID", "name": "sid", "in": "path", diff --git a/scnserver/swagger/swagger.yaml b/scnserver/swagger/swagger.yaml index fa02e26..247d7d3 100644 --- a/scnserver/swagger/swagger.yaml +++ b/scnserver/swagger/swagger.yaml @@ -1264,6 +1264,26 @@ paths: By default we return long messages with a trimmed body, if trimmed=false is supplied we return full messages (this reduces the max page_size) operationId: api-messages-list parameters: + - description: RFC3339 + in: query + name: after + type: string + - description: RFC3339 + in: query + name: before + type: string + - collectionFormat: csv + in: query + items: + type: string + name: channel + type: array + - collectionFormat: csv + in: query + items: + type: string + name: channel_id + type: array - in: query name: filter type: string @@ -1273,10 +1293,27 @@ paths: - in: query name: page_size type: integer - - description: TODO more filter (sender-name, channel, timestamps, prio, ) + - collectionFormat: csv in: query + items: + type: integer + name: priority + type: array + - collectionFormat: csv + in: query + items: + type: string + name: sender + type: array + - in: query name: trimmed type: boolean + - collectionFormat: csv + in: query + items: + type: string + name: used_key + type: array responses: "200": description: OK @@ -1307,7 +1344,7 @@ paths: in: path name: mid required: true - type: integer + type: string responses: "200": description: OK @@ -1343,7 +1380,7 @@ paths: in: path name: mid required: true - type: integer + type: string responses: "200": description: OK @@ -1393,198 +1430,6 @@ paths: summary: Create a new user tags: - API-v2 - /api/v2/users/:uid/keys: - get: - description: The request must be done with an ADMIN key, the returned keys are - without their token. - operationId: api-tokenkeys-list - parameters: - - description: UserID - in: path - name: uid - required: true - type: integer - responses: - "200": - description: OK - schema: - $ref: '#/definitions/handler.ListUserKeys.response' - "400": - description: supplied values/parameters cannot be parsed / are invalid - schema: - $ref: '#/definitions/ginresp.apiError' - "401": - description: user is not authorized / has missing permissions - schema: - $ref: '#/definitions/ginresp.apiError' - "404": - description: message not found - schema: - $ref: '#/definitions/ginresp.apiError' - "500": - description: internal server error - schema: - $ref: '#/definitions/ginresp.apiError' - summary: List keys of the user - tags: - - API-v2 - post: - operationId: api-tokenkeys-create - parameters: - - description: UserID - in: path - name: uid - required: true - type: integer - - description: ' ' - in: body - name: post_body - schema: - $ref: '#/definitions/handler.CreateUserKey.body' - responses: - "200": - description: OK - schema: - $ref: '#/definitions/models.KeyTokenJSON' - "400": - description: supplied values/parameters cannot be parsed / are invalid - schema: - $ref: '#/definitions/ginresp.apiError' - "401": - description: user is not authorized / has missing permissions - schema: - $ref: '#/definitions/ginresp.apiError' - "404": - description: message not found - schema: - $ref: '#/definitions/ginresp.apiError' - "500": - description: internal server error - schema: - $ref: '#/definitions/ginresp.apiError' - summary: Create a new key - tags: - - API-v2 - /api/v2/users/:uid/keys/:kid: - delete: - description: Cannot be used to delete the key used in the request itself - operationId: api-tokenkeys-delete - parameters: - - description: UserID - in: path - name: uid - required: true - type: integer - - description: TokenKeyID - in: path - name: kid - required: true - type: integer - responses: - "200": - description: OK - schema: - $ref: '#/definitions/models.KeyTokenJSON' - "400": - description: supplied values/parameters cannot be parsed / are invalid - schema: - $ref: '#/definitions/ginresp.apiError' - "401": - description: user is not authorized / has missing permissions - schema: - $ref: '#/definitions/ginresp.apiError' - "404": - description: message not found - schema: - $ref: '#/definitions/ginresp.apiError' - "500": - description: internal server error - schema: - $ref: '#/definitions/ginresp.apiError' - summary: Delete a key - tags: - - API-v2 - get: - description: The request must be done with an ADMIN key, the returned key does - not include its token. - operationId: api-tokenkeys-get - parameters: - - description: UserID - in: path - name: uid - required: true - type: integer - - description: TokenKeyID - in: path - name: kid - required: true - type: integer - responses: - "200": - description: OK - schema: - $ref: '#/definitions/models.KeyTokenJSON' - "400": - description: supplied values/parameters cannot be parsed / are invalid - schema: - $ref: '#/definitions/ginresp.apiError' - "401": - description: user is not authorized / has missing permissions - schema: - $ref: '#/definitions/ginresp.apiError' - "404": - description: message not found - schema: - $ref: '#/definitions/ginresp.apiError' - "500": - description: internal server error - schema: - $ref: '#/definitions/ginresp.apiError' - summary: Get a single key - tags: - - API-v2 - patch: - operationId: api-tokenkeys-update - parameters: - - description: UserID - in: path - name: uid - required: true - type: integer - - description: TokenKeyID - in: path - name: kid - required: true - type: integer - - description: ' ' - in: body - name: post_body - schema: - $ref: '#/definitions/handler.UpdateUserKey.body' - responses: - "200": - description: OK - schema: - $ref: '#/definitions/models.KeyTokenJSON' - "400": - description: supplied values/parameters cannot be parsed / are invalid - schema: - $ref: '#/definitions/ginresp.apiError' - "401": - description: user is not authorized / has missing permissions - schema: - $ref: '#/definitions/ginresp.apiError' - "404": - description: message not found - schema: - $ref: '#/definitions/ginresp.apiError' - "500": - description: internal server error - schema: - $ref: '#/definitions/ginresp.apiError' - summary: Update a key - tags: - - API-v2 /api/v2/users/{uid}: get: operationId: api-user-get @@ -1593,7 +1438,7 @@ paths: in: path name: uid required: true - type: integer + type: string responses: "200": description: OK @@ -1752,12 +1597,12 @@ paths: in: path name: uid required: true - type: integer + type: string - description: ChannelID in: path name: cid required: true - type: integer + type: string responses: "200": description: OK @@ -1898,12 +1743,12 @@ paths: in: path name: uid required: true - type: integer + type: string - description: ChannelID in: path name: cid required: true - type: integer + type: string responses: "200": description: OK @@ -1936,7 +1781,7 @@ paths: in: path name: uid required: true - type: integer + type: string responses: "200": description: OK @@ -1998,12 +1843,12 @@ paths: in: path name: uid required: true - type: integer + type: string - description: ClientID in: path name: cid required: true - type: integer + type: string responses: "200": description: OK @@ -2035,12 +1880,12 @@ paths: in: path name: uid required: true - type: integer + type: string - description: ClientID in: path name: cid required: true - type: integer + type: string responses: "200": description: OK @@ -2065,6 +1910,198 @@ paths: summary: Get a single client tags: - API-v2 + /api/v2/users/{uid}/keys: + get: + description: The request must be done with an ADMIN key, the returned keys are + without their token. + operationId: api-tokenkeys-list + parameters: + - description: UserID + in: path + name: uid + required: true + type: string + responses: + "200": + description: OK + schema: + $ref: '#/definitions/handler.ListUserKeys.response' + "400": + description: supplied values/parameters cannot be parsed / are invalid + schema: + $ref: '#/definitions/ginresp.apiError' + "401": + description: user is not authorized / has missing permissions + schema: + $ref: '#/definitions/ginresp.apiError' + "404": + description: message not found + schema: + $ref: '#/definitions/ginresp.apiError' + "500": + description: internal server error + schema: + $ref: '#/definitions/ginresp.apiError' + summary: List keys of the user + tags: + - API-v2 + post: + operationId: api-tokenkeys-create + parameters: + - description: UserID + in: path + name: uid + required: true + type: integer + - description: ' ' + in: body + name: post_body + schema: + $ref: '#/definitions/handler.CreateUserKey.body' + responses: + "200": + description: OK + schema: + $ref: '#/definitions/models.KeyTokenJSON' + "400": + description: supplied values/parameters cannot be parsed / are invalid + schema: + $ref: '#/definitions/ginresp.apiError' + "401": + description: user is not authorized / has missing permissions + schema: + $ref: '#/definitions/ginresp.apiError' + "404": + description: message not found + schema: + $ref: '#/definitions/ginresp.apiError' + "500": + description: internal server error + schema: + $ref: '#/definitions/ginresp.apiError' + summary: Create a new key + tags: + - API-v2 + /api/v2/users/{uid}/keys/{kid}: + delete: + description: Cannot be used to delete the key used in the request itself + operationId: api-tokenkeys-delete + parameters: + - description: UserID + in: path + name: uid + required: true + type: string + - description: TokenKeyID + in: path + name: kid + required: true + type: string + responses: + "200": + description: OK + schema: + $ref: '#/definitions/models.KeyTokenJSON' + "400": + description: supplied values/parameters cannot be parsed / are invalid + schema: + $ref: '#/definitions/ginresp.apiError' + "401": + description: user is not authorized / has missing permissions + schema: + $ref: '#/definitions/ginresp.apiError' + "404": + description: message not found + schema: + $ref: '#/definitions/ginresp.apiError' + "500": + description: internal server error + schema: + $ref: '#/definitions/ginresp.apiError' + summary: Delete a key + tags: + - API-v2 + get: + description: The request must be done with an ADMIN key, the returned key does + not include its token. + operationId: api-tokenkeys-get + parameters: + - description: UserID + in: path + name: uid + required: true + type: string + - description: TokenKeyID + in: path + name: kid + required: true + type: string + responses: + "200": + description: OK + schema: + $ref: '#/definitions/models.KeyTokenJSON' + "400": + description: supplied values/parameters cannot be parsed / are invalid + schema: + $ref: '#/definitions/ginresp.apiError' + "401": + description: user is not authorized / has missing permissions + schema: + $ref: '#/definitions/ginresp.apiError' + "404": + description: message not found + schema: + $ref: '#/definitions/ginresp.apiError' + "500": + description: internal server error + schema: + $ref: '#/definitions/ginresp.apiError' + summary: Get a single key + tags: + - API-v2 + patch: + operationId: api-tokenkeys-update + parameters: + - description: UserID + in: path + name: uid + required: true + type: integer + - description: TokenKeyID + in: path + name: kid + required: true + type: integer + - description: ' ' + in: body + name: post_body + schema: + $ref: '#/definitions/handler.UpdateUserKey.body' + responses: + "200": + description: OK + schema: + $ref: '#/definitions/models.KeyTokenJSON' + "400": + description: supplied values/parameters cannot be parsed / are invalid + schema: + $ref: '#/definitions/ginresp.apiError' + "401": + description: user is not authorized / has missing permissions + schema: + $ref: '#/definitions/ginresp.apiError' + "404": + description: message not found + schema: + $ref: '#/definitions/ginresp.apiError' + "500": + description: internal server error + schema: + $ref: '#/definitions/ginresp.apiError' + summary: Update a key + tags: + - API-v2 /api/v2/users/{uid}/subscriptions: get: description: |- @@ -2160,12 +2197,12 @@ paths: in: path name: uid required: true - type: integer + type: string - description: SubscriptionID in: path name: sid required: true - type: integer + type: string responses: "200": description: OK @@ -2197,12 +2234,12 @@ paths: in: path name: uid required: true - type: integer + type: string - description: SubscriptionID in: path name: sid required: true - type: integer + type: string responses: "200": description: OK