Devo Alerts API Client is a client for Devo Alerts API writed in TypeScript.
- node > 16
- npm > 8
**NOTE:**The clients was developed and test using node v16.15.1 and npm v8.11.0
Use one of those ways to use the Alerts API Client.
Install from npm
npm install --save @devoinc/alerts-api-client
Install from Github
First, install typescript:
npm install --save-dev typescript
Install the client:
npm install --save https://github.com/DevoInc/alerts-api-client
Install from source
- Download the package from the GitHub repository https://github.com/DevoInc/alerts-api-client
- Install the package inside your project
npm install --save /path/to/alerts-api-client
Prior to instantiate the client, you need to create a class which implements the IConfig interface, for example, in this example we create a class called AuthConfig:
import { IConfig } from "@devoinc/alerts-api-client";
const credentials = require('../../.credentials/tapu.json');
export class AuthConfig implements IConfig {
getAuthorization() {
return credentials.token;
}
}
Now you can instantiate the client. In the case that you use async/await:
import { Client } from '@devoinc/alerts-api-client';
// define the url that are you using and the token created.
const url = 'https://api-us.devo.com/alerts';
const authConfig: AuthConfig = new AuthConfig();
// initialize the Client
const client = new Client(authConfig, url);
// get alert
const alertId = 1;
const alert: Alert = await client.get(alertId, true, true);
Or instead of using async/await, you can also use promises:
import { AlertDefinition } from '@devoinc/alerts-api-client';
// define the url that are you using and the token created.
const url = 'https://api-us.devo.com/alerts';
const authConfig: AuthConfig = new AuthConfig();
// initialize the Client
const client = new Client(authConfig, url);
// get alert
const alertId = 1;
client
.get(alertId, true, true)
.then((alert) => {
// do something with the alert
})
.catch((error) => {
console.log(error);
});
- addComments
- deleteComment
- updateComment
- updateComments
- addComment
- getList
- updateStatus
- updateStatusLists
- getListByCriterias
- getListByCriteriasOverview
- getStatistics
- listStatus
- get
- getAlerts
- putAlerts
- postAlerts
- deleteAlerts
- putAlertsBatch
- postAlertsBatch
- putAlertStatus
- setTags
This client has been generated using Nswag.
Nswag is a dotnet library that takes OpenApi documentation from an existing API and builds a typescript client to consume this at your front-end.
If you are going to regenerate this client be sure you firstly had installed at least .net core 3.1 runtime in your local machine.
The documentation of this client is available at GitHub.