//public async Task DetectNewProofRequest() //{ // var context = await _agentContextProvider.GetContextAsync(); // foreach (var proofRequest in ProofRequests) // { // if (proofRequest.IsNew) // { // var record = await _recordService.GetAsync<ProofRecord>(context.Wallet, proofRequest.Id); // record.SetTag("IsNew", "false"); // await _recordService.UpdateAsync(context.Wallet, record); // await SelectProofRequest(proofRequest); // break; // } // } //} public async Task RefreshProofs() { RefreshingProofRequests = true; IAgentContext context = await _agentContextProvider.GetContextAsync(); IList <ProofRecord> proofRecords = await _proofService.ListAsync(context); IList <ProofRequestViewModel> proofs = await _proofAssembler.AssembleMany(proofRecords); IEnumerable <ProofRequestViewModel> filteredProofVms = FilterProofRequests(SearchTerm, proofs); IEnumerable <Grouping <string, ProofRequestViewModel> > groupedVms = GroupProofRequests(filteredProofVms); ProofRequestsGrouped = groupedVms; ProofRequestsCount = String.Format("Nombre de preuve", proofRecords.Count); //AppResources.ProofRequestCount HasProofRequests = ProofRequests.Any(); ProofRequests.Clear(); ProofRequests.InsertRange(filteredProofVms); RefreshingProofRequests = false; }
public async Task <IActionResult> Index() { var agentContext = await _agentProvider.GetContextAsync(); return(View(new ProofsViewModel { Proofs = await _proofService.ListAsync(agentContext), })); }
public async Task <GetProofsResponse> Handle ( GetProofsRequest aGetProofsRequest, CancellationToken aCancellationToken ) { IAgentContext agentContext = await AgentProvider.GetContextAsync(); List <ProofRecord> proofRecords = await ProofService.ListAsync(agentContext); var response = new GetProofsResponse(proofRecords, aGetProofsRequest.CorrelationId); return(response); }
/// <summary>Retrieves a proof record by its thread id.</summary> /// <param name="proofService">Proof service.</param> /// <param name="context">The context.</param> /// <param name="threadId">The thread id.</param> /// <returns>The proof record.</returns> public static async Task <ProofRecord> GetByThreadIdAsync( this IProofService proofService, IAgentContext context, string threadId) { var search = await proofService.ListAsync(context, SearchQuery.Equal(TagConstants.LastThreadId, threadId), 1); if (search.Count == 0) { throw new AgentFrameworkException(ErrorCode.RecordNotFound, $"Proof record not found by thread id : {threadId}"); } if (search.Count > 1) { throw new AgentFrameworkException(ErrorCode.RecordInInvalidState, $"Multiple proof records found by thread id : {threadId}"); } return(search.Single()); }
/// <summary>Retrieves a list of accepted proof records.</summary> /// <param name="proofService">The proof service.</param> /// <param name="context">The context.</param> /// <param name="count">The count.</param> /// <returns></returns> public static Task <List <ProofRecord> > ListAcceptedAsync(this IProofService proofService, IAgentContext context, int count = 100) => proofService.ListAsync(context, SearchQuery.Equal(nameof(ProofRecord.State), ProofState.Accepted.ToString("G")), count);
/// <summary> /// Retrieves a list of accepted proof records. /// </summary> /// <param name="proofService">The proof service.</param> /// <param name="wallet">The wallet.</param> /// <param name="count">The count.</param> /// <returns></returns> public static Task <List <ProofRecord> > ListAcceptedAsync(this IProofService proofService, Wallet wallet, int count = 100) => proofService.ListAsync(wallet, new SearchRecordQuery { { TagConstants.State, ProofState.Accepted.ToString("G") } }, count);