shiori/docs/swagger.json
Felipe Martin 6f19c12c95
Start working on new REST API. Refactor logic in domains. (#497)
* added 404 template

* added auth domain

* added embed file for frontend

* added base config and dependencies

* added basic new http server

* added separated server command

* updated go modules

* removed modd file

* Added shortcut to send internal server error response

* Added JWT support to Auth Domain

* Added JWT support to API

* docs: added comments to response struct

* naming

* inline returns

* updated dependencies

* production logger

* bookmarks endpoint

* reverted old views api path

* frontend for api v1

* proper 404 error (not working atm)

* use response

* removed 404 html

* server error handler

* login and basic auth

* adjusted session duration

* properly retrieve tags

* properly delete bookmark

* cleanup

* archiver domain

* debug routes

* bookmark routes

* expiration by parameter

* move to logrus

* logout

* frontend cache

* updated dependencies

* http: migrated to gin

* linted

* Added version command

* unit tests, docs

* response test utils and tests

* remove logout handler

* auth

* createtag

* improved http test utilities

* assert message equals

* Remove 1.19 from test matrix

* moved api to v1 folder

* docs: contribute docs

* updated makefile

* updated usage docs

* warn in server command

* updaed docs with shiori version command

* Updated documentation

* deps: update
2023-07-17 14:30:18 +01:00

191 lines
No EOL
5.5 KiB
JSON

{
"swagger": "2.0",
"info": {
"contact": {}
},
"paths": {
"/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.loginRequestPayload"
}
}
],
"responses": {
"200": {
"description": "Login successful",
"schema": {
"$ref": "#/definitions/api.loginResponseMessage"
}
},
"400": {
"description": "Invalid login data"
}
}
}
},
"/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.loginResponseMessage"
}
},
"403": {
"description": "Token not provided/invalid"
}
}
}
},
"/api/v1/tags": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Tags"
],
"summary": "List tags",
"responses": {
"200": {
"description": "List of tags",
"schema": {
"$ref": "#/definitions/model.Tag"
}
},
"403": {
"description": "Token not provided/invalid"
}
}
},
"post": {
"produces": [
"application/json"
],
"tags": [
"Tags"
],
"summary": "Create tag",
"responses": {
"200": {
"description": "Created tag",
"schema": {
"$ref": "#/definitions/model.Tag"
}
},
"400": {
"description": "Token not provided/invalid"
},
"403": {
"description": "Token not provided/invalid"
}
}
}
}
},
"definitions": {
"api.loginRequestPayload": {
"type": "object",
"required": [
"password",
"username"
],
"properties": {
"password": {
"type": "string"
},
"remember_me": {
"type": "boolean"
},
"username": {
"type": "string"
}
}
},
"api.loginResponseMessage": {
"type": "object",
"properties": {
"token": {
"type": "string"
}
}
},
"model.Account": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"owner": {
"type": "boolean"
},
"password": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"model.Tag": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"nBookmarks": {
"type": "integer"
},
"name": {
"type": "string"
}
}
}
}
}