Initial commit
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
---
|
||||
openapi: 3.0.1
|
||||
info:
|
||||
title: API V1
|
||||
version: v1
|
||||
paths:
|
||||
"/api/v1/admin/dashboard":
|
||||
get:
|
||||
summary: admin dashboard (admin only)
|
||||
tags:
|
||||
- Admin
|
||||
security:
|
||||
- bearer_auth: []
|
||||
responses:
|
||||
'200':
|
||||
description: admin dashboard accessed
|
||||
'403':
|
||||
description: forbidden for non-admin users
|
||||
'401':
|
||||
description: unauthorized without token
|
||||
"/api/v1/login":
|
||||
post:
|
||||
summary: logs in a user
|
||||
tags:
|
||||
- Auth
|
||||
security: []
|
||||
parameters: []
|
||||
responses:
|
||||
'200':
|
||||
description: logged in
|
||||
'401':
|
||||
description: invalid credentials
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- email
|
||||
- password
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
example: bob@random.com
|
||||
password:
|
||||
type: string
|
||||
example: '123456'
|
||||
"/api/v1/logout":
|
||||
post:
|
||||
summary: logs out user and blacklists token
|
||||
tags:
|
||||
- Auth
|
||||
security:
|
||||
- bearer_auth: []
|
||||
responses:
|
||||
'200':
|
||||
description: successfully logged out
|
||||
'401':
|
||||
description: unauthorized without token
|
||||
"/api/v1/profile":
|
||||
get:
|
||||
summary: get current user info using jwt token
|
||||
tags:
|
||||
- Profile
|
||||
security:
|
||||
- bearer_auth: []
|
||||
responses:
|
||||
'200':
|
||||
description: profile fetched
|
||||
'401':
|
||||
description: unauthorized access
|
||||
"/api/v1/refresh":
|
||||
post:
|
||||
summary: refreshes access token using refresh token
|
||||
tags:
|
||||
- Auth
|
||||
security: []
|
||||
parameters: []
|
||||
responses:
|
||||
'200':
|
||||
description: new access token issued
|
||||
'401':
|
||||
description: revoked refresh token
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- refresh_token
|
||||
properties:
|
||||
refresh_token:
|
||||
type: string
|
||||
example: your_refresh_token_here
|
||||
"/api/v1/signup":
|
||||
post:
|
||||
summary: registers a new user and returns a jwt
|
||||
tags:
|
||||
- Auth
|
||||
security: []
|
||||
parameters: []
|
||||
responses:
|
||||
'201':
|
||||
description: user created and token returned
|
||||
'422':
|
||||
description: validation failed invalid email + password
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- email
|
||||
- password
|
||||
- password_confirmation
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
example: newbob@example.com
|
||||
password:
|
||||
type: string
|
||||
example: '123456'
|
||||
password_confirmation:
|
||||
type: string
|
||||
example: '123456'
|
||||
components:
|
||||
securitySchemes:
|
||||
bearer_auth:
|
||||
type: http
|
||||
scheme: bearer
|
||||
bearerFormat: JWT
|
||||
security:
|
||||
- bearer_auth: []
|
||||
servers:
|
||||
- url: "{defaultHost}"
|
||||
variables:
|
||||
defaultHost:
|
||||
default: http://localhost:3000
|
||||
Reference in New Issue
Block a user