public async Task <int> PostContext(Catalog.OpenAPI.RevisedStockPrice param) { int code = int.MinValue; try { var response = await client.ExecuteAsync(new RestRequest(security.Request(param.GetType().Name), Method.POST).AddJsonBody(param, security.ContentType), source.Token); if (response != null && response.RawBytes != null && response.RawBytes.Length > 0) { Coin += security.GetSettleTheFare(response.RawBytes.Length); SendMessage(Coin); } code = (int)response.StatusCode; } catch (Exception ex) { SendMessage(ex.StackTrace); } return(code); }
public async Task <Queue <Catalog.Request.ConfirmRevisedStockPrice> > GetContext(Catalog.OpenAPI.RevisedStockPrice param) { try { var response = await client.ExecuteAsync(new RestRequest(security.RequestCode(param), Method.GET), source.Token); if (response != null && response.RawBytes != null && response.RawBytes.Length > 0) { Coin += security.GetSettleTheFare(response.RawBytes.Length); SendMessage(Coin); } if (response.StatusCode.Equals(HttpStatusCode.OK)) { return(JsonConvert.DeserializeObject <Queue <Catalog.Request.ConfirmRevisedStockPrice> >(response.Content)); } } catch (Exception ex) { SendMessage(ex.StackTrace); } return(null); }