dev: openapi

Massimo Melina committed Nov 7, 2023 at 12:05 UTC cc6ca91162b1387cf56e5cfd1d4b60cb4e26ebfd
1 file changed +194
openapi.yaml new
+194
@@ -0,0 +1,194 @@
1 +---
2 +openapi: 3.0.0
3 +info:
4 + title: HFS REST API
5 + contact:
6 + name: Massimo Melina
7 + email: a@rejetto.com
8 + version: 1.0.0
9 +servers:
10 +- url: /
11 +paths:
12 + /~/api/get_file_list:
13 + get:
14 + tags:
15 + - Front-end
16 + description: returns all files of a specified folder
17 + parameters:
18 + - name: uri
19 + in: query
20 + description: path to the folder containing the files. Default is `/`
21 + required: false
22 + style: form
23 + explode: true
24 + schema:
25 + type: string
26 + - name: offset
27 + in: query
28 + description: number of records to skip
29 + required: false
30 + style: form
31 + explode: true
32 + schema:
33 + type: number
34 + - name: limit
35 + in: query
36 + description: max number of records to return
37 + required: false
38 + style: form
39 + explode: true
40 + schema:
41 + type: number
42 + - name: search
43 + in: query
44 + description: "search for files with the specified pattern, also in subfolders."
45 + required: false
46 + style: form
47 + explode: true
48 + schema:
49 + type: string
50 + - name: c
51 + in: query
52 + description: "request separated `c` and `m` properties in entries. Pass any string to turn it on. By default only `m` is provided, and when missing it is copied from `c`."
53 + required: false
54 + style: form
55 + explode: true
56 + schema:
57 + type: string
58 + responses:
59 + "200":
60 + description: all files accordingly to the specified parameters
61 + content:
62 + application/json:
63 + schema:
64 + $ref: '#/components/schemas/inline_response_200'
65 + /{folder}:
66 + post:
67 + tags:
68 + - Front-end
69 + summary: Uploads a file to a specific folder
70 + description: Equivalent to curl -F upload=@FILE FOLDER/
71 + parameters:
72 + - name: folder
73 + in: path
74 + description: The folder path where the file will be uploaded
75 + required: true
76 + style: simple
77 + explode: false
78 + schema:
79 + type: string
80 + requestBody:
81 + content:
82 + multipart/form-data:
83 + schema:
84 + $ref: '#/components/schemas/folder_body'
85 + encoding:
86 + file:
87 + contentType: application/octet-stream
88 + headers:
89 + Content-Disposition:
90 + style: simple
91 + explode: false
92 + schema:
93 + type: string
94 + description: "Form field name and filename, e.g., 'form-data; name=\"file\"; filename=\"example.txt\"'"
95 + style: form
96 + required: true
97 + responses:
98 + "200":
99 + description: File uploaded successfully
100 + "400":
101 + description: Bad request
102 + /{folder}/{file}:
103 + put:
104 + tags:
105 + - Front-end
106 + summary: Uploads a file to a specific folder
107 + description: Equivalent to curl -T FILE URL/
108 + parameters:
109 + - name: folder
110 + in: path
111 + description: The folder path where the file will be uploaded
112 + required: true
113 + style: simple
114 + explode: false
115 + schema:
116 + type: string
117 + - name: file
118 + in: path
119 + description: The uploaded file name
120 + required: true
121 + style: simple
122 + explode: false
123 + schema:
124 + type: string
125 + requestBody:
126 + content:
127 + application/octet-stream: {}
128 + required: true
129 + responses:
130 + "200":
131 + description: File uploaded successfully
132 +components:
133 + schemas:
134 + DirEntry:
135 + required:
136 + - "n"
137 + type: object
138 + properties:
139 + "n":
140 + type: string
141 + description: name of the entry. Can be a relative path in case you used `search`.
142 + c:
143 + type: string
144 + description: creation time
145 + format: date-time
146 + m:
147 + type: string
148 + description: modification time
149 + format: date-time
150 + s:
151 + type: number
152 + description: "size, in bytes"
153 + p:
154 + pattern: "[rR]?[lL]?d?"
155 + type: string
156 + description: |
157 + permissions, only when are different from the parent folder.
158 + Meaning of each character:
159 + - r: cannot be downloaded
160 + - R: can be downloaded only with other credentials
161 + - l: folder cannot be listed
162 + - L: folder can be listed only with other credetnials
163 + - d: can be deleted
164 + comment:
165 + type: string
166 + description: assigned comment
167 + description: front-end list item format. Common properties are kept short to optimize space.
168 + inline_response_200:
169 + type: object
170 + properties:
171 + can_archive:
172 + type: boolean
173 + description: if you can download this folder as zip
174 + can_upload:
175 + type: boolean
176 + description: if you can upload in this folder
177 + can_delete:
178 + type: boolean
179 + description: if you can delete items in this folder
180 + can_comment:
181 + type: boolean
182 + description: if you can coment items in this folder
183 + list:
184 + type: array
185 + description: entries from this folder
186 + items:
187 + $ref: '#/components/schemas/DirEntry'
188 + folder_body:
189 + type: object
190 + properties:
191 + file:
192 + type: string
193 + description: The file to upload.
194 + format: binary