Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.2.0"
".": "0.2.1"
}
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 0.2.1 (2025-11-04)

Full Changelog: [v0.2.0...v0.2.1](https://github.com/Munchpass/checkbook/compare/v0.2.0...v0.2.1)

### Bug Fixes

* bugfix for setting JSON keys with special characters ([0a6b6da](https://github.com/Munchpass/checkbook/commit/0a6b6da4e7ebfbdf7ec4795cadfe1c9f0b5c04ae))
* use slices.Concat instead of sometimes modifying r.Options ([c73bccf](https://github.com/Munchpass/checkbook/commit/c73bccf25d2357526c49fbdccad07ee5da9c70b7))


### Chores

* bump minimum go version to 1.22 ([d744de6](https://github.com/Munchpass/checkbook/commit/d744de6d7d132a63d75851df6d332b15798c4882))
* do not install brew dependencies in ./scripts/bootstrap by default ([e90cb19](https://github.com/Munchpass/checkbook/commit/e90cb1978646d52cdccbc8c42fa8c9e7c7160b14))
* **internal:** codegen related update ([a782efa](https://github.com/Munchpass/checkbook/commit/a782efa4f933c90c846dbc289edf18db97327b31))
* **internal:** grammar fix (it's -> its) ([5bdac52](https://github.com/Munchpass/checkbook/commit/5bdac522c3e3a76a34808a5e94de1c09c6d3ccd1))
* update more docs for 1.22 ([b37ee7a](https://github.com/Munchpass/checkbook/commit/b37ee7a270ba115331498b2287ee056585e48ed3))

## 0.2.0 (2025-09-05)

Full Changelog: [v0.1.0...v0.2.0](https://github.com/Munchpass/checkbook/compare/v0.1.0...v0.2.0)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $ ./scripts/lint

This will install all the required dependencies and build the SDK.

You can also [install go 1.18+ manually](https://go.dev/doc/install).
You can also [install go 1.22+ manually](https://go.dev/doc/install).

## Modifying/Adding code

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/Munchpass/checkbook@v0.2.0'
go get -u 'github.com/Munchpass/checkbook@v0.2.1'
```

<!-- x-release-please-end -->

## Requirements

This library requires Go 1.18+.
This library requires Go 1.22+.

## Usage

Expand Down Expand Up @@ -126,7 +126,7 @@ custom := param.Override[checkbook.FooParams](12)

### Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of it's variants,
Unions are represented as a struct with fields prefixed by "Of" for each of its variants,
only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct.
Expand Down
15 changes: 8 additions & 7 deletions accountbank.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"net/http"
"slices"

"github.com/Munchpass/checkbook/internal/apijson"
"github.com/Munchpass/checkbook/internal/requestconfig"
Expand Down Expand Up @@ -38,15 +39,15 @@ func NewAccountBankService(opts ...option.RequestOption) (r AccountBankService)

// Add a new bank account
func (r *AccountBankService) New(ctx context.Context, body AccountBankNewParams, opts ...option.RequestOption) (res *AccountBankNewResponse, err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
path := "v3/account/bank"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}

// Update an existing bank account
func (r *AccountBankService) Update(ctx context.Context, bankID string, body AccountBankUpdateParams, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if bankID == "" {
err = errors.New("missing required bank_id parameter")
Expand All @@ -59,15 +60,15 @@ func (r *AccountBankService) Update(ctx context.Context, bankID string, body Acc

// Get the bank accounts for a user
func (r *AccountBankService) List(ctx context.Context, opts ...option.RequestOption) (res *AccountBankListResponse, err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
path := "v3/account/bank"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}

// Remove the specified bank account
func (r *AccountBankService) Delete(ctx context.Context, bankID string, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if bankID == "" {
err = errors.New("missing required bank_id parameter")
Expand All @@ -80,7 +81,7 @@ func (r *AccountBankService) Delete(ctx context.Context, bankID string, opts ...

// Release the micro-deposits for a bank account
func (r *AccountBankService) Release(ctx context.Context, body AccountBankReleaseParams, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
path := "v3/account/bank/release"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
Expand All @@ -89,15 +90,15 @@ func (r *AccountBankService) Release(ctx context.Context, body AccountBankReleas

// Return a list of our supported institutions for instant account verification
func (r *AccountBankService) GetInstitutions(ctx context.Context, opts ...option.RequestOption) (res *AccountBankGetInstitutionsResponse, err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
path := "v3/account/bank/institutions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}

// Verify the micro-deposits for a bank account
func (r *AccountBankService) Verify(ctx context.Context, body AccountBankVerifyParams, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
path := "v3/account/bank/verify"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
Expand Down
5 changes: 3 additions & 2 deletions accountbankiav.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package checkbook
import (
"context"
"net/http"
"slices"

"github.com/Munchpass/checkbook/internal/apijson"
"github.com/Munchpass/checkbook/internal/requestconfig"
Expand Down Expand Up @@ -34,15 +35,15 @@ func NewAccountBankIavService(opts ...option.RequestOption) (r AccountBankIavSer

// Add a new bank account with instant account verification
func (r *AccountBankIavService) New(ctx context.Context, body AccountBankIavNewParams, opts ...option.RequestOption) (res *AccountBankIavNewResponse, err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
path := "v3/account/bank/iav"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}

// Retrieve the bank account(s) associated with the Plaid token
func (r *AccountBankIavService) Plaid(ctx context.Context, body AccountBankIavPlaidParams, opts ...option.RequestOption) (res *AccountBankIavPlaidResponse, err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
path := "v3/account/bank/iav/plaid"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
Expand Down
9 changes: 5 additions & 4 deletions accountcard.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"net/http"
"slices"

"github.com/Munchpass/checkbook/internal/apijson"
"github.com/Munchpass/checkbook/internal/requestconfig"
Expand Down Expand Up @@ -36,15 +37,15 @@ func NewAccountCardService(opts ...option.RequestOption) (r AccountCardService)

// Add a new card
func (r *AccountCardService) New(ctx context.Context, body AccountCardNewParams, opts ...option.RequestOption) (res *AccountCardNewResponse, err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
path := "v3/account/card"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}

// Update the specified card
func (r *AccountCardService) Update(ctx context.Context, cardID string, body AccountCardUpdateParams, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if cardID == "" {
err = errors.New("missing required card_id parameter")
Expand All @@ -57,15 +58,15 @@ func (r *AccountCardService) Update(ctx context.Context, cardID string, body Acc

// Return the cards
func (r *AccountCardService) List(ctx context.Context, opts ...option.RequestOption) (res *AccountCardListResponse, err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
path := "v3/account/card"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}

// Remove the specified card
func (r *AccountCardService) Delete(ctx context.Context, cardID string, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if cardID == "" {
err = errors.New("missing required card_id parameter")
Expand Down
9 changes: 5 additions & 4 deletions accountinterac.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"net/http"
"slices"

"github.com/Munchpass/checkbook/internal/apijson"
"github.com/Munchpass/checkbook/internal/requestconfig"
Expand Down Expand Up @@ -36,15 +37,15 @@ func NewAccountInteracService(opts ...option.RequestOption) (r AccountInteracSer

// Add a new Interac account for a user
func (r *AccountInteracService) New(ctx context.Context, body AccountInteracNewParams, opts ...option.RequestOption) (res *InteracAccountResponse, err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
path := "v3/account/interac"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}

// Update an existing Interac account
func (r *AccountInteracService) Update(ctx context.Context, interacID string, body AccountInteracUpdateParams, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if interacID == "" {
err = errors.New("missing required interac_id parameter")
Expand All @@ -57,15 +58,15 @@ func (r *AccountInteracService) Update(ctx context.Context, interacID string, bo

// Return the Interac accounts of a user
func (r *AccountInteracService) List(ctx context.Context, opts ...option.RequestOption) (res *AccountInteracListResponse, err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
path := "v3/account/interac"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}

// Remove an existing Interac account
func (r *AccountInteracService) Delete(ctx context.Context, interacID string, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if interacID == "" {
err = errors.New("missing required interac_id parameter")
Expand Down
9 changes: 5 additions & 4 deletions accountpaypal.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"net/http"
"slices"

"github.com/Munchpass/checkbook/internal/apijson"
"github.com/Munchpass/checkbook/internal/requestconfig"
Expand Down Expand Up @@ -36,15 +37,15 @@ func NewAccountPaypalService(opts ...option.RequestOption) (r AccountPaypalServi

// Add a new Paypal account for a user
func (r *AccountPaypalService) New(ctx context.Context, body AccountPaypalNewParams, opts ...option.RequestOption) (res *PaypalAccountResponse, err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
path := "v3/account/paypal"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}

// Update an existing Paypal account
func (r *AccountPaypalService) Update(ctx context.Context, paypalID string, body AccountPaypalUpdateParams, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if paypalID == "" {
err = errors.New("missing required paypal_id parameter")
Expand All @@ -57,15 +58,15 @@ func (r *AccountPaypalService) Update(ctx context.Context, paypalID string, body

// Return the Paypal accounts of a user
func (r *AccountPaypalService) List(ctx context.Context, opts ...option.RequestOption) (res *AccountPaypalListResponse, err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
path := "v3/account/paypal"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}

// Remove an existing PayPal account
func (r *AccountPaypalService) Delete(ctx context.Context, paypalID string, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if paypalID == "" {
err = errors.New("missing required paypal_id parameter")
Expand Down
9 changes: 5 additions & 4 deletions accountvcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"net/http"
"slices"

"github.com/Munchpass/checkbook/internal/apijson"
"github.com/Munchpass/checkbook/internal/requestconfig"
Expand Down Expand Up @@ -39,15 +40,15 @@ func NewAccountVccService(opts ...option.RequestOption) (r AccountVccService) {

// Add a new vcc
func (r *AccountVccService) New(ctx context.Context, body AccountVccNewParams, opts ...option.RequestOption) (res *AccountVccNewResponse, err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
path := "v3/account/vcc"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}

// Update the specified vcc
func (r *AccountVccService) Update(ctx context.Context, vccID string, body AccountVccUpdateParams, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if vccID == "" {
err = errors.New("missing required vcc_id parameter")
Expand All @@ -60,15 +61,15 @@ func (r *AccountVccService) Update(ctx context.Context, vccID string, body Accou

// Return the virtual cards
func (r *AccountVccService) List(ctx context.Context, opts ...option.RequestOption) (res *AccountVccListResponse, err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
path := "v3/account/vcc"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}

// Remove the specified vcc
func (r *AccountVccService) Delete(ctx context.Context, vccID string, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if vccID == "" {
err = errors.New("missing required vcc_id parameter")
Expand Down
5 changes: 3 additions & 2 deletions accountvcctransaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"net/http"
"net/url"
"slices"
"time"

"github.com/Munchpass/checkbook/internal/apijson"
Expand Down Expand Up @@ -39,7 +40,7 @@ func NewAccountVccTransactionService(opts ...option.RequestOption) (r AccountVcc

// Get the requested transaction for the specified VCC
func (r *AccountVccTransactionService) Get(ctx context.Context, transactionID string, query AccountVccTransactionGetParams, opts ...option.RequestOption) (res *Transaction, err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
if query.VccID == "" {
err = errors.New("missing required vcc_id parameter")
return
Expand All @@ -55,7 +56,7 @@ func (r *AccountVccTransactionService) Get(ctx context.Context, transactionID st

// Get the transactions for the specified VCC
func (r *AccountVccTransactionService) List(ctx context.Context, vccID string, query AccountVccTransactionListParams, opts ...option.RequestOption) (res *AccountVccTransactionListResponse, err error) {
opts = append(r.Options[:], opts...)
opts = slices.Concat(r.Options, opts)
if vccID == "" {
err = errors.New("missing required vcc_id parameter")
return
Expand Down
Loading