Links

Query Post

The Social SDK product includes a powerful Posts Query method that allows users to search for and retrieve posts that match specific criteria. This functionality is useful for a variety of use cases and provides a flexible and customizable approach to managing and displaying content in your app. Furthermore, the result of the method will always return as Live collection.

Use-case Examples

Posts Query API can be useful for the use cases that require flattening the search and results. For example:
  • All posts in a community or user feed
  • Media gallery that shows the list of all images, posted by a user
  • List of all the text posts that are deleted in a community

Query Options

The Posts Query method is capable of retrieving and searching all posts on the server that match the specified criteria, which are:
  • targetId - ID of the community or user respectively.
  • targetType - Type of the target, either a particular community or a user feed.
  • types - available post types are video, image, file, liveStream , poll and custom post. Alternatively, if you don't specify a particular post type, it will return all post types for a specific target.
  • includeDeleted - Deletion filter. When the boolean is set to true, it retrieves both deleted and non-deleted posts. Conversely, when set to false, only non-deleted posts are returned. The default state of the boolean is false. Additionally, it excludes all deleted posts (both soft and hard deleted posts) not owned by the logged-in user. Community moderators have visibility of soft-deleted posts in the community feed, while self-users can see their own soft-deleted posts in their user feed.
  • sortBy - When it is set to "lastCreated", the most recently created posts will appear at the top of the result. Conversely, when the "sortOption" is set to "firstCreated", the earliest created posts will be displayed at the top of the result.
  • feedType - Type of the feed, for possible feedTypes please refer to - Feed Types.
iOS
Android
JavaScript
TypeScript
Flutter
Version 6
Beta (v0.0.1)
In Flutter SDK, supported query post types are "video", "image" and "file".
For custom post, follow a namespace like format. Example: "my.customtype"
Last modified 1mo ago