listCollectionKeys static method

Future<CollectionFrameResponse> listCollectionKeys(
  1. P2PStream stream, {
  2. required PeerId ownerPeerId,
  3. required String path,
  4. int? limit,
  5. int? offset,
  6. String? cursor,
})

List keys in a collection

Implementation

static Future<CollectionFrameResponse> listCollectionKeys(
  P2PStream stream, {
  required PeerId ownerPeerId,
  required String path,
  int? limit,
  int? offset,
  String? cursor,
}) async {
  try {
    final requestBytes = CollectionFrame.encodeRequest(
      operation: 'LIST',
      ownerPeerId: ownerPeerId,
      path: path,
      limit: limit,
      offset: offset,
      cursor: cursor,
    );

    await _writeFrameStatic(stream, requestBytes);
    final responseBytes = await _readFrameStatic(stream);
    return CollectionFrame.decodeResponse(responseBytes);
  } catch (e, stackTrace) {
    _logger.severe('Error listing collection keys: $e', e, stackTrace);
    rethrow;
  }
}