public LibraProtocalWrapper(string caller) { _callMode = new LibraProtocalModel() { Flag = caller, Parameters = null }; }
public static LibraResult <S> Post <S>(string url, LibraProtocalModel callModel) { var request = GetClientInternal(); try { StringContent content = new StringContent(JsonSerializer.Serialize(callModel)); content.Headers.ContentType.MediaType = "application/json"; var result = request.PostAsync(url + "api/Libra", content).Result; if (result.IsSuccessStatusCode) { if (result.StatusCode != System.Net.HttpStatusCode.NoContent) { var message = result.Content.ReadAsStringAsync().Result; if (message == "该类型不支持远程调用!") { throw new Exception($"{callModel.Flag} 暂不支持远程调用!"); } return(JsonSerializer.Deserialize <LibraResult <S> >(message)); } } return(default);
public string Run(LibraProtocalModel model) { return(LibraProtocalAnalysis.Call(model.Flag, model.Parameters)); }
public static LibraResult <S> Post <S>(LibraProtocalModel callModel) { return(Post <S>(_baseUrl, callModel)); }