diff --git a/Octokit.Reactive/Clients/IObservableTeamsClient.cs b/Octokit.Reactive/Clients/IObservableTeamsClient.cs
index bf670845..cf51c40e 100644
--- a/Octokit.Reactive/Clients/IObservableTeamsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableTeamsClient.cs
@@ -64,6 +64,30 @@ namespace Octokit.Reactive
///
IObservable Delete(int id);
+ ///
+ /// Adds a to a .
+ ///
+ ///
+ /// See the API documentation for more information.
+ ///
+ /// The team identifier.
+ /// The user to add to the team.
+ /// Thrown when a general API error occurs.
+ /// if the user was added to the team; otherwise.
+ IObservable AddMember(int id, string login);
+
+ ///
+ /// Removes a from a .
+ ///
+ ///
+ /// See the API documentation for more information.
+ ///
+ /// The team identifier.
+ /// The user to remove from the team.
+ /// Thrown when a general API error occurs.
+ /// if the user was removed from the team; otherwise.
+ IObservable RemoveMember(int id, string login);
+
///
/// Gets whether the user with the given
/// is a member of the team with the given .
@@ -72,5 +96,16 @@ namespace Octokit.Reactive
/// The user to check.
/// if the user is a member of the team; otherwise.
IObservable IsMember(int id, string login);
+
+ ///
+ /// Returns all (ies) associated with the given team.
+ ///
+ /// The team identifier
+ ///
+ /// See the API documentation for more information.
+ ///
+ /// Thrown when a general API error occurs.
+ /// A list of the team's (ies).
+ IObservable GetRepositories(int id);
}
}
diff --git a/Octokit.Reactive/Clients/ObservableTeamsClient.cs b/Octokit.Reactive/Clients/ObservableTeamsClient.cs
index 28bb3843..50beb15a 100644
--- a/Octokit.Reactive/Clients/ObservableTeamsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableTeamsClient.cs
@@ -96,6 +96,36 @@ namespace Octokit.Reactive
return _client.Delete(id).ToObservable();
}
+ ///
+ /// Adds a to a .
+ ///
+ ///
+ /// See the API documentation for more information.
+ ///
+ /// The team identifier.
+ /// The user to add to the team.
+ /// Thrown when a general API error occurs.
+ /// if the user was added to the team; otherwise.
+ public IObservable AddMember(int id, string login)
+ {
+ return _client.AddMember(id, login).ToObservable();
+ }
+
+ ///
+ /// Removes a from a .
+ ///
+ ///
+ /// See the API documentation for more information.
+ ///
+ /// The team identifier.
+ /// The user to remove from the team.
+ /// Thrown when a general API error occurs.
+ /// if the user was removed from the team; otherwise.
+ public IObservable RemoveMember(int id, string login)
+ {
+ return _client.RemoveMember(id, login).ToObservable();
+ }
+
///
/// Gets whether the user with the given
/// is a member of the team with the given .
@@ -108,5 +138,18 @@ namespace Octokit.Reactive
return _client.IsMember(id, login).ToObservable();
}
+ ///
+ /// Returns all (ies) associated with the given team.
+ ///
+ /// The team identifier
+ ///
+ /// See the API documentation for more information.
+ ///
+ /// Thrown when a general API error occurs.
+ /// A list of the team's (ies).
+ public IObservable GetRepositories(int id)
+ {
+ return _connection.GetAndFlattenAllPages(ApiUrls.TeamRepositories(id));
+ }
}
}
diff --git a/Octokit/Clients/ITeamsClient.cs b/Octokit/Clients/ITeamsClient.cs
index 9fc03371..7077c402 100644
--- a/Octokit/Clients/ITeamsClient.cs
+++ b/Octokit/Clients/ITeamsClient.cs
@@ -65,6 +65,30 @@ namespace Octokit
///
Task Delete(int id);
+ ///
+ /// Adds a to a .
+ ///
+ ///
+ /// See the API documentation for more information.
+ ///
+ /// The team identifier.
+ /// The user to add to the team.
+ /// Thrown when a general API error occurs.
+ /// if the user was added to the team; otherwise.
+ Task AddMember(int id, string login);
+
+ ///
+ /// Removes a from a .
+ ///
+ ///
+ /// See the API documentation for more information.
+ ///
+ /// The team identifier.
+ /// The user to remove from the team.
+ /// Thrown when a general API error occurs.
+ /// if the user was removed from the team; otherwise.
+ Task RemoveMember(int id, string login);
+
///
/// Gets whether the user with the given
/// is a member of the team with the given .
@@ -73,5 +97,16 @@ namespace Octokit
/// The user to check.
/// if the user is a member of the team; otherwise.
Task IsMember(int id, string login);
+
+ ///
+ /// Returns all (ies) associated with the given team.
+ ///
+ /// The team identifier
+ ///
+ /// See the API documentation for more information.
+ ///
+ /// Thrown when a general API error occurs.
+ /// A list of the team's (ies).
+ Task> GetRepositories(int id);
}
}
diff --git a/Octokit/Clients/TeamsClient.cs b/Octokit/Clients/TeamsClient.cs
index 1211becf..58946681 100644
--- a/Octokit/Clients/TeamsClient.cs
+++ b/Octokit/Clients/TeamsClient.cs
@@ -107,6 +107,62 @@ namespace Octokit
return ApiConnection.Delete(endpoint);
}
+ ///
+ /// Adds a to a .
+ ///
+ ///
+ /// See the API documentation for more information.
+ ///
+ /// The team identifier.
+ /// The user to add to the team.
+ /// Thrown when a general API error occurs.
+ /// if the user was added to the team; otherwise.
+ public async Task AddMember(int id, string login)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(login, "login");
+
+ var endpoint = ApiUrls.TeamMember(id, login);
+
+ try
+ {
+ var httpStatusCode = await ApiConnection.Connection.Put(endpoint);
+
+ return httpStatusCode == System.Net.HttpStatusCode.NoContent;
+ }
+ catch (NotFoundException)
+ {
+ return false;
+ }
+ }
+
+ ///
+ /// Removes a from a .
+ ///
+ ///
+ /// See the API documentation for more information.
+ ///
+ /// The team identifier.
+ /// The user to remove from the team.
+ /// Thrown when a general API error occurs.
+ /// if the user was removed from the team; otherwise.
+ public async Task RemoveMember(int id, string login)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(login, "login");
+
+ var endpoint = ApiUrls.TeamMember(id, login);
+
+ try
+ {
+ var httpStatusCode = await ApiConnection.Connection.Delete(endpoint);
+
+ return httpStatusCode == System.Net.HttpStatusCode.NoContent;
+ }
+ catch (NotFoundException)
+ {
+ return false;
+ }
+ }
+
///
/// Gets whether the user with the given
/// is a member of the team with the given .
@@ -130,5 +186,21 @@ namespace Octokit
return false;
}
}
+
+ ///
+ /// Returns all (ies) associated with the given team.
+ ///
+ /// The team identifier
+ ///
+ /// See the API documentation for more information.
+ ///
+ /// Thrown when a general API error occurs.
+ /// A list of the team's (ies).
+ public Task> GetRepositories(int id)
+ {
+ var endpoint = ApiUrls.TeamRepositories(id);
+
+ return ApiConnection.GetAll(endpoint);
+ }
}
}
diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs
index 7b1ba17a..40fab094 100644
--- a/Octokit/Helpers/ApiUrls.cs
+++ b/Octokit/Helpers/ApiUrls.cs
@@ -954,6 +954,15 @@ namespace Octokit
return "teams/{0}/members".FormatUri(id);
}
+ ///
+ /// returns the for listing team repositories
+ ///
+ /// The team id
+ public static Uri TeamRepositories(int id)
+ {
+ return "teams/{0}/repos".FormatUri(id);
+ }
+
///
/// returns the for teams
/// use for update or deleting a team