18
18
use OCA \Tables \ResponseDefinitions ;
19
19
use OCA \Tables \Service \RowService ;
20
20
use OCP \AppFramework \Http ;
21
+ use OCP \AppFramework \Http \Attribute \ApiRoute ;
21
22
use OCP \AppFramework \Http \Attribute \NoAdminRequired ;
22
23
use OCP \AppFramework \Http \DataResponse ;
23
24
use OCP \IL10N ;
@@ -42,10 +43,14 @@ public function __construct(
42
43
/**
43
44
* [api v2] Create a new row in a table or a view
44
45
*
45
- * @param 'tables'|'views' $nodeCollection Indicates whether to create a row on a table or view
46
+ * @param 'tables'|'views' $nodeCollection Indicates whether to create a
47
+ * row on a table or view
46
48
* @param int $nodeId The identifier of the targeted table or view
47
- * @param string|array<string, mixed> $data An array containing the column identifiers and their values
48
- * @return DataResponse<Http::STATUS_OK, TablesRow, array{}>|DataResponse<Http::STATUS_FORBIDDEN|Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}>
49
+ * @param string|array<string, mixed> $data An array containing the column
50
+ * identifiers and their values
51
+ * @return DataResponse<Http::STATUS_OK, TablesRow,
52
+ * array{}>|DataResponse<Http::STATUS_FORBIDDEN|Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR,
53
+ * array{message: string}, array{}>
49
54
*
50
55
* 200: Row returned
51
56
* 400: Invalid request parameters
@@ -55,6 +60,7 @@ public function __construct(
55
60
*/
56
61
#[NoAdminRequired]
57
62
#[RequirePermission(permission: Application::PERMISSION_CREATE , typeParam: 'nodeCollection ' )]
63
+ #[ApiRoute(verb: 'POST ' , url: '/api/2/{nodeCollection}/{nodeId}/rows ' , requirements: ['nodeCollection ' => '(tables|views) ' , 'nodeId ' => '(\d+) ' ])]
58
64
public function createRow (string $ nodeCollection , int $ nodeId , mixed $ data ): DataResponse {
59
65
if (is_string ($ data )) {
60
66
$ data = json_decode ($ data , true );
@@ -86,4 +92,11 @@ public function createRow(string $nodeCollection, int $nodeId, mixed $data): Dat
86
92
return $ this ->handleError ($ e );
87
93
}
88
94
}
95
+
96
+ #[NoAdminRequired]
97
+ #[RequirePermission(permission: Application::PERMISSION_READ , typeParam: 'nodeCollection ' )]
98
+ #[ApiRoute(verb: 'GET ' , url: '/api/2/{nodeCollection}/{nodeId}/rows ' , requirements: ['nodeCollection ' => '(tables|views) ' , 'nodeId ' => '(\d+) ' ])]
99
+ public function getRows (int $ nodeId , ?int $ limit , ?int $ offset , ?array $ filter , ?array $ sort ): DataResponse {
100
+ return new DataResponse ([]);
101
+ }
89
102
}
0 commit comments