1package models
2
3import (
4 "database/sql"
5 "time"
6
7 "github.com/google/uuid"
8)
9
10// Webhook is a repository webhook.
11type Webhook struct {
12 ID int64 `db:"id"`
13 RepoID int64 `db:"repo_id"`
14 URL string `db:"url"`
15 Secret string `db:"secret"`
16 ContentType int `db:"content_type"`
17 Active bool `db:"active"`
18 CreatedAt time.Time `db:"created_at"`
19 UpdatedAt time.Time `db:"updated_at"`
20}
21
22// WebhookEvent is a webhook event.
23type WebhookEvent struct {
24 ID int64 `db:"id"`
25 WebhookID int64 `db:"webhook_id"`
26 Event int `db:"event"`
27 CreatedAt time.Time `db:"created_at"`
28}
29
30// WebhookDelivery is a webhook delivery.
31type WebhookDelivery struct {
32 ID uuid.UUID `db:"id"`
33 WebhookID int64 `db:"webhook_id"`
34 Event int `db:"event"`
35 RequestURL string `db:"request_url"`
36 RequestMethod string `db:"request_method"`
37 RequestError sql.NullString `db:"request_error"`
38 RequestHeaders string `db:"request_headers"`
39 RequestBody string `db:"request_body"`
40 ResponseStatus int `db:"response_status"`
41 ResponseHeaders string `db:"response_headers"`
42 ResponseBody string `db:"response_body"`
43 CreatedAt time.Time `db:"created_at"`
44}