How to convert api response to document?

In my app, I have a page with a list view to display algolia search results. Each element of the list view has a custom component that takes a document parameter.

I realized that because my app is multi-user, the Algolia query “leaks” user data unless I configure a filter/facet on the index.

To solve that issue, I configured the facet on the index in algolia, and created a custom API call using the appropriate secure api key to maintain data security.

The API response is correct now, but I can’t figure out how to convert algolia's JSON response into a list of documents to be used in my list view.

Is there an easy way to do this?

I’ve tried these approaches but am running into errors:
1. Convert api response to document using ‘FromAlgolia’ method from the <collection>Record class
2. Convert api response to document using create<collection>RecordData and getDocumentFromData methods from the <collection>Record class

Has anyone done this successfully? I appreciate any thoughts ideas or solutions.

Thanks!

7 replies