Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lassejlv/instatus.js
A simple Node.js module for interacting with the Instatus API.
https://github.com/lassejlv/instatus.js
Last synced: about 2 months ago
JSON representation
A simple Node.js module for interacting with the Instatus API.
- Host: GitHub
- URL: https://github.com/lassejlv/instatus.js
- Owner: lassejlv
- Created: 2023-06-28T16:04:06.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-06-28T23:01:47.000Z (over 1 year ago)
- Last Synced: 2024-09-19T01:49:18.327Z (4 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Instatus.js
A simple and easy to use wrapper for the Instatus API.
# Creating your client
```js
const { InstatusClient } = require("instatus.js");
const client = new InstatusClient({
apiKey: "", // head to https://dashboard.instatus.com/developer to get your API key
apiVersion: "v1", // optional, defaults to v1
pageId: "", // optional, defaults to null. but use .getPages() to get your page ID
});
```# Get pages
```js
(async () => {
const getPages = await client.getPages();console.log(getPages);
// returns an array of pages
})();
```# Get components
```js
(async () => {
const getComponents = await client.getComponents(); // this uses the pageId from the clientconsole.log(getComponents);
// returns an array of components
})();
```# Get a specific component
```js
(async () => {
const getComponent = await client.getComponent(""); // this uses the pageId from the client, and use .getComponents() to get your component IDconsole.log(getComponent);
// returns a component
})();
```# Get incidents
```js
(async () => {
const getIncidents = await client.getIncidents(); // this uses the pageId from the clientconsole.log(getIncidents);
// returns an array of incidents
})();
```# Get a specific incident
```js
(async () => {
const getIncident = await client.getIncident(""); // this uses the pageId from the client, and use .getIncidents() to get your incident IDconsole.log(getIncident);
// returns an incident
})();
```# Create an incident
```js
(async () => {
const createIncident = await client.createIncident({
name: "Incident name",
status: "investigating", // can be investigating, identified, monitoring, resolved
message: "Incident message",
components: [""], // optional, defaults to null
}); // this uses the pageId from the clientconsole.log(createIncident);
// returns the created incident
})();
```# Get user profile
```js
(async () => {
const getUserProfile = await client.getUserProfile();console.log(getUserProfile);
// returns the user profile
})();
```# Get subscribers
```js
(async () => {
const getSubscribers = await client.getSubscribers(); // this uses the pageId from the clientconsole.log(getSubscribers);
// returns an array of subscribers
})();
```# Add a subscriber
```js
(async () => {
const addSubscriber = await client.addSubscriber({
email: "[email protected]", // the email of the subscriber
all: true,
autoConfirm: false, // set to true to skip confirmation emails (paid feature), visit https://instatus.com/pricing for more info
}); // this uses the pageId from the clientconsole.log(addSubscriber);
})();
```# Delete a subscriber
```js
(async () => {
const removeSubscriber = await client.deleteSubscriber(""); // this uses the pageId from the client, and use .getSubscribers() to get your subscriber IDconsole.log(removeSubscriber);
})();
```# Get teammates
```js
(async () => {
const getTeammates = await client.getTeammates(); // this uses the pageId from the clientconsole.log(getTeammates);
// returns an array of teammates
})();
```# Add a teammate
```js
(async () => {
const addTeammate = await client.addTeammate({
email: "[email protected]", // the email of the teammate
}); // this uses the pageId from the clientconsole.log(addTeammate);
})();
```# Remove a teammate
```js
(async () => {
const removeTeammate = await client.deleteTeammate(""); // this uses the pageId from the client, and use .getTeammates() to get your teammate IDconsole.log(removeTeammate);
})();
```