Class Socialveo\WebApi\Controllers\ConnectionsController

InheritanceSocialveo\WebApi\Controllers\ConnectionsController » Socialveo\WebApi\Controllers\RestApiController » Phalcon\Mvc\Controller
Uses TraitsSocialveo\Core\Translatable

Class ConnectionsController

Public Methods

Hide inherited methods

MethodDescriptionDefined By
_handleException() Handle exceptions Socialveo\WebApi\Controllers\RestApiController
_t() Gets translations Socialveo\Core\Translatable
afterExecuteRoute() After execute route, change return value to json Socialveo\WebApi\Controllers\RestApiController
beforeExecuteRoute() Before execute route, remove extra params Socialveo\WebApi\Controllers\RestApiController
checkClientCredentials() Checks client credentials Socialveo\WebApi\Controllers\RestApiController
decrypt() Decrypt value Socialveo\WebApi\Controllers\RestApiController
disconnectNetworkAction() Disconnect joined network Socialveo\WebApi\Controllers\ConnectionsController
encrypt() Encrypt value Socialveo\WebApi\Controllers\RestApiController
followUserAction() Follow user (add to first circle and create connection). Socialveo\WebApi\Controllers\ConnectionsController
friendsAction() Get friends Socialveo\WebApi\Controllers\ConnectionsController
getAction() Returns a connection Socialveo\WebApi\Controllers\ConnectionsController
getArrayFromParam() Returns array from params Socialveo\WebApi\Controllers\RestApiController
getLanguage() Gets language code Socialveo\WebApi\Controllers\RestApiController
getParams() Gets request params for Socialveo::filteredFind() Socialveo\WebApi\Controllers\RestApiController
getRequestData() Returns request data Socialveo\WebApi\Controllers\RestApiController
getRequiredParam() Get required param Socialveo\WebApi\Controllers\RestApiController
getToken() Get token Socialveo\WebApi\Controllers\RestApiController
getTranslation() Gets translations Socialveo\WebApi\Controllers\RestApiController
handleError() Handle errors Socialveo\WebApi\Controllers\RestApiController
handleException() Handle exceptions Socialveo\WebApi\Controllers\RestApiController
initialize() Initialize controller Socialveo\WebApi\Controllers\RestApiController
invalidMethodAction() Action trigger when invalid action tried run Socialveo\WebApi\Controllers\RestApiController
joinNetworkAction() Join public networks or ask to join closed networks or join into invited network Socialveo\WebApi\Controllers\ConnectionsController
listAction() Get connections list Socialveo\WebApi\Controllers\ConnectionsController
notFoundAction() Not found action Socialveo\WebApi\Controllers\RestApiController
posts() Gets posts Socialveo\WebApi\Controllers\RestApiController
replaceParam() Replace param Socialveo\WebApi\Controllers\RestApiController
respondWithItem() Response with item // * @deprecated Socialveo\WebApi\Controllers\RestApiController
sendJsonContent() Send response as json content and exit Socialveo\WebApi\Controllers\RestApiController
sendJsonContentRaw() Send json content Socialveo\WebApi\Controllers\RestApiController
sendJsonContentRawStatic() Send json content static Socialveo\WebApi\Controllers\RestApiController
setDefaultParam() Set default option Socialveo\WebApi\Controllers\RestApiController
t() Gets translations Socialveo\Core\Translatable
unfollowUserAction() Unfollow user (removes from circles and removes connection). Socialveo\WebApi\Controllers\ConnectionsController
unsetParam() Unset get param Socialveo\WebApi\Controllers\RestApiController
updateUserAction() Create/update/remove connection with user (add user circles and create connection or remove). Socialveo\WebApi\Controllers\ConnectionsController
userAction() Get connection with user Socialveo\WebApi\Controllers\ConnectionsController

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
checkAccess() Checks during the init of controller whether user is a guest. Socialveo\WebApi\Controllers\RestApiController
log() Log full request data for debug Socialveo\WebApi\Controllers\RestApiController
objectsToArray() Convert objects to arrays Socialveo\WebApi\Controllers\RestApiController

Method Details

disconnectNetworkAction() public method

Disconnect joined network

/connections/networks/{networks_uuid}/disconnect

Method: POST

Access: Logged && UserHasAccess (Network)

Parameters:

{networks_uuid} required string network uuid
language optional string language code

Affects: Connection , Notification

Sample response:

