Skip to content

Commit

Permalink
fix: Use event type name consts for switch cases
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeymike committed Nov 6, 2024
1 parent 27bfacd commit 908a439
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions example_webhook_unmarshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func Example_webhookUnmarshal() {
var entityID string

switch webhook.EventType {
case "address.created":
case paddlenotification.EventTypeNameAddressCreated:
address := &paddlenotification.AddressCreated{}
if err := json.Unmarshal(rawBody, address); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
Expand All @@ -71,7 +71,7 @@ func Example_webhookUnmarshal() {

// You can safely proceed with address as a paddlenotification.AddressCreated type
entityID = address.Data.ID
case "price.created":
case paddlenotification.EventTypeNamePriceCreated:
price := &paddlenotification.PriceCreated{}
if err := json.Unmarshal(rawBody, price); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
Expand Down

0 comments on commit 908a439

Please sign in to comment.