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.
Posts Query API can be useful for the use cases that require flattening the search and results. For example:
- 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
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
custompost. Alternatively, if you don't specify a particular post type, it will return all post types for a specific target.
includeDeleted- Deletion filter. By setting the boolean to
true, it will return both deleted and non-deleted posts. On the other hand, if the boolean is set to
false, it will only return non-deleted posts. By default, the boolean is set to
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.
In Flutter SDK, supported query post types are "
image" and "
For custom post, follow a namespace like format. Example: "