updown.io 3.4.7 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/Endpoints.d.ts +7 -0
- package/dist/Endpoints.js +20 -7
- package/dist/UpdownIO.js +6 -1
- package/dist/api/ChecksAPI.d.ts +1 -0
- package/dist/api/ChecksAPI.js +22 -4
- package/dist/api/NodesAPI.d.ts +2 -0
- package/dist/api/NodesAPI.js +8 -0
- package/dist/api/RecipientsAPI.d.ts +17 -0
- package/dist/api/RecipientsAPI.js +50 -0
- package/dist/api/StatusPagesAPI.d.ts +19 -0
- package/dist/api/StatusPagesAPI.js +58 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +2 -0
- package/dist/interfaces/API.d.ts +3 -1
- package/dist/interfaces/Check.d.ts +15 -2
- package/dist/interfaces/Downtime.d.ts +4 -1
- package/dist/interfaces/Metrics.d.ts +1 -0
- package/dist/interfaces/Options.d.ts +40 -0
- package/dist/interfaces/Recipient.d.ts +8 -0
- package/dist/interfaces/Recipient.js +2 -0
- package/dist/interfaces/StatusPage.d.ts +10 -0
- package/dist/interfaces/StatusPage.js +2 -0
- package/dist/interfaces/index.d.ts +2 -0
- package/dist/interfaces/index.js +2 -0
- package/package.json +13 -7
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# updown.io [](https://www.npmjs.com/package/updown.io)
|
|
2
2
|
|
|
3
|
-
An [updown.io](https://updown.io) API client. For a documentation on the API see https://updown.io/api
|
|
3
|
+
An [updown.io](https://updown.io) API client. For a documentation on the API see [the updown.io API reference](https://updown.io/api/).
|
|
4
4
|
|
|
5
5
|
### Installation
|
|
6
6
|
|
package/dist/Endpoints.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const Endpoint: {
|
|
2
|
+
API: string;
|
|
2
3
|
CHECKS: string;
|
|
3
4
|
Checks: {
|
|
4
5
|
check(token: string): string;
|
|
@@ -7,13 +8,19 @@ export declare const Endpoint: {
|
|
|
7
8
|
};
|
|
8
9
|
checks(token?: string): string;
|
|
9
10
|
DOWNTIMES: string;
|
|
11
|
+
IPS: string;
|
|
10
12
|
IPV4: string;
|
|
11
13
|
IPV6: string;
|
|
12
14
|
METRICS: string;
|
|
13
15
|
NODES: string;
|
|
14
16
|
Nodes: {
|
|
17
|
+
ips(): string;
|
|
15
18
|
ipv4(): string;
|
|
16
19
|
ipv6(): string;
|
|
17
20
|
};
|
|
18
21
|
nodes(): string;
|
|
22
|
+
RECIPIENTS: string;
|
|
23
|
+
recipients(id?: string): string;
|
|
24
|
+
STATUS_PAGES: string;
|
|
25
|
+
statusPages(token?: string): string;
|
|
19
26
|
};
|
package/dist/Endpoints.js
CHANGED
|
@@ -3,35 +3,48 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Endpoint = void 0;
|
|
4
4
|
const encode = encodeURIComponent;
|
|
5
5
|
exports.Endpoint = {
|
|
6
|
+
API: 'api',
|
|
6
7
|
CHECKS: 'checks',
|
|
7
8
|
Checks: {
|
|
8
9
|
check(token) {
|
|
9
|
-
return `/${exports.Endpoint.CHECKS}/${encode(token)}/`;
|
|
10
|
+
return `/${exports.Endpoint.API}/${exports.Endpoint.CHECKS}/${encode(token)}/`;
|
|
10
11
|
},
|
|
11
12
|
downtimes(token) {
|
|
12
|
-
return `/${exports.Endpoint.CHECKS}/${encode(token)}/${exports.Endpoint.DOWNTIMES}/`;
|
|
13
|
+
return `/${exports.Endpoint.API}/${exports.Endpoint.CHECKS}/${encode(token)}/${exports.Endpoint.DOWNTIMES}/`;
|
|
13
14
|
},
|
|
14
15
|
metrics(token) {
|
|
15
|
-
return `/${exports.Endpoint.CHECKS}/${encode(token)}/${exports.Endpoint.METRICS}/`;
|
|
16
|
+
return `/${exports.Endpoint.API}/${exports.Endpoint.CHECKS}/${encode(token)}/${exports.Endpoint.METRICS}/`;
|
|
16
17
|
},
|
|
17
18
|
},
|
|
18
19
|
checks(token) {
|
|
19
|
-
return `/${exports.Endpoint.CHECKS}/${token ? `${encode(token)}/` : ''}`;
|
|
20
|
+
return `/${exports.Endpoint.API}/${exports.Endpoint.CHECKS}/${token ? `${encode(token)}/` : ''}`;
|
|
20
21
|
},
|
|
21
22
|
DOWNTIMES: 'downtimes',
|
|
23
|
+
IPS: 'ips',
|
|
22
24
|
IPV4: 'ipv4',
|
|
23
25
|
IPV6: 'ipv6',
|
|
24
26
|
METRICS: 'metrics',
|
|
25
27
|
NODES: 'nodes',
|
|
26
28
|
Nodes: {
|
|
29
|
+
ips() {
|
|
30
|
+
return `/${exports.Endpoint.API}/${exports.Endpoint.NODES}/${exports.Endpoint.IPS}/`;
|
|
31
|
+
},
|
|
27
32
|
ipv4() {
|
|
28
|
-
return `/${exports.Endpoint.NODES}/${exports.Endpoint.IPV4}/`;
|
|
33
|
+
return `/${exports.Endpoint.API}/${exports.Endpoint.NODES}/${exports.Endpoint.IPV4}/`;
|
|
29
34
|
},
|
|
30
35
|
ipv6() {
|
|
31
|
-
return `/${exports.Endpoint.NODES}/${exports.Endpoint.IPV6}/`;
|
|
36
|
+
return `/${exports.Endpoint.API}/${exports.Endpoint.NODES}/${exports.Endpoint.IPV6}/`;
|
|
32
37
|
},
|
|
33
38
|
},
|
|
34
39
|
nodes() {
|
|
35
|
-
return `/${exports.Endpoint.NODES}/`;
|
|
40
|
+
return `/${exports.Endpoint.API}/${exports.Endpoint.NODES}/`;
|
|
41
|
+
},
|
|
42
|
+
RECIPIENTS: 'recipients',
|
|
43
|
+
recipients(id) {
|
|
44
|
+
return `/${exports.Endpoint.API}/${exports.Endpoint.RECIPIENTS}/${id ? `${encode(id)}/` : ''}`;
|
|
45
|
+
},
|
|
46
|
+
STATUS_PAGES: 'status_pages',
|
|
47
|
+
statusPages(token) {
|
|
48
|
+
return `/${exports.Endpoint.API}/${exports.Endpoint.STATUS_PAGES}/${token ? `${encode(token)}/` : ''}`;
|
|
36
49
|
},
|
|
37
50
|
};
|
package/dist/UpdownIO.js
CHANGED
|
@@ -5,15 +5,18 @@ const api_client_1 = require("@ffflorian/api-client");
|
|
|
5
5
|
const api_1 = require("./api");
|
|
6
6
|
class UpdownIO {
|
|
7
7
|
constructor(options) {
|
|
8
|
+
var _a;
|
|
8
9
|
if (typeof options === 'string') {
|
|
9
10
|
options = { apiKey: options };
|
|
10
11
|
}
|
|
11
|
-
this.apiClient = new api_client_1.APIClient('https://updown.io
|
|
12
|
+
this.apiClient = new api_client_1.APIClient((_a = options === null || options === void 0 ? void 0 : options.apiUrl) !== null && _a !== void 0 ? _a : 'https://updown.io', {
|
|
12
13
|
headers: Object.assign({}, ((options === null || options === void 0 ? void 0 : options.apiKey) && { 'X-API-KEY': options.apiKey })),
|
|
13
14
|
});
|
|
14
15
|
this.api = {
|
|
15
16
|
checks: new api_1.ChecksAPI(this.apiClient),
|
|
16
17
|
nodes: new api_1.NodesAPI(this.apiClient),
|
|
18
|
+
recipients: new api_1.RecipientsAPI(this.apiClient),
|
|
19
|
+
statusPages: new api_1.StatusPagesAPI(this.apiClient),
|
|
17
20
|
};
|
|
18
21
|
}
|
|
19
22
|
/**
|
|
@@ -23,6 +26,8 @@ class UpdownIO {
|
|
|
23
26
|
setApiUrl(newURL) {
|
|
24
27
|
this.api.checks.setApiUrl(newURL);
|
|
25
28
|
this.api.nodes.setApiUrl(newURL);
|
|
29
|
+
this.api.recipients.setApiUrl(newURL);
|
|
30
|
+
this.api.statusPages.setApiUrl(newURL);
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
33
|
exports.UpdownIO = UpdownIO;
|
package/dist/api/ChecksAPI.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { Check, CheckOptions, Deleted, Downtime, Metrics, MetricsOptions }
|
|
|
3
3
|
export declare class ChecksAPI {
|
|
4
4
|
private readonly apiClient;
|
|
5
5
|
constructor(apiClient: APIClient);
|
|
6
|
+
private static mapCheckOptions;
|
|
6
7
|
/**
|
|
7
8
|
* Add a new check.
|
|
8
9
|
* @param url The URL you want to monitor.
|
package/dist/api/ChecksAPI.js
CHANGED
|
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
23
|
exports.ChecksAPI = void 0;
|
|
13
24
|
const Endpoints_1 = require("../Endpoints");
|
|
@@ -15,6 +26,13 @@ class ChecksAPI {
|
|
|
15
26
|
constructor(apiClient) {
|
|
16
27
|
this.apiClient = apiClient;
|
|
17
28
|
}
|
|
29
|
+
static mapCheckOptions(options) {
|
|
30
|
+
if (!options) {
|
|
31
|
+
return {};
|
|
32
|
+
}
|
|
33
|
+
const { customHeaders, disabledLocations } = options, rest = __rest(options, ["customHeaders", "disabledLocations"]);
|
|
34
|
+
return Object.assign(Object.assign(Object.assign({}, rest), (customHeaders && { custom_headers: customHeaders })), (disabledLocations && { disabled_locations: disabledLocations }));
|
|
35
|
+
}
|
|
18
36
|
/**
|
|
19
37
|
* Add a new check.
|
|
20
38
|
* @param url The URL you want to monitor.
|
|
@@ -23,7 +41,7 @@ class ChecksAPI {
|
|
|
23
41
|
addCheck(url, options) {
|
|
24
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
43
|
const endpoint = Endpoints_1.Endpoint.checks();
|
|
26
|
-
const params = Object.assign({ url }, options);
|
|
44
|
+
const params = Object.assign({ url }, ChecksAPI.mapCheckOptions(options));
|
|
27
45
|
const { data } = yield this.apiClient.post(endpoint, params);
|
|
28
46
|
return data;
|
|
29
47
|
});
|
|
@@ -47,7 +65,7 @@ class ChecksAPI {
|
|
|
47
65
|
getCheck(token, metrics) {
|
|
48
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
67
|
const endpoint = Endpoints_1.Endpoint.Checks.check(token);
|
|
50
|
-
const { data } = yield this.apiClient.get(endpoint, {
|
|
68
|
+
const { data } = yield this.apiClient.get(endpoint, { params: { metrics } });
|
|
51
69
|
return data;
|
|
52
70
|
});
|
|
53
71
|
}
|
|
@@ -85,7 +103,7 @@ class ChecksAPI {
|
|
|
85
103
|
*/
|
|
86
104
|
getMetrics(token, options) {
|
|
87
105
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
const endpoint = Endpoints_1.Endpoint.Checks.
|
|
106
|
+
const endpoint = Endpoints_1.Endpoint.Checks.metrics(token);
|
|
89
107
|
const { data } = yield this.apiClient.get(endpoint, { params: options });
|
|
90
108
|
return data;
|
|
91
109
|
});
|
|
@@ -105,7 +123,7 @@ class ChecksAPI {
|
|
|
105
123
|
updateCheck(token, options) {
|
|
106
124
|
return __awaiter(this, void 0, void 0, function* () {
|
|
107
125
|
const endpoint = Endpoints_1.Endpoint.checks(token);
|
|
108
|
-
const { data } = yield this.apiClient.put(endpoint, options);
|
|
126
|
+
const { data } = yield this.apiClient.put(endpoint, ChecksAPI.mapCheckOptions(options));
|
|
109
127
|
return data;
|
|
110
128
|
});
|
|
111
129
|
}
|
package/dist/api/NodesAPI.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export declare class NodesAPI {
|
|
|
4
4
|
private readonly apiClient;
|
|
5
5
|
constructor(apiClient: APIClient);
|
|
6
6
|
/** List all updown.io monitoring nodes IPv4 addresses. */
|
|
7
|
+
getIps(): Promise<string[]>;
|
|
8
|
+
/** List all updown.io monitoring nodes IPv4 addresses. */
|
|
7
9
|
getIpv4Nodes(): Promise<string[]>;
|
|
8
10
|
/** List all updown.io monitoring nodes IPv6 addresses. */
|
|
9
11
|
getIpv6Nodes(): Promise<string[]>;
|
package/dist/api/NodesAPI.js
CHANGED
|
@@ -16,6 +16,14 @@ class NodesAPI {
|
|
|
16
16
|
this.apiClient = apiClient;
|
|
17
17
|
}
|
|
18
18
|
/** List all updown.io monitoring nodes IPv4 addresses. */
|
|
19
|
+
getIps() {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const endpoint = Endpoints_1.Endpoint.Nodes.ips();
|
|
22
|
+
const { data } = yield this.apiClient.get(endpoint);
|
|
23
|
+
return data;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** List all updown.io monitoring nodes IPv4 addresses. */
|
|
19
27
|
getIpv4Nodes() {
|
|
20
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
29
|
const endpoint = Endpoints_1.Endpoint.Nodes.ipv4();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { APIClient } from '@ffflorian/api-client';
|
|
2
|
+
import type { Deleted, Recipient, RecipientOptions } from '../interfaces';
|
|
3
|
+
export declare class RecipientsAPI {
|
|
4
|
+
private readonly apiClient;
|
|
5
|
+
constructor(apiClient: APIClient);
|
|
6
|
+
/** Add a new recipient. */
|
|
7
|
+
addRecipient(options: RecipientOptions): Promise<Recipient>;
|
|
8
|
+
/** Delete a recipient. */
|
|
9
|
+
deleteRecipient(id: string): Promise<Deleted>;
|
|
10
|
+
/** List all possible alert recipients/channels on your account. */
|
|
11
|
+
getRecipients(): Promise<Recipient[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Set a new API URL.
|
|
14
|
+
* @param newURL The new API url
|
|
15
|
+
*/
|
|
16
|
+
setApiUrl(newURL: string): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RecipientsAPI = void 0;
|
|
13
|
+
const Endpoints_1 = require("../Endpoints");
|
|
14
|
+
class RecipientsAPI {
|
|
15
|
+
constructor(apiClient) {
|
|
16
|
+
this.apiClient = apiClient;
|
|
17
|
+
}
|
|
18
|
+
/** Add a new recipient. */
|
|
19
|
+
addRecipient(options) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const endpoint = Endpoints_1.Endpoint.recipients();
|
|
22
|
+
const { data } = yield this.apiClient.post(endpoint, options);
|
|
23
|
+
return data;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** Delete a recipient. */
|
|
27
|
+
deleteRecipient(id) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const endpoint = Endpoints_1.Endpoint.recipients(id);
|
|
30
|
+
const { data } = yield this.apiClient.delete(endpoint);
|
|
31
|
+
return data;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/** List all possible alert recipients/channels on your account. */
|
|
35
|
+
getRecipients() {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const endpoint = Endpoints_1.Endpoint.recipients();
|
|
38
|
+
const { data } = yield this.apiClient.get(endpoint);
|
|
39
|
+
return data;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Set a new API URL.
|
|
44
|
+
* @param newURL The new API url
|
|
45
|
+
*/
|
|
46
|
+
setApiUrl(newURL) {
|
|
47
|
+
this.apiClient.setBaseURL(newURL);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.RecipientsAPI = RecipientsAPI;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { APIClient } from '@ffflorian/api-client';
|
|
2
|
+
import type { Deleted, StatusPage, StatusPageOptions } from '../interfaces';
|
|
3
|
+
export declare class StatusPagesAPI {
|
|
4
|
+
private readonly apiClient;
|
|
5
|
+
constructor(apiClient: APIClient);
|
|
6
|
+
/** Add a new status page. */
|
|
7
|
+
addStatusPage(options: StatusPageOptions): Promise<StatusPage>;
|
|
8
|
+
/** Delete a status page. */
|
|
9
|
+
deleteStatusPage(token: string): Promise<Deleted>;
|
|
10
|
+
/** List all status pages. */
|
|
11
|
+
getStatusPages(): Promise<StatusPage[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Set a new API URL.
|
|
14
|
+
* @param newURL The new API url
|
|
15
|
+
*/
|
|
16
|
+
setApiUrl(newURL: string): void;
|
|
17
|
+
/** Update a status page. */
|
|
18
|
+
updateStatusPage(token: string, options: StatusPageOptions): Promise<StatusPage>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.StatusPagesAPI = void 0;
|
|
13
|
+
const Endpoints_1 = require("../Endpoints");
|
|
14
|
+
class StatusPagesAPI {
|
|
15
|
+
constructor(apiClient) {
|
|
16
|
+
this.apiClient = apiClient;
|
|
17
|
+
}
|
|
18
|
+
/** Add a new status page. */
|
|
19
|
+
addStatusPage(options) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const endpoint = Endpoints_1.Endpoint.statusPages();
|
|
22
|
+
const { data } = yield this.apiClient.post(endpoint, options);
|
|
23
|
+
return data;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** Delete a status page. */
|
|
27
|
+
deleteStatusPage(token) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const endpoint = Endpoints_1.Endpoint.statusPages(token);
|
|
30
|
+
const { data } = yield this.apiClient.delete(endpoint);
|
|
31
|
+
return data;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/** List all status pages. */
|
|
35
|
+
getStatusPages() {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const endpoint = Endpoints_1.Endpoint.statusPages();
|
|
38
|
+
const { data } = yield this.apiClient.get(endpoint);
|
|
39
|
+
return data;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Set a new API URL.
|
|
44
|
+
* @param newURL The new API url
|
|
45
|
+
*/
|
|
46
|
+
setApiUrl(newURL) {
|
|
47
|
+
this.apiClient.setBaseURL(newURL);
|
|
48
|
+
}
|
|
49
|
+
/** Update a status page. */
|
|
50
|
+
updateStatusPage(token, options) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const endpoint = Endpoints_1.Endpoint.statusPages(token);
|
|
53
|
+
const { data } = yield this.apiClient.put(endpoint, options);
|
|
54
|
+
return data;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.StatusPagesAPI = StatusPagesAPI;
|
package/dist/api/index.d.ts
CHANGED
package/dist/api/index.js
CHANGED
|
@@ -16,3 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./ChecksAPI"), exports);
|
|
18
18
|
__exportStar(require("./NodesAPI"), exports);
|
|
19
|
+
__exportStar(require("./RecipientsAPI"), exports);
|
|
20
|
+
__exportStar(require("./StatusPagesAPI"), exports);
|
package/dist/interfaces/API.d.ts
CHANGED
|
@@ -2,26 +2,39 @@ import type { CustomHeaders } from './Options';
|
|
|
2
2
|
export interface Check {
|
|
3
3
|
alias: string;
|
|
4
4
|
apdex_t: number;
|
|
5
|
+
created_at: string;
|
|
5
6
|
custom_headers: CustomHeaders;
|
|
6
7
|
disabled_locations: string[];
|
|
8
|
+
domain?: {
|
|
9
|
+
expires_at: string;
|
|
10
|
+
remaining_days: number;
|
|
11
|
+
source: string;
|
|
12
|
+
tested_at: string;
|
|
13
|
+
};
|
|
7
14
|
down: boolean;
|
|
8
15
|
down_since: null | string;
|
|
9
16
|
enabled: boolean;
|
|
10
17
|
error: null | string;
|
|
11
18
|
favicon_url: null | string;
|
|
19
|
+
http_body: string;
|
|
20
|
+
http_verb: string;
|
|
12
21
|
last_check_at: string;
|
|
13
|
-
last_status: number;
|
|
22
|
+
last_status: null | number;
|
|
14
23
|
mute_until: null | string;
|
|
15
24
|
next_check_at: string;
|
|
16
25
|
period: number;
|
|
17
26
|
published: boolean;
|
|
27
|
+
recipients: string[];
|
|
18
28
|
ssl: {
|
|
19
29
|
error: null | string;
|
|
30
|
+
expires_at?: string;
|
|
20
31
|
tested_at: string;
|
|
21
32
|
valid: boolean;
|
|
22
33
|
};
|
|
23
|
-
string_match:
|
|
34
|
+
string_match: string;
|
|
24
35
|
token: string;
|
|
36
|
+
type: string;
|
|
37
|
+
up_since: null | string;
|
|
25
38
|
uptime: number;
|
|
26
39
|
url: string;
|
|
27
40
|
}
|
|
@@ -3,21 +3,32 @@ export interface CheckOptions {
|
|
|
3
3
|
alias?: string;
|
|
4
4
|
/** APDEX threshold in seconds (0.125, 0.25, 0.5, 1.0 or 2.0) */
|
|
5
5
|
apdex_t?: number;
|
|
6
|
+
custom_headers?: CustomHeaders;
|
|
6
7
|
/** The HTTP headers you want in updown requests. Ex: custom_headers[X-Api-Key]=xxxxxxxxx */
|
|
7
8
|
customHeaders?: CustomHeaders;
|
|
9
|
+
disabled_locations?: string[];
|
|
8
10
|
/** Disabled monitoring locations. It's an array of abbreviated location names. Can be any of these: ["lan", "mia", "bhs", "gra", "fra", "sin", "tok", "syd"]. Ex: disabled_locations[]=lan&disabled_locations[]=syd */
|
|
9
11
|
disabledLocations?: string[];
|
|
10
12
|
/** Is the check enabled (true or false) */
|
|
11
13
|
enabled?: boolean;
|
|
14
|
+
/** The HTTP body sent alongside the request */
|
|
15
|
+
http_body?: string;
|
|
16
|
+
/** The HTTP verb used to perform the request */
|
|
17
|
+
http_verb?: HttpVerb;
|
|
12
18
|
/** Mute notifications until given time, accepts a time, 'recovery' or 'forever' */
|
|
13
19
|
mute_until?: string;
|
|
14
20
|
/** Interval in seconds (15, 30, 60, 120, 300, 600, 1800 or 3600) */
|
|
15
21
|
period?: number;
|
|
16
22
|
/** Shall the status page be public (true or false) */
|
|
17
23
|
published?: boolean;
|
|
24
|
+
/** Selected alert recipients */
|
|
25
|
+
recipients?: string[];
|
|
18
26
|
/** Search for this string in the page */
|
|
19
27
|
string_match?: string;
|
|
28
|
+
/** The type of check to create */
|
|
29
|
+
type?: CheckType;
|
|
20
30
|
}
|
|
31
|
+
export type CheckType = 'http' | 'https' | 'icmp' | 'pulse' | 'tcp' | 'tcps';
|
|
21
32
|
export interface ClientOptions {
|
|
22
33
|
apiKey: string;
|
|
23
34
|
apiUrl?: string;
|
|
@@ -26,6 +37,7 @@ export interface CustomHeaders {
|
|
|
26
37
|
[key: string]: boolean | number | string;
|
|
27
38
|
}
|
|
28
39
|
export type HttpMethod = 'delete' | 'get' | 'post' | 'put';
|
|
40
|
+
export type HttpVerb = 'DELETE' | 'GET/HEAD' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT';
|
|
29
41
|
export type MetricsGroup = 'host' | 'time';
|
|
30
42
|
export interface MetricsOptions {
|
|
31
43
|
/** Start time, default to 1 month ago */
|
|
@@ -35,6 +47,17 @@ export interface MetricsOptions {
|
|
|
35
47
|
/** End time, default to now */
|
|
36
48
|
to?: string;
|
|
37
49
|
}
|
|
50
|
+
export interface RecipientOptions {
|
|
51
|
+
/** Optional user-friendly label for supported recipient types */
|
|
52
|
+
name?: string;
|
|
53
|
+
/** Initial state on all existing checks */
|
|
54
|
+
selected?: boolean;
|
|
55
|
+
/** Type of recipient */
|
|
56
|
+
type: RecipientType;
|
|
57
|
+
/** Recipient value (email, phone or URL) */
|
|
58
|
+
value: string;
|
|
59
|
+
}
|
|
60
|
+
export type RecipientType = 'email' | 'msteams' | 'slack_compatible' | 'sms' | 'webhook';
|
|
38
61
|
export interface RequestOptions {
|
|
39
62
|
alias?: string;
|
|
40
63
|
apdex_t?: number;
|
|
@@ -44,12 +67,29 @@ export interface RequestOptions {
|
|
|
44
67
|
enabled?: boolean;
|
|
45
68
|
from?: string;
|
|
46
69
|
group?: MetricsGroup;
|
|
70
|
+
http_body?: string;
|
|
71
|
+
http_verb?: HttpVerb;
|
|
47
72
|
metrics?: boolean;
|
|
48
73
|
mute_until?: string;
|
|
49
74
|
page?: number;
|
|
50
75
|
period?: number;
|
|
51
76
|
published?: boolean;
|
|
77
|
+
recipients?: string[];
|
|
52
78
|
string_match?: string;
|
|
53
79
|
to?: string;
|
|
80
|
+
type?: CheckType;
|
|
54
81
|
url?: string;
|
|
55
82
|
}
|
|
83
|
+
export interface StatusPageOptions {
|
|
84
|
+
/** Access key for protected pages */
|
|
85
|
+
access_key?: string;
|
|
86
|
+
/** List of checks to show in the page */
|
|
87
|
+
checks?: string[];
|
|
88
|
+
/** Description text */
|
|
89
|
+
description?: string;
|
|
90
|
+
/** Name of the status page */
|
|
91
|
+
name?: string;
|
|
92
|
+
/** Page visibility */
|
|
93
|
+
visibility?: StatusPageVisibility;
|
|
94
|
+
}
|
|
95
|
+
export type StatusPageVisibility = 'private' | 'protected' | 'public';
|
package/dist/interfaces/index.js
CHANGED
|
@@ -21,3 +21,5 @@ __exportStar(require("./Downtime"), exports);
|
|
|
21
21
|
__exportStar(require("./Metrics"), exports);
|
|
22
22
|
__exportStar(require("./Nodes"), exports);
|
|
23
23
|
__exportStar(require("./Options"), exports);
|
|
24
|
+
__exportStar(require("./Recipient"), exports);
|
|
25
|
+
__exportStar(require("./StatusPage"), exports);
|
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Florian Imdahl <git@ffflorian.de>",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@ffflorian/api-client": "2.5.
|
|
4
|
+
"@ffflorian/api-client": "2.5.3"
|
|
5
5
|
},
|
|
6
6
|
"description": "An updown.io API client",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@types/node": "~
|
|
8
|
+
"@types/node": "~26",
|
|
9
|
+
"nock": "14.0.17",
|
|
9
10
|
"rimraf": "6.1.3",
|
|
10
|
-
"typedoc": "0.28.
|
|
11
|
-
"typescript": "
|
|
11
|
+
"typedoc": "0.28.20",
|
|
12
|
+
"typescript": "7.0.2",
|
|
13
|
+
"vite": "8.2.2",
|
|
14
|
+
"vitest": "5.0.0"
|
|
12
15
|
},
|
|
13
16
|
"engines": {
|
|
14
17
|
"node": ">= 21"
|
|
@@ -27,14 +30,17 @@
|
|
|
27
30
|
"license": "GPL-3.0",
|
|
28
31
|
"name": "updown.io",
|
|
29
32
|
"readme": "https://github.com/ffflorian/api-clients#readme",
|
|
30
|
-
"repository":
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/ffflorian/api-clients.git"
|
|
36
|
+
},
|
|
31
37
|
"scripts": {
|
|
32
38
|
"build": "yarn build:ts",
|
|
33
39
|
"build:ts": "tsc -p tsconfig.build.json",
|
|
34
40
|
"build:docs": "typedoc --tsconfig tsconfig.build.json --options ../../typedoc.json --out ../../docs/packages/updown.io src/index.ts",
|
|
35
41
|
"clean": "rimraf dist",
|
|
36
42
|
"dist": "yarn clean && yarn build",
|
|
37
|
-
"test": "
|
|
43
|
+
"test": "vitest"
|
|
38
44
|
},
|
|
39
|
-
"version": "3.
|
|
45
|
+
"version": "3.5.1"
|
|
40
46
|
}
|