rescript-contentful
v3.0.0
Published
ReScript bindings for Contentful
Downloads
12
Maintainers
Readme
rescript-contentful
ReScript bindings (FFI) for contentful.js, the JavaScript library for interacting with Contentful's Delivery API.
Installation
Run npm install rescript-contentful contentful
, and then update the bs-dependencies
key in your rescript.json
file to include "rescript-contentful".
Usage
open Contentful
// Create a Contentful client instance
let client = createClient({
accessToken: "<ACCESS_TOKEN>",
space: "<SPACE_ID>",
})
// Fetch an entry
// client is piped to the first
// argument of the function
client
->getEntry(id)
->Promise.then(entry => { /* do something */ })
// Fetch an asset
client
->getAsset(id, ())
->Promise.then(asset => { /* do something */ })
See DOCUMENTATION.md for a more detailed outline of the API.
License
MIT Licensed. Full text available in the LICENSE file.