Refactor event HTTP API route modules (#27441)

This commit is contained in:
Aiden Cline
2026-05-13 22:41:17 -05:00
committed by GitHub
parent ddad0988e7
commit c50d2b3656
6 changed files with 32 additions and 28 deletions
@@ -0,0 +1,24 @@
import { Schema } from "effect"
import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/unstable/httpapi"
import { WorkspaceRoutingQuery } from "../middleware/workspace-routing"
export const EventPaths = {
event: "/event",
} as const
export const EventApi = HttpApi.make("event").add(
HttpApiGroup.make("event")
.add(
HttpApiEndpoint.get("subscribe", EventPaths.event, {
query: WorkspaceRoutingQuery,
success: Schema.String.pipe(HttpApiSchema.asText({ contentType: "text/event-stream" })),
}).annotateMerge(
OpenApi.annotations({
identifier: "event.subscribe",
summary: "Subscribe to events",
description: "Get events",
}),
),
)
.annotateMerge(OpenApi.annotations({ title: "event", description: "Instance event stream route." })),
)