Class Socialveo\WebApi\Controllers\CommentsController

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

Class CommentsController

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
createAction() Create comment on post Socialveo\WebApi\Controllers\CommentsController
decrypt() Decrypt value Socialveo\WebApi\Controllers\RestApiController
deleteAction() Removes a comment Socialveo\WebApi\Controllers\CommentsController
encrypt() Encrypt value Socialveo\WebApi\Controllers\RestApiController
getAction() Returns a comment Socialveo\WebApi\Controllers\CommentsController
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
listAction() Returns a list of comments Socialveo\WebApi\Controllers\CommentsController
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
unsetParam() Unset get param Socialveo\WebApi\Controllers\RestApiController
updateAction() Updates a comment Socialveo\WebApi\Controllers\CommentsController

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

createAction() public method

Create comment on post

/comments/create

Method: POST

Access: OwnerTarget || UserHasAccessCommentTarget

Parameters:

target_type required string target type, e.g. post
target_uuid required string target uuid
body required string comment body
attributes optional mixed Comment attributes

Affects: Comment , Media , Tag , TagAssociation

Returns: Comment

Sample response:

{
    "status": "OK",
    "data":[
        "type": "comment",
        "uuid": "3783fb66-b5e7-11e4-b252-b88d1200a92c",
        "user_uuid": "32067218-b5e7-11e4-a722-b88d1200a92c",
        "target_uuid": "347d7974-b5e7-11e4-a4e3-b88d1200a92c",
        "parent_uuid": null,
        ...
    ],
    "timestamp": 1234567890
}

public mixed createAction ( )
throws Exception
deleteAction() public method

Removes a comment

/comments/{comment_uuid}/delete

Method: POST

Access: Owner

Parameters:

**{comment_uuid} required string comment uuid

Affects: Comment

Sample response:

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

public mixed deleteAction ( $comment_uuid )
$comment_uuid string

Comment uuid

getAction() public method

Returns a comment

/comments/{comment_uuid}

Method: GET

Access: Owner, UserHasAccess

Parameters:

{comment_uuid} required string comment uuid

Returns: Comment

Sample response:

{
    "status": "OK",
    "data":[
        "type": "comment",
        "uuid": "3783fb66-b5e7-11e4-b252-b88d1200a92c",
        "user_uuid": "32067218-b5e7-11e4-a722-b88d1200a92c",
        "target_uuid": "347d7974-b5e7-11e4-a4e3-b88d1200a92c",
        "parent_uuid": null,
        ...
    ],
    "timestamp": 1234567890
}

public mixed getAction ( $comment_uuid )
$comment_uuid string

Comment uuid

listAction() public method

Returns a list of comments

Notice. This action is disabled, the reasons can be: not implemented, unsafe, duplicated or deprecated (autodetect: disabled in the router)
/comments

Method: GET

Access: Owner, UserHasAccess

Parameters:

page or offset optional integer, page start or offset
limit optional integer, page limit
sortby[property]=order optional sort by property value, order either desc or asc
filterby[property][operator]=value optional filter (limit results) by given property, operator eq (=), gt (>), ge(>=), lt(<), le(<=), ne(<>), like
uuids optional list of item UUIDs to fetch, array or string separated by commas, when it used other parameters will be ignored
language optional string, language code

Filter by: Comment

Returns: Comment []

Sample response:

{
    "status": "OK",
    "data":[
        {"type": "comment", "uuid": "d164e32c-6ecb-11e7-bf60-54bef75c7a3f", "user_uuid": "a479b438-14a8-11e6-ac83-54bef75c7a3f",…},
        {"type": "comment", "uuid": "07b1c6f8-6ecb-11e7-8e97-54bef75c7a3f", "user_uuid": "a479b438-14a8-11e6-ac83-54bef75c7a3f",…},
        {"type": "comment", "uuid": "2d761706-6ec9-11e7-83ae-54bef75c7a3f", "user_uuid": "a479b438-14a8-11e6-ac83-54bef75c7a3f",…},
        {"type": "comment", "uuid": "52a9561a-6ec8-11e7-8a95-54bef75c7a3f", "user_uuid": "a479b438-14a8-11e6-ac83-54bef75c7a3f",…},
        ...
    ],
    "count":{ "offset": 0, "limit": 10, "total": 12 },
    "timestamp": 1234567890
}

public mixed listAction ( )
updateAction() public method

Updates a comment

/comments/{comment_uuid}/update

Method: POST

Access: Owner

Parameters:

**{comment_uuid} required string comment uuid
body required string comment body
attributes optional mixed Comment attributes

Affects: Comment

Returns: Comment

Sample response:

{
    "status": "OK",
    "data":[
        "type": "comment",
        "uuid": "3783fb66-b5e7-11e4-b252-b88d1200a92c",
        "user_uuid": "32067218-b5e7-11e4-a722-b88d1200a92c",
        "target_uuid": "347d7974-b5e7-11e4-a4e3-b88d1200a92c",
        "parent_uuid": null,
        ...
    ],
    "timestamp": 1234567890
}

public mixed updateAction ( $comment_uuid )
$comment_uuid string

Comment uuid

throws Exception