Skip to content

Commit

Permalink
feat: API alignment (#30)
Browse files Browse the repository at this point in the history
* feat: API alignment

- Adds Simulation API
- Notification Setting filter by traffic_source
- New errors

* fix: Subscription resume missing path param on union func

* feat: Support currency_code filtering on customer credit notes

* docs(release): 2.1.0

* chore(ci): Drop coverage checks

The SDK is generated and provides testable examples, there is little benefit to having a coverage criteria set.

* feat: Support re-use of notification payloads in Simulator API
fix: Fixes unmarshal for GetNotification

* docs: Add scenario simulation create example

* Update CHANGELOG.md

* docs: Update CHANGELOG date

---------

Co-authored-by: David Grayston <david.grayston@paddle.com>
Co-authored-by: Víctor Fernández Saborit <victorfs.sp@gmail.com>
  • Loading branch information
3 people authored Oct 17, 2024
1 parent 194c888 commit 540437e
Show file tree
Hide file tree
Showing 36 changed files with 1,465 additions and 172 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,4 @@ jobs:
run: go vet ./...

- name: Test
run: go test ./... -v -coverprofile=./cover.out -covermode atomic -coverpkg ./... -race

- name: Check coverage
uses: vladopajic/go-test-coverage@v2
with:
profile: cover.out
threshold-total: 30
run: go test ./... -v
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx&utm_medium=paddle-go-sdk) for information about changes to the Paddle Billing platform, the Paddle API, and other developer tools.

## 2.1.0 - 2024-10-17

### Added

- Support for the Simulation API - see related [changelog entry](https://developer.paddle.com/changelog/2024/webhook-simulator)
- Filtering of customer credit balances by `currency_code` in `AdjustmentsClient.ListCreditBalances`
- New API error mappings

### Fixed

- Subscription resume union funcs now accept the required path param
- `NewResumeSubscriptionRequestResumeOnASpecificDate`
- `NewResumeSubscriptionRequestResumeImmediately`
- Response unmarshal for GetNotifications to the Notification struct

## 2.0.0 - 2024-09-18

### Changed
Expand Down
4 changes: 4 additions & 0 deletions adjustments.go

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

10 changes: 7 additions & 3 deletions collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@ func (c *Collection[T]) Next(ctx context.Context) *Res[T] {
return &ptrCopy
}

// Ensure that Collection[T] implements the json.Unmarshaler and the
// Ensure that Collection[T] implements the response.Unmarshaler and the
// client.Wanter interfaces.
var (
_ json.Unmarshaler = &Collection[any]{}
_ client.Wanter = &Collection[any]{}
_ response.UnmarshalsResponses = &Collection[any]{}
_ json.Unmarshaler = &Collection[any]{}
_ client.Wanter = &Collection[any]{}
)

// Wants sets the client to be used for making requests.
Expand Down Expand Up @@ -157,6 +158,9 @@ func (c *Collection[T]) IterErr(ctx context.Context, fn func(v T) error) error {
}
}

// UnmarshalsResponses acts as a marker to identify this struct must Unmarshal the entire response.
func (c *Collection[T]) UnmarshalsResponses() {}

// UnmarshalJSON unmarshals the collection from a JSON response.
func (c *Collection[T]) UnmarshalJSON(b []byte) error {
if len(b) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion events.go

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

Loading

0 comments on commit 540437e

Please sign in to comment.