mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-07 12:26:18 +00:00
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:
committed by
Ryan Gribble
parent
db74c3b4ad
commit
cda714bef6
@@ -136,6 +136,43 @@ namespace Octokit
|
||||
}
|
||||
}
|
||||
|
||||
/// <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 Task<CollaboratorPermission> ReviewPermission(string owner, string name, string user)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNullOrEmptyString(user, "user");
|
||||
|
||||
return ApiConnection
|
||||
.Get<CollaboratorPermission>(ApiUrls.RepoCollaboratorPermission(owner, name, user), null, AcceptHeaders.OrganizationMembershipPreview);
|
||||
}
|
||||
|
||||
/// <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 Task<CollaboratorPermission> ReviewPermission(long repositoryId, string user)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(user, "user");
|
||||
|
||||
return ApiConnection
|
||||
.Get<CollaboratorPermission>(ApiUrls.RepoCollaboratorPermission(repositoryId, user), null, AcceptHeaders.OrganizationMembershipPreview);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new collaborator to the repository.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user