diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/BillingCouponResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingCouponResponseDataTest.cs new file mode 100644 index 0000000..a2090fb --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingCouponResponseDataTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class BillingCouponResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ListMetricCountsResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingMeterResponseDataTest.cs similarity index 66% rename from src/SchematicHQ.Client.Test/Unit/Serialization/ListMetricCountsResponseTest.cs rename to src/SchematicHQ.Client.Test/Unit/Serialization/BillingMeterResponseDataTest.cs index 0921dd5..09ad576 100644 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/ListMetricCountsResponseTest.cs +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingMeterResponseDataTest.cs @@ -5,4 +5,4 @@ namespace SchematicHQ.Client.Test; [TestFixture] -public class ListMetricCountsResponseTest { } +public class BillingMeterResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/BillingPlanTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingPriceViewTest.cs similarity index 70% rename from src/SchematicHQ.Client.Test/Unit/Serialization/BillingPlanTest.cs rename to src/SchematicHQ.Client.Test/Unit/Serialization/BillingPriceViewTest.cs index 95027f1..0a864f7 100644 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/BillingPlanTest.cs +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingPriceViewTest.cs @@ -5,4 +5,4 @@ namespace SchematicHQ.Client.Test; [TestFixture] -public class BillingPlanTest { } +public class BillingPriceViewTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/CreateBillingPlanGroupResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingProductPriceResponseDataTest.cs similarity index 63% rename from src/SchematicHQ.Client.Test/Unit/Serialization/CreateBillingPlanGroupResponseTest.cs rename to src/SchematicHQ.Client.Test/Unit/Serialization/BillingProductPriceResponseDataTest.cs index 188e132..4d9185e 100644 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/CreateBillingPlanGroupResponseTest.cs +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingProductPriceResponseDataTest.cs @@ -5,4 +5,4 @@ namespace SchematicHQ.Client.Test; [TestFixture] -public class CreateBillingPlanGroupResponseTest { } +public class BillingProductPriceResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/BillingSubscriptionDiscountTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingSubscriptionDiscountTest.cs new file mode 100644 index 0000000..906379f --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingSubscriptionDiscountTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class BillingSubscriptionDiscountTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/BillingSubscriptionDiscountViewTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingSubscriptionDiscountViewTest.cs new file mode 100644 index 0000000..8cf6862 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingSubscriptionDiscountViewTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class BillingSubscriptionDiscountViewTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/BillingSubscriptionViewTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingSubscriptionViewTest.cs new file mode 100644 index 0000000..57a03f1 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/BillingSubscriptionViewTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class BillingSubscriptionViewTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ChangeSubscriptionInternalRequestBodyTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ChangeSubscriptionInternalRequestBodyTest.cs new file mode 100644 index 0000000..dd806bd --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/ChangeSubscriptionInternalRequestBodyTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class ChangeSubscriptionInternalRequestBodyTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ChangeSubscriptionRequestBodyTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ChangeSubscriptionRequestBodyTest.cs new file mode 100644 index 0000000..972e3cd --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/ChangeSubscriptionRequestBodyTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class ChangeSubscriptionRequestBodyTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/CheckoutInternalResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/CheckoutInternalResponseTest.cs new file mode 100644 index 0000000..84b987e --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/CheckoutInternalResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class CheckoutInternalResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/CompanyEventPeriodMetricsResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/CompanyEventPeriodMetricsResponseDataTest.cs new file mode 100644 index 0000000..71a11ee --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/CompanyEventPeriodMetricsResponseDataTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class CompanyEventPeriodMetricsResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/CompanyPlanDetailResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/CompanyPlanDetailResponseDataTest.cs new file mode 100644 index 0000000..93b880c --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/CompanyPlanDetailResponseDataTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class CompanyPlanDetailResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/CompanyPlanWithBillingSubViewTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/CompanyPlanWithBillingSubViewTest.cs new file mode 100644 index 0000000..b4f5c77 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/CompanyPlanWithBillingSubViewTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class CompanyPlanWithBillingSubViewTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ListMetricCountsParamsTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ComponentCapabilitiesTest.cs similarity index 67% rename from src/SchematicHQ.Client.Test/Unit/Serialization/ListMetricCountsParamsTest.cs rename to src/SchematicHQ.Client.Test/Unit/Serialization/ComponentCapabilitiesTest.cs index ecd1749..796b957 100644 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/ListMetricCountsParamsTest.cs +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/ComponentCapabilitiesTest.cs @@ -5,4 +5,4 @@ namespace SchematicHQ.Client.Test; [TestFixture] -public class ListMetricCountsParamsTest { } +public class ComponentCapabilitiesTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/BillingPlanGroupResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ComponentHydrateResponseDataTest.cs similarity index 64% rename from src/SchematicHQ.Client.Test/Unit/Serialization/BillingPlanGroupResponseDataTest.cs rename to src/SchematicHQ.Client.Test/Unit/Serialization/ComponentHydrateResponseDataTest.cs index 3bf6ae8..6798a7c 100644 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/BillingPlanGroupResponseDataTest.cs +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/ComponentHydrateResponseDataTest.cs @@ -5,4 +5,4 @@ namespace SchematicHQ.Client.Test; [TestFixture] -public class BillingPlanGroupResponseDataTest { } +public class ComponentHydrateResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ComponentPreviewResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ComponentPreviewResponseDataTest.cs new file mode 100644 index 0000000..8f898a1 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/ComponentPreviewResponseDataTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class ComponentPreviewResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/CountBillingProductsParamsTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/CountBillingProductsParamsTest.cs new file mode 100644 index 0000000..2138431 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/CountBillingProductsParamsTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class CountBillingProductsParamsTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/CountBillingProductsResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/CountBillingProductsResponseTest.cs new file mode 100644 index 0000000..3e14a93 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/CountBillingProductsResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class CountBillingProductsResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/CouponRequestBodyTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/CouponRequestBodyTest.cs new file mode 100644 index 0000000..dc4c5e7 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/CouponRequestBodyTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class CouponRequestBodyTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/CreateEntitlementReqCommonTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/CreateEntitlementReqCommonTest.cs new file mode 100644 index 0000000..44a3cf2 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/CreateEntitlementReqCommonTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class CreateEntitlementReqCommonTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/CreatePlanGroupResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/CreatePlanGroupResponseTest.cs new file mode 100644 index 0000000..f636911 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/CreatePlanGroupResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class CreatePlanGroupResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/DeleteProductPriceResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/DeleteProductPriceResponseTest.cs new file mode 100644 index 0000000..d3df6f0 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/DeleteProductPriceResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class DeleteProductPriceResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/GenericPreviewObjectTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/GenericPreviewObjectTest.cs new file mode 100644 index 0000000..943b080 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/GenericPreviewObjectTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class GenericPreviewObjectTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/GetBillingPlanGroupByAccountIdResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/GetBillingPlanGroupByAccountIdResponseTest.cs deleted file mode 100644 index e726e50..0000000 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/GetBillingPlanGroupByAccountIdResponseTest.cs +++ /dev/null @@ -1,8 +0,0 @@ -using NUnit.Framework; - -#nullable enable - -namespace SchematicHQ.Client.Test; - -[TestFixture] -public class GetBillingPlanGroupByAccountIdResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/GetEventSummaryBySubtypeResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/GetEventSummaryBySubtypeResponseTest.cs deleted file mode 100644 index eda436b..0000000 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/GetEventSummaryBySubtypeResponseTest.cs +++ /dev/null @@ -1,8 +0,0 @@ -using NUnit.Framework; - -#nullable enable - -namespace SchematicHQ.Client.Test; - -[TestFixture] -public class GetEventSummaryBySubtypeResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/GetPlanGroupResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/GetPlanGroupResponseTest.cs new file mode 100644 index 0000000..4f0d82f --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/GetPlanGroupResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class GetPlanGroupResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/InvoiceRequestBodyTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/InvoiceRequestBodyTest.cs new file mode 100644 index 0000000..37f9afd --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/InvoiceRequestBodyTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class InvoiceRequestBodyTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/InvoiceResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/InvoiceResponseDataTest.cs new file mode 100644 index 0000000..f026f13 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/InvoiceResponseDataTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class InvoiceResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ListInvoicesParamsTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ListInvoicesParamsTest.cs new file mode 100644 index 0000000..930c0b1 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/ListInvoicesParamsTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class ListInvoicesParamsTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ListInvoicesResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ListInvoicesResponseTest.cs new file mode 100644 index 0000000..93d72ff --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/ListInvoicesResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class ListInvoicesResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/CreateReqCommonTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ListMetersParamsTest.cs similarity index 70% rename from src/SchematicHQ.Client.Test/Unit/Serialization/CreateReqCommonTest.cs rename to src/SchematicHQ.Client.Test/Unit/Serialization/ListMetersParamsTest.cs index 2e94097..c1ba447 100644 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/CreateReqCommonTest.cs +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/ListMetersParamsTest.cs @@ -5,4 +5,4 @@ namespace SchematicHQ.Client.Test; [TestFixture] -public class CreateReqCommonTest { } +public class ListMetersParamsTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ListMetersResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ListMetersResponseTest.cs new file mode 100644 index 0000000..6575514 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/ListMetersResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class ListMetersResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ListPaymentMethodsParamsTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ListPaymentMethodsParamsTest.cs new file mode 100644 index 0000000..f1a8dab --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/ListPaymentMethodsParamsTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class ListPaymentMethodsParamsTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/ListPaymentMethodsResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/ListPaymentMethodsResponseTest.cs new file mode 100644 index 0000000..7f73fdf --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/ListPaymentMethodsResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class ListPaymentMethodsResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/MeterRequestBodyTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/MeterRequestBodyTest.cs new file mode 100644 index 0000000..ef2314e --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/MeterRequestBodyTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class MeterRequestBodyTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/MetricCountsHourlyResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/MetricCountsHourlyResponseDataTest.cs deleted file mode 100644 index de95497..0000000 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/MetricCountsHourlyResponseDataTest.cs +++ /dev/null @@ -1,8 +0,0 @@ -using NUnit.Framework; - -#nullable enable - -namespace SchematicHQ.Client.Test; - -[TestFixture] -public class MetricCountsHourlyResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/PaymentMethodRequestBodyTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/PaymentMethodRequestBodyTest.cs new file mode 100644 index 0000000..6da3b3c --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/PaymentMethodRequestBodyTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class PaymentMethodRequestBodyTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/PaymentMethodResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/PaymentMethodResponseDataTest.cs new file mode 100644 index 0000000..96acd60 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/PaymentMethodResponseDataTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class PaymentMethodResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/PlanGroupDetailResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/PlanGroupDetailResponseDataTest.cs new file mode 100644 index 0000000..7b8166b --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/PlanGroupDetailResponseDataTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class PlanGroupDetailResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/PlanGroupPlanDetailResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/PlanGroupPlanDetailResponseDataTest.cs new file mode 100644 index 0000000..b83845e --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/PlanGroupPlanDetailResponseDataTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class PlanGroupPlanDetailResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/PlanGroupResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/PlanGroupResponseDataTest.cs new file mode 100644 index 0000000..aef959a --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/PlanGroupResponseDataTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class PlanGroupResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/PreviewCheckoutInternalResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/PreviewCheckoutInternalResponseTest.cs new file mode 100644 index 0000000..ca23178 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/PreviewCheckoutInternalResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class PreviewCheckoutInternalResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/PreviewComponentDataParamsTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/PreviewComponentDataParamsTest.cs new file mode 100644 index 0000000..5238d61 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/PreviewComponentDataParamsTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class PreviewComponentDataParamsTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/PreviewComponentDataResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/PreviewComponentDataResponseTest.cs new file mode 100644 index 0000000..1b811fa --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/PreviewComponentDataResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class PreviewComponentDataResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/PreviewObjectResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/PreviewObjectResponseDataTest.cs new file mode 100644 index 0000000..f8b5bbd --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/PreviewObjectResponseDataTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class PreviewObjectResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/PreviewSubscriptionChangeResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/PreviewSubscriptionChangeResponseDataTest.cs new file mode 100644 index 0000000..e39009d --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/PreviewSubscriptionChangeResponseDataTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class PreviewSubscriptionChangeResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/RuleConditionResourceResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/RuleConditionResourceResponseDataTest.cs deleted file mode 100644 index f7a2c89..0000000 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/RuleConditionResourceResponseDataTest.cs +++ /dev/null @@ -1,8 +0,0 @@ -using NUnit.Framework; - -#nullable enable - -namespace SchematicHQ.Client.Test; - -[TestFixture] -public class RuleConditionResourceResponseDataTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/SearchBillingPricesParamsTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/SearchBillingPricesParamsTest.cs new file mode 100644 index 0000000..41fd214 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/SearchBillingPricesParamsTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class SearchBillingPricesParamsTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/SearchBillingPricesResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/SearchBillingPricesResponseTest.cs new file mode 100644 index 0000000..02b6132 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/SearchBillingPricesResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class SearchBillingPricesResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/UpdateReqCommonTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/StripeEmbedInfoTest.cs similarity index 71% rename from src/SchematicHQ.Client.Test/Unit/Serialization/UpdateReqCommonTest.cs rename to src/SchematicHQ.Client.Test/Unit/Serialization/StripeEmbedInfoTest.cs index 04360c2..d8bcb17 100644 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/UpdateReqCommonTest.cs +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/StripeEmbedInfoTest.cs @@ -5,4 +5,4 @@ namespace SchematicHQ.Client.Test; [TestFixture] -public class UpdateReqCommonTest { } +public class StripeEmbedInfoTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/UpdateAddOnRequestBodyTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/UpdateAddOnRequestBodyTest.cs new file mode 100644 index 0000000..555cc68 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/UpdateAddOnRequestBodyTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class UpdateAddOnRequestBodyTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/UpdateBillingPlanGroupResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/UpdateBillingPlanGroupResponseTest.cs deleted file mode 100644 index d4847e8..0000000 --- a/src/SchematicHQ.Client.Test/Unit/Serialization/UpdateBillingPlanGroupResponseTest.cs +++ /dev/null @@ -1,8 +0,0 @@ -using NUnit.Framework; - -#nullable enable - -namespace SchematicHQ.Client.Test; - -[TestFixture] -public class UpdateBillingPlanGroupResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/UpdateCustomerSubscriptionTrialEndResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/UpdateCustomerSubscriptionTrialEndResponseTest.cs new file mode 100644 index 0000000..d93a9ad --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/UpdateCustomerSubscriptionTrialEndResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class UpdateCustomerSubscriptionTrialEndResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/UpdateEntitlementReqCommonTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/UpdateEntitlementReqCommonTest.cs new file mode 100644 index 0000000..d7308e4 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/UpdateEntitlementReqCommonTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class UpdateEntitlementReqCommonTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/UpdatePayInAdvanceRequestBodyTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/UpdatePayInAdvanceRequestBodyTest.cs new file mode 100644 index 0000000..4130c05 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/UpdatePayInAdvanceRequestBodyTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class UpdatePayInAdvanceRequestBodyTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/UpdatePlanGroupResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/UpdatePlanGroupResponseTest.cs new file mode 100644 index 0000000..93b7811 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/UpdatePlanGroupResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class UpdatePlanGroupResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertBillingCouponResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertBillingCouponResponseTest.cs new file mode 100644 index 0000000..d172d84 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertBillingCouponResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class UpsertBillingCouponResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertBillingMeterResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertBillingMeterResponseTest.cs new file mode 100644 index 0000000..0f5fa84 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertBillingMeterResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class UpsertBillingMeterResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertInvoiceResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertInvoiceResponseTest.cs new file mode 100644 index 0000000..0881df9 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertInvoiceResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class UpsertInvoiceResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertPaymentMethodResponseTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertPaymentMethodResponseTest.cs new file mode 100644 index 0000000..4185962 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/UpsertPaymentMethodResponseTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class UpsertPaymentMethodResponseTest { } diff --git a/src/SchematicHQ.Client.Test/Unit/Serialization/UsageBasedEntitlementResponseDataTest.cs b/src/SchematicHQ.Client.Test/Unit/Serialization/UsageBasedEntitlementResponseDataTest.cs new file mode 100644 index 0000000..9236053 --- /dev/null +++ b/src/SchematicHQ.Client.Test/Unit/Serialization/UsageBasedEntitlementResponseDataTest.cs @@ -0,0 +1,8 @@ +using NUnit.Framework; + +#nullable enable + +namespace SchematicHQ.Client.Test; + +[TestFixture] +public class UsageBasedEntitlementResponseDataTest { } diff --git a/src/SchematicHQ.Client.sln b/src/SchematicHQ.Client.sln index 1215d84..163c423 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", "{F9CD1DE1-BFD1-43D5-A3A4-6D1CFCFA4337}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client", "SchematicHQ.Client\SchematicHQ.Client.csproj", "{5313E998-FA14-40DC-B729-67340DB574CA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client.Test", "SchematicHQ.Client.Test\SchematicHQ.Client.Test.csproj", "{1FCA9B08-C3B5-4F1D-BEBD-36BFBB619D34}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client.Test", "SchematicHQ.Client.Test\SchematicHQ.Client.Test.csproj", "{58A3E118-9475-4C0A-B2F4-9926ED62D035}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -16,13 +16,13 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {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 + {5313E998-FA14-40DC-B729-67340DB574CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5313E998-FA14-40DC-B729-67340DB574CA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5313E998-FA14-40DC-B729-67340DB574CA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5313E998-FA14-40DC-B729-67340DB574CA}.Release|Any CPU.Build.0 = Release|Any CPU + {58A3E118-9475-4C0A-B2F4-9926ED62D035}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {58A3E118-9475-4C0A-B2F4-9926ED62D035}.Debug|Any CPU.Build.0 = Debug|Any CPU + {58A3E118-9475-4C0A-B2F4-9926ED62D035}.Release|Any CPU.ActiveCfg = Release|Any CPU + {58A3E118-9475-4C0A-B2F4-9926ED62D035}.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 6db2171..dac3cf7 100644 --- a/src/SchematicHQ.Client/Billing/BillingClient.cs +++ b/src/SchematicHQ.Client/Billing/BillingClient.cs @@ -16,6 +16,26 @@ public BillingClient(RawClient client) _client = client; } + public async Task UpsertBillingCouponAsync( + CreateCouponRequestBody request + ) + { + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + Method = HttpMethod.Post, + Path = "billing/coupons", + 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 UpsertBillingCustomerAsync( CreateBillingCustomerRequestBody request ) @@ -114,58 +134,214 @@ public async Task CountCustomersAsync(CountCustomersRequ throw new Exception(responseBody); } - public async Task GetBillingPlanGroupByAccountIdAsync() + public async Task ListInvoicesAsync(ListInvoicesRequest request) + { + var _query = new Dictionary() + { + { "customer_external_id", request.CustomerExternalId }, + }; + if (request.CompanyId != null) + { + _query["company_id"] = request.CompanyId; + } + if (request.SubscriptionExternalId != null) + { + _query["subscription_external_id"] = request.SubscriptionExternalId; + } + 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/invoices", + 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 UpsertInvoiceAsync(CreateInvoiceRequestBody request) { var response = await _client.MakeRequestAsync( - new RawClient.JsonApiRequest { Method = HttpMethod.Get, Path = "billing/plan-group" } + new RawClient.JsonApiRequest + { + Method = HttpMethod.Post, + Path = "billing/invoices", + Body = request + } ); 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); } - public async Task CreateBillingPlanGroupAsync( - CreateBillingPlanGroupRequestBody request + public async Task ListMetersAsync(ListMetersRequest request) + { + var _query = new Dictionary() { }; + if (request.DisplayName != null) + { + _query["display_name"] = request.DisplayName; + } + 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/meter", + 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 UpsertBillingMeterAsync( + CreateMeterRequestBody request ) { var response = await _client.MakeRequestAsync( new RawClient.JsonApiRequest { Method = HttpMethod.Post, - Path = "billing/plan-group", + Path = "billing/meter/upsert", Body = request } ); 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); } - public async Task UpdateBillingPlanGroupAsync( - string billingId, - UpdateBillingPlanGroupRequestBody request + public async Task ListPaymentMethodsAsync( + ListPaymentMethodsRequest request + ) + { + var _query = new Dictionary() + { + { "customer_external_id", request.CustomerExternalId }, + }; + if (request.CompanyId != null) + { + _query["company_id"] = request.CompanyId; + } + if (request.SubscriptionExternalId != null) + { + _query["subscription_external_id"] = request.SubscriptionExternalId; + } + 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/payment-methods", + 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 UpsertPaymentMethodAsync( + CreatePaymentMethodRequestBody request ) { var response = await _client.MakeRequestAsync( new RawClient.JsonApiRequest { - Method = HttpMethod.Put, - Path = $"billing/plan-group/{billingId}", + Method = HttpMethod.Post, + Path = "billing/payment-methods", Body = request } ); 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); + } + + public async Task SearchBillingPricesAsync( + SearchBillingPricesRequest request + ) + { + var _query = new Dictionary() { }; + if (request.Ids != null) + { + _query["ids"] = request.Ids; + } + if (request.Interval != null) + { + _query["interval"] = request.Interval; + } + if (request.UsageType != null) + { + _query["usage_type"] = request.UsageType; + } + if (request.Price != null) + { + _query["price"] = request.Price.ToString(); + } + 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/price", + Query = _query + } + ); + var responseBody = await response.Raw.Content.ReadAsStringAsync(); + if (response.StatusCode is >= 200 and < 400) + { + return JsonSerializer.Deserialize(responseBody)!; } throw new Exception(responseBody); } @@ -207,6 +383,22 @@ ListProductPricesRequest request { _query["q"] = request.Q; } + if (request.PriceUsageType != null) + { + _query["price_usage_type"] = request.PriceUsageType; + } + if (request.WithoutLinkedToPlan != null) + { + _query["without_linked_to_plan"] = request.WithoutLinkedToPlan.ToString(); + } + if (request.WithZeroPrice != null) + { + _query["with_zero_price"] = request.WithZeroPrice.ToString(); + } + if (request.WithPricesOnly != null) + { + _query["with_prices_only"] = request.WithPricesOnly.ToString(); + } if (request.Limit != null) { _query["limit"] = request.Limit.ToString(); @@ -231,6 +423,23 @@ ListProductPricesRequest request throw new Exception(responseBody); } + public async Task DeleteProductPriceAsync(string billingId) + { + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + Method = HttpMethod.Delete, + Path = $"billing/product/prices/{billingId}" + } + ); + 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 ) @@ -268,6 +477,22 @@ ListBillingProductsRequest request { _query["q"] = request.Q; } + if (request.PriceUsageType != null) + { + _query["price_usage_type"] = request.PriceUsageType; + } + if (request.WithoutLinkedToPlan != null) + { + _query["without_linked_to_plan"] = request.WithoutLinkedToPlan.ToString(); + } + if (request.WithZeroPrice != null) + { + _query["with_zero_price"] = request.WithZeroPrice.ToString(); + } + if (request.WithPricesOnly != null) + { + _query["with_prices_only"] = request.WithPricesOnly.ToString(); + } if (request.Limit != null) { _query["limit"] = request.Limit.ToString(); @@ -292,6 +517,63 @@ ListBillingProductsRequest request throw new Exception(responseBody); } + public async Task CountBillingProductsAsync( + CountBillingProductsRequest 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.PriceUsageType != null) + { + _query["price_usage_type"] = request.PriceUsageType; + } + if (request.WithoutLinkedToPlan != null) + { + _query["without_linked_to_plan"] = request.WithoutLinkedToPlan.ToString(); + } + if (request.WithZeroPrice != null) + { + _query["with_zero_price"] = request.WithZeroPrice.ToString(); + } + if (request.WithPricesOnly != null) + { + _query["with_prices_only"] = request.WithPricesOnly.ToString(); + } + 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/products/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 UpsertBillingSubscriptionAsync( CreateBillingSubscriptionsRequestBody request ) diff --git a/src/SchematicHQ.Client/Billing/Requests/CountBillingProductsRequest.cs b/src/SchematicHQ.Client/Billing/Requests/CountBillingProductsRequest.cs new file mode 100644 index 0000000..1a84401 --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Requests/CountBillingProductsRequest.cs @@ -0,0 +1,37 @@ +namespace SchematicHQ.Client; + +public record CountBillingProductsRequest +{ + public string? Ids { get; init; } + + public string? Name { get; init; } + + public string? Q { get; init; } + + public string? PriceUsageType { get; init; } + + /// + /// Filter products that are not linked to any plan + /// + public bool? WithoutLinkedToPlan { get; init; } + + /// + /// Filter products that have zero price for free subscription type + /// + public bool? WithZeroPrice { get; init; } + + /// + /// Filter products that have prices + /// + public bool? WithPricesOnly { 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/Billing/Requests/CreateBillingPlanGroupRequestBody.cs b/src/SchematicHQ.Client/Billing/Requests/CreateBillingPlanGroupRequestBody.cs deleted file mode 100644 index 7a4272d..0000000 --- a/src/SchematicHQ.Client/Billing/Requests/CreateBillingPlanGroupRequestBody.cs +++ /dev/null @@ -1,14 +0,0 @@ -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 index 61f7de8..7ab958f 100644 --- a/src/SchematicHQ.Client/Billing/Requests/CreateBillingPriceRequestBody.cs +++ b/src/SchematicHQ.Client/Billing/Requests/CreateBillingPriceRequestBody.cs @@ -6,9 +6,15 @@ namespace SchematicHQ.Client; public record CreateBillingPriceRequestBody { + [JsonPropertyName("currency")] + public required string Currency { get; init; } + [JsonPropertyName("interval")] public required string Interval { get; init; } + [JsonPropertyName("meter_id")] + public string? MeterId { get; init; } + [JsonPropertyName("price")] public required int Price { get; init; } @@ -17,4 +23,7 @@ public record CreateBillingPriceRequestBody [JsonPropertyName("product_external_id")] public required string ProductExternalId { get; init; } + + [JsonPropertyName("usage_type")] + public required string UsageType { get; init; } } diff --git a/src/SchematicHQ.Client/Billing/Requests/CreateBillingSubscriptionsRequestBody.cs b/src/SchematicHQ.Client/Billing/Requests/CreateBillingSubscriptionsRequestBody.cs index dcaca86..8e00d41 100644 --- a/src/SchematicHQ.Client/Billing/Requests/CreateBillingSubscriptionsRequestBody.cs +++ b/src/SchematicHQ.Client/Billing/Requests/CreateBillingSubscriptionsRequestBody.cs @@ -7,9 +7,16 @@ namespace SchematicHQ.Client; public record CreateBillingSubscriptionsRequestBody { + [JsonPropertyName("currency")] + public required string Currency { get; init; } + [JsonPropertyName("customer_external_id")] public required string CustomerExternalId { get; init; } + [JsonPropertyName("discounts")] + public IEnumerable Discounts { get; init; } = + new List(); + [JsonPropertyName("expired_at")] public required DateTime ExpiredAt { get; init; } @@ -19,6 +26,12 @@ public record CreateBillingSubscriptionsRequestBody [JsonPropertyName("metadata")] public Dictionary? Metadata { get; init; } + [JsonPropertyName("period_end")] + public int? PeriodEnd { get; init; } + + [JsonPropertyName("period_start")] + public int? PeriodStart { get; init; } + [JsonPropertyName("product_external_ids")] public IEnumerable ProductExternalIds { get; init; } = new List(); @@ -31,4 +44,10 @@ public record CreateBillingSubscriptionsRequestBody [JsonPropertyName("total_price")] public required int TotalPrice { get; init; } + + [JsonPropertyName("trial_end")] + public int? TrialEnd { get; init; } + + [JsonPropertyName("trial_end_setting")] + public string? TrialEndSetting { get; init; } } diff --git a/src/SchematicHQ.Client/Billing/Requests/CreateCouponRequestBody.cs b/src/SchematicHQ.Client/Billing/Requests/CreateCouponRequestBody.cs new file mode 100644 index 0000000..0b349a0 --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Requests/CreateCouponRequestBody.cs @@ -0,0 +1,35 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record CreateCouponRequestBody +{ + [JsonPropertyName("amount_off")] + public required int AmountOff { get; init; } + + [JsonPropertyName("currency")] + public string? Currency { get; init; } + + [JsonPropertyName("duration")] + public required string Duration { get; init; } + + [JsonPropertyName("duration_in_months")] + public required int DurationInMonths { get; init; } + + [JsonPropertyName("external_id")] + public required string ExternalId { get; init; } + + [JsonPropertyName("max_redemptions")] + public required int MaxRedemptions { get; init; } + + [JsonPropertyName("name")] + public required string Name { get; init; } + + [JsonPropertyName("percent_off")] + public required double PercentOff { get; init; } + + [JsonPropertyName("times_redeemed")] + public required int TimesRedeemed { get; init; } +} diff --git a/src/SchematicHQ.Client/Billing/Requests/CreateInvoiceRequestBody.cs b/src/SchematicHQ.Client/Billing/Requests/CreateInvoiceRequestBody.cs new file mode 100644 index 0000000..41126b5 --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Requests/CreateInvoiceRequestBody.cs @@ -0,0 +1,44 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record CreateInvoiceRequestBody +{ + [JsonPropertyName("amount_due")] + public required int AmountDue { get; init; } + + [JsonPropertyName("amount_paid")] + public required int AmountPaid { get; init; } + + [JsonPropertyName("amount_remaining")] + public required int AmountRemaining { get; init; } + + [JsonPropertyName("collection_method")] + public required string CollectionMethod { get; init; } + + [JsonPropertyName("currency")] + public required string Currency { get; init; } + + [JsonPropertyName("customer_external_id")] + public required string CustomerExternalId { get; init; } + + [JsonPropertyName("due_date")] + public DateTime? DueDate { get; init; } + + [JsonPropertyName("external_id")] + public string? ExternalId { get; init; } + + [JsonPropertyName("payment_method_external_id")] + public string? PaymentMethodExternalId { get; init; } + + [JsonPropertyName("subscription_external_id")] + public string? SubscriptionExternalId { get; init; } + + [JsonPropertyName("subtotal")] + public required int Subtotal { get; init; } + + [JsonPropertyName("url")] + public string? Url { get; init; } +} diff --git a/src/SchematicHQ.Client/Billing/Requests/CreateMeterRequestBody.cs b/src/SchematicHQ.Client/Billing/Requests/CreateMeterRequestBody.cs new file mode 100644 index 0000000..104f5cd --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Requests/CreateMeterRequestBody.cs @@ -0,0 +1,20 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record CreateMeterRequestBody +{ + [JsonPropertyName("display_name")] + public required string DisplayName { get; init; } + + [JsonPropertyName("event_name")] + public required string EventName { get; init; } + + [JsonPropertyName("event_payload_key")] + public required string EventPayloadKey { get; init; } + + [JsonPropertyName("external_id")] + public required string ExternalId { get; init; } +} diff --git a/src/SchematicHQ.Client/Billing/Requests/CreatePaymentMethodRequestBody.cs b/src/SchematicHQ.Client/Billing/Requests/CreatePaymentMethodRequestBody.cs new file mode 100644 index 0000000..1205da0 --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Requests/CreatePaymentMethodRequestBody.cs @@ -0,0 +1,47 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record CreatePaymentMethodRequestBody +{ + [JsonPropertyName("account_last4")] + public string? AccountLast4 { get; init; } + + [JsonPropertyName("account_name")] + public string? AccountName { get; init; } + + [JsonPropertyName("bank_name")] + public string? BankName { get; init; } + + [JsonPropertyName("billing_email")] + public string? BillingEmail { get; init; } + + [JsonPropertyName("billing_name")] + public string? BillingName { get; init; } + + [JsonPropertyName("card_brand")] + public string? CardBrand { get; init; } + + [JsonPropertyName("card_exp_month")] + public int? CardExpMonth { get; init; } + + [JsonPropertyName("card_exp_year")] + public int? CardExpYear { get; init; } + + [JsonPropertyName("card_last4")] + public string? CardLast4 { get; init; } + + [JsonPropertyName("customer_external_id")] + public required string CustomerExternalId { get; init; } + + [JsonPropertyName("external_id")] + public required string ExternalId { get; init; } + + [JsonPropertyName("payment_method_type")] + public required string PaymentMethodType { get; init; } + + [JsonPropertyName("subscription_external_id")] + public string? SubscriptionExternalId { get; init; } +} diff --git a/src/SchematicHQ.Client/Billing/Requests/ListBillingProductsRequest.cs b/src/SchematicHQ.Client/Billing/Requests/ListBillingProductsRequest.cs index c050194..cd5a1a8 100644 --- a/src/SchematicHQ.Client/Billing/Requests/ListBillingProductsRequest.cs +++ b/src/SchematicHQ.Client/Billing/Requests/ListBillingProductsRequest.cs @@ -8,6 +8,23 @@ public record ListBillingProductsRequest public string? Q { get; init; } + public string? PriceUsageType { get; init; } + + /// + /// Filter products that are not linked to any plan + /// + public bool? WithoutLinkedToPlan { get; init; } + + /// + /// Filter products that have zero price for free subscription type + /// + public bool? WithZeroPrice { get; init; } + + /// + /// Filter products that have prices + /// + public bool? WithPricesOnly { get; init; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Billing/Requests/ListInvoicesRequest.cs b/src/SchematicHQ.Client/Billing/Requests/ListInvoicesRequest.cs new file mode 100644 index 0000000..bfbe231 --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Requests/ListInvoicesRequest.cs @@ -0,0 +1,20 @@ +namespace SchematicHQ.Client; + +public record ListInvoicesRequest +{ + public string? CompanyId { get; init; } + + public required string CustomerExternalId { get; init; } + + public string? SubscriptionExternalId { 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/Billing/Requests/ListMetersRequest.cs b/src/SchematicHQ.Client/Billing/Requests/ListMetersRequest.cs new file mode 100644 index 0000000..35593c2 --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Requests/ListMetersRequest.cs @@ -0,0 +1,16 @@ +namespace SchematicHQ.Client; + +public record ListMetersRequest +{ + public string? DisplayName { 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/Billing/Requests/ListPaymentMethodsRequest.cs b/src/SchematicHQ.Client/Billing/Requests/ListPaymentMethodsRequest.cs new file mode 100644 index 0000000..b6a9a8a --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Requests/ListPaymentMethodsRequest.cs @@ -0,0 +1,20 @@ +namespace SchematicHQ.Client; + +public record ListPaymentMethodsRequest +{ + public string? CompanyId { get; init; } + + public required string CustomerExternalId { get; init; } + + public string? SubscriptionExternalId { 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/Billing/Requests/ListProductPricesRequest.cs b/src/SchematicHQ.Client/Billing/Requests/ListProductPricesRequest.cs index 1eeb28a..c90c5d7 100644 --- a/src/SchematicHQ.Client/Billing/Requests/ListProductPricesRequest.cs +++ b/src/SchematicHQ.Client/Billing/Requests/ListProductPricesRequest.cs @@ -8,6 +8,23 @@ public record ListProductPricesRequest public string? Q { get; init; } + public string? PriceUsageType { get; init; } + + /// + /// Filter products that are not linked to any plan + /// + public bool? WithoutLinkedToPlan { get; init; } + + /// + /// Filter products that have zero price for free subscription type + /// + public bool? WithZeroPrice { get; init; } + + /// + /// Filter products that have prices + /// + public bool? WithPricesOnly { get; init; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Billing/Requests/SearchBillingPricesRequest.cs b/src/SchematicHQ.Client/Billing/Requests/SearchBillingPricesRequest.cs new file mode 100644 index 0000000..be693c4 --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Requests/SearchBillingPricesRequest.cs @@ -0,0 +1,22 @@ +namespace SchematicHQ.Client; + +public record SearchBillingPricesRequest +{ + public string? Ids { get; init; } + + public string? Interval { get; init; } + + public string? UsageType { get; init; } + + public int? Price { 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/Billing/Requests/UpdateBillingPlanGroupRequestBody.cs b/src/SchematicHQ.Client/Billing/Requests/UpdateBillingPlanGroupRequestBody.cs deleted file mode 100644 index 03c8eb5..0000000 --- a/src/SchematicHQ.Client/Billing/Requests/UpdateBillingPlanGroupRequestBody.cs +++ /dev/null @@ -1,14 +0,0 @@ -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/Billing/Types/CountBillingProductsParams.cs b/src/SchematicHQ.Client/Billing/Types/CountBillingProductsParams.cs new file mode 100644 index 0000000..fcdde2d --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Types/CountBillingProductsParams.cs @@ -0,0 +1,50 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record CountBillingProductsParams +{ + [JsonPropertyName("ids")] + public IEnumerable? Ids { get; init; } + + /// + /// Page limit (default 100) + /// + [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("price_usage_type")] + public string? PriceUsageType { get; init; } + + [JsonPropertyName("q")] + public string? Q { get; init; } + + /// + /// Filter products that have prices + /// + [JsonPropertyName("with_prices_only")] + public bool? WithPricesOnly { get; init; } + + /// + /// Filter products that have zero price for free subscription type + /// + [JsonPropertyName("with_zero_price")] + public bool? WithZeroPrice { get; init; } + + /// + /// Filter products that are not linked to any plan + /// + [JsonPropertyName("without_linked_to_plan")] + public bool? WithoutLinkedToPlan { get; init; } +} diff --git a/src/SchematicHQ.Client/Billing/Types/CountBillingProductsResponse.cs b/src/SchematicHQ.Client/Billing/Types/CountBillingProductsResponse.cs new file mode 100644 index 0000000..f05d7c8 --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Types/CountBillingProductsResponse.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record CountBillingProductsResponse +{ + [JsonPropertyName("data")] + public required CountResponse Data { get; init; } + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public required CountBillingProductsParams Params { get; init; } +} diff --git a/src/SchematicHQ.Client/Billing/Types/UpdateBillingPlanGroupResponse.cs b/src/SchematicHQ.Client/Billing/Types/DeleteProductPriceResponse.cs similarity index 74% rename from src/SchematicHQ.Client/Billing/Types/UpdateBillingPlanGroupResponse.cs rename to src/SchematicHQ.Client/Billing/Types/DeleteProductPriceResponse.cs index c7f3ebe..200b55b 100644 --- a/src/SchematicHQ.Client/Billing/Types/UpdateBillingPlanGroupResponse.cs +++ b/src/SchematicHQ.Client/Billing/Types/DeleteProductPriceResponse.cs @@ -5,10 +5,10 @@ namespace SchematicHQ.Client; -public record UpdateBillingPlanGroupResponse +public record DeleteProductPriceResponse { [JsonPropertyName("data")] - public required BillingPlanGroupResponseData Data { get; init; } + public required DeleteResponse Data { get; init; } /// /// Input parameters diff --git a/src/SchematicHQ.Client/Billing/Types/ListBillingProductsParams.cs b/src/SchematicHQ.Client/Billing/Types/ListBillingProductsParams.cs index 479642d..6bfb852 100644 --- a/src/SchematicHQ.Client/Billing/Types/ListBillingProductsParams.cs +++ b/src/SchematicHQ.Client/Billing/Types/ListBillingProductsParams.cs @@ -24,6 +24,27 @@ public record ListBillingProductsParams [JsonPropertyName("offset")] public int? Offset { get; init; } + [JsonPropertyName("price_usage_type")] + public string? PriceUsageType { get; init; } + [JsonPropertyName("q")] public string? Q { get; init; } + + /// + /// Filter products that have prices + /// + [JsonPropertyName("with_prices_only")] + public bool? WithPricesOnly { get; init; } + + /// + /// Filter products that have zero price for free subscription type + /// + [JsonPropertyName("with_zero_price")] + public bool? WithZeroPrice { get; init; } + + /// + /// Filter products that are not linked to any plan + /// + [JsonPropertyName("without_linked_to_plan")] + public bool? WithoutLinkedToPlan { get; init; } } diff --git a/src/SchematicHQ.Client/Billing/Types/ListInvoicesParams.cs b/src/SchematicHQ.Client/Billing/Types/ListInvoicesParams.cs new file mode 100644 index 0000000..7108f7a --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Types/ListInvoicesParams.cs @@ -0,0 +1,29 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record ListInvoicesParams +{ + [JsonPropertyName("company_id")] + public string? CompanyId { get; init; } + + [JsonPropertyName("customer_external_id")] + public string? CustomerExternalId { get; init; } + + /// + /// Page limit (default 100) + /// + [JsonPropertyName("limit")] + public int? Limit { get; init; } + + /// + /// Page offset (default 0) + /// + [JsonPropertyName("offset")] + public int? Offset { get; init; } + + [JsonPropertyName("subscription_external_id")] + public string? SubscriptionExternalId { get; init; } +} diff --git a/src/SchematicHQ.Client/Events/Types/ListMetricCountsResponse.cs b/src/SchematicHQ.Client/Billing/Types/ListInvoicesResponse.cs similarity index 57% rename from src/SchematicHQ.Client/Events/Types/ListMetricCountsResponse.cs rename to src/SchematicHQ.Client/Billing/Types/ListInvoicesResponse.cs index 369bbb2..004a50c 100644 --- a/src/SchematicHQ.Client/Events/Types/ListMetricCountsResponse.cs +++ b/src/SchematicHQ.Client/Billing/Types/ListInvoicesResponse.cs @@ -5,18 +5,17 @@ namespace SchematicHQ.Client; -public record ListMetricCountsResponse +public record ListInvoicesResponse { /// /// 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 ListMetricCountsParams Params { get; init; } + public required ListInvoicesParams Params { get; init; } } diff --git a/src/SchematicHQ.Client/Billing/Types/ListMetersParams.cs b/src/SchematicHQ.Client/Billing/Types/ListMetersParams.cs new file mode 100644 index 0000000..2a4d18d --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Types/ListMetersParams.cs @@ -0,0 +1,23 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record ListMetersParams +{ + [JsonPropertyName("display_name")] + public string? DisplayName { 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/Billing/Types/ListMetersResponse.cs b/src/SchematicHQ.Client/Billing/Types/ListMetersResponse.cs new file mode 100644 index 0000000..d0714a8 --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Types/ListMetersResponse.cs @@ -0,0 +1,22 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record ListMetersResponse +{ + /// + /// The returned resources + /// + [JsonPropertyName("data")] + public IEnumerable Data { get; init; } = + new List(); + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public required ListMetersParams Params { get; init; } +} diff --git a/src/SchematicHQ.Client/Billing/Types/ListPaymentMethodsParams.cs b/src/SchematicHQ.Client/Billing/Types/ListPaymentMethodsParams.cs new file mode 100644 index 0000000..caedfc7 --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Types/ListPaymentMethodsParams.cs @@ -0,0 +1,29 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record ListPaymentMethodsParams +{ + [JsonPropertyName("company_id")] + public string? CompanyId { get; init; } + + [JsonPropertyName("customer_external_id")] + public string? CustomerExternalId { get; init; } + + /// + /// Page limit (default 100) + /// + [JsonPropertyName("limit")] + public int? Limit { get; init; } + + /// + /// Page offset (default 0) + /// + [JsonPropertyName("offset")] + public int? Offset { get; init; } + + [JsonPropertyName("subscription_external_id")] + public string? SubscriptionExternalId { get; init; } +} diff --git a/src/SchematicHQ.Client/Billing/Types/ListPaymentMethodsResponse.cs b/src/SchematicHQ.Client/Billing/Types/ListPaymentMethodsResponse.cs new file mode 100644 index 0000000..15f7729 --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Types/ListPaymentMethodsResponse.cs @@ -0,0 +1,22 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record ListPaymentMethodsResponse +{ + /// + /// The returned resources + /// + [JsonPropertyName("data")] + public IEnumerable Data { get; init; } = + new List(); + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public required ListPaymentMethodsParams Params { get; init; } +} diff --git a/src/SchematicHQ.Client/Billing/Types/ListProductPricesParams.cs b/src/SchematicHQ.Client/Billing/Types/ListProductPricesParams.cs index 0bfc512..16cd253 100644 --- a/src/SchematicHQ.Client/Billing/Types/ListProductPricesParams.cs +++ b/src/SchematicHQ.Client/Billing/Types/ListProductPricesParams.cs @@ -24,6 +24,27 @@ public record ListProductPricesParams [JsonPropertyName("offset")] public int? Offset { get; init; } + [JsonPropertyName("price_usage_type")] + public string? PriceUsageType { get; init; } + [JsonPropertyName("q")] public string? Q { get; init; } + + /// + /// Filter products that have prices + /// + [JsonPropertyName("with_prices_only")] + public bool? WithPricesOnly { get; init; } + + /// + /// Filter products that have zero price for free subscription type + /// + [JsonPropertyName("with_zero_price")] + public bool? WithZeroPrice { get; init; } + + /// + /// Filter products that are not linked to any plan + /// + [JsonPropertyName("without_linked_to_plan")] + public bool? WithoutLinkedToPlan { get; init; } } diff --git a/src/SchematicHQ.Client/Billing/Types/SearchBillingPricesParams.cs b/src/SchematicHQ.Client/Billing/Types/SearchBillingPricesParams.cs new file mode 100644 index 0000000..54508cc --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Types/SearchBillingPricesParams.cs @@ -0,0 +1,32 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record SearchBillingPricesParams +{ + [JsonPropertyName("ids")] + public IEnumerable? Ids { get; init; } + + [JsonPropertyName("interval")] + public string? Interval { get; init; } + + /// + /// Page limit (default 100) + /// + [JsonPropertyName("limit")] + public int? Limit { get; init; } + + /// + /// Page offset (default 0) + /// + [JsonPropertyName("offset")] + public int? Offset { get; init; } + + [JsonPropertyName("price")] + public int? Price { get; init; } + + [JsonPropertyName("usage_type")] + public string? UsageType { get; init; } +} diff --git a/src/SchematicHQ.Client/Billing/Types/SearchBillingPricesResponse.cs b/src/SchematicHQ.Client/Billing/Types/SearchBillingPricesResponse.cs new file mode 100644 index 0000000..2f021cb --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Types/SearchBillingPricesResponse.cs @@ -0,0 +1,21 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record SearchBillingPricesResponse +{ + /// + /// The returned resources + /// + [JsonPropertyName("data")] + public IEnumerable Data { get; init; } = new List(); + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public required SearchBillingPricesParams Params { get; init; } +} diff --git a/src/SchematicHQ.Client/Billing/Types/CreateBillingPlanGroupResponse.cs b/src/SchematicHQ.Client/Billing/Types/UpsertBillingCouponResponse.cs similarity index 74% rename from src/SchematicHQ.Client/Billing/Types/CreateBillingPlanGroupResponse.cs rename to src/SchematicHQ.Client/Billing/Types/UpsertBillingCouponResponse.cs index 3a00501..8c488b7 100644 --- a/src/SchematicHQ.Client/Billing/Types/CreateBillingPlanGroupResponse.cs +++ b/src/SchematicHQ.Client/Billing/Types/UpsertBillingCouponResponse.cs @@ -5,10 +5,10 @@ namespace SchematicHQ.Client; -public record CreateBillingPlanGroupResponse +public record UpsertBillingCouponResponse { [JsonPropertyName("data")] - public required BillingPlanGroupResponseData Data { get; init; } + public required BillingCouponResponseData Data { get; init; } /// /// Input parameters diff --git a/src/SchematicHQ.Client/Events/Types/GetEventSummaryBySubtypeResponse.cs b/src/SchematicHQ.Client/Billing/Types/UpsertBillingMeterResponse.cs similarity index 75% rename from src/SchematicHQ.Client/Events/Types/GetEventSummaryBySubtypeResponse.cs rename to src/SchematicHQ.Client/Billing/Types/UpsertBillingMeterResponse.cs index 64a4dad..3e479db 100644 --- a/src/SchematicHQ.Client/Events/Types/GetEventSummaryBySubtypeResponse.cs +++ b/src/SchematicHQ.Client/Billing/Types/UpsertBillingMeterResponse.cs @@ -5,10 +5,10 @@ namespace SchematicHQ.Client; -public record GetEventSummaryBySubtypeResponse +public record UpsertBillingMeterResponse { [JsonPropertyName("data")] - public required EventSummaryResponseData Data { get; init; } + public required BillingMeterResponseData Data { get; init; } /// /// Input parameters diff --git a/src/SchematicHQ.Client/Billing/Types/GetBillingPlanGroupByAccountIdResponse.cs b/src/SchematicHQ.Client/Billing/Types/UpsertInvoiceResponse.cs similarity index 73% rename from src/SchematicHQ.Client/Billing/Types/GetBillingPlanGroupByAccountIdResponse.cs rename to src/SchematicHQ.Client/Billing/Types/UpsertInvoiceResponse.cs index e71bfec..9a3b354 100644 --- a/src/SchematicHQ.Client/Billing/Types/GetBillingPlanGroupByAccountIdResponse.cs +++ b/src/SchematicHQ.Client/Billing/Types/UpsertInvoiceResponse.cs @@ -5,10 +5,10 @@ namespace SchematicHQ.Client; -public record GetBillingPlanGroupByAccountIdResponse +public record UpsertInvoiceResponse { [JsonPropertyName("data")] - public required BillingPlanGroupResponseData Data { get; init; } + public required InvoiceResponseData Data { get; init; } /// /// Input parameters diff --git a/src/SchematicHQ.Client/Billing/Types/UpsertPaymentMethodResponse.cs b/src/SchematicHQ.Client/Billing/Types/UpsertPaymentMethodResponse.cs new file mode 100644 index 0000000..bccad38 --- /dev/null +++ b/src/SchematicHQ.Client/Billing/Types/UpsertPaymentMethodResponse.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record UpsertPaymentMethodResponse +{ + [JsonPropertyName("data")] + public required PaymentMethodResponseData Data { get; init; } + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public Dictionary Params { get; init; } = new Dictionary(); +} diff --git a/src/SchematicHQ.Client/Checkout/CheckoutClient.cs b/src/SchematicHQ.Client/Checkout/CheckoutClient.cs new file mode 100644 index 0000000..88216a9 --- /dev/null +++ b/src/SchematicHQ.Client/Checkout/CheckoutClient.cs @@ -0,0 +1,81 @@ +using System.Net.Http; +using System.Text.Json; +using SchematicHQ.Client; +using SchematicHQ.Client.Core; + +#nullable enable + +namespace SchematicHQ.Client; + +public class CheckoutClient +{ + private RawClient _client; + + public CheckoutClient(RawClient client) + { + _client = client; + } + + public async Task InternalAsync( + ChangeSubscriptionInternalRequestBody request + ) + { + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + Method = HttpMethod.Post, + Path = "checkout-internal", + 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 PreviewCheckoutInternalAsync( + ChangeSubscriptionInternalRequestBody request + ) + { + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + Method = HttpMethod.Post, + Path = "checkout-internal/preview", + 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 UpdateCustomerSubscriptionTrialEndAsync( + string subscriptionId, + UpdateTrialEndRequestBody request + ) + { + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + Method = HttpMethod.Put, + Path = $"subscription/{subscriptionId}/edit-trial-end", + Body = request + } + ); + var responseBody = await response.Raw.Content.ReadAsStringAsync(); + if (response.StatusCode is >= 200 and < 400) + { + return JsonSerializer.Deserialize( + responseBody + )!; + } + throw new Exception(responseBody); + } +} diff --git a/src/SchematicHQ.Client/Checkout/Requests/UpdateTrialEndRequestBody.cs b/src/SchematicHQ.Client/Checkout/Requests/UpdateTrialEndRequestBody.cs new file mode 100644 index 0000000..23efedf --- /dev/null +++ b/src/SchematicHQ.Client/Checkout/Requests/UpdateTrialEndRequestBody.cs @@ -0,0 +1,11 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record UpdateTrialEndRequestBody +{ + [JsonPropertyName("trial_end")] + public DateTime? TrialEnd { get; init; } +} diff --git a/src/SchematicHQ.Client/Checkout/Types/CheckoutInternalResponse.cs b/src/SchematicHQ.Client/Checkout/Types/CheckoutInternalResponse.cs new file mode 100644 index 0000000..ddf124e --- /dev/null +++ b/src/SchematicHQ.Client/Checkout/Types/CheckoutInternalResponse.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record CheckoutInternalResponse +{ + [JsonPropertyName("data")] + public required BillingSubscriptionResponseData Data { get; init; } + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public Dictionary Params { get; init; } = new Dictionary(); +} diff --git a/src/SchematicHQ.Client/Checkout/Types/PreviewCheckoutInternalResponse.cs b/src/SchematicHQ.Client/Checkout/Types/PreviewCheckoutInternalResponse.cs new file mode 100644 index 0000000..2be509f --- /dev/null +++ b/src/SchematicHQ.Client/Checkout/Types/PreviewCheckoutInternalResponse.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record PreviewCheckoutInternalResponse +{ + [JsonPropertyName("data")] + public required PreviewSubscriptionChangeResponseData Data { get; init; } + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public Dictionary Params { get; init; } = new Dictionary(); +} diff --git a/src/SchematicHQ.Client/Checkout/Types/UpdateCustomerSubscriptionTrialEndResponse.cs b/src/SchematicHQ.Client/Checkout/Types/UpdateCustomerSubscriptionTrialEndResponse.cs new file mode 100644 index 0000000..125b2f1 --- /dev/null +++ b/src/SchematicHQ.Client/Checkout/Types/UpdateCustomerSubscriptionTrialEndResponse.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record UpdateCustomerSubscriptionTrialEndResponse +{ + [JsonPropertyName("data")] + public required BillingSubscriptionView Data { get; init; } + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public Dictionary Params { get; init; } = new Dictionary(); +} diff --git a/src/SchematicHQ.Client/Companies/CompaniesClient.cs b/src/SchematicHQ.Client/Companies/CompaniesClient.cs index aef9939..63b43b4 100644 --- a/src/SchematicHQ.Client/Companies/CompaniesClient.cs +++ b/src/SchematicHQ.Client/Companies/CompaniesClient.cs @@ -35,6 +35,10 @@ public async Task ListCompaniesAsync(ListCompaniesRequest { _query["without_feature_override_for"] = request.WithoutFeatureOverrideFor; } + if (request.WithoutPlan != null) + { + _query["without_plan"] = request.WithoutPlan.ToString(); + } if (request.Limit != null) { _query["limit"] = request.Limit.ToString(); @@ -130,6 +134,10 @@ public async Task CountCompaniesAsync(CountCompaniesRequ { _query["without_feature_override_for"] = request.WithoutFeatureOverrideFor; } + if (request.WithoutPlan != null) + { + _query["without_plan"] = request.WithoutPlan.ToString(); + } if (request.Limit != null) { _query["limit"] = request.Limit.ToString(); @@ -320,7 +328,15 @@ public async Task GetActiveCompanySubscrip GetActiveCompanySubscriptionRequest request ) { - var _query = new Dictionary() { { "company_id", request.CompanyId }, }; + var _query = new Dictionary() { }; + if (request.CompanyId != null) + { + _query["company_id"] = request.CompanyId; + } + if (request.CompanyIds != null) + { + _query["company_ids"] = request.CompanyIds; + } if (request.Limit != null) { _query["limit"] = request.Limit.ToString(); @@ -460,14 +476,14 @@ ListEntityTraitDefinitionsRequest request { _query["ids"] = request.Ids; } - if (request.TraitType != null) - { - _query["trait_type"] = JsonSerializer.Serialize(request.TraitType.Value); - } if (request.Q != null) { _query["q"] = request.Q; } + if (request.TraitType != null) + { + _query["trait_type"] = JsonSerializer.Serialize(request.TraitType.Value); + } if (request.Limit != null) { _query["limit"] = request.Limit.ToString(); @@ -567,14 +583,14 @@ CountEntityTraitDefinitionsRequest request { _query["ids"] = request.Ids; } - if (request.TraitType != null) - { - _query["trait_type"] = JsonSerializer.Serialize(request.TraitType.Value); - } if (request.Q != null) { _query["q"] = request.Q; } + if (request.TraitType != null) + { + _query["trait_type"] = JsonSerializer.Serialize(request.TraitType.Value); + } if (request.Limit != null) { _query["limit"] = request.Limit.ToString(); diff --git a/src/SchematicHQ.Client/Companies/Requests/CountCompaniesRequest.cs b/src/SchematicHQ.Client/Companies/Requests/CountCompaniesRequest.cs index d0c9e7c..bd5bb2f 100644 --- a/src/SchematicHQ.Client/Companies/Requests/CountCompaniesRequest.cs +++ b/src/SchematicHQ.Client/Companies/Requests/CountCompaniesRequest.cs @@ -2,12 +2,18 @@ namespace SchematicHQ.Client; public record CountCompaniesRequest { + /// + /// Filter companies by multiple company IDs (starts with comp_) + /// public string? Ids { get; init; } + /// + /// Filter companies by plan ID (starts with plan_) + /// public string? PlanId { get; init; } /// - /// Search filter + /// Search for companies by name, keys or string traits /// public string? Q { get; init; } @@ -16,6 +22,11 @@ public record CountCompaniesRequest /// public string? WithoutFeatureOverrideFor { get; init; } + /// + /// Filter out companies that have a plan + /// + public bool? WithoutPlan { get; init; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Companies/Requests/CountEntityTraitDefinitionsRequest.cs b/src/SchematicHQ.Client/Companies/Requests/CountEntityTraitDefinitionsRequest.cs index 0cbad0b..9f438c8 100644 --- a/src/SchematicHQ.Client/Companies/Requests/CountEntityTraitDefinitionsRequest.cs +++ b/src/SchematicHQ.Client/Companies/Requests/CountEntityTraitDefinitionsRequest.cs @@ -10,10 +10,10 @@ public record CountEntityTraitDefinitionsRequest public string? Ids { get; init; } - public CountEntityTraitDefinitionsRequestTraitType? TraitType { get; init; } - public string? Q { get; init; } + public CountEntityTraitDefinitionsRequestTraitType? TraitType { get; init; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Companies/Requests/CountUsersRequest.cs b/src/SchematicHQ.Client/Companies/Requests/CountUsersRequest.cs index 36c19e4..dad546e 100644 --- a/src/SchematicHQ.Client/Companies/Requests/CountUsersRequest.cs +++ b/src/SchematicHQ.Client/Companies/Requests/CountUsersRequest.cs @@ -2,14 +2,23 @@ namespace SchematicHQ.Client; public record CountUsersRequest { + /// + /// Filter users by company ID (starts with comp_) + /// public string? CompanyId { get; init; } + /// + /// Filter users by multiple user IDs (starts with user_) + /// public string? Ids { get; init; } + /// + /// Filter users by plan ID (starts with plan_) + /// public string? PlanId { get; init; } /// - /// Search filter + /// Search for users by name, keys or string traits /// public string? Q { get; init; } diff --git a/src/SchematicHQ.Client/Companies/Requests/GetActiveCompanySubscriptionRequest.cs b/src/SchematicHQ.Client/Companies/Requests/GetActiveCompanySubscriptionRequest.cs index e1ccb86..e4554ad 100644 --- a/src/SchematicHQ.Client/Companies/Requests/GetActiveCompanySubscriptionRequest.cs +++ b/src/SchematicHQ.Client/Companies/Requests/GetActiveCompanySubscriptionRequest.cs @@ -2,7 +2,9 @@ namespace SchematicHQ.Client; public record GetActiveCompanySubscriptionRequest { - public required string CompanyId { get; init; } + public string? CompanyId { get; init; } + + public string? CompanyIds { get; init; } /// /// Page limit (default 100) diff --git a/src/SchematicHQ.Client/Companies/Requests/ListCompaniesRequest.cs b/src/SchematicHQ.Client/Companies/Requests/ListCompaniesRequest.cs index 164ab9b..078ec26 100644 --- a/src/SchematicHQ.Client/Companies/Requests/ListCompaniesRequest.cs +++ b/src/SchematicHQ.Client/Companies/Requests/ListCompaniesRequest.cs @@ -2,12 +2,18 @@ namespace SchematicHQ.Client; public record ListCompaniesRequest { + /// + /// Filter companies by multiple company IDs (starts with comp_) + /// public string? Ids { get; init; } + /// + /// Filter companies by plan ID (starts with plan_) + /// public string? PlanId { get; init; } /// - /// Search filter + /// Search for companies by name, keys or string traits /// public string? Q { get; init; } @@ -16,6 +22,11 @@ public record ListCompaniesRequest /// public string? WithoutFeatureOverrideFor { get; init; } + /// + /// Filter out companies that have a plan + /// + public bool? WithoutPlan { get; init; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Companies/Requests/ListEntityTraitDefinitionsRequest.cs b/src/SchematicHQ.Client/Companies/Requests/ListEntityTraitDefinitionsRequest.cs index 9655846..8f46f85 100644 --- a/src/SchematicHQ.Client/Companies/Requests/ListEntityTraitDefinitionsRequest.cs +++ b/src/SchematicHQ.Client/Companies/Requests/ListEntityTraitDefinitionsRequest.cs @@ -10,10 +10,10 @@ public record ListEntityTraitDefinitionsRequest public string? Ids { get; init; } - public ListEntityTraitDefinitionsRequestTraitType? TraitType { get; init; } - public string? Q { get; init; } + public ListEntityTraitDefinitionsRequestTraitType? TraitType { get; init; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Companies/Requests/ListUsersRequest.cs b/src/SchematicHQ.Client/Companies/Requests/ListUsersRequest.cs index 3cbb221..8587934 100644 --- a/src/SchematicHQ.Client/Companies/Requests/ListUsersRequest.cs +++ b/src/SchematicHQ.Client/Companies/Requests/ListUsersRequest.cs @@ -2,14 +2,23 @@ namespace SchematicHQ.Client; public record ListUsersRequest { + /// + /// Filter users by company ID (starts with comp_) + /// public string? CompanyId { get; init; } + /// + /// Filter users by multiple user IDs (starts with user_) + /// public string? Ids { get; init; } + /// + /// Filter users by plan ID (starts with plan_) + /// public string? PlanId { get; init; } /// - /// Search filter + /// Search for users by name, keys or string traits /// public string? Q { get; init; } diff --git a/src/SchematicHQ.Client/Companies/Types/CountCompaniesParams.cs b/src/SchematicHQ.Client/Companies/Types/CountCompaniesParams.cs index 43a0c33..725f7f1 100644 --- a/src/SchematicHQ.Client/Companies/Types/CountCompaniesParams.cs +++ b/src/SchematicHQ.Client/Companies/Types/CountCompaniesParams.cs @@ -6,6 +6,9 @@ namespace SchematicHQ.Client; public record CountCompaniesParams { + /// + /// Filter companies by multiple company IDs (starts with comp_) + /// [JsonPropertyName("ids")] public IEnumerable? Ids { get; init; } @@ -21,11 +24,14 @@ public record CountCompaniesParams [JsonPropertyName("offset")] public int? Offset { get; init; } + /// + /// Filter companies by plan ID (starts with plan_) + /// [JsonPropertyName("plan_id")] public string? PlanId { get; init; } /// - /// Search filter + /// Search for companies by name, keys or string traits /// [JsonPropertyName("q")] public string? Q { get; init; } @@ -35,4 +41,10 @@ public record CountCompaniesParams /// [JsonPropertyName("without_feature_override_for")] public string? WithoutFeatureOverrideFor { get; init; } + + /// + /// Filter out companies that have a plan + /// + [JsonPropertyName("without_plan")] + public bool? WithoutPlan { get; init; } } diff --git a/src/SchematicHQ.Client/Companies/Types/CountUsersParams.cs b/src/SchematicHQ.Client/Companies/Types/CountUsersParams.cs index c1247a5..71c9844 100644 --- a/src/SchematicHQ.Client/Companies/Types/CountUsersParams.cs +++ b/src/SchematicHQ.Client/Companies/Types/CountUsersParams.cs @@ -6,9 +6,15 @@ namespace SchematicHQ.Client; public record CountUsersParams { + /// + /// Filter users by company ID (starts with comp_) + /// [JsonPropertyName("company_id")] public string? CompanyId { get; init; } + /// + /// Filter users by multiple user IDs (starts with user_) + /// [JsonPropertyName("ids")] public IEnumerable? Ids { get; init; } @@ -24,11 +30,14 @@ public record CountUsersParams [JsonPropertyName("offset")] public int? Offset { get; init; } + /// + /// Filter users by plan ID (starts with plan_) + /// [JsonPropertyName("plan_id")] public string? PlanId { get; init; } /// - /// Search filter + /// Search for users by name, keys or string traits /// [JsonPropertyName("q")] public string? Q { get; init; } diff --git a/src/SchematicHQ.Client/Companies/Types/GetActiveCompanySubscriptionParams.cs b/src/SchematicHQ.Client/Companies/Types/GetActiveCompanySubscriptionParams.cs index 99dc620..eca64f3 100644 --- a/src/SchematicHQ.Client/Companies/Types/GetActiveCompanySubscriptionParams.cs +++ b/src/SchematicHQ.Client/Companies/Types/GetActiveCompanySubscriptionParams.cs @@ -9,6 +9,9 @@ public record GetActiveCompanySubscriptionParams [JsonPropertyName("company_id")] public string? CompanyId { get; init; } + [JsonPropertyName("company_ids")] + public IEnumerable? CompanyIds { get; init; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Companies/Types/ListCompaniesParams.cs b/src/SchematicHQ.Client/Companies/Types/ListCompaniesParams.cs index cb787f5..f25ebe1 100644 --- a/src/SchematicHQ.Client/Companies/Types/ListCompaniesParams.cs +++ b/src/SchematicHQ.Client/Companies/Types/ListCompaniesParams.cs @@ -6,6 +6,9 @@ namespace SchematicHQ.Client; public record ListCompaniesParams { + /// + /// Filter companies by multiple company IDs (starts with comp_) + /// [JsonPropertyName("ids")] public IEnumerable? Ids { get; init; } @@ -21,11 +24,14 @@ public record ListCompaniesParams [JsonPropertyName("offset")] public int? Offset { get; init; } + /// + /// Filter companies by plan ID (starts with plan_) + /// [JsonPropertyName("plan_id")] public string? PlanId { get; init; } /// - /// Search filter + /// Search for companies by name, keys or string traits /// [JsonPropertyName("q")] public string? Q { get; init; } @@ -35,4 +41,10 @@ public record ListCompaniesParams /// [JsonPropertyName("without_feature_override_for")] public string? WithoutFeatureOverrideFor { get; init; } + + /// + /// Filter out companies that have a plan + /// + [JsonPropertyName("without_plan")] + public bool? WithoutPlan { get; init; } } diff --git a/src/SchematicHQ.Client/Companies/Types/ListUsersParams.cs b/src/SchematicHQ.Client/Companies/Types/ListUsersParams.cs index c2fc42b..ee29722 100644 --- a/src/SchematicHQ.Client/Companies/Types/ListUsersParams.cs +++ b/src/SchematicHQ.Client/Companies/Types/ListUsersParams.cs @@ -6,9 +6,15 @@ namespace SchematicHQ.Client; public record ListUsersParams { + /// + /// Filter users by company ID (starts with comp_) + /// [JsonPropertyName("company_id")] public string? CompanyId { get; init; } + /// + /// Filter users by multiple user IDs (starts with user_) + /// [JsonPropertyName("ids")] public IEnumerable? Ids { get; init; } @@ -24,11 +30,14 @@ public record ListUsersParams [JsonPropertyName("offset")] public int? Offset { get; init; } + /// + /// Filter users by plan ID (starts with plan_) + /// [JsonPropertyName("plan_id")] public string? PlanId { get; init; } /// - /// Search filter + /// Search for users by name, keys or string traits /// [JsonPropertyName("q")] public string? Q { get; init; } diff --git a/src/SchematicHQ.Client/Components/ComponentsClient.cs b/src/SchematicHQ.Client/Components/ComponentsClient.cs index 266f819..44b6919 100644 --- a/src/SchematicHQ.Client/Components/ComponentsClient.cs +++ b/src/SchematicHQ.Client/Components/ComponentsClient.cs @@ -152,4 +152,33 @@ public async Task CountComponentsAsync(CountComponentsR } throw new Exception(responseBody); } + + public async Task PreviewComponentDataAsync( + PreviewComponentDataRequest request + ) + { + var _query = new Dictionary() { }; + if (request.CompanyId != null) + { + _query["company_id"] = request.CompanyId; + } + if (request.ComponentId != null) + { + _query["component_id"] = request.ComponentId; + } + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + Method = HttpMethod.Get, + Path = "components/preview-data", + Query = _query + } + ); + var responseBody = await response.Raw.Content.ReadAsStringAsync(); + if (response.StatusCode is >= 200 and < 400) + { + return JsonSerializer.Deserialize(responseBody)!; + } + throw new Exception(responseBody); + } } diff --git a/src/SchematicHQ.Client/Components/Requests/PreviewComponentDataRequest.cs b/src/SchematicHQ.Client/Components/Requests/PreviewComponentDataRequest.cs new file mode 100644 index 0000000..3c8444c --- /dev/null +++ b/src/SchematicHQ.Client/Components/Requests/PreviewComponentDataRequest.cs @@ -0,0 +1,8 @@ +namespace SchematicHQ.Client; + +public record PreviewComponentDataRequest +{ + public string? CompanyId { get; init; } + + public string? ComponentId { get; init; } +} diff --git a/src/SchematicHQ.Client/Components/Types/PreviewComponentDataParams.cs b/src/SchematicHQ.Client/Components/Types/PreviewComponentDataParams.cs new file mode 100644 index 0000000..1ae13bf --- /dev/null +++ b/src/SchematicHQ.Client/Components/Types/PreviewComponentDataParams.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record PreviewComponentDataParams +{ + [JsonPropertyName("company_id")] + public string? CompanyId { get; init; } + + [JsonPropertyName("component_id")] + public string? ComponentId { get; init; } +} diff --git a/src/SchematicHQ.Client/Components/Types/PreviewComponentDataResponse.cs b/src/SchematicHQ.Client/Components/Types/PreviewComponentDataResponse.cs new file mode 100644 index 0000000..e8efa2a --- /dev/null +++ b/src/SchematicHQ.Client/Components/Types/PreviewComponentDataResponse.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record PreviewComponentDataResponse +{ + [JsonPropertyName("data")] + public required ComponentPreviewResponseData Data { get; init; } + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public required PreviewComponentDataParams Params { get; init; } +} diff --git a/src/SchematicHQ.Client/Crm/Requests/CreateCrmLineItemRequestBody.cs b/src/SchematicHQ.Client/Crm/Requests/CreateCrmLineItemRequestBody.cs index ed74b97..8a15839 100644 --- a/src/SchematicHQ.Client/Crm/Requests/CreateCrmLineItemRequestBody.cs +++ b/src/SchematicHQ.Client/Crm/Requests/CreateCrmLineItemRequestBody.cs @@ -6,9 +6,6 @@ namespace SchematicHQ.Client; public record CreateCrmLineItemRequestBody { - [JsonPropertyName("TermMonth")] - public int? TermMonth { get; init; } - [JsonPropertyName("amount")] public required string Amount { get; init; } @@ -27,6 +24,9 @@ public record CreateCrmLineItemRequestBody [JsonPropertyName("quantity")] public required int Quantity { get; init; } + [JsonPropertyName("term_month")] + public int? TermMonth { get; init; } + [JsonPropertyName("total_discount")] public string? TotalDiscount { get; init; } } diff --git a/src/SchematicHQ.Client/Entitlements/EntitlementsClient.cs b/src/SchematicHQ.Client/Entitlements/EntitlementsClient.cs index 094f433..3ba8446 100644 --- a/src/SchematicHQ.Client/Entitlements/EntitlementsClient.cs +++ b/src/SchematicHQ.Client/Entitlements/EntitlementsClient.cs @@ -41,6 +41,10 @@ ListCompanyOverridesRequest request { _query["ids"] = request.Ids; } + if (request.WithoutExpired != null) + { + _query["without_expired"] = request.WithoutExpired.ToString(); + } if (request.Q != null) { _query["q"] = request.Q; @@ -171,6 +175,10 @@ CountCompanyOverridesRequest request { _query["ids"] = request.Ids; } + if (request.WithoutExpired != null) + { + _query["without_expired"] = request.WithoutExpired.ToString(); + } if (request.Q != null) { _query["q"] = request.Q; @@ -286,6 +294,11 @@ ListFeatureUsageRequest request { _query["q"] = request.Q; } + if (request.WithoutNegativeEntitlements != null) + { + _query["without_negative_entitlements"] = + request.WithoutNegativeEntitlements.ToString(); + } if (request.Limit != null) { _query["limit"] = request.Limit.ToString(); @@ -331,6 +344,11 @@ CountFeatureUsageRequest request { _query["q"] = request.Q; } + if (request.WithoutNegativeEntitlements != null) + { + _query["without_negative_entitlements"] = + request.WithoutNegativeEntitlements.ToString(); + } if (request.Limit != null) { _query["limit"] = request.Limit.ToString(); @@ -450,6 +468,10 @@ ListPlanEntitlementsRequest request { _query["q"] = request.Q; } + if (request.WithMeteredProducts != null) + { + _query["with_metered_products"] = request.WithMeteredProducts.ToString(); + } if (request.Limit != null) { _query["limit"] = request.Limit.ToString(); @@ -580,6 +602,10 @@ CountPlanEntitlementsRequest request { _query["q"] = request.Q; } + if (request.WithMeteredProducts != null) + { + _query["with_metered_products"] = request.WithMeteredProducts.ToString(); + } if (request.Limit != null) { _query["limit"] = request.Limit.ToString(); diff --git a/src/SchematicHQ.Client/Entitlements/Requests/CountCompanyOverridesRequest.cs b/src/SchematicHQ.Client/Entitlements/Requests/CountCompanyOverridesRequest.cs index 29e1430..ff57098 100644 --- a/src/SchematicHQ.Client/Entitlements/Requests/CountCompanyOverridesRequest.cs +++ b/src/SchematicHQ.Client/Entitlements/Requests/CountCompanyOverridesRequest.cs @@ -2,16 +2,39 @@ namespace SchematicHQ.Client; public record CountCompanyOverridesRequest { + /// + /// Filter company overrides by a single company ID (starting with comp_) + /// public string? CompanyId { get; init; } + /// + /// Filter company overrides by multiple company IDs (starting with comp_) + /// public string? CompanyIds { get; init; } + /// + /// Filter company overrides by a single feature ID (starting with feat_) + /// public string? FeatureId { get; init; } + /// + /// Filter company overrides by multiple feature IDs (starting with feat_) + /// public string? FeatureIds { get; init; } + /// + /// Filter company overrides by multiple company override IDs (starting with cmov_) + /// public string? Ids { get; init; } + /// + /// Filter company overrides by whether they have not expired + /// + public bool? WithoutExpired { get; init; } + + /// + /// Search for company overrides by feature or company name + /// public string? Q { get; init; } /// diff --git a/src/SchematicHQ.Client/Entitlements/Requests/CountFeatureUsageRequest.cs b/src/SchematicHQ.Client/Entitlements/Requests/CountFeatureUsageRequest.cs index e5367f1..1324280 100644 --- a/src/SchematicHQ.Client/Entitlements/Requests/CountFeatureUsageRequest.cs +++ b/src/SchematicHQ.Client/Entitlements/Requests/CountFeatureUsageRequest.cs @@ -4,12 +4,14 @@ public record CountFeatureUsageRequest { public string? CompanyId { get; init; } - public Dictionary? CompanyKeys { get; init; } + public Dictionary? CompanyKeys { get; init; } public string? FeatureIds { get; init; } public string? Q { get; init; } + public bool? WithoutNegativeEntitlements { get; init; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Entitlements/Requests/CountPlanEntitlementsRequest.cs b/src/SchematicHQ.Client/Entitlements/Requests/CountPlanEntitlementsRequest.cs index 9a676ad..4120713 100644 --- a/src/SchematicHQ.Client/Entitlements/Requests/CountPlanEntitlementsRequest.cs +++ b/src/SchematicHQ.Client/Entitlements/Requests/CountPlanEntitlementsRequest.cs @@ -2,18 +2,41 @@ namespace SchematicHQ.Client; public record CountPlanEntitlementsRequest { + /// + /// Filter plan entitlements by a single feature ID (starting with feat_) + /// public string? FeatureId { get; init; } + /// + /// Filter plan entitlements by multiple feature IDs (starting with feat_) + /// public string? FeatureIds { get; init; } + /// + /// Filter plan entitlements by multiple plan entitlement IDs (starting with pltl_) + /// public string? Ids { get; init; } + /// + /// Filter plan entitlements by a single plan ID (starting with plan_) + /// public string? PlanId { get; init; } + /// + /// Filter plan entitlements by multiple plan IDs (starting with plan_) + /// public string? PlanIds { get; init; } + /// + /// Search for plan entitlements by feature or company name + /// public string? Q { get; init; } + /// + /// Filter plan entitlements only with metered products + /// + public bool? WithMeteredProducts { get; init; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Entitlements/Requests/CreateCompanyOverrideRequestBody.cs b/src/SchematicHQ.Client/Entitlements/Requests/CreateCompanyOverrideRequestBody.cs index 0174bb8..c855604 100644 --- a/src/SchematicHQ.Client/Entitlements/Requests/CreateCompanyOverrideRequestBody.cs +++ b/src/SchematicHQ.Client/Entitlements/Requests/CreateCompanyOverrideRequestBody.cs @@ -10,12 +10,18 @@ public record CreateCompanyOverrideRequestBody [JsonPropertyName("company_id")] public required string CompanyId { get; init; } + [JsonPropertyName("expiration_date")] + public DateTime? ExpirationDate { get; init; } + [JsonPropertyName("feature_id")] public required string FeatureId { get; init; } [JsonPropertyName("metric_period")] public CreateCompanyOverrideRequestBodyMetricPeriod? MetricPeriod { get; init; } + [JsonPropertyName("metric_period_month_reset")] + public CreateCompanyOverrideRequestBodyMetricPeriodMonthReset? MetricPeriodMonthReset { get; init; } + [JsonPropertyName("value_bool")] public bool? ValueBool { get; init; } diff --git a/src/SchematicHQ.Client/Entitlements/Requests/CreatePlanEntitlementRequestBody.cs b/src/SchematicHQ.Client/Entitlements/Requests/CreatePlanEntitlementRequestBody.cs index 3bbb747..b741025 100644 --- a/src/SchematicHQ.Client/Entitlements/Requests/CreatePlanEntitlementRequestBody.cs +++ b/src/SchematicHQ.Client/Entitlements/Requests/CreatePlanEntitlementRequestBody.cs @@ -13,9 +13,18 @@ public record CreatePlanEntitlementRequestBody [JsonPropertyName("metric_period")] public CreatePlanEntitlementRequestBodyMetricPeriod? MetricPeriod { get; init; } + [JsonPropertyName("metric_period_month_reset")] + public CreatePlanEntitlementRequestBodyMetricPeriodMonthReset? MetricPeriodMonthReset { get; init; } + + [JsonPropertyName("monthly_metered_price_id")] + public string? MonthlyMeteredPriceId { get; init; } + [JsonPropertyName("plan_id")] public required string PlanId { get; init; } + [JsonPropertyName("price_behavior")] + public string? PriceBehavior { get; init; } + [JsonPropertyName("value_bool")] public bool? ValueBool { get; init; } @@ -27,4 +36,7 @@ public record CreatePlanEntitlementRequestBody [JsonPropertyName("value_type")] public required CreatePlanEntitlementRequestBodyValueType ValueType { get; init; } + + [JsonPropertyName("yearly_metered_price_id")] + public string? YearlyMeteredPriceId { get; init; } } diff --git a/src/SchematicHQ.Client/Entitlements/Requests/ListCompanyOverridesRequest.cs b/src/SchematicHQ.Client/Entitlements/Requests/ListCompanyOverridesRequest.cs index 6218061..559b14b 100644 --- a/src/SchematicHQ.Client/Entitlements/Requests/ListCompanyOverridesRequest.cs +++ b/src/SchematicHQ.Client/Entitlements/Requests/ListCompanyOverridesRequest.cs @@ -2,16 +2,39 @@ namespace SchematicHQ.Client; public record ListCompanyOverridesRequest { + /// + /// Filter company overrides by a single company ID (starting with comp_) + /// public string? CompanyId { get; init; } + /// + /// Filter company overrides by multiple company IDs (starting with comp_) + /// public string? CompanyIds { get; init; } + /// + /// Filter company overrides by a single feature ID (starting with feat_) + /// public string? FeatureId { get; init; } + /// + /// Filter company overrides by multiple feature IDs (starting with feat_) + /// public string? FeatureIds { get; init; } + /// + /// Filter company overrides by multiple company override IDs (starting with cmov_) + /// public string? Ids { get; init; } + /// + /// Filter company overrides by whether they have not expired + /// + public bool? WithoutExpired { get; init; } + + /// + /// Search for company overrides by feature or company name + /// public string? Q { get; init; } /// diff --git a/src/SchematicHQ.Client/Entitlements/Requests/ListFeatureUsageRequest.cs b/src/SchematicHQ.Client/Entitlements/Requests/ListFeatureUsageRequest.cs index 125b926..baf1238 100644 --- a/src/SchematicHQ.Client/Entitlements/Requests/ListFeatureUsageRequest.cs +++ b/src/SchematicHQ.Client/Entitlements/Requests/ListFeatureUsageRequest.cs @@ -4,12 +4,14 @@ public record ListFeatureUsageRequest { public string? CompanyId { get; init; } - public Dictionary? CompanyKeys { get; init; } + public Dictionary? CompanyKeys { get; init; } public string? FeatureIds { get; init; } public string? Q { get; init; } + public bool? WithoutNegativeEntitlements { get; init; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Entitlements/Requests/ListPlanEntitlementsRequest.cs b/src/SchematicHQ.Client/Entitlements/Requests/ListPlanEntitlementsRequest.cs index 6193640..0da3409 100644 --- a/src/SchematicHQ.Client/Entitlements/Requests/ListPlanEntitlementsRequest.cs +++ b/src/SchematicHQ.Client/Entitlements/Requests/ListPlanEntitlementsRequest.cs @@ -2,18 +2,41 @@ namespace SchematicHQ.Client; public record ListPlanEntitlementsRequest { + /// + /// Filter plan entitlements by a single feature ID (starting with feat_) + /// public string? FeatureId { get; init; } + /// + /// Filter plan entitlements by multiple feature IDs (starting with feat_) + /// public string? FeatureIds { get; init; } + /// + /// Filter plan entitlements by multiple plan entitlement IDs (starting with pltl_) + /// public string? Ids { get; init; } + /// + /// Filter plan entitlements by a single plan ID (starting with plan_) + /// public string? PlanId { get; init; } + /// + /// Filter plan entitlements by multiple plan IDs (starting with plan_) + /// public string? PlanIds { get; init; } + /// + /// Search for plan entitlements by feature or company name + /// public string? Q { get; init; } + /// + /// Filter plan entitlements only with metered products + /// + public bool? WithMeteredProducts { get; init; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Entitlements/Requests/UpdateCompanyOverrideRequestBody.cs b/src/SchematicHQ.Client/Entitlements/Requests/UpdateCompanyOverrideRequestBody.cs index 82a09b1..f67616c 100644 --- a/src/SchematicHQ.Client/Entitlements/Requests/UpdateCompanyOverrideRequestBody.cs +++ b/src/SchematicHQ.Client/Entitlements/Requests/UpdateCompanyOverrideRequestBody.cs @@ -7,9 +7,15 @@ namespace SchematicHQ.Client; public record UpdateCompanyOverrideRequestBody { + [JsonPropertyName("expiration_date")] + public DateTime? ExpirationDate { get; init; } + [JsonPropertyName("metric_period")] public UpdateCompanyOverrideRequestBodyMetricPeriod? MetricPeriod { get; init; } + [JsonPropertyName("metric_period_month_reset")] + public UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset? MetricPeriodMonthReset { get; init; } + [JsonPropertyName("value_bool")] public bool? ValueBool { get; init; } diff --git a/src/SchematicHQ.Client/Entitlements/Requests/UpdatePlanEntitlementRequestBody.cs b/src/SchematicHQ.Client/Entitlements/Requests/UpdatePlanEntitlementRequestBody.cs index ee76f1f..e280ded 100644 --- a/src/SchematicHQ.Client/Entitlements/Requests/UpdatePlanEntitlementRequestBody.cs +++ b/src/SchematicHQ.Client/Entitlements/Requests/UpdatePlanEntitlementRequestBody.cs @@ -10,6 +10,15 @@ public record UpdatePlanEntitlementRequestBody [JsonPropertyName("metric_period")] public UpdatePlanEntitlementRequestBodyMetricPeriod? MetricPeriod { get; init; } + [JsonPropertyName("metric_period_month_reset")] + public UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset? MetricPeriodMonthReset { get; init; } + + [JsonPropertyName("monthly_metered_price_id")] + public string? MonthlyMeteredPriceId { get; init; } + + [JsonPropertyName("price_behavior")] + public string? PriceBehavior { get; init; } + [JsonPropertyName("value_bool")] public bool? ValueBool { get; init; } @@ -21,4 +30,7 @@ public record UpdatePlanEntitlementRequestBody [JsonPropertyName("value_type")] public required UpdatePlanEntitlementRequestBodyValueType ValueType { get; init; } + + [JsonPropertyName("yearly_metered_price_id")] + public string? YearlyMeteredPriceId { get; init; } } diff --git a/src/SchematicHQ.Client/Entitlements/Types/CountCompanyOverridesParams.cs b/src/SchematicHQ.Client/Entitlements/Types/CountCompanyOverridesParams.cs index b4a9309..4bdeaa7 100644 --- a/src/SchematicHQ.Client/Entitlements/Types/CountCompanyOverridesParams.cs +++ b/src/SchematicHQ.Client/Entitlements/Types/CountCompanyOverridesParams.cs @@ -6,18 +6,33 @@ namespace SchematicHQ.Client; public record CountCompanyOverridesParams { + /// + /// Filter company overrides by a single company ID (starting with comp_) + /// [JsonPropertyName("company_id")] public string? CompanyId { get; init; } + /// + /// Filter company overrides by multiple company IDs (starting with comp_) + /// [JsonPropertyName("company_ids")] public IEnumerable? CompanyIds { get; init; } + /// + /// Filter company overrides by a single feature ID (starting with feat_) + /// [JsonPropertyName("feature_id")] public string? FeatureId { get; init; } + /// + /// Filter company overrides by multiple feature IDs (starting with feat_) + /// [JsonPropertyName("feature_ids")] public IEnumerable? FeatureIds { get; init; } + /// + /// Filter company overrides by multiple company override IDs (starting with cmov_) + /// [JsonPropertyName("ids")] public IEnumerable? Ids { get; init; } @@ -33,6 +48,15 @@ public record CountCompanyOverridesParams [JsonPropertyName("offset")] public int? Offset { get; init; } + /// + /// Search for company overrides by feature or company name + /// [JsonPropertyName("q")] public string? Q { get; init; } + + /// + /// Filter company overrides by whether they have not expired + /// + [JsonPropertyName("without_expired")] + public bool? WithoutExpired { get; init; } } diff --git a/src/SchematicHQ.Client/Entitlements/Types/CountFeatureUsageParams.cs b/src/SchematicHQ.Client/Entitlements/Types/CountFeatureUsageParams.cs index 4a0e753..2fee243 100644 --- a/src/SchematicHQ.Client/Entitlements/Types/CountFeatureUsageParams.cs +++ b/src/SchematicHQ.Client/Entitlements/Types/CountFeatureUsageParams.cs @@ -29,4 +29,7 @@ public record CountFeatureUsageParams [JsonPropertyName("q")] public string? Q { get; init; } + + [JsonPropertyName("without_negative_entitlements")] + public bool? WithoutNegativeEntitlements { get; init; } } diff --git a/src/SchematicHQ.Client/Entitlements/Types/CountPlanEntitlementsParams.cs b/src/SchematicHQ.Client/Entitlements/Types/CountPlanEntitlementsParams.cs index b398802..f709a71 100644 --- a/src/SchematicHQ.Client/Entitlements/Types/CountPlanEntitlementsParams.cs +++ b/src/SchematicHQ.Client/Entitlements/Types/CountPlanEntitlementsParams.cs @@ -6,12 +6,21 @@ namespace SchematicHQ.Client; public record CountPlanEntitlementsParams { + /// + /// Filter plan entitlements by a single feature ID (starting with feat_) + /// [JsonPropertyName("feature_id")] public string? FeatureId { get; init; } + /// + /// Filter plan entitlements by multiple feature IDs (starting with feat_) + /// [JsonPropertyName("feature_ids")] public IEnumerable? FeatureIds { get; init; } + /// + /// Filter plan entitlements by multiple plan entitlement IDs (starting with pltl_) + /// [JsonPropertyName("ids")] public IEnumerable? Ids { get; init; } @@ -27,12 +36,27 @@ public record CountPlanEntitlementsParams [JsonPropertyName("offset")] public int? Offset { get; init; } + /// + /// Filter plan entitlements by a single plan ID (starting with plan_) + /// [JsonPropertyName("plan_id")] public string? PlanId { get; init; } + /// + /// Filter plan entitlements by multiple plan IDs (starting with plan_) + /// [JsonPropertyName("plan_ids")] public IEnumerable? PlanIds { get; init; } + /// + /// Search for plan entitlements by feature or company name + /// [JsonPropertyName("q")] public string? Q { get; init; } + + /// + /// Filter plan entitlements only with metered products + /// + [JsonPropertyName("with_metered_products")] + public bool? WithMeteredProducts { get; init; } } diff --git a/src/SchematicHQ.Client/Entitlements/Types/CreateCompanyOverrideRequestBodyMetricPeriod.cs b/src/SchematicHQ.Client/Entitlements/Types/CreateCompanyOverrideRequestBodyMetricPeriod.cs index b62ee09..45931c3 100644 --- a/src/SchematicHQ.Client/Entitlements/Types/CreateCompanyOverrideRequestBodyMetricPeriod.cs +++ b/src/SchematicHQ.Client/Entitlements/Types/CreateCompanyOverrideRequestBodyMetricPeriod.cs @@ -10,6 +10,9 @@ namespace SchematicHQ.Client; [JsonConverter(typeof(StringEnumSerializer))] public enum CreateCompanyOverrideRequestBodyMetricPeriod { + [EnumMember(Value = "all_time")] + AllTime, + [EnumMember(Value = "current_month")] CurrentMonth, diff --git a/src/SchematicHQ.Client/Entitlements/Types/CreateCompanyOverrideRequestBodyMetricPeriodMonthReset.cs b/src/SchematicHQ.Client/Entitlements/Types/CreateCompanyOverrideRequestBodyMetricPeriodMonthReset.cs new file mode 100644 index 0000000..c2fe29e --- /dev/null +++ b/src/SchematicHQ.Client/Entitlements/Types/CreateCompanyOverrideRequestBodyMetricPeriodMonthReset.cs @@ -0,0 +1,20 @@ +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 CreateCompanyOverrideRequestBodyMetricPeriodMonthReset +{ + [EnumMember(Value = "first_of_month")] + FirstOfMonth, + + [EnumMember(Value = "billing_cycle")] + BillingCycle +} diff --git a/src/SchematicHQ.Client/Entitlements/Types/CreatePlanEntitlementRequestBodyMetricPeriod.cs b/src/SchematicHQ.Client/Entitlements/Types/CreatePlanEntitlementRequestBodyMetricPeriod.cs index a1f76b8..f98e097 100644 --- a/src/SchematicHQ.Client/Entitlements/Types/CreatePlanEntitlementRequestBodyMetricPeriod.cs +++ b/src/SchematicHQ.Client/Entitlements/Types/CreatePlanEntitlementRequestBodyMetricPeriod.cs @@ -10,6 +10,9 @@ namespace SchematicHQ.Client; [JsonConverter(typeof(StringEnumSerializer))] public enum CreatePlanEntitlementRequestBodyMetricPeriod { + [EnumMember(Value = "all_time")] + AllTime, + [EnumMember(Value = "current_month")] CurrentMonth, diff --git a/src/SchematicHQ.Client/Entitlements/Types/CreatePlanEntitlementRequestBodyMetricPeriodMonthReset.cs b/src/SchematicHQ.Client/Entitlements/Types/CreatePlanEntitlementRequestBodyMetricPeriodMonthReset.cs new file mode 100644 index 0000000..da991c0 --- /dev/null +++ b/src/SchematicHQ.Client/Entitlements/Types/CreatePlanEntitlementRequestBodyMetricPeriodMonthReset.cs @@ -0,0 +1,20 @@ +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 CreatePlanEntitlementRequestBodyMetricPeriodMonthReset +{ + [EnumMember(Value = "first_of_month")] + FirstOfMonth, + + [EnumMember(Value = "billing_cycle")] + BillingCycle +} diff --git a/src/SchematicHQ.Client/Entitlements/Types/ListCompanyOverridesParams.cs b/src/SchematicHQ.Client/Entitlements/Types/ListCompanyOverridesParams.cs index fc2d1d5..fa6ad01 100644 --- a/src/SchematicHQ.Client/Entitlements/Types/ListCompanyOverridesParams.cs +++ b/src/SchematicHQ.Client/Entitlements/Types/ListCompanyOverridesParams.cs @@ -6,18 +6,33 @@ namespace SchematicHQ.Client; public record ListCompanyOverridesParams { + /// + /// Filter company overrides by a single company ID (starting with comp_) + /// [JsonPropertyName("company_id")] public string? CompanyId { get; init; } + /// + /// Filter company overrides by multiple company IDs (starting with comp_) + /// [JsonPropertyName("company_ids")] public IEnumerable? CompanyIds { get; init; } + /// + /// Filter company overrides by a single feature ID (starting with feat_) + /// [JsonPropertyName("feature_id")] public string? FeatureId { get; init; } + /// + /// Filter company overrides by multiple feature IDs (starting with feat_) + /// [JsonPropertyName("feature_ids")] public IEnumerable? FeatureIds { get; init; } + /// + /// Filter company overrides by multiple company override IDs (starting with cmov_) + /// [JsonPropertyName("ids")] public IEnumerable? Ids { get; init; } @@ -33,6 +48,15 @@ public record ListCompanyOverridesParams [JsonPropertyName("offset")] public int? Offset { get; init; } + /// + /// Search for company overrides by feature or company name + /// [JsonPropertyName("q")] public string? Q { get; init; } + + /// + /// Filter company overrides by whether they have not expired + /// + [JsonPropertyName("without_expired")] + public bool? WithoutExpired { get; init; } } diff --git a/src/SchematicHQ.Client/Entitlements/Types/ListFeatureUsageParams.cs b/src/SchematicHQ.Client/Entitlements/Types/ListFeatureUsageParams.cs index 7028c8b..7bc1e65 100644 --- a/src/SchematicHQ.Client/Entitlements/Types/ListFeatureUsageParams.cs +++ b/src/SchematicHQ.Client/Entitlements/Types/ListFeatureUsageParams.cs @@ -29,4 +29,7 @@ public record ListFeatureUsageParams [JsonPropertyName("q")] public string? Q { get; init; } + + [JsonPropertyName("without_negative_entitlements")] + public bool? WithoutNegativeEntitlements { get; init; } } diff --git a/src/SchematicHQ.Client/Entitlements/Types/ListPlanEntitlementsParams.cs b/src/SchematicHQ.Client/Entitlements/Types/ListPlanEntitlementsParams.cs index 58f2b0c..6cec2d6 100644 --- a/src/SchematicHQ.Client/Entitlements/Types/ListPlanEntitlementsParams.cs +++ b/src/SchematicHQ.Client/Entitlements/Types/ListPlanEntitlementsParams.cs @@ -6,12 +6,21 @@ namespace SchematicHQ.Client; public record ListPlanEntitlementsParams { + /// + /// Filter plan entitlements by a single feature ID (starting with feat_) + /// [JsonPropertyName("feature_id")] public string? FeatureId { get; init; } + /// + /// Filter plan entitlements by multiple feature IDs (starting with feat_) + /// [JsonPropertyName("feature_ids")] public IEnumerable? FeatureIds { get; init; } + /// + /// Filter plan entitlements by multiple plan entitlement IDs (starting with pltl_) + /// [JsonPropertyName("ids")] public IEnumerable? Ids { get; init; } @@ -27,12 +36,27 @@ public record ListPlanEntitlementsParams [JsonPropertyName("offset")] public int? Offset { get; init; } + /// + /// Filter plan entitlements by a single plan ID (starting with plan_) + /// [JsonPropertyName("plan_id")] public string? PlanId { get; init; } + /// + /// Filter plan entitlements by multiple plan IDs (starting with plan_) + /// [JsonPropertyName("plan_ids")] public IEnumerable? PlanIds { get; init; } + /// + /// Search for plan entitlements by feature or company name + /// [JsonPropertyName("q")] public string? Q { get; init; } + + /// + /// Filter plan entitlements only with metered products + /// + [JsonPropertyName("with_metered_products")] + public bool? WithMeteredProducts { get; init; } } diff --git a/src/SchematicHQ.Client/Entitlements/Types/UpdateCompanyOverrideRequestBodyMetricPeriod.cs b/src/SchematicHQ.Client/Entitlements/Types/UpdateCompanyOverrideRequestBodyMetricPeriod.cs index 8a0f1d1..1cf22ff 100644 --- a/src/SchematicHQ.Client/Entitlements/Types/UpdateCompanyOverrideRequestBodyMetricPeriod.cs +++ b/src/SchematicHQ.Client/Entitlements/Types/UpdateCompanyOverrideRequestBodyMetricPeriod.cs @@ -10,6 +10,9 @@ namespace SchematicHQ.Client; [JsonConverter(typeof(StringEnumSerializer))] public enum UpdateCompanyOverrideRequestBodyMetricPeriod { + [EnumMember(Value = "all_time")] + AllTime, + [EnumMember(Value = "current_month")] CurrentMonth, diff --git a/src/SchematicHQ.Client/Entitlements/Types/UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset.cs b/src/SchematicHQ.Client/Entitlements/Types/UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset.cs new file mode 100644 index 0000000..77ffd47 --- /dev/null +++ b/src/SchematicHQ.Client/Entitlements/Types/UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset.cs @@ -0,0 +1,20 @@ +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 UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset +{ + [EnumMember(Value = "first_of_month")] + FirstOfMonth, + + [EnumMember(Value = "billing_cycle")] + BillingCycle +} diff --git a/src/SchematicHQ.Client/Entitlements/Types/UpdatePlanEntitlementRequestBodyMetricPeriod.cs b/src/SchematicHQ.Client/Entitlements/Types/UpdatePlanEntitlementRequestBodyMetricPeriod.cs index 3338962..2e37e34 100644 --- a/src/SchematicHQ.Client/Entitlements/Types/UpdatePlanEntitlementRequestBodyMetricPeriod.cs +++ b/src/SchematicHQ.Client/Entitlements/Types/UpdatePlanEntitlementRequestBodyMetricPeriod.cs @@ -10,6 +10,9 @@ namespace SchematicHQ.Client; [JsonConverter(typeof(StringEnumSerializer))] public enum UpdatePlanEntitlementRequestBodyMetricPeriod { + [EnumMember(Value = "all_time")] + AllTime, + [EnumMember(Value = "current_month")] CurrentMonth, diff --git a/src/SchematicHQ.Client/Entitlements/Types/UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset.cs b/src/SchematicHQ.Client/Entitlements/Types/UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset.cs new file mode 100644 index 0000000..5faf1fb --- /dev/null +++ b/src/SchematicHQ.Client/Entitlements/Types/UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset.cs @@ -0,0 +1,20 @@ +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 UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset +{ + [EnumMember(Value = "first_of_month")] + FirstOfMonth, + + [EnumMember(Value = "billing_cycle")] + BillingCycle +} diff --git a/src/SchematicHQ.Client/Events/EventsClient.cs b/src/SchematicHQ.Client/Events/EventsClient.cs index 1ab2721..7ac96bb 100644 --- a/src/SchematicHQ.Client/Events/EventsClient.cs +++ b/src/SchematicHQ.Client/Events/EventsClient.cs @@ -73,19 +73,6 @@ GetEventSummariesRequest request throw new Exception(responseBody); } - public async Task GetEventSummaryBySubtypeAsync(string key) - { - var response = await _client.MakeRequestAsync( - new RawClient.JsonApiRequest { Method = HttpMethod.Get, Path = $"event-types/{key}" } - ); - 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 ListEventsAsync(ListEventsRequest request) { var _query = new Dictionary() { }; @@ -164,67 +151,6 @@ public async Task GetEventAsync(string eventId) throw new Exception(responseBody); } - public async Task ListMetricCountsAsync( - ListMetricCountsRequest request - ) - { - var _query = new Dictionary() { }; - if (request.StartTime != null) - { - _query["start_time"] = request.StartTime.Value.ToString("o0"); - } - if (request.EndTime != null) - { - _query["end_time"] = request.EndTime.Value.ToString("o0"); - } - if (request.EventSubtype != null) - { - _query["event_subtype"] = request.EventSubtype; - } - if (request.EventSubtypes != null) - { - _query["event_subtypes"] = request.EventSubtypes; - } - if (request.CompanyId != null) - { - _query["company_id"] = request.CompanyId; - } - if (request.CompanyIds != null) - { - _query["company_ids"] = request.CompanyIds; - } - if (request.UserId != null) - { - _query["user_id"] = request.UserId; - } - if (request.Limit != null) - { - _query["limit"] = request.Limit.ToString(); - } - if (request.Offset != null) - { - _query["offset"] = request.Offset.ToString(); - } - if (request.Grouping != null) - { - _query["grouping"] = request.Grouping; - } - var response = await _client.MakeRequestAsync( - new RawClient.JsonApiRequest - { - Method = HttpMethod.Get, - Path = "metric-counts", - 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 GetSegmentIntegrationStatusAsync() { var response = await _client.MakeRequestAsync( diff --git a/src/SchematicHQ.Client/Events/Requests/ListMetricCountsRequest.cs b/src/SchematicHQ.Client/Events/Requests/ListMetricCountsRequest.cs deleted file mode 100644 index b292c9f..0000000 --- a/src/SchematicHQ.Client/Events/Requests/ListMetricCountsRequest.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace SchematicHQ.Client; - -public record ListMetricCountsRequest -{ - public DateTime? StartTime { get; init; } - - public DateTime? EndTime { get; init; } - - public string? EventSubtype { get; init; } - - public string? EventSubtypes { get; init; } - - public string? CompanyId { get; init; } - - public string? CompanyIds { get; init; } - - public string? UserId { get; init; } - - /// - /// Page limit (default 100) - /// - public int? Limit { get; init; } - - /// - /// Page offset (default 0) - /// - public int? Offset { get; init; } - - public string? Grouping { get; init; } -} diff --git a/src/SchematicHQ.Client/Events/Types/ListMetricCountsParams.cs b/src/SchematicHQ.Client/Events/Types/ListMetricCountsParams.cs deleted file mode 100644 index e39fdc0..0000000 --- a/src/SchematicHQ.Client/Events/Types/ListMetricCountsParams.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Text.Json.Serialization; - -#nullable enable - -namespace SchematicHQ.Client; - -public record ListMetricCountsParams -{ - [JsonPropertyName("company_id")] - public string? CompanyId { get; init; } - - [JsonPropertyName("company_ids")] - public IEnumerable? CompanyIds { get; init; } - - [JsonPropertyName("end_time")] - public DateTime? EndTime { get; init; } - - [JsonPropertyName("event_subtype")] - public string? EventSubtype { get; init; } - - [JsonPropertyName("event_subtypes")] - public IEnumerable? EventSubtypes { get; init; } - - [JsonPropertyName("grouping")] - public string? Grouping { get; init; } - - /// - /// Page limit (default 100) - /// - [JsonPropertyName("limit")] - public int? Limit { get; init; } - - /// - /// Page offset (default 0) - /// - [JsonPropertyName("offset")] - public int? Offset { get; init; } - - [JsonPropertyName("start_time")] - public DateTime? StartTime { get; init; } - - [JsonPropertyName("user_id")] - public string? UserId { get; init; } -} diff --git a/src/SchematicHQ.Client/Plangroups/PlangroupsClient.cs b/src/SchematicHQ.Client/Plangroups/PlangroupsClient.cs new file mode 100644 index 0000000..0fdc3e0 --- /dev/null +++ b/src/SchematicHQ.Client/Plangroups/PlangroupsClient.cs @@ -0,0 +1,72 @@ +using System.Net.Http; +using System.Text.Json; +using SchematicHQ.Client; +using SchematicHQ.Client.Core; + +#nullable enable + +namespace SchematicHQ.Client; + +public class PlangroupsClient +{ + private RawClient _client; + + public PlangroupsClient(RawClient client) + { + _client = client; + } + + public async Task GetPlanGroupAsync() + { + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest { Method = HttpMethod.Get, Path = "plan-groups" } + ); + 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 CreatePlanGroupAsync( + CreatePlanGroupRequestBody request + ) + { + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + Method = HttpMethod.Post, + Path = "plan-groups", + 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 UpdatePlanGroupAsync( + string planGroupId, + UpdatePlanGroupRequestBody request + ) + { + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + Method = HttpMethod.Put, + Path = $"plan-groups/{planGroupId}", + Body = request + } + ); + var responseBody = await response.Raw.Content.ReadAsStringAsync(); + if (response.StatusCode is >= 200 and < 400) + { + return JsonSerializer.Deserialize(responseBody)!; + } + throw new Exception(responseBody); + } +} diff --git a/src/SchematicHQ.Client/Plangroups/Requests/CreatePlanGroupRequestBody.cs b/src/SchematicHQ.Client/Plangroups/Requests/CreatePlanGroupRequestBody.cs new file mode 100644 index 0000000..c1a0b4a --- /dev/null +++ b/src/SchematicHQ.Client/Plangroups/Requests/CreatePlanGroupRequestBody.cs @@ -0,0 +1,23 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record CreatePlanGroupRequestBody +{ + [JsonPropertyName("add_on_ids")] + public IEnumerable AddOnIds { get; init; } = new List(); + + [JsonPropertyName("default_plan_id")] + public string? DefaultPlanId { get; init; } + + [JsonPropertyName("plan_ids")] + public IEnumerable PlanIds { get; init; } = new List(); + + [JsonPropertyName("trial_days")] + public int? TrialDays { get; init; } + + [JsonPropertyName("trial_payment_method_required")] + public bool? TrialPaymentMethodRequired { get; init; } +} diff --git a/src/SchematicHQ.Client/Plangroups/Requests/UpdatePlanGroupRequestBody.cs b/src/SchematicHQ.Client/Plangroups/Requests/UpdatePlanGroupRequestBody.cs new file mode 100644 index 0000000..7c24e67 --- /dev/null +++ b/src/SchematicHQ.Client/Plangroups/Requests/UpdatePlanGroupRequestBody.cs @@ -0,0 +1,23 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record UpdatePlanGroupRequestBody +{ + [JsonPropertyName("add_on_ids")] + public IEnumerable AddOnIds { get; init; } = new List(); + + [JsonPropertyName("default_plan_id")] + public string? DefaultPlanId { get; init; } + + [JsonPropertyName("plan_ids")] + public IEnumerable PlanIds { get; init; } = new List(); + + [JsonPropertyName("trial_days")] + public int? TrialDays { get; init; } + + [JsonPropertyName("trial_payment_method_required")] + public bool? TrialPaymentMethodRequired { get; init; } +} diff --git a/src/SchematicHQ.Client/Plangroups/Types/CreatePlanGroupResponse.cs b/src/SchematicHQ.Client/Plangroups/Types/CreatePlanGroupResponse.cs new file mode 100644 index 0000000..43a908e --- /dev/null +++ b/src/SchematicHQ.Client/Plangroups/Types/CreatePlanGroupResponse.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record CreatePlanGroupResponse +{ + [JsonPropertyName("data")] + public required PlanGroupResponseData Data { get; init; } + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public Dictionary Params { get; init; } = new Dictionary(); +} diff --git a/src/SchematicHQ.Client/Plangroups/Types/GetPlanGroupResponse.cs b/src/SchematicHQ.Client/Plangroups/Types/GetPlanGroupResponse.cs new file mode 100644 index 0000000..2439a41 --- /dev/null +++ b/src/SchematicHQ.Client/Plangroups/Types/GetPlanGroupResponse.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record GetPlanGroupResponse +{ + [JsonPropertyName("data")] + public required PlanGroupDetailResponseData Data { get; init; } + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public Dictionary Params { get; init; } = new Dictionary(); +} diff --git a/src/SchematicHQ.Client/Plangroups/Types/UpdatePlanGroupResponse.cs b/src/SchematicHQ.Client/Plangroups/Types/UpdatePlanGroupResponse.cs new file mode 100644 index 0000000..1168116 --- /dev/null +++ b/src/SchematicHQ.Client/Plangroups/Types/UpdatePlanGroupResponse.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record UpdatePlanGroupResponse +{ + [JsonPropertyName("data")] + public required PlanGroupResponseData Data { get; init; } + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public Dictionary Params { get; init; } = new Dictionary(); +} diff --git a/src/SchematicHQ.Client/Plans/PlansClient.cs b/src/SchematicHQ.Client/Plans/PlansClient.cs index d880664..c22633f 100644 --- a/src/SchematicHQ.Client/Plans/PlansClient.cs +++ b/src/SchematicHQ.Client/Plans/PlansClient.cs @@ -78,22 +78,30 @@ public async Task ListPlansAsync(ListPlansRequest request) { _query["company_id"] = request.CompanyId; } - if (request.Ids != null) + if (request.HasProductId != null) { - _query["ids"] = request.Ids; + _query["has_product_id"] = request.HasProductId.ToString(); } - if (request.Q != null) + if (request.Ids != null) { - _query["q"] = request.Q; + _query["ids"] = request.Ids; } if (request.PlanType != null) { _query["plan_type"] = JsonSerializer.Serialize(request.PlanType.Value); } + if (request.Q != null) + { + _query["q"] = request.Q; + } if (request.WithoutEntitlementFor != null) { _query["without_entitlement_for"] = request.WithoutEntitlementFor; } + if (request.WithoutProductId != null) + { + _query["without_product_id"] = request.WithoutProductId.ToString(); + } if (request.Limit != null) { _query["limit"] = request.Limit.ToString(); @@ -211,22 +219,30 @@ public async Task CountPlansAsync(CountPlansRequest request) { _query["company_id"] = request.CompanyId; } - if (request.Ids != null) + if (request.HasProductId != null) { - _query["ids"] = request.Ids; + _query["has_product_id"] = request.HasProductId.ToString(); } - if (request.Q != null) + if (request.Ids != null) { - _query["q"] = request.Q; + _query["ids"] = request.Ids; } if (request.PlanType != null) { _query["plan_type"] = JsonSerializer.Serialize(request.PlanType.Value); } + if (request.Q != null) + { + _query["q"] = request.Q; + } if (request.WithoutEntitlementFor != null) { _query["without_entitlement_for"] = request.WithoutEntitlementFor; } + if (request.WithoutProductId != null) + { + _query["without_product_id"] = request.WithoutProductId.ToString(); + } if (request.Limit != null) { _query["limit"] = request.Limit.ToString(); diff --git a/src/SchematicHQ.Client/Plans/Requests/CountPlansRequest.cs b/src/SchematicHQ.Client/Plans/Requests/CountPlansRequest.cs index 31a1eca..a5a7562 100644 --- a/src/SchematicHQ.Client/Plans/Requests/CountPlansRequest.cs +++ b/src/SchematicHQ.Client/Plans/Requests/CountPlansRequest.cs @@ -8,20 +8,30 @@ public record CountPlansRequest { public string? CompanyId { get; init; } - public string? Ids { get; init; } + /// + /// Filter out plans that do not have a billing product ID + /// + public bool? HasProductId { get; init; } - public string? Q { get; init; } + public string? Ids { get; init; } /// /// Filter by plan type /// public CountPlansRequestPlanType? PlanType { get; init; } + public string? Q { get; init; } + /// /// Filter out plans that already have a plan entitlement for the specified feature ID /// public string? WithoutEntitlementFor { get; init; } + /// + /// Filter out plans that have a billing product ID + /// + public bool? WithoutProductId { get; init; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Plans/Requests/ListPlansRequest.cs b/src/SchematicHQ.Client/Plans/Requests/ListPlansRequest.cs index 87ca1ef..bbb62ed 100644 --- a/src/SchematicHQ.Client/Plans/Requests/ListPlansRequest.cs +++ b/src/SchematicHQ.Client/Plans/Requests/ListPlansRequest.cs @@ -8,20 +8,30 @@ public record ListPlansRequest { public string? CompanyId { get; init; } - public string? Ids { get; init; } + /// + /// Filter out plans that do not have a billing product ID + /// + public bool? HasProductId { get; init; } - public string? Q { get; init; } + public string? Ids { get; init; } /// /// Filter by plan type /// public ListPlansRequestPlanType? PlanType { get; init; } + public string? Q { get; init; } + /// /// Filter out plans that already have a plan entitlement for the specified feature ID /// public string? WithoutEntitlementFor { get; init; } + /// + /// Filter out plans that have a billing product ID + /// + public bool? WithoutProductId { get; init; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Plans/Requests/UpsertBillingProductRequestBody.cs b/src/SchematicHQ.Client/Plans/Requests/UpsertBillingProductRequestBody.cs index ad28848..434da5a 100644 --- a/src/SchematicHQ.Client/Plans/Requests/UpsertBillingProductRequestBody.cs +++ b/src/SchematicHQ.Client/Plans/Requests/UpsertBillingProductRequestBody.cs @@ -7,11 +7,20 @@ namespace SchematicHQ.Client; public record UpsertBillingProductRequestBody { [JsonPropertyName("billing_product_id")] - public required string BillingProductId { get; init; } + public string? BillingProductId { get; init; } + + [JsonPropertyName("is_free_plan")] + public required bool IsFreePlan { get; init; } + + [JsonPropertyName("is_trialable")] + public required bool IsTrialable { get; init; } [JsonPropertyName("monthly_price_id")] public string? MonthlyPriceId { get; init; } + [JsonPropertyName("trial_days")] + public int? TrialDays { 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 de1b3bd..c46063c 100644 --- a/src/SchematicHQ.Client/Plans/Types/CountPlansParams.cs +++ b/src/SchematicHQ.Client/Plans/Types/CountPlansParams.cs @@ -10,6 +10,12 @@ public record CountPlansParams [JsonPropertyName("company_id")] public string? CompanyId { get; init; } + /// + /// Filter out plans that do not have a billing product ID + /// + [JsonPropertyName("has_product_id")] + public bool? HasProductId { get; init; } + [JsonPropertyName("ids")] public IEnumerable? Ids { get; init; } @@ -39,4 +45,10 @@ public record CountPlansParams /// [JsonPropertyName("without_entitlement_for")] public string? WithoutEntitlementFor { get; init; } + + /// + /// Filter out plans that have a billing product ID + /// + [JsonPropertyName("without_product_id")] + public bool? WithoutProductId { get; init; } } diff --git a/src/SchematicHQ.Client/Plans/Types/ListPlansParams.cs b/src/SchematicHQ.Client/Plans/Types/ListPlansParams.cs index 73b2aa5..7958b67 100644 --- a/src/SchematicHQ.Client/Plans/Types/ListPlansParams.cs +++ b/src/SchematicHQ.Client/Plans/Types/ListPlansParams.cs @@ -10,6 +10,12 @@ public record ListPlansParams [JsonPropertyName("company_id")] public string? CompanyId { get; init; } + /// + /// Filter out plans that do not have a billing product ID + /// + [JsonPropertyName("has_product_id")] + public bool? HasProductId { get; init; } + [JsonPropertyName("ids")] public IEnumerable? Ids { get; init; } @@ -39,4 +45,10 @@ public record ListPlansParams /// [JsonPropertyName("without_entitlement_for")] public string? WithoutEntitlementFor { get; init; } + + /// + /// Filter out plans that have a billing product ID + /// + [JsonPropertyName("without_product_id")] + public bool? WithoutProductId { get; init; } } diff --git a/src/SchematicHQ.Client/SchematicApi.cs b/src/SchematicHQ.Client/SchematicApi.cs index e9345fa..e9cbc4b 100644 --- a/src/SchematicHQ.Client/SchematicApi.cs +++ b/src/SchematicHQ.Client/SchematicApi.cs @@ -18,19 +18,21 @@ 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.2" }, + { "X-Fern-SDK-Version", "1.0.3" }, }, clientOptions ?? new ClientOptions() ); Accounts = new AccountsClient(_client); Features = new FeaturesClient(_client); Billing = new BillingClient(_client); + Checkout = new CheckoutClient(_client); Companies = new CompaniesClient(_client); Entitlements = new EntitlementsClient(_client); Components = new ComponentsClient(_client); Crm = new CrmClient(_client); Events = new EventsClient(_client); Plans = new PlansClient(_client); + Plangroups = new PlangroupsClient(_client); Accesstokens = new AccesstokensClient(_client); Webhooks = new WebhooksClient(_client); } @@ -41,6 +43,8 @@ public SchematicApi(string? apiKey = null, ClientOptions? clientOptions = null) public BillingClient Billing { get; init; } + public CheckoutClient Checkout { get; init; } + public CompaniesClient Companies { get; init; } public EntitlementsClient Entitlements { get; init; } @@ -53,6 +57,8 @@ public SchematicApi(string? apiKey = null, ClientOptions? clientOptions = null) public PlansClient Plans { get; init; } + public PlangroupsClient Plangroups { get; init; } + public AccesstokensClient Accesstokens { get; init; } public WebhooksClient Webhooks { get; init; } diff --git a/src/SchematicHQ.Client/SchematicHQ.Client.csproj b/src/SchematicHQ.Client/SchematicHQ.Client.csproj index 1edb8a4..15e51d6 100644 --- a/src/SchematicHQ.Client/SchematicHQ.Client.csproj +++ b/src/SchematicHQ.Client/SchematicHQ.Client.csproj @@ -1,4 +1,4 @@ - + @@ -7,23 +7,23 @@ false 12 enable - 1.0.2 + 1.0.3 README.md https://github.com/schematichq/schematic-csharp - + true - + - + - + runtime; build; native; contentfiles; analyzers; buildtransitive @@ -34,7 +34,7 @@ - + diff --git a/src/SchematicHQ.Client/Types/BillingCouponResponseData.cs b/src/SchematicHQ.Client/Types/BillingCouponResponseData.cs new file mode 100644 index 0000000..cc5f4df --- /dev/null +++ b/src/SchematicHQ.Client/Types/BillingCouponResponseData.cs @@ -0,0 +1,56 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record BillingCouponResponseData +{ + [JsonPropertyName("account_id")] + public required string AccountId { get; init; } + + [JsonPropertyName("amount_off")] + public int? AmountOff { get; init; } + + [JsonPropertyName("currency")] + public string? Currency { get; init; } + + [JsonPropertyName("duration")] + public string? Duration { get; init; } + + [JsonPropertyName("duration_in_months")] + public int? DurationInMonths { 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("is_active")] + public required bool IsActive { get; init; } + + [JsonPropertyName("max_redemptions")] + public int? MaxRedemptions { get; init; } + + [JsonPropertyName("metadata")] + public Dictionary Metadata { get; init; } = new Dictionary(); + + [JsonPropertyName("name")] + public required string Name { get; init; } + + [JsonPropertyName("percent_off")] + public int? PercentOff { get; init; } + + [JsonPropertyName("times_redeemed")] + public required int TimesRedeemed { get; init; } + + [JsonPropertyName("valid_from")] + public DateTime? ValidFrom { get; init; } + + [JsonPropertyName("valid_until")] + public DateTime? ValidUntil { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/BillingCustomerSubscription.cs b/src/SchematicHQ.Client/Types/BillingCustomerSubscription.cs index 9c3f11c..9e17ddb 100644 --- a/src/SchematicHQ.Client/Types/BillingCustomerSubscription.cs +++ b/src/SchematicHQ.Client/Types/BillingCustomerSubscription.cs @@ -6,9 +6,21 @@ namespace SchematicHQ.Client; public record BillingCustomerSubscription { + [JsonPropertyName("currency")] + public required string Currency { get; init; } + [JsonPropertyName("expired_at")] public DateTime? ExpiredAt { get; init; } + [JsonPropertyName("interval")] + public required string Interval { get; init; } + + [JsonPropertyName("metered_usage")] + public required bool MeteredUsage { get; init; } + + [JsonPropertyName("per_unit_price")] + public required int PerUnitPrice { get; init; } + [JsonPropertyName("total_price")] public required int TotalPrice { get; init; } } diff --git a/src/SchematicHQ.Client/Types/BillingMeterResponseData.cs b/src/SchematicHQ.Client/Types/BillingMeterResponseData.cs new file mode 100644 index 0000000..b584df8 --- /dev/null +++ b/src/SchematicHQ.Client/Types/BillingMeterResponseData.cs @@ -0,0 +1,23 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record BillingMeterResponseData +{ + [JsonPropertyName("dispaly_name")] + public required string DispalyName { get; init; } + + [JsonPropertyName("event_name")] + public required string EventName { get; init; } + + [JsonPropertyName("event_payload_key")] + public required string EventPayloadKey { get; init; } + + [JsonPropertyName("external_price_id")] + public required string ExternalPriceId { get; init; } + + [JsonPropertyName("id")] + public required string Id { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/BillingPriceResponseData.cs b/src/SchematicHQ.Client/Types/BillingPriceResponseData.cs index 92aa7a2..8586fa8 100644 --- a/src/SchematicHQ.Client/Types/BillingPriceResponseData.cs +++ b/src/SchematicHQ.Client/Types/BillingPriceResponseData.cs @@ -6,6 +6,9 @@ namespace SchematicHQ.Client; public record BillingPriceResponseData { + [JsonPropertyName("currency")] + public required string Currency { get; init; } + [JsonPropertyName("external_price_id")] public required string ExternalPriceId { get; init; } diff --git a/src/SchematicHQ.Client/Types/BillingPriceView.cs b/src/SchematicHQ.Client/Types/BillingPriceView.cs new file mode 100644 index 0000000..c1138de --- /dev/null +++ b/src/SchematicHQ.Client/Types/BillingPriceView.cs @@ -0,0 +1,47 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record BillingPriceView +{ + [JsonPropertyName("created_at")] + public required DateTime CreatedAt { get; init; } + + [JsonPropertyName("currency")] + public required string Currency { get; init; } + + [JsonPropertyName("id")] + public required string Id { get; init; } + + [JsonPropertyName("interval")] + public required string Interval { get; init; } + + [JsonPropertyName("meter_id")] + public string? MeterId { get; init; } + + [JsonPropertyName("price")] + public required int Price { get; init; } + + [JsonPropertyName("price_external_id")] + public required string PriceExternalId { get; init; } + + [JsonPropertyName("price_id")] + public required string PriceId { get; init; } + + [JsonPropertyName("product_external_id")] + public required string ProductExternalId { get; init; } + + [JsonPropertyName("product_id")] + public required string ProductId { get; init; } + + [JsonPropertyName("product_name")] + public required string ProductName { get; init; } + + [JsonPropertyName("updated_at")] + public required DateTime UpdatedAt { get; init; } + + [JsonPropertyName("usage_type")] + public required string UsageType { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/BillingProductDetailResponseData.cs b/src/SchematicHQ.Client/Types/BillingProductDetailResponseData.cs index b956d0e..849b174 100644 --- a/src/SchematicHQ.Client/Types/BillingProductDetailResponseData.cs +++ b/src/SchematicHQ.Client/Types/BillingProductDetailResponseData.cs @@ -7,10 +7,6 @@ namespace SchematicHQ.Client; public record BillingProductDetailResponseData { - [JsonPropertyName("Prices")] - public IEnumerable Prices { get; init; } = - new List(); - [JsonPropertyName("account_id")] public required string AccountId { get; init; } @@ -32,6 +28,10 @@ public record BillingProductDetailResponseData [JsonPropertyName("price")] public required double Price { get; init; } + [JsonPropertyName("prices")] + public IEnumerable Prices { get; init; } = + new List(); + [JsonPropertyName("product_id")] public required string ProductId { get; init; } diff --git a/src/SchematicHQ.Client/Types/BillingProductForSubscriptionResponseData.cs b/src/SchematicHQ.Client/Types/BillingProductForSubscriptionResponseData.cs index e5644a7..2c7b37f 100644 --- a/src/SchematicHQ.Client/Types/BillingProductForSubscriptionResponseData.cs +++ b/src/SchematicHQ.Client/Types/BillingProductForSubscriptionResponseData.cs @@ -6,9 +6,6 @@ namespace SchematicHQ.Client; public record BillingProductForSubscriptionResponseData { - [JsonPropertyName("account_id")] - public required string AccountId { get; init; } - [JsonPropertyName("created_at")] public required DateTime CreatedAt { get; init; } @@ -25,17 +22,32 @@ public record BillingProductForSubscriptionResponseData public required string Id { get; init; } [JsonPropertyName("interval")] - public string? Interval { get; init; } + public required string Interval { get; init; } + + [JsonPropertyName("meter_id")] + public string? MeterId { get; init; } [JsonPropertyName("name")] public required string Name { get; init; } [JsonPropertyName("price")] - public required double Price { get; init; } + public required int Price { get; init; } + + [JsonPropertyName("price_external_id")] + public required string PriceExternalId { get; init; } + + [JsonPropertyName("price_id")] + public required string PriceId { get; init; } [JsonPropertyName("quantity")] public required double Quantity { get; init; } + [JsonPropertyName("subscription_id")] + public required string SubscriptionId { get; init; } + [JsonPropertyName("updated_at")] public required DateTime UpdatedAt { get; init; } + + [JsonPropertyName("usage_type")] + public required string UsageType { get; init; } } diff --git a/src/SchematicHQ.Client/Types/BillingProductPlanResponseData.cs b/src/SchematicHQ.Client/Types/BillingProductPlanResponseData.cs index ec48ffa..aa0ce1d 100644 --- a/src/SchematicHQ.Client/Types/BillingProductPlanResponseData.cs +++ b/src/SchematicHQ.Client/Types/BillingProductPlanResponseData.cs @@ -15,12 +15,18 @@ public record BillingProductPlanResponseData [JsonPropertyName("environment_id")] public required string EnvironmentId { get; init; } + [JsonPropertyName("is_trialable")] + public required bool IsTrialable { get; init; } + [JsonPropertyName("monthly_price_id")] public string? MonthlyPriceId { get; init; } [JsonPropertyName("plan_id")] public required string PlanId { get; init; } + [JsonPropertyName("trial_days")] + public int? TrialDays { get; init; } + [JsonPropertyName("yearly_price_id")] public string? YearlyPriceId { get; init; } } diff --git a/src/SchematicHQ.Client/Types/BillingProductPriceResponseData.cs b/src/SchematicHQ.Client/Types/BillingProductPriceResponseData.cs new file mode 100644 index 0000000..9143af8 --- /dev/null +++ b/src/SchematicHQ.Client/Types/BillingProductPriceResponseData.cs @@ -0,0 +1,38 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record BillingProductPriceResponseData +{ + [JsonPropertyName("created_at")] + public required DateTime CreatedAt { get; init; } + + [JsonPropertyName("currency")] + public required string Currency { get; init; } + + [JsonPropertyName("id")] + public required string Id { get; init; } + + [JsonPropertyName("interval")] + public required string Interval { get; init; } + + [JsonPropertyName("meter_id")] + public string? MeterId { 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; } + + [JsonPropertyName("updated_at")] + public required DateTime UpdatedAt { get; init; } + + [JsonPropertyName("usage_type")] + public required string UsageType { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/BillingProductPricing.cs b/src/SchematicHQ.Client/Types/BillingProductPricing.cs index ec95e27..85e0ea0 100644 --- a/src/SchematicHQ.Client/Types/BillingProductPricing.cs +++ b/src/SchematicHQ.Client/Types/BillingProductPricing.cs @@ -6,15 +6,27 @@ namespace SchematicHQ.Client; public record BillingProductPricing { + [JsonPropertyName("currency")] + public required string Currency { get; init; } + [JsonPropertyName("interval")] - public string? Interval { get; init; } + public required string Interval { get; init; } + + [JsonPropertyName("meter_id")] + public string? MeterId { get; init; } [JsonPropertyName("price")] public required int Price { get; init; } [JsonPropertyName("price_external_id")] - public string? PriceExternalId { get; init; } + public required string PriceExternalId { get; init; } [JsonPropertyName("product_external_id")] public required string ProductExternalId { get; init; } + + [JsonPropertyName("quantity")] + public required int Quantity { get; init; } + + [JsonPropertyName("usage_type")] + public required string UsageType { get; init; } } diff --git a/src/SchematicHQ.Client/Types/BillingSubscriptionDiscount.cs b/src/SchematicHQ.Client/Types/BillingSubscriptionDiscount.cs new file mode 100644 index 0000000..401c4c9 --- /dev/null +++ b/src/SchematicHQ.Client/Types/BillingSubscriptionDiscount.cs @@ -0,0 +1,29 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record BillingSubscriptionDiscount +{ + [JsonPropertyName("coupon_external_id")] + public required string CouponExternalId { get; init; } + + [JsonPropertyName("customer_facing_code")] + public string? CustomerFacingCode { get; init; } + + [JsonPropertyName("ended_at")] + public DateTime? EndedAt { get; init; } + + [JsonPropertyName("external_id")] + public required string ExternalId { get; init; } + + [JsonPropertyName("is_active")] + public required bool IsActive { get; init; } + + [JsonPropertyName("promo_code_external_id")] + public string? PromoCodeExternalId { get; init; } + + [JsonPropertyName("started_at")] + public required DateTime StartedAt { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/BillingSubscriptionDiscountView.cs b/src/SchematicHQ.Client/Types/BillingSubscriptionDiscountView.cs new file mode 100644 index 0000000..a011ff7 --- /dev/null +++ b/src/SchematicHQ.Client/Types/BillingSubscriptionDiscountView.cs @@ -0,0 +1,50 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record BillingSubscriptionDiscountView +{ + [JsonPropertyName("amount_off")] + public int? AmountOff { get; init; } + + [JsonPropertyName("coupon_id")] + public required string CouponId { get; init; } + + [JsonPropertyName("coupon_name")] + public required string CouponName { get; init; } + + [JsonPropertyName("currency")] + public string? Currency { get; init; } + + [JsonPropertyName("customer_facing_code")] + public string? CustomerFacingCode { get; init; } + + [JsonPropertyName("discount_external_id")] + public required string DiscountExternalId { get; init; } + + [JsonPropertyName("duration")] + public required string Duration { get; init; } + + [JsonPropertyName("duration_in_months")] + public int? DurationInMonths { get; init; } + + [JsonPropertyName("ended_at")] + public DateTime? EndedAt { get; init; } + + [JsonPropertyName("is_active")] + public required bool IsActive { get; init; } + + [JsonPropertyName("percent_off")] + public double? PercentOff { get; init; } + + [JsonPropertyName("promo_code_external_id")] + public string? PromoCodeExternalId { get; init; } + + [JsonPropertyName("started_at")] + public required DateTime StartedAt { get; init; } + + [JsonPropertyName("subscription_external_id")] + public required string SubscriptionExternalId { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/BillingSubscriptionResponseData.cs b/src/SchematicHQ.Client/Types/BillingSubscriptionResponseData.cs index 75530b0..ba01249 100644 --- a/src/SchematicHQ.Client/Types/BillingSubscriptionResponseData.cs +++ b/src/SchematicHQ.Client/Types/BillingSubscriptionResponseData.cs @@ -6,15 +6,48 @@ namespace SchematicHQ.Client; public record BillingSubscriptionResponseData { + [JsonPropertyName("company_id")] + public string? CompanyId { get; init; } + + [JsonPropertyName("created_at")] + public required DateTime CreatedAt { get; init; } + + [JsonPropertyName("currency")] + public required string Currency { get; init; } + + [JsonPropertyName("customer_external_id")] + public required string CustomerExternalId { get; init; } + [JsonPropertyName("expired_at")] public DateTime? ExpiredAt { get; init; } - [JsonPropertyName("external_id")] - public required string ExternalId { get; init; } - [JsonPropertyName("id")] - public required int Id { get; init; } + public required string Id { get; init; } + + [JsonPropertyName("interval")] + public required string Interval { get; init; } + + [JsonPropertyName("metadata")] + public Dictionary? Metadata { get; init; } + + [JsonPropertyName("period_end")] + public required int PeriodEnd { get; init; } + + [JsonPropertyName("period_start")] + public required int PeriodStart { get; init; } + + [JsonPropertyName("status")] + public required string Status { get; init; } + + [JsonPropertyName("subscription_external_id")] + public required string SubscriptionExternalId { get; init; } + + [JsonPropertyName("total_price")] + public required int TotalPrice { get; init; } + + [JsonPropertyName("trial_end")] + public int? TrialEnd { get; init; } - [JsonPropertyName("updated_at")] - public required DateTime UpdatedAt { get; init; } + [JsonPropertyName("trial_end_setting")] + public string? TrialEndSetting { get; init; } } diff --git a/src/SchematicHQ.Client/Types/BillingSubscriptionView.cs b/src/SchematicHQ.Client/Types/BillingSubscriptionView.cs new file mode 100644 index 0000000..0206d77 --- /dev/null +++ b/src/SchematicHQ.Client/Types/BillingSubscriptionView.cs @@ -0,0 +1,68 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record BillingSubscriptionView +{ + [JsonPropertyName("company_id")] + public string? CompanyId { get; init; } + + [JsonPropertyName("created_at")] + public required DateTime CreatedAt { get; init; } + + [JsonPropertyName("currency")] + public required string Currency { get; init; } + + [JsonPropertyName("customer_external_id")] + public required string CustomerExternalId { get; init; } + + [JsonPropertyName("discounts")] + public IEnumerable Discounts { get; init; } = + new List(); + + [JsonPropertyName("expired_at")] + public DateTime? ExpiredAt { get; init; } + + [JsonPropertyName("id")] + public required string Id { get; init; } + + [JsonPropertyName("interval")] + public required string Interval { get; init; } + + [JsonPropertyName("latest_invoice")] + public InvoiceResponseData? LatestInvoice { get; init; } + + [JsonPropertyName("metadata")] + public Dictionary? Metadata { get; init; } + + [JsonPropertyName("payment_method")] + public PaymentMethodResponseData? PaymentMethod { get; init; } + + [JsonPropertyName("period_end")] + public required int PeriodEnd { get; init; } + + [JsonPropertyName("period_start")] + public required int PeriodStart { get; init; } + + [JsonPropertyName("products")] + public IEnumerable Products { get; init; } = + new List(); + + [JsonPropertyName("status")] + public required string Status { get; init; } + + [JsonPropertyName("subscription_external_id")] + public required string SubscriptionExternalId { get; init; } + + [JsonPropertyName("total_price")] + public required int TotalPrice { get; init; } + + [JsonPropertyName("trial_end")] + public int? TrialEnd { get; init; } + + [JsonPropertyName("trial_end_setting")] + public string? TrialEndSetting { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/ChangeSubscriptionInternalRequestBody.cs b/src/SchematicHQ.Client/Types/ChangeSubscriptionInternalRequestBody.cs new file mode 100644 index 0000000..da9af27 --- /dev/null +++ b/src/SchematicHQ.Client/Types/ChangeSubscriptionInternalRequestBody.cs @@ -0,0 +1,32 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record ChangeSubscriptionInternalRequestBody +{ + [JsonPropertyName("add_on_ids")] + public IEnumerable AddOnIds { get; init; } = + new List(); + + [JsonPropertyName("company_id")] + public required string CompanyId { get; init; } + + [JsonPropertyName("new_plan_id")] + public required string NewPlanId { get; init; } + + [JsonPropertyName("new_price_id")] + public required string NewPriceId { get; init; } + + [JsonPropertyName("pay_in_advance")] + public IEnumerable PayInAdvance { get; init; } = + new List(); + + [JsonPropertyName("payment_method_id")] + public string? PaymentMethodId { get; init; } + + [JsonPropertyName("promo_code")] + public string? PromoCode { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/ChangeSubscriptionRequestBody.cs b/src/SchematicHQ.Client/Types/ChangeSubscriptionRequestBody.cs new file mode 100644 index 0000000..5d02929 --- /dev/null +++ b/src/SchematicHQ.Client/Types/ChangeSubscriptionRequestBody.cs @@ -0,0 +1,29 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record ChangeSubscriptionRequestBody +{ + [JsonPropertyName("add_on_ids")] + public IEnumerable AddOnIds { get; init; } = + new List(); + + [JsonPropertyName("new_plan_id")] + public required string NewPlanId { get; init; } + + [JsonPropertyName("new_price_id")] + public required string NewPriceId { get; init; } + + [JsonPropertyName("pay_in_advance")] + public IEnumerable PayInAdvance { get; init; } = + new List(); + + [JsonPropertyName("payment_method_id")] + public string? PaymentMethodId { get; init; } + + [JsonPropertyName("promo_code")] + public string? PromoCode { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/CheckFlagOutputWithFlagKey.cs b/src/SchematicHQ.Client/Types/CheckFlagOutputWithFlagKey.cs index 6f07fba..deeaebe 100644 --- a/src/SchematicHQ.Client/Types/CheckFlagOutputWithFlagKey.cs +++ b/src/SchematicHQ.Client/Types/CheckFlagOutputWithFlagKey.cs @@ -15,6 +15,9 @@ public record CheckFlagOutputWithFlagKey [JsonPropertyName("flag")] public required string Flag { get; init; } + [JsonPropertyName("flag_id")] + public string? FlagId { get; init; } + [JsonPropertyName("reason")] public required string Reason { get; init; } diff --git a/src/SchematicHQ.Client/Types/CheckFlagRequestBody.cs b/src/SchematicHQ.Client/Types/CheckFlagRequestBody.cs index c5d3837..de2b0a6 100644 --- a/src/SchematicHQ.Client/Types/CheckFlagRequestBody.cs +++ b/src/SchematicHQ.Client/Types/CheckFlagRequestBody.cs @@ -7,8 +7,8 @@ namespace SchematicHQ.Client; public record CheckFlagRequestBody { [JsonPropertyName("company")] - public Dictionary? Company { get; init; } + public Dictionary? Company { get; init; } [JsonPropertyName("user")] - public Dictionary? User { get; init; } + public Dictionary? User { get; init; } } diff --git a/src/SchematicHQ.Client/Types/CheckFlagResponseData.cs b/src/SchematicHQ.Client/Types/CheckFlagResponseData.cs index 4c842d7..4cb18c5 100644 --- a/src/SchematicHQ.Client/Types/CheckFlagResponseData.cs +++ b/src/SchematicHQ.Client/Types/CheckFlagResponseData.cs @@ -12,6 +12,9 @@ public record CheckFlagResponseData [JsonPropertyName("error")] public string? Error { get; init; } + [JsonPropertyName("flag_id")] + public string? FlagId { get; init; } + [JsonPropertyName("reason")] public required string Reason { get; init; } diff --git a/src/SchematicHQ.Client/Types/CompanyDetailResponseData.cs b/src/SchematicHQ.Client/Types/CompanyDetailResponseData.cs index 9d1acb3..a8737b9 100644 --- a/src/SchematicHQ.Client/Types/CompanyDetailResponseData.cs +++ b/src/SchematicHQ.Client/Types/CompanyDetailResponseData.cs @@ -8,7 +8,15 @@ namespace SchematicHQ.Client; public record CompanyDetailResponseData { [JsonPropertyName("add_ons")] - public IEnumerable AddOns { get; init; } = new List(); + public IEnumerable AddOns { get; init; } = + new List(); + + [JsonPropertyName("billing_subscription")] + public BillingSubscriptionView? BillingSubscription { get; init; } + + [JsonPropertyName("billing_subscriptions")] + public IEnumerable BillingSubscriptions { get; init; } = + new List(); [JsonPropertyName("created_at")] public required DateTime CreatedAt { get; init; } @@ -33,14 +41,19 @@ public record CompanyDetailResponseData [JsonPropertyName("logo_url")] public string? LogoUrl { get; init; } + [JsonPropertyName("metrics")] + public IEnumerable Metrics { get; init; } = + new List(); + [JsonPropertyName("name")] public required string Name { get; init; } [JsonPropertyName("plan")] - public BillingPlan? Plan { get; init; } + public CompanyPlanWithBillingSubView? Plan { get; init; } [JsonPropertyName("plans")] - public IEnumerable Plans { get; init; } = new List(); + public IEnumerable Plans { get; init; } = + new List(); /// /// A map of trait names to trait values diff --git a/src/SchematicHQ.Client/Types/CompanyEventPeriodMetricsResponseData.cs b/src/SchematicHQ.Client/Types/CompanyEventPeriodMetricsResponseData.cs new file mode 100644 index 0000000..37191b2 --- /dev/null +++ b/src/SchematicHQ.Client/Types/CompanyEventPeriodMetricsResponseData.cs @@ -0,0 +1,41 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record CompanyEventPeriodMetricsResponseData +{ + [JsonPropertyName("account_id")] + public required string AccountId { get; init; } + + [JsonPropertyName("captured_at_max")] + public required DateTime CapturedAtMax { get; init; } + + [JsonPropertyName("captured_at_min")] + public required DateTime CapturedAtMin { get; init; } + + [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("event_subtype")] + public required string EventSubtype { get; init; } + + [JsonPropertyName("month_reset")] + public required string MonthReset { get; init; } + + [JsonPropertyName("period")] + public required string Period { get; init; } + + [JsonPropertyName("valid_until")] + public DateTime? ValidUntil { get; init; } + + [JsonPropertyName("value")] + public required int Value { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/CompanyOverrideResponseData.cs b/src/SchematicHQ.Client/Types/CompanyOverrideResponseData.cs index 2e2897d..9caa645 100644 --- a/src/SchematicHQ.Client/Types/CompanyOverrideResponseData.cs +++ b/src/SchematicHQ.Client/Types/CompanyOverrideResponseData.cs @@ -19,6 +19,9 @@ public record CompanyOverrideResponseData [JsonPropertyName("environment_id")] public required string EnvironmentId { get; init; } + [JsonPropertyName("expiration_date")] + public DateTime? ExpirationDate { get; init; } + [JsonPropertyName("feature")] public FeatureResponseData? Feature { get; init; } @@ -31,8 +34,11 @@ public record CompanyOverrideResponseData [JsonPropertyName("metric_period")] public string? MetricPeriod { get; init; } + [JsonPropertyName("metric_period_month_reset")] + public string? MetricPeriodMonthReset { get; init; } + [JsonPropertyName("rule_id")] - public required string RuleId { get; init; } + public string? RuleId { get; init; } [JsonPropertyName("updated_at")] public required DateTime UpdatedAt { get; init; } diff --git a/src/SchematicHQ.Client/Types/CompanyPlanDetailResponseData.cs b/src/SchematicHQ.Client/Types/CompanyPlanDetailResponseData.cs new file mode 100644 index 0000000..389f784 --- /dev/null +++ b/src/SchematicHQ.Client/Types/CompanyPlanDetailResponseData.cs @@ -0,0 +1,74 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record CompanyPlanDetailResponseData +{ + [JsonPropertyName("audience_type")] + public string? AudienceType { get; init; } + + [JsonPropertyName("billing_product")] + public BillingProductDetailResponseData? BillingProduct { get; init; } + + [JsonPropertyName("company_can_trial")] + public required bool CompanyCanTrial { get; init; } + + [JsonPropertyName("company_count")] + public required int CompanyCount { get; init; } + + [JsonPropertyName("created_at")] + public required DateTime CreatedAt { get; init; } + + [JsonPropertyName("current")] + public required bool Current { get; init; } + + [JsonPropertyName("description")] + public required string Description { get; init; } + + [JsonPropertyName("entitlements")] + public IEnumerable Entitlements { get; init; } = + new List(); + + [JsonPropertyName("features")] + public IEnumerable Features { get; init; } = + new List(); + + [JsonPropertyName("icon")] + public required string Icon { get; init; } + + [JsonPropertyName("id")] + public required string Id { get; init; } + + [JsonPropertyName("is_default")] + public required bool IsDefault { get; init; } + + [JsonPropertyName("is_free")] + public required bool IsFree { get; init; } + + [JsonPropertyName("is_trialable")] + public required bool IsTrialable { get; init; } + + [JsonPropertyName("monthly_price")] + public BillingPriceResponseData? MonthlyPrice { get; init; } + + [JsonPropertyName("name")] + public required string Name { get; init; } + + [JsonPropertyName("plan_type")] + public required string PlanType { get; init; } + + [JsonPropertyName("trial_days")] + public int? TrialDays { get; init; } + + [JsonPropertyName("updated_at")] + public required DateTime UpdatedAt { get; init; } + + [JsonPropertyName("valid")] + public required bool Valid { get; init; } + + [JsonPropertyName("yearly_price")] + public BillingPriceResponseData? YearlyPrice { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/BillingPlan.cs b/src/SchematicHQ.Client/Types/CompanyPlanWithBillingSubView.cs similarity index 80% rename from src/SchematicHQ.Client/Types/BillingPlan.cs rename to src/SchematicHQ.Client/Types/CompanyPlanWithBillingSubView.cs index e7b75d9..671dbfe 100644 --- a/src/SchematicHQ.Client/Types/BillingPlan.cs +++ b/src/SchematicHQ.Client/Types/CompanyPlanWithBillingSubView.cs @@ -4,8 +4,11 @@ namespace SchematicHQ.Client; -public record BillingPlan +public record CompanyPlanWithBillingSubView { + [JsonPropertyName("billing_product_id")] + public string? BillingProductId { get; init; } + [JsonPropertyName("description")] public string? Description { get; init; } diff --git a/src/SchematicHQ.Client/Types/CompanySubscriptionResponseData.cs b/src/SchematicHQ.Client/Types/CompanySubscriptionResponseData.cs index 295b985..31e786c 100644 --- a/src/SchematicHQ.Client/Types/CompanySubscriptionResponseData.cs +++ b/src/SchematicHQ.Client/Types/CompanySubscriptionResponseData.cs @@ -7,19 +7,41 @@ namespace SchematicHQ.Client; public record CompanySubscriptionResponseData { + [JsonPropertyName("currency")] + public required string Currency { get; init; } + [JsonPropertyName("customer_external_id")] public required string CustomerExternalId { get; init; } + [JsonPropertyName("discounts")] + public IEnumerable Discounts { get; init; } = + new List(); + [JsonPropertyName("expired_at")] public DateTime? ExpiredAt { get; init; } [JsonPropertyName("interval")] public required string Interval { get; init; } + [JsonPropertyName("latest_invoice")] + public InvoiceResponseData? LatestInvoice { get; init; } + + [JsonPropertyName("payment_method")] + public PaymentMethodResponseData? PaymentMethod { get; init; } + [JsonPropertyName("products")] public IEnumerable Products { get; init; } = new List(); + [JsonPropertyName("status")] + public required string Status { get; init; } + [JsonPropertyName("subscription_external_id")] public required string SubscriptionExternalId { get; init; } + + [JsonPropertyName("total_price")] + public required int TotalPrice { get; init; } + + [JsonPropertyName("trial_end")] + public DateTime? TrialEnd { get; init; } } diff --git a/src/SchematicHQ.Client/Types/ComponentCapabilities.cs b/src/SchematicHQ.Client/Types/ComponentCapabilities.cs new file mode 100644 index 0000000..5289190 --- /dev/null +++ b/src/SchematicHQ.Client/Types/ComponentCapabilities.cs @@ -0,0 +1,11 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record ComponentCapabilities +{ + [JsonPropertyName("checkout")] + public required bool Checkout { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/ComponentHydrateResponseData.cs b/src/SchematicHQ.Client/Types/ComponentHydrateResponseData.cs new file mode 100644 index 0000000..d0053ae --- /dev/null +++ b/src/SchematicHQ.Client/Types/ComponentHydrateResponseData.cs @@ -0,0 +1,45 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record ComponentHydrateResponseData +{ + [JsonPropertyName("active_add_ons")] + public IEnumerable ActiveAddOns { get; init; } = + new List(); + + [JsonPropertyName("active_plans")] + public IEnumerable ActivePlans { get; init; } = + new List(); + + [JsonPropertyName("active_usage_based_entitlements")] + public IEnumerable ActiveUsageBasedEntitlements { get; init; } = + new List(); + + [JsonPropertyName("capabilities")] + public ComponentCapabilities? Capabilities { get; init; } + + [JsonPropertyName("company")] + public CompanyDetailResponseData? Company { get; init; } + + [JsonPropertyName("component")] + public ComponentResponseData? Component { get; init; } + + [JsonPropertyName("feature_usage")] + public FeatureUsageDetailResponseData? FeatureUsage { get; init; } + + [JsonPropertyName("stripe_embed")] + public StripeEmbedInfo? StripeEmbed { get; init; } + + [JsonPropertyName("subscription")] + public CompanySubscriptionResponseData? Subscription { get; init; } + + [JsonPropertyName("trial_payment_method_required")] + public bool? TrialPaymentMethodRequired { get; init; } + + [JsonPropertyName("upcoming_invoice")] + public InvoiceResponseData? UpcomingInvoice { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/ComponentPreviewResponseData.cs b/src/SchematicHQ.Client/Types/ComponentPreviewResponseData.cs new file mode 100644 index 0000000..a247a4d --- /dev/null +++ b/src/SchematicHQ.Client/Types/ComponentPreviewResponseData.cs @@ -0,0 +1,49 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record ComponentPreviewResponseData +{ + [JsonPropertyName("active_add_ons")] + public IEnumerable ActiveAddOns { get; init; } = + new List(); + + [JsonPropertyName("active_plans")] + public IEnumerable ActivePlans { get; init; } = + new List(); + + [JsonPropertyName("active_usage_based_entitlements")] + public IEnumerable ActiveUsageBasedEntitlements { get; init; } = + new List(); + + [JsonPropertyName("capabilities")] + public ComponentCapabilities? Capabilities { get; init; } + + [JsonPropertyName("company")] + public CompanyDetailResponseData? Company { get; init; } + + [JsonPropertyName("component")] + public ComponentResponseData? Component { get; init; } + + [JsonPropertyName("feature_usage")] + public FeatureUsageDetailResponseData? FeatureUsage { get; init; } + + [JsonPropertyName("invoices")] + public IEnumerable Invoices { get; init; } = + new List(); + + [JsonPropertyName("stripe_embed")] + public StripeEmbedInfo? StripeEmbed { get; init; } + + [JsonPropertyName("subscription")] + public CompanySubscriptionResponseData? Subscription { get; init; } + + [JsonPropertyName("trial_payment_method_required")] + public bool? TrialPaymentMethodRequired { get; init; } + + [JsonPropertyName("upcoming_invoice")] + public InvoiceResponseData? UpcomingInvoice { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/CouponRequestBody.cs b/src/SchematicHQ.Client/Types/CouponRequestBody.cs new file mode 100644 index 0000000..5a61cb0 --- /dev/null +++ b/src/SchematicHQ.Client/Types/CouponRequestBody.cs @@ -0,0 +1,32 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record CouponRequestBody +{ + [JsonPropertyName("amount_off")] + public required int AmountOff { get; init; } + + [JsonPropertyName("currency")] + public string? Currency { get; init; } + + [JsonPropertyName("duration")] + public required string Duration { get; init; } + + [JsonPropertyName("duration_in_months")] + public required int DurationInMonths { get; init; } + + [JsonPropertyName("max_redemptions")] + public required int MaxRedemptions { get; init; } + + [JsonPropertyName("name")] + public required string Name { get; init; } + + [JsonPropertyName("percent_off")] + public required double PercentOff { get; init; } + + [JsonPropertyName("times_redeemed")] + public required int TimesRedeemed { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/CreateReqCommon.cs b/src/SchematicHQ.Client/Types/CreateEntitlementReqCommon.cs similarity index 60% rename from src/SchematicHQ.Client/Types/CreateReqCommon.cs rename to src/SchematicHQ.Client/Types/CreateEntitlementReqCommon.cs index 3a256f0..6e54030 100644 --- a/src/SchematicHQ.Client/Types/CreateReqCommon.cs +++ b/src/SchematicHQ.Client/Types/CreateEntitlementReqCommon.cs @@ -5,13 +5,16 @@ namespace SchematicHQ.Client; -public record CreateReqCommon +public record CreateEntitlementReqCommon { [JsonPropertyName("feature_id")] public required string FeatureId { get; init; } [JsonPropertyName("metric_period")] - public CreateReqCommonMetricPeriod? MetricPeriod { get; init; } + public CreateEntitlementReqCommonMetricPeriod? MetricPeriod { get; init; } + + [JsonPropertyName("metric_period_month_reset")] + public CreateEntitlementReqCommonMetricPeriodMonthReset? MetricPeriodMonthReset { get; init; } [JsonPropertyName("value_bool")] public bool? ValueBool { get; init; } @@ -23,5 +26,5 @@ public record CreateReqCommon public string? ValueTraitId { get; init; } [JsonPropertyName("value_type")] - public required CreateReqCommonValueType ValueType { get; init; } + public required CreateEntitlementReqCommonValueType ValueType { get; init; } } diff --git a/src/SchematicHQ.Client/Types/UpdateReqCommonMetricPeriod.cs b/src/SchematicHQ.Client/Types/CreateEntitlementReqCommonMetricPeriod.cs similarity index 65% rename from src/SchematicHQ.Client/Types/UpdateReqCommonMetricPeriod.cs rename to src/SchematicHQ.Client/Types/CreateEntitlementReqCommonMetricPeriod.cs index 6e791aa..84dfecc 100644 --- a/src/SchematicHQ.Client/Types/UpdateReqCommonMetricPeriod.cs +++ b/src/SchematicHQ.Client/Types/CreateEntitlementReqCommonMetricPeriod.cs @@ -7,9 +7,12 @@ namespace SchematicHQ.Client; -[JsonConverter(typeof(StringEnumSerializer))] -public enum UpdateReqCommonMetricPeriod +[JsonConverter(typeof(StringEnumSerializer))] +public enum CreateEntitlementReqCommonMetricPeriod { + [EnumMember(Value = "all_time")] + AllTime, + [EnumMember(Value = "current_month")] CurrentMonth, diff --git a/src/SchematicHQ.Client/Types/CreateEntitlementReqCommonMetricPeriodMonthReset.cs b/src/SchematicHQ.Client/Types/CreateEntitlementReqCommonMetricPeriodMonthReset.cs new file mode 100644 index 0000000..f8bb385 --- /dev/null +++ b/src/SchematicHQ.Client/Types/CreateEntitlementReqCommonMetricPeriodMonthReset.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 CreateEntitlementReqCommonMetricPeriodMonthReset +{ + [EnumMember(Value = "first_of_month")] + FirstOfMonth, + + [EnumMember(Value = "billing_cycle")] + BillingCycle +} diff --git a/src/SchematicHQ.Client/Types/UpdateReqCommonValueType.cs b/src/SchematicHQ.Client/Types/CreateEntitlementReqCommonValueType.cs similarity index 74% rename from src/SchematicHQ.Client/Types/UpdateReqCommonValueType.cs rename to src/SchematicHQ.Client/Types/CreateEntitlementReqCommonValueType.cs index 2793331..faaab44 100644 --- a/src/SchematicHQ.Client/Types/UpdateReqCommonValueType.cs +++ b/src/SchematicHQ.Client/Types/CreateEntitlementReqCommonValueType.cs @@ -7,8 +7,8 @@ namespace SchematicHQ.Client; -[JsonConverter(typeof(StringEnumSerializer))] -public enum UpdateReqCommonValueType +[JsonConverter(typeof(StringEnumSerializer))] +public enum CreateEntitlementReqCommonValueType { [EnumMember(Value = "boolean")] Boolean, diff --git a/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBody.cs b/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBody.cs index ce8cca7..65d8318 100644 --- a/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBody.cs +++ b/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBody.cs @@ -31,6 +31,12 @@ public record CreateOrUpdateConditionRequestBody [JsonPropertyName("metric_period")] public CreateOrUpdateConditionRequestBodyMetricPeriod? MetricPeriod { get; init; } + /// + /// When metric_period=current_month, specify whether the month restarts based on the calendar month or the billing period + /// + [JsonPropertyName("metric_period_month_reset")] + public CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset? MetricPeriodMonthReset { get; init; } + /// /// Value to compare the track event metric against /// diff --git a/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBodyConditionType.cs b/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBodyConditionType.cs index 7d9c24f..fdc5b50 100644 --- a/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBodyConditionType.cs +++ b/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBodyConditionType.cs @@ -29,5 +29,8 @@ public enum CreateOrUpdateConditionRequestBodyConditionType BillingProduct, [EnumMember(Value = "crm_product")] - CrmProduct + CrmProduct, + + [EnumMember(Value = "base_plan")] + BasePlan } diff --git a/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBodyMetricPeriod.cs b/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBodyMetricPeriod.cs index 0607f2d..71c1e12 100644 --- a/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBodyMetricPeriod.cs +++ b/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBodyMetricPeriod.cs @@ -10,6 +10,9 @@ namespace SchematicHQ.Client; [JsonConverter(typeof(StringEnumSerializer))] public enum CreateOrUpdateConditionRequestBodyMetricPeriod { + [EnumMember(Value = "all_time")] + AllTime, + [EnumMember(Value = "current_month")] CurrentMonth, diff --git a/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset.cs b/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset.cs new file mode 100644 index 0000000..ba4e98f --- /dev/null +++ b/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset.cs @@ -0,0 +1,20 @@ +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 CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset +{ + [EnumMember(Value = "first_of_month")] + FirstOfMonth, + + [EnumMember(Value = "billing_cycle")] + BillingCycle +} diff --git a/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBodyOperator.cs b/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBodyOperator.cs index 9c55558..51d55e6 100644 --- a/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBodyOperator.cs +++ b/src/SchematicHQ.Client/Types/CreateOrUpdateConditionRequestBodyOperator.cs @@ -26,5 +26,11 @@ public enum CreateOrUpdateConditionRequestBodyOperator Lt, [EnumMember(Value = "lte")] - Lte + Lte, + + [EnumMember(Value = "is_empty")] + IsEmpty, + + [EnumMember(Value = "not_empty")] + NotEmpty } diff --git a/src/SchematicHQ.Client/Types/EventBodyFlagCheck.cs b/src/SchematicHQ.Client/Types/EventBodyFlagCheck.cs index 4e166f9..f96211d 100644 --- a/src/SchematicHQ.Client/Types/EventBodyFlagCheck.cs +++ b/src/SchematicHQ.Client/Types/EventBodyFlagCheck.cs @@ -7,7 +7,7 @@ namespace SchematicHQ.Client; public record EventBodyFlagCheck { /// - /// Schematic company ID (starting with 'comp\_') of the company evaluated, if any + /// Schematic company ID (starting with 'comp_') of the company evaluated, if any /// [JsonPropertyName("company_id")] public string? CompanyId { get; init; } @@ -19,7 +19,7 @@ public record EventBodyFlagCheck public string? Error { get; init; } /// - /// Schematic flag ID (starting with 'flag\_') for the flag matching the key, if any + /// Schematic flag ID (starting with 'flag_') for the flag matching the key, if any /// [JsonPropertyName("flag_id")] public string? FlagId { get; init; } @@ -40,22 +40,22 @@ public record EventBodyFlagCheck /// Key-value pairs used to to identify company for which the flag was checked /// [JsonPropertyName("req_company")] - public Dictionary? ReqCompany { get; init; } + 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; } + public Dictionary? ReqUser { get; init; } /// - /// Schematic rule ID (starting with 'rule\_') of the rule that matched for the flag, if any + /// 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 + /// Schematic user ID (starting with 'user_') of the user evaluated, if any /// [JsonPropertyName("user_id")] public string? UserId { get; init; } diff --git a/src/SchematicHQ.Client/Types/FeatureCompanyResponseData.cs b/src/SchematicHQ.Client/Types/FeatureCompanyResponseData.cs index 5af0617..f652a53 100644 --- a/src/SchematicHQ.Client/Types/FeatureCompanyResponseData.cs +++ b/src/SchematicHQ.Client/Types/FeatureCompanyResponseData.cs @@ -28,6 +28,9 @@ public record FeatureCompanyResponseData [JsonPropertyName("company")] public CompanyDetailResponseData? Company { get; init; } + [JsonPropertyName("entitlement_expiration_date")] + public DateTime? EntitlementExpirationDate { get; init; } + [JsonPropertyName("entitlement_id")] public required string EntitlementId { get; init; } @@ -37,6 +40,18 @@ public record FeatureCompanyResponseData [JsonPropertyName("feature")] public FeatureDetailResponseData? Feature { get; init; } + /// + /// The time at which the metric will resets. + /// + [JsonPropertyName("metric_reset_at")] + public DateTime? MetricResetAt { get; init; } + + /// + /// If the period is current_month, when the month resets. + /// + [JsonPropertyName("month_reset")] + public string? MonthReset { get; init; } + /// /// The period over which usage is measured. /// diff --git a/src/SchematicHQ.Client/Types/FeatureCompanyUserResponseData.cs b/src/SchematicHQ.Client/Types/FeatureCompanyUserResponseData.cs index 2aa2d5a..8f1cfc4 100644 --- a/src/SchematicHQ.Client/Types/FeatureCompanyUserResponseData.cs +++ b/src/SchematicHQ.Client/Types/FeatureCompanyUserResponseData.cs @@ -37,6 +37,18 @@ public record FeatureCompanyUserResponseData [JsonPropertyName("feature")] public FeatureDetailResponseData? Feature { get; init; } + /// + /// The time at which the metric will resets. + /// + [JsonPropertyName("metric_reset_at")] + public DateTime? MetricResetAt { get; init; } + + /// + /// If the period is current_month, when the month resets. + /// + [JsonPropertyName("month_reset")] + public string? MonthReset { get; init; } + /// /// The period over which usage is measured. /// diff --git a/src/SchematicHQ.Client/Types/FeatureUsageResponseData.cs b/src/SchematicHQ.Client/Types/FeatureUsageResponseData.cs index 91a88d6..640ecc5 100644 --- a/src/SchematicHQ.Client/Types/FeatureUsageResponseData.cs +++ b/src/SchematicHQ.Client/Types/FeatureUsageResponseData.cs @@ -25,6 +25,9 @@ public record FeatureUsageResponseData [JsonPropertyName("allocation_type")] public required FeatureUsageResponseDataAllocationType AllocationType { get; init; } + [JsonPropertyName("entitlement_expiration_date")] + public DateTime? EntitlementExpirationDate { get; init; } + [JsonPropertyName("entitlement_id")] public required string EntitlementId { get; init; } @@ -34,6 +37,21 @@ public record FeatureUsageResponseData [JsonPropertyName("feature")] public FeatureDetailResponseData? Feature { get; init; } + /// + /// The time at which the metric will reset. + /// + [JsonPropertyName("metric_reset_at")] + public DateTime? MetricResetAt { get; init; } + + /// + /// If the period is current_month, when the month resets. + /// + [JsonPropertyName("month_reset")] + public string? MonthReset { get; init; } + + [JsonPropertyName("monthly_usage_based_price")] + public BillingPriceView? MonthlyUsageBasedPrice { get; init; } + /// /// The period over which usage is measured. /// @@ -43,9 +61,15 @@ public record FeatureUsageResponseData [JsonPropertyName("plan")] public PlanResponseData? Plan { get; init; } + [JsonPropertyName("price_behavior")] + public string? PriceBehavior { get; init; } + /// /// The amount of usage that has been consumed; a null value indicates that usage is not being measured. /// [JsonPropertyName("usage")] public int? Usage { get; init; } + + [JsonPropertyName("yearly_usage_based_price")] + public BillingPriceView? YearlyUsageBasedPrice { get; init; } } diff --git a/src/SchematicHQ.Client/Types/RuleConditionResourceResponseData.cs b/src/SchematicHQ.Client/Types/GenericPreviewObject.cs similarity index 55% rename from src/SchematicHQ.Client/Types/RuleConditionResourceResponseData.cs rename to src/SchematicHQ.Client/Types/GenericPreviewObject.cs index 4e55da7..18e8d4a 100644 --- a/src/SchematicHQ.Client/Types/RuleConditionResourceResponseData.cs +++ b/src/SchematicHQ.Client/Types/GenericPreviewObject.cs @@ -4,11 +4,17 @@ namespace SchematicHQ.Client; -public record RuleConditionResourceResponseData +public record GenericPreviewObject { + [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; } } diff --git a/src/SchematicHQ.Client/Types/InvoiceRequestBody.cs b/src/SchematicHQ.Client/Types/InvoiceRequestBody.cs new file mode 100644 index 0000000..387de34 --- /dev/null +++ b/src/SchematicHQ.Client/Types/InvoiceRequestBody.cs @@ -0,0 +1,41 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record InvoiceRequestBody +{ + [JsonPropertyName("amount_due")] + public required int AmountDue { get; init; } + + [JsonPropertyName("amount_paid")] + public required int AmountPaid { get; init; } + + [JsonPropertyName("amount_remaining")] + public required int AmountRemaining { get; init; } + + [JsonPropertyName("collection_method")] + public required string CollectionMethod { get; init; } + + [JsonPropertyName("currency")] + public required string Currency { get; init; } + + [JsonPropertyName("customer_external_id")] + public required string CustomerExternalId { get; init; } + + [JsonPropertyName("due_date")] + public DateTime? DueDate { get; init; } + + [JsonPropertyName("payment_method_external_id")] + public string? PaymentMethodExternalId { get; init; } + + [JsonPropertyName("subscription_external_id")] + public string? SubscriptionExternalId { get; init; } + + [JsonPropertyName("subtotal")] + public required int Subtotal { get; init; } + + [JsonPropertyName("url")] + public string? Url { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/InvoiceResponseData.cs b/src/SchematicHQ.Client/Types/InvoiceResponseData.cs new file mode 100644 index 0000000..90e5ea3 --- /dev/null +++ b/src/SchematicHQ.Client/Types/InvoiceResponseData.cs @@ -0,0 +1,59 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record InvoiceResponseData +{ + [JsonPropertyName("amount_due")] + public required int AmountDue { get; init; } + + [JsonPropertyName("amount_paid")] + public required int AmountPaid { get; init; } + + [JsonPropertyName("amount_remaining")] + public required int AmountRemaining { get; init; } + + [JsonPropertyName("collection_method")] + public required string CollectionMethod { get; init; } + + [JsonPropertyName("company_id")] + public string? CompanyId { get; init; } + + [JsonPropertyName("created_at")] + public required DateTime CreatedAt { get; init; } + + [JsonPropertyName("currency")] + public required string Currency { get; init; } + + [JsonPropertyName("customer_external_id")] + public required string CustomerExternalId { get; init; } + + [JsonPropertyName("due_date")] + public DateTime? DueDate { get; init; } + + [JsonPropertyName("environment_id")] + public required string EnvironmentId { get; init; } + + [JsonPropertyName("external_id")] + public string? ExternalId { get; init; } + + [JsonPropertyName("id")] + public required string Id { get; init; } + + [JsonPropertyName("payment_method_external_id")] + public string? PaymentMethodExternalId { get; init; } + + [JsonPropertyName("subscription_external_id")] + public string? SubscriptionExternalId { get; init; } + + [JsonPropertyName("subtotal")] + public required int Subtotal { get; init; } + + [JsonPropertyName("updated_at")] + public required DateTime UpdatedAt { get; init; } + + [JsonPropertyName("url")] + public string? Url { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/MeterRequestBody.cs b/src/SchematicHQ.Client/Types/MeterRequestBody.cs new file mode 100644 index 0000000..9e6548f --- /dev/null +++ b/src/SchematicHQ.Client/Types/MeterRequestBody.cs @@ -0,0 +1,17 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record MeterRequestBody +{ + [JsonPropertyName("display_name")] + public required string DisplayName { get; init; } + + [JsonPropertyName("event_name")] + public required string EventName { get; init; } + + [JsonPropertyName("event_payload_key")] + public required string EventPayloadKey { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/MetricCountsHourlyResponseData.cs b/src/SchematicHQ.Client/Types/MetricCountsHourlyResponseData.cs deleted file mode 100644 index 3fa7f82..0000000 --- a/src/SchematicHQ.Client/Types/MetricCountsHourlyResponseData.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Text.Json.Serialization; - -#nullable enable - -namespace SchematicHQ.Client; - -public record MetricCountsHourlyResponseData -{ - [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("event_subtype")] - public required string EventSubtype { get; init; } - - [JsonPropertyName("start_time")] - public required DateTime StartTime { get; init; } - - [JsonPropertyName("user_id")] - public string? UserId { get; init; } - - [JsonPropertyName("value")] - public required int Value { get; init; } -} diff --git a/src/SchematicHQ.Client/Types/PaymentMethodRequestBody.cs b/src/SchematicHQ.Client/Types/PaymentMethodRequestBody.cs new file mode 100644 index 0000000..c6800aa --- /dev/null +++ b/src/SchematicHQ.Client/Types/PaymentMethodRequestBody.cs @@ -0,0 +1,44 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record PaymentMethodRequestBody +{ + [JsonPropertyName("account_last4")] + public string? AccountLast4 { get; init; } + + [JsonPropertyName("account_name")] + public string? AccountName { get; init; } + + [JsonPropertyName("bank_name")] + public string? BankName { get; init; } + + [JsonPropertyName("billing_email")] + public string? BillingEmail { get; init; } + + [JsonPropertyName("billing_name")] + public string? BillingName { get; init; } + + [JsonPropertyName("card_brand")] + public string? CardBrand { get; init; } + + [JsonPropertyName("card_exp_month")] + public int? CardExpMonth { get; init; } + + [JsonPropertyName("card_exp_year")] + public int? CardExpYear { get; init; } + + [JsonPropertyName("card_last4")] + public string? CardLast4 { get; init; } + + [JsonPropertyName("customer_external_id")] + public required string CustomerExternalId { get; init; } + + [JsonPropertyName("payment_method_type")] + public required string PaymentMethodType { get; init; } + + [JsonPropertyName("subscription_external_id")] + public string? SubscriptionExternalId { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/PaymentMethodResponseData.cs b/src/SchematicHQ.Client/Types/PaymentMethodResponseData.cs new file mode 100644 index 0000000..c169d23 --- /dev/null +++ b/src/SchematicHQ.Client/Types/PaymentMethodResponseData.cs @@ -0,0 +1,62 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record PaymentMethodResponseData +{ + [JsonPropertyName("account_last4")] + public string? AccountLast4 { get; init; } + + [JsonPropertyName("account_name")] + public string? AccountName { get; init; } + + [JsonPropertyName("bank_name")] + public string? BankName { get; init; } + + [JsonPropertyName("billing_email")] + public string? BillingEmail { get; init; } + + [JsonPropertyName("billing_name")] + public string? BillingName { get; init; } + + [JsonPropertyName("card_brand")] + public string? CardBrand { get; init; } + + [JsonPropertyName("card_exp_month")] + public int? CardExpMonth { get; init; } + + [JsonPropertyName("card_exp_year")] + public int? CardExpYear { get; init; } + + [JsonPropertyName("card_last4")] + public string? CardLast4 { get; init; } + + [JsonPropertyName("company_id")] + public string? CompanyId { get; init; } + + [JsonPropertyName("created_at")] + public required DateTime CreatedAt { get; init; } + + [JsonPropertyName("customer_external_id")] + public required string CustomerExternalId { 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("payment_method_type")] + public required string PaymentMethodType { get; init; } + + [JsonPropertyName("subscription_external_id")] + public string? SubscriptionExternalId { get; init; } + + [JsonPropertyName("updated_at")] + public required DateTime UpdatedAt { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/PlanDetailResponseData.cs b/src/SchematicHQ.Client/Types/PlanDetailResponseData.cs index 73593c9..124f7e2 100644 --- a/src/SchematicHQ.Client/Types/PlanDetailResponseData.cs +++ b/src/SchematicHQ.Client/Types/PlanDetailResponseData.cs @@ -32,12 +32,30 @@ public record PlanDetailResponseData [JsonPropertyName("id")] public required string Id { get; init; } + [JsonPropertyName("is_default")] + public required bool IsDefault { get; init; } + + [JsonPropertyName("is_free")] + public required bool IsFree { get; init; } + + [JsonPropertyName("is_trialable")] + public required bool IsTrialable { get; init; } + + [JsonPropertyName("monthly_price")] + public BillingPriceResponseData? MonthlyPrice { get; init; } + [JsonPropertyName("name")] public required string Name { get; init; } [JsonPropertyName("plan_type")] public required string PlanType { get; init; } + [JsonPropertyName("trial_days")] + public int? TrialDays { get; init; } + [JsonPropertyName("updated_at")] public required DateTime UpdatedAt { get; init; } + + [JsonPropertyName("yearly_price")] + public BillingPriceResponseData? YearlyPrice { get; init; } } diff --git a/src/SchematicHQ.Client/Types/PlanEntitlementResponseData.cs b/src/SchematicHQ.Client/Types/PlanEntitlementResponseData.cs index 79db480..44aa0ae 100644 --- a/src/SchematicHQ.Client/Types/PlanEntitlementResponseData.cs +++ b/src/SchematicHQ.Client/Types/PlanEntitlementResponseData.cs @@ -22,15 +22,27 @@ public record PlanEntitlementResponseData [JsonPropertyName("id")] public required string Id { get; init; } + [JsonPropertyName("metered_monthly_price")] + public BillingPriceView? MeteredMonthlyPrice { get; init; } + + [JsonPropertyName("metered_yearly_price")] + public BillingPriceView? MeteredYearlyPrice { get; init; } + [JsonPropertyName("metric_period")] public string? MetricPeriod { get; init; } + [JsonPropertyName("metric_period_month_reset")] + public string? MetricPeriodMonthReset { get; init; } + [JsonPropertyName("plan")] public PlanResponseData? Plan { get; init; } [JsonPropertyName("plan_id")] public required string PlanId { get; init; } + [JsonPropertyName("price_behavior")] + public string? PriceBehavior { get; init; } + [JsonPropertyName("rule_id")] public required string RuleId { get; init; } diff --git a/src/SchematicHQ.Client/Types/PlanGroupDetailResponseData.cs b/src/SchematicHQ.Client/Types/PlanGroupDetailResponseData.cs new file mode 100644 index 0000000..742d238 --- /dev/null +++ b/src/SchematicHQ.Client/Types/PlanGroupDetailResponseData.cs @@ -0,0 +1,32 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record PlanGroupDetailResponseData +{ + [JsonPropertyName("add_ons")] + public IEnumerable AddOns { get; init; } = + new List(); + + [JsonPropertyName("default_plan")] + public PlanGroupPlanDetailResponseData? DefaultPlan { get; init; } + + [JsonPropertyName("default_plan_id")] + public string? DefaultPlanId { get; init; } + + [JsonPropertyName("id")] + public required string Id { get; init; } + + [JsonPropertyName("plans")] + public IEnumerable Plans { get; init; } = + new List(); + + [JsonPropertyName("trial_days")] + public int? TrialDays { get; init; } + + [JsonPropertyName("trial_payment_method_required")] + public bool? TrialPaymentMethodRequired { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/PlanGroupPlanDetailResponseData.cs b/src/SchematicHQ.Client/Types/PlanGroupPlanDetailResponseData.cs new file mode 100644 index 0000000..086b7e0 --- /dev/null +++ b/src/SchematicHQ.Client/Types/PlanGroupPlanDetailResponseData.cs @@ -0,0 +1,65 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record PlanGroupPlanDetailResponseData +{ + [JsonPropertyName("audience_type")] + public string? AudienceType { get; init; } + + [JsonPropertyName("billing_product")] + public BillingProductDetailResponseData? BillingProduct { get; init; } + + [JsonPropertyName("company_count")] + public required int CompanyCount { get; init; } + + [JsonPropertyName("created_at")] + public required DateTime CreatedAt { get; init; } + + [JsonPropertyName("description")] + public required string Description { get; init; } + + [JsonPropertyName("entitlements")] + public IEnumerable Entitlements { get; init; } = + new List(); + + [JsonPropertyName("features")] + public IEnumerable Features { get; init; } = + new List(); + + [JsonPropertyName("icon")] + public required string Icon { get; init; } + + [JsonPropertyName("id")] + public required string Id { get; init; } + + [JsonPropertyName("is_default")] + public required bool IsDefault { get; init; } + + [JsonPropertyName("is_free")] + public required bool IsFree { get; init; } + + [JsonPropertyName("is_trialable")] + public required bool IsTrialable { get; init; } + + [JsonPropertyName("monthly_price")] + public BillingPriceResponseData? MonthlyPrice { get; init; } + + [JsonPropertyName("name")] + public required string Name { get; init; } + + [JsonPropertyName("plan_type")] + public required string PlanType { get; init; } + + [JsonPropertyName("trial_days")] + public int? TrialDays { get; init; } + + [JsonPropertyName("updated_at")] + public required DateTime UpdatedAt { get; init; } + + [JsonPropertyName("yearly_price")] + public BillingPriceResponseData? YearlyPrice { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/BillingPlanGroupResponseData.cs b/src/SchematicHQ.Client/Types/PlanGroupResponseData.cs similarity index 51% rename from src/SchematicHQ.Client/Types/BillingPlanGroupResponseData.cs rename to src/SchematicHQ.Client/Types/PlanGroupResponseData.cs index f789b77..4dd3fff 100644 --- a/src/SchematicHQ.Client/Types/BillingPlanGroupResponseData.cs +++ b/src/SchematicHQ.Client/Types/PlanGroupResponseData.cs @@ -4,8 +4,11 @@ namespace SchematicHQ.Client; -public record BillingPlanGroupResponseData +public record PlanGroupResponseData { + [JsonPropertyName("add_on_ids")] + public IEnumerable AddOnIds { get; init; } = new List(); + [JsonPropertyName("default_plan_id")] public string? DefaultPlanId { get; init; } @@ -14,4 +17,10 @@ public record BillingPlanGroupResponseData [JsonPropertyName("plan_ids")] public IEnumerable PlanIds { get; init; } = new List(); + + [JsonPropertyName("trial_days")] + public int? TrialDays { get; init; } + + [JsonPropertyName("trial_payment_method_required")] + public bool? TrialPaymentMethodRequired { get; init; } } diff --git a/src/SchematicHQ.Client/Types/PreviewObjectResponseData.cs b/src/SchematicHQ.Client/Types/PreviewObjectResponseData.cs new file mode 100644 index 0000000..32e35cc --- /dev/null +++ b/src/SchematicHQ.Client/Types/PreviewObjectResponseData.cs @@ -0,0 +1,20 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record PreviewObjectResponseData +{ + [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; } +} diff --git a/src/SchematicHQ.Client/Types/PreviewSubscriptionChangeResponseData.cs b/src/SchematicHQ.Client/Types/PreviewSubscriptionChangeResponseData.cs new file mode 100644 index 0000000..78815dd --- /dev/null +++ b/src/SchematicHQ.Client/Types/PreviewSubscriptionChangeResponseData.cs @@ -0,0 +1,32 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record PreviewSubscriptionChangeResponseData +{ + [JsonPropertyName("amount_off")] + public required int AmountOff { get; init; } + + [JsonPropertyName("due_now")] + public required int DueNow { get; init; } + + [JsonPropertyName("new_charges")] + public required int NewCharges { get; init; } + + [JsonPropertyName("percent_off")] + public required double PercentOff { get; init; } + + [JsonPropertyName("period_start")] + public required DateTime PeriodStart { get; init; } + + [JsonPropertyName("promo_code_applied")] + public required bool PromoCodeApplied { get; init; } + + [JsonPropertyName("proration")] + public required int Proration { get; init; } + + [JsonPropertyName("trial_end")] + public DateTime? TrialEnd { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/RuleConditionDetailResponseData.cs b/src/SchematicHQ.Client/Types/RuleConditionDetailResponseData.cs index 2bf1f57..f5b0c2d 100644 --- a/src/SchematicHQ.Client/Types/RuleConditionDetailResponseData.cs +++ b/src/SchematicHQ.Client/Types/RuleConditionDetailResponseData.cs @@ -37,6 +37,9 @@ public record RuleConditionDetailResponseData [JsonPropertyName("metric_period")] public string? MetricPeriod { get; init; } + [JsonPropertyName("metric_period_month_reset")] + public string? MetricPeriodMonthReset { get; init; } + [JsonPropertyName("metric_value")] public int? MetricValue { get; init; } @@ -50,8 +53,8 @@ public record RuleConditionDetailResponseData public IEnumerable ResourceIds { get; init; } = new List(); [JsonPropertyName("resources")] - public IEnumerable Resources { get; init; } = - new List(); + public IEnumerable Resources { get; init; } = + new List(); [JsonPropertyName("rule_id")] public required string RuleId { get; init; } diff --git a/src/SchematicHQ.Client/Types/RuleConditionResponseData.cs b/src/SchematicHQ.Client/Types/RuleConditionResponseData.cs index 3882a75..ce1e2c1 100644 --- a/src/SchematicHQ.Client/Types/RuleConditionResponseData.cs +++ b/src/SchematicHQ.Client/Types/RuleConditionResponseData.cs @@ -33,6 +33,9 @@ public record RuleConditionResponseData [JsonPropertyName("metric_period")] public string? MetricPeriod { get; init; } + [JsonPropertyName("metric_period_month_reset")] + public string? MetricPeriodMonthReset { get; init; } + [JsonPropertyName("metric_value")] public int? MetricValue { get; init; } diff --git a/src/SchematicHQ.Client/Types/RulesDetailResponseData.cs b/src/SchematicHQ.Client/Types/RulesDetailResponseData.cs index ca61084..8fb1356 100644 --- a/src/SchematicHQ.Client/Types/RulesDetailResponseData.cs +++ b/src/SchematicHQ.Client/Types/RulesDetailResponseData.cs @@ -7,7 +7,7 @@ namespace SchematicHQ.Client; public record RulesDetailResponseData { - [JsonPropertyName("Flag")] + [JsonPropertyName("flag")] public FlagResponseData? Flag { get; init; } [JsonPropertyName("rules")] diff --git a/src/SchematicHQ.Client/Types/StripeEmbedInfo.cs b/src/SchematicHQ.Client/Types/StripeEmbedInfo.cs new file mode 100644 index 0000000..f546011 --- /dev/null +++ b/src/SchematicHQ.Client/Types/StripeEmbedInfo.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record StripeEmbedInfo +{ + [JsonPropertyName("publishable_key")] + public required string PublishableKey { get; init; } + + [JsonPropertyName("setup_intent_client_secret")] + public string? SetupIntentClientSecret { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/UpdateAddOnRequestBody.cs b/src/SchematicHQ.Client/Types/UpdateAddOnRequestBody.cs new file mode 100644 index 0000000..6abbe5d --- /dev/null +++ b/src/SchematicHQ.Client/Types/UpdateAddOnRequestBody.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record UpdateAddOnRequestBody +{ + [JsonPropertyName("add_on_id")] + public required string AddOnId { get; init; } + + [JsonPropertyName("price_id")] + public required string PriceId { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/UpdateReqCommon.cs b/src/SchematicHQ.Client/Types/UpdateEntitlementReqCommon.cs similarity index 56% rename from src/SchematicHQ.Client/Types/UpdateReqCommon.cs rename to src/SchematicHQ.Client/Types/UpdateEntitlementReqCommon.cs index 385b76c..cd57234 100644 --- a/src/SchematicHQ.Client/Types/UpdateReqCommon.cs +++ b/src/SchematicHQ.Client/Types/UpdateEntitlementReqCommon.cs @@ -5,10 +5,13 @@ namespace SchematicHQ.Client; -public record UpdateReqCommon +public record UpdateEntitlementReqCommon { [JsonPropertyName("metric_period")] - public UpdateReqCommonMetricPeriod? MetricPeriod { get; init; } + public UpdateEntitlementReqCommonMetricPeriod? MetricPeriod { get; init; } + + [JsonPropertyName("metric_period_month_reset")] + public UpdateEntitlementReqCommonMetricPeriodMonthReset? MetricPeriodMonthReset { get; init; } [JsonPropertyName("value_bool")] public bool? ValueBool { get; init; } @@ -20,5 +23,5 @@ public record UpdateReqCommon public string? ValueTraitId { get; init; } [JsonPropertyName("value_type")] - public required UpdateReqCommonValueType ValueType { get; init; } + public required UpdateEntitlementReqCommonValueType ValueType { get; init; } } diff --git a/src/SchematicHQ.Client/Types/CreateReqCommonMetricPeriod.cs b/src/SchematicHQ.Client/Types/UpdateEntitlementReqCommonMetricPeriod.cs similarity index 65% rename from src/SchematicHQ.Client/Types/CreateReqCommonMetricPeriod.cs rename to src/SchematicHQ.Client/Types/UpdateEntitlementReqCommonMetricPeriod.cs index 1510087..2cf8321 100644 --- a/src/SchematicHQ.Client/Types/CreateReqCommonMetricPeriod.cs +++ b/src/SchematicHQ.Client/Types/UpdateEntitlementReqCommonMetricPeriod.cs @@ -7,9 +7,12 @@ namespace SchematicHQ.Client; -[JsonConverter(typeof(StringEnumSerializer))] -public enum CreateReqCommonMetricPeriod +[JsonConverter(typeof(StringEnumSerializer))] +public enum UpdateEntitlementReqCommonMetricPeriod { + [EnumMember(Value = "all_time")] + AllTime, + [EnumMember(Value = "current_month")] CurrentMonth, diff --git a/src/SchematicHQ.Client/Types/UpdateEntitlementReqCommonMetricPeriodMonthReset.cs b/src/SchematicHQ.Client/Types/UpdateEntitlementReqCommonMetricPeriodMonthReset.cs new file mode 100644 index 0000000..6888d78 --- /dev/null +++ b/src/SchematicHQ.Client/Types/UpdateEntitlementReqCommonMetricPeriodMonthReset.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 UpdateEntitlementReqCommonMetricPeriodMonthReset +{ + [EnumMember(Value = "first_of_month")] + FirstOfMonth, + + [EnumMember(Value = "billing_cycle")] + BillingCycle +} diff --git a/src/SchematicHQ.Client/Types/CreateReqCommonValueType.cs b/src/SchematicHQ.Client/Types/UpdateEntitlementReqCommonValueType.cs similarity index 74% rename from src/SchematicHQ.Client/Types/CreateReqCommonValueType.cs rename to src/SchematicHQ.Client/Types/UpdateEntitlementReqCommonValueType.cs index d7b21c2..3559e6c 100644 --- a/src/SchematicHQ.Client/Types/CreateReqCommonValueType.cs +++ b/src/SchematicHQ.Client/Types/UpdateEntitlementReqCommonValueType.cs @@ -7,8 +7,8 @@ namespace SchematicHQ.Client; -[JsonConverter(typeof(StringEnumSerializer))] -public enum CreateReqCommonValueType +[JsonConverter(typeof(StringEnumSerializer))] +public enum UpdateEntitlementReqCommonValueType { [EnumMember(Value = "boolean")] Boolean, diff --git a/src/SchematicHQ.Client/Types/UpdatePayInAdvanceRequestBody.cs b/src/SchematicHQ.Client/Types/UpdatePayInAdvanceRequestBody.cs new file mode 100644 index 0000000..8c0dbf1 --- /dev/null +++ b/src/SchematicHQ.Client/Types/UpdatePayInAdvanceRequestBody.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +#nullable enable + +namespace SchematicHQ.Client; + +public record UpdatePayInAdvanceRequestBody +{ + [JsonPropertyName("price_id")] + public required string PriceId { get; init; } + + [JsonPropertyName("quantity")] + public required int Quantity { get; init; } +} diff --git a/src/SchematicHQ.Client/Types/UsageBasedEntitlementResponseData.cs b/src/SchematicHQ.Client/Types/UsageBasedEntitlementResponseData.cs new file mode 100644 index 0000000..4a29966 --- /dev/null +++ b/src/SchematicHQ.Client/Types/UsageBasedEntitlementResponseData.cs @@ -0,0 +1,33 @@ +using System.Text.Json.Serialization; +using SchematicHQ.Client; + +#nullable enable + +namespace SchematicHQ.Client; + +public record UsageBasedEntitlementResponseData +{ + [JsonPropertyName("feature_id")] + public required string FeatureId { get; init; } + + [JsonPropertyName("metered_price")] + public BillingPriceView? MeteredPrice { get; init; } + + [JsonPropertyName("metric_period")] + public string? MetricPeriod { get; init; } + + [JsonPropertyName("metric_period_month_reset")] + public string? MetricPeriodMonthReset { get; init; } + + [JsonPropertyName("price_behavior")] + public string? PriceBehavior { get; init; } + + [JsonPropertyName("value_bool")] + public bool? ValueBool { get; init; } + + [JsonPropertyName("value_numeric")] + public int? ValueNumeric { get; init; } + + [JsonPropertyName("value_type")] + public required string ValueType { get; init; } +} diff --git a/src/SchematicHQ.Client/Webhooks/Requests/CountWebhookEventsRequest.cs b/src/SchematicHQ.Client/Webhooks/Requests/CountWebhookEventsRequest.cs index d0091e2..ca1c982 100644 --- a/src/SchematicHQ.Client/Webhooks/Requests/CountWebhookEventsRequest.cs +++ b/src/SchematicHQ.Client/Webhooks/Requests/CountWebhookEventsRequest.cs @@ -2,12 +2,12 @@ namespace SchematicHQ.Client; public record CountWebhookEventsRequest { - public string? WebhookId { get; init; } - public string? Ids { get; init; } public string? Q { get; init; } + public string? WebhookId { get; init; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Webhooks/Requests/ListWebhookEventsRequest.cs b/src/SchematicHQ.Client/Webhooks/Requests/ListWebhookEventsRequest.cs index 4311988..83a7f31 100644 --- a/src/SchematicHQ.Client/Webhooks/Requests/ListWebhookEventsRequest.cs +++ b/src/SchematicHQ.Client/Webhooks/Requests/ListWebhookEventsRequest.cs @@ -2,12 +2,12 @@ namespace SchematicHQ.Client; public record ListWebhookEventsRequest { - public string? WebhookId { get; init; } - public string? Ids { get; init; } public string? Q { get; init; } + public string? WebhookId { get; init; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Webhooks/WebhooksClient.cs b/src/SchematicHQ.Client/Webhooks/WebhooksClient.cs index 1538de3..01273e2 100644 --- a/src/SchematicHQ.Client/Webhooks/WebhooksClient.cs +++ b/src/SchematicHQ.Client/Webhooks/WebhooksClient.cs @@ -21,10 +21,6 @@ ListWebhookEventsRequest request ) { var _query = new Dictionary() { }; - if (request.WebhookId != null) - { - _query["webhook_id"] = request.WebhookId; - } if (request.Ids != null) { _query["ids"] = request.Ids; @@ -33,6 +29,10 @@ ListWebhookEventsRequest request { _query["q"] = request.Q; } + if (request.WebhookId != null) + { + _query["webhook_id"] = request.WebhookId; + } if (request.Limit != null) { _query["limit"] = request.Limit.ToString(); @@ -79,10 +79,6 @@ CountWebhookEventsRequest request ) { var _query = new Dictionary() { }; - if (request.WebhookId != null) - { - _query["webhook_id"] = request.WebhookId; - } if (request.Ids != null) { _query["ids"] = request.Ids; @@ -91,6 +87,10 @@ CountWebhookEventsRequest request { _query["q"] = request.Q; } + if (request.WebhookId != null) + { + _query["webhook_id"] = request.WebhookId; + } if (request.Limit != null) { _query["limit"] = request.Limit.ToString();