How to get to know the number of posts of any user?

I need to show the number of posts, how to detect that?

@kmayatwal For your question about displaying the number of posts, we’d like to inquire further about your use case to provide the most suitable recommendation. Are you looking to retrieve all posts by a user ID from all communities, get posts from a user feed, or is there another specific use case you have in mind? This information will help us guide you more effectively.

I’ve below image in which we’re showing posts along with followers and following, so i need number of posts of the user

In this scenario, we recommend utilizing webhooks to capture any post creation events. This approach enables you to filter and tally posts based on user ID and other available fields.

Webhook: Amity API

Alternatively, you could query posts and implement pagination to count posts based on targetId and targetType.

Docs: Query Post | Amity Docs

i just need the total number of posts users created so far, i don’t need live count of that.
can you suggest something else

If that is the case, we would recommend the solution #2