fix swagger errors

This commit is contained in:
Mike Schwörer 2023-05-28 17:04:44 +02:00
parent d0a04bae84
commit dcb4f253d8
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
8 changed files with 629 additions and 536 deletions

View File

@ -118,8 +118,8 @@ func (h APIHandler) ListChannels(g *gin.Context) ginresp.HTTPResponse {
// @ID api-channels-get // @ID api-channels-get
// @Tags API-v2 // @Tags API-v2
// //
// @Param uid path int true "UserID" // @Param uid path string true "UserID"
// @Param cid path int true "ChannelID" // @Param cid path string true "ChannelID"
// //
// @Success 200 {object} models.ChannelWithSubscriptionJSON // @Success 200 {object} models.ChannelWithSubscriptionJSON
// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid"

View File

@ -16,7 +16,7 @@ import (
// @ID api-clients-list // @ID api-clients-list
// @Tags API-v2 // @Tags API-v2
// //
// @Param uid path int true "UserID" // @Param uid path string true "UserID"
// //
// @Success 200 {object} handler.ListClients.response // @Success 200 {object} handler.ListClients.response
// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" // @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 // @ID api-clients-get
// @Tags API-v2 // @Tags API-v2
// //
// @Param uid path int true "UserID" // @Param uid path string true "UserID"
// @Param cid path int true "ClientID" // @Param cid path string true "ClientID"
// //
// @Success 200 {object} models.ClientJSON // @Success 200 {object} models.ClientJSON
// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" // @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 // @ID api-clients-delete
// @Tags API-v2 // @Tags API-v2
// //
// @Param uid path int true "UserID" // @Param uid path string true "UserID"
// @Param cid path int true "ClientID" // @Param cid path string true "ClientID"
// //
// @Success 200 {object} models.ClientJSON // @Success 200 {object} models.ClientJSON
// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid"

View File

@ -17,7 +17,7 @@ import (
// @ID api-tokenkeys-list // @ID api-tokenkeys-list
// @Tags API-v2 // @Tags API-v2
// //
// @Param uid path int true "UserID" // @Param uid path string true "UserID"
// //
// @Success 200 {object} handler.ListUserKeys.response // @Success 200 {object} handler.ListUserKeys.response
// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" // @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 404 {object} ginresp.apiError "message not found"
// @Failure 500 {object} ginresp.apiError "internal server error" // @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 { func (h APIHandler) ListUserKeys(g *gin.Context) ginresp.HTTPResponse {
type uri struct { type uri struct {
UserID models.UserID `uri:"uid" binding:"entityid"` UserID models.UserID `uri:"uid" binding:"entityid"`
@ -62,8 +62,8 @@ func (h APIHandler) ListUserKeys(g *gin.Context) ginresp.HTTPResponse {
// @ID api-tokenkeys-get // @ID api-tokenkeys-get
// @Tags API-v2 // @Tags API-v2
// //
// @Param uid path int true "UserID" // @Param uid path string true "UserID"
// @Param kid path int true "TokenKeyID" // @Param kid path string true "TokenKeyID"
// //
// @Success 200 {object} models.KeyTokenJSON // @Success 200 {object} models.KeyTokenJSON
// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" // @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 404 {object} ginresp.apiError "message not found"
// @Failure 500 {object} ginresp.apiError "internal server error" // @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 { func (h APIHandler) GetUserKey(g *gin.Context) ginresp.HTTPResponse {
type uri struct { type uri struct {
UserID models.UserID `uri:"uid" binding:"entityid"` 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 404 {object} ginresp.apiError "message not found"
// @Failure 500 {object} ginresp.apiError "internal server error" // @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 { func (h APIHandler) UpdateUserKey(g *gin.Context) ginresp.HTTPResponse {
type uri struct { type uri struct {
UserID models.UserID `uri:"uid" binding:"entityid"` 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 404 {object} ginresp.apiError "message not found"
// @Failure 500 {object} ginresp.apiError "internal server error" // @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 { func (h APIHandler) CreateUserKey(g *gin.Context) ginresp.HTTPResponse {
type uri struct { type uri struct {
UserID models.UserID `uri:"uid" binding:"entityid"` UserID models.UserID `uri:"uid" binding:"entityid"`
@ -263,8 +263,8 @@ func (h APIHandler) CreateUserKey(g *gin.Context) ginresp.HTTPResponse {
// @ID api-tokenkeys-delete // @ID api-tokenkeys-delete
// @Tags API-v2 // @Tags API-v2
// //
// @Param uid path int true "UserID" // @Param uid path string true "UserID"
// @Param kid path int true "TokenKeyID" // @Param kid path string true "TokenKeyID"
// //
// @Success 200 {object} models.KeyTokenJSON // @Success 200 {object} models.KeyTokenJSON
// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" // @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 404 {object} ginresp.apiError "message not found"
// @Failure 500 {object} ginresp.apiError "internal server error" // @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 { func (h APIHandler) DeleteUserKey(g *gin.Context) ginresp.HTTPResponse {
type uri struct { type uri struct {
UserID models.UserID `uri:"uid" binding:"entityid"` UserID models.UserID `uri:"uid" binding:"entityid"`

View File

@ -165,7 +165,7 @@ func (h APIHandler) ListMessages(g *gin.Context) ginresp.HTTPResponse {
// @ID api-messages-get // @ID api-messages-get
// @Tags API-v2 // @Tags API-v2
// //
// @Param mid path int true "MessageID" // @Param mid path string true "MessageID"
// //
// @Success 200 {object} models.MessageJSON // @Success 200 {object} models.MessageJSON
// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" // @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 // @ID api-messages-delete
// @Tags API-v2 // @Tags API-v2
// //
// @Param mid path int true "MessageID" // @Param mid path string true "MessageID"
// //
// @Success 200 {object} models.MessageJSON // @Success 200 {object} models.MessageJSON
// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid"

View File

@ -121,8 +121,8 @@ func (h APIHandler) ListUserSubscriptions(g *gin.Context) ginresp.HTTPResponse {
// @ID api-chan-subscriptions-list // @ID api-chan-subscriptions-list
// @Tags API-v2 // @Tags API-v2
// //
// @Param uid path int true "UserID" // @Param uid path string true "UserID"
// @Param cid path int true "ChannelID" // @Param cid path string true "ChannelID"
// //
// @Success 200 {object} handler.ListChannelSubscriptions.response // @Success 200 {object} handler.ListChannelSubscriptions.response
// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" // @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 // @ID api-subscriptions-get
// @Tags API-v2 // @Tags API-v2
// //
// @Param uid path int true "UserID" // @Param uid path string true "UserID"
// @Param sid path int true "SubscriptionID" // @Param sid path string true "SubscriptionID"
// //
// @Success 200 {object} models.SubscriptionJSON // @Success 200 {object} models.SubscriptionJSON
// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" // @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 // @ID api-subscriptions-delete
// @Tags API-v2 // @Tags API-v2
// //
// @Param uid path int true "UserID" // @Param uid path string true "UserID"
// @Param sid path int true "SubscriptionID" // @Param sid path string true "SubscriptionID"
// //
// @Success 200 {object} models.SubscriptionJSON // @Success 200 {object} models.SubscriptionJSON
// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid"

View File

@ -137,7 +137,7 @@ func (h APIHandler) CreateUser(g *gin.Context) ginresp.HTTPResponse {
// @ID api-user-get // @ID api-user-get
// @Tags API-v2 // @Tags API-v2
// //
// @Param uid path int true "UserID" // @Param uid path string true "UserID"
// //
// @Success 200 {object} models.UserJSON // @Success 200 {object} models.UserJSON
// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid" // @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid"

View File

@ -851,6 +851,36 @@
"summary": "List all (subscribed) messages", "summary": "List all (subscribed) messages",
"operationId": "api-messages-list", "operationId": "api-messages-list",
"parameters": [ "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", "type": "string",
"name": "filter", "name": "filter",
@ -866,11 +896,37 @@
"name": "page_size", "name": "page_size",
"in": "query" "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", "type": "boolean",
"description": "TODO more filter (sender-name, channel, timestamps, prio, )",
"name": "trimmed", "name": "trimmed",
"in": "query" "in": "query"
},
{
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "csv",
"name": "used_key",
"in": "query"
} }
], ],
"responses": { "responses": {
@ -911,7 +967,7 @@
"operationId": "api-messages-delete", "operationId": "api-messages-delete",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "string",
"description": "MessageID", "description": "MessageID",
"name": "mid", "name": "mid",
"in": "path", "in": "path",
@ -960,7 +1016,7 @@
"operationId": "api-messages-get", "operationId": "api-messages-get",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "string",
"description": "MessageID", "description": "MessageID",
"name": "mid", "name": "mid",
"in": "path", "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}": { "/api/v2/users/{uid}": {
"get": { "get": {
"tags": [ "tags": [
@ -1333,7 +1105,7 @@
"operationId": "api-user-get", "operationId": "api-user-get",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "string",
"description": "UserID", "description": "UserID",
"name": "uid", "name": "uid",
"in": "path", "in": "path",
@ -1562,14 +1334,14 @@
"operationId": "api-channels-get", "operationId": "api-channels-get",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "string",
"description": "UserID", "description": "UserID",
"name": "uid", "name": "uid",
"in": "path", "in": "path",
"required": true "required": true
}, },
{ {
"type": "integer", "type": "string",
"description": "ChannelID", "description": "ChannelID",
"name": "cid", "name": "cid",
"in": "path", "in": "path",
@ -1776,14 +1548,14 @@
"operationId": "api-chan-subscriptions-list", "operationId": "api-chan-subscriptions-list",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "string",
"description": "UserID", "description": "UserID",
"name": "uid", "name": "uid",
"in": "path", "in": "path",
"required": true "required": true
}, },
{ {
"type": "integer", "type": "string",
"description": "ChannelID", "description": "ChannelID",
"name": "cid", "name": "cid",
"in": "path", "in": "path",
@ -1833,7 +1605,7 @@
"operationId": "api-clients-list", "operationId": "api-clients-list",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "string",
"description": "UserID", "description": "UserID",
"name": "uid", "name": "uid",
"in": "path", "in": "path",
@ -1927,14 +1699,14 @@
"operationId": "api-clients-get", "operationId": "api-clients-get",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "string",
"description": "UserID", "description": "UserID",
"name": "uid", "name": "uid",
"in": "path", "in": "path",
"required": true "required": true
}, },
{ {
"type": "integer", "type": "string",
"description": "ClientID", "description": "ClientID",
"name": "cid", "name": "cid",
"in": "path", "in": "path",
@ -1982,14 +1754,14 @@
"operationId": "api-clients-delete", "operationId": "api-clients-delete",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "string",
"description": "UserID", "description": "UserID",
"name": "uid", "name": "uid",
"in": "path", "in": "path",
"required": true "required": true
}, },
{ {
"type": "integer", "type": "string",
"description": "ClientID", "description": "ClientID",
"name": "cid", "name": "cid",
"in": "path", "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": { "/api/v2/users/{uid}/subscriptions": {
"get": { "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)", "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", "operationId": "api-subscriptions-get",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "string",
"description": "UserID", "description": "UserID",
"name": "uid", "name": "uid",
"in": "path", "in": "path",
"required": true "required": true
}, },
{ {
"type": "integer", "type": "string",
"description": "SubscriptionID", "description": "SubscriptionID",
"name": "sid", "name": "sid",
"in": "path", "in": "path",
@ -2210,14 +2266,14 @@
"operationId": "api-subscriptions-delete", "operationId": "api-subscriptions-delete",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "string",
"description": "UserID", "description": "UserID",
"name": "uid", "name": "uid",
"in": "path", "in": "path",
"required": true "required": true
}, },
{ {
"type": "integer", "type": "string",
"description": "SubscriptionID", "description": "SubscriptionID",
"name": "sid", "name": "sid",
"in": "path", "in": "path",

View File

@ -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) 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 operationId: api-messages-list
parameters: 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 - in: query
name: filter name: filter
type: string type: string
@ -1273,10 +1293,27 @@ paths:
- in: query - in: query
name: page_size name: page_size
type: integer type: integer
- description: TODO more filter (sender-name, channel, timestamps, prio, ) - collectionFormat: csv
in: query in: query
items:
type: integer
name: priority
type: array
- collectionFormat: csv
in: query
items:
type: string
name: sender
type: array
- in: query
name: trimmed name: trimmed
type: boolean type: boolean
- collectionFormat: csv
in: query
items:
type: string
name: used_key
type: array
responses: responses:
"200": "200":
description: OK description: OK
@ -1307,7 +1344,7 @@ paths:
in: path in: path
name: mid name: mid
required: true required: true
type: integer type: string
responses: responses:
"200": "200":
description: OK description: OK
@ -1343,7 +1380,7 @@ paths:
in: path in: path
name: mid name: mid
required: true required: true
type: integer type: string
responses: responses:
"200": "200":
description: OK description: OK
@ -1393,198 +1430,6 @@ paths:
summary: Create a new user summary: Create a new user
tags: tags:
- API-v2 - 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}: /api/v2/users/{uid}:
get: get:
operationId: api-user-get operationId: api-user-get
@ -1593,7 +1438,7 @@ paths:
in: path in: path
name: uid name: uid
required: true required: true
type: integer type: string
responses: responses:
"200": "200":
description: OK description: OK
@ -1752,12 +1597,12 @@ paths:
in: path in: path
name: uid name: uid
required: true required: true
type: integer type: string
- description: ChannelID - description: ChannelID
in: path in: path
name: cid name: cid
required: true required: true
type: integer type: string
responses: responses:
"200": "200":
description: OK description: OK
@ -1898,12 +1743,12 @@ paths:
in: path in: path
name: uid name: uid
required: true required: true
type: integer type: string
- description: ChannelID - description: ChannelID
in: path in: path
name: cid name: cid
required: true required: true
type: integer type: string
responses: responses:
"200": "200":
description: OK description: OK
@ -1936,7 +1781,7 @@ paths:
in: path in: path
name: uid name: uid
required: true required: true
type: integer type: string
responses: responses:
"200": "200":
description: OK description: OK
@ -1998,12 +1843,12 @@ paths:
in: path in: path
name: uid name: uid
required: true required: true
type: integer type: string
- description: ClientID - description: ClientID
in: path in: path
name: cid name: cid
required: true required: true
type: integer type: string
responses: responses:
"200": "200":
description: OK description: OK
@ -2035,12 +1880,12 @@ paths:
in: path in: path
name: uid name: uid
required: true required: true
type: integer type: string
- description: ClientID - description: ClientID
in: path in: path
name: cid name: cid
required: true required: true
type: integer type: string
responses: responses:
"200": "200":
description: OK description: OK
@ -2065,6 +1910,198 @@ paths:
summary: Get a single client summary: Get a single client
tags: tags:
- API-v2 - 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: /api/v2/users/{uid}/subscriptions:
get: get:
description: |- description: |-
@ -2160,12 +2197,12 @@ paths:
in: path in: path
name: uid name: uid
required: true required: true
type: integer type: string
- description: SubscriptionID - description: SubscriptionID
in: path in: path
name: sid name: sid
required: true required: true
type: integer type: string
responses: responses:
"200": "200":
description: OK description: OK
@ -2197,12 +2234,12 @@ paths:
in: path in: path
name: uid name: uid
required: true required: true
type: integer type: string
- description: SubscriptionID - description: SubscriptionID
in: path in: path
name: sid name: sid
required: true required: true
type: integer type: string
responses: responses:
"200": "200":
description: OK description: OK