Skip to content

Commit d4c3118

Browse files
committed
🏷️ Manually extract webhook types for PRCommentAdded
1 parent 02b07c9 commit d4c3118

File tree

1 file changed

+44
-6
lines changed

1 file changed

+44
-6
lines changed

src/server/webhooks/events/pr/comment_added.ts

+44-6
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,49 @@
1+
import type {
2+
SchemaApplicationUser,
3+
SchemaProject,
4+
SchemaPullRequestParticipant,
5+
SchemaRepository,
6+
SchemaRestMinimalRef,
7+
} from "../../../openapi/openapi-typescript.js"
8+
19
export interface Actor {
210
readonly active: boolean
311
readonly displayName: string
412
readonly emailAddress: string
513
readonly id: number
14+
readonly links: ActorLinks
615
readonly name: string
716
readonly slug: string
8-
readonly type: string
17+
readonly type: SchemaApplicationUser["type"]
18+
}
19+
20+
export interface ActorLinks {
21+
readonly self: Self[]
922
}
1023

1124
export interface Author {
1225
readonly approved: boolean
13-
readonly role: string
26+
readonly role: SchemaPullRequestParticipant["role"]
1427
readonly status: string
1528
readonly user: Actor
1629
}
1730

31+
export interface Clone {
32+
readonly href: string
33+
readonly name: string
34+
}
35+
1836
export interface Comment {
1937
readonly author: Actor
2038
readonly comments: unknown[]
2139
readonly createdDate: number
2240
readonly id: number
2341
readonly properties: Properties
24-
readonly tasks: unknown[]
42+
readonly severity: string
43+
readonly state: string
44+
readonly tasks?: unknown[]
2545
readonly text: string
46+
readonly threadResolved: boolean
2647
readonly updatedDate: number
2748
readonly version: number
2849
}
@@ -34,7 +55,7 @@ export interface PRCommentAdded {
3455
/** The comment created. */
3556
readonly comment: Comment
3657
/** Id of the parent comment if one exists. */
37-
readonly commentParentId: number
58+
readonly commentParentId?: number
3859
readonly date: string
3960
readonly eventKey: "pr:comment:added"
4061
/** The pull request comment on. */
@@ -44,22 +65,26 @@ export interface PRCommentAdded {
4465
export interface Project {
4566
readonly id: number
4667
readonly key: string
68+
readonly links: ActorLinks
4769
readonly name: string
4870
readonly public: boolean
49-
readonly type: string
71+
readonly type: SchemaProject["type"]
5072
}
5173

5274
export interface Properties {
5375
readonly repositoryId: number
76+
readonly suggestionState: string
5477
}
5578

5679
export interface PullRequest {
5780
readonly author: Author
5881
readonly closed: boolean
5982
readonly createdDate: number
83+
readonly description: string
6084
readonly draft: boolean
6185
readonly fromRef: Ref
6286
readonly id: number
87+
readonly links: ActorLinks
6388
readonly locked: boolean
6489
readonly open: boolean
6590
readonly participants: unknown[]
@@ -76,16 +101,29 @@ export interface Ref {
76101
readonly id: string
77102
readonly latestCommit: string
78103
readonly repository: Repository
104+
readonly type: SchemaRestMinimalRef["type"]
79105
}
80106

81107
export interface Repository {
108+
readonly archived: boolean
82109
readonly forkable: boolean
110+
readonly hierarchyId: string
83111
readonly id: number
112+
readonly links: RepositoryLinks
84113
readonly name: string
85114
readonly project: Project
86115
readonly public: boolean
87116
readonly scmId: string
88117
readonly slug: string
89-
readonly state: string
118+
readonly state: SchemaRepository["state"]
90119
readonly statusMessage: string
91120
}
121+
122+
export interface RepositoryLinks {
123+
readonly clone: Clone[]
124+
readonly self: Self[]
125+
}
126+
127+
export interface Self {
128+
readonly href: string
129+
}

0 commit comments

Comments
 (0)