Revert "Prefix API routes for now"

This reverts commit 4728b6f414.
This commit is contained in:
Toby Zerner 2015-06-17 18:14:41 +09:30
parent 46920468d0
commit b8fe298b04

View File

@ -43,25 +43,23 @@ class ApiServiceProvider extends ServiceProvider
{ {
$this->app->instance('flarum.api.routes', $routes = new RouteCollection); $this->app->instance('flarum.api.routes', $routes = new RouteCollection);
$prefix = '/api';
// Get forum information // Get forum information
$routes->get( $routes->get(
$prefix.'/forum', '/forum',
'flarum.api.forum.show', 'flarum.api.forum.show',
$this->action('Flarum\Api\Actions\Forum\ShowAction') $this->action('Flarum\Api\Actions\Forum\ShowAction')
); );
// Retrieve authentication token // Retrieve authentication token
$routes->post( $routes->post(
$prefix.'/token', '/token',
'flarum.api.token', 'flarum.api.token',
$this->action('Flarum\Api\Actions\TokenAction') $this->action('Flarum\Api\Actions\TokenAction')
); );
// Send forgot password email // Send forgot password email
$routes->post( $routes->post(
$prefix.'/forgot', '/forgot',
'flarum.api.forgot', 'flarum.api.forgot',
$this->action('Flarum\Api\Actions\ForgotAction') $this->action('Flarum\Api\Actions\ForgotAction')
); );
@ -74,49 +72,49 @@ class ApiServiceProvider extends ServiceProvider
// List users // List users
$routes->get( $routes->get(
$prefix.'/users', '/users',
'flarum.api.users.index', 'flarum.api.users.index',
$this->action('Flarum\Api\Actions\Users\IndexAction') $this->action('Flarum\Api\Actions\Users\IndexAction')
); );
// Register a user // Register a user
$routes->post( $routes->post(
$prefix.'/users', '/users',
'flarum.api.users.create', 'flarum.api.users.create',
$this->action('Flarum\Api\Actions\Users\CreateAction') $this->action('Flarum\Api\Actions\Users\CreateAction')
); );
// Get a single user // Get a single user
$routes->get( $routes->get(
$prefix.'/users/{id}', '/users/{id}',
'flarum.api.users.show', 'flarum.api.users.show',
$this->action('Flarum\Api\Actions\Users\ShowAction') $this->action('Flarum\Api\Actions\Users\ShowAction')
); );
// Edit a user // Edit a user
$routes->put( $routes->put(
$prefix.'/users/{id}', '/users/{id}',
'flarum.api.users.update', 'flarum.api.users.update',
$this->action('Flarum\Api\Actions\Users\UpdateAction') $this->action('Flarum\Api\Actions\Users\UpdateAction')
); );
// Delete a user // Delete a user
$routes->delete( $routes->delete(
$prefix.'/users/{id}', '/users/{id}',
'flarum.api.users.delete', 'flarum.api.users.delete',
$this->action('Flarum\Api\Actions\Users\DeleteAction') $this->action('Flarum\Api\Actions\Users\DeleteAction')
); );
// Upload avatar // Upload avatar
$routes->post( $routes->post(
$prefix.'/users/{id}/avatar', '/users/{id}/avatar',
'flarum.api.users.avatar.upload', 'flarum.api.users.avatar.upload',
$this->action('Flarum\Api\Actions\Users\UploadAvatarAction') $this->action('Flarum\Api\Actions\Users\UploadAvatarAction')
); );
// Remove avatar // Remove avatar
$routes->delete( $routes->delete(
$prefix.'/users/{id}/avatar', '/users/{id}/avatar',
'flarum.api.users.avatar.delete', 'flarum.api.users.avatar.delete',
$this->action('Flarum\Api\Actions\Users\DeleteAvatarAction') $this->action('Flarum\Api\Actions\Users\DeleteAvatarAction')
); );
@ -129,21 +127,21 @@ class ApiServiceProvider extends ServiceProvider
// List activity // List activity
$routes->get( $routes->get(
$prefix.'/activity', '/activity',
'flarum.api.activity.index', 'flarum.api.activity.index',
$this->action('Flarum\Api\Actions\Activity\IndexAction') $this->action('Flarum\Api\Actions\Activity\IndexAction')
); );
// List notifications for the current user // List notifications for the current user
$routes->get( $routes->get(
$prefix.'/notifications', '/notifications',
'flarum.api.notifications.index', 'flarum.api.notifications.index',
$this->action('Flarum\Api\Actions\Notifications\IndexAction') $this->action('Flarum\Api\Actions\Notifications\IndexAction')
); );
// Mark a single notification as read // Mark a single notification as read
$routes->put( $routes->put(
$prefix.'/notifications/{id}', '/notifications/{id}',
'flarum.api.notifications.update', 'flarum.api.notifications.update',
$this->action('Flarum\Api\Actions\Notifications\UpdateAction') $this->action('Flarum\Api\Actions\Notifications\UpdateAction')
); );
@ -156,34 +154,34 @@ class ApiServiceProvider extends ServiceProvider
// List discussions // List discussions
$routes->get( $routes->get(
$prefix.'/discussions', '/discussions',
'flarum.api.discussions.index', 'flarum.api.discussions.index',
$this->action('Flarum\Api\Actions\Discussions\IndexAction') $this->action('Flarum\Api\Actions\Discussions\IndexAction')
); );
// Create a discussion // Create a discussion
$routes->post( $routes->post(
$prefix.'/discussions', '/discussions',
'flarum.api.discussions.create', 'flarum.api.discussions.create',
$this->action('Flarum\Api\Actions\Discussions\CreateAction')); $this->action('Flarum\Api\Actions\Discussions\CreateAction'));
// Show a single discussion // Show a single discussion
$routes->get( $routes->get(
$prefix.'/discussions/{id}', '/discussions/{id}',
'flarum.api.discussions.show', 'flarum.api.discussions.show',
$this->action('Flarum\Api\Actions\Discussions\ShowAction') $this->action('Flarum\Api\Actions\Discussions\ShowAction')
); );
// Edit a discussion // Edit a discussion
$routes->put( $routes->put(
$prefix.'/discussions/{id}', '/discussions/{id}',
'flarum.api.discussions.update', 'flarum.api.discussions.update',
$this->action('Flarum\Api\Actions\Discussions\UpdateAction') $this->action('Flarum\Api\Actions\Discussions\UpdateAction')
); );
// Delete a discussion // Delete a discussion
$routes->delete( $routes->delete(
$prefix.'/discussions/{id}', '/discussions/{id}',
'flarum.api.discussions.delete', 'flarum.api.discussions.delete',
$this->action('Flarum\Api\Actions\Discussions\DeleteAction') $this->action('Flarum\Api\Actions\Discussions\DeleteAction')
); );
@ -196,7 +194,7 @@ class ApiServiceProvider extends ServiceProvider
// List posts, usually for a discussion // List posts, usually for a discussion
$routes->get( $routes->get(
$prefix.'/posts', '/posts',
'flarum.api.posts.index', 'flarum.api.posts.index',
$this->action('Flarum\Api\Actions\Posts\IndexAction') $this->action('Flarum\Api\Actions\Posts\IndexAction')
); );
@ -204,28 +202,28 @@ class ApiServiceProvider extends ServiceProvider
// Create a post // Create a post
// @todo consider 'discussions/{id}/links/posts'? // @todo consider 'discussions/{id}/links/posts'?
$routes->post( $routes->post(
$prefix.'/posts', '/posts',
'flarum.api.posts.create', 'flarum.api.posts.create',
$this->action('Flarum\Api\Actions\Posts\CreateAction') $this->action('Flarum\Api\Actions\Posts\CreateAction')
); );
// Show a single or multiple posts by ID // Show a single or multiple posts by ID
$routes->get( $routes->get(
$prefix.'/posts/{id}', '/posts/{id}',
'flarum.api.posts.show', 'flarum.api.posts.show',
$this->action('Flarum\Api\Actions\Posts\ShowAction') $this->action('Flarum\Api\Actions\Posts\ShowAction')
); );
// Edit a post // Edit a post
$routes->put( $routes->put(
$prefix.'/posts/{id}', '/posts/{id}',
'flarum.api.posts.update', 'flarum.api.posts.update',
$this->action('Flarum\Api\Actions\Posts\UpdateAction') $this->action('Flarum\Api\Actions\Posts\UpdateAction')
); );
// Delete a post // Delete a post
$routes->delete( $routes->delete(
$prefix.'/posts/{id}', '/posts/{id}',
'flarum.api.posts.delete', 'flarum.api.posts.delete',
$this->action('Flarum\Api\Actions\Posts\DeleteAction') $this->action('Flarum\Api\Actions\Posts\DeleteAction')
); );
@ -238,35 +236,35 @@ class ApiServiceProvider extends ServiceProvider
// List groups // List groups
$routes->get( $routes->get(
$prefix.'/groups', '/groups',
'flarum.api.groups.index', 'flarum.api.groups.index',
$this->action('Flarum\Api\Actions\Groups\IndexAction') $this->action('Flarum\Api\Actions\Groups\IndexAction')
); );
// Create a group // Create a group
$routes->post( $routes->post(
$prefix.'/groups', '/groups',
'flarum.api.groups.create', 'flarum.api.groups.create',
$this->action('Flarum\Api\Actions\Groups\CreateAction') $this->action('Flarum\Api\Actions\Groups\CreateAction')
); );
// Show a single group // Show a single group
$routes->get( $routes->get(
$prefix.'/groups/{id}', '/groups/{id}',
'flarum.api.groups.show', 'flarum.api.groups.show',
$this->action('Flarum\Api\Actions\Groups\ShowAction') $this->action('Flarum\Api\Actions\Groups\ShowAction')
); );
// Edit a group // Edit a group
$routes->put( $routes->put(
$prefix.'/groups/{id}', '/groups/{id}',
'flarum.api.groups.update', 'flarum.api.groups.update',
$this->action('Flarum\Api\Actions\Groups\UpdateAction') $this->action('Flarum\Api\Actions\Groups\UpdateAction')
); );
// Delete a group // Delete a group
$routes->delete( $routes->delete(
$prefix.'/groups/{id}', '/groups/{id}',
'flarum.api.groups.delete', 'flarum.api.groups.delete',
$this->action('Flarum\Api\Actions\Groups\DeleteAction') $this->action('Flarum\Api\Actions\Groups\DeleteAction')
); );