-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Bringup OpenAPI #36666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Bringup OpenAPI #36666
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
cd91b77
psalm: Enable more/less specific errors
provokateurin f929c22
cloud_federation_api: Add OpenAPI spec
provokateurin 736bd9a
user_status: Add OpenAPI spec
provokateurin 397f44c
files_sharing: Add OpenAPI spec
provokateurin 1037714
provisioning_api: Add OpenAPI spec
provokateurin f7baebb
oauth2: Add OpenAPI spec
provokateurin 55d6981
core: Add OpenAPI spec
provokateurin f58602a
theming: Add OpenAPI spec
provokateurin b9f4171
dashboard: Add OpenAPI spec
provokateurin 89816e2
dav: Add OpenAPI spec
provokateurin e778ed9
settings: Add OpenAPI spec
provokateurin 928a759
weather_status: Add OpenAPI spec
provokateurin 671e19a
federatedfilesharing: Add OpenAPI spec
provokateurin 5d4e243
federation: Add OpenAPI spec
provokateurin 873bf29
files: Add OpenAPI spec
provokateurin 4bf80a8
files_external: Add OpenAPI spec
provokateurin 8b9c4ee
files_trashbin: Add OpenAPI spec
provokateurin 3678d7f
files_versions: Add OpenAPI spec
provokateurin 1c1e091
updatenotification: Add OpenAPI spec
provokateurin 8c37393
user_ldap: Add OpenAPI spec
provokateurin 5886daa
sharebymail: Add OpenAPI spec
provokateurin 5e1efeb
comments: Add OpenAPI spec
provokateurin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
provisioning_api: Add OpenAPI spec
Signed-off-by: jld3103 <[email protected]>
- Loading branch information
commit 1037714a71c0092cba3e142f4845cd22d00b4b7a
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| * @copyright Copyright (c) 2021 Vincent Petry <[email protected]> | ||
| * | ||
| * @author Vincent Petry <[email protected]> | ||
| * @author Kate Döen <[email protected]> | ||
| * | ||
| * @license GNU AGPL version 3 or any later version | ||
| * | ||
|
|
@@ -37,6 +38,15 @@ public function __construct(IAppManager $appManager) { | |
|
|
||
| /** | ||
| * Function an app uses to return the capabilities | ||
| * | ||
| * @return array{ | ||
| * provisioning_api: array{ | ||
| * version: string, | ||
| * AccountPropertyScopesVersion: int, | ||
| * AccountPropertyScopesFederatedEnabled: bool, | ||
| * AccountPropertyScopesPublishedEnabled: bool, | ||
| * }, | ||
| * } | ||
| */ | ||
| public function getCapabilities() { | ||
| $federatedScopeEnabled = $this->appManager->isEnabledForUser('federation'); | ||
|
|
||
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
| * | ||
| * @author Joas Schilling <[email protected]> | ||
| * @author Roeland Jago Douma <[email protected]> | ||
| * @author Kate Döen <[email protected]> | ||
| * | ||
| * @license GNU AGPL version 3 or any later version | ||
| * | ||
|
|
@@ -84,7 +85,9 @@ public function __construct(string $appName, | |
| } | ||
|
|
||
| /** | ||
| * @return DataResponse | ||
| * Get a list of apps | ||
| * | ||
| * @return DataResponse<Http::STATUS_OK, array{data: string[]}, array{}> | ||
|
||
| */ | ||
| public function getApps(): DataResponse { | ||
| return new DataResponse([ | ||
|
|
@@ -93,8 +96,13 @@ public function getApps(): DataResponse { | |
| } | ||
|
|
||
| /** | ||
| * @param string $app | ||
| * @return DataResponse | ||
| * Get the config keys of an app | ||
| * | ||
| * @param string $app ID of the app | ||
| * @return DataResponse<Http::STATUS_OK, array{data: string[]}, array{}>|DataResponse<Http::STATUS_FORBIDDEN, array{data: array{message: string}}, array{}> | ||
| * | ||
| * 200: Keys returned | ||
| * 403: App is not allowed | ||
| */ | ||
| public function getKeys(string $app): DataResponse { | ||
| try { | ||
|
|
@@ -108,10 +116,15 @@ public function getKeys(string $app): DataResponse { | |
| } | ||
|
|
||
| /** | ||
| * @param string $app | ||
| * @param string $key | ||
| * @param string $defaultValue | ||
| * @return DataResponse | ||
| * Get a the config value of an app | ||
| * | ||
| * @param string $app ID if the app | ||
| * @param string $key Key | ||
| * @param string $defaultValue Default returned value if the value is empty | ||
| * @return DataResponse<Http::STATUS_OK, array{data: string}, array{}>|DataResponse<Http::STATUS_FORBIDDEN, array{data: array{message: string}}, array{}> | ||
| * | ||
| * 200: Value returned | ||
| * 403: App is not allowed | ||
| */ | ||
| public function getValue(string $app, string $key, string $defaultValue = ''): DataResponse { | ||
| try { | ||
|
|
@@ -128,10 +141,16 @@ public function getValue(string $app, string $key, string $defaultValue = ''): D | |
| * @PasswordConfirmationRequired | ||
| * @NoSubAdminRequired | ||
| * @NoAdminRequired | ||
| * @param string $app | ||
| * @param string $key | ||
| * @param string $value | ||
| * @return DataResponse | ||
| * | ||
| * Update the config value of an app | ||
| * | ||
| * @param string $app ID of the app | ||
| * @param string $key Key to update | ||
| * @param string $value New value for the key | ||
| * @return DataResponse<Http::STATUS_OK, \stdClass, array{}>|DataResponse<Http::STATUS_FORBIDDEN, array{data: array{message: string}}, array{}> | ||
| * | ||
| * 200: Value updated successfully | ||
| * 403: App or key is not allowed | ||
| */ | ||
| public function setValue(string $app, string $key, string $value): DataResponse { | ||
| $user = $this->userSession->getUser(); | ||
|
|
@@ -151,14 +170,20 @@ public function setValue(string $app, string $key, string $value): DataResponse | |
| } | ||
|
|
||
| $this->config->setAppValue($app, $key, $value); | ||
| return new DataResponse(); | ||
| return new DataResponse(new \stdClass()); | ||
| } | ||
|
|
||
| /** | ||
| * @PasswordConfirmationRequired | ||
| * @param string $app | ||
| * @param string $key | ||
| * @return DataResponse | ||
| * | ||
| * Delete a config key of an app | ||
| * | ||
| * @param string $app ID of the app | ||
| * @param string $key Key to delete | ||
| * @return DataResponse<Http::STATUS_OK, \stdClass, array{}>|DataResponse<Http::STATUS_FORBIDDEN, array{data: array{message: string}}, array{}> | ||
| * | ||
| * 200: Key deleted successfully | ||
| * 403: App or key is not allowed | ||
| */ | ||
| public function deleteKey(string $app, string $key): DataResponse { | ||
| try { | ||
|
|
@@ -169,7 +194,7 @@ public function deleteKey(string $app, string $key): DataResponse { | |
| } | ||
|
|
||
| $this->config->deleteAppValue($app, $key); | ||
| return new DataResponse(); | ||
| return new DataResponse(new \stdClass()); | ||
| } | ||
|
|
||
| /** | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ | |
| * @author Lukas Reschke <[email protected]> | ||
| * @author Roeland Jago Douma <[email protected]> | ||
| * @author Tom Needham <[email protected]> | ||
| * @author Kate Döen <[email protected]> | ||
| * | ||
| * @license AGPL-3.0 | ||
| * | ||
|
|
@@ -29,13 +30,18 @@ | |
| namespace OCA\Provisioning_API\Controller; | ||
|
|
||
| use OC_App; | ||
| use OCA\Provisioning_API\ResponseDefinitions; | ||
| use OCP\App\AppPathNotFoundException; | ||
| use OCP\App\IAppManager; | ||
| use OCP\AppFramework\Http; | ||
| use OCP\AppFramework\Http\DataResponse; | ||
| use OCP\AppFramework\OCS\OCSException; | ||
| use OCP\AppFramework\OCSController; | ||
| use OCP\IRequest; | ||
|
|
||
| /** | ||
| * @psalm-import-type ProvisioningApiAppInfo from ResponseDefinitions | ||
| */ | ||
| class AppsController extends OCSController { | ||
| /** @var IAppManager */ | ||
| private $appManager; | ||
|
|
@@ -51,8 +57,10 @@ public function __construct( | |
| } | ||
|
|
||
| /** | ||
| * @param string|null $filter | ||
| * @return DataResponse | ||
| * Get a list of installed apps | ||
| * | ||
| * @param string|null $filter Filter for enabled or disabled apps | ||
| * @return DataResponse<Http::STATUS_OK, array{apps: string[]}, array{}> | ||
|
||
| * @throws OCSException | ||
| */ | ||
| public function getApps(string $filter = null): DataResponse { | ||
|
|
@@ -61,6 +69,7 @@ public function getApps(string $filter = null): DataResponse { | |
| foreach ($apps as $app) { | ||
| $list[] = $app['id']; | ||
| } | ||
| /** @var string[] $list */ | ||
| if ($filter) { | ||
| switch ($filter) { | ||
| case 'enabled': | ||
|
|
@@ -80,8 +89,10 @@ public function getApps(string $filter = null): DataResponse { | |
| } | ||
|
|
||
| /** | ||
| * @param string $app | ||
| * @return DataResponse | ||
| * Get the app info for an app | ||
| * | ||
| * @param string $app ID of the app | ||
| * @return DataResponse<Http::STATUS_OK, ProvisioningApiAppInfo, array{}> | ||
| * @throws OCSException | ||
| */ | ||
| public function getAppInfo(string $app): DataResponse { | ||
|
|
@@ -95,8 +106,11 @@ public function getAppInfo(string $app): DataResponse { | |
|
|
||
| /** | ||
| * @PasswordConfirmationRequired | ||
| * @param string $app | ||
| * @return DataResponse | ||
| * | ||
| * Enable an app | ||
| * | ||
| * @param string $app ID of the app | ||
| * @return DataResponse<Http::STATUS_OK, \stdClass, array{}> | ||
| * @throws OCSException | ||
| */ | ||
| public function enable(string $app): DataResponse { | ||
|
|
@@ -105,16 +119,19 @@ public function enable(string $app): DataResponse { | |
| } catch (AppPathNotFoundException $e) { | ||
| throw new OCSException('The request app was not found', OCSController::RESPOND_NOT_FOUND); | ||
| } | ||
| return new DataResponse(); | ||
| return new DataResponse(new \stdClass()); | ||
| } | ||
|
|
||
| /** | ||
| * @PasswordConfirmationRequired | ||
| * @param string $app | ||
| * @return DataResponse | ||
| * | ||
| * Disable an app | ||
| * | ||
| * @param string $app ID of the app | ||
| * @return DataResponse<Http::STATUS_OK, \stdClass, array{}> | ||
| */ | ||
| public function disable(string $app): DataResponse { | ||
| $this->appManager->disableApp($app); | ||
| return new DataResponse(); | ||
| return new DataResponse(new \stdClass()); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.