1.0.3 • Published 4 years ago

elide-jsonapi-client v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Elide JSON API Client

npm npm gzip size code coverage maintainability build status styled with prettier All Contributors license

An opinionated {json:api} client for Elide based APIs

There are already a number of client libraries for working with JSON API, however this library is specifically designed for interacting with Elide based APIs, which has a few of it's own unique characteristics.

Features

  • Built with Typescript!
  • Built on top of axios as a peer dependency
  • Supports Promises and async/await
  • JSON API response normalization
    • Flatter structure
    • Merges included relationship data
  • Serializes normalized resources back to a JSON API structure
    • Dates are converted to Unix epoch time for Elide
    • Protected fields can be omitted from being sent to the API
  • Supports JSON Patch Extension for bulk writes and complex mutations
  • Parameter serialization
    • Fields, filter, include, sort
    • Pagination: size & number OR offset & limit
  • Request caching and throttling

Basic Usage

import ApiClient from 'elide-jsonapi-client'

// Initialize a new client
const api = new ApiClient({
  baseURL: 'http://localhost/api',
})

// Fetch a resource collection
const res = await api.fetch('articles')

// Create a resource
api.create('articles', {
  type: 'articles',
  title: 'Hello World',
})

// Update a resource
api.update('articles/1', {
  id: '1',
  type: 'articles',
  title: 'Hello World!!!',
})

// Remove a resource
api.remove('articles', 1)

Documentation

API Docs

Wiki

Credits

Inspired by Kitsu

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome! See CONTRIBUTING guidelines.

License

MIT

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.9.0

5 years ago

0.8.0

5 years ago

0.7.0

5 years ago

0.6.2

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.4

6 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago