API > Comments

Basic JavaScript object

Membership.api.comments

get

Gets comments for specified post

Parameters

  • activityId
    Post ID for which is needed to get comments.
  • limit
    Maximum number of comments which has to be returned. By default 10, minumum value 1, maximum value 50.
  • offsetId
    Comment ID regarding to which a list will be displayed in descending order.

Result

Returns object which contains such properties: success in a case of success and html in a case of error success, message.

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Template render membership-by-supsystic/src/Membership/Activity/views/partials/activity-comments.twig
  • message
    Error message.

Example

Membership.api.comments.get({
    activityId: 1,
    limit: 15,
    offsetId: null,
});

post

Publishes new comment.

Parameters

  • activityId
    Post ID.
  • data
    Object with parameters to publish

    Available properties:

    • message
      Message text
    • link
      Link ID to display in a comment, can be received after a method call parseUrlAttachment
    • images
      Image ID array which has to be attached to a comment, can be received after a call uploadImage
  • postAsGroup
    Group ID. If specified – posts comment on behalf of a group.

Result

Returns object with properties success и html:

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Template render membership-by-supsystic/src/Membership/Activity/views/partials/activity-comments.twig

Example

Membership.api.comments.post({
    activityId: 1,
    data: {
        message: 'Hello',
        images: [100, 101, 102],
        link: 'fef0e980f7d3cf3bbda271095c5041ea32c98343'
    },
    postAsGroup: 10
});

update

Updates comment content.

Parameters

  • commentId
    ID of a comment which has to be updated.
  • data
    Object with parameters to publish

    Available properties:

    • message
      Message text
    • link
      Link ID to display in the comment, can be received after the method call parseUrlAttachment

Result

Returns object with properties success и html:

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Template render membership-by-supsystic/src/Membership/Activity/views/partials/activity-comments.twig.twig

Example

Membership.api.comments.update({
    commentId: 1,
    data: {
        message: 'Hello Update',
        link: 'fef0e980f7d3cf3bbda271095c5041ea32c98343'
    },
});

remove

Removes comment.

Parameters

  • commentId
    ID of a comment which has to be deleted.

Result

Returns object with success property:

  • success
    Request status true in a case of success or false in a case of error.

Example

Membership.api.comments.remove({
    commentId: 1
});

reply

Publishes reply to a comment.

Parameters

  • commentId
    Comment ID.
  • data
    Object with parameters to publish

    Available properties:

    • message
      Message text
    • link
      Link ID to display in the comment, can be received after the method call parseUrlAttachment
    • images
      Image ID array which has to be attached to the comment, can be received after the call uploadImage
  • postAsGroup
    Group ID. If specified – posts comment on behalf of the group.

Result

Returns object with properties success и html:

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Template render membership-by-supsystic/src/Membership/Activity/views/partials/activity-comments.twig

Example

Membership.api.comments.post({
    commentId: commentId,
    data: {
        message: 'Hello',
        images: [100, 101, 102],
        link: 'fef0e980f7d3cf3bbda271095c5041ea32c98343'
    },
    postAsGroup: 10
});

replies

Gets comment replies to a specified comment.

Parameters

  • commentId
    Comment ID for which is needed to get comments.
  • limit
    Maximum number of comments which has to be returned. By default 15, minumum value 1, maximum value 50.
  • offsetId
    Comment ID regarding to which a list will be displayed in descending order.

Result

Returns object which contains such properties: success in a case of success and html in a case of error success, message.

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Tedmplate render membership-by-supsystic/src/Membership/Activity/views/partials/activity-comments.twig
  • message
    Error message.

Example

Membership.api.comments.replies({
    commentId: 1,
    limit: 15,
    offsetId: null
});

Categories
Latest Articles