mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-31 14:33:50 -04:00
Update auth swagger
This commit is contained in:
parent
61b6eb0c6e
commit
30dd1e0b96
@ -49,7 +49,7 @@ const docTemplate = `{
|
|||||||
"Token": []
|
"Token": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Convert a session token to a short lived JWT.",
|
"description": "Convert a session token or an API key to a short lived JWT.",
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@ -79,6 +79,126 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/keys": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"Jwt": [
|
||||||
|
"apikeys.read"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "List all api keys",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"apikeys"
|
||||||
|
],
|
||||||
|
"summary": "List API keys",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.Page-main_ApiKey"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"Jwt": [
|
||||||
|
"apikeys.write"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Create a new API key",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"apikeys"
|
||||||
|
],
|
||||||
|
"summary": "Create API key",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Api key info",
|
||||||
|
"name": "key",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.ApiKeyDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "Created",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.ApiKeyWToken"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"409": {
|
||||||
|
"description": "Duplicated api key",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.KError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "Invalid create body",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.KError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"Jwt": [
|
||||||
|
"apikeys.write"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Delete an existing API key",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"apikeys"
|
||||||
|
],
|
||||||
|
"summary": "Delete API key",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.ApiKey"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "Invalid id",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.KError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "Invalid id format",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.KError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/sessions": {
|
"/sessions": {
|
||||||
"post": {
|
"post": {
|
||||||
"description": "Login to your account and open a session",
|
"description": "Login to your account and open a session",
|
||||||
@ -563,6 +683,12 @@ const docTemplate = `{
|
|||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/main.KError"
|
"$ref": "#/definitions/main.KError"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "Invalid id format",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.KError"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -626,6 +752,88 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
|
"main.ApiKey": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"claims": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": {
|
||||||
|
"isAdmin": " true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"createAt": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2025-03-29T18:20:05.267Z"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "e05089d6-9179-4b5b-a63e-94dd5fc2a397"
|
||||||
|
},
|
||||||
|
"lastUsed": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2025-03-29T18:20:05.267Z"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "myapp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"main.ApiKeyDto": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"claims": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": {
|
||||||
|
"isAdmin": " true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "myapp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"main.ApiKeyWToken": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"claims": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": {
|
||||||
|
"isAdmin": " true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"createAt": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2025-03-29T18:20:05.267Z"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "e05089d6-9179-4b5b-a63e-94dd5fc2a397"
|
||||||
|
},
|
||||||
|
"lastUsed": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2025-03-29T18:20:05.267Z"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "myapp"
|
||||||
|
},
|
||||||
|
"token": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "myapp-lyHzTYm9yi+pkEv3m2tamAeeK7Dj7N3QRP7xv7dPU5q9MAe8tU4ySwYczE0RaMr4fijsA=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"main.EditPasswordDto": {
|
"main.EditPasswordDto": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
@ -762,6 +970,25 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"main.Page-main_ApiKey": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"items": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/main.ApiKey"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"next": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "https://kyoo.zoriya.dev/auth/users?after=aoeusth"
|
||||||
|
},
|
||||||
|
"this": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "https://kyoo.zoriya.dev/auth/users"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"main.Page-main_User": {
|
"main.Page-main_User": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
"Token": []
|
"Token": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Convert a session token to a short lived JWT.",
|
"description": "Convert a session token or an API key to a short lived JWT.",
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@ -73,6 +73,126 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/keys": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"Jwt": [
|
||||||
|
"apikeys.read"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "List all api keys",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"apikeys"
|
||||||
|
],
|
||||||
|
"summary": "List API keys",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.Page-main_ApiKey"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"Jwt": [
|
||||||
|
"apikeys.write"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Create a new API key",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"apikeys"
|
||||||
|
],
|
||||||
|
"summary": "Create API key",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Api key info",
|
||||||
|
"name": "key",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.ApiKeyDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "Created",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.ApiKeyWToken"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"409": {
|
||||||
|
"description": "Duplicated api key",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.KError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "Invalid create body",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.KError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"Jwt": [
|
||||||
|
"apikeys.write"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Delete an existing API key",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"apikeys"
|
||||||
|
],
|
||||||
|
"summary": "Delete API key",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.ApiKey"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "Invalid id",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.KError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "Invalid id format",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.KError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/sessions": {
|
"/sessions": {
|
||||||
"post": {
|
"post": {
|
||||||
"description": "Login to your account and open a session",
|
"description": "Login to your account and open a session",
|
||||||
@ -557,6 +677,12 @@
|
|||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/main.KError"
|
"$ref": "#/definitions/main.KError"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "Invalid id format",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/main.KError"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -620,6 +746,88 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
|
"main.ApiKey": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"claims": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": {
|
||||||
|
"isAdmin": " true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"createAt": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2025-03-29T18:20:05.267Z"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "e05089d6-9179-4b5b-a63e-94dd5fc2a397"
|
||||||
|
},
|
||||||
|
"lastUsed": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2025-03-29T18:20:05.267Z"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "myapp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"main.ApiKeyDto": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"claims": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": {
|
||||||
|
"isAdmin": " true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "myapp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"main.ApiKeyWToken": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"claims": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": {
|
||||||
|
"isAdmin": " true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"createAt": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2025-03-29T18:20:05.267Z"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "e05089d6-9179-4b5b-a63e-94dd5fc2a397"
|
||||||
|
},
|
||||||
|
"lastUsed": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2025-03-29T18:20:05.267Z"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "myapp"
|
||||||
|
},
|
||||||
|
"token": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "myapp-lyHzTYm9yi+pkEv3m2tamAeeK7Dj7N3QRP7xv7dPU5q9MAe8tU4ySwYczE0RaMr4fijsA=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"main.EditPasswordDto": {
|
"main.EditPasswordDto": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
@ -756,6 +964,25 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"main.Page-main_ApiKey": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"items": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/main.ApiKey"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"next": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "https://kyoo.zoriya.dev/auth/users?after=aoeusth"
|
||||||
|
},
|
||||||
|
"this": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "https://kyoo.zoriya.dev/auth/users"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"main.Page-main_User": {
|
"main.Page-main_User": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user