Rename WebhookClient

This commit is contained in:
Chen-I Lim 2020-10-29 13:42:43 -07:00
parent 923ac19769
commit 526125cba7
4 changed files with 10 additions and 10 deletions

View file

@ -13,9 +13,9 @@ type App struct {
store store.Store
wsServer *ws.Server
filesBackend filesstore.FileBackend
webhook *webhook.WebhookClient
webhook *webhook.Client
}
func New(config *config.Configuration, store store.Store, wsServer *ws.Server, filesBackend filesstore.FileBackend, webhook *webhook.WebhookClient) *App {
func New(config *config.Configuration, store store.Store, wsServer *ws.Server, filesBackend filesstore.FileBackend, webhook *webhook.Client) *App {
return &App{config: config, store: store, wsServer: wsServer, filesBackend: filesBackend, webhook: webhook}
}

View file

@ -19,7 +19,7 @@ func TestGetParentID(t *testing.T) {
cfg := config.Configuration{}
store := mockstore.NewMockStore(ctrl)
wsserver := ws.NewServer()
webhook := webhook.New(&cfg)
webhook := webhook.NewClient(&cfg)
app := New(&cfg, store, wsserver, &mocks.FileBackend{}, webhook)
t.Run("success query", func(t *testing.T) {

View file

@ -60,7 +60,7 @@ func New(cfg *config.Configuration) (*Server, error) {
return nil, errors.New("unable to initialize the files storage")
}
webhookClient := webhook.New(cfg)
webhookClient := webhook.NewClient(cfg)
appBuilder := func() *app.App { return app.New(cfg, store, wsServer, filesBackend, webhookClient) }
api := api.NewAPI(appBuilder)

View file

@ -11,7 +11,7 @@ import (
)
// NotifyUpdate calls webhooks
func (wh *WebhookClient) NotifyUpdate(block model.Block) {
func (wh *Client) NotifyUpdate(block model.Block) {
if len(wh.config.WebhookUpdate) < 1 {
return
}
@ -26,14 +26,14 @@ func (wh *WebhookClient) NotifyUpdate(block model.Block) {
}
}
// WebhookClient is a webhook client
type WebhookClient struct {
// Client is a webhook client
type Client struct {
config *config.Configuration
}
// New creates a new WebhookClient
func New(config *config.Configuration) *WebhookClient {
return &WebhookClient{
// NewClient creates a new Client
func NewClient(config *config.Configuration) *Client {
return &Client{
config: config,
}
}