public static async Task <string> PublishRulesToIpfs(this WonkaBizRulesEngine poEngine, string psIpfsFilePath, IpfsService poIpfsService, bool pbPinFlag = true, string psIpfsGateway = CONST_INFURA_IPFS_API_GATEWAY_URL) { string sIpfsHash = ""; string sRulesXml = ""; sRulesXml = poEngine.ToXml(); if (String.IsNullOrEmpty(psIpfsFilePath)) { psIpfsFilePath = "testruletree"; } if (String.IsNullOrEmpty(sRulesXml)) { throw new Exception("ERROR! No rules XMl serialized from the rules engine."); } var IpfsNode = await poIpfsService.AddTextAsync(psIpfsGateway, sRulesXml, psIpfsFilePath, pbPinFlag).ConfigureAwait(false); sIpfsHash = IpfsNode.Hash.ToString(); return(sIpfsHash); }
public static async Task <string> PublishReportToIpfs(this WonkaBizRuleTreeReport poReport, string psIpfsFilePath, IpfsService poIpfsService, bool pbPinFlag = true, string psIpfsGateway = CONST_INFURA_IPFS_API_GATEWAY_URL) { string sIpfsHash = ""; string sReport = ""; // NOTE: Not yet ready // sReport = poReport.SerializeToXml(); sReport = poReport.GetErrors(); if (String.IsNullOrEmpty(psIpfsFilePath)) { psIpfsFilePath = "testreport"; } if (String.IsNullOrEmpty(sReport)) { throw new Exception("ERROR! No report to be serialized."); } var IpfsNode = await poIpfsService.AddTextAsync(psIpfsGateway, sReport, psIpfsFilePath, pbPinFlag).ConfigureAwait(false); sIpfsHash = IpfsNode.Hash.ToString(); return(sIpfsHash); }