status-jockey
Incidents response filter for the Statuspage.io Incidents API
Note: Version 2 makes a huge number of breaking changes to the usage of this package. V1 documentation can be found in the wiki
Features
- Makes API calls to the
Status
andManage
APIs at Statuspage.io. See more information comparing these two APIs here - Can filter and manipulate the response based on the following criteria:
filterByStatus
: only include incidents which match specific statuses.customFilter
: only include incidents which match a provided filter functionmaps
: map an incident datum to a new keykeys
: only include specific keys (including keys generated bymaps
)
- Returns
Promise
from axios-based fetch - Function imports optimized for tree shaking for minimized browser use in Webpack.
Installation
yarn add status-jockey# OR npm install status-jockey
Usage
Configuration
const config = // only return incidents with the following statuses. // Otherwise, return all. filterByStatus: "investigating" "completed" // Only return incidents which return true for a filter function backfilled // Maps incident values to custom key values. maps: // can map each entry to a new key based on a string identifying old key title: "name" incident_link: "shortlink" // or based on a function which takes the incident item object incident_updates0body { } { const body = incident_updates0body; return body && body ? body : ; } // Only return the following keys for each incident // Non-mapped keys are given their default values. keys: "id" "most_recent_message" "incident_link" "created_at" "status" "hashtags" };
statusApi
: Public Status API (v2)
statusApi(config) -> statusApiFetcher({ page_id, type, limit })
page_id
(required): Queries the incidents of the corresponding statuspage.io page id.type
(optional): Queries one.json
files specified in the Statuspage public API (default:incidents
)components
incidents
incidents/unresolved
incidents/unresolved
scheduled-maintenances
scheduled-maintenances/upcoming
scheduled-maintenances/active
limit
(optional): Limits to the X most recent incidents in response (default: no limit).
const config = // your configuration const statusApi = ;const fetchStatusApi = ;
manageApi
: Manage API (v1)
manageApi(config) -> manageApiFetcher({ page_id, type, limit })
page_id
(required): Queries the incidents of the corresponding statuspage.io page id.type
(optional): Queriesscheduled
,unresolved
, orincidents
(default:incidents
)limit
(optional): Limits to the X most recent incidents in response (default: no limit).
const config = // your configuration const manageApi = ; const key = '1234567890' // SECRET Statuspage.io API key goes hereconst fetchManageApi = =
incidentsFilter
If you would like to fetch the data yourself but utilize the status-jockey
response filters. This is useful if would like to exclude axios from your browser package.
Example (pre-Webpacked JS)
const config = // your configuration const filterIncidents = ; $