-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from takker99:stream
feat(api): Add types for /api/stream/:projectname
- Loading branch information
Showing
5 changed files
with
71 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { StringLc, UnixTime } from "../../base.ts"; | ||
import type { ProjectUpdatesStreamEvent } from "../../stream-event.ts"; | ||
import type { Page } from "../pages/project/title.ts"; | ||
|
||
/** The response type of /api/stream/:projectname */ | ||
export interface Stream { | ||
/** The project name */ | ||
projectName: string; | ||
/** The latest updates in the project */ | ||
end: UnixTime; | ||
/** The page updates in the stream */ | ||
pages: Page[]; | ||
/** The latest events in the project */ | ||
events: ProjectUpdatesStreamEvent[]; | ||
} | ||
|
||
export interface StreamPage extends Pick<Page, "id" | "title" | "lines"> { | ||
/** Icons in the page */ | ||
iconsLc: StringLc[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import type { PageId, ProjectId, StringLc, UnixTime, UserId } from "./base.ts"; | ||
|
||
export type ProjectUpdatesStreamEvent = | ||
| PageDeleteEvent | ||
| MemberJoinEvent | ||
| MemberAddEvent | ||
| AdminAddEvent | ||
| AdminDeleteEvent | ||
| OwnerSetEvent | ||
| InvitationResetEvent; | ||
|
||
export interface ProjectEvent { | ||
id: string; | ||
pageId: PageId; | ||
userId: UserId; | ||
projectId: ProjectId; | ||
created: UnixTime; | ||
updated: UnixTime; | ||
} | ||
|
||
export interface PageDeleteEvent extends ProjectEvent { | ||
type: "page.delete"; | ||
data: { | ||
titleLc: StringLc; | ||
}; | ||
} | ||
export interface MemberJoinEvent extends ProjectEvent { | ||
type: "member.join"; | ||
} | ||
export interface MemberAddEvent extends ProjectEvent { | ||
type: "member.add"; | ||
} | ||
export interface InvitationResetEvent extends ProjectEvent { | ||
type: "invitation.reset"; | ||
} | ||
export interface AdminAddEvent extends ProjectEvent { | ||
type: "admin.add"; | ||
targetUserId: UserId; | ||
} | ||
export interface AdminDeleteEvent extends ProjectEvent { | ||
type: "admin.delete"; | ||
targetUserId: UserId; | ||
} | ||
export interface OwnerSetEvent extends ProjectEvent { | ||
type: "owner.set"; | ||
targetUserId: UserId; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./websocket/change.ts"; | ||
export * from "./websocket/event.ts"; | ||
export * from "./stream-event.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters