Class: StreamFeed

StreamFeed

new StreamFeed()

Manage api calls for specific feeds The feed object contains convenience functions such add activity, remove activity etc
Source:

Methods

addActivities(activities, callback) → {Promise}

Adds the given activities to the feed and calls the specified callback
Parameters:
Name Type Description
activities Array Array of activities to add
callback requestCallback Callback to call on completion
Source:
Returns:
XHR request object
Type
Promise

addActivity(activity, callback) → {Promise}

Adds the given activity to the feed and calls the specified callback
Parameters:
Name Type Description
activity object The activity to add
callback requestCallback Callback to call on completion
Source:
Returns:
Promise object
Type
Promise

follow(targetSlug, targetUserId, options, callback) → {Promise}

Follows the given target feed
Parameters:
Name Type Description
targetSlug string Slug of the target feed
targetUserId string User identifier of the target feed
options object Additional options
Properties
Name Type Description
activityCopyLimit number Limit the amount of activities copied over on follow
callback requestCallback Callback to call on completion
Source:
Returns:
Promise object
Type
Promise
Examples
feed.follow('user', '1');
feed.follow('user', '1', callback);
feed.follow('user', '1', options, callback);

followers(options, callback) → {Promise}

List the followers of this feed
Parameters:
Name Type Description
options object Additional options
Properties
Name Type Description
filter string Filter to apply on search operation
callback requestCallback Callback to call on completion
Source:
Returns:
Promise object
Type
Promise
Example
feed.followers({limit:10, filter: ['user:1', 'user:2']}, callback);

following(options, callback) → {Promise}

List which feeds this feed is following
Parameters:
Name Type Description
options object Additional options
Properties
Name Type Description
filter string Filter to apply on search operation
callback requestCallback Callback to call on completion
Source:
Returns:
Promise object
Type
Promise
Example
feed.following({limit:10, filter: ['user:1', 'user:2']}, callback);

get(options, callback) → {Promise}

Reads the feed
Parameters:
Name Type Description
options object Additional options
callback requestCallback Callback to call on completion
Source:
Returns:
Promise object
Type
Promise
Examples
feed.get({limit: 10, id_lte: 'activity-id'})
feed.get({limit: 10, mark_seen: true})

intialize(client, feedSlug, userId, tokenopt)

Initialize a feed object
Parameters:
Name Type Attributes Description
client StreamClient The stream client this feed is constructed from
feedSlug string The feed slug
userId string The user id
token string <optional>
The authentication token
Source:

removeActivity(activityId, callback) → {Promise}

Removes the activity by activityId
Parameters:
Name Type Description
activityId string Identifier of activity to remove
callback requestCallback Callback to call on completion
Source:
Returns:
Promise object
Type
Promise
Examples
feed.removeActivity(activityId);
feed.removeActivity({'foreign_id': foreignId});

subscribe(callback) → {Promise}

Subscribes to any changes in the feed, return a promise
Parameters:
Name Type Description
callback function Callback to call on completion
Source:
Returns:
Promise object
Type
Promise
Example
feed.subscribe(callback).then(function(){
		console.log('we are now listening to changes');
});

unfollow(targetSlug, targetUserId, callback) → {object}

Unfollow the given feed
Parameters:
Name Type Description
targetSlug string Slug of the target feed
targetUserId string [description]
callback requestCallback Callback to call on completion
Source:
Returns:
XHR request object
Type
object
Example
feed.unfollow('user', '2', callback);