1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of Gitamin. |
5
|
|
|
* |
6
|
|
|
* Copyright (C) 2015-2016 The Gitamin Team |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Gitamin\Http\Routes; |
13
|
|
|
|
14
|
|
|
use Illuminate\Contracts\Routing\Registrar; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* This is the api routes class. |
18
|
|
|
*/ |
19
|
|
|
class ApiRoutes |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* Define the api routes. |
23
|
|
|
* |
24
|
|
|
* @param \Illuminate\Contracts\Routing\Registrar $router |
25
|
|
|
*/ |
26
|
|
|
public function map(Registrar $router) |
27
|
|
|
{ |
28
|
|
|
$router->group([ |
29
|
|
|
'namespace' => 'Api', |
30
|
|
|
'prefix' => 'api/v1', |
31
|
|
|
'middleware' => ['accept:application/json', 'timezone', 'auth.api.optional'], |
32
|
|
|
], function ($router) { |
33
|
|
|
// General |
34
|
|
|
$router->get('ping', 'GeneralController@ping'); |
35
|
|
|
|
36
|
|
|
// Projects |
37
|
|
|
$router->get('projects', 'ProjectController@getProjects'); |
38
|
|
|
$router->get('owners', 'OwnerController@getOwners'); |
39
|
|
|
$router->get('owners/{owner}', 'OwnerController@getOwner'); |
40
|
|
|
$router->get('projects/{project}', 'ProjectController@getProject'); |
41
|
|
|
|
42
|
|
|
// Issues |
43
|
|
|
$router->get('issues', 'IssueController@getIssues'); |
44
|
|
|
$router->get('issues/{issue}', 'IssueController@getIssue'); |
45
|
|
|
|
46
|
|
|
// Comments |
47
|
|
|
$router->get('comments', 'CommentController@getComments'); |
48
|
|
|
$router->get('comments/{comment}', 'CommentController@getComment'); |
49
|
|
|
|
50
|
|
|
// Authorization Required |
51
|
|
|
$router->group(['middleware' => 'auth.api'], function ($router) { |
52
|
|
|
$router->get('subscribers', 'SubscriberController@getSubscribers'); |
53
|
|
|
|
54
|
|
|
$router->post('projects', 'ProjectController@postProjects'); |
55
|
|
|
$router->post('owners', 'OwnerController@postOwners'); |
56
|
|
|
$router->post('issues', 'IssueController@postIssues'); |
57
|
|
|
$router->post('comments', 'CommentController@postComments'); |
58
|
|
|
$router->post('subscribers', 'SubscriberController@postSubscribers'); |
59
|
|
|
|
60
|
|
|
$router->put('owners/{owner}', 'OwnerController@putOwner'); |
61
|
|
|
$router->put('projects/{project}', 'ProjectController@putProject'); |
62
|
|
|
$router->put('issues/{issue}', 'IssueController@putIssue'); |
63
|
|
|
$router->put('comments/{comment}', 'CommentController@putComment'); |
64
|
|
|
|
65
|
|
|
$router->delete('owners/{owner}', 'OwnerController@deleteOwner'); |
66
|
|
|
$router->delete('projects/{project}', 'ProjectController@deleteProject'); |
67
|
|
|
$router->delete('issues/{issue}', 'IssueController@deleteIssue'); |
68
|
|
|
$router->delete('comments/{comment}', 'CommentController@deleteComment'); |
69
|
|
|
$router->delete('subscribers/{subscriber}', 'SubscriberController@deleteSubscriber'); |
70
|
|
|
}); |
71
|
|
|
}); |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|