NodeApi¶
The NodeApi is responsible to make the requests regarding details about the node. You can check the detailed information about an IL2 node, list the peers and more. The following example shows how to get an instance of the NodeApi:
from pyil2 import IL2Client
client = IL2Client(
host='https://il2.node:32032/',
cert_filepath='rest.api.pfx',
cert_password='Str0ngPassword'
)
api = client.api('node')
print(api.details.name)
The list of methods are described as follows:
- class pyil2.api.NodeApi(client: IL2Client)¶
Bases:
BaseApi
API class for the node requests.
- Parameters:
client (
pyil2.IL2Client
) – IL2Client to be used to send requests.
- base_url¶
Base path of the requests.
- Type:
str
- add_mirrors(chains: List[str]) bool | ErrorDetailsModel ¶
Add chain mirrors to the node.
- Parameters:
chains ([
str
]) – List of chain IDs.- Returns:
Returns True if success.
- Return type:
[
bool
]
- property api_version: str | ErrorDetailsModel¶
REST API version.
- Type:
str
- property details: NodeDetailsModel | ErrorDetailsModel¶
Details about the node.
- list_apps() AppsModel | ErrorDetailsModel ¶
Get the list of valid apps in the network.
- Returns:
Valid apps in the network.
- Return type:
- list_interlockings_to_chain(chain_id: str, last_known_block: int = None, last_to_first: bool = False, page: int = 0, size: int = 10) ListModel[InterlockingRecordModel] | ErrorDetailsModel ¶
Get the list of interlocking records pointing to a target chain instance.
- Parameters:
chain_id (
str
) – Target chain id.last_known_block (
int
) – Last known block to query.last_to_first (
bool
) – If True, return the items in reverse order.page (
int
) – Page to query.size (
int
) – Number of elements in the page.
- Returns:
List of interlocking records.
- Return type:
pyil2.models.base.ListModel
[pyil2.models.record.InterlockingRecordModel
]
- list_mirrors() List[ChainIdModel] | ErrorDetailsModel ¶
List of mirror instances.
- Returns:
List of mirrors.
- Return type:
- list_peers() List[PeerNodeModel] | ErrorDetailsModel ¶
Get the list of known peer nodes.
- Returns:
List of peers.
- Return type: