(Ledger.V2)
- AddMetadataOnTransaction - Set the metadata of a transaction by its ID
- AddMetadataToAccount - Add metadata to an account
- CountAccounts - Count the accounts from a ledger
- CountTransactions - Count the transactions from a ledger
- CreateBulk - Bulk request
- CreateLedger - Create a ledger
- CreateTransaction - Create a new transaction to a ledger
- DeleteAccountMetadata - Delete metadata by key
- DeleteLedgerMetadata - Delete ledger metadata by key
- DeleteTransactionMetadata - Delete metadata by key
- ExportLogs - Export logs
- GetAccount - Get account by its address
- GetBalancesAggregated - Get the aggregated balances from selected accounts
- GetInfo - Show server information
- GetLedger - Get a ledger
- GetLedgerInfo - Get information about a ledger
- GetTransaction - Get transaction from a ledger by its ID
- GetVolumesWithBalances - Get list of volumes with balances for (account/asset)
- ImportLogs
- ListAccounts - List accounts from a ledger
- ListLedgers - List ledgers
- ListLogs - List the logs from a ledger
- ListTransactions - List transactions from a ledger
- ReadStats - Get statistics from a ledger
- RevertTransaction - Revert a ledger transaction by its ID
- UpdateLedgerMetadata - Update ledger metadata
Set the metadata of a transaction by its ID
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"math/big"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.AddMetadataOnTransaction(ctx, operations.V2AddMetadataOnTransactionRequest{
RequestBody: map[string]string{
"admin": "true",
},
DryRun: formancesdkgo.Bool(true),
ID: big.NewInt(1234),
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2AddMetadataOnTransactionRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2AddMetadataOnTransactionResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Add metadata to an account
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.AddMetadataToAccount(ctx, operations.V2AddMetadataToAccountRequest{
RequestBody: map[string]string{
"admin": "true",
},
Address: "users:001",
DryRun: formancesdkgo.Bool(true),
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2AddMetadataToAccountRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2AddMetadataToAccountResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Count the accounts from a ledger
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.CountAccounts(ctx, operations.V2CountAccountsRequest{
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2CountAccountsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2CountAccountsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Count the transactions from a ledger
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.CountTransactions(ctx, operations.V2CountTransactionsRequest{
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2CountTransactionsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2CountTransactionsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Bulk request
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.CreateBulk(ctx, operations.V2CreateBulkRequest{
RequestBody: []shared.V2BulkElement{
shared.CreateV2BulkElementV2BulkElementAddMetadata(
shared.V2BulkElementAddMetadata{
Action: "<value>",
},
),
},
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res.V2BulkResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2CreateBulkRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2CreateBulkResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Create a ledger
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.CreateLedger(ctx, operations.V2CreateLedgerRequest{
V2CreateLedgerRequest: &shared.V2CreateLedgerRequest{
Metadata: map[string]string{
"admin": "true",
},
},
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2CreateLedgerRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2CreateLedgerResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Create a new transaction to a ledger
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"math/big"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.CreateTransaction(ctx, operations.V2CreateTransactionRequest{
V2PostTransaction: shared.V2PostTransaction{
Metadata: map[string]string{
"admin": "true",
},
Postings: []shared.V2Posting{
shared.V2Posting{
Amount: big.NewInt(100),
Asset: "COIN",
Destination: "users:002",
Source: "users:001",
},
},
Reference: formancesdkgo.String("ref:001"),
Script: &shared.V2PostTransactionScript{
Plain: "vars {\n" +
"account $user\n" +
"}\n" +
"send [COIN 10] (\n" +
" source = @world\n" +
" destination = $user\n" +
")\n" +
"",
Vars: map[string]any{
"user": "users:042",
},
},
},
DryRun: formancesdkgo.Bool(true),
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res.V2CreateTransactionResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2CreateTransactionRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2CreateTransactionResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Delete metadata by key
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.DeleteAccountMetadata(ctx, operations.V2DeleteAccountMetadataRequest{
Address: "96609 Cummings Canyon",
Key: "foo",
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2DeleteAccountMetadataRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2DeleteAccountMetadataResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Delete ledger metadata by key
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.DeleteLedgerMetadata(ctx, operations.V2DeleteLedgerMetadataRequest{
Key: "foo",
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2DeleteLedgerMetadataRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2DeleteLedgerMetadataResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Delete metadata by key
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"math/big"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.DeleteTransactionMetadata(ctx, operations.V2DeleteTransactionMetadataRequest{
ID: big.NewInt(1234),
Key: "foo",
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2DeleteTransactionMetadataRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2DeleteTransactionMetadataResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Export logs
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.ExportLogs(ctx, operations.V2ExportLogsRequest{
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2ExportLogsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2ExportLogsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4XX, 5XX | */* |
Get account by its address
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.GetAccount(ctx, operations.V2GetAccountRequest{
Address: "users:001",
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res.V2AccountResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2GetAccountRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2GetAccountResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Get the aggregated balances from selected accounts
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.GetBalancesAggregated(ctx, operations.V2GetBalancesAggregatedRequest{
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res.V2AggregateBalancesResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2GetBalancesAggregatedRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2GetBalancesAggregatedResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Show server information
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.GetInfo(ctx)
if err != nil {
log.Fatal(err)
}
if res.V2ConfigInfoResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2GetInfoResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Get a ledger
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.GetLedger(ctx, operations.V2GetLedgerRequest{
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res.V2GetLedgerResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2GetLedgerRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2GetLedgerResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Get information about a ledger
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.GetLedgerInfo(ctx, operations.V2GetLedgerInfoRequest{
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res.V2LedgerInfoResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2GetLedgerInfoRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2GetLedgerInfoResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Get transaction from a ledger by its ID
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"math/big"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.GetTransaction(ctx, operations.V2GetTransactionRequest{
ID: big.NewInt(1234),
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res.V2GetTransactionResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2GetTransactionRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2GetTransactionResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Get list of volumes with balances for (account/asset)
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.GetVolumesWithBalances(ctx, operations.V2GetVolumesWithBalancesRequest{
Cursor: formancesdkgo.String("aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ=="),
GroupBy: formancesdkgo.Int64(3),
Ledger: "ledger001",
PageSize: formancesdkgo.Int64(100),
})
if err != nil {
log.Fatal(err)
}
if res.V2VolumesWithBalanceCursorResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2GetVolumesWithBalancesRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2GetVolumesWithBalancesResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.ImportLogs(ctx, operations.V2ImportLogsRequest{
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2ImportLogsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2ImportLogsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
List accounts from a ledger, sorted by address in descending order.
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.ListAccounts(ctx, operations.V2ListAccountsRequest{
Cursor: formancesdkgo.String("aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ=="),
Ledger: "ledger001",
PageSize: formancesdkgo.Int64(100),
})
if err != nil {
log.Fatal(err)
}
if res.V2AccountsCursorResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2ListAccountsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2ListAccountsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
List ledgers
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.ListLedgers(ctx, operations.V2ListLedgersRequest{
Cursor: formancesdkgo.String("aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ=="),
PageSize: formancesdkgo.Int64(100),
})
if err != nil {
log.Fatal(err)
}
if res.V2LedgerListResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2ListLedgersRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2ListLedgersResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
List the logs from a ledger, sorted by ID in descending order.
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.ListLogs(ctx, operations.V2ListLogsRequest{
Cursor: formancesdkgo.String("aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ=="),
Ledger: "ledger001",
PageSize: formancesdkgo.Int64(100),
})
if err != nil {
log.Fatal(err)
}
if res.V2LogsCursorResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2ListLogsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2ListLogsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
List transactions from a ledger, sorted by id in descending order.
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.ListTransactions(ctx, operations.V2ListTransactionsRequest{
Cursor: formancesdkgo.String("aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ=="),
Ledger: "ledger001",
PageSize: formancesdkgo.Int64(100),
})
if err != nil {
log.Fatal(err)
}
if res.V2TransactionsCursorResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2ListTransactionsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2ListTransactionsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Get statistics from a ledger. (aggregate metrics on accounts and transactions)
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.ReadStats(ctx, operations.V2ReadStatsRequest{
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res.V2StatsResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2ReadStatsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2ReadStatsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Revert a ledger transaction by its ID
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"math/big"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.RevertTransaction(ctx, operations.V2RevertTransactionRequest{
ID: big.NewInt(1234),
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res.V2RevertTransactionResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2RevertTransactionRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2RevertTransactionResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Update ledger metadata
package main
import(
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"context"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Ledger.V2.UpdateLedgerMetadata(ctx, operations.V2UpdateLedgerMetadataRequest{
RequestBody: map[string]string{
"admin": "true",
},
Ledger: "ledger001",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.V2UpdateLedgerMetadataRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.V2UpdateLedgerMetadataResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.V2ErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |