public Task <StrykerServiceResponse> Get(string endpoint) { var response = Client.GetAsync(endpoint).Result; if (response.IsSuccessStatusCode) { var content = response.Content.ReadAsStringAsync().Result; return(Task.FromResult(StrykerServiceResponse.Success(content))); } else { return(Task.FromResult(StrykerServiceResponse.Failure(response.Content))); } }
public async Task <StrykerServiceResponse> Post(string endpoint, object payload = null) { var content = payload != null ? JsonConvert.SerializeObject(payload) : null; var response = Client.PostAsync(endpoint, new StringContent(content)).Result; if (response.IsSuccessStatusCode) { var result = response.Content.ReadAsStringAsync().Result; return(StrykerServiceResponse.Success(result)); } else { return(StrykerServiceResponse.Failure(response.Content)); } }