Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/arafatamim/rescript-contentful

ReScript bindings for contentful.js
https://github.com/arafatamim/rescript-contentful

bucklescript contentful rescript

Last synced: 4 months ago
JSON representation

ReScript bindings for contentful.js

Awesome Lists containing this project

README

        

# rescript-contentful

[![npm](https://img.shields.io/npm/v/rescript-contentful?color=%23CC3534&logo=npm)](https://www.npmjs.com/package/rescript-contentful)
![npm](https://img.shields.io/npm/dm/rescript-contentful)

ReScript bindings (FFI) for [contentful.js](https://github.com/contentful/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
```rescript
open Contentful

// Create a Contentful client instance
let client = createClient({
accessToken: "",
space: "",
})

// 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](https://github.com/arafatamim/rescript-contentful/blob/main/DOCUMENTATION.md) for a more detailed outline of the API.

## License
MIT Licensed. Full text available in the [LICENSE](https://github.com/arafatamim/rescript-contentful/blob/main/LICENSE) file.