コード例 #1
0
ファイル: Sync.cs プロジェクト: cesarbreitenbach/dotnet
    public void Marcar(int Codigo, string token)
    {
        var envReader = new EnvReader();

        var         client  = new RestClient(envReader.GetStringValue("API"));
        RestRequest request = new  RestRequest($@"/sync/{Codigo}", Method.PUT);

        request.AddHeader("auth", token);

        var resposta = client.Execute(request);

        if (resposta.StatusCode != System.Net.HttpStatusCode.Created && resposta.StatusCode != System.Net.HttpStatusCode.OK)
        {
            log.Error("Não confirmei a sincronização!!! ");
            log.Error(resposta.Content);
            throw new Exception(resposta.Content);
        }

        log.Information("Fiz a marcação de sucesso da sincronização.");
    }
コード例 #2
0
 public static void Error(string format, params object[] ps) => _log.Error(format, ps);
コード例 #3
0
        public async Task <object> GetTxConfirmations(string txHash)
        {
            try
            {
                var txConfirmation = await _phantasmaRpcService.GetTxByHash.SendRequestAsync(txHash);

                return(txConfirmation);
            }
            catch (RpcResponseException rpcEx)
            {
                Log.Error($"RPC Exception occurred: {rpcEx.RpcError.Message}");
                return(new ErrorRes {
                    error = rpcEx.RpcError.Message
                });
            }
            catch (Exception ex)
            {
                Log.Error($"Exception occurred: {ex.Message}");
                return(new ErrorRes {
                    error = ex.Message
                });
            }
        }