nascentdigital / contentfully

A simple but performant REST client for Contentful.
MIT License
18 stars 7 forks source link

Add functionality to enable Contentful Sync API #45

Closed angelalagao closed 3 years ago

angelalagao commented 3 years ago

The Sync API allows for keeping a local copy of all content in a space up-to-date via delta updates, or content that has changed. To enable delta updates, Contentful provides a synchronization endpoint to the Content Delivery API.

Usage may look something like this, where we can configure synchronization in the contentfully instance.

For example:

const contentfully = new Contentfully(contentfulClient, {
   sync: true
});

Ideally, once sync is enabled, contentfully.getModels({}) should fetch from a synced local store rather than from Contentful directly.

sdedios commented 3 years ago

Offline support is an interesting idea, however keeping a local copy of the full Contentful space would mean that we'd have to implement the full query language locally, which isn't going to be feasible in terms of development effort and ongoing maintenance.

In the meantime, if you need a local copy, I would suggest caching you specific query results.

In the event that this issue is stemming from a need to work around the rate limit issues, then Issue #46 should be exactly what you need.