From ba127b21a84e8ecc1604fcd2c3a22880aba6a188 Mon Sep 17 00:00:00 2001 From: Ryan Gribble Date: Fri, 22 Jul 2016 07:22:29 +1000 Subject: [PATCH] Mark existing BranchProtection classes/properties and RepositoriesClient.EditBranch() method obsolete, due to breaking changes in the API preview period --- Octokit.Reactive/Clients/IObservableRepositoriesClient.cs | 2 ++ Octokit.Reactive/Clients/ObservableRepositoriesClient.cs | 2 ++ Octokit/Clients/IRepositoriesClient.cs | 2 ++ Octokit/Clients/RepositoriesClient.cs | 2 ++ Octokit/Models/Request/BranchUpdate.cs | 1 + Octokit/Models/Response/Branch.cs | 6 +++++- Octokit/Models/Response/BranchProtection.cs | 3 +++ 7 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs index fb39df47..127f736b 100644 --- a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs +++ b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs @@ -509,6 +509,7 @@ namespace Octokit.Reactive /// The name of the branch /// New values to update the branch with /// The updated + [Obsolete("BranchProtection preview functionality in the GitHub API has had breaking changes. This existing implementation will cease to work when the preview period ends.")] IObservable EditBranch(string owner, string name, string branch, BranchUpdate update); /// @@ -518,6 +519,7 @@ namespace Octokit.Reactive /// The name of the branch /// New values to update the branch with /// The updated + [Obsolete("BranchProtection preview functionality in the GitHub API has had breaking changes. This existing implementation will cease to work when the preview period ends.")] IObservable EditBranch(int repositoryId, string branch, BranchUpdate update); /// diff --git a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs index f18fca82..0bf678aa 100644 --- a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs @@ -769,6 +769,7 @@ namespace Octokit.Reactive /// The name of the branch /// New values to update the branch with /// The updated + [Obsolete("BranchProtection preview functionality in the GitHub API has had breaking changes. This existing implementation will cease to work when the preview period ends.")] public IObservable EditBranch(string owner, string name, string branch, BranchUpdate update) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); @@ -786,6 +787,7 @@ namespace Octokit.Reactive /// The name of the branch /// New values to update the branch with /// The updated + [Obsolete("BranchProtection preview functionality in the GitHub API has had breaking changes. This existing implementation will cease to work when the preview period ends.")] public IObservable EditBranch(int repositoryId, string branch, BranchUpdate update) { Ensure.ArgumentNotNullOrEmptyString(branch, "branch"); diff --git a/Octokit/Clients/IRepositoriesClient.cs b/Octokit/Clients/IRepositoriesClient.cs index 306279eb..3878987e 100644 --- a/Octokit/Clients/IRepositoriesClient.cs +++ b/Octokit/Clients/IRepositoriesClient.cs @@ -612,6 +612,7 @@ namespace Octokit /// The name of the branch /// New values to update the branch with /// The updated + [Obsolete("BranchProtection preview functionality in the GitHub API has had breaking changes. This existing implementation will cease to work when the preview period ends.")] Task EditBranch(string owner, string name, string branch, BranchUpdate update); /// @@ -621,6 +622,7 @@ namespace Octokit /// The name of the branch /// New values to update the branch with /// The updated + [Obsolete("BranchProtection preview functionality in the GitHub API has had breaking changes. This existing implementation will cease to work when the preview period ends.")] Task EditBranch(int repositoryId, string branch, BranchUpdate update); /// diff --git a/Octokit/Clients/RepositoriesClient.cs b/Octokit/Clients/RepositoriesClient.cs index b2559e78..70b210f0 100644 --- a/Octokit/Clients/RepositoriesClient.cs +++ b/Octokit/Clients/RepositoriesClient.cs @@ -213,6 +213,7 @@ namespace Octokit /// The name of the branch /// New values to update the branch with /// The updated + [Obsolete("BranchProtection preview functionality in the GitHub API has had breaking changes. This existing implementation will cease to work when the preview period ends.")] public Task EditBranch(string owner, string name, string branch, BranchUpdate update) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); @@ -230,6 +231,7 @@ namespace Octokit /// The name of the branch /// New values to update the branch with /// The updated + [Obsolete("BranchProtection preview functionality in the GitHub API has had breaking changes. This existing implementation will cease to work when the preview period ends.")] public Task EditBranch(int repositoryId, string branch, BranchUpdate update) { Ensure.ArgumentNotNullOrEmptyString(branch, "branch"); diff --git a/Octokit/Models/Request/BranchUpdate.cs b/Octokit/Models/Request/BranchUpdate.cs index 47196b69..7afca66a 100644 --- a/Octokit/Models/Request/BranchUpdate.cs +++ b/Octokit/Models/Request/BranchUpdate.cs @@ -9,6 +9,7 @@ namespace Octokit /// Note: this is a PREVIEW api: https://developer.github.com/changes/2015-11-11-protected-branches-api/ /// [DebuggerDisplay("{DebuggerDisplay,nq}")] + [Obsolete("BranchProtection preview functionality in the GitHub API has had breaking changes. This existing implementation will cease to work when the preview period ends.")] public class BranchUpdate { /// diff --git a/Octokit/Models/Response/Branch.cs b/Octokit/Models/Response/Branch.cs index 7f189bf9..6317fd56 100644 --- a/Octokit/Models/Response/Branch.cs +++ b/Octokit/Models/Response/Branch.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using System; +using System.Diagnostics; using System.Globalization; namespace Octokit @@ -8,12 +9,14 @@ namespace Octokit { public Branch() { } +#pragma warning disable CS0618 // Type or member is obsolete public Branch(string name, GitReference commit, BranchProtection protection) { Name = name; Commit = commit; Protection = protection; } +#pragma warning restore CS0618 // Type or member is obsolete /// /// Name of this . @@ -24,6 +27,7 @@ namespace Octokit /// The details for this . /// Note: this is a PREVIEW api: https://developer.github.com/changes/2015-11-11-protected-branches-api/ /// + [Obsolete("BranchProtection preview functionality in the GitHub API has had breaking changes. This existing implementation will cease to work when the preview period ends.", false)] public BranchProtection Protection { get; protected set; } /// diff --git a/Octokit/Models/Response/BranchProtection.cs b/Octokit/Models/Response/BranchProtection.cs index 0cd63840..454f0bfb 100644 --- a/Octokit/Models/Response/BranchProtection.cs +++ b/Octokit/Models/Response/BranchProtection.cs @@ -12,6 +12,7 @@ namespace Octokit /// Note: this is a PREVIEW api: https://developer.github.com/changes/2015-11-11-protected-branches-api/ /// [DebuggerDisplay("{DebuggerDisplay,nq}")] + [Obsolete("BranchProtection preview functionality in the GitHub API has had breaking changes. This existing implementation will cease to work when the preview period ends.")] public class BranchProtection { public BranchProtection() { } @@ -42,6 +43,7 @@ namespace Octokit } [DebuggerDisplay("{DebuggerDisplay,nq}")] + [Obsolete("BranchProtection preview functionality in the GitHub API has had breaking changes. This existing implementation will cease to work when the preview period ends.")] public class RequiredStatusChecks { public RequiredStatusChecks() { } @@ -74,6 +76,7 @@ namespace Octokit /// /// The enforcement levels that are available /// + [Obsolete("BranchProtection preview functionality in the GitHub API has had breaking changes. This existing implementation will cease to work when the preview period ends.")] public enum EnforcementLevel { ///