generated from NatoBoram/gigachad.ts
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathevent.ts
35 lines (31 loc) · 1.29 KB
/
event.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import type { PrEvent } from "./pr/event.ts"
import { prEventKeys } from "./pr/event.ts"
import type { ProjectEvent } from "./project/event.ts"
import { projectEventKeys } from "./project/event.ts"
import type { RepoEvent } from "./repo/event.ts"
import { repoEventKeys } from "./repo/event.ts"
/**
* When you have a webhook with an event, Bitbucket Data Center sends the event
* request to the server URL for the webhook whenever that event occurs.
*
* For Bitbucket to send event payload requests for a webhook with HTTPS
* endpoints, make sure your URL has a valid SSL certificate that a public
* certificate authority has signed.
*
* The following payloads contain some of the common entity types: `User`,
* `Repository`, `Comment`, and `Pull Request` – which have consistent
* representations in all the payloads where they appear. For example, the actor
* property in the `repo:refs_changed` payload is a representation of the
* event's user.
*/
export type Event = PrEvent | ProjectEvent | RepoEvent
export type EventKey = Event["eventKey"]
export function isEventKey(key: unknown): key is EventKey {
return Object.values<unknown>(eventKeys).includes(key)
}
const eventKeys = {
...prEventKeys,
...projectEventKeys,
...repoEventKeys,
} as const
eventKeys satisfies Record<EventKey, EventKey>