Skip to content

Commit

Permalink
🏷️ Manually extract webhook types for PRCommentAdded
Browse files Browse the repository at this point in the history
  • Loading branch information
NatoBoram committed Sep 27, 2024
1 parent 02b07c9 commit d4c3118
Showing 1 changed file with 44 additions and 6 deletions.
50 changes: 44 additions & 6 deletions src/server/webhooks/events/pr/comment_added.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,49 @@
import type {
SchemaApplicationUser,
SchemaProject,
SchemaPullRequestParticipant,
SchemaRepository,
SchemaRestMinimalRef,
} from "../../../openapi/openapi-typescript.js"

export interface Actor {
readonly active: boolean
readonly displayName: string
readonly emailAddress: string
readonly id: number
readonly links: ActorLinks
readonly name: string
readonly slug: string
readonly type: string
readonly type: SchemaApplicationUser["type"]
}

export interface ActorLinks {
readonly self: Self[]
}

export interface Author {
readonly approved: boolean
readonly role: string
readonly role: SchemaPullRequestParticipant["role"]
readonly status: string
readonly user: Actor
}

export interface Clone {
readonly href: string
readonly name: string
}

export interface Comment {
readonly author: Actor
readonly comments: unknown[]
readonly createdDate: number
readonly id: number
readonly properties: Properties
readonly tasks: unknown[]
readonly severity: string
readonly state: string
readonly tasks?: unknown[]
readonly text: string
readonly threadResolved: boolean
readonly updatedDate: number
readonly version: number
}
Expand All @@ -34,7 +55,7 @@ export interface PRCommentAdded {
/** The comment created. */
readonly comment: Comment
/** Id of the parent comment if one exists. */
readonly commentParentId: number
readonly commentParentId?: number
readonly date: string
readonly eventKey: "pr:comment:added"
/** The pull request comment on. */
Expand All @@ -44,22 +65,26 @@ export interface PRCommentAdded {
export interface Project {
readonly id: number
readonly key: string
readonly links: ActorLinks
readonly name: string
readonly public: boolean
readonly type: string
readonly type: SchemaProject["type"]
}

export interface Properties {
readonly repositoryId: number
readonly suggestionState: string
}

export interface PullRequest {
readonly author: Author
readonly closed: boolean
readonly createdDate: number
readonly description: string
readonly draft: boolean
readonly fromRef: Ref
readonly id: number
readonly links: ActorLinks
readonly locked: boolean
readonly open: boolean
readonly participants: unknown[]
Expand All @@ -76,16 +101,29 @@ export interface Ref {
readonly id: string
readonly latestCommit: string
readonly repository: Repository
readonly type: SchemaRestMinimalRef["type"]
}

export interface Repository {
readonly archived: boolean
readonly forkable: boolean
readonly hierarchyId: string
readonly id: number
readonly links: RepositoryLinks
readonly name: string
readonly project: Project
readonly public: boolean
readonly scmId: string
readonly slug: string
readonly state: string
readonly state: SchemaRepository["state"]
readonly statusMessage: string
}

export interface RepositoryLinks {
readonly clone: Clone[]
readonly self: Self[]
}

export interface Self {
readonly href: string
}

0 comments on commit d4c3118

Please sign in to comment.