@openstatus/sdk-node 0.0.2 → 0.1.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 +616 -142
- package/esm/gen/openstatus/status_page/v1/page_component_pb.d.ts +150 -0
- package/esm/gen/openstatus/status_page/v1/page_component_pb.d.ts.map +1 -0
- package/esm/gen/openstatus/status_page/v1/page_component_pb.js +42 -0
- package/esm/gen/openstatus/status_page/v1/page_subscriber_pb.d.ts +61 -0
- package/esm/gen/openstatus/status_page/v1/page_subscriber_pb.d.ts.map +1 -0
- package/esm/gen/openstatus/status_page/v1/page_subscriber_pb.js +13 -0
- package/esm/gen/openstatus/status_page/v1/service_pb.d.ts +1043 -0
- package/esm/gen/openstatus/status_page/v1/service_pb.d.ts.map +1 -0
- package/esm/gen/openstatus/status_page/v1/service_pb.js +202 -0
- package/esm/gen/openstatus/status_page/v1/status_page_pb.d.ts +298 -0
- package/esm/gen/openstatus/status_page/v1/status_page_pb.d.ts.map +1 -0
- package/esm/gen/openstatus/status_page/v1/status_page_pb.js +119 -0
- package/esm/gen/openstatus/status_report/v1/service_pb.d.ts +357 -0
- package/esm/gen/openstatus/status_report/v1/service_pb.d.ts.map +1 -0
- package/esm/gen/openstatus/status_report/v1/service_pb.js +79 -0
- package/esm/gen/openstatus/status_report/v1/status_report_pb.d.ts +182 -0
- package/esm/gen/openstatus/status_report/v1/status_report_pb.d.ts.map +1 -0
- package/esm/gen/openstatus/status_report/v1/status_report_pb.js +55 -0
- package/esm/mod.d.ts +62 -2
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +16 -1
- package/package.json +1 -1
- package/script/gen/openstatus/status_page/v1/page_component_pb.d.ts +150 -0
- package/script/gen/openstatus/status_page/v1/page_component_pb.d.ts.map +1 -0
- package/script/gen/openstatus/status_page/v1/page_component_pb.js +45 -0
- package/script/gen/openstatus/status_page/v1/page_subscriber_pb.d.ts +61 -0
- package/script/gen/openstatus/status_page/v1/page_subscriber_pb.d.ts.map +1 -0
- package/script/gen/openstatus/status_page/v1/page_subscriber_pb.js +16 -0
- package/script/gen/openstatus/status_page/v1/service_pb.d.ts +1043 -0
- package/script/gen/openstatus/status_page/v1/service_pb.d.ts.map +1 -0
- package/script/gen/openstatus/status_page/v1/service_pb.js +205 -0
- package/script/gen/openstatus/status_page/v1/status_page_pb.d.ts +298 -0
- package/script/gen/openstatus/status_page/v1/status_page_pb.d.ts.map +1 -0
- package/script/gen/openstatus/status_page/v1/status_page_pb.js +122 -0
- package/script/gen/openstatus/status_report/v1/service_pb.d.ts +357 -0
- package/script/gen/openstatus/status_report/v1/service_pb.d.ts.map +1 -0
- package/script/gen/openstatus/status_report/v1/service_pb.js +82 -0
- package/script/gen/openstatus/status_report/v1/status_report_pb.d.ts +182 -0
- package/script/gen/openstatus/status_report/v1/status_report_pb.d.ts.map +1 -0
- package/script/gen/openstatus/status_report/v1/status_report_pb.js +58 -0
- package/script/mod.d.ts +62 -2
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +24 -4
package/README.md
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
# OpenStatus Node.js SDK
|
|
1
|
+
# OpenStatus Node.js SDK (Beta)
|
|
2
2
|
|
|
3
3
|
[](https://jsr.io/@openstatus/sdk-node)
|
|
4
4
|
[](https://www.npmjs.com/package/@openstatus/sdk-node)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
|
|
7
|
-
Official Node.js SDK for [OpenStatus](https://openstatus.dev) -
|
|
8
|
-
monitoring
|
|
7
|
+
Official Node.js SDK for [OpenStatus](https://openstatus.dev) - The open-source
|
|
8
|
+
status page with uptime monitoring.
|
|
9
9
|
|
|
10
10
|
## Features
|
|
11
11
|
|
|
12
|
+
### Status Page
|
|
13
|
+
|
|
14
|
+
- **Status Pages** - Create and manage public status pages with custom domains
|
|
15
|
+
- **Page Components** - Add monitor-based or static components with grouping
|
|
16
|
+
- **Subscribers** - Manage email subscriptions for status updates
|
|
17
|
+
- **Status Reports** - Manage incident and maintenance reports with update
|
|
18
|
+
timelines
|
|
19
|
+
|
|
20
|
+
### Monitoring
|
|
21
|
+
|
|
12
22
|
- **HTTP Monitoring** - Monitor websites and APIs with customizable assertions
|
|
13
23
|
- **TCP Monitoring** - Check database connections and other TCP services
|
|
14
24
|
- **DNS Monitoring** - Verify DNS records and resolution
|
|
25
|
+
|
|
15
26
|
- **Global Regions** - Monitor from 28 locations worldwide
|
|
16
27
|
- **Type-safe** - Full TypeScript support with generated types from protobuf
|
|
17
28
|
|
|
@@ -39,11 +50,11 @@ import { openstatus } from "jsr:@openstatus/sdk-node";
|
|
|
39
50
|
|
|
40
51
|
```typescript
|
|
41
52
|
import {
|
|
53
|
+
HTTPMethod,
|
|
54
|
+
NumberComparator,
|
|
42
55
|
openstatus,
|
|
43
56
|
Periodicity,
|
|
44
57
|
Region,
|
|
45
|
-
HTTPMethod,
|
|
46
|
-
NumberComparator,
|
|
47
58
|
} from "@openstatus/sdk-node";
|
|
48
59
|
|
|
49
60
|
const headers = {
|
|
@@ -51,28 +62,29 @@ const headers = {
|
|
|
51
62
|
};
|
|
52
63
|
|
|
53
64
|
// Create a monitor
|
|
54
|
-
const { monitor } = await openstatus.monitor.v1.MonitorService
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
const { monitor } = await openstatus.monitor.v1.MonitorService
|
|
66
|
+
.createHTTPMonitor(
|
|
67
|
+
{
|
|
68
|
+
monitor: {
|
|
69
|
+
name: "My API",
|
|
70
|
+
url: "https://api.example.com/health",
|
|
71
|
+
periodicity: Periodicity.PERIODICITY_1M,
|
|
72
|
+
method: HTTPMethod.HTTP_METHOD_GET,
|
|
73
|
+
regions: [Region.FLY_AMS, Region.FLY_IAD, Region.FLY_SYD],
|
|
74
|
+
active: true,
|
|
75
|
+
statusCodeAssertions: [
|
|
76
|
+
{ comparator: NumberComparator.EQUAL, target: BigInt(200) },
|
|
77
|
+
],
|
|
78
|
+
},
|
|
66
79
|
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
);
|
|
80
|
+
{ headers },
|
|
81
|
+
);
|
|
70
82
|
|
|
71
83
|
console.log(`Monitor created: ${monitor?.id}`);
|
|
72
84
|
|
|
73
85
|
// List all monitors
|
|
74
|
-
const { httpMonitors, tcpMonitors, dnsMonitors, totalSize } =
|
|
75
|
-
|
|
86
|
+
const { httpMonitors, tcpMonitors, dnsMonitors, totalSize } = await openstatus
|
|
87
|
+
.monitor.v1.MonitorService.listMonitors({}, { headers });
|
|
76
88
|
|
|
77
89
|
console.log(`Found ${totalSize} monitors`);
|
|
78
90
|
```
|
|
@@ -107,21 +119,22 @@ await openstatus.monitor.v1.MonitorService.listMonitors({}, { headers });
|
|
|
107
119
|
Create an HTTP/HTTPS monitor.
|
|
108
120
|
|
|
109
121
|
```typescript
|
|
110
|
-
import { Periodicity, Region
|
|
122
|
+
import { HTTPMethod, Periodicity, Region } from "@openstatus/sdk-node";
|
|
111
123
|
|
|
112
|
-
const { monitor } = await openstatus.monitor.v1.MonitorService
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
124
|
+
const { monitor } = await openstatus.monitor.v1.MonitorService
|
|
125
|
+
.createHTTPMonitor(
|
|
126
|
+
{
|
|
127
|
+
monitor: {
|
|
128
|
+
name: "My Website",
|
|
129
|
+
url: "https://example.com",
|
|
130
|
+
periodicity: Periodicity.PERIODICITY_1M,
|
|
131
|
+
method: HTTPMethod.HTTP_METHOD_GET,
|
|
132
|
+
regions: [Region.FLY_AMS, Region.FLY_IAD, Region.FLY_SYD],
|
|
133
|
+
active: true,
|
|
134
|
+
},
|
|
121
135
|
},
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
);
|
|
136
|
+
{ headers },
|
|
137
|
+
);
|
|
125
138
|
```
|
|
126
139
|
|
|
127
140
|
#### `updateHTTPMonitor(request, options)`
|
|
@@ -129,16 +142,17 @@ const { monitor } = await openstatus.monitor.v1.MonitorService.createHTTPMonitor
|
|
|
129
142
|
Update an existing HTTP monitor.
|
|
130
143
|
|
|
131
144
|
```typescript
|
|
132
|
-
const { monitor } = await openstatus.monitor.v1.MonitorService
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
145
|
+
const { monitor } = await openstatus.monitor.v1.MonitorService
|
|
146
|
+
.updateHTTPMonitor(
|
|
147
|
+
{
|
|
148
|
+
id: "mon_123",
|
|
149
|
+
monitor: {
|
|
150
|
+
name: "Updated Name",
|
|
151
|
+
active: false,
|
|
152
|
+
},
|
|
138
153
|
},
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
);
|
|
154
|
+
{ headers },
|
|
155
|
+
);
|
|
142
156
|
```
|
|
143
157
|
|
|
144
158
|
#### `createTCPMonitor(request, options)`
|
|
@@ -261,10 +275,11 @@ Get the current status of a monitor across all configured regions.
|
|
|
261
275
|
```typescript
|
|
262
276
|
import { MonitorStatus, Region } from "@openstatus/sdk-node";
|
|
263
277
|
|
|
264
|
-
const { id, regions } = await openstatus.monitor.v1.MonitorService
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
278
|
+
const { id, regions } = await openstatus.monitor.v1.MonitorService
|
|
279
|
+
.getMonitorStatus(
|
|
280
|
+
{ id: "mon_123" },
|
|
281
|
+
{ headers },
|
|
282
|
+
);
|
|
268
283
|
|
|
269
284
|
// regions is an array of { region, status }
|
|
270
285
|
// region: Region enum value (e.g., Region.FLY_AMS)
|
|
@@ -312,88 +327,542 @@ const { status } = await openstatus.health.v1.HealthService.check({});
|
|
|
312
327
|
console.log(ServingStatus[status]); // "SERVING"
|
|
313
328
|
```
|
|
314
329
|
|
|
330
|
+
### Status Report Service
|
|
331
|
+
|
|
332
|
+
Manage incident and maintenance reports with update timelines.
|
|
333
|
+
|
|
334
|
+
#### `createStatusReport(request, options)`
|
|
335
|
+
|
|
336
|
+
Create a new status report.
|
|
337
|
+
|
|
338
|
+
```typescript
|
|
339
|
+
import { StatusReportStatus } from "@openstatus/sdk-node";
|
|
340
|
+
|
|
341
|
+
const { statusReport } = await openstatus.statusReport.v1.StatusReportService
|
|
342
|
+
.createStatusReport(
|
|
343
|
+
{
|
|
344
|
+
title: "API Degradation",
|
|
345
|
+
status: StatusReportStatus.INVESTIGATING,
|
|
346
|
+
message: "We are investigating reports of increased latency.",
|
|
347
|
+
date: "2024-01-15T10:30:00",
|
|
348
|
+
pageId: "page_123",
|
|
349
|
+
pageComponentIds: ["comp_456"],
|
|
350
|
+
notify: true,
|
|
351
|
+
},
|
|
352
|
+
{ headers },
|
|
353
|
+
);
|
|
354
|
+
|
|
355
|
+
console.log(`Status report created: ${statusReport?.id}`);
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
#### `getStatusReport(request, options)`
|
|
359
|
+
|
|
360
|
+
Get a status report by ID (includes full update timeline).
|
|
361
|
+
|
|
362
|
+
```typescript
|
|
363
|
+
const { statusReport } = await openstatus.statusReport.v1.StatusReportService
|
|
364
|
+
.getStatusReport(
|
|
365
|
+
{ id: "sr_123" },
|
|
366
|
+
{ headers },
|
|
367
|
+
);
|
|
368
|
+
|
|
369
|
+
console.log(`Title: ${statusReport?.title}`);
|
|
370
|
+
console.log(`Status: ${StatusReportStatus[statusReport?.status ?? 0]}`);
|
|
371
|
+
|
|
372
|
+
// Access update timeline
|
|
373
|
+
for (const update of statusReport?.updates ?? []) {
|
|
374
|
+
console.log(`${update.date}: ${update.message}`);
|
|
375
|
+
}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
#### `listStatusReports(request, options)`
|
|
379
|
+
|
|
380
|
+
List all status reports with pagination and optional filtering.
|
|
381
|
+
|
|
382
|
+
```typescript
|
|
383
|
+
import { StatusReportStatus } from "@openstatus/sdk-node";
|
|
384
|
+
|
|
385
|
+
const { statusReports, totalSize } = await openstatus.statusReport.v1
|
|
386
|
+
.StatusReportService.listStatusReports(
|
|
387
|
+
{
|
|
388
|
+
limit: 10,
|
|
389
|
+
offset: 0,
|
|
390
|
+
statuses: [
|
|
391
|
+
StatusReportStatus.INVESTIGATING,
|
|
392
|
+
StatusReportStatus.IDENTIFIED,
|
|
393
|
+
],
|
|
394
|
+
},
|
|
395
|
+
{ headers },
|
|
396
|
+
);
|
|
397
|
+
|
|
398
|
+
console.log(`Found ${totalSize} status reports`);
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
#### `updateStatusReport(request, options)`
|
|
402
|
+
|
|
403
|
+
Update status report metadata (title, page components).
|
|
404
|
+
|
|
405
|
+
```typescript
|
|
406
|
+
const { statusReport } = await openstatus.statusReport.v1.StatusReportService
|
|
407
|
+
.updateStatusReport(
|
|
408
|
+
{
|
|
409
|
+
id: "sr_123",
|
|
410
|
+
title: "Updated Title",
|
|
411
|
+
pageComponentIds: ["comp_456", "comp_789"],
|
|
412
|
+
},
|
|
413
|
+
{ headers },
|
|
414
|
+
);
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
#### `deleteStatusReport(request, options)`
|
|
418
|
+
|
|
419
|
+
Delete a status report and all its updates.
|
|
420
|
+
|
|
421
|
+
```typescript
|
|
422
|
+
const { success } = await openstatus.statusReport.v1.StatusReportService
|
|
423
|
+
.deleteStatusReport(
|
|
424
|
+
{ id: "sr_123" },
|
|
425
|
+
{ headers },
|
|
426
|
+
);
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
#### `addStatusReportUpdate(request, options)`
|
|
430
|
+
|
|
431
|
+
Add a new update to an existing status report timeline.
|
|
432
|
+
|
|
433
|
+
```typescript
|
|
434
|
+
import { StatusReportStatus } from "@openstatus/sdk-node";
|
|
435
|
+
|
|
436
|
+
const { statusReport } = await openstatus.statusReport.v1.StatusReportService
|
|
437
|
+
.addStatusReportUpdate(
|
|
438
|
+
{
|
|
439
|
+
statusReportId: "sr_123",
|
|
440
|
+
status: StatusReportStatus.IDENTIFIED,
|
|
441
|
+
message:
|
|
442
|
+
"The issue has been identified as a database connection problem.",
|
|
443
|
+
date: "2024-01-15T11:00:00", // optional, defaults to current time
|
|
444
|
+
notify: true,
|
|
445
|
+
},
|
|
446
|
+
{ headers },
|
|
447
|
+
);
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
### Status Report Status
|
|
451
|
+
|
|
452
|
+
| Enum Value | Description |
|
|
453
|
+
| --------------- | -------------------------------- |
|
|
454
|
+
| `UNSPECIFIED` | Default/unspecified status |
|
|
455
|
+
| `INVESTIGATING` | Actively investigating the issue |
|
|
456
|
+
| `IDENTIFIED` | Root cause has been identified |
|
|
457
|
+
| `MONITORING` | Fix deployed, monitoring |
|
|
458
|
+
| `RESOLVED` | Issue fully resolved |
|
|
459
|
+
|
|
460
|
+
### Status Page Service
|
|
461
|
+
|
|
462
|
+
Manage status pages, components, and subscribers.
|
|
463
|
+
|
|
464
|
+
#### `createStatusPage(request, options)`
|
|
465
|
+
|
|
466
|
+
Create a new status page.
|
|
467
|
+
|
|
468
|
+
```typescript
|
|
469
|
+
const { statusPage } = await openstatus.statusPage.v1.StatusPageService
|
|
470
|
+
.createStatusPage(
|
|
471
|
+
{
|
|
472
|
+
title: "My Service Status",
|
|
473
|
+
slug: "my-service",
|
|
474
|
+
description: "Status page for My Service",
|
|
475
|
+
homepageUrl: "https://example.com",
|
|
476
|
+
contactUrl: "https://example.com/contact",
|
|
477
|
+
},
|
|
478
|
+
{ headers },
|
|
479
|
+
);
|
|
480
|
+
|
|
481
|
+
console.log(`Status page created: ${statusPage?.id}`);
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
#### `getStatusPage(request, options)`
|
|
485
|
+
|
|
486
|
+
Get a status page by ID.
|
|
487
|
+
|
|
488
|
+
```typescript
|
|
489
|
+
const { statusPage } = await openstatus.statusPage.v1.StatusPageService
|
|
490
|
+
.getStatusPage(
|
|
491
|
+
{ id: "page_123" },
|
|
492
|
+
{ headers },
|
|
493
|
+
);
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
#### `listStatusPages(request, options)`
|
|
497
|
+
|
|
498
|
+
List all status pages with pagination.
|
|
499
|
+
|
|
500
|
+
```typescript
|
|
501
|
+
const { statusPages, totalSize } = await openstatus.statusPage.v1
|
|
502
|
+
.StatusPageService.listStatusPages(
|
|
503
|
+
{ limit: 10, offset: 0 },
|
|
504
|
+
{ headers },
|
|
505
|
+
);
|
|
506
|
+
|
|
507
|
+
console.log(`Found ${totalSize} status pages`);
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
#### `updateStatusPage(request, options)`
|
|
511
|
+
|
|
512
|
+
Update a status page.
|
|
513
|
+
|
|
514
|
+
```typescript
|
|
515
|
+
const { statusPage } = await openstatus.statusPage.v1.StatusPageService
|
|
516
|
+
.updateStatusPage(
|
|
517
|
+
{
|
|
518
|
+
id: "page_123",
|
|
519
|
+
title: "Updated Title",
|
|
520
|
+
description: "Updated description",
|
|
521
|
+
},
|
|
522
|
+
{ headers },
|
|
523
|
+
);
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
#### `deleteStatusPage(request, options)`
|
|
527
|
+
|
|
528
|
+
Delete a status page.
|
|
529
|
+
|
|
530
|
+
```typescript
|
|
531
|
+
const { success } = await openstatus.statusPage.v1.StatusPageService
|
|
532
|
+
.deleteStatusPage(
|
|
533
|
+
{ id: "page_123" },
|
|
534
|
+
{ headers },
|
|
535
|
+
);
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
#### `addMonitorComponent(request, options)`
|
|
539
|
+
|
|
540
|
+
Add a monitor-based component to a status page.
|
|
541
|
+
|
|
542
|
+
```typescript
|
|
543
|
+
const { component } = await openstatus.statusPage.v1.StatusPageService
|
|
544
|
+
.addMonitorComponent(
|
|
545
|
+
{
|
|
546
|
+
pageId: "page_123",
|
|
547
|
+
monitorId: "mon_456",
|
|
548
|
+
name: "API Server",
|
|
549
|
+
description: "Main API endpoint",
|
|
550
|
+
order: 1,
|
|
551
|
+
},
|
|
552
|
+
{ headers },
|
|
553
|
+
);
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
#### `addStaticComponent(request, options)`
|
|
557
|
+
|
|
558
|
+
Add a static component (not linked to a monitor).
|
|
559
|
+
|
|
560
|
+
```typescript
|
|
561
|
+
const { component } = await openstatus.statusPage.v1.StatusPageService
|
|
562
|
+
.addStaticComponent(
|
|
563
|
+
{
|
|
564
|
+
pageId: "page_123",
|
|
565
|
+
name: "Third-party Service",
|
|
566
|
+
description: "External dependency",
|
|
567
|
+
order: 2,
|
|
568
|
+
},
|
|
569
|
+
{ headers },
|
|
570
|
+
);
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
#### `updateComponent(request, options)`
|
|
574
|
+
|
|
575
|
+
Update a component.
|
|
576
|
+
|
|
577
|
+
```typescript
|
|
578
|
+
const { component } = await openstatus.statusPage.v1.StatusPageService
|
|
579
|
+
.updateComponent(
|
|
580
|
+
{
|
|
581
|
+
id: "comp_123",
|
|
582
|
+
name: "Updated Component Name",
|
|
583
|
+
order: 3,
|
|
584
|
+
},
|
|
585
|
+
{ headers },
|
|
586
|
+
);
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
#### `removeComponent(request, options)`
|
|
590
|
+
|
|
591
|
+
Remove a component from a status page.
|
|
592
|
+
|
|
593
|
+
```typescript
|
|
594
|
+
const { success } = await openstatus.statusPage.v1.StatusPageService
|
|
595
|
+
.removeComponent(
|
|
596
|
+
{ id: "comp_123" },
|
|
597
|
+
{ headers },
|
|
598
|
+
);
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
#### `createComponentGroup(request, options)`
|
|
602
|
+
|
|
603
|
+
Create a component group.
|
|
604
|
+
|
|
605
|
+
```typescript
|
|
606
|
+
const { group } = await openstatus.statusPage.v1.StatusPageService
|
|
607
|
+
.createComponentGroup(
|
|
608
|
+
{
|
|
609
|
+
pageId: "page_123",
|
|
610
|
+
name: "Core Services",
|
|
611
|
+
},
|
|
612
|
+
{ headers },
|
|
613
|
+
);
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
#### `updateComponentGroup(request, options)`
|
|
617
|
+
|
|
618
|
+
Update a component group.
|
|
619
|
+
|
|
620
|
+
```typescript
|
|
621
|
+
const { group } = await openstatus.statusPage.v1.StatusPageService
|
|
622
|
+
.updateComponentGroup(
|
|
623
|
+
{
|
|
624
|
+
id: "group_123",
|
|
625
|
+
name: "Updated Group Name",
|
|
626
|
+
},
|
|
627
|
+
{ headers },
|
|
628
|
+
);
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
#### `deleteComponentGroup(request, options)`
|
|
632
|
+
|
|
633
|
+
Delete a component group.
|
|
634
|
+
|
|
635
|
+
```typescript
|
|
636
|
+
const { success } = await openstatus.statusPage.v1.StatusPageService
|
|
637
|
+
.deleteComponentGroup(
|
|
638
|
+
{ id: "group_123" },
|
|
639
|
+
{ headers },
|
|
640
|
+
);
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
#### `subscribeToPage(request, options)`
|
|
644
|
+
|
|
645
|
+
Subscribe an email to status page updates.
|
|
646
|
+
|
|
647
|
+
```typescript
|
|
648
|
+
const { subscriber } = await openstatus.statusPage.v1.StatusPageService
|
|
649
|
+
.subscribeToPage(
|
|
650
|
+
{
|
|
651
|
+
pageId: "page_123",
|
|
652
|
+
email: "user@example.com",
|
|
653
|
+
},
|
|
654
|
+
{ headers },
|
|
655
|
+
);
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
#### `unsubscribeFromPage(request, options)`
|
|
659
|
+
|
|
660
|
+
Unsubscribe from a status page.
|
|
661
|
+
|
|
662
|
+
```typescript
|
|
663
|
+
// By email
|
|
664
|
+
const { success } = await openstatus.statusPage.v1.StatusPageService
|
|
665
|
+
.unsubscribeFromPage(
|
|
666
|
+
{
|
|
667
|
+
pageId: "page_123",
|
|
668
|
+
identifier: { case: "email", value: "user@example.com" },
|
|
669
|
+
},
|
|
670
|
+
{ headers },
|
|
671
|
+
);
|
|
672
|
+
|
|
673
|
+
// Or by subscriber ID
|
|
674
|
+
const { success: success2 } = await openstatus.statusPage.v1.StatusPageService
|
|
675
|
+
.unsubscribeFromPage(
|
|
676
|
+
{
|
|
677
|
+
pageId: "page_123",
|
|
678
|
+
identifier: { case: "id", value: "sub_456" },
|
|
679
|
+
},
|
|
680
|
+
{ headers },
|
|
681
|
+
);
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
#### `listSubscribers(request, options)`
|
|
685
|
+
|
|
686
|
+
List all subscribers for a status page.
|
|
687
|
+
|
|
688
|
+
```typescript
|
|
689
|
+
const { subscribers, totalSize } = await openstatus.statusPage.v1
|
|
690
|
+
.StatusPageService.listSubscribers(
|
|
691
|
+
{
|
|
692
|
+
pageId: "page_123",
|
|
693
|
+
limit: 50,
|
|
694
|
+
offset: 0,
|
|
695
|
+
includeUnsubscribed: false,
|
|
696
|
+
},
|
|
697
|
+
{ headers },
|
|
698
|
+
);
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
#### `getStatusPageContent(request, options)`
|
|
702
|
+
|
|
703
|
+
Get full status page content including components, groups, and active reports.
|
|
704
|
+
|
|
705
|
+
```typescript
|
|
706
|
+
const content = await openstatus.statusPage.v1.StatusPageService
|
|
707
|
+
.getStatusPageContent(
|
|
708
|
+
{ identifier: { case: "slug", value: "my-service" } },
|
|
709
|
+
{ headers },
|
|
710
|
+
);
|
|
711
|
+
|
|
712
|
+
console.log(`Page: ${content.statusPage?.title}`);
|
|
713
|
+
console.log(`Components: ${content.components.length}`);
|
|
714
|
+
console.log(`Active reports: ${content.statusReports.length}`);
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
#### `getOverallStatus(request, options)`
|
|
718
|
+
|
|
719
|
+
Get the aggregated status of a status page.
|
|
720
|
+
|
|
721
|
+
```typescript
|
|
722
|
+
import { OverallStatus } from "@openstatus/sdk-node";
|
|
723
|
+
|
|
724
|
+
const { overallStatus, componentStatuses } = await openstatus.statusPage.v1
|
|
725
|
+
.StatusPageService.getOverallStatus(
|
|
726
|
+
{ identifier: { case: "id", value: "page_123" } },
|
|
727
|
+
{ headers },
|
|
728
|
+
);
|
|
729
|
+
|
|
730
|
+
console.log(`Overall: ${OverallStatus[overallStatus]}`);
|
|
731
|
+
for (const { componentId, status } of componentStatuses) {
|
|
732
|
+
console.log(` ${componentId}: ${OverallStatus[status]}`);
|
|
733
|
+
}
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
### Status Page Options
|
|
737
|
+
|
|
738
|
+
| Option | Type | Required | Description |
|
|
739
|
+
| ------------- | ------ | -------- | ---------------------------------------- |
|
|
740
|
+
| `title` | string | Yes | Title of the status page (max 256 chars) |
|
|
741
|
+
| `slug` | string | Yes | URL-friendly slug (lowercase, hyphens) |
|
|
742
|
+
| `description` | string | No | Description (max 2048 chars) |
|
|
743
|
+
| `homepageUrl` | string | No | Link to your homepage |
|
|
744
|
+
| `contactUrl` | string | No | Link to your contact page |
|
|
745
|
+
|
|
746
|
+
### Page Access Type
|
|
747
|
+
|
|
748
|
+
| Enum Value | Description |
|
|
749
|
+
| -------------------- | ----------------------- |
|
|
750
|
+
| `UNSPECIFIED` | Default/unspecified |
|
|
751
|
+
| `PUBLIC` | Publicly accessible |
|
|
752
|
+
| `PASSWORD_PROTECTED` | Requires password |
|
|
753
|
+
| `AUTHENTICATED` | Requires authentication |
|
|
754
|
+
|
|
755
|
+
### Page Theme
|
|
756
|
+
|
|
757
|
+
| Enum Value | Description |
|
|
758
|
+
| ------------- | ------------------- |
|
|
759
|
+
| `UNSPECIFIED` | Default/unspecified |
|
|
760
|
+
| `SYSTEM` | Follow system theme |
|
|
761
|
+
| `LIGHT` | Light theme |
|
|
762
|
+
| `DARK` | Dark theme |
|
|
763
|
+
|
|
764
|
+
### Overall Status
|
|
765
|
+
|
|
766
|
+
| Enum Value | Description |
|
|
767
|
+
| ---------------- | --------------------------- |
|
|
768
|
+
| `UNSPECIFIED` | Default/unspecified |
|
|
769
|
+
| `OPERATIONAL` | All systems operational |
|
|
770
|
+
| `DEGRADED` | Performance is degraded |
|
|
771
|
+
| `PARTIAL_OUTAGE` | Some systems are down |
|
|
772
|
+
| `MAJOR_OUTAGE` | Major systems are down |
|
|
773
|
+
| `MAINTENANCE` | Scheduled maintenance |
|
|
774
|
+
| `UNKNOWN` | Status cannot be determined |
|
|
775
|
+
|
|
776
|
+
### Page Component Type
|
|
777
|
+
|
|
778
|
+
| Enum Value | Description |
|
|
779
|
+
| ------------- | ------------------------- |
|
|
780
|
+
| `UNSPECIFIED` | Default/unspecified |
|
|
781
|
+
| `MONITOR` | Linked to a monitor |
|
|
782
|
+
| `STATIC` | Static component (manual) |
|
|
783
|
+
|
|
315
784
|
## Monitor Options
|
|
316
785
|
|
|
317
786
|
### HTTP Monitor
|
|
318
787
|
|
|
319
|
-
| Option | Type
|
|
320
|
-
| ---------------------- |
|
|
321
|
-
| `name` | string
|
|
322
|
-
| `url` | string
|
|
323
|
-
| `periodicity` | Periodicity
|
|
324
|
-
| `method` | HTTPMethod
|
|
325
|
-
| `body` | string
|
|
326
|
-
| `headers` | Headers[]
|
|
327
|
-
| `timeout` | bigint
|
|
328
|
-
| `retry` | bigint
|
|
329
|
-
| `followRedirects` | boolean
|
|
330
|
-
| `regions` | Region[]
|
|
331
|
-
| `active` | boolean
|
|
332
|
-
| `public` | boolean
|
|
333
|
-
| `degradedAt` | bigint
|
|
334
|
-
| `description` | string
|
|
335
|
-
| `statusCodeAssertions` | array
|
|
336
|
-
| `bodyAssertions` | array
|
|
337
|
-
| `headerAssertions` | array
|
|
338
|
-
| `openTelemetry` | OpenTelemetryConfig| No | OpenTelemetry export configuration
|
|
788
|
+
| Option | Type | Required | Description |
|
|
789
|
+
| ---------------------- | ------------------- | -------- | --------------------------------------------------- |
|
|
790
|
+
| `name` | string | Yes | Monitor name (max 256 chars) |
|
|
791
|
+
| `url` | string | Yes | URL to monitor (max 2048 chars) |
|
|
792
|
+
| `periodicity` | Periodicity | Yes | Check interval (see [Periodicity](#periodicity)) |
|
|
793
|
+
| `method` | HTTPMethod | No | HTTP method (see [HTTP Methods](#http-methods)) |
|
|
794
|
+
| `body` | string | No | Request body |
|
|
795
|
+
| `headers` | Headers[] | No | Custom headers (`{ key: string, value: string }[]`) |
|
|
796
|
+
| `timeout` | bigint | No | Timeout in ms (default: 45000, max: 120000) |
|
|
797
|
+
| `retry` | bigint | No | Retry attempts (default: 3, max: 10) |
|
|
798
|
+
| `followRedirects` | boolean | No | Follow redirects (default: true) |
|
|
799
|
+
| `regions` | Region[] | No | [Regions](#regions) for checks |
|
|
800
|
+
| `active` | boolean | No | Enable monitoring (default: false) |
|
|
801
|
+
| `public` | boolean | No | Public visibility (default: false) |
|
|
802
|
+
| `degradedAt` | bigint | No | Latency threshold (ms) for degraded status |
|
|
803
|
+
| `description` | string | No | Monitor description (max 1024 chars) |
|
|
804
|
+
| `statusCodeAssertions` | array | No | [Status code assertions](#status-code-assertions) |
|
|
805
|
+
| `bodyAssertions` | array | No | [Body assertions](#body-assertions) |
|
|
806
|
+
| `headerAssertions` | array | No | [Header assertions](#header-assertions) |
|
|
807
|
+
| `openTelemetry` | OpenTelemetryConfig | No | OpenTelemetry export configuration |
|
|
339
808
|
|
|
340
809
|
### TCP Monitor
|
|
341
810
|
|
|
342
|
-
| Option | Type
|
|
343
|
-
| --------------- |
|
|
344
|
-
| `name` | string
|
|
345
|
-
| `uri` | string
|
|
346
|
-
| `periodicity` | Periodicity
|
|
347
|
-
| `timeout` | bigint
|
|
348
|
-
| `retry` | bigint
|
|
349
|
-
| `regions` | Region[]
|
|
350
|
-
| `active` | boolean
|
|
351
|
-
| `public` | boolean
|
|
352
|
-
| `degradedAt` | bigint
|
|
353
|
-
| `description` | string
|
|
354
|
-
| `openTelemetry` | OpenTelemetryConfig| No | OpenTelemetry export configuration |
|
|
811
|
+
| Option | Type | Required | Description |
|
|
812
|
+
| --------------- | ------------------- | -------- | ------------------------------------------------ |
|
|
813
|
+
| `name` | string | Yes | Monitor name (max 256 chars) |
|
|
814
|
+
| `uri` | string | Yes | `host:port` to monitor (max 2048 chars) |
|
|
815
|
+
| `periodicity` | Periodicity | Yes | Check interval (see [Periodicity](#periodicity)) |
|
|
816
|
+
| `timeout` | bigint | No | Timeout in ms (default: 45000, max: 120000) |
|
|
817
|
+
| `retry` | bigint | No | Retry attempts (default: 3, max: 10) |
|
|
818
|
+
| `regions` | Region[] | No | [Regions](#regions) for checks |
|
|
819
|
+
| `active` | boolean | No | Enable monitoring (default: false) |
|
|
820
|
+
| `public` | boolean | No | Public visibility (default: false) |
|
|
821
|
+
| `degradedAt` | bigint | No | Latency threshold (ms) for degraded status |
|
|
822
|
+
| `description` | string | No | Monitor description (max 1024 chars) |
|
|
823
|
+
| `openTelemetry` | OpenTelemetryConfig | No | OpenTelemetry export configuration |
|
|
355
824
|
|
|
356
825
|
### DNS Monitor
|
|
357
826
|
|
|
358
|
-
| Option | Type
|
|
359
|
-
| ------------------ |
|
|
360
|
-
| `name` | string
|
|
361
|
-
| `uri` | string
|
|
362
|
-
| `periodicity` | Periodicity
|
|
363
|
-
| `timeout` | bigint
|
|
364
|
-
| `retry` | bigint
|
|
365
|
-
| `regions` | Region[]
|
|
366
|
-
| `active` | boolean
|
|
367
|
-
| `public` | boolean
|
|
368
|
-
| `degradedAt` | bigint
|
|
369
|
-
| `description` | string
|
|
370
|
-
| `recordAssertions` | array
|
|
371
|
-
| `openTelemetry` | OpenTelemetryConfig| No | OpenTelemetry export configuration
|
|
827
|
+
| Option | Type | Required | Description |
|
|
828
|
+
| ------------------ | ------------------- | -------- | ------------------------------------------------ |
|
|
829
|
+
| `name` | string | Yes | Monitor name (max 256 chars) |
|
|
830
|
+
| `uri` | string | Yes | Domain to resolve (max 2048 chars) |
|
|
831
|
+
| `periodicity` | Periodicity | Yes | Check interval (see [Periodicity](#periodicity)) |
|
|
832
|
+
| `timeout` | bigint | No | Timeout in ms (default: 45000, max: 120000) |
|
|
833
|
+
| `retry` | bigint | No | Retry attempts (default: 3, max: 10) |
|
|
834
|
+
| `regions` | Region[] | No | [Regions](#regions) for checks |
|
|
835
|
+
| `active` | boolean | No | Enable monitoring (default: false) |
|
|
836
|
+
| `public` | boolean | No | Public visibility (default: false) |
|
|
837
|
+
| `degradedAt` | bigint | No | Latency threshold (ms) for degraded status |
|
|
838
|
+
| `description` | string | No | Monitor description (max 1024 chars) |
|
|
839
|
+
| `recordAssertions` | array | No | [DNS record assertions](#dns-record-assertions) |
|
|
840
|
+
| `openTelemetry` | OpenTelemetryConfig | No | OpenTelemetry export configuration |
|
|
372
841
|
|
|
373
842
|
### Periodicity
|
|
374
843
|
|
|
375
|
-
| Enum Value
|
|
376
|
-
|
|
|
377
|
-
| `PERIODICITY_30S`
|
|
378
|
-
| `PERIODICITY_1M`
|
|
379
|
-
| `PERIODICITY_5M`
|
|
380
|
-
| `PERIODICITY_10M`
|
|
381
|
-
| `PERIODICITY_30M`
|
|
382
|
-
| `PERIODICITY_1H`
|
|
844
|
+
| Enum Value | Description |
|
|
845
|
+
| ----------------- | ----------- |
|
|
846
|
+
| `PERIODICITY_30S` | Every 30s |
|
|
847
|
+
| `PERIODICITY_1M` | Every 1m |
|
|
848
|
+
| `PERIODICITY_5M` | Every 5m |
|
|
849
|
+
| `PERIODICITY_10M` | Every 10m |
|
|
850
|
+
| `PERIODICITY_30M` | Every 30m |
|
|
851
|
+
| `PERIODICITY_1H` | Every 1h |
|
|
383
852
|
|
|
384
853
|
### HTTP Methods
|
|
385
854
|
|
|
386
|
-
| Enum Value
|
|
387
|
-
|
|
|
388
|
-
| `HTTP_METHOD_GET`
|
|
389
|
-
| `HTTP_METHOD_POST`
|
|
390
|
-
| `HTTP_METHOD_HEAD`
|
|
391
|
-
| `HTTP_METHOD_PUT`
|
|
392
|
-
| `HTTP_METHOD_PATCH`
|
|
393
|
-
| `HTTP_METHOD_DELETE`
|
|
394
|
-
| `HTTP_METHOD_TRACE`
|
|
395
|
-
| `HTTP_METHOD_CONNECT`
|
|
396
|
-
| `HTTP_METHOD_OPTIONS`
|
|
855
|
+
| Enum Value | Description |
|
|
856
|
+
| --------------------- | ----------- |
|
|
857
|
+
| `HTTP_METHOD_GET` | GET |
|
|
858
|
+
| `HTTP_METHOD_POST` | POST |
|
|
859
|
+
| `HTTP_METHOD_HEAD` | HEAD |
|
|
860
|
+
| `HTTP_METHOD_PUT` | PUT |
|
|
861
|
+
| `HTTP_METHOD_PATCH` | PATCH |
|
|
862
|
+
| `HTTP_METHOD_DELETE` | DELETE |
|
|
863
|
+
| `HTTP_METHOD_TRACE` | TRACE |
|
|
864
|
+
| `HTTP_METHOD_CONNECT` | CONNECT |
|
|
865
|
+
| `HTTP_METHOD_OPTIONS` | OPTIONS |
|
|
397
866
|
|
|
398
867
|
## Assertions
|
|
399
868
|
|
|
@@ -416,14 +885,14 @@ import { NumberComparator } from "@openstatus/sdk-node";
|
|
|
416
885
|
|
|
417
886
|
**NumberComparator values:**
|
|
418
887
|
|
|
419
|
-
| Enum Value | Description
|
|
420
|
-
| ----------------------- |
|
|
421
|
-
| `EQUAL` | Equal to target
|
|
422
|
-
| `NOT_EQUAL` | Not equal to target
|
|
423
|
-
| `GREATER_THAN` | Greater than target
|
|
424
|
-
| `GREATER_THAN_OR_EQUAL` | Greater than or equal
|
|
425
|
-
| `LESS_THAN` | Less than target
|
|
426
|
-
| `LESS_THAN_OR_EQUAL` | Less than or equal
|
|
888
|
+
| Enum Value | Description |
|
|
889
|
+
| ----------------------- | --------------------- |
|
|
890
|
+
| `EQUAL` | Equal to target |
|
|
891
|
+
| `NOT_EQUAL` | Not equal to target |
|
|
892
|
+
| `GREATER_THAN` | Greater than target |
|
|
893
|
+
| `GREATER_THAN_OR_EQUAL` | Greater than or equal |
|
|
894
|
+
| `LESS_THAN` | Less than target |
|
|
895
|
+
| `LESS_THAN_OR_EQUAL` | Less than or equal |
|
|
427
896
|
|
|
428
897
|
### Body Assertions
|
|
429
898
|
|
|
@@ -442,18 +911,18 @@ import { StringComparator } from "@openstatus/sdk-node";
|
|
|
442
911
|
|
|
443
912
|
**StringComparator values:**
|
|
444
913
|
|
|
445
|
-
| Enum Value | Description
|
|
446
|
-
| ----------------------- |
|
|
447
|
-
| `CONTAINS` | Contains target string
|
|
448
|
-
| `NOT_CONTAINS` | Does not contain target
|
|
449
|
-
| `EQUAL` | Equal to target
|
|
450
|
-
| `NOT_EQUAL` | Not equal to target
|
|
451
|
-
| `EMPTY` | Body is empty
|
|
452
|
-
| `NOT_EMPTY` | Body is not empty
|
|
453
|
-
| `GREATER_THAN` | Lexicographically greater
|
|
454
|
-
| `GREATER_THAN_OR_EQUAL` | Lexicographically >= target
|
|
455
|
-
| `LESS_THAN` | Lexicographically less
|
|
456
|
-
| `LESS_THAN_OR_EQUAL` | Lexicographically <= target
|
|
914
|
+
| Enum Value | Description |
|
|
915
|
+
| ----------------------- | --------------------------- |
|
|
916
|
+
| `CONTAINS` | Contains target string |
|
|
917
|
+
| `NOT_CONTAINS` | Does not contain target |
|
|
918
|
+
| `EQUAL` | Equal to target |
|
|
919
|
+
| `NOT_EQUAL` | Not equal to target |
|
|
920
|
+
| `EMPTY` | Body is empty |
|
|
921
|
+
| `NOT_EMPTY` | Body is not empty |
|
|
922
|
+
| `GREATER_THAN` | Lexicographically greater |
|
|
923
|
+
| `GREATER_THAN_OR_EQUAL` | Lexicographically >= target |
|
|
924
|
+
| `LESS_THAN` | Lexicographically less |
|
|
925
|
+
| `LESS_THAN_OR_EQUAL` | Lexicographically <= target |
|
|
457
926
|
|
|
458
927
|
### Header Assertions
|
|
459
928
|
|
|
@@ -482,7 +951,11 @@ import { RecordComparator } from "@openstatus/sdk-node";
|
|
|
482
951
|
|
|
483
952
|
{
|
|
484
953
|
recordAssertions: [
|
|
485
|
-
{
|
|
954
|
+
{
|
|
955
|
+
record: "A",
|
|
956
|
+
comparator: RecordComparator.EQUAL,
|
|
957
|
+
target: "93.184.216.34",
|
|
958
|
+
},
|
|
486
959
|
{ record: "CNAME", comparator: RecordComparator.CONTAINS, target: "cdn" },
|
|
487
960
|
];
|
|
488
961
|
}
|
|
@@ -501,7 +974,8 @@ import { RecordComparator } from "@openstatus/sdk-node";
|
|
|
501
974
|
|
|
502
975
|
## Regions
|
|
503
976
|
|
|
504
|
-
Monitor from 28 global locations across multiple providers. Use the `Region`
|
|
977
|
+
Monitor from 28 global locations across multiple providers. Use the `Region`
|
|
978
|
+
enum:
|
|
505
979
|
|
|
506
980
|
```typescript
|
|
507
981
|
import { Region } from "@openstatus/sdk-node";
|
|
@@ -546,12 +1020,12 @@ regions: [Region.FLY_AMS, Region.FLY_IAD, Region.KOYEB_FRA];
|
|
|
546
1020
|
|
|
547
1021
|
### Railway Regions
|
|
548
1022
|
|
|
549
|
-
| Enum Value
|
|
550
|
-
|
|
|
551
|
-
| `RAILWAY_US_WEST2`
|
|
552
|
-
| `RAILWAY_US_EAST4`
|
|
553
|
-
| `RAILWAY_EUROPE_WEST4`
|
|
554
|
-
| `RAILWAY_ASIA_SOUTHEAST1
|
|
1023
|
+
| Enum Value | Location |
|
|
1024
|
+
| ------------------------- | -------------- |
|
|
1025
|
+
| `RAILWAY_US_WEST2` | US West |
|
|
1026
|
+
| `RAILWAY_US_EAST4` | US East |
|
|
1027
|
+
| `RAILWAY_EUROPE_WEST4` | Europe West |
|
|
1028
|
+
| `RAILWAY_ASIA_SOUTHEAST1` | Asia Southeast |
|
|
555
1029
|
|
|
556
1030
|
## Error Handling
|
|
557
1031
|
|