ls method

Future<Map<String, dynamic>> ls({
  1. String? path,
  2. String? type,
  3. bool? quiet,
  4. bool? stream,
})

List objects pinned to local storage. /api/v0/pin/ls

Optional arguments:

  • path String: Path to object(s) to be listed.
  • type String: The type of pinned keys to list. Can be "direct", "indirect", "recursive", or "all". Default: all.
  • quiet bool: Write just hashes of objects.
  • stream bool: Enable streaming of pins as they are discovered.

Response:

{
  "PinLsList": {
    "Keys": {
      "<string>": {
        "Type": "<string>"
      }
    }
  },
  "PinLsObject": {
    "Cid": "<string>",
    "Type": "<string>"
  },
  "StatusCode": "<statusCode>",
  "StatusMessage": "<statusMessage>"
}

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

Implementation

Future<Map<String, dynamic>> ls(
    {String? path, String? type, bool? quiet, bool? stream}) async {
  Response? res = await _post(
    Ipfs.dio,
    url: "${Ipfs.url}/pin/ls",
    queryParameters: {
      if (path != null) "arg": path,
      if (type != null) "type": type,
      if (quiet != null) "quiet": quiet,
      if (stream != null) "stream": stream,
    },
  );

  return _interceptDioResponse(res, expectsResponseBody: true);
}