From ac86133f18449182fe12c9ecbf66e4183cc50409 Mon Sep 17 00:00:00 2001 From: Ryan Gribble Date: Mon, 3 Sep 2018 20:05:36 +1000 Subject: [PATCH] Implement renaming and deprecation of GitHub App Installation Access Token route (#1860) * change existing CreateInstallationToken method to use new /app/installations route, and provide an obsolete CreateInstallationTokenPreview() method still using the old route, in order to support GHE 2.14 * suppress obsolete usage warning in tests * add unit test for new method * add new method to observable client * fix routes in tests * remove CreateInstallationTokenPreview() as it isnt actually required --- Octokit.Tests/Clients/GitHubAppsClientTests.cs | 2 +- Octokit/Helpers/ApiUrls.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Octokit.Tests/Clients/GitHubAppsClientTests.cs b/Octokit.Tests/Clients/GitHubAppsClientTests.cs index 201a32de3d..e96166d48f 100644 --- a/Octokit.Tests/Clients/GitHubAppsClientTests.cs +++ b/Octokit.Tests/Clients/GitHubAppsClientTests.cs @@ -98,7 +98,7 @@ public void PostsToCorrectUrl() client.CreateInstallationToken(fakeInstallationId); - connection.Received().Post(Arg.Is(u => u.ToString() == "installations/3141/access_tokens"), string.Empty, "application/vnd.github.machine-man-preview+json"); + connection.Received().Post(Arg.Is(u => u.ToString() == "app/installations/3141/access_tokens"), string.Empty, "application/vnd.github.machine-man-preview+json"); } } } diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs index c7c8d3179b..9fe5dd7c15 100644 --- a/Octokit/Helpers/ApiUrls.cs +++ b/Octokit/Helpers/ApiUrls.cs @@ -287,7 +287,7 @@ public static Uri NotificationSubscription(int id) /// The Id of the GitHub App installation. public static Uri AccessTokens(long installationId) { - return "installations/{0}/access_tokens".FormatUri(installationId); + return "app/installations/{0}/access_tokens".FormatUri(installationId); } ///