0.37.10 • Published 3 years ago

@influxenergydata/cloud-service v0.37.10

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

@influxenergydata/cloud-service

This document outlines all the public APIs that Influx provides for 3rd-party intergration.

Installation

For Node.js

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install @influxenergydata/cloud-service --save

Finally, you need to build the module:

npm run build
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

To use the link you just defined in your project, switch to the directory you want to use your cloud-service-uat from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

Finally, you need to build the module:

npm run build

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

var influx = require('@influxenergydata/cloud-service');

// authenticate user
var usernamePassword = new influx.restApis.UsernamePassword("username", "password"); 
const { policy } = await influx.login(usernamePassword);

// subscribe to a particular notification type e.g. 'discoreco' 
await influx.addNotificationHandler('discoreco', (data) => {
  console.log(`Receiving data ${data}`);
});

// example of calling rest apis
var discorecoApi = new influx.restApis.DiscorecoApi();
const resp = await discorecoApi.getMetersByIcp("organization", "icp", policy);
console.log(resp);
1.1.1

3 years ago

0.37.10

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

0.37.9

3 years ago

0.37.5

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.1

3 years ago