17
17
* @license MIT
18
18
* @link https://github.com/chriskacerguis/codeigniter-restserver
19
19
*/
20
- class Key extends REST_Controller {
20
+ class Key extends \ Restserver \ Libraries \ REST_Controller {
21
21
22
22
protected $ methods = [
23
23
'index_put ' => ['level ' => 10 , 'limit ' => 10 ],
@@ -47,14 +47,14 @@ public function index_put()
47
47
$ this ->response ([
48
48
'status ' => TRUE ,
49
49
'key ' => $ key
50
- ], REST_Controller::HTTP_CREATED ); // CREATED (201) being the HTTP response code
50
+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_CREATED ); // CREATED (201) being the HTTP response code
51
51
}
52
52
else
53
53
{
54
54
$ this ->response ([
55
55
'status ' => FALSE ,
56
56
'message ' => 'Could not save the key '
57
- ], REST_Controller::HTTP_INTERNAL_SERVER_ERROR ); // INTERNAL_SERVER_ERROR (500) being the HTTP response code
57
+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_INTERNAL_SERVER_ERROR ); // INTERNAL_SERVER_ERROR (500) being the HTTP response code
58
58
}
59
59
}
60
60
@@ -75,7 +75,7 @@ public function index_delete()
75
75
$ this ->response ([
76
76
'status ' => FALSE ,
77
77
'message ' => 'Invalid API key '
78
- ], REST_Controller::HTTP_BAD_REQUEST ); // BAD_REQUEST (400) being the HTTP response code
78
+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_BAD_REQUEST ); // BAD_REQUEST (400) being the HTTP response code
79
79
}
80
80
81
81
// Destroy it
@@ -85,7 +85,7 @@ public function index_delete()
85
85
$ this ->response ([
86
86
'status ' => TRUE ,
87
87
'message ' => 'API key was deleted '
88
- ], REST_Controller::HTTP_NO_CONTENT ); // NO_CONTENT (204) being the HTTP response code
88
+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_NO_CONTENT ); // NO_CONTENT (204) being the HTTP response code
89
89
}
90
90
91
91
/**
@@ -106,7 +106,7 @@ public function level_post()
106
106
$ this ->response ([
107
107
'status ' => FALSE ,
108
108
'message ' => 'Invalid API key '
109
- ], REST_Controller::HTTP_BAD_REQUEST ); // BAD_REQUEST (400) being the HTTP response code
109
+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_BAD_REQUEST ); // BAD_REQUEST (400) being the HTTP response code
110
110
}
111
111
112
112
// Update the key level
@@ -115,14 +115,14 @@ public function level_post()
115
115
$ this ->response ([
116
116
'status ' => TRUE ,
117
117
'message ' => 'API key was updated '
118
- ], REST_Controller::HTTP_OK ); // OK (200) being the HTTP response code
118
+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_OK ); // OK (200) being the HTTP response code
119
119
}
120
120
else
121
121
{
122
122
$ this ->response ([
123
123
'status ' => FALSE ,
124
124
'message ' => 'Could not update the key level '
125
- ], REST_Controller::HTTP_INTERNAL_SERVER_ERROR ); // INTERNAL_SERVER_ERROR (500) being the HTTP response code
125
+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_INTERNAL_SERVER_ERROR ); // INTERNAL_SERVER_ERROR (500) being the HTTP response code
126
126
}
127
127
}
128
128
@@ -143,7 +143,7 @@ public function suspend_post()
143
143
$ this ->response ([
144
144
'status ' => FALSE ,
145
145
'message ' => 'Invalid API key '
146
- ], REST_Controller::HTTP_BAD_REQUEST ); // BAD_REQUEST (400) being the HTTP response code
146
+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_BAD_REQUEST ); // BAD_REQUEST (400) being the HTTP response code
147
147
}
148
148
149
149
// Update the key level
@@ -152,14 +152,14 @@ public function suspend_post()
152
152
$ this ->response ([
153
153
'status ' => TRUE ,
154
154
'message ' => 'Key was suspended '
155
- ], REST_Controller::HTTP_OK ); // OK (200) being the HTTP response code
155
+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_OK ); // OK (200) being the HTTP response code
156
156
}
157
157
else
158
158
{
159
159
$ this ->response ([
160
160
'status ' => FALSE ,
161
161
'message ' => 'Could not suspend the user '
162
- ], REST_Controller::HTTP_INTERNAL_SERVER_ERROR ); // INTERNAL_SERVER_ERROR (500) being the HTTP response code
162
+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_INTERNAL_SERVER_ERROR ); // INTERNAL_SERVER_ERROR (500) being the HTTP response code
163
163
}
164
164
}
165
165
@@ -181,7 +181,7 @@ public function regenerate_post()
181
181
$ this ->response ([
182
182
'status ' => FALSE ,
183
183
'message ' => 'Invalid API key '
184
- ], REST_Controller::HTTP_BAD_REQUEST ); // BAD_REQUEST (400) being the HTTP response code
184
+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_BAD_REQUEST ); // BAD_REQUEST (400) being the HTTP response code
185
185
}
186
186
187
187
// Build a new key
@@ -196,14 +196,14 @@ public function regenerate_post()
196
196
$ this ->response ([
197
197
'status ' => TRUE ,
198
198
'key ' => $ new_key
199
- ], REST_Controller::HTTP_CREATED ); // CREATED (201) being the HTTP response code
199
+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_CREATED ); // CREATED (201) being the HTTP response code
200
200
}
201
201
else
202
202
{
203
203
$ this ->response ([
204
204
'status ' => FALSE ,
205
205
'message ' => 'Could not save the key '
206
- ], REST_Controller::HTTP_INTERNAL_SERVER_ERROR ); // INTERNAL_SERVER_ERROR (500) being the HTTP response code
206
+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_INTERNAL_SERVER_ERROR ); // INTERNAL_SERVER_ERROR (500) being the HTTP response code
207
207
}
208
208
}
209
209
0 commit comments