| { | |
| "openapi": "3.0.0", | |
| "info": { | |
| "title": "WhatsApp Bot Uploader API", | |
| "description": "API for uploading files to be used with WhatsApp Bot", | |
| "version": "1.0.0" | |
| }, | |
| "servers": [ | |
| { | |
| "url": "http://localhost:7860", | |
| "description": "Local development server" | |
| }, | |
| { | |
| "url": "https://your-huggingface-space.herokuapp.com", | |
| "description": "Production server" | |
| } | |
| ], | |
| "paths": { | |
| "/api/upload": { | |
| "post": { | |
| "summary": "Upload a file", | |
| "description": "Upload a file that can be accessed by the WhatsApp bot", | |
| "requestBody": { | |
| "content": { | |
| "multipart/form-data": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "file": { | |
| "type": "string", | |
| "format": "binary" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "required": true | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "File uploaded successfully", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string" | |
| }, | |
| "file": { | |
| "type": "object", | |
| "properties": { | |
| "originalName": { | |
| "type": "string" | |
| }, | |
| "fileName": { | |
| "type": "string" | |
| }, | |
| "size": { | |
| "type": "number" | |
| }, | |
| "url": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "No file was uploaded" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/files/{filename}": { | |
| "get": { | |
| "summary": "Get a file", | |
| "description": "Retrieve an uploaded file by its filename", | |
| "parameters": [ | |
| { | |
| "name": "filename", | |
| "in": "path", | |
| "description": "Name of the file to retrieve", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| } | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "File content", | |
| "content": { | |
| "application/octet-stream": { | |
| "schema": { | |
| "type": "string", | |
| "format": "binary" | |
| } | |
| } | |
| } | |
| }, | |
| "404": { | |
| "description": "File not found" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } |