@onirix/api-client
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

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) => {

    ...

});

Readme

Keywords

none

Package Sidebar

Install

npm i @onirix/api-client

Weekly Downloads

1

Version

1.2.2

License

Propietary

Unpacked Size

784 kB

Total Files

22

Last publish

Collaborators

  • frangaren
  • vifergo
  • onirix_development