Rename Api classes

This commit is contained in:
Frederic Guillot
2016-05-16 21:07:29 -04:00
parent 4514bc1d4b
commit b1e2ca00ce
21 changed files with 104 additions and 79 deletions

View File

@@ -2,13 +2,15 @@
namespace Kanboard\Api; namespace Kanboard\Api;
use Kanboard\Core\Base;
/** /**
* Action API controller * Action API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class Action extends \Kanboard\Core\Base class ActionApi extends Base
{ {
public function getAvailableActions() public function getAvailableActions()
{ {

View File

@@ -2,13 +2,15 @@
namespace Kanboard\Api; namespace Kanboard\Api;
use Kanboard\Core\Base;
/** /**
* App API controller * App API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class App extends \Kanboard\Core\Base class AppApi extends Base
{ {
public function getTimezone() public function getTimezone()
{ {

View File

@@ -7,10 +7,10 @@ use JsonRPC\Exception\AuthenticationFailureException;
/** /**
* Base class * Base class
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class Auth extends Base class AuthApi extends BaseApi
{ {
/** /**
* Check api credentials * Check api credentials
@@ -20,6 +20,7 @@ class Auth extends Base
* @param string $password * @param string $password
* @param string $class * @param string $class
* @param string $method * @param string $method
* @throws AuthenticationFailureException
*/ */
public function checkCredentials($username, $password, $class, $method) public function checkCredentials($username, $password, $class, $method)
{ {

View File

@@ -3,14 +3,15 @@
namespace Kanboard\Api; namespace Kanboard\Api;
use JsonRPC\Exception\AccessDeniedException; use JsonRPC\Exception\AccessDeniedException;
use Kanboard\Core\Base;
/** /**
* Base class * Base class
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
abstract class Base extends \Kanboard\Core\Base abstract class BaseApi extends Base
{ {
private $user_allowed_procedures = array( private $user_allowed_procedures = array(
'getMe', 'getMe',

View File

@@ -5,10 +5,10 @@ namespace Kanboard\Api;
/** /**
* Board API controller * Board API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class Board extends Base class BoardApi extends BaseApi
{ {
public function getBoard($project_id) public function getBoard($project_id)
{ {

View File

@@ -2,13 +2,15 @@
namespace Kanboard\Api; namespace Kanboard\Api;
use Kanboard\Core\Base;
/** /**
* Category API controller * Category API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class Category extends \Kanboard\Core\Base class CategoryApi extends Base
{ {
public function getCategory($category_id) public function getCategory($category_id)
{ {

View File

@@ -5,10 +5,10 @@ namespace Kanboard\Api;
/** /**
* Column API controller * Column API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class Column extends Base class ColumnApi extends BaseApi
{ {
public function getColumns($project_id) public function getColumns($project_id)
{ {

View File

@@ -2,13 +2,15 @@
namespace Kanboard\Api; namespace Kanboard\Api;
use Kanboard\Core\Base;
/** /**
* Comment API controller * Comment API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class Comment extends \Kanboard\Core\Base class CommentApi extends Base
{ {
public function getComment($comment_id) public function getComment($comment_id)
{ {

View File

@@ -7,10 +7,10 @@ use Kanboard\Core\ObjectStorage\ObjectStorageException;
/** /**
* File API controller * File API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class File extends Base class FileApi extends BaseApi
{ {
public function getTaskFile($file_id) public function getTaskFile($file_id)
{ {
@@ -32,8 +32,9 @@ class File extends Base
} }
} catch (ObjectStorageException $e) { } catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage()); $this->logger->error($e->getMessage());
return '';
} }
return '';
} }
public function createTaskFile($project_id, $task_id, $filename, $blob) public function createTaskFile($project_id, $task_id, $filename, $blob)

View File

@@ -2,13 +2,15 @@
namespace Kanboard\Api; namespace Kanboard\Api;
use Kanboard\Core\Base;
/** /**
* Group API controller * Group API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class Group extends \Kanboard\Core\Base class GroupApi extends Base
{ {
public function createGroup($name, $external_id = '') public function createGroup($name, $external_id = '')
{ {

View File

@@ -2,13 +2,15 @@
namespace Kanboard\Api; namespace Kanboard\Api;
use Kanboard\Core\Base;
/** /**
* Group Member API controller * Group Member API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class GroupMember extends \Kanboard\Core\Base class GroupMemberApi extends Base
{ {
public function getMemberGroups($user_id) public function getMemberGroups($user_id)
{ {

View File

@@ -2,13 +2,15 @@
namespace Kanboard\Api; namespace Kanboard\Api;
use Kanboard\Core\Base;
/** /**
* Link API controller * Link API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class Link extends \Kanboard\Core\Base class LinkApi extends Base
{ {
/** /**
* Get a link by id * Get a link by id

View File

@@ -7,10 +7,10 @@ use Kanboard\Model\Subtask as SubtaskModel;
/** /**
* Me API controller * Me API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class Me extends Base class MeApi extends BaseApi
{ {
public function getMe() public function getMe()
{ {

View File

@@ -5,10 +5,10 @@ namespace Kanboard\Api;
/** /**
* Project API controller * Project API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class Project extends Base class ProjectApi extends BaseApi
{ {
public function getProjectById($project_id) public function getProjectById($project_id)
{ {

View File

@@ -2,15 +2,16 @@
namespace Kanboard\Api; namespace Kanboard\Api;
use Kanboard\Core\Base;
use Kanboard\Core\Security\Role; use Kanboard\Core\Security\Role;
/** /**
* Project Permission API controller * Project Permission API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class ProjectPermission extends \Kanboard\Core\Base class ProjectPermissionApi extends Base
{ {
public function getProjectUsers($project_id) public function getProjectUsers($project_id)
{ {

View File

@@ -2,13 +2,15 @@
namespace Kanboard\Api; namespace Kanboard\Api;
use Kanboard\Core\Base;
/** /**
* Subtask API controller * Subtask API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class Subtask extends \Kanboard\Core\Base class SubtaskApi extends Base
{ {
public function getSubtask($subtask_id) public function getSubtask($subtask_id)
{ {

View File

@@ -2,13 +2,15 @@
namespace Kanboard\Api; namespace Kanboard\Api;
use Kanboard\Core\Base;
/** /**
* Swimlane API controller * Swimlane API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class Swimlane extends \Kanboard\Core\Base class SwimlaneApi extends Base
{ {
public function getActiveSwimlanes($project_id) public function getActiveSwimlanes($project_id)
{ {

View File

@@ -8,10 +8,10 @@ use Kanboard\Model\Task as TaskModel;
/** /**
* Task API controller * Task API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class Task extends Base class TaskApi extends BaseApi
{ {
public function searchTasks($project_id, $query) public function searchTasks($project_id, $query)
{ {

View File

@@ -2,13 +2,15 @@
namespace Kanboard\Api; namespace Kanboard\Api;
use Kanboard\Core\Base;
/** /**
* TaskLink API controller * TaskLink API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class TaskLink extends \Kanboard\Core\Base class TaskLinkApi extends Base
{ {
/** /**
* Get a task link * Get a task link

View File

@@ -2,6 +2,7 @@
namespace Kanboard\Api; namespace Kanboard\Api;
use Kanboard\Core\Base;
use LogicException; use LogicException;
use Kanboard\Core\Security\Role; use Kanboard\Core\Security\Role;
use Kanboard\Core\Ldap\Client as LdapClient; use Kanboard\Core\Ldap\Client as LdapClient;
@@ -11,10 +12,10 @@ use Kanboard\Core\Ldap\User as LdapUser;
/** /**
* User API controller * User API controller
* *
* @package api * @package Kanboard\Api
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class User extends \Kanboard\Core\Base class UserApi extends Base
{ {
public function getUser($user_id) public function getUser($user_id)
{ {

View File

@@ -3,47 +3,47 @@
require __DIR__.'/app/common.php'; require __DIR__.'/app/common.php';
use JsonRPC\Server; use JsonRPC\Server;
use Kanboard\Api\Auth; use Kanboard\Api\AuthApi;
use Kanboard\Api\Me; use Kanboard\Api\MeApi;
use Kanboard\Api\Action; use Kanboard\Api\ActionApi;
use Kanboard\Api\App; use Kanboard\Api\AppApi;
use Kanboard\Api\Board; use Kanboard\Api\BoardApi;
use Kanboard\Api\Column; use Kanboard\Api\ColumnApi;
use Kanboard\Api\Category; use Kanboard\Api\CategoryApi;
use Kanboard\Api\Comment; use Kanboard\Api\CommentApi;
use Kanboard\Api\File; use Kanboard\Api\FileApi;
use Kanboard\Api\Link; use Kanboard\Api\LinkApi;
use Kanboard\Api\Project; use Kanboard\Api\ProjectApi;
use Kanboard\Api\ProjectPermission; use Kanboard\Api\ProjectPermissionApi;
use Kanboard\Api\Subtask; use Kanboard\Api\SubtaskApi;
use Kanboard\Api\Swimlane; use Kanboard\Api\SwimlaneApi;
use Kanboard\Api\Task; use Kanboard\Api\TaskApi;
use Kanboard\Api\TaskLink; use Kanboard\Api\TaskLinkApi;
use Kanboard\Api\User; use Kanboard\Api\UserApi;
use Kanboard\Api\Group; use Kanboard\Api\GroupApi;
use Kanboard\Api\GroupMember; use Kanboard\Api\GroupMemberApi;
$server = new Server; $server = new Server;
$server->setAuthenticationHeader(API_AUTHENTICATION_HEADER); $server->setAuthenticationHeader(API_AUTHENTICATION_HEADER);
$server->before(array(new Auth($container), 'checkCredentials')); $server->before(array(new AuthApi($container), 'checkCredentials'));
$server->attach(new Me($container)); $server->attach(new MeApi($container));
$server->attach(new Action($container)); $server->attach(new ActionApi($container));
$server->attach(new App($container)); $server->attach(new AppApi($container));
$server->attach(new Board($container)); $server->attach(new BoardApi($container));
$server->attach(new Column($container)); $server->attach(new ColumnApi($container));
$server->attach(new Category($container)); $server->attach(new CategoryApi($container));
$server->attach(new Comment($container)); $server->attach(new CommentApi($container));
$server->attach(new File($container)); $server->attach(new FileApi($container));
$server->attach(new Link($container)); $server->attach(new LinkApi($container));
$server->attach(new Project($container)); $server->attach(new ProjectApi($container));
$server->attach(new ProjectPermission($container)); $server->attach(new ProjectPermissionApi($container));
$server->attach(new Subtask($container)); $server->attach(new SubtaskApi($container));
$server->attach(new Swimlane($container)); $server->attach(new SwimlaneApi($container));
$server->attach(new Task($container)); $server->attach(new TaskApi($container));
$server->attach(new TaskLink($container)); $server->attach(new TaskLinkApi($container));
$server->attach(new User($container)); $server->attach(new UserApi($container));
$server->attach(new Group($container)); $server->attach(new GroupApi($container));
$server->attach(new GroupMember($container)); $server->attach(new GroupMemberApi($container));
echo $server->execute(); echo $server->execute();