Desarol / drupal-jsonapi-client

MIT License
18 stars 7 forks source link

Create an easy way to fetch Entity configuration #2

Closed Auspicus closed 5 years ago

Auspicus commented 5 years ago

We want to be able to provide an export like:

import { EntityStorage, GlobalClient } from 'drupal-jsonapi-client'

GlobalClient.baseUrl = 'https://example.com' // point the cannon
GlobalClient.authorization = `Basic ${btoa('username:password')}` // if required

await EntityStorage.fetch()
const Article = EntityStorage.NodeArticle
const article = new Article()
article.title = 'asdf'
article.body.value = '1234'
article.body.format = 'basic_html'
await article.save() // create a new NodeArticle
Auspicus commented 5 years ago

3 will handle this. devour-drupal fetches the resource configuration from the OpenAPI schema definition.