diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8ebd951..7ad1e5f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -47,3 +47,4 @@ jobs: run: npm publish --access public --provenance env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_CONFIG_PROVENANCE: true diff --git a/README.md b/README.md index a7972a6..21a80e4 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ status page with uptime monitoring. - **Subscribers** - Manage email subscriptions for status updates - **Status Reports** - Manage incident reports with update timelines - **Maintenance Windows** - Schedule and manage planned maintenance periods +- **Notifications** - Configure notification channels (Slack, Discord, Email, + PagerDuty, etc.) ### Monitoring @@ -821,6 +823,229 @@ const { success } = await openstatus.maintenance.v1.MaintenanceService ); ``` +### Notification Service + +Manage notification channels for monitor alerts. + +#### `createNotification(request, options)` + +Create a new notification channel. + +```typescript +import { NotificationProvider } from "@openstatus/sdk-node"; + +// Create a Slack notification +const { notification } = await openstatus.notification.v1.NotificationService + .createNotification( + { + name: "Slack Alerts", + provider: NotificationProvider.SLACK, + data: { + data: { + case: "slack", + value: { webhookUrl: "https://hooks.slack.com/services/..." }, + }, + }, + monitorIds: ["mon_123", "mon_456"], + }, + { headers }, + ); + +console.log(`Notification created: ${notification?.id}`); +``` + +#### `getNotification(request, options)` + +Get a notification channel by ID. + +```typescript +const { notification } = await openstatus.notification.v1.NotificationService + .getNotification( + { id: "notif_123" }, + { headers }, + ); + +console.log(`Name: ${notification?.name}`); +console.log(`Provider: ${NotificationProvider[notification?.provider ?? 0]}`); +``` + +#### `listNotifications(request, options)` + +List all notification channels with pagination. + +```typescript +const { notifications, totalSize } = await openstatus.notification.v1 + .NotificationService.listNotifications( + { limit: 10, offset: 0 }, + { headers }, + ); + +console.log(`Found ${totalSize} notification channels`); +``` + +#### `updateNotification(request, options)` + +Update a notification channel. + +```typescript +const { notification } = await openstatus.notification.v1.NotificationService + .updateNotification( + { + id: "notif_123", + name: "Updated Slack Alerts", + monitorIds: ["mon_123", "mon_456", "mon_789"], + }, + { headers }, + ); +``` + +#### `deleteNotification(request, options)` + +Delete a notification channel. + +```typescript +const { success } = await openstatus.notification.v1.NotificationService + .deleteNotification( + { id: "notif_123" }, + { headers }, + ); +``` + +#### `sendTestNotification(request, options)` + +Send a test notification to verify configuration. + +```typescript +import { NotificationProvider } from "@openstatus/sdk-node"; + +const { success, errorMessage } = await openstatus.notification.v1 + .NotificationService.sendTestNotification( + { + provider: NotificationProvider.SLACK, + data: { + data: { + case: "slack", + value: { webhookUrl: "https://hooks.slack.com/services/..." }, + }, + }, + }, + { headers }, + ); + +if (success) { + console.log("Test notification sent successfully"); +} else { + console.log(`Test failed: ${errorMessage}`); +} +``` + +#### `checkNotificationLimit(request, options)` + +Check if the workspace has reached its notification limit. + +```typescript +const { limitReached, currentCount, maxCount } = await openstatus.notification + .v1.NotificationService.checkNotificationLimit({}, { headers }); + +console.log(`${currentCount}/${maxCount} notification channels used`); +if (limitReached) { + console.log("Notification limit reached"); +} +``` + +### Notification Providers + +| Enum Value | Description | +| ---------------- | -------------------- | +| `UNSPECIFIED` | Default/unspecified | +| `DISCORD` | Discord webhook | +| `EMAIL` | Email notification | +| `GOOGLE_CHAT` | Google Chat webhook | +| `GRAFANA_ONCALL` | Grafana OnCall | +| `NTFY` | Ntfy push service | +| `PAGERDUTY` | PagerDuty | +| `OPSGENIE` | Opsgenie | +| `SLACK` | Slack webhook | +| `SMS` | SMS notification | +| `TELEGRAM` | Telegram bot | +| `WEBHOOK` | Custom webhook | +| `WHATSAPP` | WhatsApp | + +### Provider Configuration Examples + +#### Discord + +```typescript +{ + data: { + case: "discord", + value: { webhookUrl: "https://discord.com/api/webhooks/..." } + } +} +``` + +#### Email + +```typescript +{ + data: { + case: "email", + value: { email: "alerts@example.com" } + } +} +``` + +#### PagerDuty + +```typescript +{ + data: { + case: "pagerduty", + value: { integrationKey: "your-integration-key" } + } +} +``` + +#### Opsgenie + +```typescript +import { OpsgenieRegion } from "@openstatus/sdk-node"; + +{ + data: { + case: "opsgenie", + value: { apiKey: "your-api-key", region: OpsgenieRegion.US } + } +} +``` + +#### Telegram + +```typescript +{ + data: { + case: "telegram", + value: { chatId: "123456789" } + } +} +``` + +#### Custom Webhook + +```typescript +{ + data: { + case: "webhook", + value: { + endpoint: "https://api.example.com/webhook", + headers: [ + { key: "Authorization", value: "Bearer token" } + ] + } + } +} +``` + ### Status Page Options | Option | Type | Required | Description | diff --git a/scripts/build_npm.ts b/scripts/build_npm.ts index bb65051..61cae38 100644 --- a/scripts/build_npm.ts +++ b/scripts/build_npm.ts @@ -22,6 +22,10 @@ await build({ bugs: { url: "https://github.com/openstatushq/sdk-node/issues", }, + publishConfig: { + access: "public", + provenance: true, + }, }, postBuild() { // steps to run after building and before running the tests diff --git a/src/gen/openstatus/notification/v1/notification_pb.ts b/src/gen/openstatus/notification/v1/notification_pb.ts new file mode 100644 index 0000000..3ddfac5 --- /dev/null +++ b/src/gen/openstatus/notification/v1/notification_pb.ts @@ -0,0 +1,144 @@ +// @generated by protoc-gen-es v2.11.0 with parameter "target=ts,import_extension=ts" +// @generated from file openstatus/notification/v1/notification.proto (package openstatus.notification.v1, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2"; +import type { NotificationData, NotificationProvider } from "./providers_pb.ts"; +import { file_openstatus_notification_v1_providers } from "./providers_pb.ts"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file openstatus/notification/v1/notification.proto. + */ +export const file_openstatus_notification_v1_notification: + GenFile = /*@__PURE__*/ + fileDesc( + "Ci1vcGVuc3RhdHVzL25vdGlmaWNhdGlvbi92MS9ub3RpZmljYXRpb24ucHJvdG8SGm9wZW5zdGF0dXMubm90aWZpY2F0aW9uLnYxIuUBCgxOb3RpZmljYXRpb24SCgoCaWQYASABKAkSDAoEbmFtZRgCIAEoCRJCCghwcm92aWRlchgDIAEoDjIwLm9wZW5zdGF0dXMubm90aWZpY2F0aW9uLnYxLk5vdGlmaWNhdGlvblByb3ZpZGVyEjoKBGRhdGEYBCABKAsyLC5vcGVuc3RhdHVzLm5vdGlmaWNhdGlvbi52MS5Ob3RpZmljYXRpb25EYXRhEhMKC21vbml0b3JfaWRzGAUgAygJEhIKCmNyZWF0ZWRfYXQYBiABKAkSEgoKdXBkYXRlZF9hdBgHIAEoCSKyAQoTTm90aWZpY2F0aW9uU3VtbWFyeRIKCgJpZBgBIAEoCRIMCgRuYW1lGAIgASgJEkIKCHByb3ZpZGVyGAMgASgOMjAub3BlbnN0YXR1cy5ub3RpZmljYXRpb24udjEuTm90aWZpY2F0aW9uUHJvdmlkZXISFQoNbW9uaXRvcl9jb3VudBgEIAEoBRISCgpjcmVhdGVkX2F0GAUgASgJEhIKCnVwZGF0ZWRfYXQYBiABKAlCXVpbZ2l0aHViLmNvbS9vcGVuc3RhdHVzaHEvb3BlbnN0YXR1cy9wYWNrYWdlcy9wcm90by9vcGVuc3RhdHVzL25vdGlmaWNhdGlvbi92MTtub3RpZmljYXRpb252MWIGcHJvdG8z", + [file_openstatus_notification_v1_providers], + ); + +/** + * Notification represents a notification channel with full details. + * + * @generated from message openstatus.notification.v1.Notification + */ +export type Notification = + & Message<"openstatus.notification.v1.Notification"> + & { + /** + * Unique identifier for the notification. + * + * @generated from field: string id = 1; + */ + id: string; + + /** + * Display name for the notification channel. + * + * @generated from field: string name = 2; + */ + name: string; + + /** + * Provider type. + * + * @generated from field: openstatus.notification.v1.NotificationProvider provider = 3; + */ + provider: NotificationProvider; + + /** + * Provider-specific configuration. + * + * @generated from field: openstatus.notification.v1.NotificationData data = 4; + */ + data?: NotificationData; + + /** + * IDs of monitors associated with this notification. + * + * @generated from field: repeated string monitor_ids = 5; + */ + monitorIds: string[]; + + /** + * Timestamp when the notification was created (RFC 3339). + * + * @generated from field: string created_at = 6; + */ + createdAt: string; + + /** + * Timestamp when the notification was last updated (RFC 3339). + * + * @generated from field: string updated_at = 7; + */ + updatedAt: string; + }; + +/** + * Describes the message openstatus.notification.v1.Notification. + * Use `create(NotificationSchema)` to create a new message. + */ +export const NotificationSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_notification, 0); + +/** + * NotificationSummary represents a notification channel summary for list responses. + * + * @generated from message openstatus.notification.v1.NotificationSummary + */ +export type NotificationSummary = + & Message<"openstatus.notification.v1.NotificationSummary"> + & { + /** + * Unique identifier for the notification. + * + * @generated from field: string id = 1; + */ + id: string; + + /** + * Display name for the notification channel. + * + * @generated from field: string name = 2; + */ + name: string; + + /** + * Provider type. + * + * @generated from field: openstatus.notification.v1.NotificationProvider provider = 3; + */ + provider: NotificationProvider; + + /** + * Number of monitors associated with this notification. + * + * @generated from field: int32 monitor_count = 4; + */ + monitorCount: number; + + /** + * Timestamp when the notification was created (RFC 3339). + * + * @generated from field: string created_at = 5; + */ + createdAt: string; + + /** + * Timestamp when the notification was last updated (RFC 3339). + * + * @generated from field: string updated_at = 6; + */ + updatedAt: string; + }; + +/** + * Describes the message openstatus.notification.v1.NotificationSummary. + * Use `create(NotificationSummarySchema)` to create a new message. + */ +export const NotificationSummarySchema: GenMessage< + NotificationSummary +> = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_notification, 1); diff --git a/src/gen/openstatus/notification/v1/providers_pb.ts b/src/gen/openstatus/notification/v1/providers_pb.ts new file mode 100644 index 0000000..66e6440 --- /dev/null +++ b/src/gen/openstatus/notification/v1/providers_pb.ts @@ -0,0 +1,604 @@ +// @generated by protoc-gen-es v2.11.0 with parameter "target=ts,import_extension=ts" +// @generated from file openstatus/notification/v1/providers.proto (package openstatus.notification.v1, syntax proto3) +/* eslint-disable */ + +import type { + GenEnum, + GenFile, + GenMessage, +} from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2"; +import { file_buf_validate_validate } from "../../../buf/validate/validate_pb.ts"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file openstatus/notification/v1/providers.proto. + */ +export const file_openstatus_notification_v1_providers: GenFile = /*@__PURE__*/ + fileDesc( + "CipvcGVuc3RhdHVzL25vdGlmaWNhdGlvbi92MS9wcm92aWRlcnMucHJvdG8SGm9wZW5zdGF0dXMubm90aWZpY2F0aW9uLnYxIiwKC0Rpc2NvcmREYXRhEh0KC3dlYmhvb2tfdXJsGAEgASgJQgi6SAVyA4gBASIjCglFbWFpbERhdGESFgoFZW1haWwYASABKAlCB7pIBHICYAEiLwoOR29vZ2xlQ2hhdERhdGESHQoLd2ViaG9va191cmwYASABKAlCCLpIBXIDiAEBIjIKEUdyYWZhbmFPbmNhbGxEYXRhEh0KC3dlYmhvb2tfdXJsGAEgASgJQgi6SAVyA4gBASJUCghOdGZ5RGF0YRIWCgV0b3BpYxgBIAEoCUIHukgEcgIQARISCgpzZXJ2ZXJfdXJsGAIgASgJEhIKBXRva2VuGAMgASgJSACIAQFCCAoGX3Rva2VuIjEKDVBhZ2VyRHV0eURhdGESIAoPaW50ZWdyYXRpb25fa2V5GAEgASgJQge6SARyAhABIm4KDE9wc2dlbmllRGF0YRIYCgdhcGlfa2V5GAEgASgJQge6SARyAhABEkQKBnJlZ2lvbhgCIAEoDjIqLm9wZW5zdGF0dXMubm90aWZpY2F0aW9uLnYxLk9wc2dlbmllUmVnaW9uQgi6SAWCAQIQASIqCglTbGFja0RhdGESHQoLd2ViaG9va191cmwYASABKAlCCLpIBXIDiAEBIigKB1Ntc0RhdGESHQoMcGhvbmVfbnVtYmVyGAEgASgJQge6SARyAhABIigKDFRlbGVncmFtRGF0YRIYCgdjaGF0X2lkGAEgASgJQge6SARyAhABIjQKDVdlYmhvb2tIZWFkZXISFAoDa2V5GAEgASgJQge6SARyAhABEg0KBXZhbHVlGAIgASgJImUKC1dlYmhvb2tEYXRhEhoKCGVuZHBvaW50GAEgASgJQgi6SAVyA4gBARI6CgdoZWFkZXJzGAIgAygLMikub3BlbnN0Y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V2hhdHNhcHBEYXRhSABCBgoEZGF0YSrmAwoUTm90aWZpY2F0aW9uUHJvdmlkZXISJQohTk9USUZJQ0FUSU9OX1BST1ZJREVSX1VOU1BFQ0lGSUVEEAASIQodTk9USUZJQ0FUSU9OX1BST1ZJREVSX0RJU0NPUkQQARIfChtOT1RJRklDQVRJT05fUFJPVklERVJfRU1BSUwQAhIlCiFOT1RJRklDQVRJT05fUFJPVklERVJfR09PR0xFX0NIQVQQAxIoCiROT1RJRklDQVRJT05fUFJPVklERVJfR1JBRkFOQV9PTkNBTEwQBBIeChpOT1RJRklDQVRJT05fUFJPVklERVJfTlRGWRAFEiMKH05PVElGSUNBVElPTl9QUk9WSURFUl9QQUdFUkRVVFkQBhIiCh5OT1RJRklDQVRJT05fUFJPVklERVJfT1BTR0VOSUUQBxIfChtOT1RJRklDQVRJT05fUFJPVklERVJfU0xBQ0sQCBIdChlOT1RJRklDQVRJT05fUFJPVklERVJfU01TEAkSIgoeTk9USUZJQ0FUSU9OX1BST1ZJREVSX1RFTEVHUkFNEAoSIQodTk9USUZJQ0FUSU9OX1BST1ZJREVSX1dFQkhPT0sQCxIiCh5OT1RJRklDQVRJT05fUFJPVklERVJfV0hBVFNBUFAQDCphCg5PcHNnZW5pZVJlZ2lvbhIfChtPUFNHRU5JRV9SRUdJT05fVU5TUEVDSUZJRUQQABIWChJPUFNHRU5JRV9SRUdJT05fVVMQARIWChJPUFNHRU5JRV9SRUdJT05fRVUQAkJdWltnaXRodWIuY29tL29wZW5zdGF0dXNocS9vcGVuc3RhdHVzL3BhY2thZ2VzL3Byb3RvL29wZW5zdGF0dXMvbm90aWZpY2F0aW9uL3YxO25vdGlmaWNhdGlvbnYxYgZwcm90bzM", + [file_buf_validate_validate], + ); + +/** + * DiscordData contains configuration for Discord notifications. + * + * @generated from message openstatus.notification.v1.DiscordData + */ +export type DiscordData = Message<"openstatus.notification.v1.DiscordData"> & { + /** + * Discord webhook URL. + * + * @generated from field: string webhook_url = 1; + */ + webhookUrl: string; +}; + +/** + * Describes the message openstatus.notification.v1.DiscordData. + * Use `create(DiscordDataSchema)` to create a new message. + */ +export const DiscordDataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_providers, 0); + +/** + * EmailData contains configuration for email notifications. + * + * @generated from message openstatus.notification.v1.EmailData + */ +export type EmailData = Message<"openstatus.notification.v1.EmailData"> & { + /** + * Email address to send notifications to. + * + * @generated from field: string email = 1; + */ + email: string; +}; + +/** + * Describes the message openstatus.notification.v1.EmailData. + * Use `create(EmailDataSchema)` to create a new message. + */ +export const EmailDataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_providers, 1); + +/** + * GoogleChatData contains configuration for Google Chat notifications. + * + * @generated from message openstatus.notification.v1.GoogleChatData + */ +export type GoogleChatData = + & Message<"openstatus.notification.v1.GoogleChatData"> + & { + /** + * Google Chat webhook URL. + * + * @generated from field: string webhook_url = 1; + */ + webhookUrl: string; + }; + +/** + * Describes the message openstatus.notification.v1.GoogleChatData. + * Use `create(GoogleChatDataSchema)` to create a new message. + */ +export const GoogleChatDataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_providers, 2); + +/** + * GrafanaOncallData contains configuration for Grafana OnCall notifications. + * + * @generated from message openstatus.notification.v1.GrafanaOncallData + */ +export type GrafanaOncallData = + & Message<"openstatus.notification.v1.GrafanaOncallData"> + & { + /** + * Grafana OnCall webhook URL. + * + * @generated from field: string webhook_url = 1; + */ + webhookUrl: string; + }; + +/** + * Describes the message openstatus.notification.v1.GrafanaOncallData. + * Use `create(GrafanaOncallDataSchema)` to create a new message. + */ +export const GrafanaOncallDataSchema: GenMessage< + GrafanaOncallData +> = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_providers, 3); + +/** + * NtfyData contains configuration for Ntfy notifications. + * + * @generated from message openstatus.notification.v1.NtfyData + */ +export type NtfyData = Message<"openstatus.notification.v1.NtfyData"> & { + /** + * Ntfy topic to publish to. + * + * @generated from field: string topic = 1; + */ + topic: string; + + /** + * Ntfy server URL (defaults to https://ntfy.sh). + * + * @generated from field: string server_url = 2; + */ + serverUrl: string; + + /** + * Optional authentication token. + * + * @generated from field: optional string token = 3; + */ + token?: string; +}; + +/** + * Describes the message openstatus.notification.v1.NtfyData. + * Use `create(NtfyDataSchema)` to create a new message. + */ +export const NtfyDataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_providers, 4); + +/** + * PagerDutyData contains configuration for PagerDuty notifications. + * + * @generated from message openstatus.notification.v1.PagerDutyData + */ +export type PagerDutyData = + & Message<"openstatus.notification.v1.PagerDutyData"> + & { + /** + * PagerDuty integration key. + * + * @generated from field: string integration_key = 1; + */ + integrationKey: string; + }; + +/** + * Describes the message openstatus.notification.v1.PagerDutyData. + * Use `create(PagerDutyDataSchema)` to create a new message. + */ +export const PagerDutyDataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_providers, 5); + +/** + * OpsgenieData contains configuration for Opsgenie notifications. + * + * @generated from message openstatus.notification.v1.OpsgenieData + */ +export type OpsgenieData = + & Message<"openstatus.notification.v1.OpsgenieData"> + & { + /** + * Opsgenie API key. + * + * @generated from field: string api_key = 1; + */ + apiKey: string; + + /** + * Opsgenie region. + * + * @generated from field: openstatus.notification.v1.OpsgenieRegion region = 2; + */ + region: OpsgenieRegion; + }; + +/** + * Describes the message openstatus.notification.v1.OpsgenieData. + * Use `create(OpsgenieDataSchema)` to create a new message. + */ +export const OpsgenieDataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_providers, 6); + +/** + * SlackData contains configuration for Slack notifications. + * + * @generated from message openstatus.notification.v1.SlackData + */ +export type SlackData = Message<"openstatus.notification.v1.SlackData"> & { + /** + * Slack webhook URL. + * + * @generated from field: string webhook_url = 1; + */ + webhookUrl: string; +}; + +/** + * Describes the message openstatus.notification.v1.SlackData. + * Use `create(SlackDataSchema)` to create a new message. + */ +export const SlackDataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_providers, 7); + +/** + * SmsData contains configuration for SMS notifications. + * + * @generated from message openstatus.notification.v1.SmsData + */ +export type SmsData = Message<"openstatus.notification.v1.SmsData"> & { + /** + * Phone number to send SMS to. + * + * @generated from field: string phone_number = 1; + */ + phoneNumber: string; +}; + +/** + * Describes the message openstatus.notification.v1.SmsData. + * Use `create(SmsDataSchema)` to create a new message. + */ +export const SmsDataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_providers, 8); + +/** + * TelegramData contains configuration for Telegram notifications. + * + * @generated from message openstatus.notification.v1.TelegramData + */ +export type TelegramData = + & Message<"openstatus.notification.v1.TelegramData"> + & { + /** + * Telegram chat ID. + * + * @generated from field: string chat_id = 1; + */ + chatId: string; + }; + +/** + * Describes the message openstatus.notification.v1.TelegramData. + * Use `create(TelegramDataSchema)` to create a new message. + */ +export const TelegramDataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_providers, 9); + +/** + * WebhookHeader represents a custom header for webhook requests. + * + * @generated from message openstatus.notification.v1.WebhookHeader + */ +export type WebhookHeader = + & Message<"openstatus.notification.v1.WebhookHeader"> + & { + /** + * Header name. + * + * @generated from field: string key = 1; + */ + key: string; + + /** + * Header value. + * + * @generated from field: string value = 2; + */ + value: string; + }; + +/** + * Describes the message openstatus.notification.v1.WebhookHeader. + * Use `create(WebhookHeaderSchema)` to create a new message. + */ +export const WebhookHeaderSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_providers, 10); + +/** + * WebhookData contains configuration for custom webhook notifications. + * + * @generated from message openstatus.notification.v1.WebhookData + */ +export type WebhookData = Message<"openstatus.notification.v1.WebhookData"> & { + /** + * Webhook endpoint URL. + * + * @generated from field: string endpoint = 1; + */ + endpoint: string; + + /** + * Optional custom headers. + * + * @generated from field: repeated openstatus.notification.v1.WebhookHeader headers = 2; + */ + headers: WebhookHeader[]; +}; + +/** + * Describes the message openstatus.notification.v1.WebhookData. + * Use `create(WebhookDataSchema)` to create a new message. + */ +export const WebhookDataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_providers, 11); + +/** + * WhatsappData contains configuration for WhatsApp notifications. + * + * @generated from message openstatus.notification.v1.WhatsappData + */ +export type WhatsappData = + & Message<"openstatus.notification.v1.WhatsappData"> + & { + /** + * Phone number to send WhatsApp messages to. + * + * @generated from field: string phone_number = 1; + */ + phoneNumber: string; + }; + +/** + * Describes the message openstatus.notification.v1.WhatsappData. + * Use `create(WhatsappDataSchema)` to create a new message. + */ +export const WhatsappDataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_providers, 12); + +/** + * NotificationData is a union of provider-specific configuration. + * + * @generated from message openstatus.notification.v1.NotificationData + */ +export type NotificationData = + & Message<"openstatus.notification.v1.NotificationData"> + & { + /** + * @generated from oneof openstatus.notification.v1.NotificationData.data + */ + data: { + /** + * Discord configuration. + * + * @generated from field: openstatus.notification.v1.DiscordData discord = 1; + */ + value: DiscordData; + case: "discord"; + } | { + /** + * Email configuration. + * + * @generated from field: openstatus.notification.v1.EmailData email = 2; + */ + value: EmailData; + case: "email"; + } | { + /** + * Google Chat configuration. + * + * @generated from field: openstatus.notification.v1.GoogleChatData google_chat = 3; + */ + value: GoogleChatData; + case: "googleChat"; + } | { + /** + * Grafana OnCall configuration. + * + * @generated from field: openstatus.notification.v1.GrafanaOncallData grafana_oncall = 4; + */ + value: GrafanaOncallData; + case: "grafanaOncall"; + } | { + /** + * Ntfy configuration. + * + * @generated from field: openstatus.notification.v1.NtfyData ntfy = 5; + */ + value: NtfyData; + case: "ntfy"; + } | { + /** + * PagerDuty configuration. + * + * @generated from field: openstatus.notification.v1.PagerDutyData pagerduty = 6; + */ + value: PagerDutyData; + case: "pagerduty"; + } | { + /** + * Opsgenie configuration. + * + * @generated from field: openstatus.notification.v1.OpsgenieData opsgenie = 7; + */ + value: OpsgenieData; + case: "opsgenie"; + } | { + /** + * Slack configuration. + * + * @generated from field: openstatus.notification.v1.SlackData slack = 8; + */ + value: SlackData; + case: "slack"; + } | { + /** + * SMS configuration. + * + * @generated from field: openstatus.notification.v1.SmsData sms = 9; + */ + value: SmsData; + case: "sms"; + } | { + /** + * Telegram configuration. + * + * @generated from field: openstatus.notification.v1.TelegramData telegram = 10; + */ + value: TelegramData; + case: "telegram"; + } | { + /** + * Webhook configuration. + * + * @generated from field: openstatus.notification.v1.WebhookData webhook = 11; + */ + value: WebhookData; + case: "webhook"; + } | { + /** + * WhatsApp configuration. + * + * @generated from field: openstatus.notification.v1.WhatsappData whatsapp = 12; + */ + value: WhatsappData; + case: "whatsapp"; + } | { case: undefined; value?: undefined }; + }; + +/** + * Describes the message openstatus.notification.v1.NotificationData. + * Use `create(NotificationDataSchema)` to create a new message. + */ +export const NotificationDataSchema: GenMessage< + NotificationData +> = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_providers, 13); + +/** + * NotificationProvider represents the supported notification channel types. + * + * @generated from enum openstatus.notification.v1.NotificationProvider + */ +export enum NotificationProvider { + /** + * Unspecified provider. + * + * @generated from enum value: NOTIFICATION_PROVIDER_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * Discord webhook. + * + * @generated from enum value: NOTIFICATION_PROVIDER_DISCORD = 1; + */ + DISCORD = 1, + + /** + * Email notification. + * + * @generated from enum value: NOTIFICATION_PROVIDER_EMAIL = 2; + */ + EMAIL = 2, + + /** + * Google Chat webhook. + * + * @generated from enum value: NOTIFICATION_PROVIDER_GOOGLE_CHAT = 3; + */ + GOOGLE_CHAT = 3, + + /** + * Grafana OnCall webhook. + * + * @generated from enum value: NOTIFICATION_PROVIDER_GRAFANA_ONCALL = 4; + */ + GRAFANA_ONCALL = 4, + + /** + * Ntfy notification service. + * + * @generated from enum value: NOTIFICATION_PROVIDER_NTFY = 5; + */ + NTFY = 5, + + /** + * PagerDuty integration. + * + * @generated from enum value: NOTIFICATION_PROVIDER_PAGERDUTY = 6; + */ + PAGERDUTY = 6, + + /** + * Opsgenie integration. + * + * @generated from enum value: NOTIFICATION_PROVIDER_OPSGENIE = 7; + */ + OPSGENIE = 7, + + /** + * Slack webhook. + * + * @generated from enum value: NOTIFICATION_PROVIDER_SLACK = 8; + */ + SLACK = 8, + + /** + * SMS notification. + * + * @generated from enum value: NOTIFICATION_PROVIDER_SMS = 9; + */ + SMS = 9, + + /** + * Telegram bot. + * + * @generated from enum value: NOTIFICATION_PROVIDER_TELEGRAM = 10; + */ + TELEGRAM = 10, + + /** + * Custom webhook. + * + * @generated from enum value: NOTIFICATION_PROVIDER_WEBHOOK = 11; + */ + WEBHOOK = 11, + + /** + * WhatsApp notification. + * + * @generated from enum value: NOTIFICATION_PROVIDER_WHATSAPP = 12; + */ + WHATSAPP = 12, +} + +/** + * Describes the enum openstatus.notification.v1.NotificationProvider. + */ +export const NotificationProviderSchema: GenEnum< + NotificationProvider +> = /*@__PURE__*/ + enumDesc(file_openstatus_notification_v1_providers, 0); + +/** + * OpsgenieRegion represents the Opsgenie API region. + * + * @generated from enum openstatus.notification.v1.OpsgenieRegion + */ +export enum OpsgenieRegion { + /** + * Unspecified region. + * + * @generated from enum value: OPSGENIE_REGION_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * US region. + * + * @generated from enum value: OPSGENIE_REGION_US = 1; + */ + US = 1, + + /** + * EU region. + * + * @generated from enum value: OPSGENIE_REGION_EU = 2; + */ + EU = 2, +} + +/** + * Describes the enum openstatus.notification.v1.OpsgenieRegion. + */ +export const OpsgenieRegionSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_openstatus_notification_v1_providers, 1); diff --git a/src/gen/openstatus/notification/v1/service_pb.ts b/src/gen/openstatus/notification/v1/service_pb.ts new file mode 100644 index 0000000..a9b4bc9 --- /dev/null +++ b/src/gen/openstatus/notification/v1/service_pb.ts @@ -0,0 +1,539 @@ +// @generated by protoc-gen-es v2.11.0 with parameter "target=ts,import_extension=ts" +// @generated from file openstatus/notification/v1/service.proto (package openstatus.notification.v1, syntax proto3) +/* eslint-disable */ + +import type { + GenFile, + GenMessage, + GenService, +} from "@bufbuild/protobuf/codegenv2"; +import { + fileDesc, + messageDesc, + serviceDesc, +} from "@bufbuild/protobuf/codegenv2"; +import { file_buf_validate_validate } from "../../../buf/validate/validate_pb.ts"; +import type { Notification, NotificationSummary } from "./notification_pb.ts"; +import { file_openstatus_notification_v1_notification } from "./notification_pb.ts"; +import type { NotificationData, NotificationProvider } from "./providers_pb.ts"; +import { file_openstatus_notification_v1_providers } from "./providers_pb.ts"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file openstatus/notification/v1/service.proto. + */ +export const file_openstatus_notification_v1_service: GenFile = /*@__PURE__*/ + fileDesc( + "CihvcGVuc3RhdHVzL25vdGlmaWNhdGlvbi92MS9zZXJ2aWNlLnByb3RvEhpvcGVuc3RhdHVzLm5vdGlmaWNhdGlvbi52MSLbAQoZQ3JlYXRlTm90aWZpY2F0aW9uUmVxdWVzdBIVCgRuYW1lGAEgASgJQge6SARyAhABEk4KCHByb3ZpZGVyGAIgASgOMjAub3BlbnN0YXR1cy5ub3RpZmljYXRpb24udjEuTm90aWZpY2F0aW9uUHJvdmlkZXJCCrpIB4IBBBABIAASQgoEZGF0YRgDIAEoCzIsLm9wZW5zdGF0dXMubm90aWZpY2F0aW9uLnYxLk5vdGlmaWNhdGlvbkRhdGFCBrpIA8gBARITCgttb25pdG9yX2lkcxgEIAMoCSJcChpDcmVhdGVOb3RpZmljYXRpb25SZXNwb25zZRI+Cgxub3RpZmljYXRpb24YASABKAsyKC5vcGVuc3RhdHVzLm5vdGlmaWNhdGlvbi52MS5Ob3RpZmljYXRpb24iLQoWR2V0Tm90aWZpY2F0aW9uUmVxdWVzdBITCgJpZBgBIAEoCUIHukgEcgIQASJZChdHZXROb3RpZmljYXRpb25SZXNwb25zZRI+Cgxub3RpZmljYXRpb24YASABKAsyKC5vcGVuc3RhdHVzLm5vdGlmaW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RpZmljYXRpb24udjEuRGVsZXRlTm90aWZpY2F0aW9uUmVxdWVzdBo2Lm9wZW5zdGF0dXMubm90aWZpY2F0aW9uLnYxLkRlbGV0ZU5vdGlmaWNhdGlvblJlc3BvbnNlEokBChRTZW5kVGVzdE5vdGlmaWNhdGlvbhI3Lm9wZW5zdGF0dXMubm90aWZpY2F0aW9uLnYxLlNlbmRUZXN0Tm90aWZpY2F0aW9uUmVxdWVzdBo4Lm9wZW5zdGF0dXMubm90aWZpY2F0aW9uLnYxLlNlbmRUZXN0Tm90aWZpY2F0aW9uUmVzcG9uc2USjwEKFkNoZWNrTm90aWZpY2F0aW9uTGltaXQSOS5vcGVuc3RhdHVzLm5vdGlmaWNhdGlvbi52MS5DaGVja05vdGlmaWNhdGlvbkxpbWl0UmVxdWVzdBo6Lm9wZW5zdGF0dXMubm90aWZpY2F0aW9uLnYxLkNoZWNrTm90aWZpY2F0aW9uTGltaXRSZXNwb25zZUJdWltnaXRodWIuY29tL29wZW5zdGF0dXNocS9vcGVuc3RhdHVzL3BhY2thZ2VzL3Byb3RvL29wZW5zdGF0dXMvbm90aWZpY2F0aW9uL3YxO25vdGlmaWNhdGlvbnYxYgZwcm90bzM", + [ + file_buf_validate_validate, + file_openstatus_notification_v1_notification, + file_openstatus_notification_v1_providers, + ], + ); + +/** + * CreateNotificationRequest is the request to create a new notification channel. + * + * @generated from message openstatus.notification.v1.CreateNotificationRequest + */ +export type CreateNotificationRequest = + & Message<"openstatus.notification.v1.CreateNotificationRequest"> + & { + /** + * Display name for the notification channel. + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Provider type. + * + * @generated from field: openstatus.notification.v1.NotificationProvider provider = 2; + */ + provider: NotificationProvider; + + /** + * Provider-specific configuration. + * + * @generated from field: openstatus.notification.v1.NotificationData data = 3; + */ + data?: NotificationData; + + /** + * IDs of monitors to associate with this notification. + * + * @generated from field: repeated string monitor_ids = 4; + */ + monitorIds: string[]; + }; + +/** + * Describes the message openstatus.notification.v1.CreateNotificationRequest. + * Use `create(CreateNotificationRequestSchema)` to create a new message. + */ +export const CreateNotificationRequestSchema: GenMessage< + CreateNotificationRequest +> = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_service, 0); + +/** + * CreateNotificationResponse is the response after creating a notification channel. + * + * @generated from message openstatus.notification.v1.CreateNotificationResponse + */ +export type CreateNotificationResponse = + & Message<"openstatus.notification.v1.CreateNotificationResponse"> + & { + /** + * The created notification channel. + * + * @generated from field: openstatus.notification.v1.Notification notification = 1; + */ + notification?: Notification; + }; + +/** + * Describes the message openstatus.notification.v1.CreateNotificationResponse. + * Use `create(CreateNotificationResponseSchema)` to create a new message. + */ +export const CreateNotificationResponseSchema: GenMessage< + CreateNotificationResponse +> = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_service, 1); + +/** + * GetNotificationRequest is the request to get a notification channel. + * + * @generated from message openstatus.notification.v1.GetNotificationRequest + */ +export type GetNotificationRequest = + & Message<"openstatus.notification.v1.GetNotificationRequest"> + & { + /** + * Notification ID to retrieve (required). + * + * @generated from field: string id = 1; + */ + id: string; + }; + +/** + * Describes the message openstatus.notification.v1.GetNotificationRequest. + * Use `create(GetNotificationRequestSchema)` to create a new message. + */ +export const GetNotificationRequestSchema: GenMessage< + GetNotificationRequest +> = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_service, 2); + +/** + * GetNotificationResponse is the response containing the notification channel. + * + * @generated from message openstatus.notification.v1.GetNotificationResponse + */ +export type GetNotificationResponse = + & Message<"openstatus.notification.v1.GetNotificationResponse"> + & { + /** + * The notification channel. + * + * @generated from field: openstatus.notification.v1.Notification notification = 1; + */ + notification?: Notification; + }; + +/** + * Describes the message openstatus.notification.v1.GetNotificationResponse. + * Use `create(GetNotificationResponseSchema)` to create a new message. + */ +export const GetNotificationResponseSchema: GenMessage< + GetNotificationResponse +> = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_service, 3); + +/** + * ListNotificationsRequest is the request to list notification channels. + * + * @generated from message openstatus.notification.v1.ListNotificationsRequest + */ +export type ListNotificationsRequest = + & Message<"openstatus.notification.v1.ListNotificationsRequest"> + & { + /** + * Maximum number of notifications to return (1-100, defaults to 50). + * + * @generated from field: optional int32 limit = 1; + */ + limit?: number; + + /** + * Number of notifications to skip for pagination (defaults to 0). + * + * @generated from field: optional int32 offset = 2; + */ + offset?: number; + }; + +/** + * Describes the message openstatus.notification.v1.ListNotificationsRequest. + * Use `create(ListNotificationsRequestSchema)` to create a new message. + */ +export const ListNotificationsRequestSchema: GenMessage< + ListNotificationsRequest +> = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_service, 4); + +/** + * ListNotificationsResponse is the response containing notification channels. + * + * @generated from message openstatus.notification.v1.ListNotificationsResponse + */ +export type ListNotificationsResponse = + & Message<"openstatus.notification.v1.ListNotificationsResponse"> + & { + /** + * Notification channel summaries. + * + * @generated from field: repeated openstatus.notification.v1.NotificationSummary notifications = 1; + */ + notifications: NotificationSummary[]; + + /** + * Total number of notification channels. + * + * @generated from field: int32 total_size = 2; + */ + totalSize: number; + }; + +/** + * Describes the message openstatus.notification.v1.ListNotificationsResponse. + * Use `create(ListNotificationsResponseSchema)` to create a new message. + */ +export const ListNotificationsResponseSchema: GenMessage< + ListNotificationsResponse +> = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_service, 5); + +/** + * UpdateNotificationRequest is the request to update a notification channel. + * + * @generated from message openstatus.notification.v1.UpdateNotificationRequest + */ +export type UpdateNotificationRequest = + & Message<"openstatus.notification.v1.UpdateNotificationRequest"> + & { + /** + * Notification ID to update (required). + * + * @generated from field: string id = 1; + */ + id: string; + + /** + * Updated display name. + * + * @generated from field: optional string name = 2; + */ + name?: string; + + /** + * Updated provider-specific configuration. + * + * @generated from field: optional openstatus.notification.v1.NotificationData data = 3; + */ + data?: NotificationData; + + /** + * Updated monitor IDs to associate. + * + * @generated from field: repeated string monitor_ids = 4; + */ + monitorIds: string[]; + }; + +/** + * Describes the message openstatus.notification.v1.UpdateNotificationRequest. + * Use `create(UpdateNotificationRequestSchema)` to create a new message. + */ +export const UpdateNotificationRequestSchema: GenMessage< + UpdateNotificationRequest +> = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_service, 6); + +/** + * UpdateNotificationResponse is the response after updating a notification channel. + * + * @generated from message openstatus.notification.v1.UpdateNotificationResponse + */ +export type UpdateNotificationResponse = + & Message<"openstatus.notification.v1.UpdateNotificationResponse"> + & { + /** + * The updated notification channel. + * + * @generated from field: openstatus.notification.v1.Notification notification = 1; + */ + notification?: Notification; + }; + +/** + * Describes the message openstatus.notification.v1.UpdateNotificationResponse. + * Use `create(UpdateNotificationResponseSchema)` to create a new message. + */ +export const UpdateNotificationResponseSchema: GenMessage< + UpdateNotificationResponse +> = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_service, 7); + +/** + * DeleteNotificationRequest is the request to delete a notification channel. + * + * @generated from message openstatus.notification.v1.DeleteNotificationRequest + */ +export type DeleteNotificationRequest = + & Message<"openstatus.notification.v1.DeleteNotificationRequest"> + & { + /** + * Notification ID to delete (required). + * + * @generated from field: string id = 1; + */ + id: string; + }; + +/** + * Describes the message openstatus.notification.v1.DeleteNotificationRequest. + * Use `create(DeleteNotificationRequestSchema)` to create a new message. + */ +export const DeleteNotificationRequestSchema: GenMessage< + DeleteNotificationRequest +> = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_service, 8); + +/** + * DeleteNotificationResponse is the response after deleting a notification channel. + * + * @generated from message openstatus.notification.v1.DeleteNotificationResponse + */ +export type DeleteNotificationResponse = + & Message<"openstatus.notification.v1.DeleteNotificationResponse"> + & { + /** + * Whether the deletion was successful. + * + * @generated from field: bool success = 1; + */ + success: boolean; + }; + +/** + * Describes the message openstatus.notification.v1.DeleteNotificationResponse. + * Use `create(DeleteNotificationResponseSchema)` to create a new message. + */ +export const DeleteNotificationResponseSchema: GenMessage< + DeleteNotificationResponse +> = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_service, 9); + +/** + * SendTestNotificationRequest is the request to send a test notification. + * + * @generated from message openstatus.notification.v1.SendTestNotificationRequest + */ +export type SendTestNotificationRequest = + & Message<"openstatus.notification.v1.SendTestNotificationRequest"> + & { + /** + * Provider type. + * + * @generated from field: openstatus.notification.v1.NotificationProvider provider = 1; + */ + provider: NotificationProvider; + + /** + * Provider-specific configuration. + * + * @generated from field: openstatus.notification.v1.NotificationData data = 2; + */ + data?: NotificationData; + }; + +/** + * Describes the message openstatus.notification.v1.SendTestNotificationRequest. + * Use `create(SendTestNotificationRequestSchema)` to create a new message. + */ +export const SendTestNotificationRequestSchema: GenMessage< + SendTestNotificationRequest +> = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_service, 10); + +/** + * SendTestNotificationResponse is the response after sending a test notification. + * + * @generated from message openstatus.notification.v1.SendTestNotificationResponse + */ +export type SendTestNotificationResponse = + & Message<"openstatus.notification.v1.SendTestNotificationResponse"> + & { + /** + * Whether the test was successful. + * + * @generated from field: bool success = 1; + */ + success: boolean; + + /** + * Optional error message if the test failed. + * + * @generated from field: optional string error_message = 2; + */ + errorMessage?: string; + }; + +/** + * Describes the message openstatus.notification.v1.SendTestNotificationResponse. + * Use `create(SendTestNotificationResponseSchema)` to create a new message. + */ +export const SendTestNotificationResponseSchema: GenMessage< + SendTestNotificationResponse +> = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_service, 11); + +/** + * CheckNotificationLimitRequest is the request to check notification limits. + * + * @generated from message openstatus.notification.v1.CheckNotificationLimitRequest + */ +export type CheckNotificationLimitRequest = + & Message<"openstatus.notification.v1.CheckNotificationLimitRequest"> + & {}; + +/** + * Describes the message openstatus.notification.v1.CheckNotificationLimitRequest. + * Use `create(CheckNotificationLimitRequestSchema)` to create a new message. + */ +export const CheckNotificationLimitRequestSchema: GenMessage< + CheckNotificationLimitRequest +> = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_service, 12); + +/** + * CheckNotificationLimitResponse is the response containing limit information. + * + * @generated from message openstatus.notification.v1.CheckNotificationLimitResponse + */ +export type CheckNotificationLimitResponse = + & Message<"openstatus.notification.v1.CheckNotificationLimitResponse"> + & { + /** + * Whether the workspace has reached its notification limit. + * + * @generated from field: bool limit_reached = 1; + */ + limitReached: boolean; + + /** + * Current number of notification channels. + * + * @generated from field: int32 current_count = 2; + */ + currentCount: number; + + /** + * Maximum allowed notification channels. + * + * @generated from field: int32 max_count = 3; + */ + maxCount: number; + }; + +/** + * Describes the message openstatus.notification.v1.CheckNotificationLimitResponse. + * Use `create(CheckNotificationLimitResponseSchema)` to create a new message. + */ +export const CheckNotificationLimitResponseSchema: GenMessage< + CheckNotificationLimitResponse +> = /*@__PURE__*/ + messageDesc(file_openstatus_notification_v1_service, 13); + +/** + * NotificationService provides CRUD operations for notification channels. + * + * @generated from service openstatus.notification.v1.NotificationService + */ +export const NotificationService: GenService<{ + /** + * CreateNotification creates a new notification channel. + * + * @generated from rpc openstatus.notification.v1.NotificationService.CreateNotification + */ + createNotification: { + methodKind: "unary"; + input: typeof CreateNotificationRequestSchema; + output: typeof CreateNotificationResponseSchema; + }; + /** + * GetNotification retrieves a notification channel by ID. + * + * @generated from rpc openstatus.notification.v1.NotificationService.GetNotification + */ + getNotification: { + methodKind: "unary"; + input: typeof GetNotificationRequestSchema; + output: typeof GetNotificationResponseSchema; + }; + /** + * ListNotifications returns a list of notification channels. + * + * @generated from rpc openstatus.notification.v1.NotificationService.ListNotifications + */ + listNotifications: { + methodKind: "unary"; + input: typeof ListNotificationsRequestSchema; + output: typeof ListNotificationsResponseSchema; + }; + /** + * UpdateNotification updates an existing notification channel. + * + * @generated from rpc openstatus.notification.v1.NotificationService.UpdateNotification + */ + updateNotification: { + methodKind: "unary"; + input: typeof UpdateNotificationRequestSchema; + output: typeof UpdateNotificationResponseSchema; + }; + /** + * DeleteNotification removes a notification channel. + * + * @generated from rpc openstatus.notification.v1.NotificationService.DeleteNotification + */ + deleteNotification: { + methodKind: "unary"; + input: typeof DeleteNotificationRequestSchema; + output: typeof DeleteNotificationResponseSchema; + }; + /** + * SendTestNotification sends a test notification to verify configuration. + * + * @generated from rpc openstatus.notification.v1.NotificationService.SendTestNotification + */ + sendTestNotification: { + methodKind: "unary"; + input: typeof SendTestNotificationRequestSchema; + output: typeof SendTestNotificationResponseSchema; + }; + /** + * CheckNotificationLimit checks if the workspace has reached its notification limit. + * + * @generated from rpc openstatus.notification.v1.NotificationService.CheckNotificationLimit + */ + checkNotificationLimit: { + methodKind: "unary"; + input: typeof CheckNotificationLimitRequestSchema; + output: typeof CheckNotificationLimitResponseSchema; + }; +}> = /*@__PURE__*/ + serviceDesc(file_openstatus_notification_v1_service, 0); diff --git a/src/mod.ts b/src/mod.ts index 2f589b8..e7093a7 100644 --- a/src/mod.ts +++ b/src/mod.ts @@ -36,6 +36,7 @@ import { HealthService } from "./gen/openstatus/health/v1/health_pb.ts"; import { StatusReportService } from "./gen/openstatus/status_report/v1/service_pb.ts"; import { StatusPageService } from "./gen/openstatus/status_page/v1/service_pb.ts"; import { MaintenanceService } from "./gen/openstatus/maintenance/v1/service_pb.ts"; +import { NotificationService } from "./gen/openstatus/notification/v1/service_pb.ts"; // Re-export monitor types export type { @@ -214,6 +215,53 @@ export type { UpdateMaintenanceResponse, } from "./gen/openstatus/maintenance/v1/service_pb.ts"; +// Re-export notification types +export type { + Notification, + NotificationSummary, +} from "./gen/openstatus/notification/v1/notification_pb.ts"; + +// Re-export notification provider types and data +export type { + DiscordData, + EmailData, + GoogleChatData, + GrafanaOncallData, + NotificationData, + NtfyData, + OpsgenieData, + PagerDutyData, + SlackData, + SmsData, + TelegramData, + WebhookData, + WebhookHeader, + WhatsappData, +} from "./gen/openstatus/notification/v1/providers_pb.ts"; + +export { + NotificationProvider, + OpsgenieRegion, +} from "./gen/openstatus/notification/v1/providers_pb.ts"; + +// Re-export notification request/response types +export type { + CheckNotificationLimitRequest, + CheckNotificationLimitResponse, + CreateNotificationRequest, + CreateNotificationResponse, + DeleteNotificationRequest, + DeleteNotificationResponse, + GetNotificationRequest, + GetNotificationResponse, + ListNotificationsRequest, + ListNotificationsResponse, + SendTestNotificationRequest, + SendTestNotificationResponse, + UpdateNotificationRequest, + UpdateNotificationResponse, +} from "./gen/openstatus/notification/v1/service_pb.ts"; + /** * Default OpenStatus API URL. */ @@ -338,6 +386,26 @@ export interface OpenStatusClient { MaintenanceService: Client; }; }; + /** + * Notification service namespace (v1). + */ + notification: { + v1: { + /** + * NotificationService provides CRUD operations for notification channels. + * + * Methods: + * - `createNotification` - Create a new notification channel + * - `getNotification` - Get a notification channel by ID + * - `listNotifications` - List all notification channels + * - `updateNotification` - Update a notification channel + * - `deleteNotification` - Delete a notification channel + * - `sendTestNotification` - Send a test notification + * - `checkNotificationLimit` - Check notification limits + */ + NotificationService: Client; + }; + }; } /** @@ -390,4 +458,9 @@ export const openstatus: OpenStatusClient = { MaintenanceService: createClient(MaintenanceService, transport), }, }, + notification: { + v1: { + NotificationService: createClient(NotificationService, transport), + }, + }, };