mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 19:11:30 +00:00
Retry until call is successful
This is crude I know, but will be revisited once all apis implemented
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Octokit
|
||||
@@ -19,13 +20,20 @@ namespace Octokit
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="repositoryName">The name of the repository</param>
|
||||
/// <returns>A list of <see cref="Contributor"/></returns>
|
||||
public Task<IEnumerable<Contributor>> GetContributors(string owner, string repositoryName)
|
||||
public async Task<IEnumerable<Contributor>> GetContributors(string owner, string repositoryName)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");
|
||||
|
||||
var endpoint = "/repos/{0}/{1}/stats/contributors".FormatUri(owner,repositoryName);
|
||||
return ApiConnection.Get<IEnumerable<Contributor>>(endpoint);
|
||||
var endpoint = "/repos/{0}/{1}/stats/contributors".FormatUri(owner, repositoryName);
|
||||
|
||||
var response = await Connection.GetAsync<IList<Contributor>>(endpoint, null, null);
|
||||
|
||||
if (response.StatusCode == HttpStatusCode.Accepted)
|
||||
{
|
||||
return await GetContributors(owner, repositoryName);
|
||||
}
|
||||
return response.BodyAsObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user