social.plus SDK provides powerful story retrieval capabilities for building engaging story feeds, viewers, and analytics dashboards. Access individual stories, active story collections, and multi-target story feeds with real-time updates and optimized playback support.

Single Story Retrieval

Get individual stories by ID with live object updates

Active Story Collections

Retrieve non-expired stories with optimistic creation support

Multi-Target Queries

Fetch stories from multiple communities simultaneously

Real-time Updates

Live synchronization of story states, reactions, and view counts
All story retrieval functions return Live Objects or Live Collections that automatically update when subscribed to Real-time Events, ensuring your app stays current with the latest story interactions.

Get Single Story

The getStory() function retrieves individual stories by ID, returning a Live Object that observes real-time updates including reactions, view states, and other dynamic properties.

Parameters

ParameterTypeRequiredDescription
storyIdStringYesUnique identifier of the story to retrieve
token = storyRepository.getStory(storyId: "story-id").observe({ object, error in
    // Handle story live object here.
})

Get Active Stories

The getActiveStories() function retrieves non-expired stories for a specific target, providing a Live Collection optimized for story feed implementation with optimistic creation support.

Parameters

ParameterTypeRequiredDescription
targetTypeEnumYesType of target (currently supports .community)
targetIdStringYesID of the target community
sortOptionEnumNoSorting order: .firstCreated or .lastCreated (default: .firstCreated)
Real-time exclusion of expired stories from Live Collections is not supported. Stories will remain in the collection until the next refresh or manual query.
token = storyRepository.getActiveStoriesByTarget(targetType: .community, targetId: "targetId", sortOption: .firstCreated).observe({ collection, _, error in
    if let error {
        print(error)
        return
    }
    
    for story in collection.snapshots {
        // Get list of story in the collection
        print(story)
    }
})

Get Stories by Targets

The getStoriesByTargets() function enables retrieval of stories from multiple communities simultaneously, perfect for pre-downloading content and building comprehensive story feeds.

Parameters

ParameterTypeRequiredDescription
targetsArrayYesArray of target pairs (max 10 targets)
sortOptionEnumNoSorting order across all targets

Target Configuration

  • Maximum Targets: Up to 10 target pairs per request
  • Target Format: Pairs of targetType and targetId
  • Story Filter: Returns only SYNCED stories (excludes optimistic stories)
  • Cross-Target Sorting: Stories sorted across all targets by specified option
let firstTarget = StoryTargetSearchInfo(targetType: .community, targetId: "targetId-1")
let secondTarget = StoryTargetSearchInfo(targetType: .community, targetId: "targetId-2")

token = storyRepository.getStoriesByTargets(targets: [firstTarget, secondTarget], sortOption: .firstCreated).observe({ collection, change, error in
    // Handle list of stories here.
})