Skip to content

Commit 99dc010

Browse files
committed
files_trashbin: Add OpenAPI spec
Signed-off-by: jld3103 <jld3103yt@gmail.com>
1 parent 706c141 commit 99dc010

File tree

3 files changed

+148
-1
lines changed

3 files changed

+148
-1
lines changed

apps/files_trashbin/lib/Capabilities.php

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ class Capabilities implements ICapability {
3333

3434
/**
3535
* Return this classes capabilities
36+
*
37+
* @return array{files: array{undelete: bool}}
3638
*/
3739
public function getCapabilities() {
3840
return [

apps/files_trashbin/lib/Controller/PreviewController.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,18 @@ public function __construct(
8585
* @NoAdminRequired
8686
* @NoCSRFRequired
8787
*
88-
* @return DataResponse|Http\FileDisplayResponse
88+
* Get the preview for a file
89+
*
90+
* @param int $fileId ID of the file
91+
* @param int $x Width of the preview
92+
* @param int $y Height of the preview
93+
* @param bool $a Whether to not crop the preview
94+
*
95+
* @return Http\FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND, array<empty>, array{}>
96+
*
97+
* 200: Preview returned
98+
* 400: Getting preview is not possible
99+
* 404: Preview not found
89100
*/
90101
public function getPreview(
91102
int $fileId = -1,

apps/files_trashbin/openapi.json

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
{
2+
"openapi": "3.0.3",
3+
"info": {
4+
"title": "files_trashbin",
5+
"version": "0.0.1",
6+
"description": "This application enables users to restore files that were deleted from the system.",
7+
"license": {
8+
"name": "agpl"
9+
}
10+
},
11+
"components": {
12+
"securitySchemes": {
13+
"basic_auth": {
14+
"type": "http",
15+
"scheme": "basic"
16+
},
17+
"bearer_auth": {
18+
"type": "http",
19+
"scheme": "bearer"
20+
}
21+
},
22+
"schemas": {
23+
"Capabilities": {
24+
"type": "object",
25+
"required": [
26+
"files"
27+
],
28+
"properties": {
29+
"files": {
30+
"type": "object",
31+
"required": [
32+
"undelete"
33+
],
34+
"properties": {
35+
"undelete": {
36+
"type": "boolean"
37+
}
38+
}
39+
}
40+
}
41+
}
42+
}
43+
},
44+
"paths": {
45+
"/index.php/apps/files_trashbin/preview": {
46+
"get": {
47+
"operationId": "preview-get-preview",
48+
"summary": "Get the preview for a file",
49+
"tags": [
50+
"preview"
51+
],
52+
"security": [
53+
{
54+
"bearer_auth": []
55+
},
56+
{
57+
"basic_auth": []
58+
}
59+
],
60+
"parameters": [
61+
{
62+
"name": "fileId",
63+
"in": "query",
64+
"description": "ID of the file",
65+
"schema": {
66+
"type": "integer",
67+
"format": "int64",
68+
"default": -1
69+
}
70+
},
71+
{
72+
"name": "x",
73+
"in": "query",
74+
"description": "Width of the preview",
75+
"schema": {
76+
"type": "integer",
77+
"format": "int64",
78+
"default": 32
79+
}
80+
},
81+
{
82+
"name": "y",
83+
"in": "query",
84+
"description": "Height of the preview",
85+
"schema": {
86+
"type": "integer",
87+
"format": "int64",
88+
"default": 32
89+
}
90+
},
91+
{
92+
"name": "a",
93+
"in": "query",
94+
"description": "Whether to not crop the preview",
95+
"schema": {
96+
"type": "integer",
97+
"default": 0
98+
}
99+
}
100+
],
101+
"responses": {
102+
"200": {
103+
"description": "Preview returned",
104+
"content": {
105+
"*/*": {
106+
"schema": {
107+
"type": "string",
108+
"format": "binary"
109+
}
110+
}
111+
}
112+
},
113+
"400": {
114+
"description": "Getting preview is not possible",
115+
"content": {
116+
"application/json": {
117+
"schema": {}
118+
}
119+
}
120+
},
121+
"404": {
122+
"description": "Preview not found",
123+
"content": {
124+
"application/json": {
125+
"schema": {}
126+
}
127+
}
128+
}
129+
}
130+
}
131+
}
132+
},
133+
"tags": []
134+
}

0 commit comments

Comments
 (0)