601 lines
25 KiB
JSON
601 lines
25 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": []
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"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"
|
|
}
|
|
]
|
|
} |