activities(activities)
Updates all supplied activities on the getstream-io api
parameter | type | description |
---|---|---|
activities |
array
|
list of activities to update |
Promise
activities(activities, callback)
Adds the given activities to the feed and calls the specified callback
parameter | type | description |
---|---|---|
activities |
Array
|
Array of activities to add |
callback |
requestCallback
|
Callback to call on completion |
Promise
:
XHR request object
activity(activity, callback)
Adds the given activity to the feed and calls the specified callback
parameter | type | description |
---|---|---|
activity |
object
|
The activity to add |
callback |
requestCallback
|
Callback to call on completion |
Promise
:
Promise object
apiKey(apiKey, [apiSecret], [appId], [options])
Initialize a client
parameter | type | description |
---|---|---|
apiKey |
string
|
the api key |
apiSecret |
[
|
the api secret |
appId |
[
|
id of the app |
options |
[
|
additional options |
options.location |
[
|
which data center to use |
options.expireTokens |
[
(default false )
|
whether to use a JWT timestamp field (i.e. iat) |
<caption>initialize is not directly called by via stream.connect, ie:</caption>
stream.connect(apiKey, apiSecret)
<caption>secret is optional and only used in server side mode</caption> stream.connect(apiKey, null, appId);
appId(callback)
Subscribes to any changes in the feed, return a promise
parameter | type | description |
---|---|---|
callback |
function
|
Callback to call on completion |
Promise
:
Promise object
feed.subscribe(callback).then(function(){
console.log('we are now listening to changes');
});
client(client, feedSlug, userId, [token])
Initialize a feed object
parameter | type | description |
---|---|---|
client |
StreamClient
|
The stream client this feed is constructed from |
feedSlug |
string
|
The feed slug |
userId |
string
|
The user id |
token |
[
|
The authentication token |
description
Get the current user agent
string
:
current user agent
event(event, callback)
Support for global event callbacks This is useful for generic error and loading handling
parameter | type | description |
---|---|---|
event |
string
|
Name of the event |
callback |
function
|
Function that is called when the event fires |
client.on('request', callback);
client.on('response', callback);
feedId(feedSlug, userId)
Returns a token that allows read and write operations
parameter | type | description |
---|---|---|
feedSlug |
string
|
The feed slug to get a read only token for |
userId |
string
|
The user identifier |
string
:
token
client.getReadWriteToken('user', '1');
feedId(feedSlug, userId)
Returns a token that allows only read operations
parameter | type | description |
---|---|---|
feedSlug |
string
|
The feed slug to get a read only token for |
userId |
string
|
The user identifier |
string
:
token
client.getReadOnlyToken('user', '1');
identifier(activityId, callback)
Removes the activity by activityId
parameter | type | description |
---|---|---|
activityId |
string
|
Identifier of activity to remove |
callback |
requestCallback
|
Callback to call on completion |
Promise
:
Promise object
feed.removeActivity(activityId);
feed.removeActivity({'foreign_id': foreignId});
key([key])
Remove one or more event handlers
parameter | type | description |
---|---|---|
key |
[
|
Name of the handler |
client.off() removes all handlers client.off(name) removes the specified handler
options(options, callback)
Reads the feed
parameter | type | description |
---|---|---|
options |
object
|
Additional options |
callback |
requestCallback
|
Callback to call on completion |
Promise
:
Promise object
feed.get({limit: 10, id_lte: 'activity-id'})
feed.get({limit: 10, mark_seen: true})
options(options, callback)
List the followers of this feed
parameter | type | description |
---|---|---|
options |
object
|
Additional options |
options.filter |
string
|
Filter to apply on search operation |
callback |
requestCallback
|
Callback to call on completion |
Promise
:
Promise object
feed.followers({limit:10, filter: ['user:1', 'user:2']}, callback);
options(options, callback)
List which feeds this feed is following
parameter | type | description |
---|---|---|
options |
object
|
Additional options |
options.filter |
string
|
Filter to apply on search operation |
callback |
requestCallback
|
Callback to call on completion |
Promise
:
Promise object
feed.following({limit:10, filter: ['user:1', 'user:2']}, callback);
options(feedSlug, userId, [token], [siteId], [options])
Returns a feed object for the given feed id and token
parameter | type | description |
---|---|---|
feedSlug |
string
|
The feed slug |
userId |
string
|
The user identifier |
token |
[
|
The token |
siteId |
[
|
The site identifier |
options |
[
|
Additional function options |
options.readOnly |
[
|
A boolean indicating whether to generate a read only token for this feed |
StreamFeed
client.feed('user', '1', 'token2');
process(apiKey, [apiSecret], [appId], [options])
Create StreamClient
parameter | type | description |
---|---|---|
apiKey |
string
|
API key |
apiSecret |
[
|
API secret (only use this on the server) |
appId |
[
|
Application identifier |
options |
[
|
Additional options |
options.location |
[
|
Datacenter location |
StreamClient
:
StreamClient
<caption>Basic usage</caption> stream.connect(apiKey, apiSecret);
<caption>or if you want to be able to subscribe and listen</caption> stream.connect(apiKey, apiSecret, appId);
<caption>or on Heroku</caption> stream.connect(streamURL);
<caption>where streamURL looks like</caption> "https://thierry:pass@gestream.io/?app=1"
StreamClient([errors], response, body)
parameter | type | description |
---|---|---|
errors |
[
|
|
response |
object
|
|
body |
object
|
StreamClient
StreamClient
Client to connect to Stream api
StreamFeed
Manage api calls for specific feeds The feed object contains convenience functions such add activity, remove activity etc
updateActivities(activity)
Updates one activity on the getstream-io api
parameter | type | description |
---|---|---|
activity |
object
|
The activity to update |
Promise
uri(targetUrl, userId, events)
Creates a redirect url for tracking the given events in the context of an email using Stream's analytics platform. Learn more at getstream.io/personalization
parameter | type | description |
---|---|---|
targetUrl |
string
|
Target url |
userId |
string
|
User id to track |
events |
array
|
List of events to track |
string
:
The redirect url
validateFeedSlug(targetSlug, targetUserId, options, callback)
Follows the given target feed
parameter | type | description |
---|---|---|
targetSlug |
string
|
Slug of the target feed |
targetUserId |
string
|
User identifier of the target feed |
options |
object
|
Additional options |
options.activityCopyLimit |
number
|
Limit the amount of activities copied over on follow |
callback |
requestCallback
|
Callback to call on completion |
Promise
:
Promise object
feed.follow('user', '1');
feed.follow('user', '1', callback);
feed.follow('user', '1', options, callback);
validateFeedSlug(targetSlug, targetUserId, callback)
Unfollow the given feed
parameter | type | description |
---|---|---|
targetSlug |
string
|
Slug of the target feed |
targetUserId |
string
|
[description] |
callback |
requestCallback
|
Callback to call on completion |
object
:
XHR request object
feed.unfollow('user', '2', callback);