-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
647 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,27 @@ | ||
<?php | ||
declare(strict_types=1); | ||
// SPDX-FileCopyrightText: Sebastian Krupinski <[email protected]> | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
/** | ||
* Create your routes in here. The name is the lowercase name of the controller | ||
* without the controller part, the stuff after the hash is the method. | ||
* e.g. page#index -> OCA\Data\Controller\PageController->index() | ||
* | ||
* The controller class has to be registered in the application.php file since | ||
* it's instantiated in there | ||
*/ | ||
* @copyright Copyright (c) 2023 Sebastian Krupinski <[email protected]> | ||
* | ||
* @author Sebastian Krupinski <[email protected]> | ||
* | ||
* @license AGPL-3.0-or-later | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
return [ | ||
'routes' => [ | ||
[ | ||
|
@@ -38,6 +49,11 @@ | |
'url' => '/phone/{id}/', | ||
'verb' => 'GET' | ||
], | ||
[ | ||
'name' => 'UserConfiguration#listTypes', | ||
'url' => '/list-types', | ||
'verb' => 'GET' | ||
], | ||
[ | ||
'name' => 'UserConfiguration#listCollections', | ||
'url' => '/list-collections', | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,27 @@ | ||
<?php | ||
declare(strict_types=1); | ||
// SPDX-FileCopyrightText: Sebastian Krupinski <[email protected]> | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
/** | ||
* @copyright Copyright (c) 2023 Sebastian Krupinski <[email protected]> | ||
* | ||
* @author Sebastian Krupinski <[email protected]> | ||
* | ||
* @license AGPL-3.0-or-later | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
namespace OCA\Data\Controller; | ||
|
||
|
@@ -24,6 +44,29 @@ public function __construct(IRequest $request, | |
$this->DataService = $DataService; | ||
$this->userId = $userId; | ||
} | ||
/** | ||
* handels types list requests | ||
* | ||
* @NoAdminRequired | ||
* | ||
* @return DataResponse | ||
*/ | ||
public function listTypes(): DataResponse { | ||
|
||
// evaluate if user id is present | ||
if ($this->userId === null) { | ||
return new DataResponse([], Http::STATUS_BAD_REQUEST); | ||
} | ||
// retrieve formats | ||
$rs = $this->DataService->listTypes($this->userId); | ||
// return response | ||
if (isset($rs)) { | ||
return new DataResponse($rs); | ||
} else { | ||
return new DataResponse($rs['error'], 401); | ||
} | ||
|
||
} | ||
/** | ||
* handels collections list requests | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.