Skip to content
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

doc(ocs): Improved doc to expose Capabilities #12084

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions developer_manual/client_apis/OCS/ocs-openapi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,7 @@ How to expose Capabilities
--------------------------

Imagine we take the same Todo app of the previous example and want to expose some capabilities to let clients know what they can expect.
First, you should create your `Capabilities` in the `lib/AppInfo` folder :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why there? In most cases I saw it in the lib root


.. code-block:: php

Expand Down Expand Up @@ -733,6 +734,33 @@ Now you have to add the correct return type annotation:

The capabilities will automatically appear in the generated specification.

You must register your `Capabilities` in the `lib/AppInfo/Application.php` file and you need to implement `IBootstrap` :

.. code-block:: php
:emphasize-lines: 3

namespace OCA\Todo\AppInfo;

use OCP\AppFramework\Bootstrap\IBootstrap;

class Application extends App implements IBootstrap {
public const APP_ID = 'todo';

public function __construct(array $urlParams = []) {
parent::__construct(self::APP_ID, $urlParams);
}

public function register(IRegistrationContext $context): void {
// code

$context->registerCapability(Capabilities::class);
}

public function boot(IBootContext $context): void {
}
}


Scopes
------

Expand Down
Loading