summaryrefslogtreecommitdiff
path: root/app/ServiceProvider
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-29 20:12:02 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-29 20:12:02 -0400
commitb69eb5f99350a378387ab1f711d4fbe3bb3bddab (patch)
tree226fb242e7f2d42510d4c87022ed3c4be98844f4 /app/ServiceProvider
parent700ffec5ab69de38539d6c0ffd019146ac19737f (diff)
Update JsonRPC library and API
Diffstat (limited to 'app/ServiceProvider')
-rw-r--r--app/ServiceProvider/ApiProvider.php74
1 files changed, 74 insertions, 0 deletions
diff --git a/app/ServiceProvider/ApiProvider.php b/app/ServiceProvider/ApiProvider.php
new file mode 100644
index 00000000..19d945f6
--- /dev/null
+++ b/app/ServiceProvider/ApiProvider.php
@@ -0,0 +1,74 @@
+<?php
+
+namespace Kanboard\ServiceProvider;
+
+use JsonRPC\Server;
+use Kanboard\Api\ActionApi;
+use Kanboard\Api\AppApi;
+use Kanboard\Api\BoardApi;
+use Kanboard\Api\CategoryApi;
+use Kanboard\Api\ColumnApi;
+use Kanboard\Api\CommentApi;
+use Kanboard\Api\FileApi;
+use Kanboard\Api\GroupApi;
+use Kanboard\Api\GroupMemberApi;
+use Kanboard\Api\LinkApi;
+use Kanboard\Api\MeApi;
+use Kanboard\Api\Middleware\AuthenticationApiMiddleware;
+use Kanboard\Api\ProjectApi;
+use Kanboard\Api\ProjectPermissionApi;
+use Kanboard\Api\SubtaskApi;
+use Kanboard\Api\SwimlaneApi;
+use Kanboard\Api\TaskApi;
+use Kanboard\Api\TaskLinkApi;
+use Kanboard\Api\UserApi;
+use Pimple\Container;
+use Pimple\ServiceProviderInterface;
+
+/**
+ * Class ApiProvider
+ *
+ * @package Kanboard\ServiceProvider
+ * @author Frederic Guillot
+ */
+class ApiProvider implements ServiceProviderInterface
+{
+ /**
+ * Registers services on the given container.
+ *
+ * @param Container $container
+ * @return Container
+ */
+ public function register(Container $container)
+ {
+ $server = new Server();
+ $server->setAuthenticationHeader(API_AUTHENTICATION_HEADER);
+ $server->getMiddlewareHandler()
+ ->withMiddleware(new AuthenticationApiMiddleware($container))
+ ;
+
+ $server->getProcedureHandler()
+ ->withObject(new MeApi($container))
+ ->withObject(new ActionApi($container))
+ ->withObject(new AppApi($container))
+ ->withObject(new BoardApi($container))
+ ->withObject(new ColumnApi($container))
+ ->withObject(new CategoryApi($container))
+ ->withObject(new CommentApi($container))
+ ->withObject(new FileApi($container))
+ ->withObject(new LinkApi($container))
+ ->withObject(new ProjectApi($container))
+ ->withObject(new ProjectPermissionApi($container))
+ ->withObject(new SubtaskApi($container))
+ ->withObject(new SwimlaneApi($container))
+ ->withObject(new TaskApi($container))
+ ->withObject(new TaskLinkApi($container))
+ ->withObject(new UserApi($container))
+ ->withObject(new GroupApi($container))
+ ->withObject(new GroupMemberApi($container))
+ ;
+
+ $container['api'] = $server;
+ return $container;
+ }
+}