orbis.getPosts()
Returns an array of posts
.
How to use?
let { data, error } = await orbis.getPosts();
Parameters
options
: JSON object containing the filters you can use in this query:context
:string
Context for which you want to retrieve the postsdid
:string
Retrieving posts shared by a specific usermaster
:string
When quering the comments under a parent postalgorithm
:string
Returns an ordered list of posts shared in the global feed. Can be one of those:recommendations
: Posts shared by users being followed by the connected user or on which they reacted.all-posts
: Returns all the posts shared by users with an active wallet.all-posts-non-filtered
: Returns all the posts shared by users (not filtered with wallet activity).page
:int
Is0
by default, increment this to retrieve additional posts
Examples
/** To query the posts from a specific context */
orbis.getPosts({ context: "k..." });
/** To query the comments under a post */
orbis.getPosts({ master: "k..." });
/** To query the posts shared by a specific did */
orbis.getPosts({ did: "did:pkh:..." });
/** To query the posts shared on the global feed */
orbis.getPosts({ algorithm: "recommendations" });
Returns
[
{
stream_id: "kjzl6cwe1...e4wvxhiqj",
creator: "did:pkh:...",
creator_details: {
did: "did:pkh:...",
profile: {
username: "Baptiste",
pfp: "https://..."
}
},
content: {
body: "Content of the post itself",
...
},
context: null,
context_details: {
group_id: "...",
group_details: {
...
},
channel_id: "...",
channel_details: {
...
},
},
master: "k...",
reply_to: "k...",
reply_to_details: {
body: "Parent post being replied to...",
...
},
count_likes: 0,
count_haha: 0,
count_downvotes: 0,
count_replies: 0
},
...
]
Next steps
Explore other parts of the API.