Get Stories
Get Story
The 'getStory()
' function enables users to retrieve a single by storyId.
The function returns a LiveObject of the story allowing observation of real time updates of the story's properties such as reactions and isSeen
state. Note that to be able to receive changes made remotely it is mandatory to explicitly subscribe to Realtime events.
Here's an explanation of the function parameter:
storyId
: Corresponds to the ID of the story.
Get Active Stories
The 'getActiveStories()
' function within the AmitySDK enables users to query non-expired stories based on a specified target, providing a LiveCollection of stories for seamless playback and browsing. Notably, the AmitySDK supports optimistic story creation, including un-synced stories within the collection. In sorting, priority is accorded to un-synced stories followed by synced ones, with secondary sorting based on the sortOption
. It is important to note that real-time exclusion of expired stories from LiveCollection is not supported.
This function requires two parameters: targetType, targetId.
Here's an explanation of the function parameters:
targetType
: Represents the type of target, currently supporting 'community.'targetId
: Corresponds to the ID of the designated target.sortOption
: Specifies the secondary sorting order for stories within the collection as 'firstCreated' or 'LastCreated.' The default value is 'firstCreated,' organizing stories chronologically based on creation time.
Get Stories by Targets
For optimal user experience, the application may opt to pre-download content for seamless stories playback. The getStoriesByTargets()
function enables retrieval of stories from multiple story targets. This function takes an input as an array of targets
and returns a LiveCollection of only 'SYNCED' stories.
Here's an explanation of the function parameters:
targets
: Represents an array of pairs oftargetType
andtargetId
sortOption
: Represents how the collection should be sorted.
The function can accept a maximum of 10 pairs of targets in the array.
Last updated