mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
28 lines
641 B
Go
28 lines
641 B
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/formancehq/payments/genericclient"
|
|
"github.com/formancehq/payments/internal/connectors/metrics"
|
|
)
|
|
|
|
func (c *client) ListTransactions(ctx context.Context, page, pageSize int64, updatedAtFrom time.Time) ([]genericclient.Transaction, error) {
|
|
req := c.apiClient.DefaultApi.GetTransactions(metrics.OperationContext(ctx, "list_transactions")).
|
|
Page(page).
|
|
PageSize(pageSize).
|
|
Sort("updatedAt:asc")
|
|
|
|
if !updatedAtFrom.IsZero() {
|
|
req = req.UpdatedAtFrom(updatedAtFrom)
|
|
}
|
|
|
|
transactions, _, err := req.Execute()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return transactions, nil
|
|
}
|