Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Protocol Newsfeed

Rick Mak edited this page Apr 7, 2017 · 1 revision

Overview

Newsfeed is created in the container when a record is pushed into it. Although records in a newsfeed is only visible to the user who is targeted, newsfeed is a container object that does not need to be created for each user.

newsfeed:fetch

Fetch records from the current user's newsfeed.

Records are added to the current user's newsfeed by other users. The client calls this action to fetch these newsfeed records to show the user a feed of activity that the user might have followed or friended.

Fetching from a non-existent newsfeed result in an error. Create a newsfeed in the container by calling newsfeed:push.

Parameters

  • access_token (string, required)

  • database_id (string, required)

When making fresh queries:

  • newsfeed_id (string, required)

    Identifier of the newsfeed owned by the current user.

  • limit (integer, required)

    Maximum number of records to be returned. This limit maybe further limited by system configuration.

When paging through a query:

  • cursor (string, required)

    Server generated record cursor to fetch the next batch of records.

Returns

  • cursor (string)

    Opaque string generated by the server to fetch the next batch of records when submitted in subsequent calls to this action.

  • result (array of objects)

    Record objects in the specified newsfeed of the current user.

newsfeed:push

Add records to the newsfeed of a user.

The client calls this action to make a record appears in the newsfeed of a user. For example, when a user created blog post record, the blog post record can be added to the newsfeed of the author's followers.

Parameters

  • access_token (string, required)

  • newsfeed_id (string, required)

    Identifier of the newsfeed owned by the target user.

  • record_ids (array of strings, required)

    The identifiers of records to be added to the newsfeed.

  • target (required)

    The target users of which the specified records will be added to the newsfeed of these users.

    The target parameter can take one of the following values:

    • array of strings: an array of identifiers of the target users

    • reference: friend or follow reference in which all users who friended or followed the current user will become target user