Pins
Overview
Sometimes you'll want to pin your favorite activity to a feed. You can pin an activity like this:
PinActivityRequest pinRequest = PinActivityRequest.builder().userID(testUserId).build();
PinActivityResponse response = testFeed.pinActivity(activityId, pinRequest).getData();When you read a feed pinned activities are automatically returned:
UnpinActivityRequest unpinRequest = UnpinActivityRequest.builder().UserID(testUserId).build();
UnpinActivityResponse response = testFeed.unpinActivity(activityId, unpinRequest).getData();Query pinned activities
queryPinnedActivities returns the pinned activities of a feed, with filtering, sorting and pagination. It applies the same read rules as querying activities:
- shadowed and expired activities are returned only to their author
- removed and soft-deleted activities are not returned
- private activities are returned only to their author, and to server-side requests without a user
- activities authored by a user blocked in either direction are not returned
A pin whose activity is hidden is left out of the response, so a page can contain fewer items than limit, or none, while next is still set. Paginate on next, not on the page size.
Server-side requests can pass user_id to read the pins as that user sees them. The feed read permission is still checked as a server-side request.
Server-side requests without a user can include hidden pins:
include_moderated_activities: shadowed and removed activitiesinclude_soft_deleted_activities: soft-deleted activitiesinclude_expired_activities: expired activities
These flags are server-side only. Client-side requests ignore them, and a request that also sets user_id or user is rejected.
const response = await client.feeds.queryPinnedActivities({
feed_group_id: "user",
feed_id: "john",
include_moderated_activities: true,
include_expired_activities: true,
limit: 20,
});
console.log(response.pinned_activities, response.next);GetOrCreateFeed returns pinned activities too (pinned_activities), but does not apply these rules.