694 lines
31 KiB
JSON
694 lines
31 KiB
JSON
{
|
||
"openapi": "3.0.0",
|
||
"info": {
|
||
"title": "API Documentation",
|
||
"version": "1.0.0"
|
||
},
|
||
"paths": {
|
||
"/api/deleteAcconut": {
|
||
"delete": {
|
||
"tags": [
|
||
"Authentication"
|
||
],
|
||
"summary": "Delete user account",
|
||
"description": "Deletes the currently authenticated user's account and invalidates the JWT token.",
|
||
"operationId": "4cf0edfc2e1177da97815505b73e16e0",
|
||
"responses": {
|
||
"200": {
|
||
"description": "Account deleted successfully",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Your account has been deleted successfully. We’re sorry to see you go."
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Account deletion failed",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"error": {
|
||
"type": "string",
|
||
"example": "We couldn’t delete your account at this moment. Please try again later."
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Exception message"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"security": [
|
||
{
|
||
"bearerAuth": []
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"/api/login": {
|
||
"post": {
|
||
"tags": [
|
||
"Authentication"
|
||
],
|
||
"summary": "User login",
|
||
"description": "Logs in a user and returns a JWT token if credentials are correct.",
|
||
"operationId": "e3ce052cc00fd9dd647e77abd7807e14",
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"required": [
|
||
"email",
|
||
"password"
|
||
],
|
||
"properties": {
|
||
"email": {
|
||
"type": "string",
|
||
"format": "email",
|
||
"example": "nima.8ak@gmail.com"
|
||
},
|
||
"password": {
|
||
"type": "string",
|
||
"format": "password",
|
||
"example": "12345678"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "Login successful",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Login successful. Welcome back!"
|
||
},
|
||
"data": {
|
||
"properties": {
|
||
"name": {
|
||
"type": "string",
|
||
"example": "Nima Malakooti"
|
||
},
|
||
"email": {
|
||
"type": "string",
|
||
"example": "nima.8ak@gmail.com"
|
||
},
|
||
"token": {
|
||
"type": "string",
|
||
"example": "Bearer eyJ0eXAiOiJKV1QiLCJhbGci..."
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized access",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Unauthorized access. Please check your credentials and try again."
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Failed to login",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Failed to login user. Please try again later."
|
||
},
|
||
"error": {
|
||
"type": "string",
|
||
"example": "Exception message here"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/logout": {
|
||
"post": {
|
||
"tags": [
|
||
"Authentication"
|
||
],
|
||
"summary": "Logout user",
|
||
"description": "Logs out the currently authenticated user by invalidating the JWT token.",
|
||
"operationId": "ad0ae046131d33ce33ee57a7f8a6a3f0",
|
||
"responses": {
|
||
"200": {
|
||
"description": "Logout successful",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "You have been logged out successfully. Come back soon!"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Logout failed",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Oops! Something went wrong while logging out. Please try again later."
|
||
},
|
||
"error": {
|
||
"type": "string",
|
||
"example": "Exception message"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"security": [
|
||
{
|
||
"bearerAuth": []
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"/api/email/verification-notification": {
|
||
"post": {
|
||
"tags": [
|
||
"Authentication"
|
||
],
|
||
"summary": "Send verification email",
|
||
"description": "Sends a verification email to the authenticated user.",
|
||
"operationId": "379b3fb09eb88cee77701aff98e2ee2b",
|
||
"responses": {
|
||
"200": {
|
||
"description": "Verification email sent",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Please check your email for the verification link."
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Error while sending email",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"error": {
|
||
"type": "string",
|
||
"example": "We encountered an issue while sending the verification email. Please try again later."
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Exception message"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"security": [
|
||
{
|
||
"bearerAuth": []
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"/api/email/verify/{id}/{hash}": {
|
||
"get": {
|
||
"tags": [
|
||
"Authentication"
|
||
],
|
||
"summary": "Verify user email",
|
||
"description": "Verifies the user's email using the verification link.",
|
||
"operationId": "ddc92b84a9a7691538056ed633a285a6",
|
||
"parameters": [
|
||
{
|
||
"name": "id",
|
||
"in": "path",
|
||
"description": "User ID",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "integer",
|
||
"example": 1
|
||
}
|
||
},
|
||
{
|
||
"name": "hash",
|
||
"in": "path",
|
||
"description": "Email verification hash",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"example": "9e4f889aabbc..."
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "Email verified successfully",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Your email has been successfully verified. Thank you!"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Verification failed",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"error": {
|
||
"type": "string",
|
||
"example": "Your verification link was found, but something went wrong during the confirmation process. Please try again or request a new verification email."
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Exception message"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/forgot-password": {
|
||
"post": {
|
||
"tags": [
|
||
"Authentication"
|
||
],
|
||
"summary": "Send password reset link",
|
||
"description": "Sends a password reset link to the user's email address.",
|
||
"operationId": "ce31c7b7aa42b76f9e462c54075c43aa",
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"required": [
|
||
"email"
|
||
],
|
||
"properties": {
|
||
"email": {
|
||
"type": "string",
|
||
"format": "email",
|
||
"example": "nima.8ak@gmail.com"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "Password reset link sent or email not found",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "We’ve emailed you the password reset link. Please check your inbox!"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Failed to send password reset email",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"error": {
|
||
"type": "string",
|
||
"example": "We couldn’t send the password reset email due to an error. Please try again later."
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Exception message"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/reset-password": {
|
||
"post": {
|
||
"tags": [
|
||
"Authentication"
|
||
],
|
||
"summary": "Reset the user's password",
|
||
"description": "Resets the password for the user using the provided token and new password.",
|
||
"operationId": "8e8229015b36555c6ad9564278a79929",
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"required": [
|
||
"email",
|
||
"password",
|
||
"password_confirmation",
|
||
"token"
|
||
],
|
||
"properties": {
|
||
"email": {
|
||
"type": "string",
|
||
"format": "email",
|
||
"example": "nima.8ak@gmail.com"
|
||
},
|
||
"password": {
|
||
"type": "string",
|
||
"format": "password",
|
||
"example": "12345678"
|
||
},
|
||
"password_confirmation": {
|
||
"type": "string",
|
||
"format": "password",
|
||
"example": "12345678"
|
||
},
|
||
"token": {
|
||
"type": "string",
|
||
"example": "valid-reset-token-here"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "Password reset successfully",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Your password has been reset!"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Invalid token or mismatched password confirmation",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "This password reset token is invalid."
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal server error",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"error": {
|
||
"type": "string",
|
||
"example": "We couldn’t process the request due to an error. Please try again later."
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Exception message"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/register": {
|
||
"post": {
|
||
"tags": [
|
||
"Authentication"
|
||
],
|
||
"summary": "Register a new user",
|
||
"description": "Registers a user and returns a JWT token.",
|
||
"operationId": "registerUser",
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"required": [
|
||
"name",
|
||
"email",
|
||
"password",
|
||
"password_confirmation"
|
||
],
|
||
"properties": {
|
||
"name": {
|
||
"type": "string",
|
||
"example": "Nima Malakooti"
|
||
},
|
||
"email": {
|
||
"type": "string",
|
||
"format": "email",
|
||
"example": "nima.8ak@gmail.com"
|
||
},
|
||
"password": {
|
||
"type": "string",
|
||
"format": "password",
|
||
"example": "12345678"
|
||
},
|
||
"password_confirmation": {
|
||
"type": "string",
|
||
"format": "password",
|
||
"example": "12345678"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "Successful registration",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "User registered successfully."
|
||
},
|
||
"data": {
|
||
"properties": {
|
||
"name": {
|
||
"type": "string",
|
||
"example": "Nima Malakooti"
|
||
},
|
||
"email": {
|
||
"type": "string",
|
||
"example": "nima.8ak@gmail.com"
|
||
},
|
||
"token": {
|
||
"type": "string",
|
||
"example": "Bearer eyJ0eXAiOiJKV1..."
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Registration failed",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Failed to register user. Please try again later."
|
||
},
|
||
"error": {
|
||
"type": "string",
|
||
"example": "Detailed error message"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"tags": [
|
||
{
|
||
"name": "Authentication",
|
||
"description": "Authentication"
|
||
}
|
||
]
|
||
} |