teralytic

1.1.0-dev.14 • Public • Published

teralytic

teralytic - JavaScript client for teralytic The Teralytic API allows clients to manage their organization, view their fields and and probes, and query sensor readings and analytics. For sandbox testing you may use the api key: swagger.teralytic.io This SDK is automatically generated by the Swagger Codegen project:

  • API version: 1.1.0
  • Package version: 1.1.0-dev.14
  • Build package: io.swagger.codegen.languages.JavascriptClientCodegen

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 teralytic --save
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

Finally, switch to the directory you want to use your teralytic from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

You should now be able to require('teralytic') in javascript files from the directory you ran the last command above from.

git

If the library is hosted at a git repository, e.g. https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

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, that's to say your javascript file where you actually use this library):

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

Please follow the installation instruction and execute the following JS code:

var teralytic = require('teralytic');

var defaultClient = teralytic.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
var ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix['x-api-key'] = "Token"

// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = "YOUR ACCESS TOKEN"

var api = new teralytic.OrganizationApi()

var organizationId = "organizationId_example"; // {String} id of Organization for the operation

var opts = { 
  'application': new teralytic.Application() // {Application} The application to create
};
api.applicationCreate(organizationId, opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Documentation for API Endpoints

All URIs are relative to https://api.teralytic.io/v1

Class Method HTTP request Description
teralytic.OrganizationApi applicationCreate POST /organizations/{organization_id}/applications Create a new organization client with the specified scope
teralytic.OrganizationApi applicationDelete DELETE /organizations/{organization_id}/applications/{application_id} Delete an application api client
teralytic.OrganizationApi applicationList GET /organizations/{organization_id}/applications Get organization applications
teralytic.OrganizationApi fieldGet GET /organizations/{organization_id}/fields/{field_id} List single Field details associated with Field id provided (from set of Fields associated with the organization)
teralytic.OrganizationApi fieldList GET /organizations/{organization_id}/fields List all Fields associated with an organization
teralytic.OrganizationApi organizationGet GET /organizations/{organization_id} Get a specific organization
teralytic.OrganizationApi organizationList GET /organizations List all Organizations
teralytic.OrganizationApi probeGet GET /organizations/{organization_id}/probes/{probe_id} List single Probe details associated with Probe id provided (from set of Fields associated with the account key)
teralytic.OrganizationApi probeList GET /organizations/{organization_id}/probes List all Probes associated with an organization
teralytic.SoilsApi query GET /soils Query the soildb
teralytic.TelemetryApi analyticsQuery GET /organizations/{organization_id}/analytics Query reading anlaytics
teralytic.TelemetryApi readingsQuery GET /organizations/{organization_id}/readings Query sensor readings

Documentation for Models

Documentation for Authorization

ApiKeyAuth

  • Type: API key
  • API key parameter name: x-api-key
  • Location: HTTP header

OAuth2

Readme

Keywords

none

Package Sidebar

Install

npm i teralytic

Weekly Downloads

1

Version

1.1.0-dev.14

License

MIT

Unpacked Size

292 kB

Total Files

96

Last publish

Collaborators

  • djcasson
  • jonthies
  • rodriguise