Skip to content

Commit

Permalink
add --expunge option to event-type delete
Browse files Browse the repository at this point in the history
  • Loading branch information
svix-onelson committed Sep 25, 2023
1 parent c12580f commit b28ab08
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion cmd/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,19 @@ Example Schema:
utils.Confirm(fmt.Sprintf("Are you sure you want to delete the the event with id: %s", eventID))

svixClient := getSvixClientOrExit()
err := svixClient.EventType.Delete(cmd.Context(), eventID)
options := &svix.EventTypeDeleteOptions{}
expunge, _ := cmd.Flags().GetBool("include-archived")
if cmd.Flags().Changed("expunge") {
options.Expunge = &expunge
}
err := svixClient.EventType.DeleteWithOptions(cmd.Context(), eventID, options)
printer.CheckErr(err)

fmt.Printf("Event Type \"%s\" Deleted!\n", eventID)
},
}

delete.Flags().Bool("expunge", false, "permanently delete instead of archiving")
etc.cmd.AddCommand(delete)

return etc
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ require (
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cobra v1.3.0
github.com/spf13/viper v1.10.0
github.com/svix/svix-webhooks v1.7.0
github.com/svix/svix-webhooks v1.12.1-0.20230925234853-e39398a6349d
github.com/tidwall/pretty v1.1.1
)
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ github.com/svix/svix-webhooks v0.75.0 h1:GH8myVTh6EDlVIHbyEXqs6bA8a/zSBH3JmZKRdD
github.com/svix/svix-webhooks v0.75.0/go.mod h1:vWwH7D6zMhF9pCLfgLlogcXGDmnGqIJeIT9AXorZTAQ=
github.com/svix/svix-webhooks v1.7.0 h1:rfJ9yGc1h9odbdoNW8+dkO4ZdgajPYXvTdLqJsLBcIo=
github.com/svix/svix-webhooks v1.7.0/go.mod h1:q3Z9c8NXqDRPZviI+zLMToAja+bjhTw929cMVhJirOI=
github.com/svix/svix-webhooks v1.12.1-0.20230925233234-3ab7663b4d56 h1:PQ68xHJkoZ8Y0O283S+QRg9X6vbUyWKvuQHauLaaC3U=
github.com/svix/svix-webhooks v1.12.1-0.20230925233234-3ab7663b4d56/go.mod h1:q3Z9c8NXqDRPZviI+zLMToAja+bjhTw929cMVhJirOI=
github.com/svix/svix-webhooks v1.12.1-0.20230925234853-e39398a6349d h1:0EDWjQWi6yyBwekvXhMxbmM7M/llfGeYCeiUQvVfe8g=
github.com/svix/svix-webhooks v1.12.1-0.20230925234853-e39398a6349d/go.mod h1:q3Z9c8NXqDRPZviI+zLMToAja+bjhTw929cMVhJirOI=
github.com/tidwall/pretty v1.1.1 h1:nt6/Ot5LtZnJCWwEFlelOixPo0xhPFsuZlKyOL3Xfnc=
github.com/tidwall/pretty v1.1.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
Expand Down

0 comments on commit b28ab08

Please sign in to comment.