HoshiAI-be/storage/api-docs/api-docs.json
2025-11-10 22:47:08 +01:00

998 lines
39 KiB
JSON

{
"openapi": "3.0.0",
"info": {
"title": "HoshiAI API",
"description": "Documentaion for project",
"version": "1.0.0"
},
"paths": {
"/api/auth/register": {
"post": {
"tags": [
"Auth"
],
"summary": "Register a new user",
"operationId": "d764dd091cc4494ae0baf360b03319f3",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"required": [
"username",
"email",
"password",
"password_confirmation"
],
"properties": {
"username": {
"type": "string",
"maxLength": 100,
"example": "root"
},
"email": {
"type": "string",
"format": "email",
"maxLength": 100,
"example": "root@example.com"
},
"password": {
"type": "string",
"format": "password",
"example": "123456"
},
"password_confirmation": {
"type": "string",
"format": "password",
"example": "123456"
}
},
"type": "object"
}
}
}
},
"responses": {
"200": {
"description": "User registered successfully. Confirmation email sent.",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "You successfully registered! Please, confirm your account using email"
}
},
"type": "object"
}
}
}
},
"422": {
"description": "Validation error",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "The given data was invalid."
},
"errors": {
"type": "object",
"example": {
"email": [
"The email has already been taken."
],
"password": [
"The password must be at least 6 characters."
]
}
}
},
"type": "object"
}
}
}
}
}
}
},
"/api/auth/login": {
"post": {
"tags": [
"Auth"
],
"summary": "User login",
"operationId": "8dcb70df1020986038d098cc08d05dae",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"required": [
"email",
"password"
],
"properties": {
"email": {
"type": "string",
"format": "email",
"example": "root@example.com"
},
"password": {
"type": "string",
"format": "password",
"example": "123456"
}
},
"type": "object"
}
}
}
},
"responses": {
"200": {
"description": "Login successful",
"content": {
"application/json": {
"schema": {
"properties": {
"access_token": {
"type": "string",
"example": "1|JfjOc5DkOHHTtWnM4SdpLM0BR0YvpycoeNAWanlH1305fab7"
},
"token_type": {
"type": "string",
"example": "Bearer"
},
"user": {
"$ref": "#/components/schemas/UserResource"
}
},
"type": "object"
}
}
}
},
"401": {
"description": "Invalid credentials",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "Invalid credentials"
}
},
"type": "object"
}
}
}
},
"403": {
"description": "Email not verified",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "Please verify your email first"
}
},
"type": "object"
}
}
}
}
}
}
},
"/api/auth/logout": {
"post": {
"tags": [
"Auth"
],
"summary": "Logout current user",
"operationId": "69281b12abb272c76871f19cb17ca563",
"responses": {
"200": {
"description": "Successfully logged out",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "Successfully logged out"
}
},
"type": "object"
}
}
}
},
"401": {
"description": "Unauthenticated",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "Unauthenticated"
}
},
"type": "object"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}
},
"/api/auth/forgot-password": {
"post": {
"tags": [
"Auth"
],
"summary": "Send password reset link to user email",
"operationId": "cff9b52a898f73f39d684747bd69c4e1",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"required": [
"email"
],
"properties": {
"email": {
"type": "string",
"format": "email",
"example": "user@example.com"
}
},
"type": "object"
}
}
}
},
"responses": {
"200": {
"description": "Password reset link sent successfully",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "Password reset link has been sent to your email. Please check your inbox."
}
},
"type": "object"
}
}
}
},
"404": {
"description": "User not found",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "User is not found"
}
},
"type": "object"
}
}
}
},
"422": {
"description": "Validation error",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "The given data was invalid."
},
"errors": {
"type": "object",
"example": {
"email": [
"The email must be a valid email address."
]
}
}
},
"type": "object"
}
}
}
}
}
}
},
"/api/auth/reset-password": {
"post": {
"tags": [
"Auth"
],
"summary": "Reset user password using token",
"operationId": "6af92e090f994419a2295111b391a205",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"required": [
"token",
"password",
"password_confirmation"
],
"properties": {
"token": {
"type": "string",
"example": "abcdef123456"
},
"password": {
"type": "string",
"format": "password",
"example": "newpassword123"
},
"password_confirmation": {
"type": "string",
"format": "password",
"example": "newpassword123"
}
},
"type": "object"
}
}
}
},
"responses": {
"200": {
"description": "Password reset successfully",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "Your password was successfully changed!"
}
},
"type": "object"
}
}
}
},
"401": {
"description": "Invalid token",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "Your token is not valid"
}
},
"type": "object"
}
}
}
},
"422": {
"description": "Validation error",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "The given data was invalid."
},
"errors": {
"type": "object",
"example": {
"password": [
"The password must be at least 6 characters."
],
"password_confirmation": [
"The password confirmation does not match."
]
}
}
},
"type": "object"
}
}
}
}
}
}
},
"/api/auth/confirmation-account": {
"post": {
"tags": [
"Auth"
],
"summary": "Confirm user account via email verification token",
"operationId": "c8ecdf6fd50dc4c70fcc5bf19233e462",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"required": [
"token"
],
"properties": {
"token": {
"type": "string",
"example": "abcdef123456"
}
},
"type": "object"
}
}
}
},
"responses": {
"200": {
"description": "Account successfully activated",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "Your account was successfully activated"
}
},
"type": "object"
}
}
}
},
"401": {
"description": "Invalid token",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "Your token is not valid"
}
},
"type": "object"
}
}
}
},
"422": {
"description": "Validation error",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "The given data was invalid."
},
"errors": {
"type": "object",
"example": {
"token": [
"The token field is required."
]
}
}
},
"type": "object"
}
}
}
}
}
}
},
"/api/auth/me": {
"get": {
"tags": [
"Auth"
],
"summary": "Get current user info",
"operationId": "b9abb1a7a74670a19c215c2c133f14d8",
"responses": {
"200": {
"description": "User info",
"content": {
"application/json": {
"schema": {
"properties": {
"user": {
"$ref": "#/components/schemas/UserResource"
}
},
"type": "object"
}
}
}
},
"401": {
"description": "Unauthenticated"
}
},
"security": [
{
"bearerAuth": []
}
]
}
},
"/api/categories": {
"get": {
"tags": [
"Categories"
],
"summary": "Get all categories",
"operationId": "3f5817a34833d0a1f4af4548dd3aeaba",
"responses": {
"200": {
"description": "List of categories",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CategoryResource"
}
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
},
"post": {
"tags": [
"Categories"
],
"summary": "Create a new category (only admin)",
"operationId": "71fcad552bb0eaba9fb191fd8d8dcab0",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"example": "Physics"
}
},
"type": "object"
}
}
}
},
"responses": {
"200": {
"description": "Category created successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CategoryResource"
}
}
}
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"bearerAuth": []
}
]
}
},
"/api/categories/{id}": {
"get": {
"tags": [
"Categories"
],
"summary": "Get a specific category",
"operationId": "c68e76d323c008827a9e47398b1583de",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the category",
"required": true,
"schema": {
"type": "integer",
"example": 1
}
}
],
"responses": {
"200": {
"description": "Category retrieved successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CategoryResource"
}
}
}
},
"404": {
"description": "Category not found"
}
}
},
"put": {
"tags": [
"Categories"
],
"summary": "Update a category (only admin)",
"operationId": "0e686b2748211cc688333ed705dc111f",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the category",
"required": true,
"schema": {
"type": "integer",
"example": 1
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"example": "Physics Updated"
}
},
"type": "object"
}
}
}
},
"responses": {
"200": {
"description": "Category updated successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CategoryResource"
}
}
}
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Category not found"
}
},
"security": [
{
"bearerAuth": []
}
]
},
"delete": {
"tags": [
"Categories"
],
"summary": "Delete a category (only admin)",
"operationId": "4c12e22a7f8c617bd83bfa1fdc05428d",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the category",
"required": true,
"schema": {
"type": "integer",
"example": 1
}
}
],
"responses": {
"200": {
"description": "Category deleted successfully",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "The category was deleted"
}
},
"type": "object"
}
}
}
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Category not found"
}
},
"security": [
{
"bearerAuth": []
}
]
}
},
"/api/logs": {
"get": {
"tags": [
"Logs"
],
"summary": "Get all logs (paginated, only admin)",
"operationId": "07258c00ce1b2cbc7c7151a7cc8ca986",
"responses": {
"200": {
"description": "List of logs",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/LogResource"
}
}
}
}
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"bearerAuth": []
}
]
}
},
"/api/logs/{id}": {
"get": {
"tags": [
"Logs"
],
"summary": "Get a specific log (only admin)",
"operationId": "caa09131dde473dca25ea025d181146a",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the log",
"required": true,
"schema": {
"type": "integer",
"example": 1
}
}
],
"responses": {
"200": {
"description": "Log retrieved successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LogResource"
}
}
}
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Log not found"
}
},
"security": [
{
"bearerAuth": []
}
]
},
"delete": {
"tags": [
"Logs"
],
"summary": "Delete a specific log (only admin)",
"operationId": "2a0e57b9168eaca7e207f5b35f469666",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the log",
"required": true,
"schema": {
"type": "integer",
"example": 1
}
}
],
"responses": {
"200": {
"description": "Log deleted successfully",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "This log is successfully deleted"
}
},
"type": "object"
}
}
}
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Log not found"
}
},
"security": [
{
"bearerAuth": []
}
]
}
}
},
"components": {
"schemas": {
"CategoryResource": {
"title": "Category",
"description": "Category resource with dynamic count",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "Books"
},
"created_at": {
"type": "string",
"format": "date-time",
"example": "2025-11-10T18:00:00Z"
},
"count": {
"description": "Dynamic count of related items",
"type": "integer",
"example": 5
}
},
"type": "object"
},
"LogResource": {
"title": "Log",
"description": "Log resource",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"description": {
"type": "string",
"example": "User logged in"
},
"created_at": {
"type": "string",
"format": "date-time",
"example": "2025-11-10T17:45:00.000000Z"
}
},
"type": "object"
},
"UserResource": {
"properties": {
"id": {
"type": "integer",
"example": 1
},
"username": {
"type": "string",
"example": "root"
},
"email": {
"type": "string",
"example": "root@example.com"
},
"email_verified_at": {
"type": "string",
"format": "date-time"
},
"type": {
"type": "string",
"example": "user"
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
}
},
"type": "object"
}
},
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT"
}
}
},
"tags": [
{
"name": "Auth",
"description": "Auth"
},
{
"name": "Categories",
"description": "Categories"
},
{
"name": "Logs",
"description": "Logs"
}
]
}