Pins

Overview

Sometimes you'll want to pin your favorite activity to a feed. You can pin an activity like this:

$activityId = 'activity_123';
$feedGroupId = 'user';
$feedId = 'eric';
$response = $feedsClient->pinActivity(
    $feedGroupId,
    $feedId,
    $activityId,
    new GeneratedModels\PinActivityRequest(userID: "eric")
);

When you read a feed pinned activities are automatically returned:

$activityId = 'activity_123';
$feedGroupId = 'user';
$feedId = 'eric';

$response = $feedsClient->unpinActivity(
    $feedGroupId,
    $feedId,
    $activityId,
    'eric'
);

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 activities
  • include_soft_deleted_activities: soft-deleted activities
  • include_expired_activities: expired activities
Warning:

These flags are server-side only. Client-side requests ignore them, and a request that also sets user_id or user is rejected.

$response = $feedsClient->queryPinnedActivities(
    'user',
    'john',
    new GeneratedModels\QueryPinnedActivitiesRequest(
        include_moderated_activities: true,
        include_expired_activities: true,
        limit: 20,
    )
);

GetOrCreateFeed returns pinned activities too (pinned_activities), but does not apply these rules.