Posts Query
Overview
Posts Query API is capable of the following items:
Search all posts on the server that match the criteria
Scoped searching
Post types filtering
Deleted or non-deleted state filtering
Results ordering
Search and Results Behavior
Posts Query API searches all the posts in the database. Any posts that match the criteria will be put into the live collection, regardless of whether it is a parent or a child post.
Posts Query API returns a live collection, with the flattened post objects. The collection can contain parent and child posts, ordered by the sorting criteria.
Use-cases
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
Usage
Create
AmityPostQueryOptions
. You can specify the desired criteria and ordering.Call
postRepository.getPosts()
with the options above.
The supported query post types are video
, image
, file
, liveStream
, poll
and custom
post.
For custom post, follow a namespace like format.
Example: "upstra.customtype
"
Pagination
When querying posts, you cannot set limit
, skip
, after
, first
, before
, and last
parameters. By default, the number of items in each page is 20. To handle pagination to load more posts, refer to Pagination in Live Objects.
Last updated