diff --git a/SeatsioDotNet.Test/HoldTokens/RetrieveHoldTokenTest.cs b/SeatsioDotNet.Test/HoldTokens/RetrieveHoldTokenTest.cs index 50b0673..81a6095 100644 --- a/SeatsioDotNet.Test/HoldTokens/RetrieveHoldTokenTest.cs +++ b/SeatsioDotNet.Test/HoldTokens/RetrieveHoldTokenTest.cs @@ -14,7 +14,7 @@ public void Test() Assert.Equal(holdToken.Token, retrievedHoldToken.Token); Assert.Equal(holdToken.ExpiresAt, retrievedHoldToken.ExpiresAt); Assert.InRange(holdToken.ExpiresInSeconds, 14 * 60, 15 * 60); - Assert.True(holdToken.AccountId > 0); + Assert.NotNull(holdToken.workspaceKey); } } } \ No newline at end of file diff --git a/SeatsioDotNet.Test/SeatsioClientTest.cs b/SeatsioDotNet.Test/SeatsioClientTest.cs index d29065a..c2bd2da 100644 --- a/SeatsioDotNet.Test/SeatsioClientTest.cs +++ b/SeatsioDotNet.Test/SeatsioClientTest.cs @@ -67,9 +67,9 @@ protected SeatsioClient CreateSeatsioClient(string secretKey) return new SeatsioClient(secretKey, null, BaseUrl); } - protected SeatsioClient CreateSeatsioClient(string secretKey, long accountId) + protected SeatsioClient CreateSeatsioClient(string secretKey, string workspaceKey) { - return new SeatsioClient(secretKey, accountId, BaseUrl); + return new SeatsioClient(secretKey, workspaceKey, BaseUrl); } } } \ No newline at end of file diff --git a/SeatsioDotNet.Test/Subaccounts/RetrieveSubaccountTest.cs b/SeatsioDotNet.Test/Subaccounts/RetrieveSubaccountTest.cs index fb37706..96b6c52 100644 --- a/SeatsioDotNet.Test/Subaccounts/RetrieveSubaccountTest.cs +++ b/SeatsioDotNet.Test/Subaccounts/RetrieveSubaccountTest.cs @@ -17,7 +17,7 @@ public void Test() Assert.Equal(subaccount.PublicKey, retrievedSubaccount.PublicKey); Assert.Equal("joske", retrievedSubaccount.Name); Assert.True(retrievedSubaccount.Active); - Assert.True(retrievedSubaccount.AccountId > 0); + Assert.NotNull(retrievedSubaccount.workspaceKey); } } } \ No newline at end of file diff --git a/SeatsioDotNet.Test/AccountIdAuthenticationTest.cs b/SeatsioDotNet.Test/WorkspaceKeyAuthenticationTest.cs similarity index 63% rename from SeatsioDotNet.Test/AccountIdAuthenticationTest.cs rename to SeatsioDotNet.Test/WorkspaceKeyAuthenticationTest.cs index 56c234f..02cb08e 100644 --- a/SeatsioDotNet.Test/AccountIdAuthenticationTest.cs +++ b/SeatsioDotNet.Test/WorkspaceKeyAuthenticationTest.cs @@ -2,17 +2,17 @@ namespace SeatsioDotNet.Test { - public class AccountIdAuthenticationTest : SeatsioClientTest + public class WorkspaceKeyAuthenticationTest : SeatsioClientTest { [Fact] public void Test() { var subaccount = Client.Subaccounts.Create(); - var subaccountClient = CreateSeatsioClient(User.SecretKey, subaccount.AccountId); + var subaccountClient = CreateSeatsioClient(User.SecretKey, subaccount.workspaceKey); var holdToken = subaccountClient.HoldTokens.Create(); - Assert.Equal(subaccount.AccountId, holdToken.AccountId); + Assert.Equal(subaccount.workspaceKey, holdToken.workspaceKey); } } } \ No newline at end of file diff --git a/SeatsioDotNet/HoldTokens/HoldToken.cs b/SeatsioDotNet/HoldTokens/HoldToken.cs index d2ee45b..dc7e713 100644 --- a/SeatsioDotNet/HoldTokens/HoldToken.cs +++ b/SeatsioDotNet/HoldTokens/HoldToken.cs @@ -9,6 +9,6 @@ public class HoldToken public string Token { get; set; } public DateTimeOffset ExpiresAt { get; set; } public int ExpiresInSeconds { get; set; } - public long AccountId { get; set; } + public string workspaceKey { get; set; } } } \ No newline at end of file diff --git a/SeatsioDotNet/SeatsioClient.cs b/SeatsioDotNet/SeatsioClient.cs index 15ac1e5..7761c83 100644 --- a/SeatsioDotNet/SeatsioClient.cs +++ b/SeatsioDotNet/SeatsioClient.cs @@ -14,9 +14,9 @@ public class SeatsioClient public ChartReports.ChartReports ChartReports { get; } public UsageReports.UsageReports UsageReports { get; } - public SeatsioClient(string secretKey, long? accountId, string baseUrl) + public SeatsioClient(string secretKey, string workspaceKey, string baseUrl) { - var restClient = CreateRestClient(secretKey, accountId, baseUrl); + var restClient = CreateRestClient(secretKey, workspaceKey, baseUrl); Charts = new Charts.Charts(restClient); Events = new Events.Events(restClient); Accounts = new Accounts.Accounts(restClient); @@ -27,7 +27,7 @@ public SeatsioClient(string secretKey, long? accountId, string baseUrl) UsageReports = new UsageReports.UsageReports(restClient); } - public SeatsioClient(string secretKey, long? accountId) : this(secretKey, accountId, "https://api.seatsio.net") + public SeatsioClient(string secretKey, string workspaceKey) : this(secretKey, workspaceKey, "https://api.seatsio.net") { } @@ -35,13 +35,13 @@ public SeatsioClient(string secretKey) : this(secretKey, null) { } - private static RestClient CreateRestClient(string secretKey, long? accountId, string baseUrl) + private static RestClient CreateRestClient(string secretKey, string workspaceKey, string baseUrl) { var client = new RestClient(baseUrl); client.Authenticator = new HttpBasicAuthenticator(secretKey, null); - if (accountId != null) + if (workspaceKey != null) { - client.AddDefaultHeader("X-Account-ID", accountId.ToString()); + client.AddDefaultHeader("X-Workspace-Key", workspaceKey.ToString()); } return client; diff --git a/SeatsioDotNet/Subaccounts/Subaccount.cs b/SeatsioDotNet/Subaccounts/Subaccount.cs index aa5e91d..5173acb 100644 --- a/SeatsioDotNet/Subaccounts/Subaccount.cs +++ b/SeatsioDotNet/Subaccounts/Subaccount.cs @@ -3,7 +3,7 @@ public class Subaccount { public long Id { get; set; } - public long AccountId { get; set; } + public string workspaceKey { get; set; } public string SecretKey { get; set; } public string DesignerKey { get; set; } public string PublicKey { get; set; }