356 lines
16 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"openapi": "3.0.0",
"info": {
"title": "API Documentation",
"version": "1.0.0"
},
"paths": {
"/api/deleteAccount": {
"delete": {
"tags": [
"Authentication"
],
"summary": "Delete user account",
"description": "Deletes the user's account and invalidates their tokens.",
"operationId": "dab9c1b923636bca3b073db3bdf87db0",
"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. Were sorry to see you go."
}
},
"type": "object"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"properties": {
"status": {
"type": "integer",
"example": 0
},
"error": {
"type": "string",
"example": "We couldnt delete your account at this moment. Please try again later."
},
"message": {
"type": "string",
"example": "Exception message"
}
},
"type": "object"
}
}
}
}
}
}
},
"/api/login": {
"post": {
"tags": [
"Authentication"
],
"summary": "Login user",
"description": "Login a user with email and password, and return an authentication token.",
"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": "User successfully logged in and token provided",
"content": {
"application/json": {
"schema": {
"properties": {
"status": {
"type": "integer",
"example": 1
},
"message": {
"type": "string",
"example": "Login successful. Welcome back!"
},
"data": {
"properties": {
"email": {
"type": "string",
"example": "nima.8ak@gmail.com"
},
"name": {
"type": "string",
"example": "nima malakooti"
},
"token": {
"type": "string",
"example": "your-token-here"
}
},
"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": "Internal server error",
"content": {
"application/json": {
"schema": {
"properties": {
"status": {
"type": "integer",
"example": 0
},
"error": {
"type": "string",
"example": "Failed to login user. Please try again later."
},
"message": {
"type": "string",
"example": "Exception message"
}
},
"type": "object"
}
}
}
}
}
}
},
"/api/logout": {
"post": {
"tags": [
"Authentication"
],
"summary": "Logout the user",
"description": "Invalidate the user's session by deleting their tokens and logging them out.",
"operationId": "ad0ae046131d33ce33ee57a7f8a6a3f0",
"responses": {
"200": {
"description": "Successfully logged out",
"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": "Internal server error",
"content": {
"application/json": {
"schema": {
"properties": {
"status": {
"type": "integer",
"example": 0
},
"error": {
"type": "string",
"example": "Oops! Something went wrong while logging out. Please try again later."
},
"message": {
"type": "string",
"example": "Exception message"
}
},
"type": "object"
}
}
}
}
}
}
},
"/api/register": {
"post": {
"tags": [
"Authentication"
],
"summary": "Register a new user",
"description": "Register a new user with name, email, and password and return a user object with authentication token.",
"operationId": "97cd8d12c6b5cf0267b29ff739a126f8",
"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": "User successfully registered and token provided",
"content": {
"application/json": {
"schema": {
"properties": {
"status": {
"type": "integer",
"example": 1
},
"message": {
"type": "string",
"example": "User registered successfully."
},
"user": {
"properties": {
"name": {
"type": "string",
"example": "nima malakooti"
},
"email": {
"type": "string",
"example": "nima.8ak@gmail.com"
},
"token": {
"type": "string",
"example": "your-token-here"
}
},
"type": "object"
}
},
"type": "object"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"properties": {
"status": {
"type": "integer",
"example": 0
},
"error": {
"type": "string",
"example": "Failed to register user. Please try again later."
},
"message": {
"type": "string",
"example": "Exception message"
}
},
"type": "object"
}
}
}
}
}
}
}
},
"tags": [
{
"name": "Authentication",
"description": "Authentication"
}
]
}