Skip to content

Instantly share code, notes, and snippets.

@nparsons08 nparsons08/enrichment.js Secret
Created Nov 8, 2019

Embed
What would you like to do?
// instantiate a new client (server side)
var streamClient = stream.connect(config.stream.key, config.stream.secret);
// instantiate a feed using feed class 'timeline_flat' and user id from params
var timelineFlatFeed = streamClient.feed('timeline_flat', params.user_id);
// get activities from stream
timelineFlatFeed.get()
.then(function(stream) {
// length of activity results
var ln = stream.results.length;
// exit if length is zero
if (!ln) {
res.send(204);
return next();
}
// enrich the activities
var references = streamUtils.referencesFromActivities(stream.results);
streamUtils.loadReferencedObjects(references, params.user_id, function(referencedObjects) {
streamUtils.enrichActivities(stream.results, referencedObjects);
cb(null, stream.results);
});
})
.catch(function(error) {
cb(error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.