Пример #1
0
$app->delete('/user/{id:[0-9]+}/block', function ($request, $response, $args) {
    $token = parseToken($request);
    $friend_id = $args['id'];
    return Friends::unblock($response, $token, $friend_id);
});
/* Handle accept friend */
$app->post('/user/{id:[0-9]+}/accept', function ($request, $response, $args) {
    $token = parseToken($request);
    $friend_id = $args['id'];
    return Friends::accept($response, $token, $friend_id);
});
/* Handle add friend */
$app->post('/user/{id:[0-9]+}/request', function ($request, $response, $args) {
    $token = parseToken($request);
    $friend_id = $args['id'];
    return Friends::request($response, $token, $friend_id);
});
/* Handle delete friend */
$app->delete('/user/{id:[0-9]+}/request', function ($request, $response, $args) {
    $token = parseToken($request);
    $friend_id = $args['id'];
    return Friends::unrequest($response, $token, $friend_id);
});
/* Handle get my friend requests */
$app->get('/user/me/friends/requests', function ($request, $response) {
    $token = parseToken($request);
    return Friends::requests($response, $token);
});
/* Handle get my requested friends */
$app->get('/user/me/friends/requested', function ($request, $response) {
    $token = parseToken($request);