Last active
March 10, 2016 16:52
-
-
Save JayBazuzi/120e900f8f7cb39e970d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IFooStatusReportsListener | |
{ | |
void Notify(string productName, BarStatus[] barStatuses); | |
} | |
class BarClient | |
{ | |
readonly HttpClient _httpClient = new HttpClient {BaseAddress = new Uri("https://bar.example.com/")}; | |
public async void UpdateShippingStatusReports(string product, IFooStatusReportsListener listener) | |
{ | |
var httpResponseMessage = await this._httpClient.GetAsync($"something/{product}").ConfigureAwait(false); | |
var result = await httpResponseMessage.EnsureSuccessStatusCode() | |
.Content.ReadAsAsync<BarStatus[]>().ConfigureAwait(false); | |
listener.Notify(product, result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment