Add method for getting repo archive link

This commit is contained in:
Henrik Andersson
2015-03-21 21:54:01 +10:00
parent b3ba03fc34
commit 09d1932b4a
5 changed files with 94 additions and 0 deletions
+14
View File
@@ -386,6 +386,20 @@ namespace Octokit
return Connection.Delete(uri, data);
}
public async Task<string> GetRedirect(Uri uri)
{
Ensure.ArgumentNotNull(uri, "uri");
var response = await Connection.GetResponse<string>(uri);
if (response.HttpResponse.StatusCode == HttpStatusCode.Redirect)
{
return response.HttpResponse.Headers["Location"];
}
throw new ApiException("Redirect Operation expect status code or Redirect.",
response.HttpResponse.StatusCode);
}
/// <summary>
/// Executes a GET to the API object at the specified URI. This operation is appropriate for
/// API calls which queue long running calculations.