Last active
July 24, 2022 22:48
-
-
Save sakukode/d144cfb2dc66837ae48ce86c90d7cfcd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "openapi": "3.0.0", | |
| "info": { | |
| "title": "ES API", | |
| "description": "API documentation for Store App", | |
| "version": "1" | |
| }, | |
| "servers": [ | |
| { | |
| "url": "http://127.0.0.1:4000/api/v1", | |
| "description": "Production" | |
| }, | |
| { | |
| "url": "http://127.0.0.1:4000/api/v1", | |
| "description": "Testing" | |
| } | |
| ], | |
| "components": { | |
| "securitySchemes": { | |
| "bearerAuth": { | |
| "type": "http", | |
| "scheme": "bearer" | |
| } | |
| }, | |
| "responses": { | |
| "UnauthorizedError": { | |
| "description": "Access token is missing or invalid", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "status": { | |
| "type": "string", | |
| "default": "error" | |
| }, | |
| "message": { | |
| "type": "string", | |
| "default": "Access token is missing or invalid" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "RecordNotFound": { | |
| "description": "Record not found", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "status": { | |
| "type": "string", | |
| "default": "error" | |
| }, | |
| "message": { | |
| "type": "string", | |
| "default": "Record not found." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "schemas": { | |
| "GeneralResponse": { | |
| "properties": { | |
| "status": { | |
| "type": "string" | |
| }, | |
| "message": { | |
| "type": "string" | |
| } | |
| } | |
| }, | |
| "PaginationLink": { | |
| "properties": { | |
| "first": { | |
| "type": "string", | |
| "example": "http://127.0.0.1:4000/api/v1/example?page=1" | |
| }, | |
| "last": { | |
| "type": "string", | |
| "example": "http://127.0.0.1:4000/api/v1/example?page=10" | |
| }, | |
| "prev": { | |
| "type": "string", | |
| "example": null | |
| }, | |
| "next": { | |
| "type": "string", | |
| "example": "http://127.0.0.1:4000/api/v1/example?page=2" | |
| } | |
| } | |
| }, | |
| "PaginationMeta": { | |
| "properties": { | |
| "current_page": { | |
| "type": "number", | |
| "example": 1 | |
| }, | |
| "from": { | |
| "type": "number", | |
| "example": 1 | |
| }, | |
| "last_page": { | |
| "type": "number", | |
| "example": 10 | |
| }, | |
| "links": { | |
| "type": "array", | |
| "items": { | |
| "properties": { | |
| "url": { | |
| "type": "string", | |
| "example": "http://127.0.0.1:4000/api/v1/example?page=1" | |
| }, | |
| "label": { | |
| "type": "string", | |
| "example": "Previous" | |
| }, | |
| "active": { | |
| "type": "boolean", | |
| "example": true | |
| } | |
| } | |
| } | |
| }, | |
| "path": { | |
| "type": "string", | |
| "example": "http://127.0.0.1:4000/api/v1/example" | |
| }, | |
| "per_page": { | |
| "type": "number", | |
| "example": 10 | |
| }, | |
| "to": { | |
| "type": "number", | |
| "example": 10 | |
| }, | |
| "total": { | |
| "type": "number", | |
| "example": 10 | |
| } | |
| } | |
| }, | |
| "UserForm": { | |
| "properties": { | |
| "email": { | |
| "type": "string" | |
| }, | |
| "password": { | |
| "type": "string" | |
| } | |
| } | |
| }, | |
| "AuthToken": { | |
| "properties": { | |
| "email": { | |
| "type": "string" | |
| }, | |
| "token": { | |
| "type": "string" | |
| } | |
| } | |
| }, | |
| "UserSetting": { | |
| "properties": { | |
| "name": { | |
| "type": "string" | |
| }, | |
| "setting": { | |
| "type": "object", | |
| "properties": { | |
| "phone": { | |
| "type": "string" | |
| }, | |
| "address": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "Category": { | |
| "properties": { | |
| "id": { | |
| "type": "integer", | |
| "example": 1 | |
| }, | |
| "name": { | |
| "type": "string", | |
| "example": "Shoes" | |
| }, | |
| "description": { | |
| "type": "string", | |
| "example": "Shoes Product" | |
| } | |
| } | |
| }, | |
| "Product": { | |
| "properties": { | |
| "id": { | |
| "type": "integer", | |
| "example": 1 | |
| }, | |
| "name": { | |
| "type": "string", | |
| "example": "Sneaker Z100" | |
| }, | |
| "category": { | |
| "$ref": "#/components/schemas/Category" | |
| }, | |
| "images": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "preview": { | |
| "type": "string", | |
| "example": "https://via.placeholder.com/200x200.png/0033dd?text=natus" | |
| }, | |
| "full": { | |
| "type": "string", | |
| "example": "https://via.placeholder.com/200x200.png/0033dd?text=natus" | |
| } | |
| } | |
| } | |
| }, | |
| "prices": { | |
| "type": "object", | |
| "properties": { | |
| "usd": { | |
| "type": "number", | |
| "example": 5 | |
| }, | |
| "btc": { | |
| "type": "number", | |
| "example": 0.0003785 | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "ProductForm": { | |
| "properties": { | |
| "name": { | |
| "type": "string" | |
| }, | |
| "category": { | |
| "$ref": "#/components/schemas/Category" | |
| }, | |
| "images": { | |
| "type": "array", | |
| "description": "binary file", | |
| "items": { | |
| "type": "string" | |
| } | |
| }, | |
| "price": { | |
| "type": "object", | |
| "properties": { | |
| "usd": { | |
| "type": "number" | |
| }, | |
| "btc": { | |
| "type": "number" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "Order": { | |
| "properties": { | |
| "id": { | |
| "type": "integer", | |
| "example": 1 | |
| }, | |
| "date": { | |
| "type": "string", | |
| "example": "2022-07-24T15:29:53.000Z" | |
| }, | |
| "status": { | |
| "type": "string", | |
| "example": "paid" | |
| }, | |
| "total": { | |
| "type": "object", | |
| "properties": { | |
| "usd": { | |
| "type": "number", | |
| "example": 10 | |
| }, | |
| "btc": { | |
| "type": "number", | |
| "example": 0.000246 | |
| } | |
| } | |
| }, | |
| "items": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "id": { | |
| "type": "integer", | |
| "example": 1 | |
| }, | |
| "name": { | |
| "type": "string", | |
| "example": "Sneaker Z100" | |
| }, | |
| "price": { | |
| "type": "object", | |
| "properties": { | |
| "usd": { | |
| "type": "number", | |
| "example": 5 | |
| }, | |
| "btc": { | |
| "type": "number", | |
| "example": 0.000123 | |
| } | |
| } | |
| }, | |
| "quantity": { | |
| "type": "number", | |
| "example": 2 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "OrderForm": { | |
| "properties": { | |
| "items": { | |
| "type": "array", | |
| "items": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "id": { | |
| "type": "integer" | |
| }, | |
| "quantity": { | |
| "type": "number" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "paths": { | |
| "/auth/register": { | |
| "post": { | |
| "tags": [ | |
| "Register" | |
| ], | |
| "summary": "Create a new User", | |
| "description": "", | |
| "operationId": "authRegister", | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "name": { | |
| "type": "string", | |
| "example": "John Doe" | |
| }, | |
| "email": { | |
| "type": "string", | |
| "example": "[email protected]" | |
| }, | |
| "password": { | |
| "type": "string", | |
| "example": "passdev123456@" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Created", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "$ref": "#/components/schemas/GeneralResponse" | |
| }, | |
| "examples": { | |
| "default": { | |
| "value": { | |
| "status": "success", | |
| "message": "User Created Successfully." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "422": { | |
| "description": "Unprocessable entity", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "status": { | |
| "type": "string" | |
| }, | |
| "message": { | |
| "type": "string" | |
| }, | |
| "data": { | |
| "type": "object" | |
| } | |
| } | |
| }, | |
| "examples": { | |
| "default": { | |
| "value": { | |
| "status": "error", | |
| "message": "Validation errors", | |
| "data": { | |
| "name": [ | |
| "The name field is required." | |
| ], | |
| "email": [ | |
| "The email must be a valid email address." | |
| ] | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/auth/login": { | |
| "post": { | |
| "tags": [ | |
| "Login" | |
| ], | |
| "summary": "Login or request a token", | |
| "description": "", | |
| "operationId": "authLogin", | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "$ref": "#/components/schemas/UserForm" | |
| }, | |
| "examples": { | |
| "default": { | |
| "value": { | |
| "email": "[email protected]", | |
| "password": "passdev123456@" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Successfully logged in", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "status": { | |
| "type": "string" | |
| }, | |
| "message": { | |
| "type": "string" | |
| }, | |
| "data": { | |
| "$ref": "#/components/schemas/AuthToken" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Credentials mismatch", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "$ref": "#/components/schemas/GeneralResponse" | |
| }, | |
| "examples": { | |
| "default": { | |
| "value": { | |
| "status": "error", | |
| "message": "Credentials mismatch" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/auth/forgot-password": { | |
| "post": { | |
| "tags": [ | |
| "Forgot Password" | |
| ], | |
| "summary": "Forgot Password", | |
| "description": "", | |
| "operationId": "authForgotPassword", | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "email": { | |
| "type": "string", | |
| "example": "[email protected]" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Success", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "$ref": "#/components/schemas/GeneralResponse" | |
| }, | |
| "examples": { | |
| "default": { | |
| "value": { | |
| "status": "success", | |
| "message": "We've been sent reset password code to your email." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "422": { | |
| "description": "Unprocessable entity", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "status": { | |
| "type": "string" | |
| }, | |
| "message": { | |
| "type": "string" | |
| }, | |
| "data": { | |
| "type": "object" | |
| } | |
| } | |
| }, | |
| "examples": { | |
| "default": { | |
| "value": { | |
| "status": "error", | |
| "message": "Validation errors", | |
| "data": { | |
| "email": [ | |
| "The selected email is invalid." | |
| ] | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/auth/reset-password": { | |
| "post": { | |
| "tags": [ | |
| "Reset Password" | |
| ], | |
| "summary": "Reset Password", | |
| "description": "", | |
| "operationId": "authResetPassword", | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "code": { | |
| "type": "string" | |
| }, | |
| "password": { | |
| "type": "string" | |
| }, | |
| "password_confirmation": { | |
| "type": "string" | |
| } | |
| } | |
| }, | |
| "examples": { | |
| "default": { | |
| "value": { | |
| "code": "756338", | |
| "password": "newpass123456@", | |
| "password_confirmation": "newpass123456@" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Success", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "$ref": "#/components/schemas/GeneralResponse" | |
| }, | |
| "examples": { | |
| "default": { | |
| "value": { | |
| "status": "success", | |
| "message": "Password has been successfully reset." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "404": { | |
| "description": "Code Expired or Invalid", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "$ref": "#/components/schemas/GeneralResponse" | |
| }, | |
| "examples": { | |
| "expired": { | |
| "value": { | |
| "status": "error", | |
| "message": "Your reset password code has expired!" | |
| } | |
| }, | |
| "invalid": { | |
| "value": { | |
| "status": "error", | |
| "message": "Your reset password code is invalid!" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "422": { | |
| "description": "Unprocessable entity", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "status": { | |
| "type": "string" | |
| }, | |
| "message": { | |
| "type": "string" | |
| }, | |
| "data": { | |
| "type": "object" | |
| } | |
| } | |
| }, | |
| "examples": { | |
| "default": { | |
| "value": { | |
| "status": "error", | |
| "message": "Validation errors", | |
| "data": { | |
| "email": [ | |
| "The email must be a valid email address." | |
| ] | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/user/get-user": { | |
| "get": { | |
| "tags": [ | |
| "User Setting" | |
| ], | |
| "summary": "Get User Setting", | |
| "description": "", | |
| "parameters": [ | |
| { | |
| "in": "header", | |
| "name": "Authorization", | |
| "required": true, | |
| "schema": { | |
| "type": "string", | |
| "default": "Bearer {token}" | |
| } | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Success", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "status": { | |
| "type": "string" | |
| }, | |
| "message": { | |
| "type": "string" | |
| }, | |
| "data": { | |
| "$ref": "#/components/schemas/UserSetting" | |
| } | |
| } | |
| }, | |
| "examples": { | |
| "default": { | |
| "value": { | |
| "status": "success", | |
| "message": "Successfully.", | |
| "data": { | |
| "name": "John Doe", | |
| "email": "[email protected]", | |
| "setting": { | |
| "phone": "", | |
| "address": "" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "$ref": "#/components/responses/UnauthorizedError" | |
| } | |
| }, | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ] | |
| } | |
| }, | |
| "/user/update-user": { | |
| "put": { | |
| "tags": [ | |
| "User Setting" | |
| ], | |
| "summary": "Update User Setting", | |
| "description": "", | |
| "parameters": [ | |
| { | |
| "in": "header", | |
| "name": "Authorization", | |
| "required": true, | |
| "schema": { | |
| "type": "string", | |
| "default": "Bearer {token}" | |
| } | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "$ref": "#/components/schemas/UserSetting" | |
| }, | |
| "examples": { | |
| "default": { | |
| "value": { | |
| "name": "John Doe", | |
| "setting": { | |
| "phone": "+1 234 567", | |
| "address": "Oak Street 17th, California" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Success", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "status": { | |
| "type": "string" | |
| }, | |
| "message": { | |
| "type": "string" | |
| }, | |
| "data": { | |
| "$ref": "#/components/schemas/UserSetting" | |
| } | |
| } | |
| }, | |
| "examples": { | |
| "default": { | |
| "value": { | |
| "name": "John Doe", | |
| "setting": { | |
| "phone": "+1 234 567", | |
| "address": "Oak Street 17th, California" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "$ref": "#/components/responses/UnauthorizedError" | |
| }, | |
| "422": { | |
| "description": "Unprocessable entity", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "status": { | |
| "type": "string" | |
| }, | |
| "message": { | |
| "type": "string" | |
| }, | |
| "data": { | |
| "type": "object" | |
| } | |
| } | |
| }, | |
| "examples": { | |
| "default": { | |
| "value": { | |
| "status": "error", | |
| "message": "Validation errors", | |
| "data": { | |
| "name": [ | |
| "The name field is required." | |
| ], | |
| "phone": [ | |
| "The phone field is required." | |
| ], | |
| "address": [ | |
| "The address field is required." | |
| ] | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ] | |
| } | |
| }, | |
| "/product": { | |
| "get": { | |
| "tags": [ | |
| "Product" | |
| ], | |
| "summary": "Get Products", | |
| "description": "", | |
| "parameters": [ | |
| { | |
| "in": "header", | |
| "name": "Authorization", | |
| "required": true, | |
| "schema": { | |
| "type": "string", | |
| "default": "Bearer {token}" | |
| } | |
| }, | |
| { | |
| "in": "query", | |
| "name": "limit", | |
| "schema": { | |
| "type": "integer" | |
| } | |
| }, | |
| { | |
| "in": "query", | |
| "name": "page", | |
| "schema": { | |
| "type": "integer" | |
| } | |
| }, | |
| { | |
| "in": "query", | |
| "name": "search", | |
| "schema": { | |
| "type": "string" | |
| } | |
| }, | |
| { | |
| "in": "query", | |
| "name": "categories", | |
| "schema": { | |
| "type": "string" | |
| } | |
| }, | |
| { | |
| "in": "query", | |
| "name": "sort", | |
| "schema": { | |
| "type": "string", | |
| "enum": [ | |
| "price", | |
| "-price", | |
| "name", | |
| "-name", | |
| "category", | |
| "rating" | |
| ] | |
| }, | |
| "description": "Sort order:\n * `price` - by price (highest to lowest)\n * `-price` - by price (lowest to highest)\n * `name` - by name (A-Z)\n * `-name` - by name (Z-A)\n * `category` - by category\n * `rating` - by rating\n \n \n" | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Success", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "status": { | |
| "type": "string" | |
| }, | |
| "message": { | |
| "type": "string" | |
| }, | |
| "data": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/components/schemas/Product" | |
| } | |
| }, | |
| "links": { | |
| "$ref": "#/components/schemas/PaginationLink" | |
| }, | |
| "meta": { | |
| "$ref": "#/components/schemas/PaginationMeta" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "$ref": "#/components/responses/UnauthorizedError" | |
| } | |
| }, | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ] | |
| }, | |
| "post": { | |
| "tags": [ | |
| "Product" | |
| ], | |
| "summary": "Add a new Product", | |
| "description": "", | |
| "parameters": [ | |
| { | |
| "in": "header", | |
| "name": "Authorization", | |
| "required": true, | |
| "schema": { | |
| "type": "string", | |
| "default": "Bearer {token}" | |
| } | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "$ref": "#/components/schemas/ProductForm" | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Created" | |
| } | |
| }, | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ] | |
| } | |
| }, | |
| "/product/{productId}": { | |
| "get": { | |
| "tags": [ | |
| "Product" | |
| ], | |
| "summary": "Get Product Details", | |
| "description": "", | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "productId", | |
| "required": true, | |
| "schema": { | |
| "type": "integer" | |
| } | |
| }, | |
| { | |
| "in": "header", | |
| "name": "Authorization", | |
| "required": true, | |
| "schema": { | |
| "type": "string", | |
| "default": "Bearer {token}" | |
| } | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Success", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "status": { | |
| "type": "string" | |
| }, | |
| "message": { | |
| "type": "string" | |
| }, | |
| "data": { | |
| "$ref": "#/components/schemas/Product" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "$ref": "#/components/responses/UnauthorizedError" | |
| }, | |
| "404": { | |
| "$ref": "#/components/responses/RecordNotFound" | |
| } | |
| }, | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ] | |
| }, | |
| "put": { | |
| "tags": [ | |
| "Product" | |
| ], | |
| "summary": "Update Product", | |
| "description": "", | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "productId", | |
| "required": true, | |
| "schema": { | |
| "type": "integer" | |
| } | |
| }, | |
| { | |
| "in": "header", | |
| "name": "Authorization", | |
| "required": true, | |
| "schema": { | |
| "type": "string", | |
| "default": "Bearer {token}" | |
| } | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "$ref": "#/components/schemas/ProductForm" | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Success", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "status": { | |
| "type": "string" | |
| }, | |
| "message": { | |
| "type": "string" | |
| }, | |
| "data": { | |
| "$ref": "#/components/schemas/Product" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "$ref": "#/components/responses/UnauthorizedError" | |
| }, | |
| "422": { | |
| "description": "Unprocessable entity" | |
| } | |
| }, | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ] | |
| } | |
| }, | |
| "/order": { | |
| "get": { | |
| "tags": [ | |
| "Order" | |
| ], | |
| "summary": "Get User Orders", | |
| "description": "", | |
| "parameters": [ | |
| { | |
| "in": "header", | |
| "name": "Authorization", | |
| "required": true, | |
| "schema": { | |
| "type": "string", | |
| "default": "Bearer {token}" | |
| } | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Success", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "status": { | |
| "type": "string" | |
| }, | |
| "message": { | |
| "type": "string" | |
| }, | |
| "data": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/components/schemas/Order" | |
| } | |
| }, | |
| "links": { | |
| "$ref": "#/components/schemas/PaginationLink" | |
| }, | |
| "meta": { | |
| "$ref": "#/components/schemas/PaginationMeta" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "$ref": "#/components/responses/UnauthorizedError" | |
| } | |
| }, | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ] | |
| }, | |
| "post": { | |
| "tags": [ | |
| "Order" | |
| ], | |
| "summary": "Create a new Order", | |
| "description": "", | |
| "parameters": [ | |
| { | |
| "in": "header", | |
| "name": "Authorization", | |
| "required": true, | |
| "schema": { | |
| "type": "string", | |
| "default": "Bearer {token}" | |
| } | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "$ref": "#/components/schemas/OrderForm" | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Created", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "status": { | |
| "type": "string" | |
| }, | |
| "message": { | |
| "type": "string" | |
| }, | |
| "data": { | |
| "$ref": "#/components/schemas/Order" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "$ref": "#/components/responses/UnauthorizedError" | |
| }, | |
| "422": { | |
| "description": "Unprocessable entity" | |
| } | |
| }, | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ] | |
| } | |
| }, | |
| "/order/{orderId}": { | |
| "get": { | |
| "tags": [ | |
| "Order" | |
| ], | |
| "summary": "Get User Order Details", | |
| "description": "", | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "orderId", | |
| "required": true, | |
| "schema": { | |
| "type": "integer" | |
| } | |
| }, | |
| { | |
| "in": "header", | |
| "name": "Authorization", | |
| "required": true, | |
| "schema": { | |
| "type": "string", | |
| "default": "Bearer {token}" | |
| } | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Success", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "status": { | |
| "type": "string" | |
| }, | |
| "message": { | |
| "type": "string" | |
| }, | |
| "data": { | |
| "$ref": "#/components/schemas/Order" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "$ref": "#/components/responses/UnauthorizedError" | |
| }, | |
| "404": { | |
| "$ref": "#/components/responses/RecordNotFound" | |
| } | |
| }, | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ] | |
| }, | |
| "put": { | |
| "tags": [ | |
| "Order" | |
| ], | |
| "summary": "Update Order", | |
| "description": "", | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "orderId", | |
| "required": true, | |
| "schema": { | |
| "type": "integer" | |
| } | |
| }, | |
| { | |
| "in": "header", | |
| "name": "Authorization", | |
| "required": true, | |
| "schema": { | |
| "type": "string", | |
| "default": "Bearer {token}" | |
| } | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "status": { | |
| "type": "string", | |
| "description": "Order Status", | |
| "enum": [ | |
| "new", | |
| "paid", | |
| "completed", | |
| "expired", | |
| "archived" | |
| ] | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Success", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "status": { | |
| "type": "string" | |
| }, | |
| "message": { | |
| "type": "string" | |
| }, | |
| "data": { | |
| "$ref": "#/components/schemas/Order" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "$ref": "#/components/responses/UnauthorizedError" | |
| }, | |
| "422": { | |
| "description": "Unprocessable entity" | |
| } | |
| }, | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ] | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment