API > Activity

Basic JavaScript object

Membership.api.activity

get

Returns list of post related to current user.

Parameters

  • limit
    Maximum number of posts which has to be returned. By default 5, minumum value 1, maximum value 20.
  • offsetId
    Post ID regarding to which a list will be displayed in descending order.

Result

Returns object with properties success and 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/activities.twig

Example

    Membership.api.activity.get({
        limit: 10,
        offsetId: null
    });

post

Publishes new post on the page of specified user.

Parameters

  • userId
    User ID for which is needed to publish a post.

  • data
    Object with properties for publication

    Available properties:

    • message
      Message text
    • link
      Link ID to display in the post, can be received after the method call
      parseUrlAttachment
    • images
      Image ID array which has to be attached to the post, can be received after the call uploadImage

Result

Returns object with properties success and 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/activities.twig

Example

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

update

Updates post on the page of specified user.

Parameters

  • activityId
    Post ID which has to be updated.

  • data
    Object with properties for publication

    Available properties:

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

Result

Returns object with properties success and 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/activities.twig

Example

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

remove

Removes user post.

Parameters

  • activityId
    ID of a post 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.activity.remove({
    activityId: 1
});

share

Copies (shares) certain post and displays it as a post of a current user.

Parameters

  • activityId
    ID of a post which has to be copied (shared).

Result

Returns object with properties success and 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-action-popup-user.twig

Example

Membership.api.activity.share({
    activityId: 1
});

like

Puts "Like" for the certain post.

Parameters

  • activityId
    ID of a post which has to be copied (shared).

Result

Returns object with properties success и html or error:

  • 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-action-popup-user.twig
  • message
    Error message in a case of unseccessful request.

Example

Membership.api.activity.like({
    activityId: 1
});

unlike

Removes "Like" for the certain post.

Parameters

  • activityId
    Post ID.

Result

Returns object with properties success and html or error:

  • 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-action-popup-user.twig
  • message
    Error message in a case of unseccessful request.

Example

Membership.api.activity.like({
    activityId: 1
});

getLikes

Gets a list of users who clicked "Like".

Parameters

  • activityId
    Post ID.

  • limit
    Maximum number of users which has to be returned. By default 15, minumum value 1, maximum value 50.

  • offsetId
    User ID regarding to which a list will be displayed in descending order.

  • template
    A template with the help of which a list be rendered.

    Acceptable values

    • modal will be rendered membership-by-supsystic/src/Membership/Activity/views/partials/activity-action-modal-user.twig
    • popup will be rendered membership-by-supsystic/src/Membership/Activity/views/partials/activity-action-popup-user.twig

Result

Returns object with properties success and html or error:

  • 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-action-modal-user.twig or
    membership-by-supsystic/src/Membership/Activity/views/partials/activity-action-popup-user.twig
  • message
    Error message in a case of unseccessful request.

Example

Membership.api.activity.getLikes({
    activityId: 1,
    limit: 15,
    offsetId: null,
    template: 'modal'
});

getShares

Gets list of users who shared a post.

Parameters

  • activityId
    Post ID.

  • limit
    Maximum number of users which has to be returned. By default 15, minumum value 1, maximum value 50.

  • offsetId
    User ID regarding to which a list will be displayed in descending order.

  • template
    A template with the help of which a list be rendered.

    Acceptable values

    • modal will be rendered membership-by-supsystic/src/Membership/Activity/views/partials/activity-action-modal-user.twig
    • popup will be rendered membership-by-supsystic/src/Membership/Activity/views/partials/activity-action-popup-user.twig

Result

Returns object with properties success and html or error:

  • 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-action-modal-user.twig or
    membership-by-supsystic/src/Membership/Activity/views/partials/activity-action-popup-user.twig
  • message
    Error message in a case of unseccessful request.

Example

Membership.api.activity.getLikes({
    activityId: 1,
    limit: 15,
    offsetId: null,
    template: 'modal'
});

parseUrlAttachment

Gets Open Graph data by the link.

Parameters

  • url
    Url address.

Result

Returns object with properties success and html or error:

  • 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-attachment-link.twig
  • message Error message is a case of unseccessful request.

Example

Membership.api.activity.parseUrlAttachment({
    url: 'http://example.com'
});

Search through posts.

Parameters

  • query
    Query line
  • type
    If query type is hash search will be made by hashtags, if type is not specified then search will be made by posts text.
  • limit
    Maximum number of posts which has to be returned. By default 5, minumum value 1, maximum value 20.
  • offsetId
    Post ID regarding to which a list will be displayed in descending order.

Result

Returns object with properties success and html or error:

  • 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/activities.twig

Example

Membership.api.activity.search({
    query: '#tag',
    type: 'hash',
    limit: 5,
    offsetId: null
});

Categories
Latest Articles