Skip to content

Latest commit

 

History

History
277 lines (188 loc) · 11.4 KB

AccountsApi.md

File metadata and controls

277 lines (188 loc) · 11.4 KB

ledger.AccountsApi

All URIs are relative to http://localhost

Method HTTP request Description
addMetadataToAccount POST /{ledger}/accounts/{address}/metadata Add metadata to an account
countAccounts HEAD /{ledger}/accounts Count the accounts from a ledger
getAccount GET /{ledger}/accounts/{address} Get account by its address
listAccounts GET /{ledger}/accounts List accounts from a ledger

addMetadataToAccount

void addMetadataToAccount(requestBody)

Example

import { ledger } from '@numaryhq/ledger-nodejs';
import * as fs from 'fs';

const configuration = ledger.createConfiguration();
const apiInstance = new ledger.AccountsApi(configuration);

let body:ledger.AccountsApiAddMetadataToAccountRequest = {
  // string | Name of the ledger.
  ledger: "ledger001",
  // string | Exact address of the account. It must match the following regular expressions pattern: ``` ^\\w+(:\\w+)*$ ``` 
  address: "users:001",
  // { [key: string]: any; } | metadata
  requestBody: {
    "key": null,
  },
};

apiInstance.addMetadataToAccount(body).then((data:any) => {
  console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));

Parameters

Name Type Description Notes
requestBody { [key: string]: any; } metadata
ledger [string] Name of the ledger. defaults to undefined
address [string] Exact address of the account. It must match the following regular expressions pattern: ``` ^\w+(:\w+)*$ ``` defaults to undefined

Return type

void

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json; charset=utf-8
  • Accept: application/json; charset=utf-8

HTTP response details

Status code Description Response headers
204 No Content -
0 Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

countAccounts

void countAccounts()

Example

import { ledger } from '@numaryhq/ledger-nodejs';
import * as fs from 'fs';

const configuration = ledger.createConfiguration();
const apiInstance = new ledger.AccountsApi(configuration);

let body:ledger.AccountsApiCountAccountsRequest = {
  // string | Name of the ledger.
  ledger: "ledger001",
  // string | Filter accounts by address pattern (regular expression placed between ^ and $). (optional)
  address: "users:.+",
  // any | Filter accounts by metadata key value pairs. Nested objects can be used as seen in the example below. (optional)
  metadata: {},
};

apiInstance.countAccounts(body).then((data:any) => {
  console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));

Parameters

Name Type Description Notes
ledger [string] Name of the ledger. defaults to undefined
address [string] Filter accounts by address pattern (regular expression placed between ^ and $). (optional) defaults to undefined
metadata any Filter accounts by metadata key value pairs. Nested objects can be used as seen in the example below. (optional) defaults to undefined

Return type

void

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json; charset=utf-8

HTTP response details

Status code Description Response headers
200 OK * Count -
0 Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getAccount

AccountResponse getAccount()

Example

import { ledger } from '@numaryhq/ledger-nodejs';
import * as fs from 'fs';

const configuration = ledger.createConfiguration();
const apiInstance = new ledger.AccountsApi(configuration);

let body:ledger.AccountsApiGetAccountRequest = {
  // string | Name of the ledger.
  ledger: "ledger001",
  // string | Exact address of the account. It must match the following regular expressions pattern: ``` ^\\w+(:\\w+)*$ ``` 
  address: "users:001",
};

apiInstance.getAccount(body).then((data:any) => {
  console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));

Parameters

Name Type Description Notes
ledger [string] Name of the ledger. defaults to undefined
address [string] Exact address of the account. It must match the following regular expressions pattern: ``` ^\w+(:\w+)*$ ``` defaults to undefined

Return type

AccountResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json; charset=utf-8

HTTP response details

Status code Description Response headers
200 OK -
0 Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listAccounts

AccountsCursorResponse listAccounts()

List accounts from a ledger, sorted by address in descending order.

Example

import { ledger } from '@numaryhq/ledger-nodejs';
import * as fs from 'fs';

const configuration = ledger.createConfiguration();
const apiInstance = new ledger.AccountsApi(configuration);

let body:ledger.AccountsApiListAccountsRequest = {
  // string | Name of the ledger.
  ledger: "ledger001",
  // number | The maximum number of results to return per page.  (optional)
  pageSize: 100,
  // number | The maximum number of results to return per page. Deprecated, please use `pageSize` instead.  (optional)
  pageSize2: 100,
  // string | Pagination cursor, will return accounts after given address, in descending order. (optional)
  after: "users:003",
  // string | Filter accounts by address pattern (regular expression placed between ^ and $). (optional)
  address: "users:.+",
  // any | Filter accounts by metadata key value pairs. Nested objects can be used as seen in the example below. (optional)
  metadata: {},
  // number | Filter accounts by their balance (default operator is gte) (optional)
  balance: 2400,
  // 'gte' | 'lte' | 'gt' | 'lt' | 'e' | 'ne' | Operator used for the filtering of balances can be greater than/equal, less than/equal, greater than, less than, equal or not.  (optional)
  balanceOperator: "gte",
  // 'gte' | 'lte' | 'gt' | 'lt' | 'e' | 'ne' | Operator used for the filtering of balances can be greater than/equal, less than/equal, greater than, less than, equal or not. Deprecated, please use `balanceOperator` instead.  (optional)
  balanceOperator2: "gte",
  // string | Parameter used in pagination requests. Maximum page size is set to 15. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set.  (optional)
  cursor: "aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==",
  // string | Parameter used in pagination requests. Maximum page size is set to 15. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. Deprecated, please use `cursor` instead.  (optional)
  paginationToken: "aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==",
};

apiInstance.listAccounts(body).then((data:any) => {
  console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));

Parameters

Name Type Description Notes
ledger [string] Name of the ledger. defaults to undefined
pageSize [number] The maximum number of results to return per page. (optional) defaults to 15
pageSize2 [number] The maximum number of results to return per page. Deprecated, please use `pageSize` instead. (optional) defaults to 15
after [string] Pagination cursor, will return accounts after given address, in descending order. (optional) defaults to undefined
address [string] Filter accounts by address pattern (regular expression placed between ^ and $). (optional) defaults to undefined
metadata any Filter accounts by metadata key value pairs. Nested objects can be used as seen in the example below. (optional) defaults to undefined
balance [number] Filter accounts by their balance (default operator is gte) (optional) defaults to undefined
balanceOperator [**'gte' 'lte' 'gt'
balanceOperator2 [**'gte' 'lte' 'gt'
cursor [string] Parameter used in pagination requests. Maximum page size is set to 15. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. (optional) defaults to undefined
paginationToken [string] Parameter used in pagination requests. Maximum page size is set to 15. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. Deprecated, please use `cursor` instead. (optional) defaults to undefined

Return type

AccountsCursorResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json; charset=utf-8

HTTP response details

Status code Description Response headers
200 OK -
0 Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]