From 731bd2b7fb00d5b4a897bcbd90e261b8a0b5a8b4 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 13 Aug 2018 15:56:07 -0400 Subject: [PATCH] Undoing unintentional changes and cleaning up --- .../Clients/IObservableGitHubAppsClient.cs | 23 +++++++++++-------- .../Clients/ObservableGitHubAppsClient.cs | 21 +++++++++++++---- .../{Clients => }/IObservableGitHubClient.cs | 0 .../{Clients => }/ObservableGitHubClient.cs | 0 Octokit/Clients/GitHubAppsClient.cs | 10 ++++++++ Octokit/Clients/IGitHubAppsClient.cs | 7 ++++++ Octokit/Helpers/ApiUrls.cs | 9 ++++++++ 7 files changed, 56 insertions(+), 14 deletions(-) rename Octokit.Reactive/{Clients => }/IObservableGitHubClient.cs (100%) rename Octokit.Reactive/{Clients => }/ObservableGitHubClient.cs (100%) diff --git a/Octokit.Reactive/Clients/IObservableGitHubAppsClient.cs b/Octokit.Reactive/Clients/IObservableGitHubAppsClient.cs index f48901a470..ec3a88b330 100644 --- a/Octokit.Reactive/Clients/IObservableGitHubAppsClient.cs +++ b/Octokit.Reactive/Clients/IObservableGitHubAppsClient.cs @@ -16,7 +16,7 @@ public interface IObservableGitHubAppsClient /// /// Refer to the API documentation for more information: https://developer.github.com/v3/apps/installations/ /// - IObservableGitHubAppsInstallationsClient Installations { get; } + IObservableGitHubAppsInstallationsClient Installation { get; } /// /// Get a single GitHub App. @@ -80,22 +80,27 @@ public interface IObservableGitHubAppsClient /// 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); + IObservable GetRepositoryInstallationForCurrent(string owner, string repo); /// - /// Enables an authenticated GitHub App to find the repository's installation information. + /// Enables an authenticated GitHub App to find the organizations's installation information. + /// + /// https://developer.github.com/v3/apps/#find-repository-installation + /// The Id of the repository + IObservable GetRepositoryInstallationForCurrent(long repositoryId); + + /// + /// Enables an authenticated GitHub App to find the organization'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); + /// The name of the organization + IObservable GetOrganizationInstallationForCurrent(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); + /// The name of the user + IObservable GetUserInstallationForCurrent(string user); } } diff --git a/Octokit.Reactive/Clients/ObservableGitHubAppsClient.cs b/Octokit.Reactive/Clients/ObservableGitHubAppsClient.cs index 934fa03033..ff3c450293 100644 --- a/Octokit.Reactive/Clients/ObservableGitHubAppsClient.cs +++ b/Octokit.Reactive/Clients/ObservableGitHubAppsClient.cs @@ -19,13 +19,13 @@ public ObservableGitHubAppsClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); - Installations = new ObservableGitHubAppsInstallationsClient(client); + Installation = new ObservableGitHubAppsInstallationsClient(client); _client = client.GitHubApps; _connection = client.Connection; } - public IObservableGitHubAppsInstallationsClient Installations { get; private set; } + public IObservableGitHubAppsInstallationsClient Installation { get; private set; } public IObservable Get(string slug) { @@ -110,18 +110,29 @@ public IObservable GetAllInstallationsForUser(ApiOptions /// 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) + public IObservable GetRepositoryInstallationForCurrent(string owner, string repo) { return _client.GetRepositoryInstallation(owner, repo).ToObservable(); } + + /// + /// Enables an authenticated GitHub App to find the organizations's installation information. + /// + /// https://developer.github.com/v3/apps/#find-repository-installation + /// The id of the repo + public IObservable GetRepositoryInstallationForCurrent(long repositoryId) + { + return _client.GetRepositoryInstallation(repositoryId).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) + public IObservable GetOrganizationInstallationForCurrent(string organization) { return _client.GetOrganizationInstallation(organization).ToObservable(); } @@ -132,7 +143,7 @@ public IObservable GetOrganizationInstallation(string organization /// https://developer.github.com/v3/apps/#find-user-installation /// The owner of the repo /// The name of the repo - public IObservable GetUserInstallation(string user) + public IObservable GetUserInstallationForCurrent(string user) { return _client.GetUserInstallation(user).ToObservable(); } diff --git a/Octokit.Reactive/Clients/IObservableGitHubClient.cs b/Octokit.Reactive/IObservableGitHubClient.cs similarity index 100% rename from Octokit.Reactive/Clients/IObservableGitHubClient.cs rename to Octokit.Reactive/IObservableGitHubClient.cs diff --git a/Octokit.Reactive/Clients/ObservableGitHubClient.cs b/Octokit.Reactive/ObservableGitHubClient.cs similarity index 100% rename from Octokit.Reactive/Clients/ObservableGitHubClient.cs rename to Octokit.Reactive/ObservableGitHubClient.cs diff --git a/Octokit/Clients/GitHubAppsClient.cs b/Octokit/Clients/GitHubAppsClient.cs index f6aa24e43a..0fbeaf9b81 100644 --- a/Octokit/Clients/GitHubAppsClient.cs +++ b/Octokit/Clients/GitHubAppsClient.cs @@ -79,6 +79,16 @@ public Task GetRepositoryInstallation(string owner, string repo) return ApiConnection.Get(ApiUrls.RepoInstallation(owner, repo), null, AcceptHeaders.GitHubAppsPreview); } + /// + /// Enables an authenticated GitHub App to find the organizations's installation information. + /// + /// https://developer.github.com/v3/apps/#find-repository-installation + /// The id of the repo + public Task GetRepositoryInstallation(long repositoryId) + { + return ApiConnection.Get(ApiUrls.RepoInstallation(repositoryId), null, AcceptHeaders.GitHubAppsPreview); + } + /// /// Enables an authenticated GitHub App to find the repository's installation information. /// diff --git a/Octokit/Clients/IGitHubAppsClient.cs b/Octokit/Clients/IGitHubAppsClient.cs index a8e85ce36d..af5160b6f9 100644 --- a/Octokit/Clients/IGitHubAppsClient.cs +++ b/Octokit/Clients/IGitHubAppsClient.cs @@ -84,6 +84,13 @@ public interface IGitHubAppsClient /// The name of the repo Task GetRepositoryInstallation(string owner, string repo); + /// + /// Enables an authenticated GitHub App to find the organizations's installation information. + /// + /// https://developer.github.com/v3/apps/#find-repository-installation + /// The id of the repo + Task GetRepositoryInstallation(long repositoryId); + /// /// Enables an authenticated GitHub App to find the repository's installation information. /// diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs index cad3bb2d33..86a6f24b9c 100644 --- a/Octokit/Helpers/ApiUrls.cs +++ b/Octokit/Helpers/ApiUrls.cs @@ -332,6 +332,15 @@ public static Uri RepoInstallation(string owner, string repo) return "repos/{0}/{1}/installation".FormatUri(owner, repo); } + /// + /// Returns the that returns the repository's installation information. + /// + /// + public static Uri RepoInstallation(long repositoryId) + { + return "repositories/{0}/installation".FormatUri(repositoryId); + } + /// /// Returns the that returns the repository's installation information. ///