diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/BillingCustomerResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingCustomerResponseDataTest.cs new file mode 100644 index 0000000..ef8479f --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingCustomerResponseDataTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class BillingCustomerResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/BillingCustomerSubscriptionTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingCustomerSubscriptionTest.cs new file mode 100644 index 0000000..a1faae2 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingCustomerSubscriptionTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class BillingCustomerSubscriptionTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/BillingCustomerWithSubscriptionsResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingCustomerWithSubscriptionsResponseDataTest.cs new file mode 100644 index 0000000..b945837 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingCustomerWithSubscriptionsResponseDataTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class BillingCustomerWithSubscriptionsResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ComponentHydrateResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingPlanGroupResponseDataTest.cs similarity index 64% rename from src/SchematicHQ.Client.Test/Unit/Serialization/ComponentHydrateResponseDataTest.cs rename to src/SchematicHQ.Client.Test/Unit/Serialization/BillingPlanGroupResponseDataTest.cs index 6798a7c..3bf6ae8 100644 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/ComponentHydrateResponseDataTest.cs +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingPlanGroupResponseDataTest.cs @@ -5,4 +5,4 @@ namespace SchematicHQ.Client.Test; [TestFixture] -public class ComponentHydrateResponseDataTest { } +public class BillingPlanGroupResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ListProductsParamsTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingPlanTest.cs similarity index 69% rename from src/SchematicHQ.Client.Test/Unit/Serialization/ListProductsParamsTest.cs rename to src/SchematicHQ.Client.Test/Unit/Serialization/BillingPlanTest.cs index 1f8bf4d..95027f1 100644 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/ListProductsParamsTest.cs +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingPlanTest.cs @@ -5,4 +5,4 @@ namespace SchematicHQ.Client.Test; [TestFixture] -public class ListProductsParamsTest { } +public class BillingPlanTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/FlagCheckLogResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingPriceResponseDataTest.cs similarity index 66% rename from src/SchematicHQ.Client.Test/Unit/Serialization/FlagCheckLogResponseDataTest.cs rename to src/SchematicHQ.Client.Test/Unit/Serialization/BillingPriceResponseDataTest.cs index cbb504d..175953b 100644 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/FlagCheckLogResponseDataTest.cs +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingPriceResponseDataTest.cs @@ -5,4 +5,4 @@ namespace SchematicHQ.Client.Test; [TestFixture] -public class FlagCheckLogResponseDataTest { } +public class BillingPriceResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/BillingProductDetailResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingProductDetailResponseDataTest.cs new file mode 100644 index 0000000..6075d71 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingProductDetailResponseDataTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class BillingProductDetailResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/BillingProductForSubscriptionResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingProductForSubscriptionResponseDataTest.cs new file mode 100644 index 0000000..1b8e29b --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingProductForSubscriptionResponseDataTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class BillingProductForSubscriptionResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/CountFlagChecksParamsTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingProductPricingTest.cs similarity index 68% rename from src/SchematicHQ.Client.Test/Unit/Serialization/CountFlagChecksParamsTest.cs rename to src/SchematicHQ.Client.Test/Unit/Serialization/BillingProductPricingTest.cs index 87d1a06..94ebcb8 100644 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/CountFlagChecksParamsTest.cs +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingProductPricingTest.cs @@ -5,4 +5,4 @@ namespace SchematicHQ.Client.Test; [TestFixture] -public class CountFlagChecksParamsTest { } +public class BillingProductPricingTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/GetFlagCheckResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/CountCustomersParamsTest.cs similarity index 68% rename from src/SchematicHQ.Client.Test/Unit/Serialization/GetFlagCheckResponseTest.cs rename to src/SchematicHQ.Client.Test/Unit/Serialization/CountCustomersParamsTest.cs index d6ec14c..0a07554 100644 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/GetFlagCheckResponseTest.cs +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/CountCustomersParamsTest.cs @@ -5,4 +5,4 @@ namespace SchematicHQ.Client.Test; [TestFixture] -public class GetFlagCheckResponseTest { } +public class CountCustomersParamsTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ListCompanyPlansParamsTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/CountCustomersResponseTest.cs similarity index 67% rename from src/SchematicHQ.Client.Test/Unit/Serialization/ListCompanyPlansParamsTest.cs rename to src/SchematicHQ.Client.Test/Unit/Serialization/CountCustomersResponseTest.cs index 4937ebc..2594328 100644 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/ListCompanyPlansParamsTest.cs +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/CountCustomersResponseTest.cs @@ -5,4 +5,4 @@ namespace SchematicHQ.Client.Test; [TestFixture] -public class ListCompanyPlansParamsTest { } +public class CountCustomersResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/CreateBillingPlanGroupResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/CreateBillingPlanGroupResponseTest.cs new file mode 100644 index 0000000..188e132 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/CreateBillingPlanGroupResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class CreateBillingPlanGroupResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ListProductsResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/EventBodyFlagCheckTest.cs similarity index 68% rename from src/SchematicHQ.Client.Test/Unit/Serialization/ListProductsResponseTest.cs rename to src/SchematicHQ.Client.Test/Unit/Serialization/EventBodyFlagCheckTest.cs index a70d62a..b517bf0 100644 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/ListProductsResponseTest.cs +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/EventBodyFlagCheckTest.cs @@ -5,4 +5,4 @@ namespace SchematicHQ.Client.Test; [TestFixture] -public class ListProductsResponseTest { } +public class EventBodyFlagCheckTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/FlagCheckLogDetailResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/FlagCheckLogDetailResponseDataTest.cs deleted file mode 100644 index ab8200a..0000000 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/FlagCheckLogDetailResponseDataTest.cs +++ /dev/null @@ -1,8 +0,0 @@ -using NUnit.Framework; - -#nullable enable - -namespace SchematicHQ.Client.Test; - -[TestFixture] -public class FlagCheckLogDetailResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/GetBillingPlanGroupByAccountIdResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/GetBillingPlanGroupByAccountIdResponseTest.cs new file mode 100644 index 0000000..e726e50 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/GetBillingPlanGroupByAccountIdResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class GetBillingPlanGroupByAccountIdResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/GetLatestFlagChecksParamsTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/GetLatestFlagChecksParamsTest.cs deleted file mode 100644 index 99ca70e..0000000 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/GetLatestFlagChecksParamsTest.cs +++ /dev/null @@ -1,8 +0,0 @@ -using NUnit.Framework; - -#nullable enable - -namespace SchematicHQ.Client.Test; - -[TestFixture] -public class GetLatestFlagChecksParamsTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/GetLatestFlagChecksResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/GetLatestFlagChecksResponseTest.cs deleted file mode 100644 index f54dbf5..0000000 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/GetLatestFlagChecksResponseTest.cs +++ /dev/null @@ -1,8 +0,0 @@ -using NUnit.Framework; - -#nullable enable - -namespace SchematicHQ.Client.Test; - -[TestFixture] -public class GetLatestFlagChecksResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/HydrateComponentResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/HydrateComponentResponseTest.cs deleted file mode 100644 index 9bb4413..0000000 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/HydrateComponentResponseTest.cs +++ /dev/null @@ -1,8 +0,0 @@ -using NUnit.Framework; - -#nullable enable - -namespace SchematicHQ.Client.Test; - -[TestFixture] -public class HydrateComponentResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/CountFlagChecksResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ListBillingProductsParamsTest.cs similarity index 66% rename from src/SchematicHQ.Client.Test/Unit/Serialization/CountFlagChecksResponseTest.cs rename to src/SchematicHQ.Client.Test/Unit/Serialization/ListBillingProductsParamsTest.cs index f1d502f..72eae05 100644 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/CountFlagChecksResponseTest.cs +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/ListBillingProductsParamsTest.cs @@ -5,4 +5,4 @@ namespace SchematicHQ.Client.Test; [TestFixture] -public class CountFlagChecksResponseTest { } +public class ListBillingProductsParamsTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ListBillingProductsResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ListBillingProductsResponseTest.cs new file mode 100644 index 0000000..c5420b8 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/ListBillingProductsResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class ListBillingProductsResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ListCompanyPlansResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ListCompanyPlansResponseTest.cs deleted file mode 100644 index b5da53d..0000000 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/ListCompanyPlansResponseTest.cs +++ /dev/null @@ -1,8 +0,0 @@ -using NUnit.Framework; - -#nullable enable - -namespace SchematicHQ.Client.Test; - -[TestFixture] -public class ListCompanyPlansResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ListFlagChecksParamsTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ListCustomersParamsTest.cs similarity index 68% rename from src/SchematicHQ.Client.Test/Unit/Serialization/ListFlagChecksParamsTest.cs rename to src/SchematicHQ.Client.Test/Unit/Serialization/ListCustomersParamsTest.cs index 6192a73..f28b139 100644 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/ListFlagChecksParamsTest.cs +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/ListCustomersParamsTest.cs @@ -5,4 +5,4 @@ namespace SchematicHQ.Client.Test; [TestFixture] -public class ListFlagChecksParamsTest { } +public class ListCustomersParamsTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ListCustomersResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ListCustomersResponseTest.cs new file mode 100644 index 0000000..e4defff --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/ListCustomersResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class ListCustomersResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ListFlagChecksResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ListFlagChecksResponseTest.cs deleted file mode 100644 index 108b739..0000000 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/ListFlagChecksResponseTest.cs +++ /dev/null @@ -1,8 +0,0 @@ -using NUnit.Framework; - -#nullable enable - -namespace SchematicHQ.Client.Test; - -[TestFixture] -public class ListFlagChecksResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/CompanyPlanResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ListProductPricesParamsTest.cs similarity index 67% rename from src/SchematicHQ.Client.Test/Unit/Serialization/CompanyPlanResponseDataTest.cs rename to src/SchematicHQ.Client.Test/Unit/Serialization/ListProductPricesParamsTest.cs index 2c5436b..0fdc6bd 100644 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/CompanyPlanResponseDataTest.cs +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/ListProductPricesParamsTest.cs @@ -5,4 +5,4 @@ namespace SchematicHQ.Client.Test; [TestFixture] -public class CompanyPlanResponseDataTest { } +public class ListProductPricesParamsTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ListProductPricesResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ListProductPricesResponseTest.cs new file mode 100644 index 0000000..d0759ae --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/ListProductPricesResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class ListProductPricesResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/UpdateBillingPlanGroupResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/UpdateBillingPlanGroupResponseTest.cs new file mode 100644 index 0000000..d4847e8 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/UpdateBillingPlanGroupResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class UpdateBillingPlanGroupResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertBillingCustomerResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertBillingCustomerResponseTest.cs new file mode 100644 index 0000000..88284e8 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertBillingCustomerResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class UpsertBillingCustomerResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertBillingPriceResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertBillingPriceResponseTest.cs new file mode 100644 index 0000000..436112e --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertBillingPriceResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class UpsertBillingPriceResponseTest { } diff --git a/src/SchematicHQ.Client.sln b/src/SchematicHQ.Client.sln index 3f55b05..1215d84 100644 --- a/src/SchematicHQ.Client.sln +++ b/src/SchematicHQ.Client.sln @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client", "SchematicHQ.Client\SchematicHQ.Client.csproj", "{C30B50C0-036A-412F-B9A8-AD4F8F6F4BC1}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client", "SchematicHQ.Client\SchematicHQ.Client.csproj", "{F9CD1DE1-BFD1-43D5-A3A4-6D1CFCFA4337}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client.Test", "SchematicHQ.Client.Test\SchematicHQ.Client.Test.csproj", "{A59EAE67-B559-4E6F-A7C1-5E5C6633A3D3}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client.Test", "SchematicHQ.Client.Test\SchematicHQ.Client.Test.csproj", "{1FCA9B08-C3B5-4F1D-BEBD-36BFBB619D34}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -16,13 +16,13 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C30B50C0-036A-412F-B9A8-AD4F8F6F4BC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C30B50C0-036A-412F-B9A8-AD4F8F6F4BC1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C30B50C0-036A-412F-B9A8-AD4F8F6F4BC1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C30B50C0-036A-412F-B9A8-AD4F8F6F4BC1}.Release|Any CPU.Build.0 = Release|Any CPU - {A59EAE67-B559-4E6F-A7C1-5E5C6633A3D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A59EAE67-B559-4E6F-A7C1-5E5C6633A3D3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A59EAE67-B559-4E6F-A7C1-5E5C6633A3D3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A59EAE67-B559-4E6F-A7C1-5E5C6633A3D3}.Release|Any CPU.Build.0 = Release|Any CPU + {F9CD1DE1-BFD1-43D5-A3A4-6D1CFCFA4337}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F9CD1DE1-BFD1-43D5-A3A4-6D1CFCFA4337}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F9CD1DE1-BFD1-43D5-A3A4-6D1CFCFA4337}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F9CD1DE1-BFD1-43D5-A3A4-6D1CFCFA4337}.Release|Any CPU.Build.0 = Release|Any CPU + {1FCA9B08-C3B5-4F1D-BEBD-36BFBB619D34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1FCA9B08-C3B5-4F1D-BEBD-36BFBB619D34}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1FCA9B08-C3B5-4F1D-BEBD-36BFBB619D34}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1FCA9B08-C3B5-4F1D-BEBD-36BFBB619D34}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/src/SchematicHQ.Client/Billing/BillingClient.cs b/src/SchematicHQ.Client/Billing/BillingClient.cs index 1cfd724..6db2171 100644 --- a/src/SchematicHQ.Client/Billing/BillingClient.cs +++ b/src/SchematicHQ.Client/Billing/BillingClient.cs @@ -16,6 +16,221 @@ public BillingClient(RawClient client) _client = client; } + public async Task UpsertBillingCustomerAsync( + CreateBillingCustomerRequestBody request + ) + { + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + Method = HttpMethod.Post, + Path = "billing/customer/upsert", + Body = request + } + ); + var responseBody = await response.Raw.Content.ReadAsStringAsync(); + if (response.StatusCode is >= 200 and < 400) + { + return JsonSerializer.Deserialize(responseBody)!; + } + throw new Exception(responseBody); + } + + public async Task ListCustomersAsync(ListCustomersRequest request) + { + var _query = new Dictionary() { }; + if (request.Name != null) + { + _query["name"] = request.Name; + } + if (request.FailedToImport != null) + { + _query["failed_to_import"] = request.FailedToImport.ToString(); + } + if (request.Q != null) + { + _query["q"] = request.Q; + } + if (request.Limit != null) + { + _query["limit"] = request.Limit.ToString(); + } + if (request.Offset != null) + { + _query["offset"] = request.Offset.ToString(); + } + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + Method = HttpMethod.Get, + Path = "billing/customers", + Query = _query + } + ); + var responseBody = await response.Raw.Content.ReadAsStringAsync(); + if (response.StatusCode is >= 200 and < 400) + { + return JsonSerializer.Deserialize(responseBody)!; + } + throw new Exception(responseBody); + } + + public async Task CountCustomersAsync(CountCustomersRequest request) + { + var _query = new Dictionary() { }; + if (request.Name != null) + { + _query["name"] = request.Name; + } + if (request.FailedToImport != null) + { + _query["failed_to_import"] = request.FailedToImport.ToString(); + } + if (request.Q != null) + { + _query["q"] = request.Q; + } + if (request.Limit != null) + { + _query["limit"] = request.Limit.ToString(); + } + if (request.Offset != null) + { + _query["offset"] = request.Offset.ToString(); + } + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + Method = HttpMethod.Get, + Path = "billing/customers/count", + Query = _query + } + ); + var responseBody = await response.Raw.Content.ReadAsStringAsync(); + if (response.StatusCode is >= 200 and < 400) + { + return JsonSerializer.Deserialize(responseBody)!; + } + throw new Exception(responseBody); + } + + public async Task GetBillingPlanGroupByAccountIdAsync() + { + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest { Method = HttpMethod.Get, Path = "billing/plan-group" } + ); + var responseBody = await response.Raw.Content.ReadAsStringAsync(); + if (response.StatusCode is >= 200 and < 400) + { + return JsonSerializer.Deserialize( + responseBody + )!; + } + throw new Exception(responseBody); + } + + public async Task CreateBillingPlanGroupAsync( + CreateBillingPlanGroupRequestBody request + ) + { + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + Method = HttpMethod.Post, + Path = "billing/plan-group", + Body = request + } + ); + var responseBody = await response.Raw.Content.ReadAsStringAsync(); + if (response.StatusCode is >= 200 and < 400) + { + return JsonSerializer.Deserialize(responseBody)!; + } + throw new Exception(responseBody); + } + + public async Task UpdateBillingPlanGroupAsync( + string billingId, + UpdateBillingPlanGroupRequestBody request + ) + { + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + Method = HttpMethod.Put, + Path = $"billing/plan-group/{billingId}", + Body = request + } + ); + var responseBody = await response.Raw.Content.ReadAsStringAsync(); + if (response.StatusCode is >= 200 and < 400) + { + return JsonSerializer.Deserialize(responseBody)!; + } + throw new Exception(responseBody); + } + + public async Task UpsertBillingPriceAsync( + CreateBillingPriceRequestBody request + ) + { + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + Method = HttpMethod.Post, + Path = "billing/price/upsert", + Body = request + } + ); + var responseBody = await response.Raw.Content.ReadAsStringAsync(); + if (response.StatusCode is >= 200 and < 400) + { + return JsonSerializer.Deserialize(responseBody)!; + } + throw new Exception(responseBody); + } + + public async Task ListProductPricesAsync( + ListProductPricesRequest request + ) + { + var _query = new Dictionary() { }; + if (request.Ids != null) + { + _query["ids"] = request.Ids; + } + if (request.Name != null) + { + _query["name"] = request.Name; + } + if (request.Q != null) + { + _query["q"] = request.Q; + } + if (request.Limit != null) + { + _query["limit"] = request.Limit.ToString(); + } + if (request.Offset != null) + { + _query["offset"] = request.Offset.ToString(); + } + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + Method = HttpMethod.Get, + Path = "billing/product/prices", + Query = _query + } + ); + var responseBody = await response.Raw.Content.ReadAsStringAsync(); + if (response.StatusCode is >= 200 and < 400) + { + return JsonSerializer.Deserialize(responseBody)!; + } + throw new Exception(responseBody); + } + public async Task UpsertBillingProductAsync( CreateBillingProductRequestBody request ) @@ -36,7 +251,9 @@ CreateBillingProductRequestBody request throw new Exception(responseBody); } - public async Task ListProductsAsync(ListProductsRequest request) + public async Task ListBillingProductsAsync( + ListBillingProductsRequest request + ) { var _query = new Dictionary() { }; if (request.Ids != null) @@ -70,7 +287,7 @@ public async Task ListProductsAsync(ListProductsRequest re var responseBody = await response.Raw.Content.ReadAsStringAsync(); if (response.StatusCode is >= 200 and < 400) { - return JsonSerializer.Deserialize(responseBody)!; + return JsonSerializer.Deserialize(responseBody)!; } throw new Exception(responseBody); } diff --git a/src/SchematicHQ.Client/Features/Requests/CountFlagChecksRequest.cs b/src/SchematicHQ.Client/Billing/Requests/CountCustomersRequest.cs similarity index 61% rename from src/SchematicHQ.Client/Features/Requests/CountFlagChecksRequest.cs rename to src/SchematicHQ.Client/Billing/Requests/CountCustomersRequest.cs index 2d044c7..b9952ac 100644 --- a/src/SchematicHQ.Client/Features/Requests/CountFlagChecksRequest.cs +++ b/src/SchematicHQ.Client/Billing/Requests/CountCustomersRequest.cs @@ -1,12 +1,12 @@ namespace SchematicHQ.Client; -public record CountFlagChecksRequest +public record CountCustomersRequest { - public string? FlagId { get; init; } + public string? Name { get; init; } - public string? FlagIds { get; init; } + public bool? FailedToImport { get; init; } - public string? Id { get; init; } + public string? Q { get; init; } /// /// Page limit (default 100) diff --git a/src/SchematicHQ.Client/Billing/Requests/CreateBillingCustomerRequestBody.cs b/src/SchematicHQ.Client/Billing/Requests/CreateBillingCustomerRequestBody.cs new file mode 100644 index 0000000..d514ba1 --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Requests/CreateBillingCustomerRequestBody.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record CreateBillingCustomerRequestBody +{ + [JsonPropertyName("company_id")] + public string? CompanyId { get; init; } + + [JsonPropertyName("email")] + public required string Email { get; init; } + + [JsonPropertyName("external_id")] + public required string ExternalId { get; init; } + + [JsonPropertyName("failed_to_import")] + public required bool FailedToImport { get; init; } + + [JsonPropertyName("meta")] + public Dictionary Meta { get; init; } = new Dictionary(); + + [JsonPropertyName("name")] + public required string Name { get; init; } +} diff --git a/src/SchematicHQ.Client/Billing/Requests/CreateBillingPlanGroupRequestBody.cs b/src/SchematicHQ.Client/Billing/Requests/CreateBillingPlanGroupRequestBody.cs new file mode 100644 index 0000000..7a4272d --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Requests/CreateBillingPlanGroupRequestBody.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record CreateBillingPlanGroupRequestBody +{ + [JsonPropertyName("default_plan_id")] + public string? DefaultPlanId { get; init; } + + [JsonPropertyName("plan_ids")] + public IEnumerable PlanIds { get; init; } = new List(); +} diff --git a/src/SchematicHQ.Client/Billing/Requests/CreateBillingPriceRequestBody.cs b/src/SchematicHQ.Client/Billing/Requests/CreateBillingPriceRequestBody.cs new file mode 100644 index 0000000..61f7de8 --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Requests/CreateBillingPriceRequestBody.cs @@ -0,0 +1,20 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record CreateBillingPriceRequestBody +{ + [JsonPropertyName("interval")] + public required string Interval { get; init; } + + [JsonPropertyName("price")] + public required int Price { get; init; } + + [JsonPropertyName("price_external_id")] + public required string PriceExternalId { get; init; } + + [JsonPropertyName("product_external_id")] + public required string ProductExternalId { get; init; } +} diff --git a/src/SchematicHQ.Client/Billing/Requests/CreateBillingSubscriptionsRequestBody.cs b/src/SchematicHQ.Client/Billing/Requests/CreateBillingSubscriptionsRequestBody.cs index c42bd31..dcaca86 100644 --- a/src/SchematicHQ.Client/Billing/Requests/CreateBillingSubscriptionsRequestBody.cs +++ b/src/SchematicHQ.Client/Billing/Requests/CreateBillingSubscriptionsRequestBody.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using SchematicHQ.Client; #nullable enable @@ -15,9 +16,19 @@ public record CreateBillingSubscriptionsRequestBody [JsonPropertyName("interval")] public string? Interval { get; init; } + [JsonPropertyName("metadata")] + public Dictionary? Metadata { get; init; } + [JsonPropertyName("product_external_ids")] - public IEnumerable ProductExternalIds { get; init; } = new List(); + public IEnumerable ProductExternalIds { get; init; } = + new List(); + + [JsonPropertyName("status")] + public string? Status { get; init; } [JsonPropertyName("subscription_external_id")] public required string SubscriptionExternalId { get; init; } + + [JsonPropertyName("total_price")] + public required int TotalPrice { get; init; } } diff --git a/src/SchematicHQ.Client/Companies/Requests/ListCompanyPlansRequest.cs b/src/SchematicHQ.Client/Billing/Requests/ListBillingProductsRequest.cs similarity index 61% rename from src/SchematicHQ.Client/Companies/Requests/ListCompanyPlansRequest.cs rename to src/SchematicHQ.Client/Billing/Requests/ListBillingProductsRequest.cs index 1676cca..c050194 100644 --- a/src/SchematicHQ.Client/Companies/Requests/ListCompanyPlansRequest.cs +++ b/src/SchematicHQ.Client/Billing/Requests/ListBillingProductsRequest.cs @@ -1,10 +1,12 @@ namespace SchematicHQ.Client; -public record ListCompanyPlansRequest +public record ListBillingProductsRequest { - public string? CompanyId { get; init; } + public string? Ids { get; init; } - public string? PlanId { get; init; } + public string? Name { get; init; } + + public string? Q { get; init; } /// /// Page limit (default 100) diff --git a/src/SchematicHQ.Client/Features/Requests/ListFlagChecksRequest.cs b/src/SchematicHQ.Client/Billing/Requests/ListCustomersRequest.cs similarity index 61% rename from src/SchematicHQ.Client/Features/Requests/ListFlagChecksRequest.cs rename to src/SchematicHQ.Client/Billing/Requests/ListCustomersRequest.cs index 874f842..78d5ee6 100644 --- a/src/SchematicHQ.Client/Features/Requests/ListFlagChecksRequest.cs +++ b/src/SchematicHQ.Client/Billing/Requests/ListCustomersRequest.cs @@ -1,12 +1,12 @@ namespace SchematicHQ.Client; -public record ListFlagChecksRequest +public record ListCustomersRequest { - public string? FlagId { get; init; } + public string? Name { get; init; } - public string? FlagIds { get; init; } + public bool? FailedToImport { get; init; } - public string? Id { get; init; } + public string? Q { get; init; } /// /// Page limit (default 100) diff --git a/src/SchematicHQ.Client/Billing/Requests/ListProductsRequest.cs b/src/SchematicHQ.Client/Billing/Requests/ListProductPricesRequest.cs similarity index 90% rename from src/SchematicHQ.Client/Billing/Requests/ListProductsRequest.cs rename to src/SchematicHQ.Client/Billing/Requests/ListProductPricesRequest.cs index 09bf7f0..1eeb28a 100644 --- a/src/SchematicHQ.Client/Billing/Requests/ListProductsRequest.cs +++ b/src/SchematicHQ.Client/Billing/Requests/ListProductPricesRequest.cs @@ -1,6 +1,6 @@ namespace SchematicHQ.Client; -public record ListProductsRequest +public record ListProductPricesRequest { public string? Ids { get; init; } diff --git a/src/SchematicHQ.Client/Billing/Requests/UpdateBillingPlanGroupRequestBody.cs b/src/SchematicHQ.Client/Billing/Requests/UpdateBillingPlanGroupRequestBody.cs new file mode 100644 index 0000000..03c8eb5 --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Requests/UpdateBillingPlanGroupRequestBody.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record UpdateBillingPlanGroupRequestBody +{ + [JsonPropertyName("default_plan_id")] + public string? DefaultPlanId { get; init; } + + [JsonPropertyName("plan_ids")] + public IEnumerable PlanIds { get; init; } = new List(); +} diff --git a/src/SchematicHQ.Client/Features/Types/ListFlagChecksParams.cs b/src/SchematicHQ.Client/Billing/Types/CountCustomersParams.cs similarity index 58% rename from src/SchematicHQ.Client/Features/Types/ListFlagChecksParams.cs rename to src/SchematicHQ.Client/Billing/Types/CountCustomersParams.cs index ca22535..eed656c 100644 --- a/src/SchematicHQ.Client/Features/Types/ListFlagChecksParams.cs +++ b/src/SchematicHQ.Client/Billing/Types/CountCustomersParams.cs @@ -4,16 +4,10 @@ namespace SchematicHQ.Client; -public record ListFlagChecksParams +public record CountCustomersParams { - [JsonPropertyName("flag_id")] - public string? FlagId { get; init; } - - [JsonPropertyName("flag_ids")] - public IEnumerable? FlagIds { get; init; } - - [JsonPropertyName("id")] - public string? Id { get; init; } + [JsonPropertyName("failed_to_import")] + public bool? FailedToImport { get; init; } /// /// Page limit (default 100) @@ -21,9 +15,15 @@ public record ListFlagChecksParams [JsonPropertyName("limit")] public int? Limit { get; init; } + [JsonPropertyName("name")] + public string? Name { get; init; } + /// /// Page offset (default 0) /// [JsonPropertyName("offset")] public int? Offset { get; init; } + + [JsonPropertyName("q")] + public string? Q { get; init; } } diff --git a/src/SchematicHQ.Client/Features/Types/CountFlagChecksResponse.cs b/src/SchematicHQ.Client/Billing/Types/CountCustomersResponse.cs similarity index 74% rename from src/SchematicHQ.Client/Features/Types/CountFlagChecksResponse.cs rename to src/SchematicHQ.Client/Billing/Types/CountCustomersResponse.cs index 5b56fe2..3d23553 100644 --- a/src/SchematicHQ.Client/Features/Types/CountFlagChecksResponse.cs +++ b/src/SchematicHQ.Client/Billing/Types/CountCustomersResponse.cs @@ -5,7 +5,7 @@ namespace SchematicHQ.Client; -public record CountFlagChecksResponse +public record CountCustomersResponse { [JsonPropertyName("data")] public required CountResponse Data { get; init; } @@ -14,5 +14,5 @@ public record CountFlagChecksResponse /// Input parameters /// [JsonPropertyName("params")] - public required CountFlagChecksParams Params { get; init; } + public required CountCustomersParams Params { get; init; } } diff --git a/src/SchematicHQ.Client/Components/Types/HydrateComponentResponse.cs b/src/SchematicHQ.Client/Billing/Types/CreateBillingPlanGroupResponse.cs similarity index 76% rename from src/SchematicHQ.Client/Components/Types/HydrateComponentResponse.cs rename to src/SchematicHQ.Client/Billing/Types/CreateBillingPlanGroupResponse.cs index 2a0e2bc..3a00501 100644 --- a/src/SchematicHQ.Client/Components/Types/HydrateComponentResponse.cs +++ b/src/SchematicHQ.Client/Billing/Types/CreateBillingPlanGroupResponse.cs @@ -5,10 +5,10 @@ namespace SchematicHQ.Client; -public record HydrateComponentResponse +public record CreateBillingPlanGroupResponse { [JsonPropertyName("data")] - public required ComponentHydrateResponseData Data { get; init; } + public required BillingPlanGroupResponseData Data { get; init; } /// /// Input parameters diff --git a/src/SchematicHQ.Client/Billing/Types/GetBillingPlanGroupByAccountIdResponse.cs b/src/SchematicHQ.Client/Billing/Types/GetBillingPlanGroupByAccountIdResponse.cs new file mode 100644 index 0000000..e71bfec --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Types/GetBillingPlanGroupByAccountIdResponse.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record GetBillingPlanGroupByAccountIdResponse +{ + [JsonPropertyName("data")] + public required BillingPlanGroupResponseData Data { get; init; } + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public Dictionary Params { get; init; } = new Dictionary(); +} diff --git a/src/SchematicHQ.Client/Companies/Types/ListCompanyPlansParams.cs b/src/SchematicHQ.Client/Billing/Types/ListBillingProductsParams.cs similarity index 59% rename from src/SchematicHQ.Client/Companies/Types/ListCompanyPlansParams.cs rename to src/SchematicHQ.Client/Billing/Types/ListBillingProductsParams.cs index 7d4d398..479642d 100644 --- a/src/SchematicHQ.Client/Companies/Types/ListCompanyPlansParams.cs +++ b/src/SchematicHQ.Client/Billing/Types/ListBillingProductsParams.cs @@ -4,10 +4,10 @@ namespace SchematicHQ.Client; -public record ListCompanyPlansParams +public record ListBillingProductsParams { - [JsonPropertyName("company_id")] - public string? CompanyId { get; init; } + [JsonPropertyName("ids")] + public IEnumerable? Ids { get; init; } /// /// Page limit (default 100) @@ -15,12 +15,15 @@ public record ListCompanyPlansParams [JsonPropertyName("limit")] public int? Limit { get; init; } + [JsonPropertyName("name")] + public string? Name { get; init; } + /// /// Page offset (default 0) /// [JsonPropertyName("offset")] public int? Offset { get; init; } - [JsonPropertyName("plan_id")] - public string? PlanId { get; init; } + [JsonPropertyName("q")] + public string? Q { get; init; } } diff --git a/src/SchematicHQ.Client/Features/Types/ListFlagChecksResponse.cs b/src/SchematicHQ.Client/Billing/Types/ListBillingProductsResponse.cs similarity index 56% rename from src/SchematicHQ.Client/Features/Types/ListFlagChecksResponse.cs rename to src/SchematicHQ.Client/Billing/Types/ListBillingProductsResponse.cs index 6fad526..952127a 100644 --- a/src/SchematicHQ.Client/Features/Types/ListFlagChecksResponse.cs +++ b/src/SchematicHQ.Client/Billing/Types/ListBillingProductsResponse.cs @@ -5,18 +5,18 @@ namespace SchematicHQ.Client; -public record ListFlagChecksResponse +public record ListBillingProductsResponse { /// /// The returned resources /// [JsonPropertyName("data")] - public IEnumerable Data { get; init; } = - new List(); + public IEnumerable Data { get; init; } = + new List(); /// /// Input parameters /// [JsonPropertyName("params")] - public required ListFlagChecksParams Params { get; init; } + public required ListBillingProductsParams Params { get; init; } } diff --git a/src/SchematicHQ.Client/Features/Types/CountFlagChecksParams.cs b/src/SchematicHQ.Client/Billing/Types/ListCustomersParams.cs similarity index 58% rename from src/SchematicHQ.Client/Features/Types/CountFlagChecksParams.cs rename to src/SchematicHQ.Client/Billing/Types/ListCustomersParams.cs index 9486b4b..15a6780 100644 --- a/src/SchematicHQ.Client/Features/Types/CountFlagChecksParams.cs +++ b/src/SchematicHQ.Client/Billing/Types/ListCustomersParams.cs @@ -4,16 +4,10 @@ namespace SchematicHQ.Client; -public record CountFlagChecksParams +public record ListCustomersParams { - [JsonPropertyName("flag_id")] - public string? FlagId { get; init; } - - [JsonPropertyName("flag_ids")] - public IEnumerable? FlagIds { get; init; } - - [JsonPropertyName("id")] - public string? Id { get; init; } + [JsonPropertyName("failed_to_import")] + public bool? FailedToImport { get; init; } /// /// Page limit (default 100) @@ -21,9 +15,15 @@ public record CountFlagChecksParams [JsonPropertyName("limit")] public int? Limit { get; init; } + [JsonPropertyName("name")] + public string? Name { get; init; } + /// /// Page offset (default 0) /// [JsonPropertyName("offset")] public int? Offset { get; init; } + + [JsonPropertyName("q")] + public string? Q { get; init; } } diff --git a/src/SchematicHQ.Client/Billing/Types/ListProductsResponse.cs b/src/SchematicHQ.Client/Billing/Types/ListCustomersResponse.cs similarity index 55% rename from src/SchematicHQ.Client/Billing/Types/ListProductsResponse.cs rename to src/SchematicHQ.Client/Billing/Types/ListCustomersResponse.cs index 386858a..adac147 100644 --- a/src/SchematicHQ.Client/Billing/Types/ListProductsResponse.cs +++ b/src/SchematicHQ.Client/Billing/Types/ListCustomersResponse.cs @@ -5,18 +5,18 @@ namespace SchematicHQ.Client; -public record ListProductsResponse +public record ListCustomersResponse { /// /// The returned resources /// [JsonPropertyName("data")] - public IEnumerable Data { get; init; } = - new List(); + public IEnumerable Data { get; init; } = + new List(); /// /// Input parameters /// [JsonPropertyName("params")] - public required ListProductsParams Params { get; init; } + public required ListCustomersParams Params { get; init; } } diff --git a/src/SchematicHQ.Client/Billing/Types/ListProductsParams.cs b/src/SchematicHQ.Client/Billing/Types/ListProductPricesParams.cs similarity index 93% rename from src/SchematicHQ.Client/Billing/Types/ListProductsParams.cs rename to src/SchematicHQ.Client/Billing/Types/ListProductPricesParams.cs index c091460..0bfc512 100644 --- a/src/SchematicHQ.Client/Billing/Types/ListProductsParams.cs +++ b/src/SchematicHQ.Client/Billing/Types/ListProductPricesParams.cs @@ -4,7 +4,7 @@ namespace SchematicHQ.Client; -public record ListProductsParams +public record ListProductPricesParams { [JsonPropertyName("ids")] public IEnumerable? Ids { get; init; } diff --git a/src/SchematicHQ.Client/Features/Types/GetLatestFlagChecksResponse.cs b/src/SchematicHQ.Client/Billing/Types/ListProductPricesResponse.cs similarity index 59% rename from src/SchematicHQ.Client/Features/Types/GetLatestFlagChecksResponse.cs rename to src/SchematicHQ.Client/Billing/Types/ListProductPricesResponse.cs index bf13cd4..7ed59d1 100644 --- a/src/SchematicHQ.Client/Features/Types/GetLatestFlagChecksResponse.cs +++ b/src/SchematicHQ.Client/Billing/Types/ListProductPricesResponse.cs @@ -5,18 +5,18 @@ namespace SchematicHQ.Client; -public record GetLatestFlagChecksResponse +public record ListProductPricesResponse { /// /// The returned resources /// [JsonPropertyName("data")] - public IEnumerable Data { get; init; } = - new List(); + public IEnumerable Data { get; init; } = + new List(); /// /// Input parameters /// [JsonPropertyName("params")] - public required GetLatestFlagChecksParams Params { get; init; } + public required ListProductPricesParams Params { get; init; } } diff --git a/src/SchematicHQ.Client/Billing/Types/UpdateBillingPlanGroupResponse.cs b/src/SchematicHQ.Client/Billing/Types/UpdateBillingPlanGroupResponse.cs new file mode 100644 index 0000000..c7f3ebe --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Types/UpdateBillingPlanGroupResponse.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record UpdateBillingPlanGroupResponse +{ + [JsonPropertyName("data")] + public required BillingPlanGroupResponseData Data { get; init; } + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public Dictionary Params { get; init; } = new Dictionary(); +} diff --git a/src/SchematicHQ.Client/Billing/Types/UpsertBillingCustomerResponse.cs b/src/SchematicHQ.Client/Billing/Types/UpsertBillingCustomerResponse.cs new file mode 100644 index 0000000..7686f1f --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Types/UpsertBillingCustomerResponse.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record UpsertBillingCustomerResponse +{ + [JsonPropertyName("data")] + public required BillingCustomerResponseData Data { get; init; } + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public Dictionary Params { get; init; } = new Dictionary(); +} diff --git a/src/SchematicHQ.Client/Features/Types/GetFlagCheckResponse.cs b/src/SchematicHQ.Client/Billing/Types/UpsertBillingPriceResponse.cs similarity index 76% rename from src/SchematicHQ.Client/Features/Types/GetFlagCheckResponse.cs rename to src/SchematicHQ.Client/Billing/Types/UpsertBillingPriceResponse.cs index 4fd8d36..2285c3e 100644 --- a/src/SchematicHQ.Client/Features/Types/GetFlagCheckResponse.cs +++ b/src/SchematicHQ.Client/Billing/Types/UpsertBillingPriceResponse.cs @@ -5,10 +5,10 @@ namespace SchematicHQ.Client; -public record GetFlagCheckResponse +public record UpsertBillingPriceResponse { [JsonPropertyName("data")] - public required FlagCheckLogDetailResponseData Data { get; init; } + public required BillingPriceResponseData Data { get; init; } /// /// Input parameters diff --git a/src/SchematicHQ.Client/Companies/CompaniesClient.cs b/src/SchematicHQ.Client/Companies/CompaniesClient.cs index cd72421..aef9939 100644 --- a/src/SchematicHQ.Client/Companies/CompaniesClient.cs +++ b/src/SchematicHQ.Client/Companies/CompaniesClient.cs @@ -316,43 +316,6 @@ string companyMembershipId throw new Exception(responseBody); } - public async Task ListCompanyPlansAsync( - ListCompanyPlansRequest request - ) - { - var _query = new Dictionary() { }; - if (request.CompanyId != null) - { - _query["company_id"] = request.CompanyId; - } - if (request.PlanId != null) - { - _query["plan_id"] = request.PlanId; - } - if (request.Limit != null) - { - _query["limit"] = request.Limit.ToString(); - } - if (request.Offset != null) - { - _query["offset"] = request.Offset.ToString(); - } - var response = await _client.MakeRequestAsync( - new RawClient.JsonApiRequest - { - Method = HttpMethod.Get, - Path = "company-plans", - Query = _query - } - ); - var responseBody = await response.Raw.Content.ReadAsStringAsync(); - if (response.StatusCode is >= 200 and < 400) - { - return JsonSerializer.Deserialize(responseBody)!; - } - throw new Exception(responseBody); - } - public async Task GetActiveCompanySubscriptionAsync( GetActiveCompanySubscriptionRequest request ) diff --git a/src/SchematicHQ.Client/Companies/Types/ListCompanyPlansResponse.cs b/src/SchematicHQ.Client/Companies/Types/ListCompanyPlansResponse.cs deleted file mode 100644 index f3651b3..0000000 --- a/src/SchematicHQ.Client/Companies/Types/ListCompanyPlansResponse.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Text.Json.Serialization; -using SchematicHQ.Client; - -#nullable enable - -namespace SchematicHQ.Client; - -public record ListCompanyPlansResponse -{ - /// - /// The returned resources - /// - [JsonPropertyName("data")] - public IEnumerable Data { get; init; } = - new List(); - - /// - /// Input parameters - /// - [JsonPropertyName("params")] - public required ListCompanyPlansParams Params { get; init; } -} diff --git a/src/SchematicHQ.Client/Components/ComponentsClient.cs b/src/SchematicHQ.Client/Components/ComponentsClient.cs index 1f813de..266f819 100644 --- a/src/SchematicHQ.Client/Components/ComponentsClient.cs +++ b/src/SchematicHQ.Client/Components/ComponentsClient.cs @@ -122,23 +122,6 @@ public async Task DeleteComponentAsync(string component throw new Exception(responseBody); } - public async Task HydrateComponentAsync(string componentId) - { - var response = await _client.MakeRequestAsync( - new RawClient.JsonApiRequest - { - Method = HttpMethod.Get, - Path = $"components/{componentId}/hydrate" - } - ); - var responseBody = await response.Raw.Content.ReadAsStringAsync(); - if (response.StatusCode is >= 200 and < 400) - { - return JsonSerializer.Deserialize(responseBody)!; - } - throw new Exception(responseBody); - } - public async Task CountComponentsAsync(CountComponentsRequest request) { var _query = new Dictionary() { }; diff --git a/src/SchematicHQ.Client/Components/Requests/CreateComponentRequestBody.cs b/src/SchematicHQ.Client/Components/Requests/CreateComponentRequestBody.cs index ee2a523..2ab60f3 100644 --- a/src/SchematicHQ.Client/Components/Requests/CreateComponentRequestBody.cs +++ b/src/SchematicHQ.Client/Components/Requests/CreateComponentRequestBody.cs @@ -8,7 +8,7 @@ namespace SchematicHQ.Client; public record CreateComponentRequestBody { [JsonPropertyName("ast")] - public IEnumerable Ast { get; init; } = new List(); + public Dictionary? Ast { get; init; } [JsonPropertyName("entity_type")] public required CreateComponentRequestBodyEntityType EntityType { get; init; } diff --git a/src/SchematicHQ.Client/Components/Requests/UpdateComponentRequestBody.cs b/src/SchematicHQ.Client/Components/Requests/UpdateComponentRequestBody.cs index 36f1c9c..449667c 100644 --- a/src/SchematicHQ.Client/Components/Requests/UpdateComponentRequestBody.cs +++ b/src/SchematicHQ.Client/Components/Requests/UpdateComponentRequestBody.cs @@ -8,7 +8,7 @@ namespace SchematicHQ.Client; public record UpdateComponentRequestBody { [JsonPropertyName("ast")] - public IEnumerable? Ast { get; init; } + public Dictionary? Ast { get; init; } [JsonPropertyName("entity_type")] public UpdateComponentRequestBodyEntityType? EntityType { get; init; } diff --git a/src/SchematicHQ.Client/Events/EventsClient.cs b/src/SchematicHQ.Client/Events/EventsClient.cs index 2e68b05..1ab2721 100644 --- a/src/SchematicHQ.Client/Events/EventsClient.cs +++ b/src/SchematicHQ.Client/Events/EventsClient.cs @@ -93,14 +93,22 @@ public async Task ListEventsAsync(ListEventsRequest request) { _query["company_id"] = request.CompanyId; } - if (request.UserId != null) - { - _query["user_id"] = request.UserId; - } if (request.EventSubtype != null) { _query["event_subtype"] = request.EventSubtype; } + if (request.EventTypes != null) + { + _query["event_types"] = request.EventTypes; + } + if (request.FlagId != null) + { + _query["flag_id"] = request.FlagId; + } + if (request.UserId != null) + { + _query["user_id"] = request.UserId; + } if (request.Limit != null) { _query["limit"] = request.Limit.ToString(); diff --git a/src/SchematicHQ.Client/Events/Requests/ListEventsRequest.cs b/src/SchematicHQ.Client/Events/Requests/ListEventsRequest.cs index 73f9304..ac9d447 100644 --- a/src/SchematicHQ.Client/Events/Requests/ListEventsRequest.cs +++ b/src/SchematicHQ.Client/Events/Requests/ListEventsRequest.cs @@ -4,10 +4,14 @@ public record ListEventsRequest { public string? CompanyId { get; init; } - public string? UserId { get; init; } - public string? EventSubtype { get; init; } + public string? EventTypes { get; init; } + + public string? FlagId { get; init; } + + public string? UserId { get; init; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Events/Types/ListEventsParams.cs b/src/SchematicHQ.Client/Events/Types/ListEventsParams.cs index 0434a8e..7e75e43 100644 --- a/src/SchematicHQ.Client/Events/Types/ListEventsParams.cs +++ b/src/SchematicHQ.Client/Events/Types/ListEventsParams.cs @@ -12,6 +12,12 @@ public record ListEventsParams [JsonPropertyName("event_subtype")] public string? EventSubtype { get; init; } + [JsonPropertyName("event_types")] + public IEnumerable? EventTypes { get; init; } + + [JsonPropertyName("flag_id")] + public string? FlagId { get; init; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Features/FeaturesClient.cs b/src/SchematicHQ.Client/Features/FeaturesClient.cs index c5f8fbc..f91eeb7 100644 --- a/src/SchematicHQ.Client/Features/FeaturesClient.cs +++ b/src/SchematicHQ.Client/Features/FeaturesClient.cs @@ -249,142 +249,6 @@ public async Task CountFeaturesAsync(CountFeaturesRequest throw new Exception(responseBody); } - public async Task ListFlagChecksAsync(ListFlagChecksRequest request) - { - var _query = new Dictionary() { }; - if (request.FlagId != null) - { - _query["flag_id"] = request.FlagId; - } - if (request.FlagIds != null) - { - _query["flag_ids"] = request.FlagIds; - } - if (request.Id != null) - { - _query["id"] = request.Id; - } - if (request.Limit != null) - { - _query["limit"] = request.Limit.ToString(); - } - if (request.Offset != null) - { - _query["offset"] = request.Offset.ToString(); - } - var response = await _client.MakeRequestAsync( - new RawClient.JsonApiRequest - { - Method = HttpMethod.Get, - Path = "flag-checks", - Query = _query - } - ); - var responseBody = await response.Raw.Content.ReadAsStringAsync(); - if (response.StatusCode is >= 200 and < 400) - { - return JsonSerializer.Deserialize(responseBody)!; - } - throw new Exception(responseBody); - } - - public async Task GetFlagCheckAsync(string flagCheckId) - { - var response = await _client.MakeRequestAsync( - new RawClient.JsonApiRequest - { - Method = HttpMethod.Get, - Path = $"flag-checks/{flagCheckId}" - } - ); - var responseBody = await response.Raw.Content.ReadAsStringAsync(); - if (response.StatusCode is >= 200 and < 400) - { - return JsonSerializer.Deserialize(responseBody)!; - } - throw new Exception(responseBody); - } - - public async Task CountFlagChecksAsync(CountFlagChecksRequest request) - { - var _query = new Dictionary() { }; - if (request.FlagId != null) - { - _query["flag_id"] = request.FlagId; - } - if (request.FlagIds != null) - { - _query["flag_ids"] = request.FlagIds; - } - if (request.Id != null) - { - _query["id"] = request.Id; - } - if (request.Limit != null) - { - _query["limit"] = request.Limit.ToString(); - } - if (request.Offset != null) - { - _query["offset"] = request.Offset.ToString(); - } - var response = await _client.MakeRequestAsync( - new RawClient.JsonApiRequest - { - Method = HttpMethod.Get, - Path = "flag-checks/count", - Query = _query - } - ); - var responseBody = await response.Raw.Content.ReadAsStringAsync(); - if (response.StatusCode is >= 200 and < 400) - { - return JsonSerializer.Deserialize(responseBody)!; - } - throw new Exception(responseBody); - } - - public async Task GetLatestFlagChecksAsync( - GetLatestFlagChecksRequest request - ) - { - var _query = new Dictionary() { }; - if (request.FlagId != null) - { - _query["flag_id"] = request.FlagId; - } - if (request.FlagIds != null) - { - _query["flag_ids"] = request.FlagIds; - } - if (request.Id != null) - { - _query["id"] = request.Id; - } - if (request.Limit != null) - { - _query["limit"] = request.Limit.ToString(); - } - if (request.Offset != null) - { - _query["offset"] = request.Offset.ToString(); - } - var response = await _client.MakeRequestAsync( - new RawClient.JsonApiRequest - { - Method = HttpMethod.Get, - Path = "flag-checks/latest", - Query = _query - } - ); - var responseBody = await response.Raw.Content.ReadAsStringAsync(); - if (response.StatusCode is >= 200 and < 400) - { - return JsonSerializer.Deserialize(responseBody)!; - } - throw new Exception(responseBody); - } - public async Task ListFlagsAsync(ListFlagsRequest request) { var _query = new Dictionary() { }; diff --git a/src/SchematicHQ.Client/Features/Requests/CreateFeatureRequestBody.cs b/src/SchematicHQ.Client/Features/Requests/CreateFeatureRequestBody.cs index b8be71d..b5de2bc 100644 --- a/src/SchematicHQ.Client/Features/Requests/CreateFeatureRequestBody.cs +++ b/src/SchematicHQ.Client/Features/Requests/CreateFeatureRequestBody.cs @@ -19,9 +19,15 @@ public record CreateFeatureRequestBody [JsonPropertyName("flag")] public CreateOrUpdateFlagRequestBody? Flag { get; init; } + [JsonPropertyName("icon")] + public string? Icon { get; init; } + [JsonPropertyName("lifecycle_phase")] public string? LifecyclePhase { get; init; } + [JsonPropertyName("maintainer_id")] + public string? MaintainerId { get; init; } + [JsonPropertyName("name")] public required string Name { get; init; } diff --git a/src/SchematicHQ.Client/Features/Requests/GetLatestFlagChecksRequest.cs b/src/SchematicHQ.Client/Features/Requests/GetLatestFlagChecksRequest.cs deleted file mode 100644 index b2cd6f7..0000000 --- a/src/SchematicHQ.Client/Features/Requests/GetLatestFlagChecksRequest.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace SchematicHQ.Client; - -public record GetLatestFlagChecksRequest -{ - public string? FlagId { get; init; } - - public string? FlagIds { get; init; } - - public string? Id { get; init; } - - /// - /// Page limit (default 100) - /// - public int? Limit { get; init; } - - /// - /// Page offset (default 0) - /// - public int? Offset { get; init; } -} diff --git a/src/SchematicHQ.Client/Features/Requests/UpdateFeatureRequestBody.cs b/src/SchematicHQ.Client/Features/Requests/UpdateFeatureRequestBody.cs index e02fc3e..5fe89cd 100644 --- a/src/SchematicHQ.Client/Features/Requests/UpdateFeatureRequestBody.cs +++ b/src/SchematicHQ.Client/Features/Requests/UpdateFeatureRequestBody.cs @@ -19,9 +19,15 @@ public record UpdateFeatureRequestBody [JsonPropertyName("flag")] public CreateOrUpdateFlagRequestBody? Flag { get; init; } + [JsonPropertyName("icon")] + public string? Icon { get; init; } + [JsonPropertyName("lifecycle_phase")] public string? LifecyclePhase { get; init; } + [JsonPropertyName("maintainer_id")] + public string? MaintainerId { get; init; } + [JsonPropertyName("name")] public string? Name { get; init; } diff --git a/src/SchematicHQ.Client/Features/Types/GetLatestFlagChecksParams.cs b/src/SchematicHQ.Client/Features/Types/GetLatestFlagChecksParams.cs deleted file mode 100644 index 8c90fe5..0000000 --- a/src/SchematicHQ.Client/Features/Types/GetLatestFlagChecksParams.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Text.Json.Serialization; - -#nullable enable - -namespace SchematicHQ.Client; - -public record GetLatestFlagChecksParams -{ - [JsonPropertyName("flag_id")] - public string? FlagId { get; init; } - - [JsonPropertyName("flag_ids")] - public IEnumerable? FlagIds { get; init; } - - [JsonPropertyName("id")] - public string? Id { get; init; } - - /// - /// Page limit (default 100) - /// - [JsonPropertyName("limit")] - public int? Limit { get; init; } - - /// - /// Page offset (default 0) - /// - [JsonPropertyName("offset")] - public int? Offset { get; init; } -} diff --git a/src/SchematicHQ.Client/Plans/PlansClient.cs b/src/SchematicHQ.Client/Plans/PlansClient.cs index 7f54aab..d880664 100644 --- a/src/SchematicHQ.Client/Plans/PlansClient.cs +++ b/src/SchematicHQ.Client/Plans/PlansClient.cs @@ -86,6 +86,10 @@ public async Task ListPlansAsync(ListPlansRequest request) { _query["q"] = request.Q; } + if (request.PlanType != null) + { + _query["plan_type"] = JsonSerializer.Serialize(request.PlanType.Value); + } if (request.WithoutEntitlementFor != null) { _query["without_entitlement_for"] = request.WithoutEntitlementFor; @@ -215,6 +219,10 @@ public async Task CountPlansAsync(CountPlansRequest request) { _query["q"] = request.Q; } + if (request.PlanType != null) + { + _query["plan_type"] = JsonSerializer.Serialize(request.PlanType.Value); + } if (request.WithoutEntitlementFor != null) { _query["without_entitlement_for"] = request.WithoutEntitlementFor; diff --git a/src/SchematicHQ.Client/Plans/Requests/CountPlansRequest.cs b/src/SchematicHQ.Client/Plans/Requests/CountPlansRequest.cs index d3bdf4b..31a1eca 100644 --- a/src/SchematicHQ.Client/Plans/Requests/CountPlansRequest.cs +++ b/src/SchematicHQ.Client/Plans/Requests/CountPlansRequest.cs @@ -1,3 +1,7 @@ +using SchematicHQ.Client; + +#nullable enable + namespace SchematicHQ.Client; public record CountPlansRequest @@ -8,6 +12,11 @@ public record CountPlansRequest public string? Q { get; init; } + /// + /// Filter by plan type + /// + public CountPlansRequestPlanType? PlanType { get; init; } + /// /// Filter out plans that already have a plan entitlement for the specified feature ID /// diff --git a/src/SchematicHQ.Client/Plans/Requests/CreatePlanRequestBody.cs b/src/SchematicHQ.Client/Plans/Requests/CreatePlanRequestBody.cs index 5862d87..c4b172a 100644 --- a/src/SchematicHQ.Client/Plans/Requests/CreatePlanRequestBody.cs +++ b/src/SchematicHQ.Client/Plans/Requests/CreatePlanRequestBody.cs @@ -7,12 +7,12 @@ namespace SchematicHQ.Client; public record CreatePlanRequestBody { - [JsonPropertyName("audience_type")] - public string? AudienceType { get; init; } - [JsonPropertyName("description")] public required string Description { get; init; } + [JsonPropertyName("icon")] + public string? Icon { get; init; } + [JsonPropertyName("name")] public required string Name { get; init; } diff --git a/src/SchematicHQ.Client/Plans/Requests/ListPlansRequest.cs b/src/SchematicHQ.Client/Plans/Requests/ListPlansRequest.cs index 09e2b23..87ca1ef 100644 --- a/src/SchematicHQ.Client/Plans/Requests/ListPlansRequest.cs +++ b/src/SchematicHQ.Client/Plans/Requests/ListPlansRequest.cs @@ -1,3 +1,7 @@ +using SchematicHQ.Client; + +#nullable enable + namespace SchematicHQ.Client; public record ListPlansRequest @@ -8,6 +12,11 @@ public record ListPlansRequest public string? Q { get; init; } + /// + /// Filter by plan type + /// + public ListPlansRequestPlanType? PlanType { get; init; } + /// /// Filter out plans that already have a plan entitlement for the specified feature ID /// diff --git a/src/SchematicHQ.Client/Plans/Requests/UpdatePlanRequestBody.cs b/src/SchematicHQ.Client/Plans/Requests/UpdatePlanRequestBody.cs index 537d619..c069bc4 100644 --- a/src/SchematicHQ.Client/Plans/Requests/UpdatePlanRequestBody.cs +++ b/src/SchematicHQ.Client/Plans/Requests/UpdatePlanRequestBody.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using SchematicHQ.Client; #nullable enable @@ -7,15 +6,12 @@ namespace SchematicHQ.Client; public record UpdatePlanRequestBody { - [JsonPropertyName("audience_type")] - public required string AudienceType { get; init; } - [JsonPropertyName("description")] public string? Description { get; init; } + [JsonPropertyName("icon")] + public string? Icon { get; init; } + [JsonPropertyName("name")] public required string Name { get; init; } - - [JsonPropertyName("plan_type")] - public UpdatePlanRequestBodyPlanType? PlanType { get; init; } } diff --git a/src/SchematicHQ.Client/Plans/Requests/UpsertBillingProductRequestBody.cs b/src/SchematicHQ.Client/Plans/Requests/UpsertBillingProductRequestBody.cs index e2b0909..ad28848 100644 --- a/src/SchematicHQ.Client/Plans/Requests/UpsertBillingProductRequestBody.cs +++ b/src/SchematicHQ.Client/Plans/Requests/UpsertBillingProductRequestBody.cs @@ -6,6 +6,12 @@ namespace SchematicHQ.Client; public record UpsertBillingProductRequestBody { - [JsonPropertyName("BillingProductID")] + [JsonPropertyName("billing_product_id")] public required string BillingProductId { get; init; } + + [JsonPropertyName("monthly_price_id")] + public string? MonthlyPriceId { get; init; } + + [JsonPropertyName("yearly_price_id")] + public string? YearlyPriceId { get; init; } } diff --git a/src/SchematicHQ.Client/Plans/Types/CountPlansParams.cs b/src/SchematicHQ.Client/Plans/Types/CountPlansParams.cs index 2456a2b..de1b3bd 100644 --- a/src/SchematicHQ.Client/Plans/Types/CountPlansParams.cs +++ b/src/SchematicHQ.Client/Plans/Types/CountPlansParams.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using SchematicHQ.Client; #nullable enable @@ -24,6 +25,12 @@ public record CountPlansParams [JsonPropertyName("offset")] public int? Offset { get; init; } + /// + /// Filter by plan type + /// + [JsonPropertyName("plan_type")] + public CountPlansResponseParamsPlanType? PlanType { get; init; } + [JsonPropertyName("q")] public string? Q { get; init; } diff --git a/src/SchematicHQ.Client/Plans/Types/CountPlansRequestPlanType.cs b/src/SchematicHQ.Client/Plans/Types/CountPlansRequestPlanType.cs new file mode 100644 index 0000000..52fcf2c --- /dev/null +++ b/src/SchematicHQ.Client/Plans/Types/CountPlansRequestPlanType.cs @@ -0,0 +1,18 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using SchematicHQ.Client; +using SchematicHQ.Client.Core; + +#nullable enable + +namespace SchematicHQ.Client; + +[JsonConverter(typeof(StringEnumSerializer))] +public enum CountPlansRequestPlanType +{ + [EnumMember(Value = "plan")] + Plan, + + [EnumMember(Value = "add_on")] + AddOn +} diff --git a/src/SchematicHQ.Client/Plans/Types/CountPlansResponseParamsPlanType.cs b/src/SchematicHQ.Client/Plans/Types/CountPlansResponseParamsPlanType.cs new file mode 100644 index 0000000..5bd554e --- /dev/null +++ b/src/SchematicHQ.Client/Plans/Types/CountPlansResponseParamsPlanType.cs @@ -0,0 +1,18 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using SchematicHQ.Client; +using SchematicHQ.Client.Core; + +#nullable enable + +namespace SchematicHQ.Client; + +[JsonConverter(typeof(StringEnumSerializer))] +public enum CountPlansResponseParamsPlanType +{ + [EnumMember(Value = "plan")] + Plan, + + [EnumMember(Value = "add_on")] + AddOn +} diff --git a/src/SchematicHQ.Client/Plans/Types/CreatePlanRequestBodyPlanType.cs b/src/SchematicHQ.Client/Plans/Types/CreatePlanRequestBodyPlanType.cs index 8a8a1e3..b3f6bda 100644 --- a/src/SchematicHQ.Client/Plans/Types/CreatePlanRequestBodyPlanType.cs +++ b/src/SchematicHQ.Client/Plans/Types/CreatePlanRequestBodyPlanType.cs @@ -10,21 +10,9 @@ namespace SchematicHQ.Client; [JsonConverter(typeof(StringEnumSerializer))] public enum CreatePlanRequestBodyPlanType { - [EnumMember(Value = "product")] - Product, - - [EnumMember(Value = "pricing_plan")] - PricingPlan, + [EnumMember(Value = "plan")] + Plan, [EnumMember(Value = "add_on")] - AddOn, - - [EnumMember(Value = "overage")] - Overage, - - [EnumMember(Value = "billable_metric")] - BillableMetric, - - [EnumMember(Value = "other")] - Other + AddOn } diff --git a/src/SchematicHQ.Client/Plans/Types/ListPlansParams.cs b/src/SchematicHQ.Client/Plans/Types/ListPlansParams.cs index 601723a..73b2aa5 100644 --- a/src/SchematicHQ.Client/Plans/Types/ListPlansParams.cs +++ b/src/SchematicHQ.Client/Plans/Types/ListPlansParams.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using SchematicHQ.Client; #nullable enable @@ -24,6 +25,12 @@ public record ListPlansParams [JsonPropertyName("offset")] public int? Offset { get; init; } + /// + /// Filter by plan type + /// + [JsonPropertyName("plan_type")] + public ListPlansResponseParamsPlanType? PlanType { get; init; } + [JsonPropertyName("q")] public string? Q { get; init; } diff --git a/src/SchematicHQ.Client/Plans/Types/ListPlansRequestPlanType.cs b/src/SchematicHQ.Client/Plans/Types/ListPlansRequestPlanType.cs new file mode 100644 index 0000000..5821c75 --- /dev/null +++ b/src/SchematicHQ.Client/Plans/Types/ListPlansRequestPlanType.cs @@ -0,0 +1,18 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using SchematicHQ.Client; +using SchematicHQ.Client.Core; + +#nullable enable + +namespace SchematicHQ.Client; + +[JsonConverter(typeof(StringEnumSerializer))] +public enum ListPlansRequestPlanType +{ + [EnumMember(Value = "plan")] + Plan, + + [EnumMember(Value = "add_on")] + AddOn +} diff --git a/src/SchematicHQ.Client/Plans/Types/ListPlansResponseParamsPlanType.cs b/src/SchematicHQ.Client/Plans/Types/ListPlansResponseParamsPlanType.cs new file mode 100644 index 0000000..f2f1766 --- /dev/null +++ b/src/SchematicHQ.Client/Plans/Types/ListPlansResponseParamsPlanType.cs @@ -0,0 +1,18 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using SchematicHQ.Client; +using SchematicHQ.Client.Core; + +#nullable enable + +namespace SchematicHQ.Client; + +[JsonConverter(typeof(StringEnumSerializer))] +public enum ListPlansResponseParamsPlanType +{ + [EnumMember(Value = "plan")] + Plan, + + [EnumMember(Value = "add_on")] + AddOn +} diff --git a/src/SchematicHQ.Client/Plans/Types/UpdatePlanRequestBodyPlanType.cs b/src/SchematicHQ.Client/Plans/Types/UpdatePlanRequestBodyPlanType.cs deleted file mode 100644 index 50f2708..0000000 --- a/src/SchematicHQ.Client/Plans/Types/UpdatePlanRequestBodyPlanType.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Runtime.Serialization; -using System.Text.Json.Serialization; -using SchematicHQ.Client; -using SchematicHQ.Client.Core; - -#nullable enable - -namespace SchematicHQ.Client; - -[JsonConverter(typeof(StringEnumSerializer))] -public enum UpdatePlanRequestBodyPlanType -{ - [EnumMember(Value = "product")] - Product, - - [EnumMember(Value = "pricing_plan")] - PricingPlan, - - [EnumMember(Value = "add_on")] - AddOn, - - [EnumMember(Value = "overage")] - Overage, - - [EnumMember(Value = "billable_metric")] - BillableMetric, - - [EnumMember(Value = "other")] - Other -} diff --git a/src/SchematicHQ.Client/Schematic.cs b/src/SchematicHQ.Client/Schematic.cs index 6949b1e..2a58c8c 100644 --- a/src/SchematicHQ.Client/Schematic.cs +++ b/src/SchematicHQ.Client/Schematic.cs @@ -126,7 +126,7 @@ public void Track(string eventName, Dictionary? company = null, }); } - private void EnqueueEvent(CreateEventRequestBodyEventType eventType, OneOf body) + private void EnqueueEvent(CreateEventRequestBodyEventType eventType, OneOf body) { if (_offline) return; diff --git a/src/SchematicHQ.Client/SchematicApi.cs b/src/SchematicHQ.Client/SchematicApi.cs index 8d1ad30..e9345fa 100644 --- a/src/SchematicHQ.Client/SchematicApi.cs +++ b/src/SchematicHQ.Client/SchematicApi.cs @@ -1,3 +1,4 @@ +using System.Net.Http; using SchematicHQ.Client; using SchematicHQ.Client.Core; @@ -17,7 +18,7 @@ public SchematicApi(string? apiKey = null, ClientOptions? clientOptions = null) { "X-Schematic-Api-Key", apiKey }, { "X-Fern-Language", "C#" }, { "X-Fern-SDK-Name", "SchematicHQ.Client" }, - { "X-Fern-SDK-Version", "1.0.1" }, + { "X-Fern-SDK-Version", "1.0.2" }, }, clientOptions ?? new ClientOptions() ); @@ -55,4 +56,11 @@ public SchematicApi(string? apiKey = null, ClientOptions? clientOptions = null) public AccesstokensClient Accesstokens { get; init; } public WebhooksClient Webhooks { get; init; } + + public async Task GetCompanyPlansAsync() + { + await _client.MakeRequestAsync( + new RawClient.JsonApiRequest { Method = HttpMethod.Get, Path = "company-plans" } + ); + } } diff --git a/src/SchematicHQ.Client/SchematicHQ.Client.csproj b/src/SchematicHQ.Client/SchematicHQ.Client.csproj index 674177e..314fccd 100644 --- a/src/SchematicHQ.Client/SchematicHQ.Client.csproj +++ b/src/SchematicHQ.Client/SchematicHQ.Client.csproj @@ -7,7 +7,7 @@ false 12 enable - 1.0.1 + 1.0.2 README.md https://github.com/schematichq/schematic-csharp diff --git a/src/SchematicHQ.Client/Types/BillingCustomerResponseData.cs b/src/SchematicHQ.Client/Types/BillingCustomerResponseData.cs new file mode 100644 index 0000000..092f878 --- /dev/null +++ b/src/SchematicHQ.Client/Types/BillingCustomerResponseData.cs @@ -0,0 +1,32 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record BillingCustomerResponseData +{ + [JsonPropertyName("company_id")] + public string? CompanyId { get; init; } + + [JsonPropertyName("deleted_at")] + public DateTime? DeletedAt { get; init; } + + [JsonPropertyName("email")] + public required string Email { get; init; } + + [JsonPropertyName("external_id")] + public required string ExternalId { get; init; } + + [JsonPropertyName("failed_to_import")] + public required bool FailedToImport { get; init; } + + [JsonPropertyName("id")] + public required string Id { get; init; } + + [JsonPropertyName("name")] + public required string Name { get; init; } + + [JsonPropertyName("updated_at")] + public required DateTime UpdatedAt { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/BillingCustomerSubscription.cs b/src/SchematicHQ.Client/Types/BillingCustomerSubscription.cs new file mode 100644 index 0000000..9c3f11c --- /dev/null +++ b/src/SchematicHQ.Client/Types/BillingCustomerSubscription.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record BillingCustomerSubscription +{ + [JsonPropertyName("expired_at")] + public DateTime? ExpiredAt { get; init; } + + [JsonPropertyName("total_price")] + public required int TotalPrice { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/BillingCustomerWithSubscriptionsResponseData.cs b/src/SchematicHQ.Client/Types/BillingCustomerWithSubscriptionsResponseData.cs new file mode 100644 index 0000000..4d962b8 --- /dev/null +++ b/src/SchematicHQ.Client/Types/BillingCustomerWithSubscriptionsResponseData.cs @@ -0,0 +1,37 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record BillingCustomerWithSubscriptionsResponseData +{ + [JsonPropertyName("company_id")] + public string? CompanyId { get; init; } + + [JsonPropertyName("deleted_at")] + public DateTime? DeletedAt { get; init; } + + [JsonPropertyName("email")] + public required string Email { get; init; } + + [JsonPropertyName("external_id")] + public required string ExternalId { get; init; } + + [JsonPropertyName("failed_to_import")] + public required bool FailedToImport { get; init; } + + [JsonPropertyName("id")] + public required string Id { get; init; } + + [JsonPropertyName("name")] + public required string Name { get; init; } + + [JsonPropertyName("subscriptions")] + public IEnumerable Subscriptions { get; init; } = + new List(); + + [JsonPropertyName("updated_at")] + public required DateTime UpdatedAt { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/BillingPlan.cs b/src/SchematicHQ.Client/Types/BillingPlan.cs new file mode 100644 index 0000000..e7b75d9 --- /dev/null +++ b/src/SchematicHQ.Client/Types/BillingPlan.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record BillingPlan +{ + [JsonPropertyName("description")] + public string? Description { get; init; } + + [JsonPropertyName("id")] + public required string Id { get; init; } + + [JsonPropertyName("image_url")] + public string? ImageUrl { get; init; } + + [JsonPropertyName("name")] + public required string Name { get; init; } + + [JsonPropertyName("plan_period")] + public string? PlanPeriod { get; init; } + + [JsonPropertyName("plan_price")] + public int? PlanPrice { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/BillingPlanGroupResponseData.cs b/src/SchematicHQ.Client/Types/BillingPlanGroupResponseData.cs new file mode 100644 index 0000000..f789b77 --- /dev/null +++ b/src/SchematicHQ.Client/Types/BillingPlanGroupResponseData.cs @@ -0,0 +1,17 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record BillingPlanGroupResponseData +{ + [JsonPropertyName("default_plan_id")] + public string? DefaultPlanId { get; init; } + + [JsonPropertyName("id")] + public required string Id { get; init; } + + [JsonPropertyName("plan_ids")] + public IEnumerable PlanIds { get; init; } = new List(); +} diff --git a/src/SchematicHQ.Client/Types/BillingPriceResponseData.cs b/src/SchematicHQ.Client/Types/BillingPriceResponseData.cs new file mode 100644 index 0000000..92aa7a2 --- /dev/null +++ b/src/SchematicHQ.Client/Types/BillingPriceResponseData.cs @@ -0,0 +1,20 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record BillingPriceResponseData +{ + [JsonPropertyName("external_price_id")] + public required string ExternalPriceId { get; init; } + + [JsonPropertyName("id")] + public required string Id { get; init; } + + [JsonPropertyName("interval")] + public required string Interval { get; init; } + + [JsonPropertyName("price")] + public required int Price { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/BillingProductDetailResponseData.cs b/src/SchematicHQ.Client/Types/BillingProductDetailResponseData.cs new file mode 100644 index 0000000..b956d0e --- /dev/null +++ b/src/SchematicHQ.Client/Types/BillingProductDetailResponseData.cs @@ -0,0 +1,43 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record BillingProductDetailResponseData +{ + [JsonPropertyName("Prices")] + public IEnumerable Prices { get; init; } = + new List(); + + [JsonPropertyName("account_id")] + public required string AccountId { get; init; } + + [JsonPropertyName("created_at")] + public required DateTime CreatedAt { get; init; } + + [JsonPropertyName("currency")] + public required string Currency { get; init; } + + [JsonPropertyName("environment_id")] + public required string EnvironmentId { get; init; } + + [JsonPropertyName("external_id")] + public required string ExternalId { get; init; } + + [JsonPropertyName("name")] + public required string Name { get; init; } + + [JsonPropertyName("price")] + public required double Price { get; init; } + + [JsonPropertyName("product_id")] + public required string ProductId { get; init; } + + [JsonPropertyName("quantity")] + public required double Quantity { get; init; } + + [JsonPropertyName("updated_at")] + public required DateTime UpdatedAt { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/BillingProductForSubscriptionResponseData.cs b/src/SchematicHQ.Client/Types/BillingProductForSubscriptionResponseData.cs new file mode 100644 index 0000000..e5644a7 --- /dev/null +++ b/src/SchematicHQ.Client/Types/BillingProductForSubscriptionResponseData.cs @@ -0,0 +1,41 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record BillingProductForSubscriptionResponseData +{ + [JsonPropertyName("account_id")] + public required string AccountId { get; init; } + + [JsonPropertyName("created_at")] + public required DateTime CreatedAt { get; init; } + + [JsonPropertyName("currency")] + public required string Currency { get; init; } + + [JsonPropertyName("environment_id")] + public required string EnvironmentId { get; init; } + + [JsonPropertyName("external_id")] + public required string ExternalId { get; init; } + + [JsonPropertyName("id")] + public required string Id { get; init; } + + [JsonPropertyName("interval")] + public string? Interval { get; init; } + + [JsonPropertyName("name")] + public required string Name { get; init; } + + [JsonPropertyName("price")] + public required double Price { get; init; } + + [JsonPropertyName("quantity")] + public required double Quantity { get; init; } + + [JsonPropertyName("updated_at")] + public required DateTime UpdatedAt { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/BillingProductPlanResponseData.cs b/src/SchematicHQ.Client/Types/BillingProductPlanResponseData.cs index e7b1534..ec48ffa 100644 --- a/src/SchematicHQ.Client/Types/BillingProductPlanResponseData.cs +++ b/src/SchematicHQ.Client/Types/BillingProductPlanResponseData.cs @@ -15,6 +15,12 @@ public record BillingProductPlanResponseData [JsonPropertyName("environment_id")] public required string EnvironmentId { get; init; } + [JsonPropertyName("monthly_price_id")] + public string? MonthlyPriceId { get; init; } + [JsonPropertyName("plan_id")] public required string PlanId { get; init; } + + [JsonPropertyName("yearly_price_id")] + public string? YearlyPriceId { get; init; } } diff --git a/src/SchematicHQ.Client/Types/BillingProductPricing.cs b/src/SchematicHQ.Client/Types/BillingProductPricing.cs new file mode 100644 index 0000000..ec95e27 --- /dev/null +++ b/src/SchematicHQ.Client/Types/BillingProductPricing.cs @@ -0,0 +1,20 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record BillingProductPricing +{ + [JsonPropertyName("interval")] + public string? Interval { get; init; } + + [JsonPropertyName("price")] + public required int Price { get; init; } + + [JsonPropertyName("price_external_id")] + public string? PriceExternalId { get; init; } + + [JsonPropertyName("product_external_id")] + public required string ProductExternalId { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/CompanyDetailResponseData.cs b/src/SchematicHQ.Client/Types/CompanyDetailResponseData.cs index db70013..9d1acb3 100644 --- a/src/SchematicHQ.Client/Types/CompanyDetailResponseData.cs +++ b/src/SchematicHQ.Client/Types/CompanyDetailResponseData.cs @@ -7,6 +7,9 @@ namespace SchematicHQ.Client; public record CompanyDetailResponseData { + [JsonPropertyName("add_ons")] + public IEnumerable AddOns { get; init; } = new List(); + [JsonPropertyName("created_at")] public required DateTime CreatedAt { get; init; } @@ -33,6 +36,9 @@ public record CompanyDetailResponseData [JsonPropertyName("name")] public required string Name { get; init; } + [JsonPropertyName("plan")] + public BillingPlan? Plan { get; init; } + [JsonPropertyName("plans")] public IEnumerable Plans { get; init; } = new List(); diff --git a/src/SchematicHQ.Client/Types/CompanyPlanResponseData.cs b/src/SchematicHQ.Client/Types/CompanyPlanResponseData.cs deleted file mode 100644 index 5441062..0000000 --- a/src/SchematicHQ.Client/Types/CompanyPlanResponseData.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Text.Json.Serialization; - -#nullable enable - -namespace SchematicHQ.Client; - -public record CompanyPlanResponseData -{ - [JsonPropertyName("company_id")] - public required string CompanyId { get; init; } - - [JsonPropertyName("created_at")] - public required DateTime CreatedAt { get; init; } - - [JsonPropertyName("environment_id")] - public required string EnvironmentId { get; init; } - - [JsonPropertyName("id")] - public required string Id { get; init; } - - [JsonPropertyName("plan_id")] - public required string PlanId { get; init; } - - [JsonPropertyName("updated_at")] - public required DateTime UpdatedAt { get; init; } -} diff --git a/src/SchematicHQ.Client/Types/CompanySubscriptionResponseData.cs b/src/SchematicHQ.Client/Types/CompanySubscriptionResponseData.cs index b19c60e..295b985 100644 --- a/src/SchematicHQ.Client/Types/CompanySubscriptionResponseData.cs +++ b/src/SchematicHQ.Client/Types/CompanySubscriptionResponseData.cs @@ -17,8 +17,8 @@ public record CompanySubscriptionResponseData public required string Interval { get; init; } [JsonPropertyName("products")] - public IEnumerable Products { get; init; } = - new List(); + public IEnumerable Products { get; init; } = + new List(); [JsonPropertyName("subscription_external_id")] public required string SubscriptionExternalId { get; init; } diff --git a/src/SchematicHQ.Client/Types/ComponentHydrateResponseData.cs b/src/SchematicHQ.Client/Types/ComponentHydrateResponseData.cs deleted file mode 100644 index ab9e743..0000000 --- a/src/SchematicHQ.Client/Types/ComponentHydrateResponseData.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Text.Json.Serialization; -using SchematicHQ.Client; - -#nullable enable - -namespace SchematicHQ.Client; - -public record ComponentHydrateResponseData -{ - [JsonPropertyName("company")] - public CompanyDetailResponseData? Company { get; init; } - - [JsonPropertyName("component")] - public ComponentResponseData? Component { get; init; } - - [JsonPropertyName("feature_usage")] - public FeatureUsageDetailResponseData? FeatureUsage { get; init; } -} diff --git a/src/SchematicHQ.Client/Types/ComponentResponseData.cs b/src/SchematicHQ.Client/Types/ComponentResponseData.cs index 90857e3..94d43e1 100644 --- a/src/SchematicHQ.Client/Types/ComponentResponseData.cs +++ b/src/SchematicHQ.Client/Types/ComponentResponseData.cs @@ -7,7 +7,7 @@ namespace SchematicHQ.Client; public record ComponentResponseData { [JsonPropertyName("ast")] - public IEnumerable Ast { get; init; } = new List(); + public Dictionary? Ast { get; init; } [JsonPropertyName("created_at")] public required DateTime CreatedAt { get; init; } diff --git a/src/SchematicHQ.Client/Types/CreateEventRequestBody.cs b/src/SchematicHQ.Client/Types/CreateEventRequestBody.cs index eb9dee9..d1772e7 100644 --- a/src/SchematicHQ.Client/Types/CreateEventRequestBody.cs +++ b/src/SchematicHQ.Client/Types/CreateEventRequestBody.cs @@ -10,8 +10,10 @@ namespace SchematicHQ.Client; public record CreateEventRequestBody { [JsonPropertyName("body")] - [JsonConverter(typeof(OneOfSerializer>))] - public OneOf? Body { get; init; } + [JsonConverter( + typeof(OneOfSerializer>) + )] + public OneOf? Body { get; init; } /// /// Either 'identify' or 'track' diff --git a/src/SchematicHQ.Client/Types/CreateEventRequestBodyEventType.cs b/src/SchematicHQ.Client/Types/CreateEventRequestBodyEventType.cs index 5828d1a..49d8888 100644 --- a/src/SchematicHQ.Client/Types/CreateEventRequestBodyEventType.cs +++ b/src/SchematicHQ.Client/Types/CreateEventRequestBodyEventType.cs @@ -14,5 +14,8 @@ public enum CreateEventRequestBodyEventType Identify, [EnumMember(Value = "track")] - Track + Track, + + [EnumMember(Value = "flag_check")] + FlagCheck } diff --git a/src/SchematicHQ.Client/Types/CreateFlagRequestBody.cs b/src/SchematicHQ.Client/Types/CreateFlagRequestBody.cs index 061e73b..b371326 100644 --- a/src/SchematicHQ.Client/Types/CreateFlagRequestBody.cs +++ b/src/SchematicHQ.Client/Types/CreateFlagRequestBody.cs @@ -21,6 +21,9 @@ public record CreateFlagRequestBody [JsonPropertyName("key")] public required string Key { get; init; } + [JsonPropertyName("maintainer_id")] + public string? MaintainerId { get; init; } + [JsonPropertyName("name")] public required string Name { get; init; } } diff --git a/src/SchematicHQ.Client/Types/CreateOrUpdateFlagRequestBody.cs b/src/SchematicHQ.Client/Types/CreateOrUpdateFlagRequestBody.cs index e8b5a59..328d03d 100644 --- a/src/SchematicHQ.Client/Types/CreateOrUpdateFlagRequestBody.cs +++ b/src/SchematicHQ.Client/Types/CreateOrUpdateFlagRequestBody.cs @@ -24,6 +24,9 @@ public record CreateOrUpdateFlagRequestBody [JsonPropertyName("key")] public required string Key { get; init; } + [JsonPropertyName("maintainer_id")] + public string? MaintainerId { get; init; } + [JsonPropertyName("name")] public required string Name { get; init; } } diff --git a/src/SchematicHQ.Client/Types/EventBodyFlagCheck.cs b/src/SchematicHQ.Client/Types/EventBodyFlagCheck.cs new file mode 100644 index 0000000..4e166f9 --- /dev/null +++ b/src/SchematicHQ.Client/Types/EventBodyFlagCheck.cs @@ -0,0 +1,68 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record EventBodyFlagCheck +{ + /// + /// Schematic company ID (starting with 'comp\_') of the company evaluated, if any + /// + [JsonPropertyName("company_id")] + public string? CompanyId { get; init; } + + /// + /// Report an error that occurred during the flag check + /// + [JsonPropertyName("error")] + public string? Error { get; init; } + + /// + /// Schematic flag ID (starting with 'flag\_') for the flag matching the key, if any + /// + [JsonPropertyName("flag_id")] + public string? FlagId { get; init; } + + /// + /// The key of the flag being checked + /// + [JsonPropertyName("flag_key")] + public required string FlagKey { get; init; } + + /// + /// The reason why the value was returned + /// + [JsonPropertyName("reason")] + public required string Reason { get; init; } + + /// + /// Key-value pairs used to to identify company for which the flag was checked + /// + [JsonPropertyName("req_company")] + public Dictionary? ReqCompany { get; init; } + + /// + /// Key-value pairs used to to identify user for which the flag was checked + /// + [JsonPropertyName("req_user")] + public Dictionary? ReqUser { get; init; } + + /// + /// Schematic rule ID (starting with 'rule\_') of the rule that matched for the flag, if any + /// + [JsonPropertyName("rule_id")] + public string? RuleId { get; init; } + + /// + /// Schematic user ID (starting with 'user\_') of the user evaluated, if any + /// + [JsonPropertyName("user_id")] + public string? UserId { get; init; } + + /// + /// The value of the flag for the given company and/or user + /// + [JsonPropertyName("value")] + public required bool Value { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/FeatureDetailResponseData.cs b/src/SchematicHQ.Client/Types/FeatureDetailResponseData.cs index fa0ac54..eb30a4a 100644 --- a/src/SchematicHQ.Client/Types/FeatureDetailResponseData.cs +++ b/src/SchematicHQ.Client/Types/FeatureDetailResponseData.cs @@ -26,12 +26,18 @@ public record FeatureDetailResponseData public IEnumerable Flags { get; init; } = new List(); + [JsonPropertyName("icon")] + public required string Icon { get; init; } + [JsonPropertyName("id")] public required string Id { get; init; } [JsonPropertyName("lifecycle_phase")] public string? LifecyclePhase { get; init; } + [JsonPropertyName("maintainer_id")] + public string? MaintainerId { get; init; } + [JsonPropertyName("name")] public required string Name { get; init; } diff --git a/src/SchematicHQ.Client/Types/FeatureResponseData.cs b/src/SchematicHQ.Client/Types/FeatureResponseData.cs index 5ff2959..e55d56d 100644 --- a/src/SchematicHQ.Client/Types/FeatureResponseData.cs +++ b/src/SchematicHQ.Client/Types/FeatureResponseData.cs @@ -18,12 +18,18 @@ public record FeatureResponseData [JsonPropertyName("feature_type")] public required string FeatureType { get; init; } + [JsonPropertyName("icon")] + public required string Icon { get; init; } + [JsonPropertyName("id")] public required string Id { get; init; } [JsonPropertyName("lifecycle_phase")] public string? LifecyclePhase { get; init; } + [JsonPropertyName("maintainer_id")] + public string? MaintainerId { get; init; } + [JsonPropertyName("name")] public required string Name { get; init; } diff --git a/src/SchematicHQ.Client/Types/FlagCheckLogDetailResponseData.cs b/src/SchematicHQ.Client/Types/FlagCheckLogDetailResponseData.cs deleted file mode 100644 index 5dcb47c..0000000 --- a/src/SchematicHQ.Client/Types/FlagCheckLogDetailResponseData.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System.Text.Json.Serialization; -using SchematicHQ.Client; - -#nullable enable - -namespace SchematicHQ.Client; - -public record FlagCheckLogDetailResponseData -{ - [JsonPropertyName("check_status")] - public required string CheckStatus { get; init; } - - [JsonPropertyName("company")] - public CompanyResponseData? Company { get; init; } - - [JsonPropertyName("company_id")] - public string? CompanyId { get; init; } - - [JsonPropertyName("created_at")] - public required DateTime CreatedAt { get; init; } - - [JsonPropertyName("environment")] - public EnvironmentResponseData? Environment { get; init; } - - [JsonPropertyName("environment_id")] - public required string EnvironmentId { get; init; } - - [JsonPropertyName("error")] - public string? Error { get; init; } - - [JsonPropertyName("flag")] - public FlagResponseData? Flag { get; init; } - - [JsonPropertyName("flag_id")] - public string? FlagId { get; init; } - - [JsonPropertyName("flag_key")] - public required string FlagKey { get; init; } - - [JsonPropertyName("id")] - public required string Id { get; init; } - - [JsonPropertyName("reason")] - public required string Reason { get; init; } - - [JsonPropertyName("req_company")] - public Dictionary? ReqCompany { get; init; } - - [JsonPropertyName("req_user")] - public Dictionary? ReqUser { get; init; } - - [JsonPropertyName("rule")] - public RuleResponseData? Rule { get; init; } - - [JsonPropertyName("rule_id")] - public string? RuleId { get; init; } - - [JsonPropertyName("updated_at")] - public required DateTime UpdatedAt { get; init; } - - [JsonPropertyName("user")] - public UserResponseData? User { get; init; } - - [JsonPropertyName("user_id")] - public string? UserId { get; init; } - - [JsonPropertyName("value")] - public required bool Value { get; init; } -} diff --git a/src/SchematicHQ.Client/Types/FlagCheckLogResponseData.cs b/src/SchematicHQ.Client/Types/FlagCheckLogResponseData.cs deleted file mode 100644 index 98d4f8c..0000000 --- a/src/SchematicHQ.Client/Types/FlagCheckLogResponseData.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.Text.Json.Serialization; - -#nullable enable - -namespace SchematicHQ.Client; - -public record FlagCheckLogResponseData -{ - [JsonPropertyName("check_status")] - public required string CheckStatus { get; init; } - - [JsonPropertyName("company_id")] - public string? CompanyId { get; init; } - - [JsonPropertyName("created_at")] - public required DateTime CreatedAt { get; init; } - - [JsonPropertyName("environment_id")] - public required string EnvironmentId { get; init; } - - [JsonPropertyName("error")] - public string? Error { get; init; } - - [JsonPropertyName("flag_id")] - public string? FlagId { get; init; } - - [JsonPropertyName("flag_key")] - public required string FlagKey { get; init; } - - [JsonPropertyName("id")] - public required string Id { get; init; } - - [JsonPropertyName("reason")] - public required string Reason { get; init; } - - [JsonPropertyName("req_company")] - public Dictionary? ReqCompany { get; init; } - - [JsonPropertyName("req_user")] - public Dictionary? ReqUser { get; init; } - - [JsonPropertyName("rule_id")] - public string? RuleId { get; init; } - - [JsonPropertyName("updated_at")] - public required DateTime UpdatedAt { get; init; } - - [JsonPropertyName("user_id")] - public string? UserId { get; init; } - - [JsonPropertyName("value")] - public required bool Value { get; init; } -} diff --git a/src/SchematicHQ.Client/Types/FlagDetailResponseData.cs b/src/SchematicHQ.Client/Types/FlagDetailResponseData.cs index 8382c79..3df2581 100644 --- a/src/SchematicHQ.Client/Types/FlagDetailResponseData.cs +++ b/src/SchematicHQ.Client/Types/FlagDetailResponseData.cs @@ -31,8 +31,11 @@ public record FlagDetailResponseData [JsonPropertyName("key")] public required string Key { get; init; } - [JsonPropertyName("latest_check")] - public FlagCheckLogResponseData? LatestCheck { get; init; } + [JsonPropertyName("last_checked_at")] + public DateTime? LastCheckedAt { get; init; } + + [JsonPropertyName("maintainer_id")] + public string? MaintainerId { get; init; } [JsonPropertyName("name")] public required string Name { get; init; } diff --git a/src/SchematicHQ.Client/Types/FlagResponseData.cs b/src/SchematicHQ.Client/Types/FlagResponseData.cs index 8007de9..d31e36e 100644 --- a/src/SchematicHQ.Client/Types/FlagResponseData.cs +++ b/src/SchematicHQ.Client/Types/FlagResponseData.cs @@ -27,6 +27,9 @@ public record FlagResponseData [JsonPropertyName("key")] public required string Key { get; init; } + [JsonPropertyName("maintainer_id")] + public string? MaintainerId { get; init; } + [JsonPropertyName("name")] public required string Name { get; init; } diff --git a/src/SchematicHQ.Client/Types/PlanDetailResponseData.cs b/src/SchematicHQ.Client/Types/PlanDetailResponseData.cs index 61f0d7f..73593c9 100644 --- a/src/SchematicHQ.Client/Types/PlanDetailResponseData.cs +++ b/src/SchematicHQ.Client/Types/PlanDetailResponseData.cs @@ -8,7 +8,10 @@ namespace SchematicHQ.Client; public record PlanDetailResponseData { [JsonPropertyName("audience_type")] - public required string AudienceType { get; init; } + public string? AudienceType { get; init; } + + [JsonPropertyName("billing_product")] + public BillingProductDetailResponseData? BillingProduct { get; init; } [JsonPropertyName("company_count")] public required int CompanyCount { get; init; } @@ -23,6 +26,9 @@ public record PlanDetailResponseData public IEnumerable Features { get; init; } = new List(); + [JsonPropertyName("icon")] + public required string Icon { get; init; } + [JsonPropertyName("id")] public required string Id { get; init; } diff --git a/src/SchematicHQ.Client/Types/PlanResponseData.cs b/src/SchematicHQ.Client/Types/PlanResponseData.cs index f53f807..26efff3 100644 --- a/src/SchematicHQ.Client/Types/PlanResponseData.cs +++ b/src/SchematicHQ.Client/Types/PlanResponseData.cs @@ -7,7 +7,7 @@ namespace SchematicHQ.Client; public record PlanResponseData { [JsonPropertyName("audience_type")] - public required string AudienceType { get; init; } + public string? AudienceType { get; init; } [JsonPropertyName("created_at")] public required DateTime CreatedAt { get; init; } @@ -15,6 +15,9 @@ public record PlanResponseData [JsonPropertyName("description")] public required string Description { get; init; } + [JsonPropertyName("icon")] + public required string Icon { get; init; } + [JsonPropertyName("id")] public required string Id { get; init; } diff --git a/src/SchematicHQ.Client/Types/PreviewObject.cs b/src/SchematicHQ.Client/Types/PreviewObject.cs index 41e03c6..0e8f5fb 100644 --- a/src/SchematicHQ.Client/Types/PreviewObject.cs +++ b/src/SchematicHQ.Client/Types/PreviewObject.cs @@ -6,6 +6,9 @@ namespace SchematicHQ.Client; public record PreviewObject { + [JsonPropertyName("description")] + public string? Description { get; init; } + [JsonPropertyName("id")] public required string Id { get; init; }