diff --git a/server/api/apierr/enums.go b/server/api/apierr/enums.go index 739611b..6303670 100644 --- a/server/api/apierr/enums.go +++ b/server/api/apierr/enums.go @@ -36,6 +36,8 @@ const ( NO_DEVICE_LINKED APIError = 1401 + CHANNEL_ALREADY_EXISTS APIError = 1501 + QUOTA_REACHED APIError = 2101 FAILED_VERIFY_PRO_TOKEN APIError = 3001 diff --git a/server/api/handler/api.go b/server/api/handler/api.go index 98fee2c..49b5c7f 100644 --- a/server/api/handler/api.go +++ b/server/api/handler/api.go @@ -36,8 +36,8 @@ func NewAPIHandler(app *logic.Application) APIHandler { // @Param post_body body handler.CreateUser.body false " " // // @Success 200 {object} models.UserJSONWithClients -// @Failure 400 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/users [POST] func (h APIHandler) CreateUser(g *gin.Context) ginresp.HTTPResponse { @@ -142,10 +142,10 @@ func (h APIHandler) CreateUser(g *gin.Context) ginresp.HTTPResponse { // @Param uid path int true "UserID" // // @Success 200 {object} models.UserJSON -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 404 {object} ginresp.apiError "user not found" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/users/{uid} [GET] func (h APIHandler) GetUser(g *gin.Context) ginresp.HTTPResponse { @@ -191,10 +191,10 @@ func (h APIHandler) GetUser(g *gin.Context) ginresp.HTTPResponse { // @Param admin_key body string false "Send `true` to create a new admin_key" // // @Success 200 {object} models.UserJSON -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 404 {object} ginresp.apiError "user not found" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/users/{uid} [PATCH] func (h APIHandler) UpdateUser(g *gin.Context) ginresp.HTTPResponse { @@ -298,10 +298,9 @@ func (h APIHandler) UpdateUser(g *gin.Context) ginresp.HTTPResponse { // @Param uid path int true "UserID" // // @Success 200 {object} handler.ListClients.response -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/users/{uid}/clients [GET] func (h APIHandler) ListClients(g *gin.Context) ginresp.HTTPResponse { @@ -343,10 +342,10 @@ func (h APIHandler) ListClients(g *gin.Context) ginresp.HTTPResponse { // @Param cid path int true "ClientID" // // @Success 200 {object} models.ClientJSON -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 404 {object} ginresp.apiError "client not found" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/users/{uid}/clients/{cid} [GET] func (h APIHandler) GetClient(g *gin.Context) ginresp.HTTPResponse { @@ -388,10 +387,9 @@ func (h APIHandler) GetClient(g *gin.Context) ginresp.HTTPResponse { // @Param post_body body handler.AddClient.body false " " // // @Success 200 {object} models.ClientJSON -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/users/{uid}/clients [POST] func (h APIHandler) AddClient(g *gin.Context) ginresp.HTTPResponse { @@ -449,10 +447,10 @@ func (h APIHandler) AddClient(g *gin.Context) ginresp.HTTPResponse { // @Param cid path int true "ClientID" // // @Success 200 {object} models.ClientJSON -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 404 {object} ginresp.apiError "client not found" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/users/{uid}/clients/{cid} [DELETE] func (h APIHandler) DeleteClient(g *gin.Context) ginresp.HTTPResponse { @@ -504,10 +502,9 @@ func (h APIHandler) DeleteClient(g *gin.Context) ginresp.HTTPResponse { // @Param selector query string true "Filter channels (default: owned)" Enums(owned, subscribed, all, subscribed_any, all_any) // // @Success 200 {object} handler.ListChannels.response -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/users/{uid}/channels [GET] func (h APIHandler) ListChannels(g *gin.Context) ginresp.HTTPResponse { @@ -584,10 +581,10 @@ func (h APIHandler) ListChannels(g *gin.Context) ginresp.HTTPResponse { // @Param cid path int true "ChannelID" // // @Success 200 {object} models.ChannelJSON -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 404 {object} ginresp.apiError "channel not found" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/users/{uid}/channels/{cid} [GET] func (h APIHandler) GetChannel(g *gin.Context) ginresp.HTTPResponse { @@ -631,10 +628,10 @@ func (h APIHandler) GetChannel(g *gin.Context) ginresp.HTTPResponse { // @Param send_key body string false "Send `true` to create a new send_key" // // @Success 200 {object} models.ChannelJSON -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 404 {object} ginresp.apiError "channel not found" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/users/{uid}/channels/{cid} [PATCH] func (h APIHandler) UpdateChannel(g *gin.Context) ginresp.HTTPResponse { @@ -708,10 +705,10 @@ func (h APIHandler) UpdateChannel(g *gin.Context) ginresp.HTTPResponse { // @Param cid path int true "ChannelID" // // @Success 200 {object} handler.ListChannelMessages.response -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 404 {object} ginresp.apiError "channel not found" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/users/{uid}/channels/{cid}/messages [GET] func (h APIHandler) ListChannelMessages(g *gin.Context) ginresp.HTTPResponse { @@ -803,10 +800,9 @@ func (h APIHandler) ListChannelMessages(g *gin.Context) ginresp.HTTPResponse { // @Param uid path int true "UserID" // // @Success 200 {object} handler.ListUserSubscriptions.response -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/users/{uid}/subscriptions [GET] func (h APIHandler) ListUserSubscriptions(g *gin.Context) ginresp.HTTPResponse { @@ -848,10 +844,10 @@ func (h APIHandler) ListUserSubscriptions(g *gin.Context) ginresp.HTTPResponse { // @Param cid path int true "ChannelID" // // @Success 200 {object} handler.ListChannelSubscriptions.response -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 404 {object} ginresp.apiError "channel not found" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/users/{uid}/channels/{cid}/subscriptions [GET] func (h APIHandler) ListChannelSubscriptions(g *gin.Context) ginresp.HTTPResponse { @@ -902,10 +898,10 @@ func (h APIHandler) ListChannelSubscriptions(g *gin.Context) ginresp.HTTPRespons // @Param sid path int true "SubscriptionID" // // @Success 200 {object} models.SubscriptionJSON -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 404 {object} ginresp.apiError "subscription not found" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/users/{uid}/subscriptions/{sid} [GET] func (h APIHandler) GetSubscription(g *gin.Context) ginresp.HTTPResponse { @@ -950,10 +946,10 @@ func (h APIHandler) GetSubscription(g *gin.Context) ginresp.HTTPResponse { // @Param sid path int true "SubscriptionID" // // @Success 200 {object} models.SubscriptionJSON -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 404 {object} ginresp.apiError "subscription not found" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/users/{uid}/subscriptions/{sid} [DELETE] func (h APIHandler) CancelSubscription(g *gin.Context) ginresp.HTTPResponse { @@ -1004,10 +1000,9 @@ func (h APIHandler) CancelSubscription(g *gin.Context) ginresp.HTTPResponse { // @Param post_data body handler.CreateSubscription.body false " " // // @Success 200 {object} models.SubscriptionJSON -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/users/{uid}/subscriptions [POST] func (h APIHandler) CreateSubscription(g *gin.Context) ginresp.HTTPResponse { @@ -1065,10 +1060,10 @@ func (h APIHandler) CreateSubscription(g *gin.Context) ginresp.HTTPResponse { // @Param sid path int true "SubscriptionID" // // @Success 200 {object} models.SubscriptionJSON -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 404 {object} ginresp.apiError "subscription not found" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/users/{uid}/subscriptions/{sid} [PATCH] func (h APIHandler) UpdateSubscription(g *gin.Context) ginresp.HTTPResponse { @@ -1132,10 +1127,9 @@ func (h APIHandler) UpdateSubscription(g *gin.Context) ginresp.HTTPResponse { // @Param query_data query handler.ListMessages.query false " " // // @Success 200 {object} handler.ListMessages.response -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/messages [GET] func (h APIHandler) ListMessages(g *gin.Context) ginresp.HTTPResponse { @@ -1215,10 +1209,10 @@ func (h APIHandler) ListMessages(g *gin.Context) ginresp.HTTPResponse { // @Param mid path int true "SCNMessageID" // // @Success 200 {object} models.MessageJSON -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 404 {object} ginresp.apiError "message not found" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/messages/{mid} [PATCH] func (h APIHandler) GetMessage(g *gin.Context) ginresp.HTTPResponse { @@ -1285,10 +1279,10 @@ func (h APIHandler) GetMessage(g *gin.Context) ginresp.HTTPResponse { // @Param mid path int true "SCNMessageID" // // @Success 200 {object} models.MessageJSON -// @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" +// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions" +// @Failure 404 {object} ginresp.apiError "message not found" +// @Failure 500 {object} ginresp.apiError "internal server error" // // @Router /api/messages/{mid} [DELETE] func (h APIHandler) DeleteMessage(g *gin.Context) ginresp.HTTPResponse { diff --git a/server/swagger/swagger.json b/server/swagger/swagger.json index 561b925..af0993e 100644 --- a/server/swagger/swagger.json +++ b/server/swagger/swagger.json @@ -447,25 +447,19 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "404": { - "description": "Not Found", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -498,25 +492,25 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "404": { - "description": "Not Found", + "description": "message not found", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -547,25 +541,25 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "404": { - "description": "Not Found", + "description": "message not found", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1002,13 +996,13 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1040,25 +1034,25 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "404": { - "description": "Not Found", + "description": "user not found", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1129,25 +1123,25 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "404": { - "description": "Not Found", + "description": "user not found", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1194,25 +1188,19 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "404": { - "description": "Not Found", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1251,25 +1239,25 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "404": { - "description": "Not Found", + "description": "channel not found", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1322,25 +1310,25 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "404": { - "description": "Not Found", + "description": "channel not found", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1400,25 +1388,25 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "404": { - "description": "Not Found", + "description": "channel not found", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1457,25 +1445,25 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "404": { - "description": "Not Found", + "description": "channel not found", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1507,25 +1495,19 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "404": { - "description": "Not Found", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1563,25 +1545,19 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "404": { - "description": "Not Found", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1620,25 +1596,25 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "404": { - "description": "Not Found", + "description": "client not found", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1675,25 +1651,25 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "404": { - "description": "Not Found", + "description": "client not found", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1725,25 +1701,19 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "404": { - "description": "Not Found", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1786,25 +1756,19 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "404": { - "description": "Not Found", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1843,25 +1807,25 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "404": { - "description": "Not Found", + "description": "subscription not found", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1898,25 +1862,25 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "404": { - "description": "Not Found", + "description": "subscription not found", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1953,25 +1917,25 @@ } }, "400": { - "description": "Bad Request", + "description": "supplied values/parameters cannot be parsed / are invalid", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "401": { - "description": "Unauthorized", + "description": "user is not authorized / has missing permissions", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "404": { - "description": "Not Found", + "description": "subscription not found", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "internal server error", "schema": { "$ref": "#/definitions/ginresp.apiError" } diff --git a/server/swagger/swagger.yaml b/server/swagger/swagger.yaml index c576a3c..61c01cf 100644 --- a/server/swagger/swagger.yaml +++ b/server/swagger/swagger.yaml @@ -799,19 +799,15 @@ paths: schema: $ref: '#/definitions/handler.ListMessages.response' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized - schema: - $ref: '#/definitions/ginresp.apiError' - "404": - description: Not Found + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: List all (subscribed) messages @@ -834,19 +830,19 @@ paths: schema: $ref: '#/definitions/models.MessageJSON' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "404": - description: Not Found + description: message not found schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: Delete a single message @@ -870,19 +866,19 @@ paths: schema: $ref: '#/definitions/models.MessageJSON' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "404": - description: Not Found + description: message not found schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: Get a single message (untrimmed) @@ -1178,11 +1174,11 @@ paths: schema: $ref: '#/definitions/models.UserJSONWithClients' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: Create a new user @@ -1203,19 +1199,19 @@ paths: schema: $ref: '#/definitions/models.UserJSON' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "404": - description: Not Found + description: user not found schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: Get a user @@ -1261,19 +1257,19 @@ paths: schema: $ref: '#/definitions/models.UserJSON' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "404": - description: Not Found + description: user not found schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: (Partially) update a user @@ -1312,19 +1308,15 @@ paths: schema: $ref: '#/definitions/handler.ListChannels.response' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized - schema: - $ref: '#/definitions/ginresp.apiError' - "404": - description: Not Found + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: List channels of a user (subscribed/owned) @@ -1350,19 +1342,19 @@ paths: schema: $ref: '#/definitions/models.ChannelJSON' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "404": - description: Not Found + description: channel not found schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: List all channels of a user @@ -1397,19 +1389,19 @@ paths: schema: $ref: '#/definitions/models.ChannelJSON' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "404": - description: Not Found + description: channel not found schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: (Partially) update a channel @@ -1452,19 +1444,19 @@ paths: schema: $ref: '#/definitions/handler.ListChannelMessages.response' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "404": - description: Not Found + description: channel not found schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: List messages of a channel @@ -1490,19 +1482,19 @@ paths: schema: $ref: '#/definitions/handler.ListChannelSubscriptions.response' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "404": - description: Not Found + description: channel not found schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: List all subscriptions of a channel @@ -1523,19 +1515,15 @@ paths: schema: $ref: '#/definitions/handler.ListClients.response' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized - schema: - $ref: '#/definitions/ginresp.apiError' - "404": - description: Not Found + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: List all clients @@ -1560,19 +1548,15 @@ paths: schema: $ref: '#/definitions/models.ClientJSON' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized - schema: - $ref: '#/definitions/ginresp.apiError' - "404": - description: Not Found + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: Add a new clients @@ -1598,19 +1582,19 @@ paths: schema: $ref: '#/definitions/models.ClientJSON' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "404": - description: Not Found + description: client not found schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: Delete a client @@ -1635,19 +1619,19 @@ paths: schema: $ref: '#/definitions/models.ClientJSON' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "404": - description: Not Found + description: client not found schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: Get a single client @@ -1668,19 +1652,15 @@ paths: schema: $ref: '#/definitions/handler.ListUserSubscriptions.response' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized - schema: - $ref: '#/definitions/ginresp.apiError' - "404": - description: Not Found + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: List all channels of a user @@ -1708,19 +1688,15 @@ paths: schema: $ref: '#/definitions/models.SubscriptionJSON' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized - schema: - $ref: '#/definitions/ginresp.apiError' - "404": - description: Not Found + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: Creare/Request a subscription @@ -1746,19 +1722,19 @@ paths: schema: $ref: '#/definitions/models.SubscriptionJSON' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "404": - description: Not Found + description: subscription not found schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: Cancel (delete) subscription @@ -1783,19 +1759,19 @@ paths: schema: $ref: '#/definitions/models.SubscriptionJSON' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "404": - description: Not Found + description: subscription not found schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: Get a single subscription @@ -1820,19 +1796,19 @@ paths: schema: $ref: '#/definitions/models.SubscriptionJSON' "400": - description: Bad Request + description: supplied values/parameters cannot be parsed / are invalid schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized + description: user is not authorized / has missing permissions schema: $ref: '#/definitions/ginresp.apiError' "404": - description: Not Found + description: subscription not found schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: internal server error schema: $ref: '#/definitions/ginresp.apiError' summary: Update a subscription (e.g. confirm)