1.2.2 • Published 2 years ago

@onirix/api-client v1.2.2

Weekly downloads
-
License
Propietary
Repository
-
Last release
2 years ago

Onirix API library wrapper

JavaScript wrapper library for Onirix REST API.

Usage from the browser


Using a bundler (Webpack, Rollup):

  1. Install the dependency:
npm install @onirix/api-client
  1. Import and use it within your code:
import OnirixAPI from '@onirix/api-client';
        
const OnirixAPIClient = new OnirixAPI("<token>");

OnirixAPIClient.getProjects().then((projects) => {

    ...

});

Using plain HTML

  1. Include the dependency within the HTML head tag:
<head>
...
    <script src="https://unpkg.com/@onirix/api-client@1.2.0/dist/ox-api.umd.js">
...
</head>
  1. Use it from any other script:
<script>
    const OnirixAPIClient = new OnirixAPI("<token>");
    
    OnirixAPIClient.getProjects().then((projects) => {
    
        ...
    
    });
</script>

Usage from Node.js


As this library uses fetch for http requests, a polyfill (isomorphic-unfetch) is needed when used in a Node environment.

  1. Install dependencies:
npm install @onirix/api-client
npm install isomorphic-unfetch
  1. Import the dependencies and use the library from your code:
import 'isomorphic-unfetch';

import OnirixAPI from '@onirix/api-client';
        
const OnirixAPIClient = new OnirixAPI("<token>");

OnirixAPIClient.getProjects().then((projects) => {

    ...

});