{
    "status": "OK",
    "timestamp": 1234567890
}

public mixed disconnectNetworkAction ( $networks_uuid )
$networks_uuid string

Network uuid

throws Exception
followUserAction() public method

Follow user (add to first circle and create connection).

/connections/users/{user_uuid}/follow

Method: POST

Access: LoggedUserHasAccess (User passed by _{user_uuid}_)

Parameters:

{user_uuid} required string user uuid
circle_uuids[] optional string or array coma separated uuids, or array
language optional string language code

Affects: Connection , Circle , ConnectionCircle , Notification

Returns: Connection

Note. If user already has connection with current user, this user will be removed from other circles and added in the first active circle.

Sample response:

{
    "status": "OK",
    "data":{
        "type": "connection",
        "uuid": "6cbf3926-6e72-11e7-a385-54bef75c7a3f",
        "user_uuid": "a479b438-14a8-11e6-ac83-54bef75c7a3f",
        "network_uuid": "4631a06c-27f8-11e6-94b3-54bef75c7a3f",
        ...
        "connectionCircle":[
            {"type": "connection_circle", "uuid": "6cc2dab8-6e72-11e7-beda-54bef75c7a3f", "connection_uuid": "6cbf3926-6e72-11e7-a385-54bef75c7a3f",…},
            {"type": "connection_circle", "uuid": "6cc37b4e-6e72-11e7-9acc-54bef75c7a3f", "connection_uuid": "6cbf3926-6e72-11e7-a385-54bef75c7a3f",…}
        ]
    },
    "timestamp": 1234567890
}

public mixed followUserAction ( $user_uuid )
$user_uuid string
throws Exception
friendsAction() public method

Get friends

public Phalcon\Mvc\Model\ResultsetInterface friendsAction ( )
throws Exception
getAction() public method

Returns a connection

/connections/{connection_uuid}

Method: GET

Access: LoggedUserHasAccess (Connection passed by _{connection_uuid}_)

Parameters:

{connection_uuid} required string connection uuid
language optional string language code

Returns: Connection

Sample response:

{
    "status": "OK",
    "data":{
        "type": "connection",
        "uuid": "6cbf3926-6e72-11e7-a385-54bef75c7a3f",
        "user_uuid": "a479b438-14a8-11e6-ac83-54bef75c7a3f",
        "network_uuid": "4631a06c-27f8-11e6-94b3-54bef75c7a3f",
        ...
        "connectionCircle":[
            {"type": "connection_circle", "uuid": "6cc2dab8-6e72-11e7-beda-54bef75c7a3f", "connection_uuid": "6cbf3926-6e72-11e7-a385-54bef75c7a3f",…},
            {"type": "connection_circle", "uuid": "6cc37b4e-6e72-11e7-9acc-54bef75c7a3f", "connection_uuid": "6cbf3926-6e72-11e7-a385-54bef75c7a3f",…}
        ]
    },
    "timestamp": 1234567890
}

public mixed getAction ( $connection_uuid )
$connection_uuid string
joinNetworkAction() public method

Join public networks or ask to join closed networks or join into invited network

/connections/networks/{networks_uuid}/join

Method: POST

Access: Logged && UserNotLocked (by owner of Network)

Parameters:

{networks_uuid} required string network uuid
language optional string language code

Affects: Connection , Notification

Returns: Connection

Sample response:

{
    "status": "OK",
    "data":{
        "type": "connection",
        "uuid": "6cbf3926-6e72-11e7-a385-54bef75c7a3f",
        "user_uuid": "a479b438-14a8-11e6-ac83-54bef75c7a3f",
        "network_uuid": "4631a06c-27f8-11e6-94b3-54bef75c7a3f",
        ...
    },
    "timestamp": 1234567890
}

public mixed joinNetworkAction ( $networks_uuid )
$networks_uuid string

Network uuid

throws Exception
listAction() public method

Get connections list

/connections

Method: GET

Access: Logged

Parameters:

page or offset optional integer page start or offset
limit optional integer page limit
sortby[property]=order optional array sort by property value, order either desc or asc
filterby[property][operator]=value optional array filter by given property, operator eq (=), gt (>), ge(>=), lt(<), le(<=), ne(<>), like
language optional string language code

Filter by: Connection

Returns: Connection []

Sample response:

