summaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api
diff options
context:
space:
mode:
authorjld3103 <jld3103yt@gmail.com>2023-09-19 14:12:17 +0200
committerjld3103 <jld3103yt@gmail.com>2023-09-27 08:05:21 +0200
commitc2d45cb1728e2191e51424734e74cb2a56b323b0 (patch)
tree0c46d10f4e5ef18bf0771069dd2a896da788b4ba /apps/provisioning_api
parent912b18b1fc9fd90bfc78f942cd2043a5a0145e69 (diff)
downloadnextcloud-server-c2d45cb1728e2191e51424734e74cb2a56b323b0.tar.gz
nextcloud-server-c2d45cb1728e2191e51424734e74cb2a56b323b0.zip
Add single status code descriptions for OpenAPI
Signed-off-by: jld3103 <jld3103yt@gmail.com>
Diffstat (limited to 'apps/provisioning_api')
-rw-r--r--apps/provisioning_api/lib/Controller/AppConfigController.php2
-rw-r--r--apps/provisioning_api/lib/Controller/AppsController.php8
-rw-r--r--apps/provisioning_api/lib/Controller/GroupsController.php16
-rw-r--r--apps/provisioning_api/lib/Controller/UsersController.php38
-rw-r--r--apps/provisioning_api/openapi.json64
5 files changed, 96 insertions, 32 deletions
diff --git a/apps/provisioning_api/lib/Controller/AppConfigController.php b/apps/provisioning_api/lib/Controller/AppConfigController.php
index b6e2bec0ccd..4cdd350042e 100644
--- a/apps/provisioning_api/lib/Controller/AppConfigController.php
+++ b/apps/provisioning_api/lib/Controller/AppConfigController.php
@@ -88,6 +88,8 @@ class AppConfigController extends OCSController {
* Get a list of apps
*
* @return DataResponse<Http::STATUS_OK, array{data: string[]}, array{}>
+ *
+ * 200: Apps returned
*/
public function getApps(): DataResponse {
return new DataResponse([
diff --git a/apps/provisioning_api/lib/Controller/AppsController.php b/apps/provisioning_api/lib/Controller/AppsController.php
index 7f84bdeb9db..893a17d684e 100644
--- a/apps/provisioning_api/lib/Controller/AppsController.php
+++ b/apps/provisioning_api/lib/Controller/AppsController.php
@@ -62,6 +62,8 @@ class AppsController extends OCSController {
* @param ?string $filter Filter for enabled or disabled apps
* @return DataResponse<Http::STATUS_OK, array{apps: string[]}, array{}>
* @throws OCSException
+ *
+ * 200: Installed apps returned
*/
public function getApps(?string $filter = null): DataResponse {
$apps = (new OC_App())->listAllApps();
@@ -94,6 +96,8 @@ class AppsController extends OCSController {
* @param string $app ID of the app
* @return DataResponse<Http::STATUS_OK, ProvisioningApiAppInfo, array{}>
* @throws OCSException
+ *
+ * 200: App info returned
*/
public function getAppInfo(string $app): DataResponse {
$info = $this->appManager->getAppInfo($app);
@@ -112,6 +116,8 @@ class AppsController extends OCSController {
* @param string $app ID of the app
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
* @throws OCSException
+ *
+ * 200: App enabled successfully
*/
public function enable(string $app): DataResponse {
try {
@@ -129,6 +135,8 @@ class AppsController extends OCSController {
*
* @param string $app ID of the app
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+ *
+ * 200: App disabled successfully
*/
public function disable(string $app): DataResponse {
$this->appManager->disableApp($app);
diff --git a/apps/provisioning_api/lib/Controller/GroupsController.php b/apps/provisioning_api/lib/Controller/GroupsController.php
index 5404f47efc2..7b0e36ecec5 100644
--- a/apps/provisioning_api/lib/Controller/GroupsController.php
+++ b/apps/provisioning_api/lib/Controller/GroupsController.php
@@ -91,6 +91,8 @@ class GroupsController extends AUserData {
* @param ?int $limit Limit the amount of groups returned
* @param int $offset Offset for searching for groups
* @return DataResponse<Http::STATUS_OK, array{groups: string[]}, array{}>
+ *
+ * 200: Groups returned
*/
public function getGroups(string $search = '', ?int $limit = null, int $offset = 0): DataResponse {
$groups = $this->groupManager->search($search, $limit, $offset);
@@ -112,6 +114,8 @@ class GroupsController extends AUserData {
* @param ?int $limit Limit the amount of groups returned
* @param int $offset Offset for searching for groups
* @return DataResponse<Http::STATUS_OK, array{groups: ProvisioningApiGroupDetails[]}, array{}>
+ *
+ * 200: Groups details returned
*/
public function getGroupsDetails(string $search = '', int $limit = null, int $offset = 0): DataResponse {
$groups = $this->groupManager->search($search, $limit, $offset);
@@ -140,6 +144,8 @@ class GroupsController extends AUserData {
* @throws OCSException
*
* @deprecated 14 Use getGroupUsers
+ *
+ * 200: Group users returned
*/
public function getGroup(string $groupId): DataResponse {
return $this->getGroupUsers($groupId);
@@ -200,6 +206,8 @@ class GroupsController extends AUserData {
*
* @return DataResponse<Http::STATUS_OK, array{users: array<string, ProvisioningApiUserDetails|array{id: string}>}, array{}>
* @throws OCSException
+ *
+ * 200: Group users details returned
*/
public function getGroupUsersDetails(string $groupId, string $search = '', int $limit = null, int $offset = 0): DataResponse {
$groupId = urldecode($groupId);
@@ -251,6 +259,8 @@ class GroupsController extends AUserData {
* @param string $displayname Display name of the group
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
* @throws OCSException
+ *
+ * 200: Group created successfully
*/
public function addGroup(string $groupid, string $displayname = ''): DataResponse {
// Validate name
@@ -282,6 +292,8 @@ class GroupsController extends AUserData {
* @param string $value New value for the key
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
* @throws OCSException
+ *
+ * 200: Group updated successfully
*/
public function updateGroup(string $groupId, string $key, string $value): DataResponse {
$groupId = urldecode($groupId);
@@ -309,6 +321,8 @@ class GroupsController extends AUserData {
* @param string $groupId ID of the group
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
* @throws OCSException
+ *
+ * 200: Group deleted successfully
*/
public function deleteGroup(string $groupId): DataResponse {
$groupId = urldecode($groupId);
@@ -330,6 +344,8 @@ class GroupsController extends AUserData {
* @param string $groupId ID of the group
* @return DataResponse<Http::STATUS_OK, string[], array{}>
* @throws OCSException
+ *
+ * 200: Sub admins returned
*/
public function getSubAdminsOfGroup(string $groupId): DataResponse {
// Check group exists
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php
index c3e9d502675..b7e9b5d0de0 100644
--- a/apps/provisioning_api/lib/Controller/UsersController.php
+++ b/apps/provisioning_api/lib/Controller/UsersController.php
@@ -144,6 +144,8 @@ class UsersController extends AUserData {
* @param int|null $limit Limit the amount of groups returned
* @param int $offset Offset for searching for groups
* @return DataResponse<Http::STATUS_OK, array{users: string[]}, array{}>
+ *
+ * 200: Users returned
*/
public function getUsers(string $search = '', int $limit = null, int $offset = 0): DataResponse {
$user = $this->userSession->getUser();
@@ -183,6 +185,8 @@ class UsersController extends AUserData {
* @param int|null $limit Limit the amount of groups returned
* @param int $offset Offset for searching for groups
* @return DataResponse<Http::STATUS_OK, array{users: array<string, ProvisioningApiUserDetails|array{id: string}>}, array{}>
+ *
+ * 200: Users details returned
*/
public function getUsersDetails(string $search = '', int $limit = null, int $offset = 0): DataResponse {
$currentUser = $this->userSession->getUser();
@@ -537,6 +541,8 @@ class UsersController extends AUserData {
* @param string $userId ID of the user
* @return DataResponse<Http::STATUS_OK, ProvisioningApiUserDetails, array{}>
* @throws OCSException
+ *
+ * 200: User returned
*/
public function getUser(string $userId): DataResponse {
$includeScopes = false;
@@ -561,6 +567,8 @@ class UsersController extends AUserData {
*
* @return DataResponse<Http::STATUS_OK, ProvisioningApiUserDetails, array{}>
* @throws OCSException
+ *
+ * 200: Current user returned
*/
public function getCurrentUser(): DataResponse {
$user = $this->userSession->getUser();
@@ -581,6 +589,8 @@ class UsersController extends AUserData {
*
* @return DataResponse<Http::STATUS_OK, string[], array{}>
* @throws OCSException
+ *
+ * 200: Editable fields returned
*/
public function getEditableFields(): DataResponse {
$currentLoggedInUser = $this->userSession->getUser();
@@ -600,6 +610,8 @@ class UsersController extends AUserData {
* @param string $userId ID of the user
* @return DataResponse<Http::STATUS_OK, string[], array{}>
* @throws OCSException
+ *
+ * 200: Editable fields for user returned
*/
public function getEditableFieldsForUser(string $userId): DataResponse {
$currentLoggedInUser = $this->userSession->getUser();
@@ -666,6 +678,8 @@ class UsersController extends AUserData {
* @param string $value New value for the key
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
* @throws OCSException
+ *
+ * 200: User values edited successfully
*/
public function editUserMultiValue(
string $userId,
@@ -765,6 +779,8 @@ class UsersController extends AUserData {
* @param string $value New value for the key
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
* @throws OCSException
+ *
+ * 200: User value edited successfully
*/
public function editUser(string $userId, string $key, string $value): DataResponse {
$currentLoggedInUser = $this->userSession->getUser();
@@ -1076,6 +1092,8 @@ class UsersController extends AUserData {
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
*
* @throws OCSException
+ *
+ * 200: Wiped all user devices successfully
*/
public function wipeUserDevices(string $userId): DataResponse {
/** @var IUser $currentLoggedInUser */
@@ -1111,6 +1129,8 @@ class UsersController extends AUserData {
* @param string $userId ID of the user
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
* @throws OCSException
+ *
+ * 200: User deleted successfully
*/
public function deleteUser(string $userId): DataResponse {
$currentLoggedInUser = $this->userSession->getUser();
@@ -1148,6 +1168,8 @@ class UsersController extends AUserData {
* @param string $userId ID of the user
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
* @throws OCSException
+ *
+ * 200: User disabled successfully
*/
public function disableUser(string $userId): DataResponse {
return $this->setEnabled($userId, false);
@@ -1162,6 +1184,8 @@ class UsersController extends AUserData {
* @param string $userId ID of the user
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
* @throws OCSException
+ *
+ * 200: User enabled successfully
*/
public function enableUser(string $userId): DataResponse {
return $this->setEnabled($userId, true);
@@ -1201,6 +1225,8 @@ class UsersController extends AUserData {
* @param string $userId ID of the user
* @return DataResponse<Http::STATUS_OK, array{groups: string[]}, array{}>
* @throws OCSException
+ *
+ * 200: Users groups returned
*/
public function getUsersGroups(string $userId): DataResponse {
$loggedInUser = $this->userSession->getUser();
@@ -1249,6 +1275,8 @@ class UsersController extends AUserData {
* @param string $groupid ID of the group
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
* @throws OCSException
+ *
+ * 200: User added to group successfully
*/
public function addToGroup(string $userId, string $groupid = ''): DataResponse {
if ($groupid === '') {
@@ -1286,6 +1314,8 @@ class UsersController extends AUserData {
* @param string $groupid ID of the group
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
* @throws OCSException
+ *
+ * 200: User removed from group successfully
*/
public function removeFromGroup(string $userId, string $groupid): DataResponse {
$loggedInUser = $this->userSession->getUser();
@@ -1349,6 +1379,8 @@ class UsersController extends AUserData {
* @param string $groupid ID of the group
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
* @throws OCSException
+ *
+ * 200: User added as group subadmin successfully
*/
public function addSubAdmin(string $userId, string $groupid): DataResponse {
$group = $this->groupManager->get($groupid);
@@ -1387,6 +1419,8 @@ class UsersController extends AUserData {
* @param string $groupid ID of the group
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
* @throws OCSException
+ *
+ * 200: User removed as group subadmin successfully
*/
public function removeSubAdmin(string $userId, string $groupid): DataResponse {
$group = $this->groupManager->get($groupid);
@@ -1417,6 +1451,8 @@ class UsersController extends AUserData {
* @param string $userId ID if the user
* @return DataResponse<Http::STATUS_OK, string[], array{}>
* @throws OCSException
+ *
+ * 200: User subadmin groups returned
*/
public function getUserSubAdminGroups(string $userId): DataResponse {
$groups = $this->getUserSubAdminGroupsData($userId);
@@ -1432,6 +1468,8 @@ class UsersController extends AUserData {
* @param string $userId ID if the user
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
* @throws OCSException
+ *
+ * 200: Resent welcome message successfully
*/
public function resendWelcomeMessage(string $userId): DataResponse {
$currentLoggedInUser = $this->userSession->getUser();
diff --git a/apps/provisioning_api/openapi.json b/apps/provisioning_api/openapi.json
index 58badb57461..0599768d67f 100644
--- a/apps/provisioning_api/openapi.json
+++ b/apps/provisioning_api/openapi.json
@@ -580,7 +580,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Installed apps returned",
"content": {
"application/json": {
"schema": {
@@ -661,7 +661,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "App info returned",
"content": {
"application/json": {
"schema": {
@@ -729,7 +729,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "App enabled successfully",
"content": {
"application/json": {
"schema": {
@@ -795,7 +795,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "App disabled successfully",
"content": {
"application/json": {
"schema": {
@@ -882,7 +882,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Groups returned",
"content": {
"application/json": {
"schema": {
@@ -970,7 +970,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Group created successfully",
"content": {
"application/json": {
"schema": {
@@ -1057,7 +1057,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Groups details returned",
"content": {
"application/json": {
"schema": {
@@ -1268,7 +1268,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Group users details returned",
"content": {
"application/json": {
"schema": {
@@ -1365,7 +1365,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Sub admins returned",
"content": {
"application/json": {
"schema": {
@@ -1439,7 +1439,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Group users returned",
"content": {
"application/json": {
"schema": {
@@ -1537,7 +1537,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Group updated successfully",
"content": {
"application/json": {
"schema": {
@@ -1604,7 +1604,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Group deleted successfully",
"content": {
"application/json": {
"schema": {
@@ -1691,7 +1691,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Users returned",
"content": {
"application/json": {
"schema": {
@@ -1954,7 +1954,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Users details returned",
"content": {
"application/json": {
"schema": {
@@ -2158,7 +2158,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "User returned",
"content": {
"application/json": {
"schema": {
@@ -2243,7 +2243,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "User value edited successfully",
"content": {
"application/json": {
"schema": {
@@ -2308,7 +2308,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "User deleted successfully",
"content": {
"application/json": {
"schema": {
@@ -2366,7 +2366,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Current user returned",
"content": {
"application/json": {
"schema": {
@@ -2426,7 +2426,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Editable fields returned",
"content": {
"application/json": {
"schema": {
@@ -2498,7 +2498,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Editable fields for user returned",
"content": {
"application/json": {
"schema": {
@@ -2598,7 +2598,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "User values edited successfully",
"content": {
"application/json": {
"schema": {
@@ -2665,7 +2665,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Wiped all user devices successfully",
"content": {
"application/json": {
"schema": {
@@ -2732,7 +2732,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "User enabled successfully",
"content": {
"application/json": {
"schema": {
@@ -2799,7 +2799,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "User disabled successfully",
"content": {
"application/json": {
"schema": {
@@ -2866,7 +2866,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Users groups returned",
"content": {
"application/json": {
"schema": {
@@ -2953,7 +2953,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "User added to group successfully",
"content": {
"application/json": {
"schema": {
@@ -3027,7 +3027,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "User removed from group successfully",
"content": {
"application/json": {
"schema": {
@@ -3095,7 +3095,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "User subadmin groups returned",
"content": {
"application/json": {
"schema": {
@@ -3175,7 +3175,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "User added as group subadmin successfully",
"content": {
"application/json": {
"schema": {
@@ -3250,7 +3250,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "User removed as group subadmin successfully",
"content": {
"application/json": {
"schema": {
@@ -3317,7 +3317,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Resent welcome message successfully",
"content": {
"application/json": {
"schema": {
@@ -3376,7 +3376,7 @@
],
"responses": {
"200": {
- "description": "",
+ "description": "Apps returned",
"content": {
"application/json": {
"schema": {