protected override async Task DoExtraExercisesAsync(RestAbstractNode <RestChain> node, bool write) { try { foreach (IRestChainV6_0 chain in await node.GetChainsAsync()) { if (write) { // Add something } var records = await chain.Records.RecordsFromAsync(0, pageSize : 0); var filteredRecords = records.Items.Where(r => r.ApplicationId == 8ul && r.PayloadTagId == 2100) .Select(r => r.Serial) .ToArray(); Console.WriteLine($"{Environment.NewLine}==== JSON from {chain.Id}: {filteredRecords.Length} records"); foreach (var serial in filteredRecords) { var json = await chain.JsonStore.RetrieveAsync(serial); Console.WriteLine($"{Environment.NewLine}Json at {chain.Id}@{serial}:"); if (json is null) { Console.WriteLine("-- Could not retrieve it!"); } else if (json.JsonText.IsValidJson()) { Console.WriteLine($"-- {json.JsonText.Ellipsis(300)}"); } else if (json.EncryptedJson is null) { Console.WriteLine("-- Invalid format!"); } else { Console.WriteLine($"-- {json.EncryptedJson}"); Console.WriteLine($"-- {json.EncryptedJson.DecodedWith(node.Certificate)}"); } } } } catch (Exception e) { Console.WriteLine(e); } }
protected UsingV6_0(RestAbstractNode <RestChain> node) : base(node) { }
protected AbstractUsing(RestAbstractNode <T> node) => _node = node.Required(nameof(node));