A Software Development Kit for working with Studio Alerts
npm install @wral/sdk-alertsThe sdk-alerts is a JavaScript SDK (Software Development Kit) designed to
simplify interaction with an Alerts API.
You can install the sdk-alerts
``bash`
npm install @wral/sdk-alerts
To use the sdk-alerts, you first need to import it into your JavaScript code.
`javascript`
import { createClient } from '@wral/sdk-alerts/v1';
Then, you can create a client instance with your configuration:
`javascript
const config = {
baseUrl: 'YOUR_BASE_URL', // Base URL of your API
apiKey: 'YOUR_API_KEY', // API key (if using management endpoints)
};
const client = createClient(config);
`
After creating the client instance, you can use its methods to interact with the
API. Here are some examples:
`javascript`
// List Active Alerts
let alerts = await client.listActiveAlerts();
Creates a new client instance with the provided configuration.
- config: An object containing API configuration parameters:baseUrl
- : The base URL of the API.apiKey
- : The API key to use for authentication (if using management endpoints).
Returns a client instance with methods for interacting with the API.
#### Public
- api: (path, options = {}): fetch wrapper for the API.listActiveAlerts()
- : list active public alertsgetActiveAlert(alertId)
- : get an active alert
#### Private (requires apiKey)listAlerts()
- : list all alertsgetAlert(alertId)
- : get an alertsendAlert(alert)
- : send or update an alert (requires id)cancelAlert(alertId)`: cancel an alert
-