shiori/docs/swagger/swagger.json
Felipe Martin 876d27f337
refactor: remove gin and use stdlib http server (#1064)
* refactor: base http server stdlib

* refactor: swagger and frontend routes

* fix: use global middlewares

* refactor: removed gin from testutils

* fix: object references in legacy webserver

* refactor: legacy, swagger and system handlers

* fix: added verbs to handlers

* fix: server handlers ordering

* refactor: bookmarks handlers

* refactor: system api routes

* tests: bookmark handlers

* refactor: migrated api auth routes

* chore: remove unused middlewares

* docs: add swagger docs to refactored system api

* chore: remove old auth routes

* refactor: account apis

* chore: removed old handlers

* fix: api v1 handlers missing middlewares

* refactor: migrated tag list route

* refactor: bookmark routes

* refactor: remove gin

* chore: make styles

* test: fixed tests

* test: generate binary file without text

* fix: global middleware missing from system api handler

* fix: incorrect api handler

* chore: avoid logging screenshot contents

* tests: bookmarks domain

* tests: shortcuts

* test: missing tests

* tests: server tests

* test: remove test using syscall to avoid windows errors

* chore: added middlewares
2025-02-26 20:50:48 +01:00

662 lines
No EOL
20 KiB
JSON

{
"swagger": "2.0",
"info": {
"contact": {}
},
"paths": {
"/api/v1/accounts": {
"get": {
"description": "List accounts",
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "List accounts",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/model.AccountDTO"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "Create an account",
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/model.AccountDTO"
}
},
"400": {
"description": "Bad Request"
},
"409": {
"description": "Account already exists"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/api/v1/accounts/{id}": {
"delete": {
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "Delete an account",
"parameters": [
{
"type": "integer",
"description": "Account ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No content"
},
"400": {
"description": "Invalid ID"
},
"404": {
"description": "Account not found"
},
"500": {
"description": "Internal Server Error"
}
}
},
"patch": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "Update an account",
"parameters": [
{
"type": "integer",
"description": "Account ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Account data",
"name": "account",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api_v1.updateAccountPayload"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.AccountDTO"
}
},
"400": {
"description": "Invalid ID/data"
},
"404": {
"description": "Account not found"
},
"409": {
"description": "Account already exists"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/api/v1/auth/account": {
"patch": {
"produces": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "Update account information",
"parameters": [
{
"description": "Account data",
"name": "payload",
"in": "body",
"schema": {
"$ref": "#/definitions/api_v1.updateAccountPayload"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.Account"
}
},
"403": {
"description": "Token not provided/invalid"
}
}
}
},
"/api/v1/auth/login": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "Login to an account using username and password",
"parameters": [
{
"description": "Login data",
"name": "payload",
"in": "body",
"schema": {
"$ref": "#/definitions/api_v1.loginRequestPayload"
}
}
],
"responses": {
"200": {
"description": "Login successful",
"schema": {
"$ref": "#/definitions/api_v1.loginResponseMessage"
}
},
"400": {
"description": "Invalid login data"
}
}
}
},
"/api/v1/auth/logout": {
"post": {
"produces": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "Logout from the current session",
"responses": {
"200": {
"description": "Logout successful"
},
"403": {
"description": "Token not provided/invalid"
}
}
}
},
"/api/v1/auth/me": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "Get information for the current logged in user",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.Account"
}
},
"403": {
"description": "Token not provided/invalid"
}
}
}
},
"/api/v1/auth/refresh": {
"post": {
"produces": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "Refresh a token for an account",
"responses": {
"200": {
"description": "Refresh successful",
"schema": {
"$ref": "#/definitions/api_v1.loginResponseMessage"
}
},
"403": {
"description": "Token not provided/invalid"
}
}
}
},
"/api/v1/bookmarks/cache": {
"put": {
"produces": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "Update Cache and Ebook on server.",
"parameters": [
{
"description": "Update Cache Payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api_v1.updateCachePayload"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.BookmarkDTO"
}
},
"403": {
"description": "Token not provided/invalid"
}
}
}
},
"/api/v1/bookmarks/id/readable": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "Get readable version of bookmark.",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api_v1.readableResponseMessage"
}
},
"403": {
"description": "Token not provided/invalid"
}
}
}
},
"/api/v1/system/info": {
"get": {
"description": "Get general system information like Shiori version, database, and OS",
"produces": [
"application/json"
],
"tags": [
"System"
],
"summary": "Get general system information",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api_v1.infoResponse"
}
},
"403": {
"description": "Only owners can access this endpoint"
}
}
}
},
"/api/v1/tags": {
"get": {
"description": "List all tags",
"produces": [
"application/json"
],
"tags": [
"Tags"
],
"summary": "List tags",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/model.Tag"
}
}
},
"403": {
"description": "Authentication required"
},
"500": {
"description": "Internal server error"
}
}
}
}
},
"definitions": {
"api_v1.infoResponse": {
"type": "object",
"properties": {
"database": {
"type": "string"
},
"os": {
"type": "string"
},
"version": {
"type": "object",
"properties": {
"commit": {
"type": "string"
},
"date": {
"type": "string"
},
"tag": {
"type": "string"
}
}
}
}
},
"api_v1.loginRequestPayload": {
"type": "object",
"properties": {
"password": {
"type": "string"
},
"remember_me": {
"type": "boolean"
},
"username": {
"type": "string"
}
}
},
"api_v1.loginResponseMessage": {
"type": "object",
"properties": {
"expires": {
"description": "Deprecated, used only for legacy APIs",
"type": "integer"
},
"session": {
"description": "Deprecated, used only for legacy APIs",
"type": "string"
},
"token": {
"type": "string"
}
}
},
"api_v1.readableResponseMessage": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"html": {
"type": "string"
}
}
},
"api_v1.updateAccountPayload": {
"type": "object",
"properties": {
"config": {
"$ref": "#/definitions/model.UserConfig"
},
"new_password": {
"type": "string"
},
"old_password": {
"type": "string"
},
"owner": {
"type": "boolean"
},
"username": {
"type": "string"
}
}
},
"api_v1.updateCachePayload": {
"type": "object",
"required": [
"ids"
],
"properties": {
"create_archive": {
"type": "boolean"
},
"create_ebook": {
"type": "boolean"
},
"ids": {
"type": "array",
"items": {
"type": "integer"
}
},
"keep_metadata": {
"type": "boolean"
},
"skip_exist": {
"type": "boolean"
}
}
},
"model.Account": {
"type": "object",
"properties": {
"config": {
"$ref": "#/definitions/model.UserConfig"
},
"id": {
"type": "integer"
},
"owner": {
"type": "boolean"
},
"password": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"model.AccountDTO": {
"type": "object",
"properties": {
"config": {
"$ref": "#/definitions/model.UserConfig"
},
"id": {
"type": "integer"
},
"owner": {
"type": "boolean"
},
"passowrd": {
"description": "Used only to store, not to retrieve",
"type": "string"
},
"username": {
"type": "string"
}
}
},
"model.BookmarkDTO": {
"type": "object",
"properties": {
"author": {
"type": "string"
},
"create_archive": {
"description": "TODO: migrate outside the DTO",
"type": "boolean"
},
"create_ebook": {
"description": "TODO: migrate outside the DTO",
"type": "boolean"
},
"createdAt": {
"type": "string"
},
"excerpt": {
"type": "string"
},
"hasArchive": {
"type": "boolean"
},
"hasContent": {
"type": "boolean"
},
"hasEbook": {
"type": "boolean"
},
"html": {
"type": "string"
},
"id": {
"type": "integer"
},
"imageURL": {
"type": "string"
},
"modifiedAt": {
"type": "string"
},
"public": {
"type": "integer"
},
"tags": {
"type": "array",
"items": {
"$ref": "#/definitions/model.TagDTO"
}
},
"title": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"model.Tag": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
}
},
"model.TagDTO": {
"type": "object",
"properties": {
"bookmark_count": {
"description": "Number of bookmarks with this tag",
"type": "integer"
},
"deleted": {
"description": "Marks when a tag is deleted from a bookmark",
"type": "boolean"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
}
},
"model.UserConfig": {
"type": "object",
"properties": {
"createEbook": {
"type": "boolean"
},
"hideExcerpt": {
"type": "boolean"
},
"hideThumbnail": {
"type": "boolean"
},
"keepMetadata": {
"type": "boolean"
},
"listMode": {
"type": "boolean"
},
"makePublic": {
"type": "boolean"
},
"showId": {
"type": "boolean"
},
"theme": {
"type": "string"
},
"useArchive": {
"type": "boolean"
}
}
}
}
}