From 1e5d95f4a0cd011c03204fd8076631f3f36c0fc6 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 7 Aug 2018 15:28:24 -0400 Subject: [PATCH] Adding observable client methods --- .../Clients/IObservableGitHubAppsClient.cs | 36 +++++++++++++ .../Clients/ObservableGitHubAppsClient.cs | 51 +++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/Octokit.Reactive/Clients/IObservableGitHubAppsClient.cs b/Octokit.Reactive/Clients/IObservableGitHubAppsClient.cs index 65f4ba4aa0..8c4d04eb3b 100644 --- a/Octokit.Reactive/Clients/IObservableGitHubAppsClient.cs +++ b/Octokit.Reactive/Clients/IObservableGitHubAppsClient.cs @@ -53,5 +53,41 @@ public interface IObservableGitHubAppsClient /// /// The Id of the GitHub App Installation IObservable CreateInstallationToken(long installationId); + + /// + /// List installations for user + /// + /// https://developer.github.com/v3/apps/#list-installations-for-user + IObservable GetAllInstallationsForUser(); + + /// + /// List installations for user + /// + /// https://developer.github.com/v3/apps/#list-installations-for-user + IObservable GetAllInstallationsForUser(ApiOptions options); + + /// + /// Enables an authenticated GitHub App to find the organizations's installation information. + /// + /// https://developer.github.com/v3/apps/#find-repository-installation + /// The owner of the repo + /// The name of the repo + IObservable GetRepositoryInstallation(string owner, string repo); + + /// + /// Enables an authenticated GitHub App to find the repository's installation information. + /// + /// https://developer.github.com/v3/apps/#find-organization-installation + /// The owner of the repo + /// The name of the repo + IObservable GetOrganizationInstallation(string organization); + + /// + /// Enables an authenticated GitHub App to find the users's installation information. + /// + /// https://developer.github.com/v3/apps/#find-user-installation + /// The owner of the repo + /// The name of the repo + IObservable GetUserInstallation(string user); } } diff --git a/Octokit.Reactive/Clients/ObservableGitHubAppsClient.cs b/Octokit.Reactive/Clients/ObservableGitHubAppsClient.cs index 6e52d53803..5322f58770 100644 --- a/Octokit.Reactive/Clients/ObservableGitHubAppsClient.cs +++ b/Octokit.Reactive/Clients/ObservableGitHubAppsClient.cs @@ -81,5 +81,56 @@ public IObservable CreateInstallationToken(long installationId) { return _client.CreateInstallationToken(installationId).ToObservable(); } + + /// + /// List installations for user + /// + /// https://developer.github.com/v3/apps/#list-installations-for-user + public IObservable GetAllInstallationsForUser() + { + return _connection.GetAndFlattenAllPages(ApiUrls.UserInstallations(), null, AcceptHeaders.GitHubAppsPreview); + } + + /// + /// List installations for user + /// + /// https://developer.github.com/v3/apps/#list-installations-for-user + public IObservable GetAllInstallationsForUser(ApiOptions options) + { + return _connection.GetAndFlattenAllPages(ApiUrls.UserInstallations(), null, AcceptHeaders.GitHubAppsPreview, options); + } + + /// + /// Enables an authenticated GitHub App to find the organizations's installation information. + /// + /// https://developer.github.com/v3/apps/#find-repository-installation + /// The owner of the repo + /// The name of the repo + public IObservable GetRepositoryInstallation(string owner, string repo) + { + return _client.GetRepositoryInstallation(owner, repo).ToObservable(); + } + + /// + /// Enables an authenticated GitHub App to find the repository's installation information. + /// + /// https://developer.github.com/v3/apps/#find-organization-installation + /// The owner of the repo + /// The name of the repo + public IObservable GetOrganizationInstallation(string organization) + { + return _client.GetOrganizationInstallation(organization).ToObservable(); + } + + /// + /// Enables an authenticated GitHub App to find the users's installation information. + /// + /// https://developer.github.com/v3/apps/#find-user-installation + /// The owner of the repo + /// The name of the repo + public IObservable GetUserInstallation(string user) + { + return _client.GetUserInstallation(user).ToObservable(); + } } }