From 016e25b6932024351faf5bf29e930146ab9c2cf1 Mon Sep 17 00:00:00 2001 From: Ryan Gribble Date: Sat, 16 Jul 2016 20:45:01 +1000 Subject: [PATCH 1/4] Remove obsolete items - AuthorizationClient - RevokeAllApplicationAuthentications() --- .../IObservableAuthorizationsClient.cs | 12 ------ .../Clients/ObservableAuthorizationsClient.cs | 18 --------- .../Clients/AuthorizationClientTests.cs | 37 ------------------- .../Clients/AuthorizationsClientTests.cs | 25 ------------- Octokit/Clients/AuthorizationsClient.cs | 18 --------- Octokit/Clients/IAuthorizationsClient.cs | 12 ------ 6 files changed, 122 deletions(-) diff --git a/Octokit.Reactive/Clients/IObservableAuthorizationsClient.cs b/Octokit.Reactive/Clients/IObservableAuthorizationsClient.cs index 1b7505ca16..24d0515f37 100644 --- a/Octokit.Reactive/Clients/IObservableAuthorizationsClient.cs +++ b/Octokit.Reactive/Clients/IObservableAuthorizationsClient.cs @@ -213,18 +213,6 @@ IObservable GetOrCreateApplicationAuthentication( /// IObservable RevokeApplicationAuthentication(string clientId, string accessToken); - /// - /// Revokes every OAuth token for an OAuth application. - /// - /// - /// This method requires authentication. - /// See the API documentation for more information. - /// - /// ClientID of the OAuth application for the token - /// - [Obsolete("This feature is no longer supported in the GitHub API and will be removed in a future release")] - IObservable RevokeAllApplicationAuthentications(string clientId); - /// /// Update the specified by the id. /// diff --git a/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs b/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs index fa1956a045..cf9d8bd65b 100644 --- a/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs +++ b/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs @@ -301,24 +301,6 @@ public IObservable RevokeApplicationAuthentication(string clientId, string .ToObservable(); } - /// - /// Revokes every OAuth token for an OAuth application. - /// - /// - /// This method requires authentication. - /// See the API documentation for more information. - /// - /// ClientID of the OAuth application for the token - /// - [Obsolete("This feature is no longer supported in the GitHub API and will be removed in a future release")] - public IObservable RevokeAllApplicationAuthentications(string clientId) - { - Ensure.ArgumentNotNullOrEmptyString("clientId", clientId); - - return _client.RevokeAllApplicationAuthentications(clientId) - .ToObservable(); - } - /// /// Update the specified by the id. /// diff --git a/Octokit.Tests.Integration/Clients/AuthorizationClientTests.cs b/Octokit.Tests.Integration/Clients/AuthorizationClientTests.cs index 994c29b524..72ed1ad5cd 100644 --- a/Octokit.Tests.Integration/Clients/AuthorizationClientTests.cs +++ b/Octokit.Tests.Integration/Clients/AuthorizationClientTests.cs @@ -235,42 +235,5 @@ public async Task CanRevokeApplicationAuthentication() Assert.ThrowsAsync(() => applicationClient.Authorization.CheckApplicationAuthentication(Helper.ClientId, created.Token)); Assert.ThrowsAsync(() => github.Authorization.Get(created.Id)); } - - [BasicAuthenticationTest(Skip = "See https://github.com/octokit/octokit.net/issues/1078 for explanation of why this is now obsolete")] - public async Task CanRevokeAllApplicationAuthentications() - { - var github = Helper.GetBasicAuthClient(); - - var fingerprint = Helper.MakeNameWithTimestamp("authorization-testing"); - var note = Helper.MakeNameWithTimestamp("Testing authentication"); - var token1 = await github.Authorization.GetOrCreateApplicationAuthentication( - Helper.ClientId, - Helper.ClientSecret, - new NewAuthorization( - note, - new[] { "user" }, - fingerprint)); - - fingerprint = Helper.MakeNameWithTimestamp("authorization-testing-2"); - note = Helper.MakeNameWithTimestamp("Testing authentication 2"); - var token2 = await github.Authorization.GetOrCreateApplicationAuthentication( - Helper.ClientId, - Helper.ClientSecret, - new NewAuthorization( - note, - new[] { "user" }, - fingerprint)); - - var applicationClient = Helper.GetAuthenticatedApplicationClient(); - await applicationClient.Authorization.RevokeAllApplicationAuthentications(Helper.ClientId); - - Assert.ThrowsAsync(async () => - await applicationClient.Authorization.CheckApplicationAuthentication(Helper.ClientId, token1.Token)); - Assert.ThrowsAsync(async () => - await applicationClient.Authorization.CheckApplicationAuthentication(Helper.ClientId, token2.Token)); - - Assert.ThrowsAsync(() => github.Authorization.Get(token1.Id)); - Assert.ThrowsAsync(() => github.Authorization.Get(token2.Id)); - } } } diff --git a/Octokit.Tests/Clients/AuthorizationsClientTests.cs b/Octokit.Tests/Clients/AuthorizationsClientTests.cs index 91887a6e32..c975fcbadc 100644 --- a/Octokit.Tests/Clients/AuthorizationsClientTests.cs +++ b/Octokit.Tests/Clients/AuthorizationsClientTests.cs @@ -358,30 +358,5 @@ public async Task EnsuresArgumentsNotNull() await Assert.ThrowsAsync(() => authEndpoint.RevokeApplicationAuthentication("clientId", "")); } } - - public class TheRevokeAllApplicationAuthenticationsMethod - { - [Fact] - public async Task RevokesAllApplicationAuthenticationsAtCorrectUrl() - { - var client = Substitute.For(); - var authEndpoint = new AuthorizationsClient(client); - - authEndpoint.RevokeAllApplicationAuthentications("clientId"); - - client.Received().Delete( - Arg.Is(u => u.ToString() == "applications/clientId/tokens")); - } - - [Fact] - public async Task EnsuresArgumentsNotNull() - { - var client = Substitute.For(); - var authEndpoint = new AuthorizationsClient(client); - - await Assert.ThrowsAsync(() => authEndpoint.RevokeAllApplicationAuthentications(null)); - await Assert.ThrowsAsync(() => authEndpoint.RevokeAllApplicationAuthentications("")); - } - } } } diff --git a/Octokit/Clients/AuthorizationsClient.cs b/Octokit/Clients/AuthorizationsClient.cs index 4d6e03408a..a7fa406ce4 100644 --- a/Octokit/Clients/AuthorizationsClient.cs +++ b/Octokit/Clients/AuthorizationsClient.cs @@ -386,24 +386,6 @@ public Task RevokeApplicationAuthentication(string clientId, string accessToken) ApiUrls.ApplicationAuthorization(clientId, accessToken)); } - /// - /// Revokes every OAuth token for an OAuth application. - /// - /// - /// This method requires authentication. - /// See the API documentation for more information. - /// - /// ClientID of the OAuth application for the token - /// A for the request's execution. - [Obsolete("This feature is no longer supported in the GitHub API and will be removed in a future release")] - public Task RevokeAllApplicationAuthentications(string clientId) - { - Ensure.ArgumentNotNullOrEmptyString(clientId, "clientId"); - - return ApiConnection.Delete( - ApiUrls.ApplicationAuthorization(clientId)); - } - /// /// Updates the specified . /// diff --git a/Octokit/Clients/IAuthorizationsClient.cs b/Octokit/Clients/IAuthorizationsClient.cs index 994a9494c6..f39b2d4fe7 100644 --- a/Octokit/Clients/IAuthorizationsClient.cs +++ b/Octokit/Clients/IAuthorizationsClient.cs @@ -238,18 +238,6 @@ Task GetOrCreateApplicationAuthentication( /// A for the request's execution. Task RevokeApplicationAuthentication(string clientId, string accessToken); - /// - /// Revokes every OAuth token for an OAuth application. - /// - /// - /// This method requires authentication. - /// See the API documentation for more information. - /// - /// ClientID of the OAuth application for the token - /// A for the request's execution. - [Obsolete("This feature is no longer supported in the GitHub API and will be removed in a future release")] - Task RevokeAllApplicationAuthentications(string clientId); - /// /// Updates the specified . /// From 0021269d70cf9dc3c4ddb4d6e26bd826989c02ed Mon Sep 17 00:00:00 2001 From: Ryan Gribble Date: Sat, 16 Jul 2016 20:46:16 +1000 Subject: [PATCH 2/4] Remove obsolete items - RepositoriesClient - CommitStatus - RepoCollaborators - Commits - RepositoryComments --- .../Clients/IObservableRepositoriesClient.cs | 38 -------------- .../Clients/ObservableRepositoriesClient.cs | 47 ----------------- Octokit/Clients/IRepositoriesClient.cs | 38 -------------- Octokit/Clients/RepositoriesClient.cs | 50 ------------------- 4 files changed, 173 deletions(-) diff --git a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs index 952dd82a61..866f4956bb 100644 --- a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs +++ b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs @@ -150,17 +150,6 @@ public interface IObservableRepositoriesClient /// A of . IObservable GetAllForOrg(string organization, ApiOptions options); - /// - /// A client for GitHub's Commit Status API. - /// - /// - /// See the Commit Status API documentation for more - /// details. Also check out the blog post - /// that announced this feature. - /// - [Obsolete("Use Status instead")] - IObservableCommitStatusClient CommitStatus { get; } - /// /// A client for GitHub's Commit Status API. /// @@ -187,15 +176,6 @@ public interface IObservableRepositoriesClient /// IObservableStatisticsClient Statistics { get; } - /// - /// Client for GitHub's Repository Comments API. - /// - /// - /// See the Repository Comments API documentation for more information. - /// - [Obsolete("Comment information is now available under the Comment property. This will be removed in a future update.")] - IObservableRepositoryCommentsClient RepositoryComments { get; } - /// /// Client for GitHub's Repository Comments API. /// @@ -540,15 +520,6 @@ public interface IObservableRepositoriesClient /// The updated IObservable EditBranch(int repositoryId, string branch, BranchUpdate update); - /// - /// A client for GitHub's Repo Collaborators. - /// - /// - /// See the Collaborators API documentation for more details - /// - [Obsolete("Collaborator information is now available under the Collaborator property. This will be removed in a future update.")] - IObservableRepoCollaboratorsClient RepoCollaborators { get; } - /// /// A client for GitHub's Repo Collaborators. /// @@ -557,15 +528,6 @@ public interface IObservableRepositoriesClient /// IObservableRepoCollaboratorsClient Collaborator { get; } - /// - /// Client for GitHub's Repository Commits API - /// - /// - /// See the Commits API documentation for more details - /// - [Obsolete("Commit information is now available under the Commit property. This will be removed in a future update.")] - IObservableRepositoryCommitsClient Commits { get; } - /// /// Client for GitHub's Repository Commits API /// diff --git a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs index c4839ea021..c54774af41 100644 --- a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs @@ -22,20 +22,11 @@ public ObservableRepositoriesClient(IGitHubClient client) Status = new ObservableCommitStatusClient(client); Hooks = new ObservableRepositoryHooksClient(client); Forks = new ObservableRepositoryForksClient(client); -#pragma warning disable CS0618 // Type or member is obsolete - RepoCollaborators = new ObservableRepoCollaboratorsClient(client); -#pragma warning restore CS0618 // Type or member is obsolete Collaborator = new ObservableRepoCollaboratorsClient(client); Deployment = new ObservableDeploymentsClient(client); Statistics = new ObservableStatisticsClient(client); PullRequest = new ObservablePullRequestsClient(client); -#pragma warning disable CS0618 // Type or member is obsolete - RepositoryComments = new ObservableRepositoryCommentsClient(client); -#pragma warning restore CS0618 // Type or member is obsolete Comment = new ObservableRepositoryCommentsClient(client); -#pragma warning disable CS0618 // Type or member is obsolete - Commits = new ObservableRepositoryCommitsClient(client); -#pragma warning restore CS0618 // Type or member is obsolete Commit = new ObservableRepositoryCommitsClient(client); Release = new ObservableReleasesClient(client); DeployKeys = new ObservableRepositoryDeployKeysClient(client); @@ -264,17 +255,6 @@ public IObservable GetAllForOrg(string organization, ApiOptions opti return _connection.GetAndFlattenAllPages(ApiUrls.OrganizationRepositories(organization), options); } - /// - /// A client for GitHub's Commit Status API. - /// - /// - /// See the Commit Status API documentation for more - /// details. Also check out the blog post - /// that announced this feature. - /// - [Obsolete("Use Status instead")] - public IObservableCommitStatusClient CommitStatus { get { return Status; } } - /// /// A client for GitHub's Commit Status API. /// @@ -301,15 +281,6 @@ public IObservable GetAllForOrg(string organization, ApiOptions opti /// public IObservableStatisticsClient Statistics { get; private set; } - /// - /// Client for GitHub's Repository Comments API. - /// - /// - /// See the Repository Comments API documentation for more information. - /// - [Obsolete("Comment information is now available under the Comment property. This will be removed in a future update.")] - public IObservableRepositoryCommentsClient RepositoryComments { get; private set; } - /// /// Client for GitHub's Repository Comments API. /// @@ -836,15 +807,6 @@ public IObservable Compare(string owner, string name, string @bas return _client.Commit.Compare(owner, name, @base, head).ToObservable(); } - /// - /// A client for GitHub's Repo Collaborators. - /// - /// - /// See the Collaborators API documentation for more details - /// - [Obsolete("Collaborator information is now available under the Collaborator property. This will be removed in a future update.")] - public IObservableRepoCollaboratorsClient RepoCollaborators { get; private set; } - /// /// A client for GitHub's Repo Collaborators. /// @@ -853,15 +815,6 @@ public IObservable Compare(string owner, string name, string @bas /// public IObservableRepoCollaboratorsClient Collaborator { get; private set; } - /// - /// Client for GitHub's Repository Commits API - /// - /// - /// See the Commits API documentation for more details - /// - [Obsolete("Commit information is now available under the Commit property. This will be removed in a future update.")] - public IObservableRepositoryCommitsClient Commits { get; private set; } - /// /// Client for GitHub's Repository Commits API /// diff --git a/Octokit/Clients/IRepositoriesClient.cs b/Octokit/Clients/IRepositoriesClient.cs index 5ae6b1decc..7261c45c7b 100644 --- a/Octokit/Clients/IRepositoriesClient.cs +++ b/Octokit/Clients/IRepositoriesClient.cs @@ -23,15 +23,6 @@ public interface IRepositoriesClient /// IPullRequestsClient PullRequest { get; } - /// - /// Client for managing commit comments in a repository. - /// - /// - /// See the Repository Comments API documentation for more information. - /// - [Obsolete("Comment information is now available under the Comment property. This will be removed in a future update.")] - IRepositoryCommentsClient RepositoryComments { get; } - /// /// Client for managing commit comments in a repository. /// @@ -254,17 +245,6 @@ public interface IRepositoriesClient /// A of . Task> GetAllForOrg(string organization, ApiOptions options); - /// - /// A client for GitHub's Commit Status API. - /// - /// - /// See the Commit Status API documentation for more - /// details. Also check out the blog post - /// that announced this feature. - /// - [Obsolete("Use Status instead")] - ICommitStatusClient CommitStatus { get; } - /// /// A client for GitHub's Commit Status API. /// @@ -287,15 +267,6 @@ public interface IRepositoriesClient /// See Forks API documentation for more information. IRepositoryForksClient Forks { get; } - /// - /// A client for GitHub's Repo Collaborators. - /// - /// - /// See the Collaborators API documentation for more details - /// - [Obsolete("Collaborator information is now available under the Collaborator property. This will be removed in a future update.")] - IRepoCollaboratorsClient RepoCollaborators { get; } - /// /// A client for GitHub's Repo Collaborators. /// @@ -320,15 +291,6 @@ public interface IRepositoriesClient /// IStatisticsClient Statistics { get; } - /// - /// Client for GitHub's Repository Commits API - /// - /// - /// See the Commits API documentation for more details - /// - [Obsolete("Commit information is now available under the Commit property. This will be removed in a future update.")] - IRepositoryCommitsClient Commits { get; } - /// /// Client for GitHub's Repository Commits API /// diff --git a/Octokit/Clients/RepositoriesClient.cs b/Octokit/Clients/RepositoriesClient.cs index 8508e4db17..e308d2dd6f 100644 --- a/Octokit/Clients/RepositoriesClient.cs +++ b/Octokit/Clients/RepositoriesClient.cs @@ -25,20 +25,11 @@ public RepositoriesClient(IApiConnection apiConnection) : base(apiConnection) Status = new CommitStatusClient(apiConnection); Hooks = new RepositoryHooksClient(apiConnection); Forks = new RepositoryForksClient(apiConnection); -#pragma warning disable CS0618 // Type or member is obsolete - RepoCollaborators = new RepoCollaboratorsClient(apiConnection); -#pragma warning restore CS0618 // Type or member is obsolete Collaborator = new RepoCollaboratorsClient(apiConnection); Statistics = new StatisticsClient(apiConnection); Deployment = new DeploymentsClient(apiConnection); PullRequest = new PullRequestsClient(apiConnection); -#pragma warning disable CS0618 // Type or member is obsolete - RepositoryComments = new RepositoryCommentsClient(apiConnection); -#pragma warning restore CS0618 // Type or member is obsolete Comment = new RepositoryCommentsClient(apiConnection); -#pragma warning disable CS0618 // Type or member is obsolete - Commits = new RepositoryCommitsClient(apiConnection); -#pragma warning restore CS0618 // Type or member is obsolete Commit = new RepositoryCommitsClient(apiConnection); Release = new ReleasesClient(apiConnection); DeployKeys = new RepositoryDeployKeysClient(apiConnection); @@ -441,20 +432,6 @@ public Task> GetAllForOrg(string organization, ApiOpti return ApiConnection.GetAll(ApiUrls.OrganizationRepositories(organization), options); } - /// - /// A client for GitHub's Commit Status API. - /// - /// - /// See the Commit Status API documentation for more - /// details. Also check out the blog post - /// that announced this feature. - /// - [Obsolete("Use Status instead")] - public ICommitStatusClient CommitStatus - { - get { return Status; } - } - /// /// A client for GitHub's Commit Status API. /// @@ -477,15 +454,6 @@ public ICommitStatusClient CommitStatus /// See Forks API documentation for more information. public IRepositoryForksClient Forks { get; private set; } - /// - /// A client for GitHub's Repo Collaborators. - /// - /// - /// See the Collaborators API documentation for more details - /// - [Obsolete("Collaborator information is now available under the Collaborator property. This will be removed in a future update.")] - public IRepoCollaboratorsClient RepoCollaborators { get; private set; } - /// /// A client for GitHub's Repo Collaborators. /// @@ -510,15 +478,6 @@ public ICommitStatusClient CommitStatus /// public IStatisticsClient Statistics { get; private set; } - /// - /// Client for GitHub's Repository Commits API - /// - /// - /// See the Commits API documentation for more details - /// - [Obsolete("Commit information is now available under the Commit property. This will be removed in a future update.")] - public IRepositoryCommitsClient Commits { get; private set; } - /// /// Client for GitHub's Repository Commits API /// @@ -551,15 +510,6 @@ public ICommitStatusClient CommitStatus /// public IPullRequestsClient PullRequest { get; private set; } - /// - /// Client for managing commit comments in a repository. - /// - /// - /// See the Repository Comments API documentation for more information. - /// - [Obsolete("Comment information is now available under the Comment property. This will be removed in a future update.")] - public IRepositoryCommentsClient RepositoryComments { get; private set; } - /// /// Client for managing commit comments in a repository. /// From 2cc2ccda622e0774094e8449802eb63c2044da98 Mon Sep 17 00:00:00 2001 From: Ryan Gribble Date: Sat, 16 Jul 2016 21:06:35 +1000 Subject: [PATCH 3/4] Remove obsolete items - GitHubClient - Release - Notification - GitDatabase --- Octokit.Reactive/IObservableGitHubClient.cs | 6 ----- Octokit.Reactive/ObservableGitHubClient.cs | 6 ----- Octokit/GitHubClient.cs | 30 --------------------- Octokit/IGitHubClient.cs | 29 -------------------- 4 files changed, 71 deletions(-) diff --git a/Octokit.Reactive/IObservableGitHubClient.cs b/Octokit.Reactive/IObservableGitHubClient.cs index aa608c8880..33f4a847b4 100644 --- a/Octokit.Reactive/IObservableGitHubClient.cs +++ b/Octokit.Reactive/IObservableGitHubClient.cs @@ -15,15 +15,9 @@ public interface IObservableGitHubClient : IApiInfoProvider IObservablePullRequestsClient PullRequest { get; } IObservableRepositoriesClient Repository { get; } IObservableGistsClient Gist { get; } - [Obsolete("Use Repository.Release instead")] - IObservableReleasesClient Release { get; } IObservableSshKeysClient SshKey { get; } IObservableUsersClient User { get; } - [Obsolete("Notifications are now available under the Activities client. This will be removed in a future update.")] - IObservableNotificationsClient Notification { get; } IObservableGitDatabaseClient Git { get; } - [Obsolete("Use Git instead")] - IObservableGitDatabaseClient GitDatabase { get; } IObservableSearchClient Search { get; } IObservableEnterpriseClient Enterprise { get; } IObservableMigrationClient Migration { get; } diff --git a/Octokit.Reactive/ObservableGitHubClient.cs b/Octokit.Reactive/ObservableGitHubClient.cs index a5aec6b545..5e33e95a01 100644 --- a/Octokit.Reactive/ObservableGitHubClient.cs +++ b/Octokit.Reactive/ObservableGitHubClient.cs @@ -35,7 +35,6 @@ public ObservableGitHubClient(IGitHubClient gitHubClient) Activity = new ObservableActivitiesClient(gitHubClient); Issue = new ObservableIssuesClient(gitHubClient); Miscellaneous = new ObservableMiscellaneousClient(gitHubClient); - Notification = new ObservableNotificationsClient(gitHubClient); Oauth = new ObservableOauthClient(gitHubClient); Organization = new ObservableOrganizationsClient(gitHubClient); PullRequest = new ObservablePullRequestsClient(gitHubClient); @@ -64,13 +63,8 @@ public IConnection Connection public IObservablePullRequestsClient PullRequest { get; private set; } public IObservableRepositoriesClient Repository { get; private set; } public IObservableGistsClient Gist { get; private set; } - [Obsolete("Use Repository.Release instead")] - public IObservableReleasesClient Release { get { return Repository.Release; } } public IObservableSshKeysClient SshKey { get; private set; } public IObservableUsersClient User { get; private set; } - public IObservableNotificationsClient Notification { get; private set; } - [Obsolete("Use Git instead")] - public IObservableGitDatabaseClient GitDatabase { get { return Git; } } public IObservableGitDatabaseClient Git { get; private set; } public IObservableSearchClient Search { get; private set; } public IObservableEnterpriseClient Enterprise { get; private set; } diff --git a/Octokit/GitHubClient.cs b/Octokit/GitHubClient.cs index 9d7cb4ef72..e0fd2e0cb4 100644 --- a/Octokit/GitHubClient.cs +++ b/Octokit/GitHubClient.cs @@ -91,7 +91,6 @@ public GitHubClient(IConnection connection) Issue = new IssuesClient(apiConnection); Migration = new MigrationClient(apiConnection); Miscellaneous = new MiscellaneousClient(connection); - Notification = new NotificationsClient(apiConnection); Oauth = new OauthClient(connection); Organization = new OrganizationsClient(apiConnection); PullRequest = new PullRequestsClient(apiConnection); @@ -226,20 +225,9 @@ public Uri BaseAddress public IGistsClient Gist { get; private set; } /// - /// Access GitHub's Releases API. - /// - /// - /// Refer to the API documentation for more information: https://developer.github.com/v3/repos/releases/ - /// - [Obsolete("Use Repository.Release instead")] - public IReleasesClient Release - { - get { return Repository.Release; } - } // 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. /// /// @@ -255,24 +243,6 @@ public IReleasesClient Release /// public IUsersClient User { get; private set; } - // TODO: this should be under Activities to align with the API docs - /// - /// Access GitHub's Notifications API. - /// - /// - /// Refer to the API documentation for more information: https://developer.github.com/v3/activity/notifications/ - /// - public INotificationsClient Notification { get; private set; } - - /// - /// Access GitHub's Git Data API. - /// - /// - /// Refer to the API documentation for more information: https://developer.github.com/v3/git/ - /// - [Obsolete("Use Git instead")] - public IGitDatabaseClient GitDatabase { get { return Git; } } - /// /// Access GitHub's Git Data API. /// diff --git a/Octokit/IGitHubClient.cs b/Octokit/IGitHubClient.cs index 03e861d75b..ffc08f8e0b 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 Repositories to align with the API docs - /// - /// Access GitHub's Releases API. - /// - /// - /// Refer to the API documentation for more information: https://developer.github.com/v3/repos/releases/ - /// - [Obsolete("Use Repository.Release instead")] - IReleasesClient Release { 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 /// @@ -120,25 +110,6 @@ public interface IGitHubClient : IApiInfoProvider /// IUsersClient User { get; } - // TODO: this should be under Activities to align with the API docs - /// - /// Access GitHub's Notifications API. - /// - /// - /// Refer to the API documentation for more information: https://developer.github.com/v3/activity/notifications/ - /// - [Obsolete("Notifications are now available under the Activities client. This will be removed in a future update.")] - INotificationsClient Notification { get; } - - /// - /// Access GitHub's Git Data API. - /// - /// - /// Refer to the API documentation for more information: https://developer.github.com/v3/git/ - /// - [Obsolete("Use Git instead")] - IGitDatabaseClient GitDatabase { get; } - /// /// Access GitHub's Git Data API. /// From 9d8e8ae8af41a42e27e933dc57f0014f32a2e0ed Mon Sep 17 00:00:00 2001 From: Ryan Gribble Date: Sat, 16 Jul 2016 22:44:56 +1000 Subject: [PATCH 4/4] 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 @@ - - -