diff --git a/Octokit.Reactive/Clients/IObservableTeamsClient.cs b/Octokit.Reactive/Clients/IObservableTeamsClient.cs index 101946a9..e6671028 100644 --- a/Octokit.Reactive/Clients/IObservableTeamsClient.cs +++ b/Octokit.Reactive/Clients/IObservableTeamsClient.cs @@ -31,6 +31,14 @@ namespace Octokit.Reactive /// A list of the orgs's teams s. IObservable GetAll(string org); + /// + /// Returns all s for the current user. + /// + /// Thrown when a general API error occurs. + /// A list of the user's s. + [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] + IObservable GetAllForCurrent(); + /// /// Returns all members of the given team. /// diff --git a/Octokit.Reactive/Clients/ObservableTeamsClient.cs b/Octokit.Reactive/Clients/ObservableTeamsClient.cs index a3e9af4f..c4d44985 100644 --- a/Octokit.Reactive/Clients/ObservableTeamsClient.cs +++ b/Octokit.Reactive/Clients/ObservableTeamsClient.cs @@ -51,6 +51,16 @@ namespace Octokit.Reactive return _connection.GetAndFlattenAllPages(ApiUrls.OrganizationTeams(org)); } + /// + /// Returns all s for the current user. + /// + /// Thrown when a general API error occurs. + /// A list of the user's s. + public IObservable GetAllForCurrent() + { + return _connection.GetAndFlattenAllPages(ApiUrls.UserTeams()); + } + /// /// Returns all members of the given team. /// diff --git a/Octokit/Clients/ITeamsClient.cs b/Octokit/Clients/ITeamsClient.cs index 7049c268..191648ed 100644 --- a/Octokit/Clients/ITeamsClient.cs +++ b/Octokit/Clients/ITeamsClient.cs @@ -34,6 +34,13 @@ namespace Octokit /// A list of the orgs's teams s. Task> GetAll(string org); + /// + /// Returns all s for the current user. + /// + /// Thrown when a general API error occurs. + /// A list of the user's s. + Task> GetAllForCurrent(); + /// /// Returns all members of the given team. /// diff --git a/Octokit/Clients/TeamsClient.cs b/Octokit/Clients/TeamsClient.cs index ad7d154f..ea8ee208 100644 --- a/Octokit/Clients/TeamsClient.cs +++ b/Octokit/Clients/TeamsClient.cs @@ -52,6 +52,17 @@ namespace Octokit return ApiConnection.GetAll(endpoint); } + /// + /// Returns all s for the current user. + /// + /// Thrown when a general API error occurs. + /// A list of the user's s. + public Task> GetAllForCurrent() + { + var endpoint = ApiUrls.UserTeams(); + return ApiConnection.GetAll(endpoint); + } + /// /// Returns all members of the given team. /// diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs index 47e0f4a0..3bc5ec9e 100644 --- a/Octokit/Helpers/ApiUrls.cs +++ b/Octokit/Helpers/ApiUrls.cs @@ -1148,6 +1148,16 @@ namespace Octokit return "orgs/{0}/teams".FormatUri(organization); } + /// + /// Returns the to discover teams + /// for the current user + /// + /// + public static Uri UserTeams() + { + return "user/teams".FormatUri(); + } + /// /// Returns the for teams /// use for getting, updating, or deleting a .