statotest-api-requests
TypeScript icon, indicating that this package has built-in type declarations

2.0.3 • Public • Published

Statotest API requests

This library is mainly for restricted usage by company Statotest s.r.o.

It contains almost every API call for different Statotest's APIs - Output API, Input API, Notification API, GetImage API.

Everything is in Typescript => all necessary types of API responses are included.

Whenever you work on a JavaScript/TypeScript project where API requests are send to one of our API's => use this library, for better management of request in the future.

Installation

Standard node module installation.

npm install statotest-api-requests

Or if you are using Yarn

yarn add statotest-api-requests

Usage

Before using any of the requets => set API URLs and Tokens:

import { initAPIVariables } from 'statotest-api-requests/dist/helper'
initAPIVariables(OUTPUT_API_URL, optionalVariables = {});

OUTPUT_API_URL: string,

Object optionalVariables can have these optional values.

API_OUTPUT_EXPORT_TOKEN?: string - for using getExport

FUNCTION_GET_IMAGE?: string - for using getImage

Set method for retrieving authentication (Bearer) token

import { setMethodForRetrievingToken } from 'statotest-api-requests/lib/helper'
setMethodForRetrievingToken(getTokenMethod: () Promise<string> | string); 

getTokenMethod => returns Promise<string> or string

e.g. Browser => returns values stored in localStorage, Cookies...

e.g. Smartphone => retuns value stored in AsyncStorage...

List of self-explanatory methods for almost every endpoint of our API

OutputAPI

Account

Method Endpoint requestFunction
POST Accounts/authenticate authenticate
GET Accounts getAccounts
POST Accounts createAccount
PUT Accounts putAccount
POST Accounts/forgot-password forgotPassword (doesn't work)
POST Accounts/refresh-token refreshToken (doesn't work)
POST Accounts/revoke-token revokeToken (doesn't work)

Company

Method Endpoint requestFunction
POST Company/Get getCompany
POST Company/Add addCompany
POST Company/Upd updateCompany
PUT Company/Rem removeCompany

Permissions Company

Method Endpoint requestFunction
POST PermissionsCompany/getCompUsers getCompanyPermissionsCompanyUsers
POST PermissionsCompany/addCompUser addCompanyPermissionsUser
POST PermissionsCompany/UpdCompUser updateCompanyPermissionsUser
POST PermissionsCompany/remCompUser removeCompanyPermissionsUser

Construction

Method Endpoint requestFunction
POST Constructions/Get getConstructions
POST Constructions/add addConstruction
POST Constructions/rem removeConstruction
POST Constructions/Upd updateConstruction
PUT Constructions/Img/Add addConstructionImages

DataOutput

Method Endpoint requestFunction
POST DataOutput/GetDataType getDataTypes
POST DataOutput/GetMeasure getMeasure
POST DataOutput/ExportData getExport
POST DataOutput/getDataOutputData updateConstruction

DataOutput Types:

const dataOutputTypes = {
    0: "/DataOutput/getdevice",
    1: "/DataOutput/getaccelero",
    2: "/DataOutput/getinclino",
    3: "/DataOutput/getmeteo",
    4: "/DataOutput/getenvironment",
    5: "/DataOutput/getvoltage",
    6: "/DataOutput/getraw",
    7: "/DataOutput/getstate",
    8: "/DataOutput/GetStrain",
    9: "/DataOutput/GetCoordinateLocal",
    10: "/DataOutput/GetCoordinateJTSK",
    99: "/DataOutput/GetUnit",
    100: "/MP/Dev/get",
};

Device

Method Endpoint requestFunction
POST MP/Dev/Get getMeasurePointsDev
POST MP/Dev/add addMeasurePointDev
POST MP/Dev/rem removeMeasurePointDev
POST MP/Dev/GetAvailable getCompanyAvailableDevices
POST Company/Dev/DashBoard getDevicesDashboard
POST Company/Dev/Get getCompanyDevices
POST Company/Dev/GetAvailabel getAllCompaniesAvailableDevices
POST Company/Dev/Reg registerDeviceToComp
POST Company/Dev/UnReg unregisterDeviceFromComp
POST Device/Add postCreateDevice

Measurepoint

Method Endpoint requestFunction
POST MP/get getMeasurePoints
POST MP/add addMeasurePoint
POST MP/rem removeMeasurePoint
POST MP/Upd updateMeasurePoint
POST MP/Img/Add? uploadMeasurePointImage

Updates

Whenever change is needed => write me an email to kramar@statotest.com

License

Proprietary

Readme

Keywords

none

Package Sidebar

Install

npm i statotest-api-requests

Weekly Downloads

87

Version

2.0.3

License

ISC

Unpacked Size

53.8 kB

Total Files

38

Last publish

Collaborators

  • kramar-statotest