photum/backend/docs/swagger.json

247 lines
No EOL
7.8 KiB
JSON

{
"swagger": "2.0",
"info": {
"description": "Backend authentication service for Photum.",
"title": "Photum Backend API",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0"
},
"host": "localhost:8080",
"basePath": "/",
"paths": {
"/auth/login": {
"post": {
"description": "Authenticate user and return access token and refresh token",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Login user",
"parameters": [
{
"description": "Login Request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/auth.loginRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/auth/logout": {
"post": {
"description": "Revoke refresh token and clear cookie",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Logout user",
"parameters": [
{
"description": "Refresh Token (optional if in cookie)",
"name": "refresh_token",
"in": "body",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/auth/refresh": {
"post": {
"description": "Get a new access token using a valid refresh token (cookie or body)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Refresh access token",
"parameters": [
{
"description": "Refresh Token (optional if in cookie)",
"name": "refresh_token",
"in": "body",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/auth/register": {
"post": {
"description": "Create a new user account with email and password",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Register a new user",
"parameters": [
{
"description": "Register Request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/auth.registerRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
},
"definitions": {
"auth.loginRequest": {
"type": "object",
"required": [
"email",
"senha"
],
"properties": {
"email": {
"type": "string"
},
"senha": {
"type": "string"
}
}
},
"auth.registerRequest": {
"type": "object",
"required": [
"email",
"senha"
],
"properties": {
"email": {
"type": "string"
},
"senha": {
"type": "string",
"minLength": 6
}
}
}
},
"securityDefinitions": {
"BearerAuth": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}