nodes method

Future<NodesList> nodes({
  1. String? nodeId,
  2. bool includeNodeDetails = false,
  3. String? startId,
  4. int? numRecords,
})

Gets the nodes associated with the user

Can optionally include node details by setting includeNodeDetails true. Will throw an exception when there is a failure containing a description of the failure.

Implementation

Future<NodesList> nodes(
    {String? nodeId,
    bool includeNodeDetails = false,
    String? startId,
    int? numRecords}) async {
  final uri = _urlBase.getPath(_nodesBase, {
    'node_id': nodeId ?? '',
    'node_details': includeNodeDetails.toString(),
    'start_id': startId ?? '',
    'num_records': numRecords?.toString() ?? '',
  });

  final resp = await get(
    uri,
    headers: {
      URLBase.authHeader: accessToken,
    },
  );
  final Map<String, dynamic> bodyResp =
      await JsonIsolate().decodeJson(resp.body);
  if (resp.statusCode != 200) {
    throw bodyResp['description'];
  }

  return NodesList.fromJson(bodyResp);
}