@wral/sdk-alerts
v0.0.1
Published
A Software Development Kit for working with Studio Alerts
Keywords
Readme
sdk-alerts
The sdk-alerts is a JavaScript SDK (Software Development Kit) designed to
simplify interaction with an Alerts API.
Installation
You can install the sdk-alerts
npm install @wral/sdk-alertsUsage
To use the sdk-alerts, you first need to import it into your JavaScript code.
import { createClient } from '@wral/sdk-alerts/v1';Then, you can create a client instance with your configuration:
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:
// List Active Alerts
let alerts = await client.listActiveAlerts();API
createClient(config)
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.
Methods
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 (requiresid)cancelAlert(alertId): cancel an alert
