Skip to content

Commit

Permalink
feat: Replace empty event / payload interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgrayston-paddle committed Oct 16, 2024
1 parent fdb71c8 commit fff8e2d
Show file tree
Hide file tree
Showing 17 changed files with 14 additions and 44 deletions.
2 changes: 1 addition & 1 deletion collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (c *Collection[T]) UnmarshalJSON(b []byte) error {

for _, item := range res.Data {
switch any(c).(type) {
case *Collection[Event]:
case *Collection[any]:
e, err := unmarshalEvent(item)
if err != nil {
return err
Expand Down
12 changes: 4 additions & 8 deletions events.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions example_list_events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func Example_listEvents() {
res, err := client.ListEvents(ctx, &paddle.ListEventsRequest{})

// Iterate the events.
err = res.Iter(ctx, func(e paddle.Event) (bool, error) {
err = res.Iter(ctx, func(e any) (bool, error) {
switch v := e.(type) {
case *paddle.TransactionCompletedEvent:
// here v could be used as concrete type TransactionCompletedEvent
Expand Down Expand Up @@ -67,7 +67,7 @@ func Example_listEvents() {
//<nil>
}

func toGenericEvent(e paddle.Event) (ge *paddle.GenericEvent, err error) {
func toGenericEvent(e any) (ge *paddle.GenericEvent, err error) {
t, err := json.Marshal(e)
if err != nil {
return nil, err
Expand Down
2 changes: 0 additions & 2 deletions pkg/paddlenotification/addresses.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pkg/paddlenotification/adjustments.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pkg/paddlenotification/businesses.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pkg/paddlenotification/customers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pkg/paddlenotification/discounts.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions pkg/paddlenotification/notification.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pkg/paddlenotification/payouts.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pkg/paddlenotification/prices.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pkg/paddlenotification/products.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pkg/paddlenotification/reports.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions pkg/paddlenotification/subscriptions.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pkg/paddlenotification/transactions.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions shared.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions simulations.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fff8e2d

Please sign in to comment.