From 9d8e8ae8af41a42e27e933dc57f0014f32a2e0ed Mon Sep 17 00:00:00 2001 From: Ryan Gribble Date: Sat, 16 Jul 2016 22:44:56 +1000 Subject: [PATCH] Remove obsolete items - SshKey - SshKeysClient - SshKey - SshKeyInfo - SshKeyUpdate --- .../Clients/IObservableSshKeysClient.cs | 64 --------- .../Clients/ObservableSshKeysClient.cs | 101 -------------- Octokit.Reactive/IObservableGitHubClient.cs | 1 - Octokit.Reactive/ObservableGitHubClient.cs | 2 - Octokit.Reactive/Octokit.Reactive-Mono.csproj | 2 - .../Octokit.Reactive-MonoAndroid.csproj | 2 - .../Octokit.Reactive-Monotouch.csproj | 2 - Octokit.Reactive/Octokit.Reactive.csproj | 2 - Octokit.Tests/Clients/SshKeysClientTests.cs | 129 ------------------ Octokit.Tests/Models/ModelExtensionsTests.cs | 66 --------- Octokit.Tests/OctoKit.Tests-NetCore45.csproj | 2 - Octokit.Tests/Octokit.Tests-Portable.csproj | 2 - Octokit.Tests/Octokit.Tests.csproj | 2 - Octokit/Clients/ISshKeysClient.cs | 71 ---------- Octokit/Clients/SshKeysClient.cs | 101 -------------- Octokit/GitHubClient.cs | 12 -- Octokit/Helpers/ModelExtensions.cs | 57 -------- Octokit/IGitHubClient.cs | 10 -- Octokit/Models/Request/SshKeyUpdate.cs | 30 ---- Octokit/Models/Response/SshKey.cs | 59 -------- Octokit/Models/Response/SshKeyInfo.cs | 23 ---- Octokit/Octokit-Mono.csproj | 6 - Octokit/Octokit-MonoAndroid.csproj | 6 - Octokit/Octokit-Monotouch.csproj | 6 - Octokit/Octokit-Portable.csproj | 6 - Octokit/Octokit-netcore45.csproj | 6 - Octokit/Octokit.csproj | 6 - 27 files changed, 776 deletions(-) delete mode 100644 Octokit.Reactive/Clients/IObservableSshKeysClient.cs delete mode 100644 Octokit.Reactive/Clients/ObservableSshKeysClient.cs delete mode 100644 Octokit.Tests/Clients/SshKeysClientTests.cs delete mode 100644 Octokit.Tests/Models/ModelExtensionsTests.cs delete mode 100644 Octokit/Clients/ISshKeysClient.cs delete mode 100644 Octokit/Clients/SshKeysClient.cs delete mode 100644 Octokit/Helpers/ModelExtensions.cs delete mode 100644 Octokit/Models/Request/SshKeyUpdate.cs delete mode 100644 Octokit/Models/Response/SshKey.cs delete mode 100644 Octokit/Models/Response/SshKeyInfo.cs diff --git a/Octokit.Reactive/Clients/IObservableSshKeysClient.cs b/Octokit.Reactive/Clients/IObservableSshKeysClient.cs deleted file mode 100644 index b4f93c0ca9..0000000000 --- a/Octokit.Reactive/Clients/IObservableSshKeysClient.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Reactive; - -namespace Octokit.Reactive -{ - public interface IObservableSshKeysClient - { - /// - /// Retrieves the for the specified id. - /// - /// The ID of the SSH key - /// A - [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")] - [Obsolete("This method is obsolete. Please use User.Keys.Get(int) instead.")] - IObservable Get(int id); - - /// - /// Retrieves the for the specified id. - /// - /// The login of the user - /// A of . - [Obsolete("This method is obsolete. Please use User.Keys.GetAll(string) instead.")] - IObservable GetAll(string user); - - /// - /// Retrieves the for the specified id. - /// - /// Thrown if the client is not authenticated. - /// A of . - [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", - Justification = "Makes a network request")] - [Obsolete("This method is obsolete. Please use User.Keys.GetAll() instead.")] - IObservable GetAllForCurrent(); - - /// - /// Update the specified . - /// - /// The SSH Key contents - /// Thrown if the client is not authenticated. - /// A - [Obsolete("This method is obsolete. Please use User.Keys.Create(NewPublicKey) instead.")] - IObservable Create(SshKeyUpdate key); - - /// - /// Update the specified . - /// - /// The ID of the SSH key - /// The SSH Key contents - /// Thrown if the client is not authenticated. - /// A - [Obsolete("This method is no longer supported in the GitHub API. Delete and Create the key again instead.")] - IObservable Update(int id, SshKeyUpdate key); - - /// - /// Update the specified . - /// - /// The id of the SSH key - /// Thrown if the client is not authenticated. - /// A - [Obsolete("This method is obsolete. Please use User.Keys.Delete(int) instead.")] - IObservable Delete(int id); - } -} diff --git a/Octokit.Reactive/Clients/ObservableSshKeysClient.cs b/Octokit.Reactive/Clients/ObservableSshKeysClient.cs deleted file mode 100644 index bf096096d9..0000000000 --- a/Octokit.Reactive/Clients/ObservableSshKeysClient.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using System.Reactive; -using System.Reactive.Threading.Tasks; -using Octokit.Reactive.Internal; - -namespace Octokit.Reactive -{ - public class ObservableSshKeysClient : IObservableSshKeysClient - { - readonly ISshKeysClient _client; - readonly IConnection _connection; - - /// - /// Initializes a new SSH Key API client. - /// - /// An used to make the requests - public ObservableSshKeysClient(IGitHubClient client) - { - Ensure.ArgumentNotNull(client, "client"); - - _client = client.SshKey; - _connection = client.Connection; - } - - /// - /// Retrieves the for the specified id. - /// - /// The ID of the SSH key - /// A - [Obsolete("This method is obsolete. Please use User.Keys.Get(int) instead.")] - public IObservable Get(int id) - { - return _client.Get(id).ToObservable(); - } - - /// - /// Retrieves the for the specified id. - /// - /// The login of the user - /// A of . - [Obsolete("This method is obsolete. Please use User.Keys.GetAll(string) instead.")] - public IObservable GetAll(string user) - { - Ensure.ArgumentNotNullOrEmptyString(user, "user"); - - return _connection.GetAndFlattenAllPages(ApiUrls.SshKeys(user)); - } - - /// - /// Retrieves the for the specified id. - /// - /// Thrown if the client is not authenticated. - /// A of . - [Obsolete("This method is obsolete. Please use User.Keys.GetAll() instead.")] - public IObservable GetAllForCurrent() - { - return _connection.GetAndFlattenAllPages(ApiUrls.SshKeys()); - } - - /// - /// Update the specified . - /// - /// The SSH Key contents - /// Thrown if the client is not authenticated. - /// A - [Obsolete("This method is obsolete. Please use User.Keys.Create(NewPublicKey) instead.")] - public IObservable Create(SshKeyUpdate key) - { - Ensure.ArgumentNotNull(key, "key"); - - return _client.Create(key).ToObservable(); - } - - /// - /// Update the specified . - /// - /// The ID of the SSH key - /// The SSH Key contents - /// Thrown if the client is not authenticated. - /// A - [Obsolete("This method is no longer supported in the GitHub API. Delete and Create the key again instead.")] - public IObservable Update(int id, SshKeyUpdate key) - { - Ensure.ArgumentNotNull(key, "key"); - - return _client.Update(id, key).ToObservable(); - } - - /// - /// Update the specified . - /// - /// The id of the SSH key - /// Thrown if the client is not authenticated. - /// A - [Obsolete("This method is obsolete. Please use User.Keys.Delete(int) instead.")] - public IObservable Delete(int id) - { - return _client.Delete(id).ToObservable(); - } - } -} diff --git a/Octokit.Reactive/IObservableGitHubClient.cs b/Octokit.Reactive/IObservableGitHubClient.cs index 33f4a847b4..e971972efb 100644 --- a/Octokit.Reactive/IObservableGitHubClient.cs +++ b/Octokit.Reactive/IObservableGitHubClient.cs @@ -15,7 +15,6 @@ public interface IObservableGitHubClient : IApiInfoProvider IObservablePullRequestsClient PullRequest { get; } IObservableRepositoriesClient Repository { get; } IObservableGistsClient Gist { get; } - IObservableSshKeysClient SshKey { get; } IObservableUsersClient User { get; } IObservableGitDatabaseClient Git { get; } IObservableSearchClient Search { get; } diff --git a/Octokit.Reactive/ObservableGitHubClient.cs b/Octokit.Reactive/ObservableGitHubClient.cs index 5e33e95a01..e7d42acbd1 100644 --- a/Octokit.Reactive/ObservableGitHubClient.cs +++ b/Octokit.Reactive/ObservableGitHubClient.cs @@ -39,7 +39,6 @@ public ObservableGitHubClient(IGitHubClient gitHubClient) Organization = new ObservableOrganizationsClient(gitHubClient); PullRequest = new ObservablePullRequestsClient(gitHubClient); Repository = new ObservableRepositoriesClient(gitHubClient); - SshKey = new ObservableSshKeysClient(gitHubClient); User = new ObservableUsersClient(gitHubClient); Git = new ObservableGitDatabaseClient(gitHubClient); Gist = new ObservableGistsClient(gitHubClient); @@ -63,7 +62,6 @@ public IConnection Connection public IObservablePullRequestsClient PullRequest { get; private set; } public IObservableRepositoriesClient Repository { get; private set; } public IObservableGistsClient Gist { get; private set; } - public IObservableSshKeysClient SshKey { get; private set; } public IObservableUsersClient User { get; private set; } public IObservableGitDatabaseClient Git { get; private set; } public IObservableSearchClient Search { get; private set; } diff --git a/Octokit.Reactive/Octokit.Reactive-Mono.csproj b/Octokit.Reactive/Octokit.Reactive-Mono.csproj index 8d12e95177..c6c1d6c718 100644 --- a/Octokit.Reactive/Octokit.Reactive-Mono.csproj +++ b/Octokit.Reactive/Octokit.Reactive-Mono.csproj @@ -68,7 +68,6 @@ - @@ -81,7 +80,6 @@ - diff --git a/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj b/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj index 67daf9d4bb..be8cc86b6d 100644 --- a/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj +++ b/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj @@ -76,7 +76,6 @@ - @@ -89,7 +88,6 @@ - diff --git a/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj b/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj index 52fc933fe4..99353b995c 100644 --- a/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj +++ b/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj @@ -72,7 +72,6 @@ - @@ -85,7 +84,6 @@ - diff --git a/Octokit.Reactive/Octokit.Reactive.csproj b/Octokit.Reactive/Octokit.Reactive.csproj index fc0a2dfa7a..f3ab686b0c 100644 --- a/Octokit.Reactive/Octokit.Reactive.csproj +++ b/Octokit.Reactive/Octokit.Reactive.csproj @@ -182,7 +182,6 @@ - @@ -207,7 +206,6 @@ - diff --git a/Octokit.Tests/Clients/SshKeysClientTests.cs b/Octokit.Tests/Clients/SshKeysClientTests.cs deleted file mode 100644 index 0d48820d8e..0000000000 --- a/Octokit.Tests/Clients/SshKeysClientTests.cs +++ /dev/null @@ -1,129 +0,0 @@ -using System; -using System.Threading.Tasks; -using NSubstitute; -using Xunit; - -namespace Octokit.Tests.Clients -{ - /// - /// Client tests mostly just need to make sure they call the IApiConnection with the correct - /// relative Uri. No need to fake up the response. All *those* tests are in ApiConnectionTests.cs. - /// - public class SshKeysClientTests - { - public class TheCtor - { - [Fact] - public void EnsuresNonNullArguments() - { - Assert.Throws(() => new SshKeysClient(null)); - } - } - - public class TheGetMethod - { - [Fact] - public void RequestsCorrectUrl() - { - var endpoint = new Uri("user/keys/42", UriKind.Relative); - var client = Substitute.For(); - var sshKeysClient = new SshKeysClient(client); - - sshKeysClient.Get(42); - - client.Received().Get(endpoint); - } - } - - public class TheGetAllMethod - { - [Fact] - public void RequestsCorrectUrl() - { - var endpoint = new Uri("users/username/keys", UriKind.Relative); - var client = Substitute.For(); - var sshKeysClient = new SshKeysClient(client); - - sshKeysClient.GetAll("username"); - - client.Received().GetAll(endpoint); - } - } - - public class TheGetAllForCurrentMethod - { - [Fact] - public void RequestsCorrectUrl() - { - var endpoint = new Uri("user/keys", UriKind.Relative); - var client = Substitute.For(); - var sshKeysClient = new SshKeysClient(client); - - sshKeysClient.GetAllForCurrent(); - - client.Received().GetAll(endpoint); - } - } - - public class TheUpdateMethod - { - [Fact] - public void SendsUpdateToCorrectUrl() - { - var endpoint = new Uri("user/keys/42", UriKind.Relative); - var data = new SshKeyUpdate(); - var client = Substitute.For(); - var sshKeysClient = new SshKeysClient(client); - - sshKeysClient.Update(42, data); - - client.Received().Patch(endpoint, data); - } - - [Fact] - public async Task EnsuresArgumentsNotNull() - { - var userEndpoint = new SshKeysClient(Substitute.For()); - await Assert.ThrowsAsync(() => userEndpoint.Update(1, null)); - } - } - - public class TheCreateMethod - { - [Fact] - public void SendsCreateToCorrectUrl() - { - var endpoint = new Uri("user/keys", UriKind.Relative); - var data = new SshKeyUpdate(); - var client = Substitute.For(); - var sshKeysClient = new SshKeysClient(client); - - sshKeysClient.Create(data); - - client.Received().Post(endpoint, data); - } - - [Fact] - public async Task EnsuresArgumentsNotNull() - { - var userEndpoint = new SshKeysClient(Substitute.For()); - await Assert.ThrowsAsync(() => userEndpoint.Create(null)); - } - } - - public class TheDeleteMethod - { - [Fact] - public void SendsCreateToCorrectUrl() - { - var endpoint = new Uri("user/keys/42", UriKind.Relative); - var client = Substitute.For(); - var sshKeysClient = new SshKeysClient(client); - - sshKeysClient.Delete(42); - - client.Received().Delete(endpoint); - } - } - } -} diff --git a/Octokit.Tests/Models/ModelExtensionsTests.cs b/Octokit.Tests/Models/ModelExtensionsTests.cs deleted file mode 100644 index 3c78a02497..0000000000 --- a/Octokit.Tests/Models/ModelExtensionsTests.cs +++ /dev/null @@ -1,66 +0,0 @@ -using Xunit; -using Xunit.Extensions; - -namespace Octokit.Tests.Models -{ - public class ModelExtensionsTests - { - public class TheGetKeyDataAndNameMethod - { - [Theory] - [InlineData("ssh-rsa AAAAB3NzaC1yc2EAAAABIwAA timothy.clem@gmail.com", "AAAAB3NzaC1yc2EAAAABIwAA", "timothy.clem@gmail.com")] - [InlineData("ssh-rsa AAAAB3NzaC1yc2EAAAABIwAA", "AAAAB3NzaC1yc2EAAAABIwAA", "")] - [InlineData("ssh-dss AAAAB3NzaC1yc2EAAAABIwAA", "AAAAB3NzaC1yc2EAAAABIwAA", "")] - [InlineData("ssh-dsa AAAAB3NzaC1yc2EAAAABIwAA", "AAAAB3NzaC1yc2EAAAABIwAA", "")] - public void CanParseKeyData(string raw, string data, string name) - { - var key = new SshKey(raw); - - SshKeyInfo keyInfo = key.GetKeyDataAndName(); - Assert.Equal(data, keyInfo.Data); - Assert.Equal(name, keyInfo.Name); - } - - [Theory] - [InlineData("")] - [InlineData(null)] - [InlineData("apsdfoihat")] - public void ParsingBadDataReturnsNull(string key) - { - Assert.Null(new SshKey(key).GetKeyDataAndName()); - } - } - - public class TheHasSameDataAsMethod - { - [Fact] - public void ReturnsTrueWhenTwoKeysHaveTheSameData() - { - var key = new SshKey("ssh-dsa AAAAB3NzaC1yc2EAAAABIwAA", "somekey"); - var anotherKey = new SshKey("ssh-rsa AAAAB3NzaC1yc2EAAAABIwAA", "whatever"); - - Assert.True(key.HasSameDataAs(anotherKey)); - } - - [Fact] - public void ReturnsFalseWhenCompareKeyIsNull() - { - var key = new SshKey("ssh-dsa AAAAB3NzaC1yc2EAAAABIwAA", "somekey"); - - Assert.False(key.HasSameDataAs(null)); - } - - [Theory] - [InlineData(null, "ssh-dsa AAAAB3NzaC1yc2EAAAABIwAA")] - [InlineData("ssh-dsa AAAAB3NzaC1yc2EAAAABIwAA", null)] - [InlineData("ssh-dsa AAAAB3NzaC1yc2EAAAABIwAA", "ssh-dsa AAAAB3NzaC1yc2EAAAABIwAB")] - public void ReturnsFalseWhenTwoKeysHaveDifferentData(string firstKey, string secondKey) - { - var key = new SshKey(firstKey, "somekey"); - var anotherKey = new SshKey(secondKey, "whatever"); - - Assert.False(key.HasSameDataAs(anotherKey)); - } - } - } -} diff --git a/Octokit.Tests/OctoKit.Tests-NetCore45.csproj b/Octokit.Tests/OctoKit.Tests-NetCore45.csproj index 7748e894c7..cc2abfdb85 100644 --- a/Octokit.Tests/OctoKit.Tests-NetCore45.csproj +++ b/Octokit.Tests/OctoKit.Tests-NetCore45.csproj @@ -97,7 +97,6 @@ - @@ -146,7 +145,6 @@ - diff --git a/Octokit.Tests/Octokit.Tests-Portable.csproj b/Octokit.Tests/Octokit.Tests-Portable.csproj index 7efabfefca..21c3d8fb85 100644 --- a/Octokit.Tests/Octokit.Tests-Portable.csproj +++ b/Octokit.Tests/Octokit.Tests-Portable.csproj @@ -106,7 +106,6 @@ - @@ -155,7 +154,6 @@ - diff --git a/Octokit.Tests/Octokit.Tests.csproj b/Octokit.Tests/Octokit.Tests.csproj index b1f4bac748..319e9c864e 100644 --- a/Octokit.Tests/Octokit.Tests.csproj +++ b/Octokit.Tests/Octokit.Tests.csproj @@ -133,7 +133,6 @@ - @@ -187,7 +186,6 @@ - diff --git a/Octokit/Clients/ISshKeysClient.cs b/Octokit/Clients/ISshKeysClient.cs deleted file mode 100644 index 6f16d1a9b1..0000000000 --- a/Octokit/Clients/ISshKeysClient.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Threading.Tasks; - -namespace Octokit -{ - /// - /// A client for GitHub's User Keys API. - /// - /// - /// See the Users API documentation for more information. - /// - public interface ISshKeysClient - { - /// - /// Retrieves the for the specified id. - /// - /// The ID of the SSH key - /// A - [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")] - [Obsolete("This method is obsolete. Please use User.Keys.Get(int) instead.")] - Task Get(int id); - - /// - /// Retrieves the for the specified id. - /// - /// The login of the user - /// A of . - [Obsolete("This method is obsolete. Please use User.Keys.GetAll(string) instead.")] - Task> GetAll(string user); - - /// - /// Retrieves the for the specified id. - /// - /// Thrown if the client is not authenticated. - /// A of . - [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", - Justification = "Makes a network request")] - [Obsolete("This method is obsolete. Please use User.Keys.GetAll() instead.")] - Task> GetAllForCurrent(); - - /// - /// Update the specified . - /// - /// The SSH Key contents - /// Thrown if the client is not authenticated. - /// A - [Obsolete("This method is obsolete. Please use User.Keys.Create(NewPublicKey) instead.")] - Task Create(SshKeyUpdate key); - - /// - /// Update the specified . - /// - /// The ID of the SSH key - /// The SSH Key contents - /// Thrown if the client is not authenticated. - /// A - [Obsolete("This method is no longer supported in the GitHub API. Delete and Create the key again instead.")] - Task Update(int id, SshKeyUpdate key); - - /// - /// Update the specified . - /// - /// The id of the SSH key - /// Thrown if the client is not authenticated. - /// A - [Obsolete("This method is obsolete. Please use User.Keys.Delete(int) instead.")] - Task Delete(int id); - } -} diff --git a/Octokit/Clients/SshKeysClient.cs b/Octokit/Clients/SshKeysClient.cs deleted file mode 100644 index 544d15afbd..0000000000 --- a/Octokit/Clients/SshKeysClient.cs +++ /dev/null @@ -1,101 +0,0 @@ -#if NET_45 -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -#endif - -namespace Octokit -{ - /// - /// A client for GitHub's User Keys API. - /// - /// - /// See the Users API documentation for more information. - /// - public class SshKeysClient : ApiClient, ISshKeysClient - { - /// - /// Instantiates a new SSH Key Client. - /// - /// The connection used to make requests - public SshKeysClient(IApiConnection apiConnection) : base(apiConnection) - { - } - - /// - /// Retrieves the for the specified id. - /// - /// The ID of the SSH key - /// A - [Obsolete("This method is obsolete. Please use User.Keys.Get(int) instead.")] - public Task Get(int id) - { - return ApiConnection.Get(ApiUrls.Keys(id)); - } - - /// - /// Retrieves the for the specified id. - /// - /// The login of the user - /// A of . - [Obsolete("This method is obsolete. Please use User.Keys.GetAll(string) instead.")] - public Task> GetAll(string user) - { - Ensure.ArgumentNotNullOrEmptyString(user, "user"); - - return ApiConnection.GetAll(ApiUrls.SshKeys(user)); - } - - /// - /// Retrieves the for the specified id. - /// - /// Thrown if the client is not authenticated. - /// A of . - [Obsolete("This method is obsolete. Please use User.Keys.GetAll() instead.")] - public Task> GetAllForCurrent() - { - return ApiConnection.GetAll(ApiUrls.SshKeys()); - } - - /// - /// Update the specified . - /// - /// The SSH Key contents - /// Thrown if the client is not authenticated. - /// A - [Obsolete("This method is obsolete. Please use User.Keys.Create(NewPublicKey) instead.")] - public Task Create(SshKeyUpdate key) - { - Ensure.ArgumentNotNull(key, "key"); - - return ApiConnection.Post(ApiUrls.SshKeys(), key); - } - - /// - /// Update the specified . - /// - /// The ID of the SSH key - /// The SSH Key contents - /// Thrown if the client is not authenticated. - /// A - [Obsolete("This method is no longer supported in the GitHub API. Delete and Create the key again instead.")] - public Task Update(int id, SshKeyUpdate key) - { - Ensure.ArgumentNotNull(key, "key"); - - return ApiConnection.Patch(ApiUrls.Keys(id), key); - } - - /// - /// Update the specified . - /// - /// The id of the SSH key - /// Thrown if the client is not authenticated. - /// A - [Obsolete("This method is obsolete. Please use User.Keys.Delete(int) instead.")] - public Task Delete(int id) - { - return ApiConnection.Delete(ApiUrls.Keys(id)); - } - } -} diff --git a/Octokit/GitHubClient.cs b/Octokit/GitHubClient.cs index e0fd2e0cb4..eecfc415db 100644 --- a/Octokit/GitHubClient.cs +++ b/Octokit/GitHubClient.cs @@ -96,7 +96,6 @@ public GitHubClient(IConnection connection) PullRequest = new PullRequestsClient(apiConnection); Repository = new RepositoriesClient(apiConnection); Search = new SearchClient(apiConnection); - SshKey = new SshKeysClient(apiConnection); User = new UsersClient(apiConnection); Reaction = new ReactionsClient(apiConnection); } @@ -224,17 +223,6 @@ public Uri BaseAddress /// public IGistsClient Gist { get; private set; } - /// - - // TODO: this should be under Users to align with the API docs - // TODO: this should be named PublicKeys to align with the API docs - /// Access GitHub's Public Keys API. - /// - /// - /// Refer to the API documentation for more information: https://developer.github.com/v3/users/keys/ - /// - public ISshKeysClient SshKey { get; private set; } - /// /// Access GitHub's Users API. /// diff --git a/Octokit/Helpers/ModelExtensions.cs b/Octokit/Helpers/ModelExtensions.cs deleted file mode 100644 index ecf52b2b1e..0000000000 --- a/Octokit/Helpers/ModelExtensions.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Text.RegularExpressions; - -namespace Octokit -{ - // TODO: this is only related to SSH keys, we should rename this - - /// - /// Extensions for working with SSH keys - /// - public static class ModelExtensions - { -#if NETFX_CORE - static readonly Regex sshKeyRegex = new Regex(@"ssh-[rd]s[as] (?\S+) ?(?.*)$"); -#else - static readonly Regex sshKeyRegex = new Regex(@"ssh-[rd]s[as] (?\S+) ?(?.*)$", RegexOptions.Compiled); -#endif - - /// - /// Extract SSH key information from the API response - /// - /// Key details received from API - [Obsolete("This method will be removed in a future release.")] - public static SshKeyInfo GetKeyDataAndName(this SshKey sshKey) - { - Ensure.ArgumentNotNull(sshKey, "sshKey"); - - var key = sshKey.Key; - if (key == null) return null; - var match = sshKeyRegex.Match(key); - return match.Success ? new SshKeyInfo(match.Groups["data"].Value, match.Groups["name"].Value) : null; - } - - /// - /// Compare two SSH keys to see if they are equal - /// - /// Reference SSH key - /// Key to compare - [Obsolete("This method will be removed in a future release.")] - public static bool HasSameDataAs(this SshKey key, SshKey otherKey) - { - Ensure.ArgumentNotNull(key, "key"); - - if (otherKey == null) return false; - var keyData = key.GetKeyData(); - return keyData != null && keyData == otherKey.GetKeyData(); - } - -#pragma warning disable CS0618 - static string GetKeyData(this SshKey key) - { - var keyInfo = key.GetKeyDataAndName(); - return keyInfo == null ? null : keyInfo.Data; - } -#pragma warning restore CS0618 - } -} diff --git a/Octokit/IGitHubClient.cs b/Octokit/IGitHubClient.cs index ffc08f8e0b..0fd4b914e1 100644 --- a/Octokit/IGitHubClient.cs +++ b/Octokit/IGitHubClient.cs @@ -92,16 +92,6 @@ public interface IGitHubClient : IApiInfoProvider /// IGistsClient Gist { get; } - // TODO: this should be under Users to align with the API docs - // TODO: this should be named PublicKeys to align with the API docs - /// - /// Access GitHub's Public Keys API. - /// - /// - /// Refer to the API documentation for more information: https://developer.github.com/v3/users/keys/ - /// - ISshKeysClient SshKey { get; } - /// /// Access GitHub's Users API. /// diff --git a/Octokit/Models/Request/SshKeyUpdate.cs b/Octokit/Models/Request/SshKeyUpdate.cs deleted file mode 100644 index fa3050743a..0000000000 --- a/Octokit/Models/Request/SshKeyUpdate.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Diagnostics; -using System.Globalization; - -namespace Octokit -{ - /// - /// Used to update an SSH key - /// - [DebuggerDisplay("{DebuggerDisplay,nq}")] - public class SshKeyUpdate - { - /// - /// The SSH Key - /// - public string Key { get; set; } - - /// - /// The title of the SSH key - /// - public string Title { get; set; } - - internal string DebuggerDisplay - { - get - { - return string.Format(CultureInfo.InvariantCulture, "Key: {0} Title: {1}", Key, Title); - } - } - } -} \ No newline at end of file diff --git a/Octokit/Models/Response/SshKey.cs b/Octokit/Models/Response/SshKey.cs deleted file mode 100644 index b5caf133a6..0000000000 --- a/Octokit/Models/Response/SshKey.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Diagnostics; -using System.Globalization; - -namespace Octokit -{ - [DebuggerDisplay("{DebuggerDisplay,nq}")] - [Obsolete("This response class is obsolete. Please use PublicKey instead")] - public class SshKey - { - public SshKey() - { - } - - public SshKey(string key) - { - Key = key; - } - - public SshKey(string key, string title) - { - Key = key; - Title = title; - } - - protected SshKey(int id, string key, string title, string url) - { - Id = id; - Key = key; - Title = title; - Url = url; - } - - /// - /// The system-wide unique Id for this user. - /// - public int Id { get; protected set; } - - /// - /// The SSH Key - /// - public string Key { get; protected set; } - - /// - /// The title of the SSH key - /// - public string Title { get; protected set; } - - /// - /// The api URL for this organization. - /// - public string Url { get; protected set; } - - internal string DebuggerDisplay - { - get { return string.Format(CultureInfo.InvariantCulture, "Title: {0} ", Title); } - } - } -} diff --git a/Octokit/Models/Response/SshKeyInfo.cs b/Octokit/Models/Response/SshKeyInfo.cs deleted file mode 100644 index a5da540145..0000000000 --- a/Octokit/Models/Response/SshKeyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; - -namespace Octokit -{ - /// - /// Represents the data and name parsed from the Ssh key. - /// - [Obsolete("This class will be removed in a future release.")] - public class SshKeyInfo - { - public SshKeyInfo(string data, string name) - { - Ensure.ArgumentNotNull(data, "data"); - Ensure.ArgumentNotNull(name, "name"); - - Data = data; - Name = name; - } - - public string Data { get; private set; } - public string Name { get; private set; } - } -} \ No newline at end of file diff --git a/Octokit/Octokit-Mono.csproj b/Octokit/Octokit-Mono.csproj index 7c6a3564f6..b183eb0a5d 100644 --- a/Octokit/Octokit-Mono.csproj +++ b/Octokit/Octokit-Mono.csproj @@ -216,7 +216,6 @@ - @@ -240,7 +239,6 @@ - @@ -271,7 +269,6 @@ - @@ -284,9 +281,6 @@ - - - diff --git a/Octokit/Octokit-MonoAndroid.csproj b/Octokit/Octokit-MonoAndroid.csproj index 8b66b03d30..1fba6249a5 100644 --- a/Octokit/Octokit-MonoAndroid.csproj +++ b/Octokit/Octokit-MonoAndroid.csproj @@ -161,7 +161,6 @@ - @@ -185,7 +184,6 @@ - @@ -216,7 +214,6 @@ - @@ -229,9 +226,6 @@ - - - diff --git a/Octokit/Octokit-Monotouch.csproj b/Octokit/Octokit-Monotouch.csproj index 68b0e6ff83..0bdf885b25 100644 --- a/Octokit/Octokit-Monotouch.csproj +++ b/Octokit/Octokit-Monotouch.csproj @@ -157,7 +157,6 @@ - @@ -181,7 +180,6 @@ - @@ -212,7 +210,6 @@ - @@ -225,9 +222,6 @@ - - - diff --git a/Octokit/Octokit-Portable.csproj b/Octokit/Octokit-Portable.csproj index c7a7f4fa47..138d85c764 100644 --- a/Octokit/Octokit-Portable.csproj +++ b/Octokit/Octokit-Portable.csproj @@ -94,7 +94,6 @@ - @@ -119,7 +118,6 @@ - @@ -145,7 +143,6 @@ - @@ -219,7 +216,6 @@ - @@ -281,8 +277,6 @@ - - diff --git a/Octokit/Octokit-netcore45.csproj b/Octokit/Octokit-netcore45.csproj index 3d7d9a74d8..a19cc40a60 100644 --- a/Octokit/Octokit-netcore45.csproj +++ b/Octokit/Octokit-netcore45.csproj @@ -102,7 +102,6 @@ - @@ -126,7 +125,6 @@ - @@ -151,7 +149,6 @@ - @@ -226,7 +223,6 @@ - @@ -288,8 +284,6 @@ - - diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index 29da34ce5c..a27d92848d 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -420,7 +420,6 @@ - @@ -444,7 +443,6 @@ - @@ -475,7 +473,6 @@ - @@ -488,9 +485,6 @@ - - -