{
    "openapi": "3.0.0",
    "info": {
        "title": "Writers Work API Documentation",
        "description": "Writers Work OpenApi description",
        "contact": {
            "email": "developer@codebuddy.co"
        },
        "license": {
            "name": "Proprietary",
            "url": ""
        },
        "version": "1.0.0"
    },
    "servers": [
        {
            "url": "https://writerswork.projectdemo.live/api",
            "description": "staging Server"
        },
        {
            "url": "https://writerswork.projectreview.co/api",
            "description": "dev Server"
        },
        {
            "url": "http://localhost/~code/john-writers-work/api",
            "description": "local Server"
        },
        {
            "url": "http://localhost/john-writers-work/api",
            "description": "local Server WSL"
        },
        {
            "url": "https://stage.writers.work/api/",
            "description": "New Live Staging"
        }
    ],
    "paths": {
        "/files/upload-file": {
            "post": {
                "tags": [
                    "uploadFile"
                ],
                "summary": "Upload Files To The System",
                "description": "",
                "operationId": "api.files.upload",
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "file"
                                ],
                                "properties": {
                                    "file": {
                                        "type": "file"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "application/json": {
                            "schema": {}
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "File Uploaded",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable Entity",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "type": "string",
                                            "example": "{originalName:'sadsadsad.png',fileName:'asdasdasdasdasd.png',filePath:'{BASE_URL}/media/6RkUWxvly45dQoV0WscQ7uWkcfymO2TftIPGihsA.png'}"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/files/delete-file": {
            "post": {
                "tags": [
                    "deleteFile"
                ],
                "summary": "Delete Files From The System",
                "description": "",
                "operationId": "api.files.delete",
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "fileName"
                                ],
                                "properties": {
                                    "fileName": {
                                        "type": "text"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "application/json": {
                            "schema": {}
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "File Deleted",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "delete": {
                                            "type": "string",
                                            "example": "true"
                                        },
                                        "fileName": {
                                            "type": "string",
                                            "example": "asdfgh.png"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable Entity",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    }
                }
            }
        },
        "/tasks/add-document-to-task/": {
            "post": {
                "tags": [
                    "addDocumentToTask"
                ],
                "summary": "Add Document To Task",
                "description": "",
                "operationId": "api.tasks.add_document_to_task",
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "document_id",
                                    "task_id"
                                ],
                                "properties": {
                                    "document_id": {
                                        "type": "text"
                                    },
                                    "task_id": {
                                        "type": "text"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "application/json": {
                            "schema": {}
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Assignment Complete",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "type": "string",
                                            "example": "{task_id:1,document_id:1}"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable Entity",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    }
                }
            }
        },
        "/documents/create-document": {
            "post": {
                "tags": [
                    "createDocument"
                ],
                "summary": "Save - update document",
                "description": "",
                "operationId": "api.documents.store",
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "user_id"
                                ],
                                "properties": {
                                    "document_id": {
                                        "type": "text"
                                    },
                                    "user_id": {
                                        "type": "text"
                                    },
                                    "title": {
                                        "type": "text"
                                    },
                                    "content": {
                                        "type": "text"
                                    },
                                    "new_converted_content": {
                                        "type": "text"
                                    },
                                    "is_sharable": {
                                        "type": "text"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "application/json": {
                            "schema": {}
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "File Deleted",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "422": {
                        "description": "Error Unprocessable Content",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    }
                }
            }
        },
        "/documents/delete-document": {
            "post": {
                "tags": [
                    "deleteDocument"
                ],
                "summary": "Delete Document",
                "description": "",
                "operationId": "api.documents.delete",
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "document_id"
                                ],
                                "properties": {
                                    "document_id": {
                                        "type": "text"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "application/json": {
                            "schema": {}
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Document Deleted",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "422": {
                        "description": "Error Unprocessable Content",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    }
                }
            }
        },
        "/documents/share/{document}": {
            "get": {
                "tags": [
                    "shareDocument"
                ],
                "summary": "Share Document",
                "description": "",
                "operationId": "api.documents.share",
                "parameters": [
                    {
                        "name": "document",
                        "in": "path",
                        "description": "Document ID",
                        "schema": {
                            "type": "text"
                        },
                        "example": "1"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Share Document",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "url": {
                                            "type": "string",
                                            "example": "{BASE_URL}/app/documents/MQ=="
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Error Document Not Found"
                    }
                }
            }
        },
        "/documents/update-stats": {
            "post": {
                "tags": [
                    "documentUpdateStats"
                ],
                "summary": "Save - update document stats",
                "description": "",
                "operationId": "api.documents.update_stats",
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "user_id",
                                    "document_id",
                                    "words",
                                    "characters",
                                    "time_spent"
                                ],
                                "properties": {
                                    "document_id": {
                                        "type": "text"
                                    },
                                    "user_id": {
                                        "type": "text"
                                    },
                                    "words": {
                                        "type": "text"
                                    },
                                    "characters": {
                                        "type": "text"
                                    },
                                    "time_spent": {
                                        "type": "text"
                                    },
                                    "words_per_minute": {
                                        "type": "text"
                                    },
                                    "characters_per_minute": {
                                        "type": "text"
                                    },
                                    "date_created": {
                                        "type": "text"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "application/json": {
                            "schema": {}
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "File Deleted",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "422": {
                        "description": "Error Unprocessable Content",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    }
                }
            }
        },
        "/documents/revision": {
            "post": {
                "tags": [
                    "documentUpdateRevision"
                ],
                "summary": "Save - update document revisions",
                "description": "",
                "operationId": "api.documents.document_revision",
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "document_id",
                                    "document_content"
                                ],
                                "properties": {
                                    "document_id": {
                                        "type": "text"
                                    },
                                    "revision_id": {
                                        "type": "text"
                                    },
                                    "document_content": {
                                        "type": "text"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "application/json": {
                            "schema": {}
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Document Revision Saved",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "422": {
                        "description": "Error Unprocessable Content",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    }
                }
            }
        },
        "/documents/revision/{document}": {
            "get": {
                "tags": [
                    "getRevisions"
                ],
                "summary": "Fetch Document Revisions",
                "description": "",
                "operationId": "api.documents.get_revision_documents",
                "parameters": [
                    {
                        "name": "document",
                        "in": "path",
                        "description": "Document ID",
                        "schema": {
                            "type": "text"
                        },
                        "example": "1"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Document Revisions",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Error Document Not Found"
                    }
                }
            }
        },
        "/users/tasks/{user}": {
            "get": {
                "tags": [
                    "getUserTasks"
                ],
                "summary": "Fetch Tasks For User",
                "description": "",
                "operationId": "api.user.ger_tasks",
                "parameters": [
                    {
                        "name": "user",
                        "in": "path",
                        "description": "User ID",
                        "schema": {
                            "type": "number"
                        },
                        "example": "1"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "User Tasks",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Error User Not Found"
                    }
                }
            }
        },
        "/users/user-profile/{user}": {
            "get": {
                "tags": [
                    "getUserProfile"
                ],
                "summary": "Fetch Profile For User",
                "description": "",
                "operationId": "api.user.get_user_profile",
                "parameters": [
                    {
                        "name": "user",
                        "in": "path",
                        "description": "User ID",
                        "schema": {
                            "type": "number"
                        },
                        "example": "1"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "User Profile",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Error User Not Found"
                    }
                }
            },
            "post": {
                "tags": [
                    "updateUserProfile"
                ],
                "summary": "update Profile For User",
                "description": "",
                "operationId": "api.user.update_user_profile",
                "parameters": [
                    {
                        "name": "user",
                        "in": "path",
                        "description": "User ID",
                        "schema": {
                            "type": "number"
                        },
                        "example": "1"
                    }
                ],
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "about"
                                ],
                                "properties": {
                                    "about": {
                                        "type": "text"
                                    },
                                    "aboutText": {
                                        "type": "text"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "application/json": {
                            "schema": {}
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "User Profile",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Error User Not Found"
                    }
                }
            }
        },
        "/users/user-notifications/{user}": {
            "get": {
                "tags": [
                    "getUserNotifications"
                ],
                "summary": "Fetch Notifcations For User",
                "description": "",
                "operationId": "api.user.get_user_notifications",
                "parameters": [
                    {
                        "name": "user",
                        "in": "path",
                        "description": "User ID",
                        "schema": {
                            "type": "number"
                        },
                        "example": "1"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "User Notifications",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Error User Not Found"
                    }
                }
            }
        },
        "/documents/{document}": {
            "get": {
                "tags": [
                    "getDocumentDetails"
                ],
                "summary": "Fetch Document Details",
                "description": "",
                "operationId": "api.documents.index",
                "parameters": [
                    {
                        "name": "document",
                        "in": "path",
                        "description": "Document ID",
                        "schema": {
                            "type": "number"
                        },
                        "example": "1"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "User Notifications",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Error User Not Found"
                    }
                }
            }
        },
        "/documents/documents-multiple/{documentIds}": {
            "get": {
                "tags": [
                    "getDocumentDetails"
                ],
                "summary": "Fetch Document Details",
                "description": "",
                "operationId": "api.documents.multiple",
                "parameters": [
                    {
                        "name": "documentIds",
                        "in": "path",
                        "description": "Document IDS",
                        "schema": {
                            "type": "text"
                        },
                        "example": "[1,2,3]"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Document Details",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Error User Not Found"
                    }
                }
            }
        },
        "/portfolio/{portfolio}": {
            "get": {
                "tags": [
                    "getPortfolioDetails"
                ],
                "summary": "Fetch Document Details",
                "description": "",
                "operationId": "api.portfolios.index",
                "parameters": [
                    {
                        "name": "portfolio",
                        "in": "path",
                        "description": "portfolio",
                        "schema": {
                            "type": "text"
                        },
                        "example": "1"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Portfolio Details",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Error Portfolio Not Found"
                    }
                }
            }
        },
        "/portfolio/create-portfolio": {
            "post": {
                "tags": [
                    "createPortfolio"
                ],
                "summary": "create portfolio",
                "description": "",
                "operationId": "api.portfolios.store",
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "user_id",
                                    "template_id"
                                ],
                                "properties": {
                                    "user_id": {
                                        "type": "text"
                                    },
                                    "template_id": {
                                        "type": "text"
                                    },
                                    "new_content": {
                                        "type": "text"
                                    },
                                    "preview_content": {
                                        "type": "text"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "application/json": {
                            "schema": {}
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "New Portfilio created",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Error creating portfolio"
                    }
                }
            }
        },
        "/users/update-portfolio/{portfolio}": {
            "post": {
                "tags": [
                    "updatePortfolio"
                ],
                "summary": "update portfolio",
                "description": "",
                "operationId": "api.portfolios.update",
                "parameters": [
                    {
                        "name": "portfolio",
                        "in": "path",
                        "description": "Portdolio ID",
                        "schema": {
                            "type": "number"
                        },
                        "example": "1"
                    }
                ],
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "user_id",
                                    "template_id"
                                ],
                                "properties": {
                                    "user_id": {
                                        "type": "text"
                                    },
                                    "template_id": {
                                        "type": "text"
                                    },
                                    "new_content": {
                                        "type": "text"
                                    },
                                    "preview_content": {
                                        "type": "text"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "application/json": {
                            "schema": {}
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Porfolio Updated",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Error Updating Portfolio"
                    }
                }
            }
        },
        "/documents/create-new-user-document-link/{user}": {
            "get": {
                "tags": [
                    "createDocumentUrl"
                ],
                "summary": "Create Document Url",
                "description": "",
                "operationId": "api.documents.create_document_url",
                "parameters": [
                    {
                        "name": "user",
                        "in": "path",
                        "description": "User ID",
                        "schema": {
                            "type": "text"
                        },
                        "example": "1"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Create Document Url",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "url": {
                                            "type": "string",
                                            "example": ""
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Error Document Not Found"
                    }
                }
            }
        },
        "/users/get-uploaded-images/{user}": {
            "get": {
                "tags": [
                    "getUploadedFiles"
                ],
                "summary": "Get uploaded images",
                "description": "",
                "operationId": "api.users.get_uploaded_images",
                "parameters": [
                    {
                        "name": "user",
                        "in": "path",
                        "description": "User ID",
                        "schema": {
                            "type": "text"
                        },
                        "example": "1"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Create Document Url",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "url": {
                                            "type": "string",
                                            "example": ""
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Error Document Not Found"
                    }
                }
            }
        },
        "/users/update-medium-account": {
            "post": {
                "tags": [
                    "updateMediumAccounts"
                ],
                "summary": "upate medium account",
                "description": "",
                "operationId": "api.users.updateMediumAccounts",
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "userId",
                                    "mediumId",
                                    "userName",
                                    "name",
                                    "url",
                                    "integrationToken",
                                    "userId"
                                ],
                                "properties": {
                                    "mediumId": {
                                        "type": "text"
                                    },
                                    "userId": {
                                        "type": "text"
                                    },
                                    "userName": {
                                        "type": "text"
                                    },
                                    "name": {
                                        "type": "text"
                                    },
                                    "url": {
                                        "type": "text"
                                    },
                                    "imageUrl": {
                                        "type": "text"
                                    },
                                    "integrationToken": {
                                        "type": "text"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "application/json": {
                            "schema": {}
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Medium Data",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Error updating medium details"
                    }
                }
            }
        },
        "/users/delete-medium-data": {
            "post": {
                "tags": [
                    "deleteMediumData"
                ],
                "summary": "Delete medium Data",
                "description": "",
                "operationId": "api.users.deleteMediumData",
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "mediumId",
                                    "userId"
                                ],
                                "properties": {
                                    "mediumId": {
                                        "type": "text"
                                    },
                                    "userId": {
                                        "type": "text"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "application/json": {
                            "schema": {}
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Medium Data Deleted",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Error deleting medium data"
                    }
                }
            }
        },
        "/users/get-medium-details/{userId}": {
            "get": {
                "tags": [
                    "getMediumDetails"
                ],
                "summary": "Get medium details",
                "description": "",
                "operationId": "api.users.getMediumDetails",
                "parameters": [
                    {
                        "name": "userId",
                        "in": "path",
                        "description": "User ID",
                        "schema": {
                            "type": "text"
                        },
                        "example": "1"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Medium Details",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "url": {
                                            "type": "string",
                                            "example": ""
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Error Document Not Found"
                    }
                }
            }
        },
        "/portfolio/refresh-portfolio-jwt": {
            "post": {
                "tags": [
                    "portfoliorefreshjwttoken"
                ],
                "summary": "Refresh jwt portfolio token",
                "description": "",
                "operationId": "api.portfolios.refreshJwtToken",
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "portfolioTemplateId",
                                    "userId",
                                    "portfolioId"
                                ],
                                "properties": {
                                    "portfolioTemplateId": {
                                        "type": "text"
                                    },
                                    "userId": {
                                        "type": "text"
                                    },
                                    "portfolioId": {
                                        "type": "text"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "application/json": {
                            "schema": {}
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "New JWT",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Error dGenerating JWT"
                    }
                }
            }
        }
    }
}