diff --git a/SeatsioDotNet.Test/Subaccounts/RegenerateDesignerKeyTest.cs b/SeatsioDotNet.Test/Subaccounts/RegenerateSubaccountDesignerKeyTest.cs similarity index 87% rename from SeatsioDotNet.Test/Subaccounts/RegenerateDesignerKeyTest.cs rename to SeatsioDotNet.Test/Subaccounts/RegenerateSubaccountDesignerKeyTest.cs index 626aa61..37fa7e1 100644 --- a/SeatsioDotNet.Test/Subaccounts/RegenerateDesignerKeyTest.cs +++ b/SeatsioDotNet.Test/Subaccounts/RegenerateSubaccountDesignerKeyTest.cs @@ -2,7 +2,7 @@ namespace SeatsioDotNet.Test.Subaccounts { - public class RegenerateDesignerKeyTest : SeatsioClientTest + public class RegenerateSubaccountDesignerKeyTest : SeatsioClientTest { [Fact] public void Test() diff --git a/SeatsioDotNet.Test/Subaccounts/RegenerateSecretKeyTest.cs b/SeatsioDotNet.Test/Subaccounts/RegenerateSubaccountSecretKeyTest.cs similarity index 87% rename from SeatsioDotNet.Test/Subaccounts/RegenerateSecretKeyTest.cs rename to SeatsioDotNet.Test/Subaccounts/RegenerateSubaccountSecretKeyTest.cs index 236a88c..e9643e1 100644 --- a/SeatsioDotNet.Test/Subaccounts/RegenerateSecretKeyTest.cs +++ b/SeatsioDotNet.Test/Subaccounts/RegenerateSubaccountSecretKeyTest.cs @@ -2,7 +2,7 @@ namespace SeatsioDotNet.Test.Subaccounts { - public class RegenerateSecretKeyTest : SeatsioClientTest + public class RegenerateSubaccountSecretKeyTest : SeatsioClientTest { [Fact] public void Test() diff --git a/SeatsioDotNet.Test/Workspaces/RegenerateWorkspaceSecretKeyTest.cs b/SeatsioDotNet.Test/Workspaces/RegenerateWorkspaceSecretKeyTest.cs new file mode 100644 index 0000000..5f73228 --- /dev/null +++ b/SeatsioDotNet.Test/Workspaces/RegenerateWorkspaceSecretKeyTest.cs @@ -0,0 +1,20 @@ +using Xunit; + +namespace SeatsioDotNet.Test.Workspaces +{ + public class RegenerateWorkspaceSecretKeyTest : SeatsioClientTest + { + [Fact] + public void Test() + { + var workspace = Client.Workspaces.Create("a ws"); + + var newSecretKey = Client.Workspaces.RegenerateSecretKey(workspace.Key); + + Assert.NotNull(newSecretKey); + Assert.NotEqual(newSecretKey, workspace.SecretKey); + var retrievedWorkspace = Client.Workspaces.Retrieve(workspace.Key); + Assert.Equal(newSecretKey, retrievedWorkspace.SecretKey); + } + } +} \ No newline at end of file diff --git a/SeatsioDotNet/SeatsioDotNet.csproj b/SeatsioDotNet/SeatsioDotNet.csproj index 513f3d2..42cc9b1 100644 --- a/SeatsioDotNet/SeatsioDotNet.csproj +++ b/SeatsioDotNet/SeatsioDotNet.csproj @@ -2,7 +2,7 @@ Library true - 70.2.0 + 70.3.0 mroloux;bverbeken Official Seats.io .NET API client Official Seats.io .NET API client diff --git a/SeatsioDotNet/Workspaces/Workspaces.cs b/SeatsioDotNet/Workspaces/Workspaces.cs index 0838b95..21d33dd 100644 --- a/SeatsioDotNet/Workspaces/Workspaces.cs +++ b/SeatsioDotNet/Workspaces/Workspaces.cs @@ -51,6 +51,14 @@ public void Update(string key, string name) AssertOk(_restClient.Execute(restRequest)); } + public string RegenerateSecretKey(string key) + { + var restRequest = new RestRequest("/workspaces/{key}/actions/regenerate-secret-key", Method.POST) + .AddUrlSegment("key", key); + var response = AssertOk(_restClient.Execute>(restRequest)); + return response["secretKey"]; + } + public IEnumerable ListAll() { return List().All();