Openstatus sdk www.openstatus.dev

improve readme

+685 -526
+685 -526
README.md
··· 7 7 Official Node.js SDK for [OpenStatus](https://openstatus.dev) - The open-source 8 8 status page with uptime monitoring. 9 9 10 + ## Table of Contents 11 + 12 + - [Features](#features) 13 + - [Installation](#installation) 14 + - [Quick Start](#quick-start) 15 + - [Authentication](#authentication) 16 + - [SDK Reference](#sdk-reference) 17 + - [Monitor Service](#monitor-service) 18 + - [Health Service](#health-service) 19 + - [Status Report Service](#status-report-service) 20 + - [Status Page Service](#status-page-service) 21 + - [Maintenance Service](#maintenance-service) 22 + - [Notification Service](#notification-service) 23 + - [Reference](#reference) 24 + - [Monitor Options](#monitor-options) 25 + - [Assertions](#assertions) 26 + - [Regions](#regions) 27 + - [Enums](#enums) 28 + - [Error Handling](#error-handling) 29 + - [Related](#related) 30 + 10 31 ## Features 11 32 33 + ### Monitoring 34 + 35 + - **HTTP Monitoring** - Monitor websites and APIs with customizable assertions 36 + - **TCP Monitoring** - Check database connections and other TCP services 37 + - **DNS Monitoring** - Verify DNS records and resolution 38 + - **Global Regions** - Monitor from 28 locations worldwide 39 + 12 40 ### Status Page 13 41 14 42 - **Status Pages** - Create and manage public status pages with custom domains ··· 16 44 - **Subscribers** - Manage email subscriptions for status updates 17 45 - **Status Reports** - Manage incident reports with update timelines 18 46 - **Maintenance Windows** - Schedule and manage planned maintenance periods 19 - - **Notifications** - Configure notification channels (Slack, Discord, Email, 20 - PagerDuty, etc.) 21 47 22 - ### Monitoring 48 + ### Notifications 23 49 24 - - **HTTP Monitoring** - Monitor websites and APIs with customizable assertions 25 - - **TCP Monitoring** - Check database connections and other TCP services 26 - - **DNS Monitoring** - Verify DNS records and resolution 50 + - **12 Providers** - Slack, Discord, Email, PagerDuty, Opsgenie, Telegram, and 51 + more 52 + - **Webhook Support** - Custom webhooks with headers for any integration 53 + - **Monitor Alerts** - Get notified when monitors go down or recover 54 + 55 + ### Developer Experience 27 56 28 - - **Global Regions** - Monitor from 28 locations worldwide 29 57 - **Type-safe** - Full TypeScript support with generated types from protobuf 58 + - **Multiple Runtimes** - Works with Node.js, Deno, and Bun 30 59 31 60 ## Installation 32 61 33 - ### JSR 62 + ### npm 34 63 35 64 ```bash 36 - npx jsr add @openstatus/sdk-node 65 + npm install @openstatus/sdk-node 37 66 ``` 38 67 39 - ### npm 68 + ### JSR 40 69 41 70 ```bash 42 - npm install @openstatus/sdk-node 71 + npx jsr add @openstatus/sdk-node 43 72 ``` 44 73 45 74 ### Deno ··· 60 89 } from "@openstatus/sdk-node"; 61 90 62 91 const headers = { 63 - "x-openstatus-key": `${process.env.OPENSTATUS_API_KEY}`, 92 + "x-openstatus-key": process.env.OPENSTATUS_API_KEY, 64 93 }; 65 94 66 95 // Create a monitor 67 - const { monitor } = await openstatus.monitor.v1.MonitorService 68 - .createHTTPMonitor( 69 - { 70 - monitor: { 71 - name: "My API", 72 - url: "https://api.example.com/health", 73 - periodicity: Periodicity.PERIODICITY_1M, 74 - method: HTTPMethod.HTTP_METHOD_GET, 75 - regions: [Region.FLY_AMS, Region.FLY_IAD, Region.FLY_SYD], 76 - active: true, 77 - statusCodeAssertions: [ 78 - { comparator: NumberComparator.EQUAL, target: BigInt(200) }, 79 - ], 80 - }, 96 + const { monitor } = await openstatus.monitor.v1.MonitorService.createHTTPMonitor( 97 + { 98 + monitor: { 99 + name: "My API", 100 + url: "https://api.example.com/health", 101 + periodicity: Periodicity.PERIODICITY_1M, 102 + method: HTTPMethod.HTTP_METHOD_GET, 103 + regions: [Region.FLY_AMS, Region.FLY_IAD, Region.FLY_SYD], 104 + active: true, 105 + statusCodeAssertions: [ 106 + { comparator: NumberComparator.EQUAL, target: BigInt(200) }, 107 + ], 81 108 }, 82 - { headers }, 83 - ); 109 + }, 110 + { headers }, 111 + ); 84 112 85 113 console.log(`Monitor created: ${monitor?.id}`); 86 114 87 115 // List all monitors 88 - const { httpMonitors, tcpMonitors, dnsMonitors, totalSize } = await openstatus 89 - .monitor.v1.MonitorService.listMonitors({}, { headers }); 116 + const { httpMonitors, tcpMonitors, dnsMonitors, totalSize } = 117 + await openstatus.monitor.v1.MonitorService.listMonitors({}, { headers }); 90 118 91 119 console.log(`Found ${totalSize} monitors`); 92 120 ``` ··· 98 126 99 127 ```typescript 100 128 const headers = { 101 - "x-openstatus-key": `${process.env.OPENSTATUS_API_KEY}`, 129 + "x-openstatus-key": process.env.OPENSTATUS_API_KEY, 102 130 }; 103 131 104 132 // Pass headers to any service method 105 133 await openstatus.monitor.v1.MonitorService.listMonitors({}, { headers }); 106 134 ``` 107 135 108 - ## Environment Variables 136 + ### Environment Variables 109 137 110 138 | Variable | Description | Default | 111 139 | -------------------- | ----------------------- | -------------------------------- | 112 - | `OPENSTATUS_API_KEY` | Your OpenStatus API key | - | 140 + | `OPENSTATUS_API_KEY` | Your OpenStatus API key | Required | 113 141 | `OPENSTATUS_API_URL` | Custom API endpoint | `https://api.openstatus.dev/rpc` | 114 142 115 - ## API Reference 143 + ## SDK Reference 116 144 117 145 ### Monitor Service 146 + 147 + Manage HTTP, TCP, and DNS monitors. 118 148 119 149 #### `createHTTPMonitor(request, options)` 120 150 ··· 123 153 ```typescript 124 154 import { HTTPMethod, Periodicity, Region } from "@openstatus/sdk-node"; 125 155 126 - const { monitor } = await openstatus.monitor.v1.MonitorService 127 - .createHTTPMonitor( 128 - { 129 - monitor: { 130 - name: "My Website", 131 - url: "https://example.com", 132 - periodicity: Periodicity.PERIODICITY_1M, 133 - method: HTTPMethod.HTTP_METHOD_GET, 134 - regions: [Region.FLY_AMS, Region.FLY_IAD, Region.FLY_SYD], 135 - active: true, 136 - }, 156 + const { monitor } = await openstatus.monitor.v1.MonitorService.createHTTPMonitor( 157 + { 158 + monitor: { 159 + name: "My Website", 160 + url: "https://example.com", 161 + periodicity: Periodicity.PERIODICITY_1M, 162 + method: HTTPMethod.HTTP_METHOD_GET, 163 + regions: [Region.FLY_AMS, Region.FLY_IAD, Region.FLY_SYD], 164 + active: true, 137 165 }, 138 - { headers }, 139 - ); 166 + }, 167 + { headers }, 168 + ); 140 169 ``` 141 170 142 171 #### `updateHTTPMonitor(request, options)` ··· 144 173 Update an existing HTTP monitor. 145 174 146 175 ```typescript 147 - const { monitor } = await openstatus.monitor.v1.MonitorService 148 - .updateHTTPMonitor( 149 - { 150 - id: "mon_123", 151 - monitor: { 152 - name: "Updated Name", 153 - active: false, 154 - }, 176 + const { monitor } = await openstatus.monitor.v1.MonitorService.updateHTTPMonitor( 177 + { 178 + id: "mon_123", 179 + monitor: { 180 + name: "Updated Name", 181 + active: false, 155 182 }, 156 - { headers }, 157 - ); 183 + }, 184 + { headers }, 185 + ); 158 186 ``` 159 187 160 188 #### `createTCPMonitor(request, options)` ··· 197 225 Create a DNS resolution monitor. 198 226 199 227 ```typescript 200 - import { RecordComparator } from "@openstatus/sdk-node"; 228 + import { Periodicity, RecordComparator, Region } from "@openstatus/sdk-node"; 201 229 202 230 const { monitor } = await openstatus.monitor.v1.MonitorService.createDNSMonitor( 203 231 { ··· 277 305 ```typescript 278 306 import { MonitorStatus, Region } from "@openstatus/sdk-node"; 279 307 280 - const { id, regions } = await openstatus.monitor.v1.MonitorService 281 - .getMonitorStatus( 282 - { id: "mon_123" }, 283 - { headers }, 284 - ); 308 + const { id, regions } = await openstatus.monitor.v1.MonitorService.getMonitorStatus( 309 + { id: "mon_123" }, 310 + { headers }, 311 + ); 285 312 286 - // regions is an array of { region, status } 287 - // region: Region enum value (e.g., Region.FLY_AMS) 288 - // status: MonitorStatus.ACTIVE, MonitorStatus.DEGRADED, or MonitorStatus.ERROR 289 313 for (const { region, status } of regions) { 290 314 console.log(`${Region[region]}: ${MonitorStatus[status]}`); 291 315 } ··· 301 325 const summary = await openstatus.monitor.v1.MonitorService.getMonitorSummary( 302 326 { 303 327 id: "mon_123", 304 - timeRange: TimeRange.TIME_RANGE_7D, // TIME_RANGE_1D, TIME_RANGE_7D, or TIME_RANGE_14D 328 + timeRange: TimeRange.TIME_RANGE_7D, 305 329 regions: [], // optional: filter by specific regions 306 330 }, 307 331 { headers }, ··· 309 333 310 334 console.log(`Last ping: ${summary.lastPingAt}`); 311 335 console.log(`Success: ${summary.totalSuccessful}`); 312 - console.log(`Degraded: ${summary.totalDegraded}`); 313 336 console.log(`Failed: ${summary.totalFailed}`); 314 337 console.log(`P50 latency: ${summary.p50}ms`); 315 - console.log(`P75 latency: ${summary.p75}ms`); 316 - console.log(`P90 latency: ${summary.p90}ms`); 317 338 console.log(`P95 latency: ${summary.p95}ms`); 318 339 console.log(`P99 latency: ${summary.p99}ms`); 319 340 ``` 320 341 342 + --- 343 + 321 344 ### Health Service 322 345 323 346 Check API health status (no authentication required). ··· 329 352 console.log(ServingStatus[status]); // "SERVING" 330 353 ``` 331 354 355 + --- 356 + 332 357 ### Status Report Service 333 358 334 - Manage incident and maintenance reports with update timelines. 359 + Manage incident reports with update timelines. 335 360 336 361 #### `createStatusReport(request, options)` 337 362 ··· 340 365 ```typescript 341 366 import { StatusReportStatus } from "@openstatus/sdk-node"; 342 367 343 - const { statusReport } = await openstatus.statusReport.v1.StatusReportService 344 - .createStatusReport( 345 - { 346 - title: "API Degradation", 347 - status: StatusReportStatus.INVESTIGATING, 348 - message: "We are investigating reports of increased latency.", 349 - date: "2024-01-15T10:30:00", 350 - pageId: "page_123", 351 - pageComponentIds: ["comp_456"], 352 - notify: true, 353 - }, 354 - { headers }, 355 - ); 368 + const { statusReport } = await openstatus.statusReport.v1.StatusReportService.createStatusReport( 369 + { 370 + title: "API Degradation", 371 + status: StatusReportStatus.INVESTIGATING, 372 + message: "We are investigating reports of increased latency.", 373 + date: "2024-01-15T10:30:00Z", 374 + pageId: "page_123", 375 + pageComponentIds: ["comp_456"], 376 + notify: true, 377 + }, 378 + { headers }, 379 + ); 356 380 357 381 console.log(`Status report created: ${statusReport?.id}`); 358 382 ``` ··· 362 386 Get a status report by ID (includes full update timeline). 363 387 364 388 ```typescript 365 - const { statusReport } = await openstatus.statusReport.v1.StatusReportService 366 - .getStatusReport( 367 - { id: "sr_123" }, 368 - { headers }, 369 - ); 389 + import { StatusReportStatus } from "@openstatus/sdk-node"; 390 + 391 + const { statusReport } = await openstatus.statusReport.v1.StatusReportService.getStatusReport( 392 + { id: "sr_123" }, 393 + { headers }, 394 + ); 370 395 371 396 console.log(`Title: ${statusReport?.title}`); 372 397 console.log(`Status: ${StatusReportStatus[statusReport?.status ?? 0]}`); 373 398 374 - // Access update timeline 375 399 for (const update of statusReport?.updates ?? []) { 376 400 console.log(`${update.date}: ${update.message}`); 377 401 } ··· 384 408 ```typescript 385 409 import { StatusReportStatus } from "@openstatus/sdk-node"; 386 410 387 - const { statusReports, totalSize } = await openstatus.statusReport.v1 388 - .StatusReportService.listStatusReports( 411 + const { statusReports, totalSize } = 412 + await openstatus.statusReport.v1.StatusReportService.listStatusReports( 389 413 { 390 414 limit: 10, 391 415 offset: 0, 392 - statuses: [ 393 - StatusReportStatus.INVESTIGATING, 394 - StatusReportStatus.IDENTIFIED, 395 - ], 416 + statuses: [StatusReportStatus.INVESTIGATING, StatusReportStatus.IDENTIFIED], 396 417 }, 397 418 { headers }, 398 419 ); ··· 402 423 403 424 #### `updateStatusReport(request, options)` 404 425 405 - Update status report metadata (title, page components). 426 + Update status report metadata. 406 427 407 428 ```typescript 408 - const { statusReport } = await openstatus.statusReport.v1.StatusReportService 409 - .updateStatusReport( 410 - { 411 - id: "sr_123", 412 - title: "Updated Title", 413 - pageComponentIds: ["comp_456", "comp_789"], 414 - }, 415 - { headers }, 416 - ); 429 + const { statusReport } = await openstatus.statusReport.v1.StatusReportService.updateStatusReport( 430 + { 431 + id: "sr_123", 432 + title: "Updated Title", 433 + pageComponentIds: ["comp_456", "comp_789"], 434 + }, 435 + { headers }, 436 + ); 417 437 ``` 418 438 419 439 #### `deleteStatusReport(request, options)` ··· 421 441 Delete a status report and all its updates. 422 442 423 443 ```typescript 424 - const { success } = await openstatus.statusReport.v1.StatusReportService 425 - .deleteStatusReport( 426 - { id: "sr_123" }, 427 - { headers }, 428 - ); 444 + const { success } = await openstatus.statusReport.v1.StatusReportService.deleteStatusReport( 445 + { id: "sr_123" }, 446 + { headers }, 447 + ); 429 448 ``` 430 449 431 450 #### `addStatusReportUpdate(request, options)` ··· 435 454 ```typescript 436 455 import { StatusReportStatus } from "@openstatus/sdk-node"; 437 456 438 - const { statusReport } = await openstatus.statusReport.v1.StatusReportService 439 - .addStatusReportUpdate( 440 - { 441 - statusReportId: "sr_123", 442 - status: StatusReportStatus.IDENTIFIED, 443 - message: 444 - "The issue has been identified as a database connection problem.", 445 - date: "2024-01-15T11:00:00", // optional, defaults to current time 446 - notify: true, 447 - }, 448 - { headers }, 449 - ); 457 + const { statusReport } = await openstatus.statusReport.v1.StatusReportService.addStatusReportUpdate( 458 + { 459 + statusReportId: "sr_123", 460 + status: StatusReportStatus.IDENTIFIED, 461 + message: "The issue has been identified as a database connection problem.", 462 + date: "2024-01-15T11:00:00Z", // optional, defaults to current time 463 + notify: true, 464 + }, 465 + { headers }, 466 + ); 450 467 ``` 451 468 452 - ### Status Report Status 453 - 454 - | Enum Value | Description | 455 - | --------------- | -------------------------------- | 456 - | `UNSPECIFIED` | Default/unspecified status | 457 - | `INVESTIGATING` | Actively investigating the issue | 458 - | `IDENTIFIED` | Root cause has been identified | 459 - | `MONITORING` | Fix deployed, monitoring | 460 - | `RESOLVED` | Issue fully resolved | 469 + --- 461 470 462 471 ### Status Page Service 463 472 ··· 468 477 Create a new status page. 469 478 470 479 ```typescript 471 - const { statusPage } = await openstatus.statusPage.v1.StatusPageService 472 - .createStatusPage( 473 - { 474 - title: "My Service Status", 475 - slug: "my-service", 476 - description: "Status page for My Service", 477 - homepageUrl: "https://example.com", 478 - contactUrl: "https://example.com/contact", 479 - }, 480 - { headers }, 481 - ); 480 + const { statusPage } = await openstatus.statusPage.v1.StatusPageService.createStatusPage( 481 + { 482 + title: "My Service Status", 483 + slug: "my-service", 484 + description: "Status page for My Service", 485 + homepageUrl: "https://example.com", 486 + contactUrl: "https://example.com/contact", 487 + }, 488 + { headers }, 489 + ); 482 490 483 491 console.log(`Status page created: ${statusPage?.id}`); 484 492 ``` ··· 488 496 Get a status page by ID. 489 497 490 498 ```typescript 491 - const { statusPage } = await openstatus.statusPage.v1.StatusPageService 492 - .getStatusPage( 493 - { id: "page_123" }, 494 - { headers }, 495 - ); 499 + const { statusPage } = await openstatus.statusPage.v1.StatusPageService.getStatusPage( 500 + { id: "page_123" }, 501 + { headers }, 502 + ); 496 503 ``` 497 504 498 505 #### `listStatusPages(request, options)` ··· 500 507 List all status pages with pagination. 501 508 502 509 ```typescript 503 - const { statusPages, totalSize } = await openstatus.statusPage.v1 504 - .StatusPageService.listStatusPages( 510 + const { statusPages, totalSize } = 511 + await openstatus.statusPage.v1.StatusPageService.listStatusPages( 505 512 { limit: 10, offset: 0 }, 506 513 { headers }, 507 514 ); ··· 514 521 Update a status page. 515 522 516 523 ```typescript 517 - const { statusPage } = await openstatus.statusPage.v1.StatusPageService 518 - .updateStatusPage( 519 - { 520 - id: "page_123", 521 - title: "Updated Title", 522 - description: "Updated description", 523 - }, 524 - { headers }, 525 - ); 524 + const { statusPage } = await openstatus.statusPage.v1.StatusPageService.updateStatusPage( 525 + { 526 + id: "page_123", 527 + title: "Updated Title", 528 + description: "Updated description", 529 + }, 530 + { headers }, 531 + ); 526 532 ``` 527 533 528 534 #### `deleteStatusPage(request, options)` ··· 530 536 Delete a status page. 531 537 532 538 ```typescript 533 - const { success } = await openstatus.statusPage.v1.StatusPageService 534 - .deleteStatusPage( 535 - { id: "page_123" }, 536 - { headers }, 537 - ); 539 + const { success } = await openstatus.statusPage.v1.StatusPageService.deleteStatusPage( 540 + { id: "page_123" }, 541 + { headers }, 542 + ); 538 543 ``` 539 544 540 545 #### `addMonitorComponent(request, options)` ··· 542 547 Add a monitor-based component to a status page. 543 548 544 549 ```typescript 545 - const { component } = await openstatus.statusPage.v1.StatusPageService 546 - .addMonitorComponent( 547 - { 548 - pageId: "page_123", 549 - monitorId: "mon_456", 550 - name: "API Server", 551 - description: "Main API endpoint", 552 - order: 1, 553 - }, 554 - { headers }, 555 - ); 550 + const { component } = await openstatus.statusPage.v1.StatusPageService.addMonitorComponent( 551 + { 552 + pageId: "page_123", 553 + monitorId: "mon_456", 554 + name: "API Server", 555 + description: "Main API endpoint", 556 + order: 1, 557 + }, 558 + { headers }, 559 + ); 556 560 ``` 557 561 558 562 #### `addStaticComponent(request, options)` ··· 560 564 Add a static component (not linked to a monitor). 561 565 562 566 ```typescript 563 - const { component } = await openstatus.statusPage.v1.StatusPageService 564 - .addStaticComponent( 565 - { 566 - pageId: "page_123", 567 - name: "Third-party Service", 568 - description: "External dependency", 569 - order: 2, 570 - }, 571 - { headers }, 572 - ); 567 + const { component } = await openstatus.statusPage.v1.StatusPageService.addStaticComponent( 568 + { 569 + pageId: "page_123", 570 + name: "Third-party Service", 571 + description: "External dependency", 572 + order: 2, 573 + }, 574 + { headers }, 575 + ); 573 576 ``` 574 577 575 578 #### `updateComponent(request, options)` ··· 577 580 Update a component. 578 581 579 582 ```typescript 580 - const { component } = await openstatus.statusPage.v1.StatusPageService 581 - .updateComponent( 582 - { 583 - id: "comp_123", 584 - name: "Updated Component Name", 585 - order: 3, 586 - }, 587 - { headers }, 588 - ); 583 + const { component } = await openstatus.statusPage.v1.StatusPageService.updateComponent( 584 + { 585 + id: "comp_123", 586 + name: "Updated Component Name", 587 + order: 3, 588 + }, 589 + { headers }, 590 + ); 589 591 ``` 590 592 591 593 #### `removeComponent(request, options)` ··· 593 595 Remove a component from a status page. 594 596 595 597 ```typescript 596 - const { success } = await openstatus.statusPage.v1.StatusPageService 597 - .removeComponent( 598 - { id: "comp_123" }, 599 - { headers }, 600 - ); 598 + const { success } = await openstatus.statusPage.v1.StatusPageService.removeComponent( 599 + { id: "comp_123" }, 600 + { headers }, 601 + ); 601 602 ``` 602 603 603 604 #### `createComponentGroup(request, options)` ··· 605 606 Create a component group. 606 607 607 608 ```typescript 608 - const { group } = await openstatus.statusPage.v1.StatusPageService 609 - .createComponentGroup( 610 - { 611 - pageId: "page_123", 612 - name: "Core Services", 613 - }, 614 - { headers }, 615 - ); 609 + const { group } = await openstatus.statusPage.v1.StatusPageService.createComponentGroup( 610 + { 611 + pageId: "page_123", 612 + name: "Core Services", 613 + }, 614 + { headers }, 615 + ); 616 616 ``` 617 617 618 618 #### `updateComponentGroup(request, options)` ··· 620 620 Update a component group. 621 621 622 622 ```typescript 623 - const { group } = await openstatus.statusPage.v1.StatusPageService 624 - .updateComponentGroup( 625 - { 626 - id: "group_123", 627 - name: "Updated Group Name", 628 - }, 629 - { headers }, 630 - ); 623 + const { group } = await openstatus.statusPage.v1.StatusPageService.updateComponentGroup( 624 + { 625 + id: "group_123", 626 + name: "Updated Group Name", 627 + }, 628 + { headers }, 629 + ); 631 630 ``` 632 631 633 632 #### `deleteComponentGroup(request, options)` ··· 635 634 Delete a component group. 636 635 637 636 ```typescript 638 - const { success } = await openstatus.statusPage.v1.StatusPageService 639 - .deleteComponentGroup( 640 - { id: "group_123" }, 641 - { headers }, 642 - ); 637 + const { success } = await openstatus.statusPage.v1.StatusPageService.deleteComponentGroup( 638 + { id: "group_123" }, 639 + { headers }, 640 + ); 643 641 ``` 644 642 645 643 #### `subscribeToPage(request, options)` ··· 647 645 Subscribe an email to status page updates. 648 646 649 647 ```typescript 650 - const { subscriber } = await openstatus.statusPage.v1.StatusPageService 651 - .subscribeToPage( 652 - { 653 - pageId: "page_123", 654 - email: "user@example.com", 655 - }, 656 - { headers }, 657 - ); 648 + const { subscriber } = await openstatus.statusPage.v1.StatusPageService.subscribeToPage( 649 + { 650 + pageId: "page_123", 651 + email: "user@example.com", 652 + }, 653 + { headers }, 654 + ); 658 655 ``` 659 656 660 657 #### `unsubscribeFromPage(request, options)` ··· 663 660 664 661 ```typescript 665 662 // By email 666 - const { success } = await openstatus.statusPage.v1.StatusPageService 667 - .unsubscribeFromPage( 668 - { 669 - pageId: "page_123", 670 - identifier: { case: "email", value: "user@example.com" }, 671 - }, 672 - { headers }, 673 - ); 663 + const { success } = await openstatus.statusPage.v1.StatusPageService.unsubscribeFromPage( 664 + { 665 + pageId: "page_123", 666 + identifier: { case: "email", value: "user@example.com" }, 667 + }, 668 + { headers }, 669 + ); 674 670 675 671 // Or by subscriber ID 676 - const { success: success2 } = await openstatus.statusPage.v1.StatusPageService 677 - .unsubscribeFromPage( 678 - { 679 - pageId: "page_123", 680 - identifier: { case: "id", value: "sub_456" }, 681 - }, 682 - { headers }, 683 - ); 672 + const { success: success2 } = await openstatus.statusPage.v1.StatusPageService.unsubscribeFromPage( 673 + { 674 + pageId: "page_123", 675 + identifier: { case: "id", value: "sub_456" }, 676 + }, 677 + { headers }, 678 + ); 684 679 ``` 685 680 686 681 #### `listSubscribers(request, options)` ··· 688 683 List all subscribers for a status page. 689 684 690 685 ```typescript 691 - const { subscribers, totalSize } = await openstatus.statusPage.v1 692 - .StatusPageService.listSubscribers( 686 + const { subscribers, totalSize } = 687 + await openstatus.statusPage.v1.StatusPageService.listSubscribers( 693 688 { 694 689 pageId: "page_123", 695 690 limit: 50, ··· 705 700 Get full status page content including components, groups, and active reports. 706 701 707 702 ```typescript 708 - const content = await openstatus.statusPage.v1.StatusPageService 709 - .getStatusPageContent( 710 - { identifier: { case: "slug", value: "my-service" } }, 711 - { headers }, 712 - ); 703 + const content = await openstatus.statusPage.v1.StatusPageService.getStatusPageContent( 704 + { identifier: { case: "slug", value: "my-service" } }, 705 + { headers }, 706 + ); 713 707 714 708 console.log(`Page: ${content.statusPage?.title}`); 715 709 console.log(`Components: ${content.components.length}`); ··· 723 717 ```typescript 724 718 import { OverallStatus } from "@openstatus/sdk-node"; 725 719 726 - const { overallStatus, componentStatuses } = await openstatus.statusPage.v1 727 - .StatusPageService.getOverallStatus( 720 + const { overallStatus, componentStatuses } = 721 + await openstatus.statusPage.v1.StatusPageService.getOverallStatus( 728 722 { identifier: { case: "id", value: "page_123" } }, 729 723 { headers }, 730 724 ); ··· 735 729 } 736 730 ``` 737 731 732 + --- 733 + 738 734 ### Maintenance Service 739 735 740 736 Manage scheduled maintenance windows. ··· 744 740 Create a new maintenance window. 745 741 746 742 ```typescript 747 - const { maintenance } = await openstatus.maintenance.v1.MaintenanceService 748 - .createMaintenance( 749 - { 750 - title: "Database Upgrade", 751 - message: "We will be upgrading our database infrastructure.", 752 - from: "2024-01-20T02:00:00Z", 753 - to: "2024-01-20T04:00:00Z", 754 - pageId: "page_123", 755 - pageComponentIds: ["comp_456"], 756 - notify: true, 757 - }, 758 - { headers }, 759 - ); 743 + const { maintenance } = await openstatus.maintenance.v1.MaintenanceService.createMaintenance( 744 + { 745 + title: "Database Upgrade", 746 + message: "We will be upgrading our database infrastructure.", 747 + from: "2024-01-20T02:00:00Z", 748 + to: "2024-01-20T04:00:00Z", 749 + pageId: "page_123", 750 + pageComponentIds: ["comp_456"], 751 + notify: true, 752 + }, 753 + { headers }, 754 + ); 760 755 761 756 console.log(`Maintenance created: ${maintenance?.id}`); 762 757 ``` ··· 766 761 Get a maintenance window by ID. 767 762 768 763 ```typescript 769 - const { maintenance } = await openstatus.maintenance.v1.MaintenanceService 770 - .getMaintenance( 771 - { id: "maint_123" }, 772 - { headers }, 773 - ); 764 + const { maintenance } = await openstatus.maintenance.v1.MaintenanceService.getMaintenance( 765 + { id: "maint_123" }, 766 + { headers }, 767 + ); 774 768 775 769 console.log(`Title: ${maintenance?.title}`); 776 770 console.log(`From: ${maintenance?.from}`); ··· 782 776 List all maintenance windows with pagination and optional filtering. 783 777 784 778 ```typescript 785 - const { maintenances, totalSize } = await openstatus.maintenance.v1 786 - .MaintenanceService.listMaintenances( 779 + const { maintenances, totalSize } = 780 + await openstatus.maintenance.v1.MaintenanceService.listMaintenances( 787 781 { 788 782 limit: 10, 789 783 offset: 0, ··· 800 794 Update a maintenance window. 801 795 802 796 ```typescript 803 - const { maintenance } = await openstatus.maintenance.v1.MaintenanceService 804 - .updateMaintenance( 805 - { 806 - id: "maint_123", 807 - title: "Extended Database Upgrade", 808 - to: "2024-01-20T06:00:00Z", 809 - }, 810 - { headers }, 811 - ); 797 + const { maintenance } = await openstatus.maintenance.v1.MaintenanceService.updateMaintenance( 798 + { 799 + id: "maint_123", 800 + title: "Extended Database Upgrade", 801 + to: "2024-01-20T06:00:00Z", 802 + }, 803 + { headers }, 804 + ); 812 805 ``` 813 806 814 807 #### `deleteMaintenance(request, options)` ··· 816 809 Delete a maintenance window. 817 810 818 811 ```typescript 819 - const { success } = await openstatus.maintenance.v1.MaintenanceService 820 - .deleteMaintenance( 821 - { id: "maint_123" }, 822 - { headers }, 823 - ); 812 + const { success } = await openstatus.maintenance.v1.MaintenanceService.deleteMaintenance( 813 + { id: "maint_123" }, 814 + { headers }, 815 + ); 824 816 ``` 825 817 818 + --- 819 + 826 820 ### Notification Service 827 821 828 - Manage notification channels for monitor alerts. 822 + Manage notification channels for monitor alerts. Supports 12 providers including 823 + Slack, Discord, Email, PagerDuty, and custom webhooks. 829 824 830 825 #### `createNotification(request, options)` 831 826 ··· 834 829 ```typescript 835 830 import { NotificationProvider } from "@openstatus/sdk-node"; 836 831 837 - // Create a Slack notification 838 - const { notification } = await openstatus.notification.v1.NotificationService 839 - .createNotification( 840 - { 841 - name: "Slack Alerts", 842 - provider: NotificationProvider.SLACK, 832 + const { notification } = await openstatus.notification.v1.NotificationService.createNotification( 833 + { 834 + name: "Slack Alerts", 835 + provider: NotificationProvider.SLACK, 836 + data: { 843 837 data: { 844 - data: { 845 - case: "slack", 846 - value: { webhookUrl: "https://hooks.slack.com/services/..." }, 847 - }, 838 + case: "slack", 839 + value: { webhookUrl: "https://hooks.slack.com/services/..." }, 848 840 }, 849 - monitorIds: ["mon_123", "mon_456"], 850 841 }, 851 - { headers }, 852 - ); 842 + monitorIds: ["mon_123", "mon_456"], 843 + }, 844 + { headers }, 845 + ); 853 846 854 847 console.log(`Notification created: ${notification?.id}`); 855 848 ``` ··· 859 852 Get a notification channel by ID. 860 853 861 854 ```typescript 862 - const { notification } = await openstatus.notification.v1.NotificationService 863 - .getNotification( 864 - { id: "notif_123" }, 865 - { headers }, 866 - ); 855 + import { NotificationProvider } from "@openstatus/sdk-node"; 856 + 857 + const { notification } = await openstatus.notification.v1.NotificationService.getNotification( 858 + { id: "notif_123" }, 859 + { headers }, 860 + ); 867 861 868 862 console.log(`Name: ${notification?.name}`); 869 863 console.log(`Provider: ${NotificationProvider[notification?.provider ?? 0]}`); ··· 874 868 List all notification channels with pagination. 875 869 876 870 ```typescript 877 - const { notifications, totalSize } = await openstatus.notification.v1 878 - .NotificationService.listNotifications( 871 + const { notifications, totalSize } = 872 + await openstatus.notification.v1.NotificationService.listNotifications( 879 873 { limit: 10, offset: 0 }, 880 874 { headers }, 881 875 ); ··· 888 882 Update a notification channel. 889 883 890 884 ```typescript 891 - const { notification } = await openstatus.notification.v1.NotificationService 892 - .updateNotification( 893 - { 894 - id: "notif_123", 895 - name: "Updated Slack Alerts", 896 - monitorIds: ["mon_123", "mon_456", "mon_789"], 897 - }, 898 - { headers }, 899 - ); 885 + const { notification } = await openstatus.notification.v1.NotificationService.updateNotification( 886 + { 887 + id: "notif_123", 888 + name: "Updated Slack Alerts", 889 + monitorIds: ["mon_123", "mon_456", "mon_789"], 890 + }, 891 + { headers }, 892 + ); 900 893 ``` 901 894 902 895 #### `deleteNotification(request, options)` ··· 904 897 Delete a notification channel. 905 898 906 899 ```typescript 907 - const { success } = await openstatus.notification.v1.NotificationService 908 - .deleteNotification( 909 - { id: "notif_123" }, 910 - { headers }, 911 - ); 900 + const { success } = await openstatus.notification.v1.NotificationService.deleteNotification( 901 + { id: "notif_123" }, 902 + { headers }, 903 + ); 912 904 ``` 913 905 914 906 #### `sendTestNotification(request, options)` ··· 918 910 ```typescript 919 911 import { NotificationProvider } from "@openstatus/sdk-node"; 920 912 921 - const { success, errorMessage } = await openstatus.notification.v1 922 - .NotificationService.sendTestNotification( 913 + const { success, errorMessage } = 914 + await openstatus.notification.v1.NotificationService.sendTestNotification( 923 915 { 924 916 provider: NotificationProvider.SLACK, 925 917 data: { ··· 944 936 Check if the workspace has reached its notification limit. 945 937 946 938 ```typescript 947 - const { limitReached, currentCount, maxCount } = await openstatus.notification 948 - .v1.NotificationService.checkNotificationLimit({}, { headers }); 939 + const { limitReached, currentCount, maxCount } = 940 + await openstatus.notification.v1.NotificationService.checkNotificationLimit({}, { headers }); 949 941 950 942 console.log(`${currentCount}/${maxCount} notification channels used`); 951 - if (limitReached) { 952 - console.log("Notification limit reached"); 953 - } 954 943 ``` 955 944 956 - ### Notification Providers 945 + #### Provider Configuration Examples 957 946 958 - | Enum Value | Description | 959 - | ---------------- | -------------------- | 960 - | `UNSPECIFIED` | Default/unspecified | 961 - | `DISCORD` | Discord webhook | 962 - | `EMAIL` | Email notification | 963 - | `GOOGLE_CHAT` | Google Chat webhook | 964 - | `GRAFANA_ONCALL` | Grafana OnCall | 965 - | `NTFY` | Ntfy push service | 966 - | `PAGERDUTY` | PagerDuty | 967 - | `OPSGENIE` | Opsgenie | 968 - | `SLACK` | Slack webhook | 969 - | `SMS` | SMS notification | 970 - | `TELEGRAM` | Telegram bot | 971 - | `WEBHOOK` | Custom webhook | 972 - | `WHATSAPP` | WhatsApp | 947 + <details> 948 + <summary><strong>Slack</strong></summary> 973 949 974 - ### Provider Configuration Examples 950 + ```typescript 951 + { 952 + provider: NotificationProvider.SLACK, 953 + data: { 954 + data: { 955 + case: "slack", 956 + value: { webhookUrl: "https://hooks.slack.com/services/..." } 957 + } 958 + } 959 + } 960 + ``` 975 961 976 - #### Discord 962 + </details> 963 + 964 + <details> 965 + <summary><strong>Discord</strong></summary> 977 966 978 967 ```typescript 979 968 { 969 + provider: NotificationProvider.DISCORD, 980 970 data: { 981 - case: "discord", 982 - value: { webhookUrl: "https://discord.com/api/webhooks/..." } 971 + data: { 972 + case: "discord", 973 + value: { webhookUrl: "https://discord.com/api/webhooks/..." } 974 + } 983 975 } 984 976 } 985 977 ``` 986 978 987 - #### Email 979 + </details> 980 + 981 + <details> 982 + <summary><strong>Email</strong></summary> 988 983 989 984 ```typescript 990 985 { 986 + provider: NotificationProvider.EMAIL, 991 987 data: { 992 - case: "email", 993 - value: { email: "alerts@example.com" } 988 + data: { 989 + case: "email", 990 + value: { email: "alerts@example.com" } 991 + } 994 992 } 995 993 } 996 994 ``` 997 995 998 - #### PagerDuty 996 + </details> 997 + 998 + <details> 999 + <summary><strong>PagerDuty</strong></summary> 999 1000 1000 1001 ```typescript 1001 1002 { 1003 + provider: NotificationProvider.PAGERDUTY, 1002 1004 data: { 1003 - case: "pagerduty", 1004 - value: { integrationKey: "your-integration-key" } 1005 + data: { 1006 + case: "pagerduty", 1007 + value: { integrationKey: "your-integration-key" } 1008 + } 1005 1009 } 1006 1010 } 1007 1011 ``` 1008 1012 1009 - #### Opsgenie 1013 + </details> 1014 + 1015 + <details> 1016 + <summary><strong>Opsgenie</strong></summary> 1010 1017 1011 1018 ```typescript 1012 1019 import { OpsgenieRegion } from "@openstatus/sdk-node"; 1013 1020 1014 1021 { 1022 + provider: NotificationProvider.OPSGENIE, 1015 1023 data: { 1016 - case: "opsgenie", 1017 - value: { apiKey: "your-api-key", region: OpsgenieRegion.US } 1024 + data: { 1025 + case: "opsgenie", 1026 + value: { apiKey: "your-api-key", region: OpsgenieRegion.US } 1027 + } 1018 1028 } 1019 1029 } 1020 1030 ``` 1021 1031 1022 - #### Telegram 1032 + </details> 1033 + 1034 + <details> 1035 + <summary><strong>Telegram</strong></summary> 1023 1036 1024 1037 ```typescript 1025 1038 { 1039 + provider: NotificationProvider.TELEGRAM, 1026 1040 data: { 1027 - case: "telegram", 1028 - value: { chatId: "123456789" } 1041 + data: { 1042 + case: "telegram", 1043 + value: { chatId: "123456789" } 1044 + } 1029 1045 } 1030 1046 } 1031 1047 ``` 1032 1048 1033 - #### Custom Webhook 1049 + </details> 1050 + 1051 + <details> 1052 + <summary><strong>Google Chat</strong></summary> 1053 + 1054 + ```typescript 1055 + { 1056 + provider: NotificationProvider.GOOGLE_CHAT, 1057 + data: { 1058 + data: { 1059 + case: "googleChat", 1060 + value: { webhookUrl: "https://chat.googleapis.com/v1/spaces/..." } 1061 + } 1062 + } 1063 + } 1064 + ``` 1065 + 1066 + </details> 1067 + 1068 + <details> 1069 + <summary><strong>Grafana OnCall</strong></summary> 1034 1070 1035 1071 ```typescript 1036 1072 { 1073 + provider: NotificationProvider.GRAFANA_ONCALL, 1037 1074 data: { 1038 - case: "webhook", 1039 - value: { 1040 - endpoint: "https://api.example.com/webhook", 1041 - headers: [ 1042 - { key: "Authorization", value: "Bearer token" } 1043 - ] 1075 + data: { 1076 + case: "grafanaOncall", 1077 + value: { webhookUrl: "https://oncall.example.com/..." } 1044 1078 } 1045 1079 } 1046 1080 } 1047 1081 ``` 1048 1082 1049 - ### Status Page Options 1083 + </details> 1050 1084 1051 - | Option | Type | Required | Description | 1052 - | ------------- | ------ | -------- | ---------------------------------------- | 1053 - | `title` | string | Yes | Title of the status page (max 256 chars) | 1054 - | `slug` | string | Yes | URL-friendly slug (lowercase, hyphens) | 1055 - | `description` | string | No | Description (max 2048 chars) | 1056 - | `homepageUrl` | string | No | Link to your homepage | 1057 - | `contactUrl` | string | No | Link to your contact page | 1085 + <details> 1086 + <summary><strong>Ntfy</strong></summary> 1058 1087 1059 - ### Page Access Type 1088 + ```typescript 1089 + { 1090 + provider: NotificationProvider.NTFY, 1091 + data: { 1092 + data: { 1093 + case: "ntfy", 1094 + value: { 1095 + topic: "my-alerts", 1096 + serverUrl: "https://ntfy.sh", // optional, defaults to ntfy.sh 1097 + token: "tk_..." // optional auth token 1098 + } 1099 + } 1100 + } 1101 + } 1102 + ``` 1060 1103 1061 - | Enum Value | Description | 1062 - | -------------------- | ----------------------- | 1063 - | `UNSPECIFIED` | Default/unspecified | 1064 - | `PUBLIC` | Publicly accessible | 1065 - | `PASSWORD_PROTECTED` | Requires password | 1066 - | `AUTHENTICATED` | Requires authentication | 1104 + </details> 1067 1105 1068 - ### Page Theme 1106 + <details> 1107 + <summary><strong>SMS</strong></summary> 1069 1108 1070 - | Enum Value | Description | 1071 - | ------------- | ------------------- | 1072 - | `UNSPECIFIED` | Default/unspecified | 1073 - | `SYSTEM` | Follow system theme | 1074 - | `LIGHT` | Light theme | 1075 - | `DARK` | Dark theme | 1109 + ```typescript 1110 + { 1111 + provider: NotificationProvider.SMS, 1112 + data: { 1113 + data: { 1114 + case: "sms", 1115 + value: { phoneNumber: "+1234567890" } 1116 + } 1117 + } 1118 + } 1119 + ``` 1076 1120 1077 - ### Overall Status 1121 + </details> 1122 + 1123 + <details> 1124 + <summary><strong>WhatsApp</strong></summary> 1078 1125 1079 - | Enum Value | Description | 1080 - | ---------------- | --------------------------- | 1081 - | `UNSPECIFIED` | Default/unspecified | 1082 - | `OPERATIONAL` | All systems operational | 1083 - | `DEGRADED` | Performance is degraded | 1084 - | `PARTIAL_OUTAGE` | Some systems are down | 1085 - | `MAJOR_OUTAGE` | Major systems are down | 1086 - | `MAINTENANCE` | Scheduled maintenance | 1087 - | `UNKNOWN` | Status cannot be determined | 1126 + ```typescript 1127 + { 1128 + provider: NotificationProvider.WHATSAPP, 1129 + data: { 1130 + data: { 1131 + case: "whatsapp", 1132 + value: { phoneNumber: "+1234567890" } 1133 + } 1134 + } 1135 + } 1136 + ``` 1088 1137 1089 - ### Page Component Type 1138 + </details> 1090 1139 1091 - | Enum Value | Description | 1092 - | ------------- | ------------------------- | 1093 - | `UNSPECIFIED` | Default/unspecified | 1094 - | `MONITOR` | Linked to a monitor | 1095 - | `STATIC` | Static component (manual) | 1140 + <details> 1141 + <summary><strong>Custom Webhook</strong></summary> 1096 1142 1097 - ## Monitor Options 1143 + ```typescript 1144 + { 1145 + provider: NotificationProvider.WEBHOOK, 1146 + data: { 1147 + data: { 1148 + case: "webhook", 1149 + value: { 1150 + endpoint: "https://api.example.com/webhook", 1151 + headers: [ 1152 + { key: "Authorization", value: "Bearer token" }, 1153 + { key: "X-Custom-Header", value: "value" } 1154 + ] 1155 + } 1156 + } 1157 + } 1158 + } 1159 + ``` 1098 1160 1099 - ### HTTP Monitor 1161 + </details> 1100 1162 1101 - | Option | Type | Required | Description | 1102 - | ---------------------- | ------------------- | -------- | --------------------------------------------------- | 1103 - | `name` | string | Yes | Monitor name (max 256 chars) | 1104 - | `url` | string | Yes | URL to monitor (max 2048 chars) | 1105 - | `periodicity` | Periodicity | Yes | Check interval (see [Periodicity](#periodicity)) | 1106 - | `method` | HTTPMethod | No | HTTP method (see [HTTP Methods](#http-methods)) | 1107 - | `body` | string | No | Request body | 1108 - | `headers` | Headers[] | No | Custom headers (`{ key: string, value: string }[]`) | 1109 - | `timeout` | bigint | No | Timeout in ms (default: 45000, max: 120000) | 1110 - | `retry` | bigint | No | Retry attempts (default: 3, max: 10) | 1111 - | `followRedirects` | boolean | No | Follow redirects (default: true) | 1112 - | `regions` | Region[] | No | [Regions](#regions) for checks | 1113 - | `active` | boolean | No | Enable monitoring (default: false) | 1114 - | `public` | boolean | No | Public visibility (default: false) | 1115 - | `degradedAt` | bigint | No | Latency threshold (ms) for degraded status | 1116 - | `description` | string | No | Monitor description (max 1024 chars) | 1117 - | `statusCodeAssertions` | array | No | [Status code assertions](#status-code-assertions) | 1118 - | `bodyAssertions` | array | No | [Body assertions](#body-assertions) | 1119 - | `headerAssertions` | array | No | [Header assertions](#header-assertions) | 1120 - | `openTelemetry` | OpenTelemetryConfig | No | OpenTelemetry export configuration | 1163 + --- 1121 1164 1122 - ### TCP Monitor 1165 + ## Reference 1123 1166 1124 - | Option | Type | Required | Description | 1125 - | --------------- | ------------------- | -------- | ------------------------------------------------ | 1126 - | `name` | string | Yes | Monitor name (max 256 chars) | 1127 - | `uri` | string | Yes | `host:port` to monitor (max 2048 chars) | 1128 - | `periodicity` | Periodicity | Yes | Check interval (see [Periodicity](#periodicity)) | 1129 - | `timeout` | bigint | No | Timeout in ms (default: 45000, max: 120000) | 1130 - | `retry` | bigint | No | Retry attempts (default: 3, max: 10) | 1131 - | `regions` | Region[] | No | [Regions](#regions) for checks | 1132 - | `active` | boolean | No | Enable monitoring (default: false) | 1133 - | `public` | boolean | No | Public visibility (default: false) | 1134 - | `degradedAt` | bigint | No | Latency threshold (ms) for degraded status | 1135 - | `description` | string | No | Monitor description (max 1024 chars) | 1136 - | `openTelemetry` | OpenTelemetryConfig | No | OpenTelemetry export configuration | 1167 + ### Monitor Options 1137 1168 1138 - ### DNS Monitor 1169 + #### HTTP Monitor 1139 1170 1140 - | Option | Type | Required | Description | 1141 - | ------------------ | ------------------- | -------- | ------------------------------------------------ | 1142 - | `name` | string | Yes | Monitor name (max 256 chars) | 1143 - | `uri` | string | Yes | Domain to resolve (max 2048 chars) | 1144 - | `periodicity` | Periodicity | Yes | Check interval (see [Periodicity](#periodicity)) | 1145 - | `timeout` | bigint | No | Timeout in ms (default: 45000, max: 120000) | 1146 - | `retry` | bigint | No | Retry attempts (default: 3, max: 10) | 1147 - | `regions` | Region[] | No | [Regions](#regions) for checks | 1148 - | `active` | boolean | No | Enable monitoring (default: false) | 1149 - | `public` | boolean | No | Public visibility (default: false) | 1150 - | `degradedAt` | bigint | No | Latency threshold (ms) for degraded status | 1151 - | `description` | string | No | Monitor description (max 1024 chars) | 1152 - | `recordAssertions` | array | No | [DNS record assertions](#dns-record-assertions) | 1153 - | `openTelemetry` | OpenTelemetryConfig | No | OpenTelemetry export configuration | 1171 + | Option | Type | Required | Description | 1172 + | ---------------------- | ------------------- | -------- | ------------------------------------------ | 1173 + | `name` | string | Yes | Monitor name (max 256 chars) | 1174 + | `url` | string | Yes | URL to monitor (max 2048 chars) | 1175 + | `periodicity` | Periodicity | Yes | Check interval | 1176 + | `method` | HTTPMethod | No | HTTP method (default: GET) | 1177 + | `body` | string | No | Request body | 1178 + | `headers` | Headers[] | No | Custom headers `{ key, value }[]` | 1179 + | `timeout` | bigint | No | Timeout in ms (default: 45000, max: 120000)| 1180 + | `retry` | bigint | No | Retry attempts (default: 3, max: 10) | 1181 + | `followRedirects` | boolean | No | Follow redirects (default: true) | 1182 + | `regions` | Region[] | No | Regions for checks | 1183 + | `active` | boolean | No | Enable monitoring (default: false) | 1184 + | `public` | boolean | No | Public visibility (default: false) | 1185 + | `degradedAt` | bigint | No | Latency threshold (ms) for degraded status | 1186 + | `description` | string | No | Monitor description (max 1024 chars) | 1187 + | `statusCodeAssertions` | array | No | Status code assertions | 1188 + | `bodyAssertions` | array | No | Body assertions | 1189 + | `headerAssertions` | array | No | Header assertions | 1190 + | `openTelemetry` | OpenTelemetryConfig | No | OpenTelemetry export configuration | 1154 1191 1155 - ### Periodicity 1192 + #### TCP Monitor 1156 1193 1157 - | Enum Value | Description | 1158 - | ----------------- | ----------- | 1159 - | `PERIODICITY_30S` | Every 30s | 1160 - | `PERIODICITY_1M` | Every 1m | 1161 - | `PERIODICITY_5M` | Every 5m | 1162 - | `PERIODICITY_10M` | Every 10m | 1163 - | `PERIODICITY_30M` | Every 30m | 1164 - | `PERIODICITY_1H` | Every 1h | 1194 + | Option | Type | Required | Description | 1195 + | --------------- | ------------------- | -------- | ------------------------------------------ | 1196 + | `name` | string | Yes | Monitor name (max 256 chars) | 1197 + | `uri` | string | Yes | `host:port` to monitor (max 2048 chars) | 1198 + | `periodicity` | Periodicity | Yes | Check interval | 1199 + | `timeout` | bigint | No | Timeout in ms (default: 45000, max: 120000)| 1200 + | `retry` | bigint | No | Retry attempts (default: 3, max: 10) | 1201 + | `regions` | Region[] | No | Regions for checks | 1202 + | `active` | boolean | No | Enable monitoring (default: false) | 1203 + | `public` | boolean | No | Public visibility (default: false) | 1204 + | `degradedAt` | bigint | No | Latency threshold (ms) for degraded status | 1205 + | `description` | string | No | Monitor description (max 1024 chars) | 1206 + | `openTelemetry` | OpenTelemetryConfig | No | OpenTelemetry export configuration | 1165 1207 1166 - ### HTTP Methods 1208 + #### DNS Monitor 1167 1209 1168 - | Enum Value | Description | 1169 - | --------------------- | ----------- | 1170 - | `HTTP_METHOD_GET` | GET | 1171 - | `HTTP_METHOD_POST` | POST | 1172 - | `HTTP_METHOD_HEAD` | HEAD | 1173 - | `HTTP_METHOD_PUT` | PUT | 1174 - | `HTTP_METHOD_PATCH` | PATCH | 1175 - | `HTTP_METHOD_DELETE` | DELETE | 1176 - | `HTTP_METHOD_TRACE` | TRACE | 1177 - | `HTTP_METHOD_CONNECT` | CONNECT | 1178 - | `HTTP_METHOD_OPTIONS` | OPTIONS | 1210 + | Option | Type | Required | Description | 1211 + | ------------------ | ------------------- | -------- | ------------------------------------------ | 1212 + | `name` | string | Yes | Monitor name (max 256 chars) | 1213 + | `uri` | string | Yes | Domain to resolve (max 2048 chars) | 1214 + | `periodicity` | Periodicity | Yes | Check interval | 1215 + | `timeout` | bigint | No | Timeout in ms (default: 45000, max: 120000)| 1216 + | `retry` | bigint | No | Retry attempts (default: 3, max: 10) | 1217 + | `regions` | Region[] | No | Regions for checks | 1218 + | `active` | boolean | No | Enable monitoring (default: false) | 1219 + | `public` | boolean | No | Public visibility (default: false) | 1220 + | `degradedAt` | bigint | No | Latency threshold (ms) for degraded status | 1221 + | `description` | string | No | Monitor description (max 1024 chars) | 1222 + | `recordAssertions` | array | No | DNS record assertions | 1223 + | `openTelemetry` | OpenTelemetryConfig | No | OpenTelemetry export configuration | 1179 1224 1180 - ## Assertions 1225 + --- 1181 1226 1182 - All assertion comparators are exported as enums from the SDK. 1227 + ### Assertions 1183 1228 1184 - ### Status Code Assertions 1229 + #### Status Code Assertions 1185 1230 1186 1231 Validate HTTP response status codes using `NumberComparator`. 1187 1232 ··· 1196 1241 } 1197 1242 ``` 1198 1243 1199 - **NumberComparator values:** 1200 - 1201 - | Enum Value | Description | 1202 - | ----------------------- | --------------------- | 1203 - | `EQUAL` | Equal to target | 1204 - | `NOT_EQUAL` | Not equal to target | 1205 - | `GREATER_THAN` | Greater than target | 1206 - | `GREATER_THAN_OR_EQUAL` | Greater than or equal | 1207 - | `LESS_THAN` | Less than target | 1208 - | `LESS_THAN_OR_EQUAL` | Less than or equal | 1209 - 1210 - ### Body Assertions 1244 + #### Body Assertions 1211 1245 1212 1246 Validate response body content using `StringComparator`. 1213 1247 ··· 1222 1256 } 1223 1257 ``` 1224 1258 1225 - **StringComparator values:** 1226 - 1227 - | Enum Value | Description | 1228 - | ----------------------- | --------------------------- | 1229 - | `CONTAINS` | Contains target string | 1230 - | `NOT_CONTAINS` | Does not contain target | 1231 - | `EQUAL` | Equal to target | 1232 - | `NOT_EQUAL` | Not equal to target | 1233 - | `EMPTY` | Body is empty | 1234 - | `NOT_EMPTY` | Body is not empty | 1235 - | `GREATER_THAN` | Lexicographically greater | 1236 - | `GREATER_THAN_OR_EQUAL` | Lexicographically >= target | 1237 - | `LESS_THAN` | Lexicographically less | 1238 - | `LESS_THAN_OR_EQUAL` | Lexicographically <= target | 1239 - 1240 - ### Header Assertions 1259 + #### Header Assertions 1241 1260 1242 1261 Validate response headers using `StringComparator`. 1243 1262 ··· 1255 1274 } 1256 1275 ``` 1257 1276 1258 - ### DNS Record Assertions 1277 + #### DNS Record Assertions 1259 1278 1260 1279 Validate DNS records using `RecordComparator`. 1261 1280 ··· 1274 1293 } 1275 1294 ``` 1276 1295 1277 - **RecordComparator values:** 1296 + **Supported record types:** `A`, `AAAA`, `CNAME`, `MX`, `TXT` 1278 1297 1279 - | Enum Value | Description | 1280 - | -------------- | ----------------------- | 1281 - | `EQUAL` | Equal to target | 1282 - | `NOT_EQUAL` | Not equal to target | 1283 - | `CONTAINS` | Contains target string | 1284 - | `NOT_CONTAINS` | Does not contain target | 1298 + --- 1285 1299 1286 - **Supported record types:** `A`, `AAAA`, `CNAME`, `MX`, `TXT` 1287 - 1288 - ## Regions 1300 + ### Regions 1289 1301 1290 - Monitor from 28 global locations across multiple providers. Use the `Region` 1291 - enum: 1302 + Monitor from 28 global locations across multiple providers. 1292 1303 1293 1304 ```typescript 1294 1305 import { Region } from "@openstatus/sdk-node"; 1295 1306 1296 - // Example: Use specific regions 1297 1307 regions: [Region.FLY_AMS, Region.FLY_IAD, Region.KOYEB_FRA]; 1298 1308 ``` 1299 1309 1300 - ### Fly.io Regions 1310 + #### Fly.io Regions (18) 1301 1311 1302 1312 | Enum Value | Location | 1303 1313 | ---------- | --------------- | ··· 1320 1330 | `FLY_SYD` | Sydney | 1321 1331 | `FLY_YYZ` | Toronto | 1322 1332 1323 - ### Koyeb Regions 1333 + #### Koyeb Regions (6) 1324 1334 1325 1335 | Enum Value | Location | 1326 1336 | ----------- | ------------- | ··· 1331 1341 | `KOYEB_TYO` | Tokyo | 1332 1342 | `KOYEB_WAS` | Washington | 1333 1343 1334 - ### Railway Regions 1344 + #### Railway Regions (4) 1335 1345 1336 1346 | Enum Value | Location | 1337 1347 | ------------------------- | -------------- | ··· 1339 1349 | `RAILWAY_US_EAST4` | US East | 1340 1350 | `RAILWAY_EUROPE_WEST4` | Europe West | 1341 1351 | `RAILWAY_ASIA_SOUTHEAST1` | Asia Southeast | 1352 + 1353 + --- 1354 + 1355 + ### Enums 1356 + 1357 + #### Periodicity 1358 + 1359 + | Value | Description | 1360 + | ----------------- | ----------- | 1361 + | `PERIODICITY_30S` | Every 30s | 1362 + | `PERIODICITY_1M` | Every 1m | 1363 + | `PERIODICITY_5M` | Every 5m | 1364 + | `PERIODICITY_10M` | Every 10m | 1365 + | `PERIODICITY_30M` | Every 30m | 1366 + | `PERIODICITY_1H` | Every 1h | 1367 + 1368 + #### HTTPMethod 1369 + 1370 + | Value | Description | 1371 + | --------------------- | ----------- | 1372 + | `HTTP_METHOD_GET` | GET | 1373 + | `HTTP_METHOD_POST` | POST | 1374 + | `HTTP_METHOD_HEAD` | HEAD | 1375 + | `HTTP_METHOD_PUT` | PUT | 1376 + | `HTTP_METHOD_PATCH` | PATCH | 1377 + | `HTTP_METHOD_DELETE` | DELETE | 1378 + | `HTTP_METHOD_TRACE` | TRACE | 1379 + | `HTTP_METHOD_CONNECT` | CONNECT | 1380 + | `HTTP_METHOD_OPTIONS` | OPTIONS | 1381 + 1382 + #### MonitorStatus 1383 + 1384 + | Value | Description | 1385 + | ---------- | ------------------------ | 1386 + | `ACTIVE` | Monitor is healthy | 1387 + | `DEGRADED` | Latency threshold exceeded | 1388 + | `ERROR` | Monitor is failing | 1389 + 1390 + #### TimeRange 1391 + 1392 + | Value | Description | 1393 + | ----------------- | ----------- | 1394 + | `TIME_RANGE_1D` | Last 1 day | 1395 + | `TIME_RANGE_7D` | Last 7 days | 1396 + | `TIME_RANGE_14D` | Last 14 days| 1397 + 1398 + #### StatusReportStatus 1399 + 1400 + | Value | Description | 1401 + | --------------- | -------------------------------- | 1402 + | `INVESTIGATING` | Actively investigating the issue | 1403 + | `IDENTIFIED` | Root cause has been identified | 1404 + | `MONITORING` | Fix deployed, monitoring | 1405 + | `RESOLVED` | Issue fully resolved | 1406 + 1407 + #### OverallStatus 1408 + 1409 + | Value | Description | 1410 + | ---------------- | --------------------------- | 1411 + | `OPERATIONAL` | All systems operational | 1412 + | `DEGRADED` | Performance is degraded | 1413 + | `PARTIAL_OUTAGE` | Some systems are down | 1414 + | `MAJOR_OUTAGE` | Major systems are down | 1415 + | `MAINTENANCE` | Scheduled maintenance | 1416 + | `UNKNOWN` | Status cannot be determined | 1417 + 1418 + #### NotificationProvider 1419 + 1420 + | Value | Description | 1421 + | ---------------- | ------------------- | 1422 + | `DISCORD` | Discord webhook | 1423 + | `EMAIL` | Email notification | 1424 + | `GOOGLE_CHAT` | Google Chat webhook | 1425 + | `GRAFANA_ONCALL` | Grafana OnCall | 1426 + | `NTFY` | Ntfy push service | 1427 + | `PAGERDUTY` | PagerDuty | 1428 + | `OPSGENIE` | Opsgenie | 1429 + | `SLACK` | Slack webhook | 1430 + | `SMS` | SMS notification | 1431 + | `TELEGRAM` | Telegram bot | 1432 + | `WEBHOOK` | Custom webhook | 1433 + | `WHATSAPP` | WhatsApp | 1434 + 1435 + #### OpsgenieRegion 1436 + 1437 + | Value | Description | 1438 + | ----- | ----------- | 1439 + | `US` | US region | 1440 + | `EU` | EU region | 1441 + 1442 + #### PageAccessType 1443 + 1444 + | Value | Description | 1445 + | -------------------- | ----------------------- | 1446 + | `PUBLIC` | Publicly accessible | 1447 + | `PASSWORD_PROTECTED` | Requires password | 1448 + | `AUTHENTICATED` | Requires authentication | 1449 + 1450 + #### PageTheme 1451 + 1452 + | Value | Description | 1453 + | -------- | ------------------- | 1454 + | `SYSTEM` | Follow system theme | 1455 + | `LIGHT` | Light theme | 1456 + | `DARK` | Dark theme | 1457 + 1458 + #### PageComponentType 1459 + 1460 + | Value | Description | 1461 + | --------- | ------------------------- | 1462 + | `MONITOR` | Linked to a monitor | 1463 + | `STATIC` | Static component (manual) | 1464 + 1465 + #### NumberComparator 1466 + 1467 + | Value | Description | 1468 + | ----------------------- | --------------------- | 1469 + | `EQUAL` | Equal to target | 1470 + | `NOT_EQUAL` | Not equal to target | 1471 + | `GREATER_THAN` | Greater than target | 1472 + | `GREATER_THAN_OR_EQUAL` | Greater than or equal | 1473 + | `LESS_THAN` | Less than target | 1474 + | `LESS_THAN_OR_EQUAL` | Less than or equal | 1475 + 1476 + #### StringComparator 1477 + 1478 + | Value | Description | 1479 + | ----------------------- | --------------------------- | 1480 + | `CONTAINS` | Contains target string | 1481 + | `NOT_CONTAINS` | Does not contain target | 1482 + | `EQUAL` | Equal to target | 1483 + | `NOT_EQUAL` | Not equal to target | 1484 + | `EMPTY` | Value is empty | 1485 + | `NOT_EMPTY` | Value is not empty | 1486 + | `GREATER_THAN` | Lexicographically greater | 1487 + | `GREATER_THAN_OR_EQUAL` | Lexicographically >= target | 1488 + | `LESS_THAN` | Lexicographically less | 1489 + | `LESS_THAN_OR_EQUAL` | Lexicographically <= target | 1490 + 1491 + #### RecordComparator 1492 + 1493 + | Value | Description | 1494 + | -------------- | ----------------------- | 1495 + | `EQUAL` | Equal to target | 1496 + | `NOT_EQUAL` | Not equal to target | 1497 + | `CONTAINS` | Contains target string | 1498 + | `NOT_CONTAINS` | Does not contain target | 1499 + 1500 + --- 1342 1501 1343 1502 ## Error Handling 1344 1503