File size: 3,027 Bytes
675e98c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
{
  "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"
          }
        }
      }
    }
  }
}