Skip to content

Commit

Permalink
better naming
Browse files Browse the repository at this point in the history
  • Loading branch information
vtopc committed Nov 9, 2024
1 parent b74d48f commit 6539096
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ func (mg *MailgunImpl) CreateWebhook(ctx context.Context, id string, urls []stri
}

// DeleteWebhook removes the specified webhook from your domain's configuration.
func (mg *MailgunImpl) DeleteWebhook(ctx context.Context, kind string) error {
r := newHTTPRequest(generateDomainApiUrl(mg, webhooksEndpoint) + "/" + kind)
func (mg *MailgunImpl) DeleteWebhook(ctx context.Context, name string) error {
r := newHTTPRequest(generateDomainApiUrl(mg, webhooksEndpoint) + "/" + name)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
_, err := makeDeleteRequest(ctx, r)
return err
}

// GetWebhook retrieves the currently assigned webhook URL associated with the provided type of webhook.
func (mg *MailgunImpl) GetWebhook(ctx context.Context, kind string) ([]string, error) {
r := newHTTPRequest(generateDomainApiUrl(mg, webhooksEndpoint) + "/" + kind)
func (mg *MailgunImpl) GetWebhook(ctx context.Context, name string) ([]string, error) {
r := newHTTPRequest(generateDomainApiUrl(mg, webhooksEndpoint) + "/" + name)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
var body WebHookResponse
Expand All @@ -91,12 +91,12 @@ func (mg *MailgunImpl) GetWebhook(ctx context.Context, kind string) ([]string, e
if len(body.Webhook.Urls) != 0 {
return body.Webhook.Urls, nil
}
return nil, fmt.Errorf("webhook '%s' returned no urls", kind)
return nil, fmt.Errorf("webhook '%s' returned no urls", name)
}

// UpdateWebhook replaces one webhook setting for another.
func (mg *MailgunImpl) UpdateWebhook(ctx context.Context, kind string, urls []string) error {
r := newHTTPRequest(generateDomainApiUrl(mg, webhooksEndpoint) + "/" + kind)
func (mg *MailgunImpl) UpdateWebhook(ctx context.Context, name string, urls []string) error {
r := newHTTPRequest(generateDomainApiUrl(mg, webhooksEndpoint) + "/" + name)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
p := newUrlEncodedPayload()
Expand Down

0 comments on commit 6539096

Please sign in to comment.