Skip to content

Commit 206234d

Browse files
committed
updated all webhook.Register references to Register
1 parent 8e8219a commit 206234d

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

internalWebhook.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (v2 RegistryV2) GetUntil() time.Time {
4545
return v2.Registration.Expires
4646
}
4747

48-
func InternalWebhookToItem(now func() time.Time, iw webhook.Register) (model.Item, error) {
48+
func InternalWebhookToItem(now func() time.Time, iw Register) (model.Item, error) {
4949
encodedWebhook, err := json.Marshal(iw)
5050
if err != nil {
5151
return model.Item{}, err
@@ -69,7 +69,7 @@ func InternalWebhookToItem(now func() time.Time, iw webhook.Register) (model.Ite
6969
}, nil
7070
}
7171

72-
func ItemToInternalWebhook(i model.Item) (r webhook.Register, e error) {
72+
func ItemToInternalWebhook(i model.Item) (r Register, e error) {
7373
var v1 RegistryV1
7474
var v2 RegistryV2
7575
encodedWebhook, e := json.Marshal(i.Data)
@@ -98,8 +98,8 @@ func ItemToInternalWebhook(i model.Item) (r webhook.Register, e error) {
9898
return nil, fmt.Errorf("could not unmarshal data into either RegistryV1 or RegistryV2")
9999
}
100100

101-
func ItemsToInternalWebhooks(items []model.Item) ([]webhook.Register, error) {
102-
iws := []webhook.Register{}
101+
func ItemsToInternalWebhooks(items []model.Item) ([]Register, error) {
102+
iws := []Register{}
103103
for _, item := range items {
104104
iw, err := ItemToInternalWebhook(item)
105105
if err != nil {
@@ -110,7 +110,7 @@ func ItemsToInternalWebhooks(items []model.Item) ([]webhook.Register, error) {
110110
return iws, nil
111111
}
112112

113-
func InternalWebhooksToWebhooks(iws []webhook.Register) []any {
113+
func InternalWebhooksToWebhooks(iws []Register) []any {
114114
w := make([]any, 0, len(iws))
115115
for _, iw := range iws {
116116
switch r := iw.(type) {

transport.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ type transportConfig struct {
5050

5151
type addWebhookRequest struct {
5252
owner string
53-
internalWebook webhook.Register
53+
internalWebook Register
5454
}
5555

5656
func encodeGetAllWebhooksResponse(ctx context.Context, rw http.ResponseWriter, response interface{}) error {
57-
iws := response.([]webhook.Register)
57+
iws := response.([]Register)
5858
webhooks := InternalWebhooksToWebhooks(iws)
5959
if webhooks == nil {
6060
// prefer JSON output to be "[]" instead of "<nil>"

watch.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,23 @@ package ancla
55

66
import (
77
"github.com/prometheus/client_golang/prometheus"
8-
"github.com/xmidt-org/webhook-schema"
98
)
109

1110
// Watch is the interface for listening for webhook subcription updates.
1211
// Updates represent the latest known list of subscriptions.
1312
type Watch interface {
14-
Update([]webhook.Register)
13+
Update([]Register)
1514
}
1615

1716
// WatchFunc allows bare functions to pass as Watches.
18-
type WatchFunc func([]webhook.Register)
17+
type WatchFunc func([]Register)
1918

20-
func (f WatchFunc) Update(update []webhook.Register) {
19+
func (f WatchFunc) Update(update []Register) {
2120
f(update)
2221
}
2322

2423
func webhookListSizeWatch(s prometheus.Gauge) Watch {
25-
return WatchFunc(func(webhooks []webhook.Register) {
24+
return WatchFunc(func(webhooks []Register) {
2625
s.Set(float64(len(webhooks)))
2726
})
2827
}

watch_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"testing"
88

99
"github.com/stretchr/testify/require"
10-
"github.com/xmidt-org/webhook-schema"
1110
)
1211

1312
func TestWebhookListSizeWatch(t *testing.T) {
@@ -17,7 +16,7 @@ func TestWebhookListSizeWatch(t *testing.T) {
1716
require.NotNil(watch)
1817
// nolint:typecheck
1918
gauge.On("Set", float64(2))
20-
watch.Update([]webhook.Register{})
19+
watch.Update([]Register{})
2120
// nolint:typecheck
2221
gauge.AssertExpectations(t)
2322
}

0 commit comments

Comments
 (0)