Directory

← Back

jsonapi-helpers

Components to communicate with a jsonapi

Author

Rating

Popularity

<100

[ This description is mirrored from README.md at github.com/morbidick/jsonapi-helpers on 2019-05-10 ]

Polymer 2 components to communicate with a jsonapi

Published on webcomponents.org Build Status

Components to communicate with an api, according to the jsonapi spec.

Components

<jsonapi-resource>

Interact with a jsonapi resource endpoint. Items can be fetched, created, updated and deleted.

<jsonapi-resource
  id="getExample"
  api-url="http://example.net"
  resource="books"
  response="{{ my_response }}"
  auto-get
></jsonapi-resource>

<jsonapi-resource
  id="getOneExample"
  api-url="http://example.net"
  resource="books"
  resourceId="1"
  response="{{ my_response }}"
  auto-get
></jsonapi-resource>

<jsonapi-resource
  id="saveExample"
  api-url="http://example.net"
  resource="books"
></jsonapi-resource>
<script>
  let resource = this.$.saveExample;
  resource.data = { title: 'awesome book', author: 'morbidick' };
  resource.save();
</script>

<jsonapi-settings>

Set api settings once globally. For now they can't be overwritten on the jsonapi-resource element.

<jsonapi-settings
  api-url="http://example.net"
></jsonapi-settings>

<jsonapi-resource
  resource="books"
  response="{{ my_response }}"
  auto-get
></jsonapi-resource>

<jsonapi-error-toast>

"Singleton Element" to display a toast with the error details if any <jsonapi-resource> on the site encounters an error.

<jsonapi-error-toast></jsonapi-error-toast>
<jsonapi-resource
  resource="undefined_endpoint"
  auto-get
></jsonapi-resource>

Development

# Get dependencies
$ npm install

# Demo site
$ npm start

# Run tests
$ npm test

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Dependencies

  • polymer#Polymer/polymer#^2.0.0
  • paper-toast#PolymerElements/paper-toast#^2.0.0
  • paper-tooltip#PolymerElements/paper-tooltip#^2.0.0
  • iron-icons#PolymerElements/iron-icons#^2.0.0
Released
2017-11-08
Maturity
IMPORTED
License
MIT License

Compatibility

Framework
Polymer 2.0+
Browser
Browser Independent

jsonapi-helpers - Vaadin Add-on Directory

Components to communicate with a jsonapi jsonapi-helpers - Vaadin Add-on Directory
**[ This description is mirrored from README.md at [github.com/morbidick/jsonapi-helpers](https://github.com//morbidick/jsonapi-helpers/blob/2.1.0/README.md) on 2019-05-10 ]** # Polymer 2 components to communicate with a jsonapi [![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/morbidick/jsonapi-helpers) [![Build Status](https://travis-ci.org/morbidick/jsonapi-helpers.svg?branch=master)](https://travis-ci.org/morbidick/jsonapi-helpers) Components to communicate with an api, according to the [jsonapi spec](http://jsonapi.org/format/). ## Components ### \ Interact with a jsonapi resource endpoint. Items can be **fetched**, **created**, **updated** and **deleted**. ```html ``` ### \ Set api settings once globally. For now they can't be overwritten on the `jsonapi-resource` element. ```html ``` ### \ "Singleton Element" to display a toast with the error details if any `` on the site encounters an error. ```html ``` ## Development ```bash # Get dependencies $ npm install # Demo site $ npm start # Run tests $ npm test ```
Online