From d182927ffa9e1ce5502427ca36148ba5f9dbcb20 Mon Sep 17 00:00:00 2001 From: Haroon Date: Wed, 13 Nov 2013 12:20:30 +0000 Subject: [PATCH] remove collab from a repo --- Octokit/Clients/IRepoCollaboratorsClient.cs | 10 ++++++++++ Octokit/Clients/RepoCollaboratorsClient.cs | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/Octokit/Clients/IRepoCollaboratorsClient.cs b/Octokit/Clients/IRepoCollaboratorsClient.cs index 7f71df81..a609c447 100644 --- a/Octokit/Clients/IRepoCollaboratorsClient.cs +++ b/Octokit/Clients/IRepoCollaboratorsClient.cs @@ -43,5 +43,15 @@ namespace Octokit /// Thrown when a general API error occurs. /// Task Add(string owner, string repo, string user); + + /// + /// Deletes a collaborator from the repo + /// + /// + /// See the API documentation for more information. + /// + /// Thrown when a general API error occurs. + /// + Task Delete(string owner, string repo, string user); } } diff --git a/Octokit/Clients/RepoCollaboratorsClient.cs b/Octokit/Clients/RepoCollaboratorsClient.cs index cf016619..ddcd29f7 100644 --- a/Octokit/Clients/RepoCollaboratorsClient.cs +++ b/Octokit/Clients/RepoCollaboratorsClient.cs @@ -92,5 +92,24 @@ namespace Octokit return ApiConnection.Put(endpoint, null); } + + /// + /// Deletes a collaborator from the repo + /// + /// + /// See the API documentation for more information. + /// + /// Thrown when a general API error occurs. + /// + public Task Delete(string owner, string repo, string user) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(repo, "repo"); + Ensure.ArgumentNotNullOrEmptyString(user, "user"); + + var endpoint = "repos/{0}/{1}/collaborators/{2}".FormatUri(owner, repo, user); + + return ApiConnection.Delete(endpoint); + } } }