Last active
August 29, 2015 14:10
-
-
Save igorkulman/405732bf92858dba1c3c 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
Task<T> Get<T>(string url); | |
Task<T> Put<T>(string url, object request); | |
Task<T> Post<T>(string url, object request); | |
Task<T> Patch<T>(string url, object request); | |
Task Delete(string url); |
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
public class MyDataService: BaseRestService | |
{ | |
protected override string GetBaseUrl() | |
{ | |
return "my base url"; | |
} | |
protected override Dictionary<string, string> GetRequestHeaders() | |
{ | |
return new Dictionary<string, string> | |
{ | |
{"Accept-Encoding", "gzip, deflate"}, | |
{"Accept", "application/json"}, | |
}; | |
} | |
} |
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
public Task<List<Account>> GetAccounts() | |
{ | |
return Get<List<Account>>("/accounts"); | |
} | |
public Task<Account> UpdateAccount(Account account) | |
{ | |
return Patch<Account>("/accounts",account); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment