Organization membership preview API changes - Review user permission (#1633)

* Add organization membership preview header

* Add API endpoints to preview a collaborators permission

* Add methods to preview a collaborators permission

* Add methods to the observable repo collaborator client

* Fix convention test failure

* Use correct API endpoint when using repository ID

* Move the helper function pair so they aren't in between another pair

* Use the correct URL for the review permission API endpoint

* Add unit tests

* Add integration tests for review permission methods

* Fix spelling mistake

* Renaming enum as per review
This commit is contained in:
Henrik Andersson
2017-07-29 15:08:44 +10:00
committed by Ryan Gribble
parent db74c3b4ad
commit cda714bef6
12 changed files with 597 additions and 2 deletions
@@ -128,6 +128,41 @@ namespace Octokit.Reactive
return _client.IsCollaborator(repositoryId, user).ToObservable();
}
/// <summary>
/// Review a user's permission level in a repository
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level">API documentation</a> for more information.
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="user">Username of the collaborator to check permission for</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
public IObservable<CollaboratorPermission> ReviewPermission(string owner, string name, string user)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNullOrEmptyString(user, "user");
return _client.ReviewPermission(owner, name, user).ToObservable();
}
/// <summary>
/// Review a user's permission level in a repository
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level">API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The id of the repository</param>
/// <param name="user">Username of the collaborator to check permission for</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
public IObservable<CollaboratorPermission> ReviewPermission(long repositoryId, string user)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
return _client.ReviewPermission(repositoryId, user).ToObservable();
}
/// <summary>
/// Adds a new collaborator to the repository.
/// </summary>