Notifications

This commit is contained in:
GamerClassN7 2021-01-04 17:08:56 +01:00
parent a3a87d39d2
commit 64b50ead9f
2 changed files with 10 additions and 0 deletions

View File

@ -53,6 +53,7 @@ $router->any('/api/HA', 'GoogleHomeApi@response');
$router->post('/api/endpoint/', 'EndpointsApi@default'); $router->post('/api/endpoint/', 'EndpointsApi@default');
$router->any('/api/update/', 'UpdatesApi@default'); $router->any('/api/update/', 'UpdatesApi@default');
$router->any('/api/users/status', 'UsersApi@status'); $router->any('/api/users/status', 'UsersApi@status');
$router->any('/api/users/subscribe', 'UsersApi@subscribe');
// examples // examples
$router->any('/api/example', 'ExampleApi@example'); $router->any('/api/example', 'ExampleApi@example');

View File

@ -34,4 +34,13 @@ class UsersApi extends ApiController{
} }
$this->response(['value'=>'OK']); $this->response(['value'=>'OK']);
} }
public function subscribe(){
//$this->requireAuth();
$subscriptionToken = $this->input['token'];
$subscriptionUserId = $this->input['user_id'];
NotificationManager::addSubscriber($subscriptionUserId, $subscriptionToken);
$this->response(['value'=>'OK']);
}
} }