All URIs are relative to http://localhost
Method | HTTP request | Description |
---|---|---|
addMetadataOnTransaction | POST /{ledger}/transactions/{txid}/metadata | Set Transaction Metadata |
countTransactions | HEAD /{ledger}/transactions | Count transactions |
createTransaction | POST /{ledger}/transactions | Create Transaction |
createTransactions | POST /{ledger}/transactions/batch | Create Transactions Batch |
getTransaction | GET /{ledger}/transactions/{txid} | Get Transaction |
listTransactions | GET /{ledger}/transactions | Get all Transactions |
revertTransaction | POST /{ledger}/transactions/{txid}/revert | Revert Transaction |
void addMetadataOnTransaction()
Set a new metadata to a ledger transaction by transaction id
import { TransactionsApi, createConfiguration } from '@numaryhq/ledger-nodejs';
import * as fs from 'fs';
const configuration = createConfiguration();
const apiInstance = new TransactionsApi(configuration);
apiInstance.addMetadataOnTransaction("ledger_example", 1, {
"key": null,
} ).then((data:any) => {
console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
requestBody | { [key: string]: any; } | metadata | |
ledger | [string] | ledger | defaults to undefined |
txid | [number] | txid | defaults to undefined |
void
- Content-Type: application/json
- Accept: Not defined
Status code | Description | Response headers |
---|---|---|
204 | Empty response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
void countTransactions()
Count transactions mathing given criteria
import { TransactionsApi, createConfiguration } from '@numaryhq/ledger-nodejs';
import * as fs from 'fs';
const configuration = createConfiguration();
const apiInstance = new TransactionsApi(configuration);
apiInstance.countTransactions("ledger_example", "after_example", "reference_example", "account_example", "source_example", "destination_example" ).then((data:any) => {
console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
ledger | [string] | ledger | defaults to undefined |
after | [string] | pagination cursor, will return transactions after given txid (in descending order) | (optional) defaults to undefined |
reference | [string] | find transactions by reference field | (optional) defaults to undefined |
account | [string] | find transactions with postings involving given account, either as source or destination | (optional) defaults to undefined |
source | [string] | find transactions with postings involving given account at source | (optional) defaults to undefined |
destination | [string] | find transactions with postings involving given account at destination | (optional) defaults to undefined |
void
- Content-Type: Not defined
- Accept: Not defined
Status code | Description | Response headers |
---|---|---|
200 | OK | * Count - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CreateTransactionResponse createTransaction(transactionData)
Create a new ledger transaction Commit a new transaction to the ledger
import { TransactionsApi, createConfiguration } from '@numaryhq/ledger-nodejs';
import * as fs from 'fs';
const configuration = createConfiguration();
const apiInstance = new TransactionsApi(configuration);
apiInstance.createTransaction("ledger_example", {
metadata: {},
postings: [
{
amount: 1,
asset: "asset_example",
destination: "destination_example",
source: "source_example",
},
],
reference: "reference_example",
}, true ).then((data:any) => {
console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
transactionData | TransactionData | transaction | |
ledger | [string] | ledger | defaults to undefined |
preview | [boolean] | Preview mode | (optional) defaults to undefined |
CreateTransactionResponse
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | - |
304 | Not modified (when preview is enabled) | - |
400 | Commit error | - |
409 | Confict | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
TransactionListResponse createTransactions(transactions)
Create a new ledger transactions batch Commit a batch of new transactions to the ledger
import { TransactionsApi, createConfiguration } from '@numaryhq/ledger-nodejs';
import * as fs from 'fs';
const configuration = createConfiguration();
const apiInstance = new TransactionsApi(configuration);
apiInstance.createTransactions("ledger_example", {
transactions: [
{
metadata: {},
postings: [
{
amount: 1,
asset: "asset_example",
destination: "destination_example",
source: "source_example",
},
],
reference: "reference_example",
},
],
} ).then((data:any) => {
console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
transactions | Transactions | transactions | |
ledger | [string] | ledger | defaults to undefined |
TransactionListResponse
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | - |
400 | Commit error | - |
409 | Confict | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
TransactionResponse getTransaction()
Get transaction by transaction id
import { TransactionsApi, createConfiguration } from '@numaryhq/ledger-nodejs';
import * as fs from 'fs';
const configuration = createConfiguration();
const apiInstance = new TransactionsApi(configuration);
apiInstance.getTransaction("ledger_example", 1 ).then((data:any) => {
console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
ledger | [string] | ledger | defaults to undefined |
txid | [number] | txid | defaults to undefined |
TransactionResponse
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | - |
404 | Not Found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
TransactionCursorResponse listTransactions()
Get all ledger transactions
import { TransactionsApi, createConfiguration } from '@numaryhq/ledger-nodejs';
import * as fs from 'fs';
const configuration = createConfiguration();
const apiInstance = new TransactionsApi(configuration);
apiInstance.listTransactions("ledger_example", "after_example", "reference_example", "account_example", "source_example", "destination_example" ).then((data:any) => {
console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
ledger | [string] | ledger | defaults to undefined |
after | [string] | pagination cursor, will return transactions after given txid (in descending order) | (optional) defaults to undefined |
reference | [string] | find transactions by reference field | (optional) defaults to undefined |
account | [string] | find transactions with postings involving given account, either as source or destination | (optional) defaults to undefined |
source | [string] | find transactions with postings involving given account at source | (optional) defaults to undefined |
destination | [string] | find transactions with postings involving given account at destination | (optional) defaults to undefined |
TransactionCursorResponse
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
TransactionResponse revertTransaction()
Revert a ledger transaction by transaction id
import { TransactionsApi, createConfiguration } from '@numaryhq/ledger-nodejs';
import * as fs from 'fs';
const configuration = createConfiguration();
const apiInstance = new TransactionsApi(configuration);
apiInstance.revertTransaction("ledger_example", 1 ).then((data:any) => {
console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
ledger | [string] | ledger | defaults to undefined |
txid | [number] | txid | defaults to undefined |
TransactionResponse
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]