{
    "status": "OK",
    "data":[
        {"type": "connection", "uuid": "a479b438-14a8-11e6-ac83-54bef75c7a3f", "network_uuid": "a66b8654-14a8-11e6-af87-54bef75c7a3f",…},
        {"type": "connection", "uuid": "5a15e760-27ed-11e6-8d4a-54bef75c7a3f", "network_uuid": "5ac94e9a-27ed-11e6-9916-54bef75c7a3f",…},
        {"type": "connection", "uuid": "0449c1f2-27f8-11e6-be68-54bef75c7a3f", "network_uuid": "04577e6e-27f8-11e6-b0cf-54bef75c7a3f",…},
        {"type": "connection", "uuid": "4622f77e-27f8-11e6-98d1-54bef75c7a3f", "network_uuid": "4631a06c-27f8-11e6-94b3-54bef75c7a3f",…},
        ...
    ],
    "count":{"offset": 0, "limit": 10, "total": 12},
    "timestamp": 1234567890
}

public mixed listAction ( )
unfollowUserAction() public method

Unfollow user (removes from circles and removes connection).

/connections/users/{user_uuid}/unfollow

Method: POST

Access: LoggedUserHasAccess (User passed by _{user_uuid}_)

Parameters:

{user_uuid} required string user uuid
language optional string language code

Affects: Connection , Circle , ConnectionCircle , Notification

Sample response:

{
    "status": "OK",
    "timestamp": 1234567890
}

public mixed unfollowUserAction ( $user_uuid )
$user_uuid string
throws Exception
updateUserAction() public method

Create/update/remove connection with user (add user circles and create connection or remove).

/connections/users/{user_uuid}/update

Method: POST

Access: LoggedUserHasAccess (User passed by _{user_uuid}_) and UserHasAccessUuids (Circle[] passed by _circle_uuids[]_)

Parameters:

{user_uuid} required string user uuid
circle_uuids[] optional string or array coma separated uuids, or array
language optional string language code

Affects: Connection , Circle , ConnectionCircle , Notification

Returns: Connection |null

Usage: * Follow. For add some user to logged user circles need to send request with _circle_uuids_ in which

circles want to add user.

  • Unfollow. Send request without or empty _circleuuids will removes user from circles and remove connection.

    Sample response:

    {
    "status": "OK",
    "data":{
        "type": "connection",
        "uuid": "6cbf3926-6e72-11e7-a385-54bef75c7a3f",
        "user_uuid": "a479b438-14a8-11e6-ac83-54bef75c7a3f",
        "network_uuid": "4631a06c-27f8-11e6-94b3-54bef75c7a3f",
        ...
        "connectionCircle":[
            {"type": "connection_circle", "uuid": "6cc2dab8-6e72-11e7-beda-54bef75c7a3f", "connection_uuid": "6cbf3926-6e72-11e7-a385-54bef75c7a3f",…},
            {"type": "connection_circle", "uuid": "6cc37b4e-6e72-11e7-9acc-54bef75c7a3f", "connection_uuid": "6cbf3926-6e72-11e7-a385-54bef75c7a3f",…}
        ]
    },
    "timestamp": 1234567890
    }

public mixed updateUserAction ( $user_uuid, $firstCircle false )
$user_uuid string
$firstCircle boolean

[optional]

throws Exception
userAction() public method

Get connection with user

/connections/users/{user_uuid}

Method: GET

Access: LoggedUserHasAccess (to User)

Parameters:

{user_uuid} required string user uuid
language optional string language code

Returns: Connection

Sample response:

{
    "status": "OK",
    "data":{
        "type": "connection",
        "uuid": "6cbf3926-6e72-11e7-a385-54bef75c7a3f",
        "user_uuid": "a479b438-14a8-11e6-ac83-54bef75c7a3f",
        "network_uuid": "4631a06c-27f8-11e6-94b3-54bef75c7a3f",
        ...
        "connectionCircle":[
            {"type": "connection_circle", "uuid": "6cc2dab8-6e72-11e7-beda-54bef75c7a3f", "connection_uuid": "6cbf3926-6e72-11e7-a385-54bef75c7a3f",…},
            {"type": "connection_circle", "uuid": "6cc37b4e-6e72-11e7-9acc-54bef75c7a3f", "connection_uuid": "6cbf3926-6e72-11e7-a385-54bef75c7a3f",…}
        ]
    },
    "timestamp": 1234567890
}

public mixed userAction ( $user_uuid )
$user_uuid string
throws Exception