Release notes v0.4.35: Search posts and load posts shared in child contexts

·
Baptiste
·kjzl6cwe1jw1-j14q9a04i3gi

I updated the getPosts function the SDK to allow two new features:

  • Search posts using the term parameter
  • Load posts shared in child contexts + main contexts using the include_child_contexts parameter
  • New limit parameter to change the number of posts returned

The child contexts is a feature that we are testing internally which will be released in the dashboard very soon which give developers to the ability to have child contexts for a parent context which can be useful to have different social spaces with different access rules. Imagine for example that you are building a decentralized forum on top of Orbis, you could have a context as the master context for the forum as well as child contexts with different access rules with their own set of posts.

Here are examples to cover those new features:

Searching posts with the term "forum" shared in a specific context as well as its children:

let { data, error } = await orbis.getPosts({  
   context: <CONTEXT_ID>,  
   include_child_contexts: true,  
   term: "forum"  
});  

Returning only 10 posts from a query:

/** In this example the 0 parameter is the 'page' and 10 the 'limit' (number of posts returned) */  
let { data, error } = await orbis.getPosts(  
   {  
      context: <CONTEXT_ID>  
   },   
   0,  
   10  
);  

Let me know if you have any questions about this!

Be the first to leave a comment here.