# Class: StreamFeed

## StreamFeed

#### new StreamFeed()

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

Source:
  - lib/feed.js, line 5

### 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:
  - lib/feed.js, line 84

##### 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:
  - lib/feed.js, line 39

##### 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:
  - lib/feed.js, line 105

##### 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:
  - lib/feed.js, line 194

##### 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:
  - lib/feed.js, line 172

##### 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:
  - lib/feed.js, line 217

##### 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:
  - lib/feed.js, line 15

#### 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:
  - lib/feed.js, line 58

##### 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:
  - lib/feed.js, line 254

##### 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:
  - lib/feed.js, line 151

##### Returns:

XHR request object

Type
  object

##### Example

    feed.unfollow('user', '2', callback);