tenseleyflow/shithub / 0ebc1ff

Browse files

regen sqlc cross-package models for webhook enums

Authored by espadonne
SHA
0ebc1ffdec3427ed12326bbc532621fa4915eab4
Parents
ac27487
Tree
a4eaf20

11 changed files

StatusFile+-
M internal/auth/policy/sqlc/models.go 174 0
M internal/checks/sqlc/models.go 174 0
M internal/issues/sqlc/models.go 174 0
M internal/meta/sqlc/models.go 174 0
M internal/notif/sqlc/models.go 174 0
M internal/orgs/sqlc/models.go 174 0
M internal/pulls/sqlc/models.go 174 0
M internal/repos/sqlc/models.go 174 0
M internal/social/sqlc/models.go 174 0
M internal/users/sqlc/models.go 174 0
M internal/worker/sqlc/models.go 174 0
internal/auth/policy/sqlc/models.gomodified
@@ -1093,6 +1093,134 @@ func (ns NullWatchLevel) Value() (driver.Value, error) {
10931093
 	return string(ns.WatchLevel), nil
10941094
 }
10951095
 
1096
+type WebhookContentType string
1097
+
1098
+const (
1099
+	WebhookContentTypeJson WebhookContentType = "json"
1100
+	WebhookContentTypeForm WebhookContentType = "form"
1101
+)
1102
+
1103
+func (e *WebhookContentType) Scan(src interface{}) error {
1104
+	switch s := src.(type) {
1105
+	case []byte:
1106
+		*e = WebhookContentType(s)
1107
+	case string:
1108
+		*e = WebhookContentType(s)
1109
+	default:
1110
+		return fmt.Errorf("unsupported scan type for WebhookContentType: %T", src)
1111
+	}
1112
+	return nil
1113
+}
1114
+
1115
+type NullWebhookContentType struct {
1116
+	WebhookContentType WebhookContentType
1117
+	Valid              bool // Valid is true if WebhookContentType is not NULL
1118
+}
1119
+
1120
+// Scan implements the Scanner interface.
1121
+func (ns *NullWebhookContentType) Scan(value interface{}) error {
1122
+	if value == nil {
1123
+		ns.WebhookContentType, ns.Valid = "", false
1124
+		return nil
1125
+	}
1126
+	ns.Valid = true
1127
+	return ns.WebhookContentType.Scan(value)
1128
+}
1129
+
1130
+// Value implements the driver Valuer interface.
1131
+func (ns NullWebhookContentType) Value() (driver.Value, error) {
1132
+	if !ns.Valid {
1133
+		return nil, nil
1134
+	}
1135
+	return string(ns.WebhookContentType), nil
1136
+}
1137
+
1138
+type WebhookDeliveryStatus string
1139
+
1140
+const (
1141
+	WebhookDeliveryStatusPending         WebhookDeliveryStatus = "pending"
1142
+	WebhookDeliveryStatusSucceeded       WebhookDeliveryStatus = "succeeded"
1143
+	WebhookDeliveryStatusFailedRetry     WebhookDeliveryStatus = "failed_retry"
1144
+	WebhookDeliveryStatusFailedPermanent WebhookDeliveryStatus = "failed_permanent"
1145
+)
1146
+
1147
+func (e *WebhookDeliveryStatus) Scan(src interface{}) error {
1148
+	switch s := src.(type) {
1149
+	case []byte:
1150
+		*e = WebhookDeliveryStatus(s)
1151
+	case string:
1152
+		*e = WebhookDeliveryStatus(s)
1153
+	default:
1154
+		return fmt.Errorf("unsupported scan type for WebhookDeliveryStatus: %T", src)
1155
+	}
1156
+	return nil
1157
+}
1158
+
1159
+type NullWebhookDeliveryStatus struct {
1160
+	WebhookDeliveryStatus WebhookDeliveryStatus
1161
+	Valid                 bool // Valid is true if WebhookDeliveryStatus is not NULL
1162
+}
1163
+
1164
+// Scan implements the Scanner interface.
1165
+func (ns *NullWebhookDeliveryStatus) Scan(value interface{}) error {
1166
+	if value == nil {
1167
+		ns.WebhookDeliveryStatus, ns.Valid = "", false
1168
+		return nil
1169
+	}
1170
+	ns.Valid = true
1171
+	return ns.WebhookDeliveryStatus.Scan(value)
1172
+}
1173
+
1174
+// Value implements the driver Valuer interface.
1175
+func (ns NullWebhookDeliveryStatus) Value() (driver.Value, error) {
1176
+	if !ns.Valid {
1177
+		return nil, nil
1178
+	}
1179
+	return string(ns.WebhookDeliveryStatus), nil
1180
+}
1181
+
1182
+type WebhookOwnerKind string
1183
+
1184
+const (
1185
+	WebhookOwnerKindRepo WebhookOwnerKind = "repo"
1186
+	WebhookOwnerKindOrg  WebhookOwnerKind = "org"
1187
+)
1188
+
1189
+func (e *WebhookOwnerKind) Scan(src interface{}) error {
1190
+	switch s := src.(type) {
1191
+	case []byte:
1192
+		*e = WebhookOwnerKind(s)
1193
+	case string:
1194
+		*e = WebhookOwnerKind(s)
1195
+	default:
1196
+		return fmt.Errorf("unsupported scan type for WebhookOwnerKind: %T", src)
1197
+	}
1198
+	return nil
1199
+}
1200
+
1201
+type NullWebhookOwnerKind struct {
1202
+	WebhookOwnerKind WebhookOwnerKind
1203
+	Valid            bool // Valid is true if WebhookOwnerKind is not NULL
1204
+}
1205
+
1206
+// Scan implements the Scanner interface.
1207
+func (ns *NullWebhookOwnerKind) Scan(value interface{}) error {
1208
+	if value == nil {
1209
+		ns.WebhookOwnerKind, ns.Valid = "", false
1210
+		return nil
1211
+	}
1212
+	ns.Valid = true
1213
+	return ns.WebhookOwnerKind.Scan(value)
1214
+}
1215
+
1216
+// Value implements the driver Valuer interface.
1217
+func (ns NullWebhookOwnerKind) Value() (driver.Value, error) {
1218
+	if !ns.Valid {
1219
+		return nil, nil
1220
+	}
1221
+	return string(ns.WebhookOwnerKind), nil
1222
+}
1223
+
10961224
 type AuthAuditLog struct {
10971225
 	ID         int64
10981226
 	ActorID    pgtype.Int8
@@ -1734,6 +1862,52 @@ type Watch struct {
17341862
 	UpdatedAt pgtype.Timestamptz
17351863
 }
17361864
 
1865
+type Webhook struct {
1866
+	ID                   int64
1867
+	OwnerKind            WebhookOwnerKind
1868
+	OwnerID              int64
1869
+	Url                  string
1870
+	ContentType          WebhookContentType
1871
+	Events               []string
1872
+	SecretCiphertext     []byte
1873
+	SecretNonce          []byte
1874
+	Active               bool
1875
+	SslVerification      bool
1876
+	ConsecutiveFailures  int32
1877
+	AutoDisableThreshold int32
1878
+	DisabledAt           pgtype.Timestamptz
1879
+	DisabledReason       pgtype.Text
1880
+	LastSuccessAt        pgtype.Timestamptz
1881
+	LastFailureAt        pgtype.Timestamptz
1882
+	CreatedByUserID      pgtype.Int8
1883
+	CreatedAt            pgtype.Timestamptz
1884
+	UpdatedAt            pgtype.Timestamptz
1885
+}
1886
+
1887
+type WebhookDelivery struct {
1888
+	ID                int64
1889
+	WebhookID         int64
1890
+	EventKind         string
1891
+	EventID           pgtype.Int8
1892
+	DeliveryUuid      pgtype.UUID
1893
+	Payload           []byte
1894
+	RequestHeaders    []byte
1895
+	RequestBody       []byte
1896
+	ResponseStatus    pgtype.Int4
1897
+	ResponseHeaders   []byte
1898
+	ResponseBody      []byte
1899
+	ResponseTruncated bool
1900
+	StartedAt         pgtype.Timestamptz
1901
+	CompletedAt       pgtype.Timestamptz
1902
+	Attempt           int32
1903
+	MaxAttempts       int32
1904
+	NextRetryAt       pgtype.Timestamptz
1905
+	Status            WebhookDeliveryStatus
1906
+	IdempotencyKey    string
1907
+	ErrorSummary      pgtype.Text
1908
+	RedeliverOf       pgtype.Int8
1909
+}
1910
+
17371911
 type WebhookEventsPending struct {
17381912
 	ID        int64
17391913
 	RepoID    int64
internal/checks/sqlc/models.gomodified
@@ -1093,6 +1093,134 @@ func (ns NullWatchLevel) Value() (driver.Value, error) {
10931093
 	return string(ns.WatchLevel), nil
10941094
 }
10951095
 
1096
+type WebhookContentType string
1097
+
1098
+const (
1099
+	WebhookContentTypeJson WebhookContentType = "json"
1100
+	WebhookContentTypeForm WebhookContentType = "form"
1101
+)
1102
+
1103
+func (e *WebhookContentType) Scan(src interface{}) error {
1104
+	switch s := src.(type) {
1105
+	case []byte:
1106
+		*e = WebhookContentType(s)
1107
+	case string:
1108
+		*e = WebhookContentType(s)
1109
+	default:
1110
+		return fmt.Errorf("unsupported scan type for WebhookContentType: %T", src)
1111
+	}
1112
+	return nil
1113
+}
1114
+
1115
+type NullWebhookContentType struct {
1116
+	WebhookContentType WebhookContentType
1117
+	Valid              bool // Valid is true if WebhookContentType is not NULL
1118
+}
1119
+
1120
+// Scan implements the Scanner interface.
1121
+func (ns *NullWebhookContentType) Scan(value interface{}) error {
1122
+	if value == nil {
1123
+		ns.WebhookContentType, ns.Valid = "", false
1124
+		return nil
1125
+	}
1126
+	ns.Valid = true
1127
+	return ns.WebhookContentType.Scan(value)
1128
+}
1129
+
1130
+// Value implements the driver Valuer interface.
1131
+func (ns NullWebhookContentType) Value() (driver.Value, error) {
1132
+	if !ns.Valid {
1133
+		return nil, nil
1134
+	}
1135
+	return string(ns.WebhookContentType), nil
1136
+}
1137
+
1138
+type WebhookDeliveryStatus string
1139
+
1140
+const (
1141
+	WebhookDeliveryStatusPending         WebhookDeliveryStatus = "pending"
1142
+	WebhookDeliveryStatusSucceeded       WebhookDeliveryStatus = "succeeded"
1143
+	WebhookDeliveryStatusFailedRetry     WebhookDeliveryStatus = "failed_retry"
1144
+	WebhookDeliveryStatusFailedPermanent WebhookDeliveryStatus = "failed_permanent"
1145
+)
1146
+
1147
+func (e *WebhookDeliveryStatus) Scan(src interface{}) error {
1148
+	switch s := src.(type) {
1149
+	case []byte:
1150
+		*e = WebhookDeliveryStatus(s)
1151
+	case string:
1152
+		*e = WebhookDeliveryStatus(s)
1153
+	default:
1154
+		return fmt.Errorf("unsupported scan type for WebhookDeliveryStatus: %T", src)
1155
+	}
1156
+	return nil
1157
+}
1158
+
1159
+type NullWebhookDeliveryStatus struct {
1160
+	WebhookDeliveryStatus WebhookDeliveryStatus
1161
+	Valid                 bool // Valid is true if WebhookDeliveryStatus is not NULL
1162
+}
1163
+
1164
+// Scan implements the Scanner interface.
1165
+func (ns *NullWebhookDeliveryStatus) Scan(value interface{}) error {
1166
+	if value == nil {
1167
+		ns.WebhookDeliveryStatus, ns.Valid = "", false
1168
+		return nil
1169
+	}
1170
+	ns.Valid = true
1171
+	return ns.WebhookDeliveryStatus.Scan(value)
1172
+}
1173
+
1174
+// Value implements the driver Valuer interface.
1175
+func (ns NullWebhookDeliveryStatus) Value() (driver.Value, error) {
1176
+	if !ns.Valid {
1177
+		return nil, nil
1178
+	}
1179
+	return string(ns.WebhookDeliveryStatus), nil
1180
+}
1181
+
1182
+type WebhookOwnerKind string
1183
+
1184
+const (
1185
+	WebhookOwnerKindRepo WebhookOwnerKind = "repo"
1186
+	WebhookOwnerKindOrg  WebhookOwnerKind = "org"
1187
+)
1188
+
1189
+func (e *WebhookOwnerKind) Scan(src interface{}) error {
1190
+	switch s := src.(type) {
1191
+	case []byte:
1192
+		*e = WebhookOwnerKind(s)
1193
+	case string:
1194
+		*e = WebhookOwnerKind(s)
1195
+	default:
1196
+		return fmt.Errorf("unsupported scan type for WebhookOwnerKind: %T", src)
1197
+	}
1198
+	return nil
1199
+}
1200
+
1201
+type NullWebhookOwnerKind struct {
1202
+	WebhookOwnerKind WebhookOwnerKind
1203
+	Valid            bool // Valid is true if WebhookOwnerKind is not NULL
1204
+}
1205
+
1206
+// Scan implements the Scanner interface.
1207
+func (ns *NullWebhookOwnerKind) Scan(value interface{}) error {
1208
+	if value == nil {
1209
+		ns.WebhookOwnerKind, ns.Valid = "", false
1210
+		return nil
1211
+	}
1212
+	ns.Valid = true
1213
+	return ns.WebhookOwnerKind.Scan(value)
1214
+}
1215
+
1216
+// Value implements the driver Valuer interface.
1217
+func (ns NullWebhookOwnerKind) Value() (driver.Value, error) {
1218
+	if !ns.Valid {
1219
+		return nil, nil
1220
+	}
1221
+	return string(ns.WebhookOwnerKind), nil
1222
+}
1223
+
10961224
 type AuthAuditLog struct {
10971225
 	ID         int64
10981226
 	ActorID    pgtype.Int8
@@ -1734,6 +1862,52 @@ type Watch struct {
17341862
 	UpdatedAt pgtype.Timestamptz
17351863
 }
17361864
 
1865
+type Webhook struct {
1866
+	ID                   int64
1867
+	OwnerKind            WebhookOwnerKind
1868
+	OwnerID              int64
1869
+	Url                  string
1870
+	ContentType          WebhookContentType
1871
+	Events               []string
1872
+	SecretCiphertext     []byte
1873
+	SecretNonce          []byte
1874
+	Active               bool
1875
+	SslVerification      bool
1876
+	ConsecutiveFailures  int32
1877
+	AutoDisableThreshold int32
1878
+	DisabledAt           pgtype.Timestamptz
1879
+	DisabledReason       pgtype.Text
1880
+	LastSuccessAt        pgtype.Timestamptz
1881
+	LastFailureAt        pgtype.Timestamptz
1882
+	CreatedByUserID      pgtype.Int8
1883
+	CreatedAt            pgtype.Timestamptz
1884
+	UpdatedAt            pgtype.Timestamptz
1885
+}
1886
+
1887
+type WebhookDelivery struct {
1888
+	ID                int64
1889
+	WebhookID         int64
1890
+	EventKind         string
1891
+	EventID           pgtype.Int8
1892
+	DeliveryUuid      pgtype.UUID
1893
+	Payload           []byte
1894
+	RequestHeaders    []byte
1895
+	RequestBody       []byte
1896
+	ResponseStatus    pgtype.Int4
1897
+	ResponseHeaders   []byte
1898
+	ResponseBody      []byte
1899
+	ResponseTruncated bool
1900
+	StartedAt         pgtype.Timestamptz
1901
+	CompletedAt       pgtype.Timestamptz
1902
+	Attempt           int32
1903
+	MaxAttempts       int32
1904
+	NextRetryAt       pgtype.Timestamptz
1905
+	Status            WebhookDeliveryStatus
1906
+	IdempotencyKey    string
1907
+	ErrorSummary      pgtype.Text
1908
+	RedeliverOf       pgtype.Int8
1909
+}
1910
+
17371911
 type WebhookEventsPending struct {
17381912
 	ID        int64
17391913
 	RepoID    int64
internal/issues/sqlc/models.gomodified
@@ -1093,6 +1093,134 @@ func (ns NullWatchLevel) Value() (driver.Value, error) {
10931093
 	return string(ns.WatchLevel), nil
10941094
 }
10951095
 
1096
+type WebhookContentType string
1097
+
1098
+const (
1099
+	WebhookContentTypeJson WebhookContentType = "json"
1100
+	WebhookContentTypeForm WebhookContentType = "form"
1101
+)
1102
+
1103
+func (e *WebhookContentType) Scan(src interface{}) error {
1104
+	switch s := src.(type) {
1105
+	case []byte:
1106
+		*e = WebhookContentType(s)
1107
+	case string:
1108
+		*e = WebhookContentType(s)
1109
+	default:
1110
+		return fmt.Errorf("unsupported scan type for WebhookContentType: %T", src)
1111
+	}
1112
+	return nil
1113
+}
1114
+
1115
+type NullWebhookContentType struct {
1116
+	WebhookContentType WebhookContentType
1117
+	Valid              bool // Valid is true if WebhookContentType is not NULL
1118
+}
1119
+
1120
+// Scan implements the Scanner interface.
1121
+func (ns *NullWebhookContentType) Scan(value interface{}) error {
1122
+	if value == nil {
1123
+		ns.WebhookContentType, ns.Valid = "", false
1124
+		return nil
1125
+	}
1126
+	ns.Valid = true
1127
+	return ns.WebhookContentType.Scan(value)
1128
+}
1129
+
1130
+// Value implements the driver Valuer interface.
1131
+func (ns NullWebhookContentType) Value() (driver.Value, error) {
1132
+	if !ns.Valid {
1133
+		return nil, nil
1134
+	}
1135
+	return string(ns.WebhookContentType), nil
1136
+}
1137
+
1138
+type WebhookDeliveryStatus string
1139
+
1140
+const (
1141
+	WebhookDeliveryStatusPending         WebhookDeliveryStatus = "pending"
1142
+	WebhookDeliveryStatusSucceeded       WebhookDeliveryStatus = "succeeded"
1143
+	WebhookDeliveryStatusFailedRetry     WebhookDeliveryStatus = "failed_retry"
1144
+	WebhookDeliveryStatusFailedPermanent WebhookDeliveryStatus = "failed_permanent"
1145
+)
1146
+
1147
+func (e *WebhookDeliveryStatus) Scan(src interface{}) error {
1148
+	switch s := src.(type) {
1149
+	case []byte:
1150
+		*e = WebhookDeliveryStatus(s)
1151
+	case string:
1152
+		*e = WebhookDeliveryStatus(s)
1153
+	default:
1154
+		return fmt.Errorf("unsupported scan type for WebhookDeliveryStatus: %T", src)
1155
+	}
1156
+	return nil
1157
+}
1158
+
1159
+type NullWebhookDeliveryStatus struct {
1160
+	WebhookDeliveryStatus WebhookDeliveryStatus
1161
+	Valid                 bool // Valid is true if WebhookDeliveryStatus is not NULL
1162
+}
1163
+
1164
+// Scan implements the Scanner interface.
1165
+func (ns *NullWebhookDeliveryStatus) Scan(value interface{}) error {
1166
+	if value == nil {
1167
+		ns.WebhookDeliveryStatus, ns.Valid = "", false
1168
+		return nil
1169
+	}
1170
+	ns.Valid = true
1171
+	return ns.WebhookDeliveryStatus.Scan(value)
1172
+}
1173
+
1174
+// Value implements the driver Valuer interface.
1175
+func (ns NullWebhookDeliveryStatus) Value() (driver.Value, error) {
1176
+	if !ns.Valid {
1177
+		return nil, nil
1178
+	}
1179
+	return string(ns.WebhookDeliveryStatus), nil
1180
+}
1181
+
1182
+type WebhookOwnerKind string
1183
+
1184
+const (
1185
+	WebhookOwnerKindRepo WebhookOwnerKind = "repo"
1186
+	WebhookOwnerKindOrg  WebhookOwnerKind = "org"
1187
+)
1188
+
1189
+func (e *WebhookOwnerKind) Scan(src interface{}) error {
1190
+	switch s := src.(type) {
1191
+	case []byte:
1192
+		*e = WebhookOwnerKind(s)
1193
+	case string:
1194
+		*e = WebhookOwnerKind(s)
1195
+	default:
1196
+		return fmt.Errorf("unsupported scan type for WebhookOwnerKind: %T", src)
1197
+	}
1198
+	return nil
1199
+}
1200
+
1201
+type NullWebhookOwnerKind struct {
1202
+	WebhookOwnerKind WebhookOwnerKind
1203
+	Valid            bool // Valid is true if WebhookOwnerKind is not NULL
1204
+}
1205
+
1206
+// Scan implements the Scanner interface.
1207
+func (ns *NullWebhookOwnerKind) Scan(value interface{}) error {
1208
+	if value == nil {
1209
+		ns.WebhookOwnerKind, ns.Valid = "", false
1210
+		return nil
1211
+	}
1212
+	ns.Valid = true
1213
+	return ns.WebhookOwnerKind.Scan(value)
1214
+}
1215
+
1216
+// Value implements the driver Valuer interface.
1217
+func (ns NullWebhookOwnerKind) Value() (driver.Value, error) {
1218
+	if !ns.Valid {
1219
+		return nil, nil
1220
+	}
1221
+	return string(ns.WebhookOwnerKind), nil
1222
+}
1223
+
10961224
 type AuthAuditLog struct {
10971225
 	ID         int64
10981226
 	ActorID    pgtype.Int8
@@ -1734,6 +1862,52 @@ type Watch struct {
17341862
 	UpdatedAt pgtype.Timestamptz
17351863
 }
17361864
 
1865
+type Webhook struct {
1866
+	ID                   int64
1867
+	OwnerKind            WebhookOwnerKind
1868
+	OwnerID              int64
1869
+	Url                  string
1870
+	ContentType          WebhookContentType
1871
+	Events               []string
1872
+	SecretCiphertext     []byte
1873
+	SecretNonce          []byte
1874
+	Active               bool
1875
+	SslVerification      bool
1876
+	ConsecutiveFailures  int32
1877
+	AutoDisableThreshold int32
1878
+	DisabledAt           pgtype.Timestamptz
1879
+	DisabledReason       pgtype.Text
1880
+	LastSuccessAt        pgtype.Timestamptz
1881
+	LastFailureAt        pgtype.Timestamptz
1882
+	CreatedByUserID      pgtype.Int8
1883
+	CreatedAt            pgtype.Timestamptz
1884
+	UpdatedAt            pgtype.Timestamptz
1885
+}
1886
+
1887
+type WebhookDelivery struct {
1888
+	ID                int64
1889
+	WebhookID         int64
1890
+	EventKind         string
1891
+	EventID           pgtype.Int8
1892
+	DeliveryUuid      pgtype.UUID
1893
+	Payload           []byte
1894
+	RequestHeaders    []byte
1895
+	RequestBody       []byte
1896
+	ResponseStatus    pgtype.Int4
1897
+	ResponseHeaders   []byte
1898
+	ResponseBody      []byte
1899
+	ResponseTruncated bool
1900
+	StartedAt         pgtype.Timestamptz
1901
+	CompletedAt       pgtype.Timestamptz
1902
+	Attempt           int32
1903
+	MaxAttempts       int32
1904
+	NextRetryAt       pgtype.Timestamptz
1905
+	Status            WebhookDeliveryStatus
1906
+	IdempotencyKey    string
1907
+	ErrorSummary      pgtype.Text
1908
+	RedeliverOf       pgtype.Int8
1909
+}
1910
+
17371911
 type WebhookEventsPending struct {
17381912
 	ID        int64
17391913
 	RepoID    int64
internal/meta/sqlc/models.gomodified
@@ -1093,6 +1093,134 @@ func (ns NullWatchLevel) Value() (driver.Value, error) {
10931093
 	return string(ns.WatchLevel), nil
10941094
 }
10951095
 
1096
+type WebhookContentType string
1097
+
1098
+const (
1099
+	WebhookContentTypeJson WebhookContentType = "json"
1100
+	WebhookContentTypeForm WebhookContentType = "form"
1101
+)
1102
+
1103
+func (e *WebhookContentType) Scan(src interface{}) error {
1104
+	switch s := src.(type) {
1105
+	case []byte:
1106
+		*e = WebhookContentType(s)
1107
+	case string:
1108
+		*e = WebhookContentType(s)
1109
+	default:
1110
+		return fmt.Errorf("unsupported scan type for WebhookContentType: %T", src)
1111
+	}
1112
+	return nil
1113
+}
1114
+
1115
+type NullWebhookContentType struct {
1116
+	WebhookContentType WebhookContentType
1117
+	Valid              bool // Valid is true if WebhookContentType is not NULL
1118
+}
1119
+
1120
+// Scan implements the Scanner interface.
1121
+func (ns *NullWebhookContentType) Scan(value interface{}) error {
1122
+	if value == nil {
1123
+		ns.WebhookContentType, ns.Valid = "", false
1124
+		return nil
1125
+	}
1126
+	ns.Valid = true
1127
+	return ns.WebhookContentType.Scan(value)
1128
+}
1129
+
1130
+// Value implements the driver Valuer interface.
1131
+func (ns NullWebhookContentType) Value() (driver.Value, error) {
1132
+	if !ns.Valid {
1133
+		return nil, nil
1134
+	}
1135
+	return string(ns.WebhookContentType), nil
1136
+}
1137
+
1138
+type WebhookDeliveryStatus string
1139
+
1140
+const (
1141
+	WebhookDeliveryStatusPending         WebhookDeliveryStatus = "pending"
1142
+	WebhookDeliveryStatusSucceeded       WebhookDeliveryStatus = "succeeded"
1143
+	WebhookDeliveryStatusFailedRetry     WebhookDeliveryStatus = "failed_retry"
1144
+	WebhookDeliveryStatusFailedPermanent WebhookDeliveryStatus = "failed_permanent"
1145
+)
1146
+
1147
+func (e *WebhookDeliveryStatus) Scan(src interface{}) error {
1148
+	switch s := src.(type) {
1149
+	case []byte:
1150
+		*e = WebhookDeliveryStatus(s)
1151
+	case string:
1152
+		*e = WebhookDeliveryStatus(s)
1153
+	default:
1154
+		return fmt.Errorf("unsupported scan type for WebhookDeliveryStatus: %T", src)
1155
+	}
1156
+	return nil
1157
+}
1158
+
1159
+type NullWebhookDeliveryStatus struct {
1160
+	WebhookDeliveryStatus WebhookDeliveryStatus
1161
+	Valid                 bool // Valid is true if WebhookDeliveryStatus is not NULL
1162
+}
1163
+
1164
+// Scan implements the Scanner interface.
1165
+func (ns *NullWebhookDeliveryStatus) Scan(value interface{}) error {
1166
+	if value == nil {
1167
+		ns.WebhookDeliveryStatus, ns.Valid = "", false
1168
+		return nil
1169
+	}
1170
+	ns.Valid = true
1171
+	return ns.WebhookDeliveryStatus.Scan(value)
1172
+}
1173
+
1174
+// Value implements the driver Valuer interface.
1175
+func (ns NullWebhookDeliveryStatus) Value() (driver.Value, error) {
1176
+	if !ns.Valid {
1177
+		return nil, nil
1178
+	}
1179
+	return string(ns.WebhookDeliveryStatus), nil
1180
+}
1181
+
1182
+type WebhookOwnerKind string
1183
+
1184
+const (
1185
+	WebhookOwnerKindRepo WebhookOwnerKind = "repo"
1186
+	WebhookOwnerKindOrg  WebhookOwnerKind = "org"
1187
+)
1188
+
1189
+func (e *WebhookOwnerKind) Scan(src interface{}) error {
1190
+	switch s := src.(type) {
1191
+	case []byte:
1192
+		*e = WebhookOwnerKind(s)
1193
+	case string:
1194
+		*e = WebhookOwnerKind(s)
1195
+	default:
1196
+		return fmt.Errorf("unsupported scan type for WebhookOwnerKind: %T", src)
1197
+	}
1198
+	return nil
1199
+}
1200
+
1201
+type NullWebhookOwnerKind struct {
1202
+	WebhookOwnerKind WebhookOwnerKind
1203
+	Valid            bool // Valid is true if WebhookOwnerKind is not NULL
1204
+}
1205
+
1206
+// Scan implements the Scanner interface.
1207
+func (ns *NullWebhookOwnerKind) Scan(value interface{}) error {
1208
+	if value == nil {
1209
+		ns.WebhookOwnerKind, ns.Valid = "", false
1210
+		return nil
1211
+	}
1212
+	ns.Valid = true
1213
+	return ns.WebhookOwnerKind.Scan(value)
1214
+}
1215
+
1216
+// Value implements the driver Valuer interface.
1217
+func (ns NullWebhookOwnerKind) Value() (driver.Value, error) {
1218
+	if !ns.Valid {
1219
+		return nil, nil
1220
+	}
1221
+	return string(ns.WebhookOwnerKind), nil
1222
+}
1223
+
10961224
 type AuthAuditLog struct {
10971225
 	ID         int64
10981226
 	ActorID    pgtype.Int8
@@ -1734,6 +1862,52 @@ type Watch struct {
17341862
 	UpdatedAt pgtype.Timestamptz
17351863
 }
17361864
 
1865
+type Webhook struct {
1866
+	ID                   int64
1867
+	OwnerKind            WebhookOwnerKind
1868
+	OwnerID              int64
1869
+	Url                  string
1870
+	ContentType          WebhookContentType
1871
+	Events               []string
1872
+	SecretCiphertext     []byte
1873
+	SecretNonce          []byte
1874
+	Active               bool
1875
+	SslVerification      bool
1876
+	ConsecutiveFailures  int32
1877
+	AutoDisableThreshold int32
1878
+	DisabledAt           pgtype.Timestamptz
1879
+	DisabledReason       pgtype.Text
1880
+	LastSuccessAt        pgtype.Timestamptz
1881
+	LastFailureAt        pgtype.Timestamptz
1882
+	CreatedByUserID      pgtype.Int8
1883
+	CreatedAt            pgtype.Timestamptz
1884
+	UpdatedAt            pgtype.Timestamptz
1885
+}
1886
+
1887
+type WebhookDelivery struct {
1888
+	ID                int64
1889
+	WebhookID         int64
1890
+	EventKind         string
1891
+	EventID           pgtype.Int8
1892
+	DeliveryUuid      pgtype.UUID
1893
+	Payload           []byte
1894
+	RequestHeaders    []byte
1895
+	RequestBody       []byte
1896
+	ResponseStatus    pgtype.Int4
1897
+	ResponseHeaders   []byte
1898
+	ResponseBody      []byte
1899
+	ResponseTruncated bool
1900
+	StartedAt         pgtype.Timestamptz
1901
+	CompletedAt       pgtype.Timestamptz
1902
+	Attempt           int32
1903
+	MaxAttempts       int32
1904
+	NextRetryAt       pgtype.Timestamptz
1905
+	Status            WebhookDeliveryStatus
1906
+	IdempotencyKey    string
1907
+	ErrorSummary      pgtype.Text
1908
+	RedeliverOf       pgtype.Int8
1909
+}
1910
+
17371911
 type WebhookEventsPending struct {
17381912
 	ID        int64
17391913
 	RepoID    int64
internal/notif/sqlc/models.gomodified
@@ -1093,6 +1093,134 @@ func (ns NullWatchLevel) Value() (driver.Value, error) {
10931093
 	return string(ns.WatchLevel), nil
10941094
 }
10951095
 
1096
+type WebhookContentType string
1097
+
1098
+const (
1099
+	WebhookContentTypeJson WebhookContentType = "json"
1100
+	WebhookContentTypeForm WebhookContentType = "form"
1101
+)
1102
+
1103
+func (e *WebhookContentType) Scan(src interface{}) error {
1104
+	switch s := src.(type) {
1105
+	case []byte:
1106
+		*e = WebhookContentType(s)
1107
+	case string:
1108
+		*e = WebhookContentType(s)
1109
+	default:
1110
+		return fmt.Errorf("unsupported scan type for WebhookContentType: %T", src)
1111
+	}
1112
+	return nil
1113
+}
1114
+
1115
+type NullWebhookContentType struct {
1116
+	WebhookContentType WebhookContentType
1117
+	Valid              bool // Valid is true if WebhookContentType is not NULL
1118
+}
1119
+
1120
+// Scan implements the Scanner interface.
1121
+func (ns *NullWebhookContentType) Scan(value interface{}) error {
1122
+	if value == nil {
1123
+		ns.WebhookContentType, ns.Valid = "", false
1124
+		return nil
1125
+	}
1126
+	ns.Valid = true
1127
+	return ns.WebhookContentType.Scan(value)
1128
+}
1129
+
1130
+// Value implements the driver Valuer interface.
1131
+func (ns NullWebhookContentType) Value() (driver.Value, error) {
1132
+	if !ns.Valid {
1133
+		return nil, nil
1134
+	}
1135
+	return string(ns.WebhookContentType), nil
1136
+}
1137
+
1138
+type WebhookDeliveryStatus string
1139
+
1140
+const (
1141
+	WebhookDeliveryStatusPending         WebhookDeliveryStatus = "pending"
1142
+	WebhookDeliveryStatusSucceeded       WebhookDeliveryStatus = "succeeded"
1143
+	WebhookDeliveryStatusFailedRetry     WebhookDeliveryStatus = "failed_retry"
1144
+	WebhookDeliveryStatusFailedPermanent WebhookDeliveryStatus = "failed_permanent"
1145
+)
1146
+
1147
+func (e *WebhookDeliveryStatus) Scan(src interface{}) error {
1148
+	switch s := src.(type) {
1149
+	case []byte:
1150
+		*e = WebhookDeliveryStatus(s)
1151
+	case string:
1152
+		*e = WebhookDeliveryStatus(s)
1153
+	default:
1154
+		return fmt.Errorf("unsupported scan type for WebhookDeliveryStatus: %T", src)
1155
+	}
1156
+	return nil
1157
+}
1158
+
1159
+type NullWebhookDeliveryStatus struct {
1160
+	WebhookDeliveryStatus WebhookDeliveryStatus
1161
+	Valid                 bool // Valid is true if WebhookDeliveryStatus is not NULL
1162
+}
1163
+
1164
+// Scan implements the Scanner interface.
1165
+func (ns *NullWebhookDeliveryStatus) Scan(value interface{}) error {
1166
+	if value == nil {
1167
+		ns.WebhookDeliveryStatus, ns.Valid = "", false
1168
+		return nil
1169
+	}
1170
+	ns.Valid = true
1171
+	return ns.WebhookDeliveryStatus.Scan(value)
1172
+}
1173
+
1174
+// Value implements the driver Valuer interface.
1175
+func (ns NullWebhookDeliveryStatus) Value() (driver.Value, error) {
1176
+	if !ns.Valid {
1177
+		return nil, nil
1178
+	}
1179
+	return string(ns.WebhookDeliveryStatus), nil
1180
+}
1181
+
1182
+type WebhookOwnerKind string
1183
+
1184
+const (
1185
+	WebhookOwnerKindRepo WebhookOwnerKind = "repo"
1186
+	WebhookOwnerKindOrg  WebhookOwnerKind = "org"
1187
+)
1188
+
1189
+func (e *WebhookOwnerKind) Scan(src interface{}) error {
1190
+	switch s := src.(type) {
1191
+	case []byte:
1192
+		*e = WebhookOwnerKind(s)
1193
+	case string:
1194
+		*e = WebhookOwnerKind(s)
1195
+	default:
1196
+		return fmt.Errorf("unsupported scan type for WebhookOwnerKind: %T", src)
1197
+	}
1198
+	return nil
1199
+}
1200
+
1201
+type NullWebhookOwnerKind struct {
1202
+	WebhookOwnerKind WebhookOwnerKind
1203
+	Valid            bool // Valid is true if WebhookOwnerKind is not NULL
1204
+}
1205
+
1206
+// Scan implements the Scanner interface.
1207
+func (ns *NullWebhookOwnerKind) Scan(value interface{}) error {
1208
+	if value == nil {
1209
+		ns.WebhookOwnerKind, ns.Valid = "", false
1210
+		return nil
1211
+	}
1212
+	ns.Valid = true
1213
+	return ns.WebhookOwnerKind.Scan(value)
1214
+}
1215
+
1216
+// Value implements the driver Valuer interface.
1217
+func (ns NullWebhookOwnerKind) Value() (driver.Value, error) {
1218
+	if !ns.Valid {
1219
+		return nil, nil
1220
+	}
1221
+	return string(ns.WebhookOwnerKind), nil
1222
+}
1223
+
10961224
 type AuthAuditLog struct {
10971225
 	ID         int64
10981226
 	ActorID    pgtype.Int8
@@ -1734,6 +1862,52 @@ type Watch struct {
17341862
 	UpdatedAt pgtype.Timestamptz
17351863
 }
17361864
 
1865
+type Webhook struct {
1866
+	ID                   int64
1867
+	OwnerKind            WebhookOwnerKind
1868
+	OwnerID              int64
1869
+	Url                  string
1870
+	ContentType          WebhookContentType
1871
+	Events               []string
1872
+	SecretCiphertext     []byte
1873
+	SecretNonce          []byte
1874
+	Active               bool
1875
+	SslVerification      bool
1876
+	ConsecutiveFailures  int32
1877
+	AutoDisableThreshold int32
1878
+	DisabledAt           pgtype.Timestamptz
1879
+	DisabledReason       pgtype.Text
1880
+	LastSuccessAt        pgtype.Timestamptz
1881
+	LastFailureAt        pgtype.Timestamptz
1882
+	CreatedByUserID      pgtype.Int8
1883
+	CreatedAt            pgtype.Timestamptz
1884
+	UpdatedAt            pgtype.Timestamptz
1885
+}
1886
+
1887
+type WebhookDelivery struct {
1888
+	ID                int64
1889
+	WebhookID         int64
1890
+	EventKind         string
1891
+	EventID           pgtype.Int8
1892
+	DeliveryUuid      pgtype.UUID
1893
+	Payload           []byte
1894
+	RequestHeaders    []byte
1895
+	RequestBody       []byte
1896
+	ResponseStatus    pgtype.Int4
1897
+	ResponseHeaders   []byte
1898
+	ResponseBody      []byte
1899
+	ResponseTruncated bool
1900
+	StartedAt         pgtype.Timestamptz
1901
+	CompletedAt       pgtype.Timestamptz
1902
+	Attempt           int32
1903
+	MaxAttempts       int32
1904
+	NextRetryAt       pgtype.Timestamptz
1905
+	Status            WebhookDeliveryStatus
1906
+	IdempotencyKey    string
1907
+	ErrorSummary      pgtype.Text
1908
+	RedeliverOf       pgtype.Int8
1909
+}
1910
+
17371911
 type WebhookEventsPending struct {
17381912
 	ID        int64
17391913
 	RepoID    int64
internal/orgs/sqlc/models.gomodified
@@ -1093,6 +1093,134 @@ func (ns NullWatchLevel) Value() (driver.Value, error) {
10931093
 	return string(ns.WatchLevel), nil
10941094
 }
10951095
 
1096
+type WebhookContentType string
1097
+
1098
+const (
1099
+	WebhookContentTypeJson WebhookContentType = "json"
1100
+	WebhookContentTypeForm WebhookContentType = "form"
1101
+)
1102
+
1103
+func (e *WebhookContentType) Scan(src interface{}) error {
1104
+	switch s := src.(type) {
1105
+	case []byte:
1106
+		*e = WebhookContentType(s)
1107
+	case string:
1108
+		*e = WebhookContentType(s)
1109
+	default:
1110
+		return fmt.Errorf("unsupported scan type for WebhookContentType: %T", src)
1111
+	}
1112
+	return nil
1113
+}
1114
+
1115
+type NullWebhookContentType struct {
1116
+	WebhookContentType WebhookContentType
1117
+	Valid              bool // Valid is true if WebhookContentType is not NULL
1118
+}
1119
+
1120
+// Scan implements the Scanner interface.
1121
+func (ns *NullWebhookContentType) Scan(value interface{}) error {
1122
+	if value == nil {
1123
+		ns.WebhookContentType, ns.Valid = "", false
1124
+		return nil
1125
+	}
1126
+	ns.Valid = true
1127
+	return ns.WebhookContentType.Scan(value)
1128
+}
1129
+
1130
+// Value implements the driver Valuer interface.
1131
+func (ns NullWebhookContentType) Value() (driver.Value, error) {
1132
+	if !ns.Valid {
1133
+		return nil, nil
1134
+	}
1135
+	return string(ns.WebhookContentType), nil
1136
+}
1137
+
1138
+type WebhookDeliveryStatus string
1139
+
1140
+const (
1141
+	WebhookDeliveryStatusPending         WebhookDeliveryStatus = "pending"
1142
+	WebhookDeliveryStatusSucceeded       WebhookDeliveryStatus = "succeeded"
1143
+	WebhookDeliveryStatusFailedRetry     WebhookDeliveryStatus = "failed_retry"
1144
+	WebhookDeliveryStatusFailedPermanent WebhookDeliveryStatus = "failed_permanent"
1145
+)
1146
+
1147
+func (e *WebhookDeliveryStatus) Scan(src interface{}) error {
1148
+	switch s := src.(type) {
1149
+	case []byte:
1150
+		*e = WebhookDeliveryStatus(s)
1151
+	case string:
1152
+		*e = WebhookDeliveryStatus(s)
1153
+	default:
1154
+		return fmt.Errorf("unsupported scan type for WebhookDeliveryStatus: %T", src)
1155
+	}
1156
+	return nil
1157
+}
1158
+
1159
+type NullWebhookDeliveryStatus struct {
1160
+	WebhookDeliveryStatus WebhookDeliveryStatus
1161
+	Valid                 bool // Valid is true if WebhookDeliveryStatus is not NULL
1162
+}
1163
+
1164
+// Scan implements the Scanner interface.
1165
+func (ns *NullWebhookDeliveryStatus) Scan(value interface{}) error {
1166
+	if value == nil {
1167
+		ns.WebhookDeliveryStatus, ns.Valid = "", false
1168
+		return nil
1169
+	}
1170
+	ns.Valid = true
1171
+	return ns.WebhookDeliveryStatus.Scan(value)
1172
+}
1173
+
1174
+// Value implements the driver Valuer interface.
1175
+func (ns NullWebhookDeliveryStatus) Value() (driver.Value, error) {
1176
+	if !ns.Valid {
1177
+		return nil, nil
1178
+	}
1179
+	return string(ns.WebhookDeliveryStatus), nil
1180
+}
1181
+
1182
+type WebhookOwnerKind string
1183
+
1184
+const (
1185
+	WebhookOwnerKindRepo WebhookOwnerKind = "repo"
1186
+	WebhookOwnerKindOrg  WebhookOwnerKind = "org"
1187
+)
1188
+
1189
+func (e *WebhookOwnerKind) Scan(src interface{}) error {
1190
+	switch s := src.(type) {
1191
+	case []byte:
1192
+		*e = WebhookOwnerKind(s)
1193
+	case string:
1194
+		*e = WebhookOwnerKind(s)
1195
+	default:
1196
+		return fmt.Errorf("unsupported scan type for WebhookOwnerKind: %T", src)
1197
+	}
1198
+	return nil
1199
+}
1200
+
1201
+type NullWebhookOwnerKind struct {
1202
+	WebhookOwnerKind WebhookOwnerKind
1203
+	Valid            bool // Valid is true if WebhookOwnerKind is not NULL
1204
+}
1205
+
1206
+// Scan implements the Scanner interface.
1207
+func (ns *NullWebhookOwnerKind) Scan(value interface{}) error {
1208
+	if value == nil {
1209
+		ns.WebhookOwnerKind, ns.Valid = "", false
1210
+		return nil
1211
+	}
1212
+	ns.Valid = true
1213
+	return ns.WebhookOwnerKind.Scan(value)
1214
+}
1215
+
1216
+// Value implements the driver Valuer interface.
1217
+func (ns NullWebhookOwnerKind) Value() (driver.Value, error) {
1218
+	if !ns.Valid {
1219
+		return nil, nil
1220
+	}
1221
+	return string(ns.WebhookOwnerKind), nil
1222
+}
1223
+
10961224
 type AuthAuditLog struct {
10971225
 	ID         int64
10981226
 	ActorID    pgtype.Int8
@@ -1734,6 +1862,52 @@ type Watch struct {
17341862
 	UpdatedAt pgtype.Timestamptz
17351863
 }
17361864
 
1865
+type Webhook struct {
1866
+	ID                   int64
1867
+	OwnerKind            WebhookOwnerKind
1868
+	OwnerID              int64
1869
+	Url                  string
1870
+	ContentType          WebhookContentType
1871
+	Events               []string
1872
+	SecretCiphertext     []byte
1873
+	SecretNonce          []byte
1874
+	Active               bool
1875
+	SslVerification      bool
1876
+	ConsecutiveFailures  int32
1877
+	AutoDisableThreshold int32
1878
+	DisabledAt           pgtype.Timestamptz
1879
+	DisabledReason       pgtype.Text
1880
+	LastSuccessAt        pgtype.Timestamptz
1881
+	LastFailureAt        pgtype.Timestamptz
1882
+	CreatedByUserID      pgtype.Int8
1883
+	CreatedAt            pgtype.Timestamptz
1884
+	UpdatedAt            pgtype.Timestamptz
1885
+}
1886
+
1887
+type WebhookDelivery struct {
1888
+	ID                int64
1889
+	WebhookID         int64
1890
+	EventKind         string
1891
+	EventID           pgtype.Int8
1892
+	DeliveryUuid      pgtype.UUID
1893
+	Payload           []byte
1894
+	RequestHeaders    []byte
1895
+	RequestBody       []byte
1896
+	ResponseStatus    pgtype.Int4
1897
+	ResponseHeaders   []byte
1898
+	ResponseBody      []byte
1899
+	ResponseTruncated bool
1900
+	StartedAt         pgtype.Timestamptz
1901
+	CompletedAt       pgtype.Timestamptz
1902
+	Attempt           int32
1903
+	MaxAttempts       int32
1904
+	NextRetryAt       pgtype.Timestamptz
1905
+	Status            WebhookDeliveryStatus
1906
+	IdempotencyKey    string
1907
+	ErrorSummary      pgtype.Text
1908
+	RedeliverOf       pgtype.Int8
1909
+}
1910
+
17371911
 type WebhookEventsPending struct {
17381912
 	ID        int64
17391913
 	RepoID    int64
internal/pulls/sqlc/models.gomodified
@@ -1093,6 +1093,134 @@ func (ns NullWatchLevel) Value() (driver.Value, error) {
10931093
 	return string(ns.WatchLevel), nil
10941094
 }
10951095
 
1096
+type WebhookContentType string
1097
+
1098
+const (
1099
+	WebhookContentTypeJson WebhookContentType = "json"
1100
+	WebhookContentTypeForm WebhookContentType = "form"
1101
+)
1102
+
1103
+func (e *WebhookContentType) Scan(src interface{}) error {
1104
+	switch s := src.(type) {
1105
+	case []byte:
1106
+		*e = WebhookContentType(s)
1107
+	case string:
1108
+		*e = WebhookContentType(s)
1109
+	default:
1110
+		return fmt.Errorf("unsupported scan type for WebhookContentType: %T", src)
1111
+	}
1112
+	return nil
1113
+}
1114
+
1115
+type NullWebhookContentType struct {
1116
+	WebhookContentType WebhookContentType
1117
+	Valid              bool // Valid is true if WebhookContentType is not NULL
1118
+}
1119
+
1120
+// Scan implements the Scanner interface.
1121
+func (ns *NullWebhookContentType) Scan(value interface{}) error {
1122
+	if value == nil {
1123
+		ns.WebhookContentType, ns.Valid = "", false
1124
+		return nil
1125
+	}
1126
+	ns.Valid = true
1127
+	return ns.WebhookContentType.Scan(value)
1128
+}
1129
+
1130
+// Value implements the driver Valuer interface.
1131
+func (ns NullWebhookContentType) Value() (driver.Value, error) {
1132
+	if !ns.Valid {
1133
+		return nil, nil
1134
+	}
1135
+	return string(ns.WebhookContentType), nil
1136
+}
1137
+
1138
+type WebhookDeliveryStatus string
1139
+
1140
+const (
1141
+	WebhookDeliveryStatusPending         WebhookDeliveryStatus = "pending"
1142
+	WebhookDeliveryStatusSucceeded       WebhookDeliveryStatus = "succeeded"
1143
+	WebhookDeliveryStatusFailedRetry     WebhookDeliveryStatus = "failed_retry"
1144
+	WebhookDeliveryStatusFailedPermanent WebhookDeliveryStatus = "failed_permanent"
1145
+)
1146
+
1147
+func (e *WebhookDeliveryStatus) Scan(src interface{}) error {
1148
+	switch s := src.(type) {
1149
+	case []byte:
1150
+		*e = WebhookDeliveryStatus(s)
1151
+	case string:
1152
+		*e = WebhookDeliveryStatus(s)
1153
+	default:
1154
+		return fmt.Errorf("unsupported scan type for WebhookDeliveryStatus: %T", src)
1155
+	}
1156
+	return nil
1157
+}
1158
+
1159
+type NullWebhookDeliveryStatus struct {
1160
+	WebhookDeliveryStatus WebhookDeliveryStatus
1161
+	Valid                 bool // Valid is true if WebhookDeliveryStatus is not NULL
1162
+}
1163
+
1164
+// Scan implements the Scanner interface.
1165
+func (ns *NullWebhookDeliveryStatus) Scan(value interface{}) error {
1166
+	if value == nil {
1167
+		ns.WebhookDeliveryStatus, ns.Valid = "", false
1168
+		return nil
1169
+	}
1170
+	ns.Valid = true
1171
+	return ns.WebhookDeliveryStatus.Scan(value)
1172
+}
1173
+
1174
+// Value implements the driver Valuer interface.
1175
+func (ns NullWebhookDeliveryStatus) Value() (driver.Value, error) {
1176
+	if !ns.Valid {
1177
+		return nil, nil
1178
+	}
1179
+	return string(ns.WebhookDeliveryStatus), nil
1180
+}
1181
+
1182
+type WebhookOwnerKind string
1183
+
1184
+const (
1185
+	WebhookOwnerKindRepo WebhookOwnerKind = "repo"
1186
+	WebhookOwnerKindOrg  WebhookOwnerKind = "org"
1187
+)
1188
+
1189
+func (e *WebhookOwnerKind) Scan(src interface{}) error {
1190
+	switch s := src.(type) {
1191
+	case []byte:
1192
+		*e = WebhookOwnerKind(s)
1193
+	case string:
1194
+		*e = WebhookOwnerKind(s)
1195
+	default:
1196
+		return fmt.Errorf("unsupported scan type for WebhookOwnerKind: %T", src)
1197
+	}
1198
+	return nil
1199
+}
1200
+
1201
+type NullWebhookOwnerKind struct {
1202
+	WebhookOwnerKind WebhookOwnerKind
1203
+	Valid            bool // Valid is true if WebhookOwnerKind is not NULL
1204
+}
1205
+
1206
+// Scan implements the Scanner interface.
1207
+func (ns *NullWebhookOwnerKind) Scan(value interface{}) error {
1208
+	if value == nil {
1209
+		ns.WebhookOwnerKind, ns.Valid = "", false
1210
+		return nil
1211
+	}
1212
+	ns.Valid = true
1213
+	return ns.WebhookOwnerKind.Scan(value)
1214
+}
1215
+
1216
+// Value implements the driver Valuer interface.
1217
+func (ns NullWebhookOwnerKind) Value() (driver.Value, error) {
1218
+	if !ns.Valid {
1219
+		return nil, nil
1220
+	}
1221
+	return string(ns.WebhookOwnerKind), nil
1222
+}
1223
+
10961224
 type AuthAuditLog struct {
10971225
 	ID         int64
10981226
 	ActorID    pgtype.Int8
@@ -1734,6 +1862,52 @@ type Watch struct {
17341862
 	UpdatedAt pgtype.Timestamptz
17351863
 }
17361864
 
1865
+type Webhook struct {
1866
+	ID                   int64
1867
+	OwnerKind            WebhookOwnerKind
1868
+	OwnerID              int64
1869
+	Url                  string
1870
+	ContentType          WebhookContentType
1871
+	Events               []string
1872
+	SecretCiphertext     []byte
1873
+	SecretNonce          []byte
1874
+	Active               bool
1875
+	SslVerification      bool
1876
+	ConsecutiveFailures  int32
1877
+	AutoDisableThreshold int32
1878
+	DisabledAt           pgtype.Timestamptz
1879
+	DisabledReason       pgtype.Text
1880
+	LastSuccessAt        pgtype.Timestamptz
1881
+	LastFailureAt        pgtype.Timestamptz
1882
+	CreatedByUserID      pgtype.Int8
1883
+	CreatedAt            pgtype.Timestamptz
1884
+	UpdatedAt            pgtype.Timestamptz
1885
+}
1886
+
1887
+type WebhookDelivery struct {
1888
+	ID                int64
1889
+	WebhookID         int64
1890
+	EventKind         string
1891
+	EventID           pgtype.Int8
1892
+	DeliveryUuid      pgtype.UUID
1893
+	Payload           []byte
1894
+	RequestHeaders    []byte
1895
+	RequestBody       []byte
1896
+	ResponseStatus    pgtype.Int4
1897
+	ResponseHeaders   []byte
1898
+	ResponseBody      []byte
1899
+	ResponseTruncated bool
1900
+	StartedAt         pgtype.Timestamptz
1901
+	CompletedAt       pgtype.Timestamptz
1902
+	Attempt           int32
1903
+	MaxAttempts       int32
1904
+	NextRetryAt       pgtype.Timestamptz
1905
+	Status            WebhookDeliveryStatus
1906
+	IdempotencyKey    string
1907
+	ErrorSummary      pgtype.Text
1908
+	RedeliverOf       pgtype.Int8
1909
+}
1910
+
17371911
 type WebhookEventsPending struct {
17381912
 	ID        int64
17391913
 	RepoID    int64
internal/repos/sqlc/models.gomodified
@@ -1093,6 +1093,134 @@ func (ns NullWatchLevel) Value() (driver.Value, error) {
10931093
 	return string(ns.WatchLevel), nil
10941094
 }
10951095
 
1096
+type WebhookContentType string
1097
+
1098
+const (
1099
+	WebhookContentTypeJson WebhookContentType = "json"
1100
+	WebhookContentTypeForm WebhookContentType = "form"
1101
+)
1102
+
1103
+func (e *WebhookContentType) Scan(src interface{}) error {
1104
+	switch s := src.(type) {
1105
+	case []byte:
1106
+		*e = WebhookContentType(s)
1107
+	case string:
1108
+		*e = WebhookContentType(s)
1109
+	default:
1110
+		return fmt.Errorf("unsupported scan type for WebhookContentType: %T", src)
1111
+	}
1112
+	return nil
1113
+}
1114
+
1115
+type NullWebhookContentType struct {
1116
+	WebhookContentType WebhookContentType
1117
+	Valid              bool // Valid is true if WebhookContentType is not NULL
1118
+}
1119
+
1120
+// Scan implements the Scanner interface.
1121
+func (ns *NullWebhookContentType) Scan(value interface{}) error {
1122
+	if value == nil {
1123
+		ns.WebhookContentType, ns.Valid = "", false
1124
+		return nil
1125
+	}
1126
+	ns.Valid = true
1127
+	return ns.WebhookContentType.Scan(value)
1128
+}
1129
+
1130
+// Value implements the driver Valuer interface.
1131
+func (ns NullWebhookContentType) Value() (driver.Value, error) {
1132
+	if !ns.Valid {
1133
+		return nil, nil
1134
+	}
1135
+	return string(ns.WebhookContentType), nil
1136
+}
1137
+
1138
+type WebhookDeliveryStatus string
1139
+
1140
+const (
1141
+	WebhookDeliveryStatusPending         WebhookDeliveryStatus = "pending"
1142
+	WebhookDeliveryStatusSucceeded       WebhookDeliveryStatus = "succeeded"
1143
+	WebhookDeliveryStatusFailedRetry     WebhookDeliveryStatus = "failed_retry"
1144
+	WebhookDeliveryStatusFailedPermanent WebhookDeliveryStatus = "failed_permanent"
1145
+)
1146
+
1147
+func (e *WebhookDeliveryStatus) Scan(src interface{}) error {
1148
+	switch s := src.(type) {
1149
+	case []byte:
1150
+		*e = WebhookDeliveryStatus(s)
1151
+	case string:
1152
+		*e = WebhookDeliveryStatus(s)
1153
+	default:
1154
+		return fmt.Errorf("unsupported scan type for WebhookDeliveryStatus: %T", src)
1155
+	}
1156
+	return nil
1157
+}
1158
+
1159
+type NullWebhookDeliveryStatus struct {
1160
+	WebhookDeliveryStatus WebhookDeliveryStatus
1161
+	Valid                 bool // Valid is true if WebhookDeliveryStatus is not NULL
1162
+}
1163
+
1164
+// Scan implements the Scanner interface.
1165
+func (ns *NullWebhookDeliveryStatus) Scan(value interface{}) error {
1166
+	if value == nil {
1167
+		ns.WebhookDeliveryStatus, ns.Valid = "", false
1168
+		return nil
1169
+	}
1170
+	ns.Valid = true
1171
+	return ns.WebhookDeliveryStatus.Scan(value)
1172
+}
1173
+
1174
+// Value implements the driver Valuer interface.
1175
+func (ns NullWebhookDeliveryStatus) Value() (driver.Value, error) {
1176
+	if !ns.Valid {
1177
+		return nil, nil
1178
+	}
1179
+	return string(ns.WebhookDeliveryStatus), nil
1180
+}
1181
+
1182
+type WebhookOwnerKind string
1183
+
1184
+const (
1185
+	WebhookOwnerKindRepo WebhookOwnerKind = "repo"
1186
+	WebhookOwnerKindOrg  WebhookOwnerKind = "org"
1187
+)
1188
+
1189
+func (e *WebhookOwnerKind) Scan(src interface{}) error {
1190
+	switch s := src.(type) {
1191
+	case []byte:
1192
+		*e = WebhookOwnerKind(s)
1193
+	case string:
1194
+		*e = WebhookOwnerKind(s)
1195
+	default:
1196
+		return fmt.Errorf("unsupported scan type for WebhookOwnerKind: %T", src)
1197
+	}
1198
+	return nil
1199
+}
1200
+
1201
+type NullWebhookOwnerKind struct {
1202
+	WebhookOwnerKind WebhookOwnerKind
1203
+	Valid            bool // Valid is true if WebhookOwnerKind is not NULL
1204
+}
1205
+
1206
+// Scan implements the Scanner interface.
1207
+func (ns *NullWebhookOwnerKind) Scan(value interface{}) error {
1208
+	if value == nil {
1209
+		ns.WebhookOwnerKind, ns.Valid = "", false
1210
+		return nil
1211
+	}
1212
+	ns.Valid = true
1213
+	return ns.WebhookOwnerKind.Scan(value)
1214
+}
1215
+
1216
+// Value implements the driver Valuer interface.
1217
+func (ns NullWebhookOwnerKind) Value() (driver.Value, error) {
1218
+	if !ns.Valid {
1219
+		return nil, nil
1220
+	}
1221
+	return string(ns.WebhookOwnerKind), nil
1222
+}
1223
+
10961224
 type AuthAuditLog struct {
10971225
 	ID         int64
10981226
 	ActorID    pgtype.Int8
@@ -1734,6 +1862,52 @@ type Watch struct {
17341862
 	UpdatedAt pgtype.Timestamptz
17351863
 }
17361864
 
1865
+type Webhook struct {
1866
+	ID                   int64
1867
+	OwnerKind            WebhookOwnerKind
1868
+	OwnerID              int64
1869
+	Url                  string
1870
+	ContentType          WebhookContentType
1871
+	Events               []string
1872
+	SecretCiphertext     []byte
1873
+	SecretNonce          []byte
1874
+	Active               bool
1875
+	SslVerification      bool
1876
+	ConsecutiveFailures  int32
1877
+	AutoDisableThreshold int32
1878
+	DisabledAt           pgtype.Timestamptz
1879
+	DisabledReason       pgtype.Text
1880
+	LastSuccessAt        pgtype.Timestamptz
1881
+	LastFailureAt        pgtype.Timestamptz
1882
+	CreatedByUserID      pgtype.Int8
1883
+	CreatedAt            pgtype.Timestamptz
1884
+	UpdatedAt            pgtype.Timestamptz
1885
+}
1886
+
1887
+type WebhookDelivery struct {
1888
+	ID                int64
1889
+	WebhookID         int64
1890
+	EventKind         string
1891
+	EventID           pgtype.Int8
1892
+	DeliveryUuid      pgtype.UUID
1893
+	Payload           []byte
1894
+	RequestHeaders    []byte
1895
+	RequestBody       []byte
1896
+	ResponseStatus    pgtype.Int4
1897
+	ResponseHeaders   []byte
1898
+	ResponseBody      []byte
1899
+	ResponseTruncated bool
1900
+	StartedAt         pgtype.Timestamptz
1901
+	CompletedAt       pgtype.Timestamptz
1902
+	Attempt           int32
1903
+	MaxAttempts       int32
1904
+	NextRetryAt       pgtype.Timestamptz
1905
+	Status            WebhookDeliveryStatus
1906
+	IdempotencyKey    string
1907
+	ErrorSummary      pgtype.Text
1908
+	RedeliverOf       pgtype.Int8
1909
+}
1910
+
17371911
 type WebhookEventsPending struct {
17381912
 	ID        int64
17391913
 	RepoID    int64
internal/social/sqlc/models.gomodified
@@ -1093,6 +1093,134 @@ func (ns NullWatchLevel) Value() (driver.Value, error) {
10931093
 	return string(ns.WatchLevel), nil
10941094
 }
10951095
 
1096
+type WebhookContentType string
1097
+
1098
+const (
1099
+	WebhookContentTypeJson WebhookContentType = "json"
1100
+	WebhookContentTypeForm WebhookContentType = "form"
1101
+)
1102
+
1103
+func (e *WebhookContentType) Scan(src interface{}) error {
1104
+	switch s := src.(type) {
1105
+	case []byte:
1106
+		*e = WebhookContentType(s)
1107
+	case string:
1108
+		*e = WebhookContentType(s)
1109
+	default:
1110
+		return fmt.Errorf("unsupported scan type for WebhookContentType: %T", src)
1111
+	}
1112
+	return nil
1113
+}
1114
+
1115
+type NullWebhookContentType struct {
1116
+	WebhookContentType WebhookContentType
1117
+	Valid              bool // Valid is true if WebhookContentType is not NULL
1118
+}
1119
+
1120
+// Scan implements the Scanner interface.
1121
+func (ns *NullWebhookContentType) Scan(value interface{}) error {
1122
+	if value == nil {
1123
+		ns.WebhookContentType, ns.Valid = "", false
1124
+		return nil
1125
+	}
1126
+	ns.Valid = true
1127
+	return ns.WebhookContentType.Scan(value)
1128
+}
1129
+
1130
+// Value implements the driver Valuer interface.
1131
+func (ns NullWebhookContentType) Value() (driver.Value, error) {
1132
+	if !ns.Valid {
1133
+		return nil, nil
1134
+	}
1135
+	return string(ns.WebhookContentType), nil
1136
+}
1137
+
1138
+type WebhookDeliveryStatus string
1139
+
1140
+const (
1141
+	WebhookDeliveryStatusPending         WebhookDeliveryStatus = "pending"
1142
+	WebhookDeliveryStatusSucceeded       WebhookDeliveryStatus = "succeeded"
1143
+	WebhookDeliveryStatusFailedRetry     WebhookDeliveryStatus = "failed_retry"
1144
+	WebhookDeliveryStatusFailedPermanent WebhookDeliveryStatus = "failed_permanent"
1145
+)
1146
+
1147
+func (e *WebhookDeliveryStatus) Scan(src interface{}) error {
1148
+	switch s := src.(type) {
1149
+	case []byte:
1150
+		*e = WebhookDeliveryStatus(s)
1151
+	case string:
1152
+		*e = WebhookDeliveryStatus(s)
1153
+	default:
1154
+		return fmt.Errorf("unsupported scan type for WebhookDeliveryStatus: %T", src)
1155
+	}
1156
+	return nil
1157
+}
1158
+
1159
+type NullWebhookDeliveryStatus struct {
1160
+	WebhookDeliveryStatus WebhookDeliveryStatus
1161
+	Valid                 bool // Valid is true if WebhookDeliveryStatus is not NULL
1162
+}
1163
+
1164
+// Scan implements the Scanner interface.
1165
+func (ns *NullWebhookDeliveryStatus) Scan(value interface{}) error {
1166
+	if value == nil {
1167
+		ns.WebhookDeliveryStatus, ns.Valid = "", false
1168
+		return nil
1169
+	}
1170
+	ns.Valid = true
1171
+	return ns.WebhookDeliveryStatus.Scan(value)
1172
+}
1173
+
1174
+// Value implements the driver Valuer interface.
1175
+func (ns NullWebhookDeliveryStatus) Value() (driver.Value, error) {
1176
+	if !ns.Valid {
1177
+		return nil, nil
1178
+	}
1179
+	return string(ns.WebhookDeliveryStatus), nil
1180
+}
1181
+
1182
+type WebhookOwnerKind string
1183
+
1184
+const (
1185
+	WebhookOwnerKindRepo WebhookOwnerKind = "repo"
1186
+	WebhookOwnerKindOrg  WebhookOwnerKind = "org"
1187
+)
1188
+
1189
+func (e *WebhookOwnerKind) Scan(src interface{}) error {
1190
+	switch s := src.(type) {
1191
+	case []byte:
1192
+		*e = WebhookOwnerKind(s)
1193
+	case string:
1194
+		*e = WebhookOwnerKind(s)
1195
+	default:
1196
+		return fmt.Errorf("unsupported scan type for WebhookOwnerKind: %T", src)
1197
+	}
1198
+	return nil
1199
+}
1200
+
1201
+type NullWebhookOwnerKind struct {
1202
+	WebhookOwnerKind WebhookOwnerKind
1203
+	Valid            bool // Valid is true if WebhookOwnerKind is not NULL
1204
+}
1205
+
1206
+// Scan implements the Scanner interface.
1207
+func (ns *NullWebhookOwnerKind) Scan(value interface{}) error {
1208
+	if value == nil {
1209
+		ns.WebhookOwnerKind, ns.Valid = "", false
1210
+		return nil
1211
+	}
1212
+	ns.Valid = true
1213
+	return ns.WebhookOwnerKind.Scan(value)
1214
+}
1215
+
1216
+// Value implements the driver Valuer interface.
1217
+func (ns NullWebhookOwnerKind) Value() (driver.Value, error) {
1218
+	if !ns.Valid {
1219
+		return nil, nil
1220
+	}
1221
+	return string(ns.WebhookOwnerKind), nil
1222
+}
1223
+
10961224
 type AuthAuditLog struct {
10971225
 	ID         int64
10981226
 	ActorID    pgtype.Int8
@@ -1734,6 +1862,52 @@ type Watch struct {
17341862
 	UpdatedAt pgtype.Timestamptz
17351863
 }
17361864
 
1865
+type Webhook struct {
1866
+	ID                   int64
1867
+	OwnerKind            WebhookOwnerKind
1868
+	OwnerID              int64
1869
+	Url                  string
1870
+	ContentType          WebhookContentType
1871
+	Events               []string
1872
+	SecretCiphertext     []byte
1873
+	SecretNonce          []byte
1874
+	Active               bool
1875
+	SslVerification      bool
1876
+	ConsecutiveFailures  int32
1877
+	AutoDisableThreshold int32
1878
+	DisabledAt           pgtype.Timestamptz
1879
+	DisabledReason       pgtype.Text
1880
+	LastSuccessAt        pgtype.Timestamptz
1881
+	LastFailureAt        pgtype.Timestamptz
1882
+	CreatedByUserID      pgtype.Int8
1883
+	CreatedAt            pgtype.Timestamptz
1884
+	UpdatedAt            pgtype.Timestamptz
1885
+}
1886
+
1887
+type WebhookDelivery struct {
1888
+	ID                int64
1889
+	WebhookID         int64
1890
+	EventKind         string
1891
+	EventID           pgtype.Int8
1892
+	DeliveryUuid      pgtype.UUID
1893
+	Payload           []byte
1894
+	RequestHeaders    []byte
1895
+	RequestBody       []byte
1896
+	ResponseStatus    pgtype.Int4
1897
+	ResponseHeaders   []byte
1898
+	ResponseBody      []byte
1899
+	ResponseTruncated bool
1900
+	StartedAt         pgtype.Timestamptz
1901
+	CompletedAt       pgtype.Timestamptz
1902
+	Attempt           int32
1903
+	MaxAttempts       int32
1904
+	NextRetryAt       pgtype.Timestamptz
1905
+	Status            WebhookDeliveryStatus
1906
+	IdempotencyKey    string
1907
+	ErrorSummary      pgtype.Text
1908
+	RedeliverOf       pgtype.Int8
1909
+}
1910
+
17371911
 type WebhookEventsPending struct {
17381912
 	ID        int64
17391913
 	RepoID    int64
internal/users/sqlc/models.gomodified
@@ -1093,6 +1093,134 @@ func (ns NullWatchLevel) Value() (driver.Value, error) {
10931093
 	return string(ns.WatchLevel), nil
10941094
 }
10951095
 
1096
+type WebhookContentType string
1097
+
1098
+const (
1099
+	WebhookContentTypeJson WebhookContentType = "json"
1100
+	WebhookContentTypeForm WebhookContentType = "form"
1101
+)
1102
+
1103
+func (e *WebhookContentType) Scan(src interface{}) error {
1104
+	switch s := src.(type) {
1105
+	case []byte:
1106
+		*e = WebhookContentType(s)
1107
+	case string:
1108
+		*e = WebhookContentType(s)
1109
+	default:
1110
+		return fmt.Errorf("unsupported scan type for WebhookContentType: %T", src)
1111
+	}
1112
+	return nil
1113
+}
1114
+
1115
+type NullWebhookContentType struct {
1116
+	WebhookContentType WebhookContentType
1117
+	Valid              bool // Valid is true if WebhookContentType is not NULL
1118
+}
1119
+
1120
+// Scan implements the Scanner interface.
1121
+func (ns *NullWebhookContentType) Scan(value interface{}) error {
1122
+	if value == nil {
1123
+		ns.WebhookContentType, ns.Valid = "", false
1124
+		return nil
1125
+	}
1126
+	ns.Valid = true
1127
+	return ns.WebhookContentType.Scan(value)
1128
+}
1129
+
1130
+// Value implements the driver Valuer interface.
1131
+func (ns NullWebhookContentType) Value() (driver.Value, error) {
1132
+	if !ns.Valid {
1133
+		return nil, nil
1134
+	}
1135
+	return string(ns.WebhookContentType), nil
1136
+}
1137
+
1138
+type WebhookDeliveryStatus string
1139
+
1140
+const (
1141
+	WebhookDeliveryStatusPending         WebhookDeliveryStatus = "pending"
1142
+	WebhookDeliveryStatusSucceeded       WebhookDeliveryStatus = "succeeded"
1143
+	WebhookDeliveryStatusFailedRetry     WebhookDeliveryStatus = "failed_retry"
1144
+	WebhookDeliveryStatusFailedPermanent WebhookDeliveryStatus = "failed_permanent"
1145
+)
1146
+
1147
+func (e *WebhookDeliveryStatus) Scan(src interface{}) error {
1148
+	switch s := src.(type) {
1149
+	case []byte:
1150
+		*e = WebhookDeliveryStatus(s)
1151
+	case string:
1152
+		*e = WebhookDeliveryStatus(s)
1153
+	default:
1154
+		return fmt.Errorf("unsupported scan type for WebhookDeliveryStatus: %T", src)
1155
+	}
1156
+	return nil
1157
+}
1158
+
1159
+type NullWebhookDeliveryStatus struct {
1160
+	WebhookDeliveryStatus WebhookDeliveryStatus
1161
+	Valid                 bool // Valid is true if WebhookDeliveryStatus is not NULL
1162
+}
1163
+
1164
+// Scan implements the Scanner interface.
1165
+func (ns *NullWebhookDeliveryStatus) Scan(value interface{}) error {
1166
+	if value == nil {
1167
+		ns.WebhookDeliveryStatus, ns.Valid = "", false
1168
+		return nil
1169
+	}
1170
+	ns.Valid = true
1171
+	return ns.WebhookDeliveryStatus.Scan(value)
1172
+}
1173
+
1174
+// Value implements the driver Valuer interface.
1175
+func (ns NullWebhookDeliveryStatus) Value() (driver.Value, error) {
1176
+	if !ns.Valid {
1177
+		return nil, nil
1178
+	}
1179
+	return string(ns.WebhookDeliveryStatus), nil
1180
+}
1181
+
1182
+type WebhookOwnerKind string
1183
+
1184
+const (
1185
+	WebhookOwnerKindRepo WebhookOwnerKind = "repo"
1186
+	WebhookOwnerKindOrg  WebhookOwnerKind = "org"
1187
+)
1188
+
1189
+func (e *WebhookOwnerKind) Scan(src interface{}) error {
1190
+	switch s := src.(type) {
1191
+	case []byte:
1192
+		*e = WebhookOwnerKind(s)
1193
+	case string:
1194
+		*e = WebhookOwnerKind(s)
1195
+	default:
1196
+		return fmt.Errorf("unsupported scan type for WebhookOwnerKind: %T", src)
1197
+	}
1198
+	return nil
1199
+}
1200
+
1201
+type NullWebhookOwnerKind struct {
1202
+	WebhookOwnerKind WebhookOwnerKind
1203
+	Valid            bool // Valid is true if WebhookOwnerKind is not NULL
1204
+}
1205
+
1206
+// Scan implements the Scanner interface.
1207
+func (ns *NullWebhookOwnerKind) Scan(value interface{}) error {
1208
+	if value == nil {
1209
+		ns.WebhookOwnerKind, ns.Valid = "", false
1210
+		return nil
1211
+	}
1212
+	ns.Valid = true
1213
+	return ns.WebhookOwnerKind.Scan(value)
1214
+}
1215
+
1216
+// Value implements the driver Valuer interface.
1217
+func (ns NullWebhookOwnerKind) Value() (driver.Value, error) {
1218
+	if !ns.Valid {
1219
+		return nil, nil
1220
+	}
1221
+	return string(ns.WebhookOwnerKind), nil
1222
+}
1223
+
10961224
 type AuthAuditLog struct {
10971225
 	ID         int64
10981226
 	ActorID    pgtype.Int8
@@ -1734,6 +1862,52 @@ type Watch struct {
17341862
 	UpdatedAt pgtype.Timestamptz
17351863
 }
17361864
 
1865
+type Webhook struct {
1866
+	ID                   int64
1867
+	OwnerKind            WebhookOwnerKind
1868
+	OwnerID              int64
1869
+	Url                  string
1870
+	ContentType          WebhookContentType
1871
+	Events               []string
1872
+	SecretCiphertext     []byte
1873
+	SecretNonce          []byte
1874
+	Active               bool
1875
+	SslVerification      bool
1876
+	ConsecutiveFailures  int32
1877
+	AutoDisableThreshold int32
1878
+	DisabledAt           pgtype.Timestamptz
1879
+	DisabledReason       pgtype.Text
1880
+	LastSuccessAt        pgtype.Timestamptz
1881
+	LastFailureAt        pgtype.Timestamptz
1882
+	CreatedByUserID      pgtype.Int8
1883
+	CreatedAt            pgtype.Timestamptz
1884
+	UpdatedAt            pgtype.Timestamptz
1885
+}
1886
+
1887
+type WebhookDelivery struct {
1888
+	ID                int64
1889
+	WebhookID         int64
1890
+	EventKind         string
1891
+	EventID           pgtype.Int8
1892
+	DeliveryUuid      pgtype.UUID
1893
+	Payload           []byte
1894
+	RequestHeaders    []byte
1895
+	RequestBody       []byte
1896
+	ResponseStatus    pgtype.Int4
1897
+	ResponseHeaders   []byte
1898
+	ResponseBody      []byte
1899
+	ResponseTruncated bool
1900
+	StartedAt         pgtype.Timestamptz
1901
+	CompletedAt       pgtype.Timestamptz
1902
+	Attempt           int32
1903
+	MaxAttempts       int32
1904
+	NextRetryAt       pgtype.Timestamptz
1905
+	Status            WebhookDeliveryStatus
1906
+	IdempotencyKey    string
1907
+	ErrorSummary      pgtype.Text
1908
+	RedeliverOf       pgtype.Int8
1909
+}
1910
+
17371911
 type WebhookEventsPending struct {
17381912
 	ID        int64
17391913
 	RepoID    int64
internal/worker/sqlc/models.gomodified
@@ -1093,6 +1093,134 @@ func (ns NullWatchLevel) Value() (driver.Value, error) {
10931093
 	return string(ns.WatchLevel), nil
10941094
 }
10951095
 
1096
+type WebhookContentType string
1097
+
1098
+const (
1099
+	WebhookContentTypeJson WebhookContentType = "json"
1100
+	WebhookContentTypeForm WebhookContentType = "form"
1101
+)
1102
+
1103
+func (e *WebhookContentType) Scan(src interface{}) error {
1104
+	switch s := src.(type) {
1105
+	case []byte:
1106
+		*e = WebhookContentType(s)
1107
+	case string:
1108
+		*e = WebhookContentType(s)
1109
+	default:
1110
+		return fmt.Errorf("unsupported scan type for WebhookContentType: %T", src)
1111
+	}
1112
+	return nil
1113
+}
1114
+
1115
+type NullWebhookContentType struct {
1116
+	WebhookContentType WebhookContentType
1117
+	Valid              bool // Valid is true if WebhookContentType is not NULL
1118
+}
1119
+
1120
+// Scan implements the Scanner interface.
1121
+func (ns *NullWebhookContentType) Scan(value interface{}) error {
1122
+	if value == nil {
1123
+		ns.WebhookContentType, ns.Valid = "", false
1124
+		return nil
1125
+	}
1126
+	ns.Valid = true
1127
+	return ns.WebhookContentType.Scan(value)
1128
+}
1129
+
1130
+// Value implements the driver Valuer interface.
1131
+func (ns NullWebhookContentType) Value() (driver.Value, error) {
1132
+	if !ns.Valid {
1133
+		return nil, nil
1134
+	}
1135
+	return string(ns.WebhookContentType), nil
1136
+}
1137
+
1138
+type WebhookDeliveryStatus string
1139
+
1140
+const (
1141
+	WebhookDeliveryStatusPending         WebhookDeliveryStatus = "pending"
1142
+	WebhookDeliveryStatusSucceeded       WebhookDeliveryStatus = "succeeded"
1143
+	WebhookDeliveryStatusFailedRetry     WebhookDeliveryStatus = "failed_retry"
1144
+	WebhookDeliveryStatusFailedPermanent WebhookDeliveryStatus = "failed_permanent"
1145
+)
1146
+
1147
+func (e *WebhookDeliveryStatus) Scan(src interface{}) error {
1148
+	switch s := src.(type) {
1149
+	case []byte:
1150
+		*e = WebhookDeliveryStatus(s)
1151
+	case string:
1152
+		*e = WebhookDeliveryStatus(s)
1153
+	default:
1154
+		return fmt.Errorf("unsupported scan type for WebhookDeliveryStatus: %T", src)
1155
+	}
1156
+	return nil
1157
+}
1158
+
1159
+type NullWebhookDeliveryStatus struct {
1160
+	WebhookDeliveryStatus WebhookDeliveryStatus
1161
+	Valid                 bool // Valid is true if WebhookDeliveryStatus is not NULL
1162
+}
1163
+
1164
+// Scan implements the Scanner interface.
1165
+func (ns *NullWebhookDeliveryStatus) Scan(value interface{}) error {
1166
+	if value == nil {
1167
+		ns.WebhookDeliveryStatus, ns.Valid = "", false
1168
+		return nil
1169
+	}
1170
+	ns.Valid = true
1171
+	return ns.WebhookDeliveryStatus.Scan(value)
1172
+}
1173
+
1174
+// Value implements the driver Valuer interface.
1175
+func (ns NullWebhookDeliveryStatus) Value() (driver.Value, error) {
1176
+	if !ns.Valid {
1177
+		return nil, nil
1178
+	}
1179
+	return string(ns.WebhookDeliveryStatus), nil
1180
+}
1181
+
1182
+type WebhookOwnerKind string
1183
+
1184
+const (
1185
+	WebhookOwnerKindRepo WebhookOwnerKind = "repo"
1186
+	WebhookOwnerKindOrg  WebhookOwnerKind = "org"
1187
+)
1188
+
1189
+func (e *WebhookOwnerKind) Scan(src interface{}) error {
1190
+	switch s := src.(type) {
1191
+	case []byte:
1192
+		*e = WebhookOwnerKind(s)
1193
+	case string:
1194
+		*e = WebhookOwnerKind(s)
1195
+	default:
1196
+		return fmt.Errorf("unsupported scan type for WebhookOwnerKind: %T", src)
1197
+	}
1198
+	return nil
1199
+}
1200
+
1201
+type NullWebhookOwnerKind struct {
1202
+	WebhookOwnerKind WebhookOwnerKind
1203
+	Valid            bool // Valid is true if WebhookOwnerKind is not NULL
1204
+}
1205
+
1206
+// Scan implements the Scanner interface.
1207
+func (ns *NullWebhookOwnerKind) Scan(value interface{}) error {
1208
+	if value == nil {
1209
+		ns.WebhookOwnerKind, ns.Valid = "", false
1210
+		return nil
1211
+	}
1212
+	ns.Valid = true
1213
+	return ns.WebhookOwnerKind.Scan(value)
1214
+}
1215
+
1216
+// Value implements the driver Valuer interface.
1217
+func (ns NullWebhookOwnerKind) Value() (driver.Value, error) {
1218
+	if !ns.Valid {
1219
+		return nil, nil
1220
+	}
1221
+	return string(ns.WebhookOwnerKind), nil
1222
+}
1223
+
10961224
 type AuthAuditLog struct {
10971225
 	ID         int64
10981226
 	ActorID    pgtype.Int8
@@ -1734,6 +1862,52 @@ type Watch struct {
17341862
 	UpdatedAt pgtype.Timestamptz
17351863
 }
17361864
 
1865
+type Webhook struct {
1866
+	ID                   int64
1867
+	OwnerKind            WebhookOwnerKind
1868
+	OwnerID              int64
1869
+	Url                  string
1870
+	ContentType          WebhookContentType
1871
+	Events               []string
1872
+	SecretCiphertext     []byte
1873
+	SecretNonce          []byte
1874
+	Active               bool
1875
+	SslVerification      bool
1876
+	ConsecutiveFailures  int32
1877
+	AutoDisableThreshold int32
1878
+	DisabledAt           pgtype.Timestamptz
1879
+	DisabledReason       pgtype.Text
1880
+	LastSuccessAt        pgtype.Timestamptz
1881
+	LastFailureAt        pgtype.Timestamptz
1882
+	CreatedByUserID      pgtype.Int8
1883
+	CreatedAt            pgtype.Timestamptz
1884
+	UpdatedAt            pgtype.Timestamptz
1885
+}
1886
+
1887
+type WebhookDelivery struct {
1888
+	ID                int64
1889
+	WebhookID         int64
1890
+	EventKind         string
1891
+	EventID           pgtype.Int8
1892
+	DeliveryUuid      pgtype.UUID
1893
+	Payload           []byte
1894
+	RequestHeaders    []byte
1895
+	RequestBody       []byte
1896
+	ResponseStatus    pgtype.Int4
1897
+	ResponseHeaders   []byte
1898
+	ResponseBody      []byte
1899
+	ResponseTruncated bool
1900
+	StartedAt         pgtype.Timestamptz
1901
+	CompletedAt       pgtype.Timestamptz
1902
+	Attempt           int32
1903
+	MaxAttempts       int32
1904
+	NextRetryAt       pgtype.Timestamptz
1905
+	Status            WebhookDeliveryStatus
1906
+	IdempotencyKey    string
1907
+	ErrorSummary      pgtype.Text
1908
+	RedeliverOf       pgtype.Int8
1909
+}
1910
+
17371911
 type WebhookEventsPending struct {
17381912
 	ID        int64
17391913
 	RepoID    int64