id method

Future<Map<String, dynamic>> id({
  1. String? peerId,
  2. String? format,
  3. String? peerIdBase,
})

Show IPFS node id info. /api/v0/id

Optional arguments:

  • peerId String: Peer ID of node to look up.
  • format String: Optional output format.
  • peerIdBase String: Encoding used for peer IDs: Can either be a multibase encoded CID or a base58btc encoded multihash. Takes {b58mh|base36|k|base32|b...}. Default: b58mh.

Response:

{
  "Addresses": ["<string>", "..."],
  "AgentVersion": "<string>",
  "ID": "<string>",
  "ProtocolVersion": "<string>",
  "Protocols": ["<string>", "..."],
  "PublicKey": "<string>",
  "StatusCode": "<statusCode>",
  "StatusMessage": "<statusMessage>"
}

See more: https://docs.ipfs.io/reference/http/api/#api-v0-id

Implementation

Future<Map<String, dynamic>> id(
    {String? peerId, String? format, String? peerIdBase}) async {
  Response? res = await _post(
    dio,
    url: "$url/id",
    queryParameters: {
      "arg": peerId,
      if (format != null) "format": format,
      if (peerIdBase != null) "peerid-base": peerIdBase,
    },
  );

  return _interceptDioResponse(res, expectsResponseBody: true);
}