Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(api): notification events sending #1376

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
410 changes: 206 additions & 204 deletions api/api.gen.go

Large diffs are not rendered by default.

673 changes: 317 additions & 356 deletions api/client/go/client.gen.go

Large diffs are not rendered by default.

97 changes: 51 additions & 46 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1599,6 +1599,35 @@ paths:
default:
$ref: "#/components/responses/UnexpectedProblemResponse"

/api/v1/notification/rules/{ruleId}/test:
post:
operationId: testNotificationRule
summary: Test notification rule
description: |
Test a notification rule by sending a test event with random data.
tags:
- Notification (Experimental)
parameters:
- $ref: "#/components/parameters/ruleId"
responses:
"201":
description: Test notification event sent.
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/NotificationEvent"
"400":
$ref: "#/components/responses/BadRequestProblemResponse"
"401":
$ref: "#/components/responses/UnauthorizedProblemResponse"
"409":
$ref: "#/components/responses/ConflictProblemResponse"
"501":
$ref: "#/components/responses/NotImplementedProblemResponse"
default:
$ref: "#/components/responses/UnexpectedProblemResponse"

# Notifications - Events

/api/v1/notification/events:
Expand Down Expand Up @@ -1640,38 +1669,6 @@ paths:
$ref: "#/components/responses/UnauthorizedProblemResponse"
default:
$ref: "#/components/responses/UnexpectedProblemResponse"
post:
operationId: createNotificationEvent
summary: Create a notification event
description: |
Create a new notification event.
tags:
- Notifications (Experimental)
requestBody:
description: The notification event to create.
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/NotificationEventCreateRequest"
responses:
"201":
description: Notification event created.
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/NotificationEvent"
"400":
$ref: "#/components/responses/BadRequestProblemResponse"
"401":
$ref: "#/components/responses/UnauthorizedProblemResponse"
"409":
$ref: "#/components/responses/ConflictProblemResponse"
"501":
$ref: "#/components/responses/NotImplementedProblemResponse"
default:
$ref: "#/components/responses/UnexpectedProblemResponse"

/api/v1/notification/events/{eventId}:
get:
Expand Down Expand Up @@ -3252,20 +3249,20 @@ components:
- "01ARZ3NDEKTSV4RRFFQ69G5FAV"

NotificationRuleBalanceThresholdValue:
description: Threshold value with multiple supported types.
type: object
required:
- value
- type
properties:
value:
type: number
format: double
type:
type: string
enum:
- NUMBER
- PERCENT
description: Threshold value with multiple supported types.
type: object
required:
- value
- type
properties:
value:
type: number
format: double
type:
type: string
enum:
- NUMBER
- PERCENT

NotificationRuleBalanceThreshold:
description: |
Expand Down Expand Up @@ -3440,6 +3437,14 @@ components:
$ref: "#/components/schemas/NotificationEventDeliveryStatus"
payload:
$ref: "#/components/schemas/NotificationEventPayload"
annotations:
description: |
List of annotations managed by the system.
type: object
additionalProperties:
type: string
example:
test-event: "true"

NotificationEventPayload:
description: The actual payload sent to channel as part of the notification event.
Expand Down
3 changes: 2 additions & 1 deletion internal/ent/db/migrate/schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 78 additions & 2 deletions internal/ent/db/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions internal/ent/db/notificationevent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions internal/ent/db/notificationevent/notificationevent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions internal/ent/db/notificationevent/where.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading