diff --git a/PandaSharp.Bamboo.Test/BambooApiFactoryTest.cs b/PandaSharp.Bamboo.Test/BambooApiFactoryTest.cs index 571466f..df6f46a 100644 --- a/PandaSharp.Bamboo.Test/BambooApiFactoryTest.cs +++ b/PandaSharp.Bamboo.Test/BambooApiFactoryTest.cs @@ -18,6 +18,18 @@ public void BambooApiBasicConstructionTest() bambooApi.ProjectRequest.ShouldNotBeNull(); } + [Test] + public void BambooApiAccessTokenConstructionTest() + { + var bambooApi = BambooApiFactory.CreateWithAccessTokenAuthentication("http://test.bamboo.com", "tokenSecret"); + + bambooApi.BuildRequest.ShouldNotBeNull(); + bambooApi.PlanRequest.ShouldNotBeNull(); + bambooApi.SearchRequest.ShouldNotBeNull(); + bambooApi.UsersRequest.ShouldNotBeNull(); + bambooApi.ProjectRequest.ShouldNotBeNull(); + } + [Test] public void BambooApiOAuthConstructionTest() { diff --git a/PandaSharp.Bamboo/BambooApiFactory.cs b/PandaSharp.Bamboo/BambooApiFactory.cs index 6b63db6..a8f7260 100644 --- a/PandaSharp.Bamboo/BambooApiFactory.cs +++ b/PandaSharp.Bamboo/BambooApiFactory.cs @@ -1,5 +1,6 @@ using PandaSharp.Framework.IoC; using PandaSharp.Framework.Utils; +using RestSharp.Authenticators.OAuth2; namespace PandaSharp.Bamboo { @@ -14,6 +15,18 @@ public static IBambooApi CreateWithBasicAuthentication(string baseUrl, string us return container.Resolve(); } + public static IBambooApi CreateWithAccessTokenAuthentication(string baseUrl, string accesstoken) + { + var container = new PandaContainer(); + var authentication = new OAuth2AuthorizationRequestHeaderAuthenticator( + accesstoken, "Bearer" + ); + container.RegisterWithCustomAuthentication(baseUrl, authentication); + container.RegisterPandaModules(); + + return container.Resolve(); + } + public static IBambooApi CreateWithOAuthAuthentication( string baseUrl, string consumerKey, diff --git a/PandaSharp.Bamboo/PandaSharp.Bamboo.csproj b/PandaSharp.Bamboo/PandaSharp.Bamboo.csproj index 028a3e7..c81257b 100644 --- a/PandaSharp.Bamboo/PandaSharp.Bamboo.csproj +++ b/PandaSharp.Bamboo/PandaSharp.Bamboo.csproj @@ -2,7 +2,7 @@ 8.0 - 1.1.4 + 1.1.5 Tom Birras true C# wrapper for Atlassian Bamboo @@ -30,7 +30,7 @@ - + diff --git a/PandaSharp.Bamboo/Services/Build/Response/BuildResponse.cs b/PandaSharp.Bamboo/Services/Build/Response/BuildResponse.cs index 755bba8..ae6f197 100644 --- a/PandaSharp.Bamboo/Services/Build/Response/BuildResponse.cs +++ b/PandaSharp.Bamboo/Services/Build/Response/BuildResponse.cs @@ -21,6 +21,15 @@ public sealed class BuildResponse [JsonProperty("buildResultKey")] public string BuildKey { get; set; } + [JsonProperty("buildReason")] + public string BuildReason { get; set; } + + [JsonProperty("buildTestSummary")] + public string TestSummary { get; set; } + + [JsonProperty("successful")] + public bool Successful { get; set; } + [JsonProperty("successfulTestCount")] public uint? SuccessfulTestCount { get; set; } diff --git a/PandaSharp.Bamboo/Services/Plan/Response/PlanResponse.cs b/PandaSharp.Bamboo/Services/Plan/Response/PlanResponse.cs index 47e2d86..b7c6e05 100644 --- a/PandaSharp.Bamboo/Services/Plan/Response/PlanResponse.cs +++ b/PandaSharp.Bamboo/Services/Plan/Response/PlanResponse.cs @@ -15,6 +15,9 @@ public sealed class PlanResponse [JsonProperty("shortName")] public string PlanName { get; set; } + [JsonProperty("name")] + public string CompositeName { get; set; } + [JsonProperty("shortKey")] public string PlanKey { get; set; } diff --git a/README.md b/README.md index 76b201a..783c274 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # PandaSharp.Bamboo -C# wrapper for Atlassian Bamboo Rest API +C# wrapper for Atlassian Bamboo Rest API derived from: [![Build status](https://ci.appveyor.com/api/projects/status/pt3xl353bgywoiea/branch/master?svg=true)](https://ci.appveyor.com/project/Metablex/pandasharp-bamboo/branch/master)