Skip to content

Commit

Permalink
Merge pull request #1376 from openmeterio/notification-api
Browse files Browse the repository at this point in the history
refactor(api): notification events sending
  • Loading branch information
chrisgacsal authored Aug 15, 2024
2 parents 49b6f40 + 444c753 commit c002ba4
Show file tree
Hide file tree
Showing 22 changed files with 1,053 additions and 699 deletions.
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

0 comments on commit c002ba4

Please sign in to comment.