Implement GetOrCreateApplicationAuthentication

Implements the endpoint for creating an application authorization token.
This commit is contained in:
Haacked
2013-10-09 16:28:59 -07:00
parent 9d71d406fa
commit 33ad79c0fe
19 changed files with 653 additions and 4 deletions
+21
View File
@@ -65,6 +65,27 @@ namespace Octokit
return response.BodyAsObject;
}
public async Task<T> GetOrCreate(Uri endpoint, object data)
{
Ensure.ArgumentNotNull(endpoint, "endpoint");
Ensure.ArgumentNotNull(data, "data");
var response = await Connection.PutAsync<T>(endpoint, data);
return response.BodyAsObject;
}
public async Task<T> GetOrCreate(Uri endpoint, object data, string twoFactorAuthenticationCode)
{
Ensure.ArgumentNotNull(endpoint, "endpoint");
Ensure.ArgumentNotNull(data, "data");
Ensure.ArgumentNotNullOrEmptyString(twoFactorAuthenticationCode, "twoFactorAuthenticationCode");
var response = await Connection.PutAsync<T>(endpoint, data, twoFactorAuthenticationCode);
return response.BodyAsObject;
}
public async Task<T> Update(Uri endpoint, object data)
{
Ensure.ArgumentNotNull(endpoint, "endpoint");